summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-07-18 23:04:24 +0200
committerSergei Golubchik <sergii@pisem.net>2011-07-18 23:04:24 +0200
commit4e46d8e5bff140f2549841167dc4b65a3c0a645d (patch)
treec6612dcc1d0fbd801c084e6c36307d9e5913a293
parent9a02c69f5c6766eaf552284a2a4dd0f1d26ecd2c (diff)
parentd4d7a8fa62c406be73f6c0f6d75e795293db548b (diff)
downloadmariadb-git-4e46d8e5bff140f2549841167dc4b65a3c0a645d.tar.gz
merge with xtradb-5.5.15
fix test cases
-rwxr-xr-xBUILD/SETUP.sh2
-rwxr-xr-xBUILD/compile-innodb21
-rwxr-xr-xBUILD/compile-innodb-debug24
-rw-r--r--include/my_valgrind.h2
-rw-r--r--libmysqld/CMakeLists.txt2
-rw-r--r--mysql-test/include/have_innodb.opt2
-rw-r--r--mysql-test/include/have_xtradb.inc1
-rw-r--r--mysql-test/include/mix1.inc5
-rw-r--r--mysql-test/include/mysqld--help.inc4
-rw-r--r--mysql-test/include/percona_query_cache_with_comments.inc95
-rw-r--r--mysql-test/include/percona_query_response_time_sleep.inc19
-rw-r--r--mysql-test/r/information_schema.result6
-rw-r--r--mysql-test/r/information_schema_all_engines.result176
-rw-r--r--mysql-test/r/innodb-analyze.result2
-rw-r--r--mysql-test/r/innodb-consistent.result35
-rw-r--r--mysql-test/r/innodb-index_ucs2.result116
-rw-r--r--mysql-test/r/innodb-replace.result13
-rw-r--r--mysql-test/r/innodb-timeout.result46
-rw-r--r--mysql-test/r/innodb_bug34053.result1
-rw-r--r--mysql-test/r/innodb_bug34300.result4
-rw-r--r--mysql-test/r/innodb_bug35220.result1
-rw-r--r--mysql-test/r/innodb_bug36169.result2
-rw-r--r--mysql-test/r/innodb_bug40360.result4
-rw-r--r--mysql-test/r/innodb_bug41904.result4
-rw-r--r--mysql-test/r/innodb_bug44571.result7
-rw-r--r--mysql-test/r/innodb_bug46676.result9
-rw-r--r--mysql-test/r/innodb_information_schema.result23
-rw-r--r--mysql-test/r/innodb_trx_weight.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result2
-rw-r--r--mysql-test/suite/pbxt/r/mysqlshow.result44
-rw-r--r--mysql-test/suite/pbxt/t/mysqlshow.test1
-rw-r--r--mysql-test/suite/percona/disabled.def20
-rw-r--r--mysql-test/suite/percona/grep.inc16
-rw-r--r--mysql-test/suite/percona/have_response_time_distribution.inc4
-rw-r--r--mysql-test/suite/percona/percona_bug643149.result21
-rw-r--r--mysql-test/suite/percona/percona_bug643149.test49
-rw-r--r--mysql-test/suite/percona/percona_innodb_buffer_pool_shm.result4
-rw-r--r--mysql-test/suite/percona/percona_innodb_buffer_pool_shm.test18
-rw-r--r--mysql-test/suite/percona/percona_innodb_deadlock_count.result10
-rw-r--r--mysql-test/suite/percona/percona_innodb_deadlock_count.test22
-rw-r--r--mysql-test/suite/percona/percona_log_connection_error-master.opt2
-rw-r--r--mysql-test/suite/percona/percona_log_connection_error.test4
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test141
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements.result86
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements.test162
-rw-r--r--mysql-test/suite/percona/percona_log_warnings_suppress-master.opt (renamed from mysql-test/suite/percona/percona_suppress_log_warning_1592-master.opt)0
-rw-r--r--mysql-test/suite/percona/percona_log_warnings_suppress.result31
-rw-r--r--mysql-test/suite/percona/percona_log_warnings_suppress.test (renamed from mysql-test/suite/percona/percona_suppress_log_warning_1592.test)17
-rw-r--r--mysql-test/suite/percona/percona_processlist_row_stats.result74
-rw-r--r--mysql-test/suite/percona/percona_processlist_row_stats.test92
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments.inc95
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments.test1
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_begin.inc (renamed from mysql-test/include/percona_query_cache_with_comments_begin.inc)2
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_clear.inc (renamed from mysql-test/include/percona_query_cache_with_comments_clear.inc)0
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_end.inc (renamed from mysql-test/include/percona_query_cache_with_comments_end.inc)0
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_eval.inc (renamed from mysql-test/include/percona_query_cache_with_comments_eval.inc)4
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_show.inc (renamed from mysql-test/include/percona_query_cache_with_comments_show.inc)0
-rw-r--r--mysql-test/suite/percona/percona_query_response_time-replication.result30
-rw-r--r--mysql-test/suite/percona/percona_query_response_time-replication.test21
-rw-r--r--mysql-test/suite/percona/percona_query_response_time-stored.result50
-rw-r--r--mysql-test/suite/percona/percona_query_response_time-stored.test42
-rw-r--r--mysql-test/suite/percona/percona_query_response_time.result433
-rw-r--r--mysql-test/suite/percona/percona_query_response_time.test30
-rw-r--r--mysql-test/suite/percona/percona_query_response_time_flush.inc (renamed from mysql-test/include/percona_query_response_time_flush.inc)0
-rw-r--r--mysql-test/suite/percona/percona_query_response_time_show.inc (renamed from mysql-test/include/percona_query_response_time_show.inc)0
-rw-r--r--mysql-test/suite/percona/percona_query_response_time_sleep.inc19
-rw-r--r--mysql-test/suite/percona/percona_server_variables.inc3
-rw-r--r--mysql-test/suite/percona/percona_server_variables.result342
-rw-r--r--mysql-test/suite/percona/percona_server_variables.test7
-rw-r--r--mysql-test/suite/percona/percona_server_variables_debug.result371
-rw-r--r--mysql-test/suite/percona/percona_server_variables_debug.test2
-rw-r--r--mysql-test/suite/percona/percona_server_variables_release.result368
-rw-r--r--mysql-test/suite/percona/percona_server_variables_release.test2
-rw-r--r--mysql-test/suite/percona/percona_show_slave_status_nolock.result21
-rw-r--r--mysql-test/suite/percona/percona_show_slave_status_nolock.test53
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_filter-master.opt (renamed from mysql-test/suite/percona/percona_slow_query_log-log_slow_filter-master.opt)2
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_filter.result (renamed from mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.result)4
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_filter.test (renamed from mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test)17
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl.result3
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl.test1
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl.result9
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl.test3
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-master.opt (renamed from mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity-master.opt)2
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity.result9
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity.test12
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-long_query_time-master.opt (renamed from mysql-test/suite/percona/percona_slow_query_log-long_query_time-master.opt)2
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-long_query_time.result24
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-long_query_time.test23
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended-master.opt (renamed from mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log-master.opt)2
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended.result13
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended.test23
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-min_examined_row_limit-master.opt (renamed from mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit-master.opt)2
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-min_examined_row_limit.result (renamed from mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.result)4
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-min_examined_row_limit.test (renamed from mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test)16
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats-master.opt (renamed from mysql-test/suite/percona/percona_slave_innodb_stats-master.opt)0
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats-slave.opt (renamed from mysql-test/suite/percona/percona_slave_innodb_stats-slave.opt)0
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats.result (renamed from mysql-test/suite/percona/percona_slave_innodb_stats.result)13
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats.test (renamed from mysql-test/suite/percona/percona_slave_innodb_stats.test)14
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time-master.opt (renamed from mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-master.opt)2
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time-slave.opt (renamed from mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-slave.opt)2
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time.result (renamed from mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.result)56
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time.test107
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_statements-master.opt (renamed from mysql-test/suite/percona/percona_log_slow_slave_statements-master.opt)2
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_statements-slave.opt (renamed from mysql-test/suite/percona/percona_log_slow_slave_statements-slave.opt)2
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_statements.result94
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slave_statements.test133
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.result3
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.test1
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl.result3
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl.test1
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-use_global_control-master.opt (renamed from mysql-test/suite/percona/percona_slow_query_log-control_global_slow-master.opt)2
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-use_global_control.result12
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-use_global_control.test12
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time.result46
-rw-r--r--mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time.test40
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-control_global_slow.result12
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test14
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.result9
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test15
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-long_query_time.result21
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-long_query_time.test18
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.result12
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test21
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.result59
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test43
-rw-r--r--mysql-test/suite/percona/percona_sql_no_fcache.test2
-rw-r--r--mysql-test/suite/percona/percona_status_wait_query_cache_mutex.result10
-rw-r--r--mysql-test/suite/percona/percona_status_wait_query_cache_mutex.test4
-rw-r--r--mysql-test/suite/percona/percona_suppress_log_warning_1592.result28
-rw-r--r--mysql-test/suite/percona/percona_xtradb_bug317074.result1
-rw-r--r--mysql-test/suite/percona/percona_xtradb_bug317074.test4
-rw-r--r--mysql-test/suite/percona/userstat_bug602047.result15
-rw-r--r--mysql-test/suite/percona/userstat_bug602047.test12
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_method_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_adaptive_hash_index_partitions_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_buffer_pool_restore_at_startup_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_buffer_pool_shm_checksum_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_buffer_pool_shm_key_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_checkpoint_age_target_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_corrupt_table_action_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_dict_size_limit_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_doublewrite_file_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_fast_checksum_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_file_format_max_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result5
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_flush_neighbor_pages_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_ibuf_accel_rate_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_ibuf_active_contract_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_ibuf_max_size_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_import_table_from_xtrabackup_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_large_prefix_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_lazy_drop_table_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_log_block_size_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_page_size_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_read_ahead_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_recovery_stats_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_recovery_update_relay_log_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_show_locks_held_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_show_verbose_locks_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_stats_auto_update_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_stats_method_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_stats_update_need_lock_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_thread_concurrency_timer_based_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_use_global_flush_log_at_trx_commit_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_use_sys_stats_table_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_method_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_partitions_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_restore_at_startup_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_shm_checksum_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_shm_key_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_checkpoint_age_target_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_corrupt_table_action_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_dict_size_limit_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_doublewrite_file_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fast_checksum_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_file_format_max_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test5
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_flush_neighbor_pages_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ibuf_accel_rate_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ibuf_active_contract_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ibuf_max_size_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_import_table_from_xtrabackup_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_large_prefix_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_lazy_drop_table_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_log_block_size_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_page_size_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_read_ahead_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_recovery_stats_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_recovery_update_relay_log_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_show_locks_held_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_show_verbose_locks_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_auto_update_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_update_need_lock_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_thread_concurrency_timer_based_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_use_global_flush_log_at_trx_commit_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_use_sys_stats_table_basic.test1
-rw-r--r--mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result20
-rw-r--r--mysql-test/suite/vcol/r/vcol_select_innodb.result20
-rw-r--r--mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result4
-rw-r--r--mysql-test/suite/vcol/r/vcol_view_innodb.result4
-rw-r--r--mysql-test/t/information_schema.test6
-rw-r--r--mysql-test/t/innodb-analyze.test65
-rw-r--r--mysql-test/t/innodb-consistent-master.opt1
-rw-r--r--mysql-test/t/innodb-consistent.test58
-rw-r--r--mysql-test/t/innodb-index_ucs2.test5
-rw-r--r--mysql-test/t/innodb-replace.test22
-rw-r--r--mysql-test/t/innodb-timeout.test69
-rw-r--r--mysql-test/t/innodb_bug34053.test50
-rw-r--r--mysql-test/t/innodb_bug34300.test36
-rw-r--r--mysql-test/t/innodb_bug35220.test16
-rw-r--r--mysql-test/t/innodb_bug36169.test1159
-rw-r--r--mysql-test/t/innodb_bug40360.test16
-rw-r--r--mysql-test/t/innodb_bug41904.test14
-rw-r--r--mysql-test/t/innodb_bug44571.test13
-rw-r--r--mysql-test/t/innodb_bug46676.test16
-rw-r--r--mysql-test/t/innodb_information_schema.test149
-rw-r--r--mysql-test/t/innodb_trx_weight.test108
-rw-r--r--mysql-test/t/subselect_sj2.test7
-rw-r--r--sql/slave.cc8
-rw-r--r--storage/xtradb/CMakeLists.txt (renamed from storage/xtradb/CMakeLists.txt.disabled)56
-rw-r--r--storage/xtradb/COPYING.Sun_Microsystems31
-rw-r--r--storage/xtradb/ChangeLog1916
-rw-r--r--storage/xtradb/Doxyfile2
-rw-r--r--storage/xtradb/btr/btr0btr.c615
-rw-r--r--storage/xtradb/btr/btr0cur.c1529
-rw-r--r--storage/xtradb/btr/btr0pcur.c2
-rw-r--r--storage/xtradb/btr/btr0sea.c534
-rw-r--r--storage/xtradb/buf/buf0buddy.c287
-rw-r--r--storage/xtradb/buf/buf0buf.c3174
-rw-r--r--storage/xtradb/buf/buf0flu.c1211
-rw-r--r--storage/xtradb/buf/buf0lru.c955
-rw-r--r--storage/xtradb/buf/buf0rea.c99
-rw-r--r--storage/xtradb/build/debian/README.Maintainer116
-rw-r--r--storage/xtradb/build/debian/additions/Docs__Images__Makefile.in6
-rw-r--r--storage/xtradb/build/debian/additions/Docs__Makefile.in6
-rw-r--r--storage/xtradb/build/debian/additions/debian-start31
-rw-r--r--storage/xtradb/build/debian/additions/debian-start.inc.sh72
-rw-r--r--storage/xtradb/build/debian/additions/echo_stderr2
-rw-r--r--storage/xtradb/build/debian/additions/innotop/InnoDBParser.pm1089
-rw-r--r--storage/xtradb/build/debian/additions/innotop/changelog.innotop318
-rw-r--r--storage/xtradb/build/debian/additions/innotop/innotop9485
-rw-r--r--storage/xtradb/build/debian/additions/innotop/innotop.12086
-rw-r--r--storage/xtradb/build/debian/additions/msql2mysql.116
-rw-r--r--storage/xtradb/build/debian/additions/my.cnf129
-rw-r--r--storage/xtradb/build/debian/additions/my_print_defaults.116
-rw-r--r--storage/xtradb/build/debian/additions/myisam_ftdump.116
-rw-r--r--storage/xtradb/build/debian/additions/myisamchk.117
-rw-r--r--storage/xtradb/build/debian/additions/myisamlog.116
-rw-r--r--storage/xtradb/build/debian/additions/myisampack.119
-rw-r--r--storage/xtradb/build/debian/additions/mysql-server.lintian-overrides2
-rw-r--r--storage/xtradb/build/debian/additions/mysql_config.117
-rw-r--r--storage/xtradb/build/debian/additions/mysql_convert_table_format.117
-rw-r--r--storage/xtradb/build/debian/additions/mysql_find_rows.118
-rw-r--r--storage/xtradb/build/debian/additions/mysql_fix_extensions.118
-rw-r--r--storage/xtradb/build/debian/additions/mysql_install_db.116
-rw-r--r--storage/xtradb/build/debian/additions/mysql_secure_installation.117
-rw-r--r--storage/xtradb/build/debian/additions/mysql_setpermission.123
-rw-r--r--storage/xtradb/build/debian/additions/mysql_tableinfo.1322
-rw-r--r--storage/xtradb/build/debian/additions/mysql_waitpid.120
-rw-r--r--storage/xtradb/build/debian/additions/mysqlbinlog.117
-rw-r--r--storage/xtradb/build/debian/additions/mysqlbug.114
-rw-r--r--storage/xtradb/build/debian/additions/mysqlcheck.128
-rw-r--r--storage/xtradb/build/debian/additions/mysqld_safe_syslog.cnf2
-rw-r--r--storage/xtradb/build/debian/additions/mysqldumpslow.150
-rw-r--r--storage/xtradb/build/debian/additions/mysqlimport.120
-rw-r--r--storage/xtradb/build/debian/additions/mysqlmanager.149
-rw-r--r--storage/xtradb/build/debian/additions/mysqlreport1298
-rw-r--r--storage/xtradb/build/debian/additions/mysqlreport.1180
-rw-r--r--storage/xtradb/build/debian/additions/mysqltest.116
-rw-r--r--storage/xtradb/build/debian/additions/pack_isam.119
-rw-r--r--storage/xtradb/build/debian/additions/resolve_stack_dump.116
-rw-r--r--storage/xtradb/build/debian/additions/resolveip.116
-rw-r--r--storage/xtradb/build/debian/changelog4186
-rw-r--r--storage/xtradb/build/debian/compat1
-rw-r--r--storage/xtradb/build/debian/control118
-rw-r--r--storage/xtradb/build/debian/copyright169
-rw-r--r--storage/xtradb/build/debian/libpercona-xtradb-client-dev.README.Maintainer4
-rw-r--r--storage/xtradb/build/debian/libpercona-xtradb-client-dev.dirs2
-rw-r--r--storage/xtradb/build/debian/libpercona-xtradb-client-dev.docs1
-rw-r--r--storage/xtradb/build/debian/libpercona-xtradb-client-dev.examples1
-rw-r--r--storage/xtradb/build/debian/libpercona-xtradb-client-dev.files7
-rw-r--r--storage/xtradb/build/debian/libpercona-xtradb-client-dev.links2
-rw-r--r--storage/xtradb/build/debian/libpercona-xtradb-client16.dirs1
-rw-r--r--storage/xtradb/build/debian/libpercona-xtradb-client16.docs1
-rw-r--r--storage/xtradb/build/debian/libpercona-xtradb-client16.files1
-rw-r--r--storage/xtradb/build/debian/libpercona-xtradb-client16.postinst12
-rw-r--r--storage/xtradb/build/debian/patches/00list6
-rw-r--r--storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Images_Makefile.in.dpatch776
-rw-r--r--storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Makefile.in.dpatch776
-rw-r--r--storage/xtradb/build/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch29
-rw-r--r--storage/xtradb/build/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch43
-rw-r--r--storage/xtradb/build/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch20
-rw-r--r--storage/xtradb/build/debian/patches/44_scripts__mysql_config__libs.dpatch24
-rw-r--r--storage/xtradb/build/debian/patches/50_mysql-test__db_test.dpatch23
-rw-r--r--storage/xtradb/build/debian/patches/60_percona_support.dpatch16
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-client-5.1.README.Debian4
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-client-5.1.dirs3
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-client-5.1.docs3
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-client-5.1.files39
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-client-5.1.links3
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-client-5.1.lintian-overrides3
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-client-5.1.menu3
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-common.dirs1
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-common.files2
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-common.lintian-overrides2
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-common.postrm7
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.NEWS34
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.README.Debian109
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.config46
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.dirs9
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.docs1
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.files53
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.links2
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.lintian-overrides4
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.paranoid9
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.server32
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.workstation32
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.mysql.init182
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.percona-xtradb-server.logrotate27
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.postinst277
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.postrm83
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.preinst186
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.prerm8
-rw-r--r--storage/xtradb/build/debian/percona-xtradb-server-5.1.templates90
-rw-r--r--storage/xtradb/build/debian/po/POTFILES.in1
-rw-r--r--storage/xtradb/build/debian/po/ar.po267
-rw-r--r--storage/xtradb/build/debian/po/ca.po342
-rw-r--r--storage/xtradb/build/debian/po/cs.po361
-rw-r--r--storage/xtradb/build/debian/po/da.po397
-rw-r--r--storage/xtradb/build/debian/po/de.po277
-rw-r--r--storage/xtradb/build/debian/po/es.po405
-rw-r--r--storage/xtradb/build/debian/po/eu.po295
-rw-r--r--storage/xtradb/build/debian/po/fr.po274
-rw-r--r--storage/xtradb/build/debian/po/gl.po264
-rw-r--r--storage/xtradb/build/debian/po/it.po266
-rw-r--r--storage/xtradb/build/debian/po/ja.po394
-rw-r--r--storage/xtradb/build/debian/po/nb.po297
-rw-r--r--storage/xtradb/build/debian/po/nl.po302
-rw-r--r--storage/xtradb/build/debian/po/pt.po322
-rw-r--r--storage/xtradb/build/debian/po/pt_BR.po458
-rw-r--r--storage/xtradb/build/debian/po/ro.po319
-rw-r--r--storage/xtradb/build/debian/po/ru.po305
-rw-r--r--storage/xtradb/build/debian/po/sv.po400
-rw-r--r--storage/xtradb/build/debian/po/templates.pot187
-rw-r--r--storage/xtradb/build/debian/po/tr.po342
-rwxr-xr-xstorage/xtradb/build/debian/rules322
-rw-r--r--storage/xtradb/build/debian/source.lintian-overrides2
-rw-r--r--storage/xtradb/build/debian/watch3
-rw-r--r--storage/xtradb/build/percona-sql.spec1644
-rw-r--r--storage/xtradb/data/data0data.c36
-rw-r--r--storage/xtradb/data/data0type.c11
-rw-r--r--storage/xtradb/dict/dict0boot.c59
-rw-r--r--storage/xtradb/dict/dict0crea.c41
-rw-r--r--storage/xtradb/dict/dict0dict.c559
-rw-r--r--storage/xtradb/dict/dict0load.c1488
-rw-r--r--storage/xtradb/dict/dict0mem.c131
-rw-r--r--storage/xtradb/eval/eval0eval.c7
-rw-r--r--storage/xtradb/fil/fil0fil.c916
-rw-r--r--storage/xtradb/fsp/fsp0fsp.c218
-rw-r--r--storage/xtradb/ha/ha0ha.c3
-rw-r--r--storage/xtradb/ha/hash0hash.c72
-rw-r--r--storage/xtradb/handler/ha_innodb.cc2568
-rw-r--r--storage/xtradb/handler/ha_innodb.h24
-rw-r--r--storage/xtradb/handler/handler0alter.cc368
-rw-r--r--storage/xtradb/handler/i_s.cc4847
-rw-r--r--storage/xtradb/handler/i_s.h60
-rw-r--r--storage/xtradb/handler/innodb_patch_info.h52
-rw-r--r--storage/xtradb/handler/mysql_addons.cc42
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.c2624
-rw-r--r--storage/xtradb/include/btr0btr.h219
-rw-r--r--storage/xtradb/include/btr0btr.ic45
-rw-r--r--storage/xtradb/include/btr0cur.h168
-rw-r--r--storage/xtradb/include/btr0pcur.h40
-rw-r--r--storage/xtradb/include/btr0pcur.ic45
-rw-r--r--storage/xtradb/include/btr0sea.h51
-rw-r--r--storage/xtradb/include/btr0sea.ic73
-rw-r--r--storage/xtradb/include/btr0types.h125
-rw-r--r--storage/xtradb/include/buf0buddy.h29
-rw-r--r--storage/xtradb/include/buf0buddy.ic72
-rw-r--r--storage/xtradb/include/buf0buf.h538
-rw-r--r--storage/xtradb/include/buf0buf.ic383
-rw-r--r--storage/xtradb/include/buf0flu.h95
-rw-r--r--storage/xtradb/include/buf0flu.ic69
-rw-r--r--storage/xtradb/include/buf0lru.h59
-rw-r--r--storage/xtradb/include/buf0rea.h10
-rw-r--r--storage/xtradb/include/buf0types.h4
-rw-r--r--storage/xtradb/include/data0data.h13
-rw-r--r--storage/xtradb/include/data0data.ic26
-rw-r--r--storage/xtradb/include/data0type.h52
-rw-r--r--storage/xtradb/include/data0type.ic75
-rw-r--r--storage/xtradb/include/db0err.h15
-rw-r--r--storage/xtradb/include/dict0boot.h36
-rw-r--r--storage/xtradb/include/dict0boot.ic16
-rw-r--r--storage/xtradb/include/dict0dict.h119
-rw-r--r--storage/xtradb/include/dict0dict.ic112
-rw-r--r--storage/xtradb/include/dict0load.h238
-rw-r--r--storage/xtradb/include/dict0mem.h142
-rw-r--r--storage/xtradb/include/dict0mem.ic46
-rw-r--r--storage/xtradb/include/dict0types.h22
-rw-r--r--storage/xtradb/include/fil0fil.h31
-rw-r--r--storage/xtradb/include/fsp0types.h2
-rw-r--r--storage/xtradb/include/ha_prototypes.h33
-rw-r--r--storage/xtradb/include/handler0alter.h2
-rw-r--r--storage/xtradb/include/hash0hash.h49
-rw-r--r--storage/xtradb/include/ibuf0ibuf.h136
-rw-r--r--storage/xtradb/include/ibuf0ibuf.ic64
-rw-r--r--storage/xtradb/include/lock0lock.h18
-rw-r--r--storage/xtradb/include/lock0lock.ic6
-rw-r--r--storage/xtradb/include/log0log.h25
-rw-r--r--storage/xtradb/include/log0log.ic2
-rw-r--r--storage/xtradb/include/mach0data.h112
-rw-r--r--storage/xtradb/include/mach0data.ic229
-rw-r--r--storage/xtradb/include/mem0mem.h2
-rw-r--r--storage/xtradb/include/mem0mem.ic12
-rw-r--r--storage/xtradb/include/mtr0log.h22
-rw-r--r--storage/xtradb/include/mtr0log.ic12
-rw-r--r--storage/xtradb/include/mtr0mtr.h23
-rw-r--r--storage/xtradb/include/mtr0mtr.ic15
-rw-r--r--storage/xtradb/include/mysql_addons.h33
-rw-r--r--storage/xtradb/include/os0file.h532
-rw-r--r--storage/xtradb/include/os0file.ic422
-rw-r--r--storage/xtradb/include/os0proc.h28
-rw-r--r--storage/xtradb/include/os0sync.h88
-rw-r--r--storage/xtradb/include/os0sync.ic11
-rw-r--r--storage/xtradb/include/os0thread.h40
-rw-r--r--storage/xtradb/include/page0cur.h16
-rw-r--r--storage/xtradb/include/page0page.h29
-rw-r--r--storage/xtradb/include/page0page.ic28
-rw-r--r--storage/xtradb/include/page0zip.h2
-rw-r--r--storage/xtradb/include/pars0pars.h10
-rw-r--r--storage/xtradb/include/que0que.h3
-rw-r--r--storage/xtradb/include/read0read.h11
-rw-r--r--storage/xtradb/include/read0read.ic14
-rw-r--r--storage/xtradb/include/rem0cmp.h7
-rw-r--r--storage/xtradb/include/rem0cmp.ic2
-rw-r--r--storage/xtradb/include/rem0rec.h33
-rw-r--r--storage/xtradb/include/rem0rec.ic55
-rw-r--r--storage/xtradb/include/rem0types.h20
-rw-r--r--storage/xtradb/include/row0ext.h13
-rw-r--r--storage/xtradb/include/row0ext.ic9
-rw-r--r--storage/xtradb/include/row0ins.h5
-rw-r--r--storage/xtradb/include/row0merge.h2
-rw-r--r--storage/xtradb/include/row0mysql.h27
-rw-r--r--storage/xtradb/include/row0purge.h22
-rw-r--r--storage/xtradb/include/row0row.h50
-rw-r--r--storage/xtradb/include/row0row.ic36
-rw-r--r--storage/xtradb/include/row0types.h2
-rw-r--r--storage/xtradb/include/row0upd.h47
-rw-r--r--storage/xtradb/include/row0upd.ic2
-rw-r--r--storage/xtradb/include/srv0que.h42
-rw-r--r--storage/xtradb/include/srv0srv.h272
-rw-r--r--storage/xtradb/include/srv0start.h7
-rw-r--r--storage/xtradb/include/sync0arr.h7
-rw-r--r--storage/xtradb/include/sync0rw.h366
-rw-r--r--storage/xtradb/include/sync0rw.ic257
-rw-r--r--storage/xtradb/include/sync0sync.h314
-rw-r--r--storage/xtradb/include/sync0sync.ic147
-rw-r--r--storage/xtradb/include/thr0loc.h101
-rw-r--r--storage/xtradb/include/thr0loc.ic24
-rw-r--r--storage/xtradb/include/trx0i_s.h89
-rw-r--r--storage/xtradb/include/trx0purge.h52
-rw-r--r--storage/xtradb/include/trx0rec.h4
-rw-r--r--storage/xtradb/include/trx0rec.ic4
-rw-r--r--storage/xtradb/include/trx0rseg.h40
-rw-r--r--storage/xtradb/include/trx0sys.h49
-rw-r--r--storage/xtradb/include/trx0sys.ic27
-rw-r--r--storage/xtradb/include/trx0trx.h63
-rw-r--r--storage/xtradb/include/trx0trx.ic12
-rw-r--r--storage/xtradb/include/trx0types.h13
-rw-r--r--storage/xtradb/include/trx0undo.h13
-rw-r--r--storage/xtradb/include/trx0undo.ic43
-rw-r--r--storage/xtradb/include/univ.i123
-rw-r--r--storage/xtradb/include/ut0auxconf.h14
-rw-r--r--storage/xtradb/include/ut0bh.h152
-rw-r--r--storage/xtradb/include/ut0bh.ic125
-rw-r--r--storage/xtradb/include/ut0byte.h169
-rw-r--r--storage/xtradb/include/ut0byte.ic254
-rw-r--r--storage/xtradb/include/ut0dbg.h55
-rw-r--r--storage/xtradb/include/ut0lst.h47
-rw-r--r--storage/xtradb/include/ut0mem.h2
-rw-r--r--storage/xtradb/include/ut0rbt.h169
-rw-r--r--storage/xtradb/include/ut0rnd.h8
-rw-r--r--storage/xtradb/include/ut0rnd.ic15
-rw-r--r--storage/xtradb/include/ut0ut.h43
-rw-r--r--storage/xtradb/include/ut0vec.h19
-rw-r--r--storage/xtradb/include/ut0vec.ic29
-rw-r--r--storage/xtradb/lock/lock0lock.c302
-rw-r--r--storage/xtradb/log/log0log.c228
-rw-r--r--storage/xtradb/log/log0recv.c131
-rw-r--r--storage/xtradb/mach/mach0data.c40
-rw-r--r--storage/xtradb/mem/mem0dbg.c25
-rw-r--r--storage/xtradb/mem/mem0mem.c2
-rw-r--r--storage/xtradb/mem/mem0pool.c7
-rw-r--r--storage/xtradb/mtr/mtr0log.c24
-rw-r--r--storage/xtradb/mtr/mtr0mtr.c166
-rw-r--r--storage/xtradb/os/os0file.c1458
-rw-r--r--storage/xtradb/os/os0proc.c174
-rw-r--r--storage/xtradb/os/os0sync.c602
-rw-r--r--storage/xtradb/os/os0thread.c124
-rw-r--r--storage/xtradb/page/page0cur.c78
-rw-r--r--storage/xtradb/page/page0page.c141
-rw-r--r--storage/xtradb/page/page0zip.c33
-rw-r--r--storage/xtradb/pars/pars0pars.c8
-rw-r--r--storage/xtradb/que/que0que.c6
-rw-r--r--storage/xtradb/read/read0read.c55
-rw-r--r--storage/xtradb/rem/rem0cmp.c17
-rw-r--r--storage/xtradb/rem/rem0rec.c8
-rw-r--r--storage/xtradb/row/row0ext.c19
-rw-r--r--storage/xtradb/row/row0ins.c99
-rw-r--r--storage/xtradb/row/row0merge.c228
-rw-r--r--storage/xtradb/row/row0mysql.c221
-rw-r--r--storage/xtradb/row/row0purge.c275
-rw-r--r--storage/xtradb/row/row0row.c103
-rw-r--r--storage/xtradb/row/row0sel.c434
-rw-r--r--storage/xtradb/row/row0uins.c54
-rw-r--r--storage/xtradb/row/row0umod.c138
-rw-r--r--storage/xtradb/row/row0undo.c5
-rw-r--r--storage/xtradb/row/row0upd.c538
-rw-r--r--storage/xtradb/row/row0vers.c51
-rw-r--r--storage/xtradb/scripts/install_innodb_plugins.sql17
-rw-r--r--storage/xtradb/scripts/install_innodb_plugins_win.sql17
-rw-r--r--storage/xtradb/srv/srv0que.c49
-rw-r--r--storage/xtradb/srv/srv0srv.c1353
-rw-r--r--storage/xtradb/srv/srv0start.c712
-rw-r--r--storage/xtradb/sync/sync0arr.c78
-rw-r--r--storage/xtradb/sync/sync0rw.c55
-rw-r--r--storage/xtradb/sync/sync0sync.c535
-rw-r--r--storage/xtradb/thr/thr0loc.c308
-rw-r--r--storage/xtradb/trx/trx0i_s.c158
-rw-r--r--storage/xtradb/trx/trx0purge.c600
-rw-r--r--storage/xtradb/trx/trx0rec.c144
-rw-r--r--storage/xtradb/trx/trx0roll.c95
-rw-r--r--storage/xtradb/trx/trx0rseg.c188
-rw-r--r--storage/xtradb/trx/trx0sys.c322
-rw-r--r--storage/xtradb/trx/trx0trx.c543
-rw-r--r--storage/xtradb/trx/trx0undo.c115
-rw-r--r--storage/xtradb/ut/ut0bh.c164
-rw-r--r--storage/xtradb/ut/ut0byte.c25
-rw-r--r--storage/xtradb/ut/ut0dbg.c38
-rw-r--r--storage/xtradb/ut/ut0mem.c8
-rw-r--r--storage/xtradb/ut/ut0rbt.c259
-rw-r--r--storage/xtradb/ut/ut0ut.c121
-rw-r--r--storage/xtradb/ut/ut0wqueue.c4
552 files changed, 30178 insertions, 52421 deletions
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index e0d8dad060f..e5a8255c428 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -149,7 +149,7 @@ fi
# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
# LINT_INIT(), which is only useful for silencing spurious warnings
# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
-valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
+valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify -DHAVE_valgrind "
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
valgrind_configs="--with-valgrind"
#
diff --git a/BUILD/compile-innodb b/BUILD/compile-innodb
index 82601f03ae9..988c862465d 100755
--- a/BUILD/compile-innodb
+++ b/BUILD/compile-innodb
@@ -1,24 +1,25 @@
-#! /bin/sh
+#!/bin/sh
+#
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
-# Copyright (c) 2006, 2009, Innobase Oy. 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., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
#
-path=`dirname $0`
-. "$path/SETUP.sh"
+# we assume this script is in storage/innobase/
+
+MYSQL_ROOT="$(dirname ${0})/../.."
-extra_flags="$pentium_cflags $fast_cflags -g"
-extra_configs="$pentium_configs $static_link --with-plugins=innobase"
+cd ${MYSQL_ROOT}
-. "$path/FINISH.sh"
+cmake -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON
+make -j$(nproc)
diff --git a/BUILD/compile-innodb-debug b/BUILD/compile-innodb-debug
deleted file mode 100755
index efb4abf88d5..00000000000
--- a/BUILD/compile-innodb-debug
+++ /dev/null
@@ -1,24 +0,0 @@
-#! /bin/sh
-#
-# Copyright (c) 2005, 2009, Innobase Oy. 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., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA
-#
-
-path=`dirname $0`
-. "$path/SETUP.sh" $@ --with-debug=full
-
-extra_flags="$pentium_cflags $debug_cflags"
-extra_configs="$pentium_configs $debug_configs --with-plugins=innobase"
-
-. "$path/FINISH.sh"
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index c0a6cef4b59..87e6c3192dc 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -22,7 +22,7 @@
#define IF_VALGRIND(A,B) B
#endif
-#if defined(HAVE_valgrind) && defined(HAVE_VALGRIND_MEMCHECK_H)
+#if defined(HAVE_VALGRIND) && defined(HAVE_VALGRIND_MEMCHECK_H)
# include <valgrind/memcheck.h>
# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index d83c91c5ec3..69d6a3fc615 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -44,7 +44,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql-common/client_plugin.c
../sql/password.c ../sql/discover.cc ../sql/derror.cc
../sql/field.cc ../sql/field_conv.cc
- ../sql/filesort.cc ../sql/gstream.cc
+ ../sql/filesort.cc ../sql/gstream.cc ../sql/slave.cc
../sql/handler.cc ../sql/hash_filo.cc ../sql/hostname.cc
../sql/init.cc ../sql/item_buff.cc ../sql/item_cmpfunc.cc
../sql/item.cc ../sql/item_create.cc ../sql/item_func.cc
diff --git a/mysql-test/include/have_innodb.opt b/mysql-test/include/have_innodb.opt
index 5d9121b3dc3..4fb96229a7b 100644
--- a/mysql-test/include/have_innodb.opt
+++ b/mysql-test/include/have_innodb.opt
@@ -1,2 +1,2 @@
--loose-innodb
---plugin-load=$HA_INNODB_SO
+--plugin-load=$HA_XTRADB_SO
diff --git a/mysql-test/include/have_xtradb.inc b/mysql-test/include/have_xtradb.inc
index 5832267375c..cf92b0317df 100644
--- a/mysql-test/include/have_xtradb.inc
+++ b/mysql-test/include/have_xtradb.inc
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
if (!`SELECT count(*) FROM information_schema.plugins WHERE
plugin_name = 'innodb' AND plugin_status = 'active' AND
plugin_description LIKE '%xtradb%'`){
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
index c5995987914..4614535c188 100644
--- a/mysql-test/include/mix1.inc
+++ b/mysql-test/include/mix1.inc
@@ -1120,6 +1120,11 @@ INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1);
INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
# should be range access
+
+#
+# InnoDB uses "where", while xtradb "index condition"
+#
+--replace_regex /where/index condition/
EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
# should produce '8 7 6 5 4' for a
diff --git a/mysql-test/include/mysqld--help.inc b/mysql-test/include/mysqld--help.inc
index a39615d6011..91fe9bf00e3 100644
--- a/mysql-test/include/mysqld--help.inc
+++ b/mysql-test/include/mysqld--help.inc
@@ -22,7 +22,7 @@ perl;
# Plugins which may or may not be there:
@plugins=qw/innodb ndb archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file
- thread-concurrency super-large-pages mutex-deadlock-detector null-audit maria aria pbxt oqgraph sphinx/;
+ xtradb thread-concurrency super-large-pages mutex-deadlock-detector null-audit maria aria pbxt oqgraph sphinx/;
# And substitute the content some environment variables with their
# names:
@@ -39,7 +39,7 @@ perl;
next if /Value \(after reading options\)/; # skip table header
next if /^($re1) /;
next if /^($re2)-/;
- $skip=0 if /^ -/;
+ $skip=0 if /^ -/ or /^$/;
$skip=1 if / --($re2)\b/;
y!\\!/!;
s/[ ]+/ /; # squeeze spaces to remove table formatting
diff --git a/mysql-test/include/percona_query_cache_with_comments.inc b/mysql-test/include/percona_query_cache_with_comments.inc
deleted file mode 100644
index bed87bd4c22..00000000000
--- a/mysql-test/include/percona_query_cache_with_comments.inc
+++ /dev/null
@@ -1,95 +0,0 @@
---source include/percona_query_cache_with_comments_clear.inc
-let $query=/* with comment first */select * from t1;
-eval $query;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=# with comment first
-select * from t1;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=-- with comment first
-select * from t1;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=/* with comment first and "quote" */select * from t1;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=# with comment first and "quote"
-select * from t1;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=-- with comment first and "quote"
-select * from t1;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=
- /* with comment and whitespaces first */select * from t1;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=
- # with comment and whitespaces first
-select * from t1;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=
- -- with comment and whitespaces first
-select * from t1;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $internal=* internal comment *;
-
-let $query=select * /$internal/ from t1;
---source include/percona_query_cache_with_comments_eval.inc
-let $query=select */$internal/ from t1;
---source include/percona_query_cache_with_comments_eval.inc
-let $query=select */$internal/from t1;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $internal=* internal comment with "quote" *;
-
-let $query=select * /$internal/ from t1;
---source include/percona_query_cache_with_comments_eval.inc
-let $query=select */$internal/ from t1;
---source include/percona_query_cache_with_comments_eval.inc
-let $query=select */$internal/from t1;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select * from t1
-;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select * from t1 ;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select * from t1 ;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select * from t1
-/* comment in the end */;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select * from t1
-/* *\/ */;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select * from t1
-/* comment in the end */
-;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select * from t1 #comment in the end;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select * from t1 #comment in the end
-;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select * from t1 -- comment in the end;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select * from t1 -- comment in the end
-;
---source include/percona_query_cache_with_comments_eval.inc
-
-let $query=select ' \' ' from t1;
---source include/percona_query_cache_with_comments_eval.inc
diff --git a/mysql-test/include/percona_query_response_time_sleep.inc b/mysql-test/include/percona_query_response_time_sleep.inc
deleted file mode 100644
index 40688b173b0..00000000000
--- a/mysql-test/include/percona_query_response_time_sleep.inc
+++ /dev/null
@@ -1,19 +0,0 @@
-SELECT SLEEP(0.31);
-SELECT SLEEP(0.32);
-SELECT SLEEP(0.33);
-SELECT SLEEP(0.34);
-SELECT SLEEP(0.35);
-SELECT SLEEP(0.36);
-SELECT SLEEP(0.37);
-SELECT SLEEP(0.38);
-SELECT SLEEP(0.39);
-SELECT SLEEP(0.40);
-SELECT SLEEP(1.1);
-SELECT SLEEP(1.2);
-SELECT SLEEP(1.3);
-SELECT SLEEP(1.5);
-SELECT SLEEP(1.4);
-SELECT SLEEP(0.5);
-SELECT SLEEP(2.1);
-SELECT SLEEP(2.3);
-SELECT SLEEP(2.5);
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index c9bac8be27f..2eedac79d25 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -862,7 +862,7 @@ x_double_precision NULL NULL
drop table t1;
grant select on test.* to mysqltest_4@localhost;
SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
-where COLUMN_NAME='TABLE_NAME';
+where COLUMN_NAME='TABLE_NAME' and table_name not like 'innodb%';
TABLE_NAME COLUMN_NAME PRIVILEGES
COLUMNS TABLE_NAME select
COLUMN_PRIVILEGES TABLE_NAME select
@@ -1250,12 +1250,12 @@ f1()
DROP FUNCTION f1;
DROP PROCEDURE p1;
DROP USER mysql_bug20230@localhost;
-SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
+SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test') and table_name not like 'xtradb%';
MAX(table_name)
VIEWS
SELECT table_name from information_schema.tables
WHERE table_name=(SELECT MAX(table_name)
-FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'));
+FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test') and table_name not like 'xtradb%');
table_name
VIEWS
DROP TABLE IF EXISTS bug23037;
diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result
index 7a2c548a329..013d480c8e1 100644
--- a/mysql-test/r/information_schema_all_engines.result
+++ b/mysql-test/r/information_schema_all_engines.result
@@ -15,6 +15,7 @@ GLOBAL_VARIABLES
INDEX_STATISTICS
KEY_CACHES
KEY_COLUMN_USAGE
+PARAMETERS
PARTITIONS
PLUGINS
PROCESSLIST
@@ -27,6 +28,7 @@ SESSION_STATUS
SESSION_VARIABLES
STATISTICS
TABLES
+TABLESPACES
TABLE_CONSTRAINTS
TABLE_PRIVILEGES
TABLE_STATISTICS
@@ -34,25 +36,29 @@ TRIGGERS
USER_PRIVILEGES
USER_STATISTICS
VIEWS
-INNODB_BUFFER_POOL_PAGES
+INNODB_CMPMEM_RESET
PBXT_STATISTICS
-INNODB_CMP
+INNODB_CMPMEM
INNODB_RSEG
-XTRADB_ENHANCEMENTS
-INNODB_BUFFER_POOL_PAGES_INDEX
-XTRADB_ADMIN_COMMAND
-INNODB_TRX
-INNODB_SYS_TABLES
+INNODB_SYS_TABLESTATS
INNODB_LOCK_WAITS
-INNODB_SYS_STATS
+INNODB_INDEX_STATS
+INNODB_CMP
+INNODB_SYS_FOREIGN_COLS
+INNODB_CMP_RESET
+INNODB_BUFFER_POOL_PAGES
+INNODB_TRX
+INNODB_BUFFER_POOL_PAGES_INDEX
INNODB_LOCKS
-INNODB_CMPMEM
+INNODB_BUFFER_POOL_PAGES_BLOB
+INNODB_SYS_TABLES
+INNODB_SYS_FIELDS
+INNODB_SYS_COLUMNS
INNODB_TABLE_STATS
+INNODB_SYS_STATS
+INNODB_SYS_FOREIGN
INNODB_SYS_INDEXES
-INNODB_CMP_RESET
-INNODB_BUFFER_POOL_PAGES_BLOB
-INNODB_CMPMEM_RESET
-INNODB_INDEX_STATS
+XTRADB_ADMIN_COMMAND
SELECT t.table_name, c1.column_name
FROM information_schema.tables t
INNER JOIN
@@ -82,6 +88,7 @@ GLOBAL_VARIABLES VARIABLE_NAME
INDEX_STATISTICS TABLE_SCHEMA
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
+PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
@@ -94,6 +101,7 @@ SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
+TABLESPACES TABLESPACE_NAME
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
TABLE_PRIVILEGES TABLE_SCHEMA
TABLE_STATISTICS TABLE_SCHEMA
@@ -101,25 +109,29 @@ TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE
USER_STATISTICS USER
VIEWS TABLE_SCHEMA
-INNODB_BUFFER_POOL_PAGES page_type
+INNODB_CMPMEM_RESET page_size
PBXT_STATISTICS ID
-INNODB_CMP page_size
+INNODB_CMPMEM page_size
INNODB_RSEG rseg_id
-XTRADB_ENHANCEMENTS name
-INNODB_BUFFER_POOL_PAGES_INDEX index_id
-XTRADB_ADMIN_COMMAND result_message
-INNODB_TRX trx_id
-INNODB_SYS_TABLES SCHEMA
+INNODB_SYS_TABLESTATS SCHEMA
INNODB_LOCK_WAITS requesting_trx_id
-INNODB_SYS_STATS INDEX_ID
-INNODB_LOCKS lock_id
-INNODB_CMPMEM page_size
-INNODB_TABLE_STATS table_schema
-INNODB_SYS_INDEXES TABLE_ID
+INNODB_INDEX_STATS table_schema
+INNODB_CMP page_size
+INNODB_SYS_FOREIGN_COLS ID
INNODB_CMP_RESET page_size
+INNODB_BUFFER_POOL_PAGES page_type
+INNODB_TRX trx_id
+INNODB_BUFFER_POOL_PAGES_INDEX index_id
+INNODB_LOCKS lock_id
INNODB_BUFFER_POOL_PAGES_BLOB space_id
-INNODB_CMPMEM_RESET page_size
-INNODB_INDEX_STATS table_schema
+INNODB_SYS_TABLES SCHEMA
+INNODB_SYS_FIELDS INDEX_ID
+INNODB_SYS_COLUMNS TABLE_ID
+INNODB_TABLE_STATS table_schema
+INNODB_SYS_STATS INDEX_ID
+INNODB_SYS_FOREIGN ID
+INNODB_SYS_INDEXES INDEX_ID
+XTRADB_ADMIN_COMMAND result_message
SELECT t.table_name, c1.column_name
FROM information_schema.tables t
INNER JOIN
@@ -149,6 +161,7 @@ GLOBAL_VARIABLES VARIABLE_NAME
INDEX_STATISTICS TABLE_SCHEMA
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
+PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
@@ -161,6 +174,7 @@ SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
+TABLESPACES TABLESPACE_NAME
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
TABLE_PRIVILEGES TABLE_SCHEMA
TABLE_STATISTICS TABLE_SCHEMA
@@ -168,25 +182,29 @@ TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE
USER_STATISTICS USER
VIEWS TABLE_SCHEMA
-INNODB_BUFFER_POOL_PAGES page_type
+INNODB_CMPMEM_RESET page_size
PBXT_STATISTICS ID
-INNODB_CMP page_size
+INNODB_CMPMEM page_size
INNODB_RSEG rseg_id
-XTRADB_ENHANCEMENTS name
-INNODB_BUFFER_POOL_PAGES_INDEX index_id
-XTRADB_ADMIN_COMMAND result_message
-INNODB_TRX trx_id
-INNODB_SYS_TABLES SCHEMA
+INNODB_SYS_TABLESTATS SCHEMA
INNODB_LOCK_WAITS requesting_trx_id
-INNODB_SYS_STATS INDEX_ID
-INNODB_LOCKS lock_id
-INNODB_CMPMEM page_size
-INNODB_TABLE_STATS table_schema
-INNODB_SYS_INDEXES TABLE_ID
+INNODB_INDEX_STATS table_schema
+INNODB_CMP page_size
+INNODB_SYS_FOREIGN_COLS ID
INNODB_CMP_RESET page_size
+INNODB_BUFFER_POOL_PAGES page_type
+INNODB_TRX trx_id
+INNODB_BUFFER_POOL_PAGES_INDEX index_id
+INNODB_LOCKS lock_id
INNODB_BUFFER_POOL_PAGES_BLOB space_id
-INNODB_CMPMEM_RESET page_size
-INNODB_INDEX_STATS table_schema
+INNODB_SYS_TABLES SCHEMA
+INNODB_SYS_FIELDS INDEX_ID
+INNODB_SYS_COLUMNS TABLE_ID
+INNODB_TABLE_STATS table_schema
+INNODB_SYS_STATS INDEX_ID
+INNODB_SYS_FOREIGN ID
+INNODB_SYS_INDEXES INDEX_ID
+XTRADB_ADMIN_COMMAND result_message
select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
(select cast(table_name as char) from information_schema.tables
order by table_name limit 1) limit 1;
@@ -231,13 +249,19 @@ INNODB_INDEX_STATS information_schema.INNODB_INDEX_STATS 1
INNODB_LOCKS information_schema.INNODB_LOCKS 1
INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
INNODB_RSEG information_schema.INNODB_RSEG 1
+INNODB_SYS_COLUMNS information_schema.INNODB_SYS_COLUMNS 1
+INNODB_SYS_FIELDS information_schema.INNODB_SYS_FIELDS 1
+INNODB_SYS_FOREIGN information_schema.INNODB_SYS_FOREIGN 1
+INNODB_SYS_FOREIGN_COLS information_schema.INNODB_SYS_FOREIGN_COLS 1
INNODB_SYS_INDEXES information_schema.INNODB_SYS_INDEXES 1
INNODB_SYS_STATS information_schema.INNODB_SYS_STATS 1
INNODB_SYS_TABLES information_schema.INNODB_SYS_TABLES 1
+INNODB_SYS_TABLESTATS information_schema.INNODB_SYS_TABLESTATS 1
INNODB_TABLE_STATS information_schema.INNODB_TABLE_STATS 1
INNODB_TRX information_schema.INNODB_TRX 1
KEY_CACHES information_schema.KEY_CACHES 1
KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
+PARAMETERS information_schema.PARAMETERS 1
PARTITIONS information_schema.PARTITIONS 1
PBXT_STATISTICS information_schema.PBXT_STATISTICS 1
PLUGINS information_schema.PLUGINS 1
@@ -251,6 +275,7 @@ SESSION_STATUS information_schema.SESSION_STATUS 1
SESSION_VARIABLES information_schema.SESSION_VARIABLES 1
STATISTICS information_schema.STATISTICS 1
TABLES information_schema.TABLES 1
+TABLESPACES information_schema.TABLESPACES 1
TABLE_CONSTRAINTS information_schema.TABLE_CONSTRAINTS 1
TABLE_PRIVILEGES information_schema.TABLE_PRIVILEGES 1
TABLE_STATISTICS information_schema.TABLE_STATISTICS 1
@@ -258,7 +283,6 @@ TRIGGERS information_schema.TRIGGERS 1
USER_PRIVILEGES information_schema.USER_PRIVILEGES 1
USER_STATISTICS information_schema.USER_STATISTICS 1
VIEWS information_schema.VIEWS 1
-XTRADB_ENHANCEMENTS information_schema.XTRADB_ENHANCEMENTS 1
Database: information_schema
+---------------------------------------+
| Tables |
@@ -277,6 +301,7 @@ Database: information_schema
| INDEX_STATISTICS |
| KEY_CACHES |
| KEY_COLUMN_USAGE |
+| PARAMETERS |
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
@@ -289,6 +314,7 @@ Database: information_schema
| SESSION_VARIABLES |
| STATISTICS |
| TABLES |
+| TABLESPACES |
| TABLE_CONSTRAINTS |
| TABLE_PRIVILEGES |
| TABLE_STATISTICS |
@@ -296,25 +322,29 @@ Database: information_schema
| USER_PRIVILEGES |
| USER_STATISTICS |
| VIEWS |
-| INNODB_BUFFER_POOL_PAGES |
+| INNODB_CMPMEM_RESET |
| PBXT_STATISTICS |
-| INNODB_CMP |
+| INNODB_CMPMEM |
| INNODB_RSEG |
-| XTRADB_ENHANCEMENTS |
-| INNODB_BUFFER_POOL_PAGES_INDEX |
-| XTRADB_ADMIN_COMMAND |
-| INNODB_TRX |
-| INNODB_SYS_TABLES |
+| INNODB_SYS_TABLESTATS |
| INNODB_LOCK_WAITS |
-| INNODB_SYS_STATS |
+| INNODB_INDEX_STATS |
+| INNODB_CMP |
+| INNODB_SYS_FOREIGN_COLS |
+| INNODB_CMP_RESET |
+| INNODB_BUFFER_POOL_PAGES |
+| INNODB_TRX |
+| INNODB_BUFFER_POOL_PAGES_INDEX |
| INNODB_LOCKS |
-| INNODB_CMPMEM |
+| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_SYS_TABLES |
+| INNODB_SYS_FIELDS |
+| INNODB_SYS_COLUMNS |
| INNODB_TABLE_STATS |
+| INNODB_SYS_STATS |
+| INNODB_SYS_FOREIGN |
| INNODB_SYS_INDEXES |
-| INNODB_CMP_RESET |
-| INNODB_BUFFER_POOL_PAGES_BLOB |
-| INNODB_CMPMEM_RESET |
-| INNODB_INDEX_STATS |
+| XTRADB_ADMIN_COMMAND |
+---------------------------------------+
Database: INFORMATION_SCHEMA
+---------------------------------------+
@@ -334,6 +364,7 @@ Database: INFORMATION_SCHEMA
| INDEX_STATISTICS |
| KEY_CACHES |
| KEY_COLUMN_USAGE |
+| PARAMETERS |
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
@@ -346,6 +377,7 @@ Database: INFORMATION_SCHEMA
| SESSION_VARIABLES |
| STATISTICS |
| TABLES |
+| TABLESPACES |
| TABLE_CONSTRAINTS |
| TABLE_PRIVILEGES |
| TABLE_STATISTICS |
@@ -353,25 +385,29 @@ Database: INFORMATION_SCHEMA
| USER_PRIVILEGES |
| USER_STATISTICS |
| VIEWS |
-| INNODB_BUFFER_POOL_PAGES |
+| INNODB_CMPMEM_RESET |
| PBXT_STATISTICS |
-| INNODB_CMP |
+| INNODB_CMPMEM |
| INNODB_RSEG |
-| XTRADB_ENHANCEMENTS |
-| INNODB_BUFFER_POOL_PAGES_INDEX |
-| XTRADB_ADMIN_COMMAND |
-| INNODB_TRX |
-| INNODB_SYS_TABLES |
+| INNODB_SYS_TABLESTATS |
| INNODB_LOCK_WAITS |
-| INNODB_SYS_STATS |
+| INNODB_INDEX_STATS |
+| INNODB_CMP |
+| INNODB_SYS_FOREIGN_COLS |
+| INNODB_CMP_RESET |
+| INNODB_BUFFER_POOL_PAGES |
+| INNODB_TRX |
+| INNODB_BUFFER_POOL_PAGES_INDEX |
| INNODB_LOCKS |
-| INNODB_CMPMEM |
+| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_SYS_TABLES |
+| INNODB_SYS_FIELDS |
+| INNODB_SYS_COLUMNS |
| INNODB_TABLE_STATS |
+| INNODB_SYS_STATS |
+| INNODB_SYS_FOREIGN |
| INNODB_SYS_INDEXES |
-| INNODB_CMP_RESET |
-| INNODB_BUFFER_POOL_PAGES_BLOB |
-| INNODB_CMPMEM_RESET |
-| INNODB_INDEX_STATS |
+| XTRADB_ADMIN_COMMAND |
+---------------------------------------+
Wildcard: inf_rmation_schema
+--------------------+
@@ -381,5 +417,5 @@ Wildcard: inf_rmation_schema
+--------------------+
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*)
-information_schema 52
-mysql 22
+information_schema 58
+mysql 23
diff --git a/mysql-test/r/innodb-analyze.result b/mysql-test/r/innodb-analyze.result
deleted file mode 100644
index 2aee004a2d6..00000000000
--- a/mysql-test/r/innodb-analyze.result
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-innodb_stats_sample_pages 1
diff --git a/mysql-test/r/innodb-consistent.result b/mysql-test/r/innodb-consistent.result
deleted file mode 100644
index 9115791b99c..00000000000
--- a/mysql-test/r/innodb-consistent.result
+++ /dev/null
@@ -1,35 +0,0 @@
-drop table if exists t1;
-set session transaction isolation level read committed;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-create table t2 like t1;
-insert into t2 values (1),(2),(3),(4),(5),(6),(7);
-set autocommit=0;
-begin;
-replace into t1 select * from t2;
-set session transaction isolation level read committed;
-set autocommit=0;
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-commit;
-begin;
-insert into t1 select * from t2;
-set session transaction isolation level read committed;
-set autocommit=0;
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-commit;
-select * from t1;
-a
-1
-2
-3
-4
-5
-6
-7
-drop table t1;
-drop table t2;
diff --git a/mysql-test/r/innodb-index_ucs2.result b/mysql-test/r/innodb-index_ucs2.result
deleted file mode 100644
index c8a1e8c7da1..00000000000
--- a/mysql-test/r/innodb-index_ucs2.result
+++ /dev/null
@@ -1,116 +0,0 @@
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=ucs2;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add unique index (b);
-ERROR 23000: Duplicate entry '2' for key 'b'
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2
-alter table t1 add index (b);
-insert into t1 values(10,10,'kkk','iii');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 5 NULL 6
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2
-alter table t1 add unique index (c), add index (d);
-insert into t1 values(11,11,'aaa','mmm');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-select * from t1 force index(c) order by c;
-a b c d
-11 11 aaa mmm
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-select * from t1 force index(d) order by d;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 5 NULL 7
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 21 NULL 7
-explain select * from t1 force index(d) order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL d 43 NULL 7
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `c` (`c`),
- KEY `b` (`b`),
- KEY `d` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-drop table t1;
diff --git a/mysql-test/r/innodb-replace.result b/mysql-test/r/innodb-replace.result
deleted file mode 100644
index c926bb89a2e..00000000000
--- a/mysql-test/r/innodb-replace.result
+++ /dev/null
@@ -1,13 +0,0 @@
-drop table if exists t1;
-create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
-select * from t1;
-c1 c2 stamp
-replace delayed into t1 (c1, c2) values ( "text1","11");
-ERROR HY000: DELAYED option not supported for table 't1'
-select * from t1;
-c1 c2 stamp
-replace delayed into t1 (c1, c2) values ( "text1","12");
-ERROR HY000: DELAYED option not supported for table 't1'
-select * from t1;
-c1 c2 stamp
-drop table t1;
diff --git a/mysql-test/r/innodb-timeout.result b/mysql-test/r/innodb-timeout.result
deleted file mode 100644
index 2d34cdb1cda..00000000000
--- a/mysql-test/r/innodb-timeout.result
+++ /dev/null
@@ -1,46 +0,0 @@
-set global innodb_lock_wait_timeout=42;
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-42
-set innodb_lock_wait_timeout=1;
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-1
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-42
-set global innodb_lock_wait_timeout=347;
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-42
-set innodb_lock_wait_timeout=1;
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-1
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-347
-create table t1(a int primary key)engine=innodb;
-begin;
-insert into t1 values(1),(2),(3);
-set innodb_lock_wait_timeout=5;
-select * from t1 for update;
-commit;
-a
-1
-2
-3
-begin;
-insert into t1 values(4);
-set innodb_lock_wait_timeout=2;
-set @a= current_timestamp();
-select * from t1 for update;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-set @b= current_timestamp();
-set @c= timestampdiff(SECOND, @a, @b);
-select if(@c >= 1 and @c <= 10, 'OK', concat("NOT OK, time passed=", @c));
-if(@c >= 1 and @c <= 10, 'OK', concat("NOT OK, time passed=", @c))
-OK
-commit;
-drop table t1;
-set global innodb_lock_wait_timeout=50;
diff --git a/mysql-test/r/innodb_bug34053.result b/mysql-test/r/innodb_bug34053.result
deleted file mode 100644
index 195775f74c8..00000000000
--- a/mysql-test/r/innodb_bug34053.result
+++ /dev/null
@@ -1 +0,0 @@
-SET storage_engine=InnoDB;
diff --git a/mysql-test/r/innodb_bug34300.result b/mysql-test/r/innodb_bug34300.result
deleted file mode 100644
index ae9fee81ad7..00000000000
--- a/mysql-test/r/innodb_bug34300.result
+++ /dev/null
@@ -1,4 +0,0 @@
-f4 f8
-xxx zzz
-f4 f8
-xxx zzz
diff --git a/mysql-test/r/innodb_bug35220.result b/mysql-test/r/innodb_bug35220.result
deleted file mode 100644
index 195775f74c8..00000000000
--- a/mysql-test/r/innodb_bug35220.result
+++ /dev/null
@@ -1 +0,0 @@
-SET storage_engine=InnoDB;
diff --git a/mysql-test/r/innodb_bug36169.result b/mysql-test/r/innodb_bug36169.result
deleted file mode 100644
index aa80e4d7aa4..00000000000
--- a/mysql-test/r/innodb_bug36169.result
+++ /dev/null
@@ -1,2 +0,0 @@
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
diff --git a/mysql-test/r/innodb_bug40360.result b/mysql-test/r/innodb_bug40360.result
deleted file mode 100644
index ef4cf463903..00000000000
--- a/mysql-test/r/innodb_bug40360.result
+++ /dev/null
@@ -1,4 +0,0 @@
-SET TX_ISOLATION='READ-COMMITTED';
-CREATE TABLE bug40360 (a INT) engine=innodb;
-INSERT INTO bug40360 VALUES (1);
-DROP TABLE bug40360;
diff --git a/mysql-test/r/innodb_bug41904.result b/mysql-test/r/innodb_bug41904.result
deleted file mode 100644
index 6070d32d181..00000000000
--- a/mysql-test/r/innodb_bug41904.result
+++ /dev/null
@@ -1,4 +0,0 @@
-CREATE TABLE bug41904 (id INT PRIMARY KEY, uniquecol CHAR(15)) ENGINE=InnoDB;
-INSERT INTO bug41904 VALUES (1,NULL), (2,NULL);
-CREATE UNIQUE INDEX ui ON bug41904 (uniquecol);
-DROP TABLE bug41904;
diff --git a/mysql-test/r/innodb_bug44571.result b/mysql-test/r/innodb_bug44571.result
deleted file mode 100644
index 955b55ac673..00000000000
--- a/mysql-test/r/innodb_bug44571.result
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
-ALTER TABLE bug44571 CHANGE foo bar INT;
-ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
-ERROR 42000: Key column 'foo' doesn't exist in table
-ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
-CREATE INDEX bug44571c ON bug44571 (bar);
-DROP TABLE bug44571;
diff --git a/mysql-test/r/innodb_bug46676.result b/mysql-test/r/innodb_bug46676.result
deleted file mode 100644
index 996799ce931..00000000000
--- a/mysql-test/r/innodb_bug46676.result
+++ /dev/null
@@ -1,9 +0,0 @@
-SET foreign_key_checks=0;
-CREATE TABLE t1 (id int, foreign key (id) references t2(id)) ENGINE=INNODB;
-CREATE TABLE t2 (id int, foreign key (id) references t1(id)) ENGINE=INNODB;
-SET foreign_key_checks=1;
-SELECT COUNT(*) FROM information_schema.key_column_usage WHERE REFERENCED_TABLE_NAME in ('t1', 't2');
-COUNT(*)
-2
-SET foreign_key_checks=0;
-DROP TABLE t1, t2;
diff --git a/mysql-test/r/innodb_information_schema.result b/mysql-test/r/innodb_information_schema.result
deleted file mode 100644
index 396cae579ce..00000000000
--- a/mysql-test/r/innodb_information_schema.result
+++ /dev/null
@@ -1,23 +0,0 @@
-lock_mode lock_type lock_table lock_index lock_rec lock_data
-X RECORD `test`.```t'\"_str` `PRIMARY` 2 '1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc'''''
-X RECORD `test`.```t'\"_str` `PRIMARY` 2 '1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc'''''
-X RECORD `test`.```t'\"_str` `PRIMARY` 3 '2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""'
-X RECORD `test`.```t'\"_str` `PRIMARY` 3 '2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""'
-X RECORD `test`.```t'\"_str` `PRIMARY` 4 '3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\'
-X RECORD `test`.```t'\"_str` `PRIMARY` 4 '3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\'
-X RECORD `test`.```t'\"_str` `PRIMARY` 5 '4', 'abc', '\0abc', 'abc\0', 'a\0bc', 'a\0bc\0', 'a\0bc\0\0'
-X RECORD `test`.```t'\"_str` `PRIMARY` 5 '4', 'abc', '\0abc', 'abc\0', 'a\0bc', 'a\0bc\0', 'a\0bc\0\0'
-X RECORD `test`.`t_min` `PRIMARY` 2 -128, 0, -32768, 0, -8388608, 0, -2147483648, 0, -9223372036854775808, 0
-X RECORD `test`.`t_min` `PRIMARY` 2 -128, 0, -32768, 0, -8388608, 0, -2147483648, 0, -9223372036854775808, 0
-X RECORD `test`.`t_max` `PRIMARY` 2 127, 255, 32767, 65535, 8388607, 16777215, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615
-X RECORD `test`.`t_max` `PRIMARY` 2 127, 255, 32767, 65535, 8388607, 16777215, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615
-X RECORD `test`.```t'\"_str` `PRIMARY` 1 supremum pseudo-record
-X RECORD `test`.```t'\"_str` `PRIMARY` 1 supremum pseudo-record
-lock_table COUNT(*)
-`test`.`t_max` 2
-`test`.`t_min` 2
-`test`.```t'\"_str` 10
-lock_table COUNT(*)
-"test"."t_max" 2
-"test"."t_min" 2
-"test"."`t'\""_str" 10
diff --git a/mysql-test/r/innodb_trx_weight.result b/mysql-test/r/innodb_trx_weight.result
deleted file mode 100644
index 195775f74c8..00000000000
--- a/mysql-test/r/innodb_trx_weight.result
+++ /dev/null
@@ -1 +0,0 @@
-SET storage_engine=InnoDB;
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 5b1c0a8b611..deb84a87e93 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -1375,7 +1375,7 @@ INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1);
INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range t1_b t1_b 5 NULL 8 Using where
+1 SIMPLE t1 range t1_b t1_b 5 NULL 8 Using index condition
SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
a b c
8 1 1
diff --git a/mysql-test/suite/pbxt/r/mysqlshow.result b/mysql-test/suite/pbxt/r/mysqlshow.result
index 4898da69b98..96e45e84b77 100644
--- a/mysql-test/suite/pbxt/r/mysqlshow.result
+++ b/mysql-test/suite/pbxt/r/mysqlshow.result
@@ -114,7 +114,29 @@ Database: information_schema
| USER_PRIVILEGES |
| USER_STATISTICS |
| VIEWS |
+| INNODB_CMPMEM_RESET |
| PBXT_STATISTICS |
+| INNODB_CMPMEM |
+| INNODB_RSEG |
+| INNODB_SYS_TABLESTATS |
+| INNODB_LOCK_WAITS |
+| INNODB_INDEX_STATS |
+| INNODB_CMP |
+| INNODB_SYS_FOREIGN_COLS |
+| INNODB_CMP_RESET |
+| INNODB_BUFFER_POOL_PAGES |
+| INNODB_TRX |
+| INNODB_BUFFER_POOL_PAGES_INDEX |
+| INNODB_LOCKS |
+| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_SYS_TABLES |
+| INNODB_SYS_FIELDS |
+| INNODB_SYS_COLUMNS |
+| INNODB_TABLE_STATS |
+| INNODB_SYS_STATS |
+| INNODB_SYS_FOREIGN |
+| INNODB_SYS_INDEXES |
+| XTRADB_ADMIN_COMMAND |
+---------------------------------------+
Database: INFORMATION_SCHEMA
+---------------------------------------+
@@ -155,7 +177,29 @@ Database: INFORMATION_SCHEMA
| USER_PRIVILEGES |
| USER_STATISTICS |
| VIEWS |
+| INNODB_CMPMEM_RESET |
| PBXT_STATISTICS |
+| INNODB_CMPMEM |
+| INNODB_RSEG |
+| INNODB_SYS_TABLESTATS |
+| INNODB_LOCK_WAITS |
+| INNODB_INDEX_STATS |
+| INNODB_CMP |
+| INNODB_SYS_FOREIGN_COLS |
+| INNODB_CMP_RESET |
+| INNODB_BUFFER_POOL_PAGES |
+| INNODB_TRX |
+| INNODB_BUFFER_POOL_PAGES_INDEX |
+| INNODB_LOCKS |
+| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_SYS_TABLES |
+| INNODB_SYS_FIELDS |
+| INNODB_SYS_COLUMNS |
+| INNODB_TABLE_STATS |
+| INNODB_SYS_STATS |
+| INNODB_SYS_FOREIGN |
+| INNODB_SYS_INDEXES |
+| XTRADB_ADMIN_COMMAND |
+---------------------------------------+
Wildcard: inf_rmation_schema
+--------------------+
diff --git a/mysql-test/suite/pbxt/t/mysqlshow.test b/mysql-test/suite/pbxt/t/mysqlshow.test
index d8f5c20afcd..41505cc0b10 100644
--- a/mysql-test/suite/pbxt/t/mysqlshow.test
+++ b/mysql-test/suite/pbxt/t/mysqlshow.test
@@ -1,5 +1,6 @@
# Can't run test of external client with embedded server
-- source include/not_embedded.inc
+-- source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2,test1,test2;
diff --git a/mysql-test/suite/percona/disabled.def b/mysql-test/suite/percona/disabled.def
index a99b952a5eb..c20f5f3860d 100644
--- a/mysql-test/suite/percona/disabled.def
+++ b/mysql-test/suite/percona/disabled.def
@@ -16,7 +16,23 @@ percona_status_wait_query_cache_mutex: Feature not merged into MariaDB
percona_slave_innodb_stats: Feature not merged into MariaDB
percona_query_response_time-replication: Feature not merged into MariaDB
percona_server_variables: Feature not merged into MariaDB
-
percona_slow_query_log-log_slow_verbosity: InnoDB filtering information not fully merged into MariaDB
-
percona_innodb_buffer_pool_shm: Requires big shmmax not default on many systems
+percona_log_warnings_suppress: Feature not merged into MariaDB
+percona_slow_extended-log_slow_sp_statements-cl: Feature not merged into MariaDB
+percona_slow_extended-log_slow_verbosity-cl: Feature not merged into MariaDB
+slow_query_log_use_global_control: Feature not merged into MariaDB
+percona_slow_extended-use_global_control: Feature not merged into MariaDB
+percona_slow_query_log-log_slow_verbosity: Feature not merged into MariaDB
+percona_slow_extended-log_slow_verbosity: Feature not merged into MariaDB
+percona_slow_extended-microseconds_in_slow_extended: Feature not merged into MariaDB
+percona_slow_extended-use_global_long_query_time: Feature not merged into MariaDB
+percona_slow_extended-slow_query_log_timestamp_always-cl: Feature not merged into MariaDB
+percona_slow_extended-slow_query_log_microseconds_timestamp-cl: Feature not merged into MariaDB
+percona_bug643149: Feature not merged into MariaDB
+percona_processlist_row_stats: Feature not merged into MariaDB
+percona_server_variables_debug: Feature not merged into MariaDB
+percona_slow_extended-slave_statements: Feature not merged into MariaDB
+percona_show_slave_status_nolock: Feature not merged into MariaDB
+percona_slow_extended-slave_innodb_stats: Feature not merged into MariaDB
+percona_slow_extended-slave_statements-and-use_global_long_query_time: Feature not merged into MariaDB
diff --git a/mysql-test/suite/percona/grep.inc b/mysql-test/suite/percona/grep.inc
new file mode 100644
index 00000000000..c9c823fa695
--- /dev/null
+++ b/mysql-test/suite/percona/grep.inc
@@ -0,0 +1,16 @@
+perl;
+
+ $file = $ENV{'grep_file'};
+ $pattern = $ENV{'grep_pattern'};
+
+ open(FILE, "$file")
+ or die("Cannot open file $file: $!\n");
+
+ $lines = 0;
+ while(<FILE>) {
+ $lines++ if (/$pattern/);
+ }
+ print "$lines\n";
+
+ close(FILE);
+EOF
diff --git a/mysql-test/suite/percona/have_response_time_distribution.inc b/mysql-test/suite/percona/have_response_time_distribution.inc
new file mode 100644
index 00000000000..45650133b31
--- /dev/null
+++ b/mysql-test/suite/percona/have_response_time_distribution.inc
@@ -0,0 +1,4 @@
+if (`SELECT @@have_response_time_distribution != 'YES'`)
+{
+ --skip No response time distribution
+}
diff --git a/mysql-test/suite/percona/percona_bug643149.result b/mysql-test/suite/percona/percona_bug643149.result
new file mode 100644
index 00000000000..1a447a194e7
--- /dev/null
+++ b/mysql-test/suite/percona/percona_bug643149.result
@@ -0,0 +1,21 @@
+SET @old_slow_query_log_file=@@global.slow_query_log_file;
+SET GLOBAL slow_query_log=on;
+SET LOCAL log_slow_verbosity='profiling';
+SET LOCAL long_query_time=0;
+SET GLOBAL slow_query_log_file='MYSQLTEST_VARDIR/percona_bug643149_slow.log';;
+SELECT 1;
+1
+1
+# User@Host: root[root] @ localhost []
+# Thread_id: X Schema: test Last_errno: X Killed: X
+# Query_time: X.X Lock_time: X.X Rows_sent: X Rows_examined: X Rows_affected: X Rows_read: X
+# Bytes_sent: X Tmp_tables: X Tmp_disk_tables: X Tmp_table_sizes: X
+# Profile_starting: X.X Profile_starting_cpu: X.X Profile_Opening_tables: X.X Profile_Opening_tables_cpu: X.X Profile_query_end: X.X Profile_query_end_cpu: X.X Profile_closing_tables: X.X Profile_closing_tables_cpu: X.X Profile_freeing_items: X.X Profile_freeing_items_cpu: X.X Profile_logging_slow_query: X.X Profile_logging_slow_query_cpu: X.X
+# Profile_total: X.X Profile_total_cpu: X.X
+# User@Host: root[root] @ localhost []
+# Thread_id: X Schema: test Last_errno: X Killed: X
+# Query_time: X.X Lock_time: X.X Rows_sent: X Rows_examined: X Rows_affected: X Rows_read: X
+# Bytes_sent: X Tmp_tables: X Tmp_disk_tables: X Tmp_table_sizes: X
+# Profile_starting: X.X Profile_starting_cpu: X.X Profile_checking_permissions: X.X Profile_checking_permissions_cpu: X.X Profile_Opening_tables: X.X Profile_Opening_tables_cpu: X.X Profile_init: X.X Profile_init_cpu: X.X Profile_optimizing: X.X Profile_optimizing_cpu: X.X Profile_executing: X.X Profile_executing_cpu: X.X Profile_end: X.X Profile_end_cpu: X.X Profile_query_end: X.X Profile_query_end_cpu: X.X Profile_closing_tables: X.X Profile_closing_tables_cpu: X.X Profile_freeing_items: X.X Profile_freeing_items_cpu: X.X Profile_logging_slow_query: X.X Profile_logging_slow_query_cpu: X.X
+# Profile_total: X.X Profile_total_cpu: X.X
+SET GLOBAL slow_query_log_file=@old_slow_query_log_file;
diff --git a/mysql-test/suite/percona/percona_bug643149.test b/mysql-test/suite/percona/percona_bug643149.test
new file mode 100644
index 00000000000..fa31b169a19
--- /dev/null
+++ b/mysql-test/suite/percona/percona_bug643149.test
@@ -0,0 +1,49 @@
+#
+# This test suffers from server
+# Bug#38124 "general_log_file" variable silently unset when using expression
+# In short:
+# SET GLOBAL general_log_file = @<whatever>
+# SET GLOBAL slow_query_log = @<whatever>
+# cause that the value of these server system variables is set to default
+# instead of the assigned values. There comes no error message or warning.
+# If this bug is fixed please
+# 1. try this test with "let $fixed_bug38124 = 0;"
+# 2. remove all workarounds if 1. was successful.
+--source include/have_profiling.inc
+let $fixed_bug38124 = 0;
+
+SET @old_slow_query_log_file=@@global.slow_query_log_file;
+SET GLOBAL slow_query_log=on;
+SET LOCAL log_slow_verbosity='profiling';
+SET LOCAL long_query_time=0;
+
+let slogfile=$MYSQLTEST_VARDIR/percona_bug643149_slow.log;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SET GLOBAL slow_query_log_file='$slogfile';
+
+SELECT 1;
+
+perl;
+ $slogfile= $ENV{'slogfile'};
+
+ open(FILE, "$slogfile") or
+ die("Unable to read slow query log file $slogfile: $!\n");
+ while(<FILE>) {
+ next if (!/^#/);
+ next if (/^# Time:/);
+ s/[0-9]+/X/g;
+ print;
+ }
+
+ close(FILE);
+EOF
+
+SET GLOBAL slow_query_log_file=@old_slow_query_log_file;
+
+if(!$fixed_bug38124)
+{
+ --disable_query_log
+ let $my_var = `SELECT @old_slow_query_log_file`;
+ eval SET @@global.slow_query_log_file = '$my_var';
+ --enable_query_log
+}
diff --git a/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.result b/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.result
index 08ece8fb9a9..e5373606099 100644
--- a/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.result
+++ b/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.result
@@ -1,6 +1,4 @@
show variables like 'innodb_buffer_pool_shm%';
Variable_name Value
-innodb_buffer_pool_shm_key 123456
-show variables like 'innodb_buffer_pool_shm%';
-Variable_name Value
+innodb_buffer_pool_shm_checksum ON
innodb_buffer_pool_shm_key 123456
diff --git a/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.test b/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.test
index 7b81bb8d54b..7b26c217893 100644
--- a/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.test
+++ b/mysql-test/suite/percona/percona_innodb_buffer_pool_shm.test
@@ -1,18 +1,2 @@
---source include/have_innodb.inc
+--source include/have_xtradb.inc
show variables like 'innodb_buffer_pool_shm%';
-
-#clean shutdown (restart_mysqld.inc is not clean if over 10 sec...)
---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-wait
-EOF
-shutdown_server 120;
---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-restart
-EOF
---enable_reconnect
---source include/wait_until_connected_again.inc
---disable_reconnect
-
-show variables like 'innodb_buffer_pool_shm%';
---sleep 1
---system ipcrm -M 123456
diff --git a/mysql-test/suite/percona/percona_innodb_deadlock_count.result b/mysql-test/suite/percona/percona_innodb_deadlock_count.result
index 4ad6fd433fe..00902e87feb 100644
--- a/mysql-test/suite/percona/percona_innodb_deadlock_count.result
+++ b/mysql-test/suite/percona/percona_innodb_deadlock_count.result
@@ -11,18 +11,18 @@ insert into t values(1,2);
# Switch to connection con1
BEGIN;
SELECT b FROM t WHERE a=1 FOR UPDATE;
-b
-2
# Switch to connection con2
BEGIN;
SELECT b FROM t WHERE a=2 FOR UPDATE;
-b
-1
# Switch to connection con1
SELECT b FROM t WHERE a=2 FOR UPDATE;
# Switch to connection con2
SELECT b FROM t WHERE a=1 FOR UPDATE;
+# Switch to connection con1
+ROLLBACK;
+# Switch to connection con2
+ROLLBACK;
# Switch to connection con3
-1
+Deadlocks: 1
# Drop test table
drop table t;
diff --git a/mysql-test/suite/percona/percona_innodb_deadlock_count.test b/mysql-test/suite/percona/percona_innodb_deadlock_count.test
index 7a7f0e5ddb7..f953b9d7822 100644
--- a/mysql-test/suite/percona/percona_innodb_deadlock_count.test
+++ b/mysql-test/suite/percona/percona_innodb_deadlock_count.test
@@ -9,7 +9,6 @@ connect (con3,localhost,root,,);
--disable_warnings
drop table if exists t;
--enable_warnings
-disable_abort_on_error;
--echo # Create test table
create table t(a INT PRIMARY KEY, b INT) engine=InnoDB;
@@ -20,12 +19,12 @@ insert into t values(1,2);
#--echo # Save current deadlock count
let $current = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_deadlocks'`;
+--disable_result_log
+
--echo # Switch to connection con1
connection con1;
BEGIN; SELECT b FROM t WHERE a=1 FOR UPDATE;
-#show engine innodb status;
-
--echo # Switch to connection con2
connection con2;
BEGIN; SELECT b FROM t WHERE a=2 FOR UPDATE;
@@ -38,12 +37,25 @@ SEND SELECT b FROM t WHERE a=2 FOR UPDATE;
connection con2;
SEND SELECT b FROM t WHERE a=1 FOR UPDATE;
-SLEEP 0.2;
+--echo # Switch to connection con1
+connection con1;
+--error 0, ER_LOCK_DEADLOCK
+reap;
+ROLLBACK;
+
+--echo # Switch to connection con2
+connection con2;
+--error 0, ER_LOCK_DEADLOCK
+reap;
+ROLLBACK;
+
--echo # Switch to connection con3
connection con3;
let $result = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_deadlocks'`;
+--enable_result_log
+
let $diff = `SELECT $result - $current`;
-echo $diff;
+echo Deadlocks: $diff;
--echo # Drop test table
drop table t;
diff --git a/mysql-test/suite/percona/percona_log_connection_error-master.opt b/mysql-test/suite/percona/percona_log_connection_error-master.opt
index 32a891789f3..4658d62af60 100644
--- a/mysql-test/suite/percona/percona_log_connection_error-master.opt
+++ b/mysql-test/suite/percona/percona_log_connection_error-master.opt
@@ -1 +1 @@
---log-error \ No newline at end of file
+--log-error
diff --git a/mysql-test/suite/percona/percona_log_connection_error.test b/mysql-test/suite/percona/percona_log_connection_error.test
index 57cd652bd24..677da047354 100644
--- a/mysql-test/suite/percona/percona_log_connection_error.test
+++ b/mysql-test/suite/percona/percona_log_connection_error.test
@@ -48,5 +48,7 @@ if(!`select LENGTH('$log_error_')`)
# Assign env variable LOG_ERROR
let LOG_ERROR=$log_error_;
-let cmd=cat $log_error | grep "Too many connections" | wc -l;
+--let grep_file = $log_error
+--let grep_pattern = Too many connections
+--source grep.inc
exec $cmd;
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test b/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test
deleted file mode 100644
index 8d4bb1e091c..00000000000
--- a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test
+++ /dev/null
@@ -1,141 +0,0 @@
--- source include/not_windows.inc
-
--- echo # Activate master-slave replication
--- source include/master-slave.inc
-
-connection master;
--- echo # Make table t for test
--- disable_warnings
-DROP TABLE IF EXISTS t;
--- enable_warnings
-CREATE TABLE t(id INT);
-
-
--- echo # Start slave replication
--- disable_warnings
-connection slave;
-START SLAVE;
--- source include/wait_for_slave_to_start.inc
--- enable_warnings
-
-#-- echo # Make insert(1) on master
-connection master;
-INSERT INTO t VALUES (1);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync(1) slave thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-
--- echo # Read and change log_slow_slave_statements to ON on slave
-show variables like 'log_slow_slave_statements';
-set global log_slow_slave_statements=ON;
-show variables like 'log_slow_slave_statements';
-
-#-- echo # Make insert(2) on master
-connection master;
-INSERT INTO t VALUES (2);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync slave(2) thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
--- echo # Restart slave
-STOP SLAVE;
--- source include/wait_for_slave_to_stop.inc
-START SLAVE;
--- source include/wait_for_slave_to_start.inc
-
-#-- echo # Make insert(3) on master
-connection master;
-INSERT INTO t VALUES (3);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync(3) slave thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-show variables like 'long_query_time';
-show global variables like 'long_query_time';
-show global variables like 'use_global_long_query_time';
-set global long_query_time=0;
-show variables like 'long_query_time';
-show global variables like 'long_query_time';
-show global variables like 'use_global_long_query_time';
-
-#-- echo # Make insert(4) on master
-connection master;
-INSERT INTO t VALUES (4);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync slave(4) thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-show variables like 'long_query_time';
-show global variables like 'long_query_time';
-show global variables like 'use_global_long_query_time';
-set global use_global_long_query_time=1;
-show variables like 'long_query_time';
-show global variables like 'long_query_time';
-show global variables like 'use_global_long_query_time';
-
-#-- echo # Make insert(5) on master
-connection master;
-let $MASTER_DATADIR= `select @@datadir`;
-INSERT INTO t VALUES (5);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync slave(5) thread
-connection slave;
-let $SLAVE_DATADIR= `select @@datadir`;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-show variables like 'long_query_time';
-show global variables like 'long_query_time';
-show global variables like 'use_global_long_query_time';
-set global long_query_time=1;
-set global use_global_long_query_time=0;
-
--- echo # Analyse master slow_query_log
-let $i=5;
-let $k=1;
-let $cmd=cat ./$MASTER_DATADIR/percona_log_slow_slave_statements-master.log | grep;
-while($i)
-{
- let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l;
- exec $current_cmd;
- dec $i;
- inc $k;
-}
-
--- echo # Analyse slave slow_query_log
-let $i=5;
-let $k=1;
-let $cmd=cat $SLAVE_DATADIR/percona_log_slow_slave_statements-slave.log | grep;
-while($i)
-{
- let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l;
- exec $current_cmd;
- dec $i;
- inc $k;
-}
-set global log_slow_slave_statements=OFF;
-
-connection master;
-DROP TABLE t;
-
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync slave(6) thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements.result b/mysql-test/suite/percona/percona_log_slow_slave_statements.result
deleted file mode 100644
index e3bf3e92c94..00000000000
--- a/mysql-test/suite/percona/percona_log_slow_slave_statements.result
+++ /dev/null
@@ -1,86 +0,0 @@
-# Activate master-slave replication
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-# Make table t for test
-DROP TABLE IF EXISTS t;
-CREATE TABLE t(id INT);
-# Start slave replication
-START SLAVE;
-INSERT INTO t VALUES (1);
-# Read information about master binlog
-# Sync(1) slave thread
-# Read and change log_slow_slave_statements to ON on slave
-show variables like 'log_slow_slave_statements';
-Variable_name Value
-log_slow_slave_statements OFF
-set global log_slow_slave_statements=ON;
-show variables like 'log_slow_slave_statements';
-Variable_name Value
-log_slow_slave_statements ON
-INSERT INTO t VALUES (2);
-# Read information about master binlog
-# Sync slave(2) thread
-# Restart slave
-STOP SLAVE;
-START SLAVE;
-INSERT INTO t VALUES (3);
-# Read information about master binlog
-# Sync(3) slave thread
-# Read and change log_slow_slave_statements to OFF on slave
-show variables like 'log_slow_slave_statements';
-Variable_name Value
-log_slow_slave_statements ON
-set global log_slow_slave_statements=OFF;
-show variables like 'log_slow_slave_statements';
-Variable_name Value
-log_slow_slave_statements OFF
-INSERT INTO t VALUES (4);
-# Read information about master binlog
-# Sync slave(4) thread
-# Restart slave
-STOP SLAVE;
-START SLAVE;
-INSERT INTO t VALUES (5);
-# Read information about master binlog
-# Sync slave(5) thread
-# Read and change log_slow_slave_statements to ON on slave
-show variables like 'log_slow_slave_statements';
-Variable_name Value
-log_slow_slave_statements OFF
-set global log_slow_slave_statements=ON;
-show variables like 'log_slow_slave_statements';
-Variable_name Value
-log_slow_slave_statements ON
-INSERT INTO t VALUES (6);
-# Read information about master binlog
-# Sync slave(6) thread
-# Restart slave
-STOP SLAVE;
-START SLAVE;
-INSERT INTO t VALUES (7);
-# Read information about master binlog
-# Sync slave(7) thread
-# Analyse master slow_query_log
-1
-1
-1
-1
-1
-1
-1
-# Analyse slave slow_query_log
-0
-0
-1
-0
-0
-0
-1
-set global log_slow_slave_statements=OFF;
-DROP TABLE t;
-# Read information about master binlog
-# Sync slave(8) thread
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements.test b/mysql-test/suite/percona/percona_log_slow_slave_statements.test
deleted file mode 100644
index 8c9c594e41c..00000000000
--- a/mysql-test/suite/percona/percona_log_slow_slave_statements.test
+++ /dev/null
@@ -1,162 +0,0 @@
--- source include/not_windows.inc
-
--- echo # Activate master-slave replication
--- source include/master-slave.inc
-
-connection master;
--- echo # Make table t for test
--- disable_warnings
-DROP TABLE IF EXISTS t;
--- enable_warnings
-CREATE TABLE t(id INT);
-
-
--- echo # Start slave replication
--- disable_warnings
-connection slave;
-START SLAVE;
--- source include/wait_for_slave_to_start.inc
--- enable_warnings
-
-#-- echo # Make insert(1) on master
-connection master;
-INSERT INTO t VALUES (1);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync(1) slave thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-
--- echo # Read and change log_slow_slave_statements to ON on slave
-show variables like 'log_slow_slave_statements';
-set global log_slow_slave_statements=ON;
-show variables like 'log_slow_slave_statements';
-
-#-- echo # Make insert(2) on master
-connection master;
-INSERT INTO t VALUES (2);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync slave(2) thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
--- echo # Restart slave
-STOP SLAVE;
--- source include/wait_for_slave_to_stop.inc
-START SLAVE;
--- source include/wait_for_slave_to_start.inc
-
-#-- echo # Make insert(3) on master
-connection master;
-INSERT INTO t VALUES (3);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync(3) slave thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
--- echo # Read and change log_slow_slave_statements to OFF on slave
-show variables like 'log_slow_slave_statements';
-set global log_slow_slave_statements=OFF;
-show variables like 'log_slow_slave_statements';
-
-#-- echo # Make insert(4) on master
-connection master;
-INSERT INTO t VALUES (4);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync slave(4) thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
--- echo # Restart slave
-STOP SLAVE;
--- source include/wait_for_slave_to_stop.inc
-START SLAVE;
--- source include/wait_for_slave_to_start.inc
-
-#-- echo # Make insert(5) on master
-connection master;
-INSERT INTO t VALUES (5);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync slave(5) thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
--- echo # Read and change log_slow_slave_statements to ON on slave
-show variables like 'log_slow_slave_statements';
-set global log_slow_slave_statements=ON;
-show variables like 'log_slow_slave_statements';
-
-#-- echo # Make insert(6) on master
-connection master;
-INSERT INTO t VALUES (6);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync slave(6) thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
--- echo # Restart slave
-STOP SLAVE;
--- source include/wait_for_slave_to_stop.inc
-START SLAVE;
--- source include/wait_for_slave_to_start.inc
-
-#-- echo # Make insert(7) on master
-connection master;
-let $MASTER_DATADIR= `select @@datadir`;
-INSERT INTO t VALUES (7);
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync slave(7) thread
-connection slave;
-let $SLAVE_DATADIR= `select @@datadir`;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
-
--- echo # Analyse master slow_query_log
-let $i=7;
-let $k=1;
-let $cmd=cat $MASTER_DATADIR/percona_log_slow_slave_statements-master.log | grep -c;
-while($i)
-{
- let $current_cmd = $cmd "INSERT INTO t VALUES ($k)";
- exec $current_cmd;
- dec $i;
- inc $k;
-}
-
--- echo # Analyse slave slow_query_log
-let $i=7;
-let $k=1;
-let $cmd=cat $SLAVE_DATADIR/percona_log_slow_slave_statements-slave.log | grep -c;
-while($i)
-{
- let $current_cmd = $cmd "INSERT INTO t VALUES ($k)";
- exec $current_cmd;
- dec $i;
- inc $k;
-}
-set global log_slow_slave_statements=OFF;
-
-connection master;
-DROP TABLE t;
-
--- echo # Read information about master binlog
-let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
-let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
-
--- echo # Sync slave(8) thread
-connection slave;
-let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
diff --git a/mysql-test/suite/percona/percona_suppress_log_warning_1592-master.opt b/mysql-test/suite/percona/percona_log_warnings_suppress-master.opt
index 4658d62af60..4658d62af60 100644
--- a/mysql-test/suite/percona/percona_suppress_log_warning_1592-master.opt
+++ b/mysql-test/suite/percona/percona_log_warnings_suppress-master.opt
diff --git a/mysql-test/suite/percona/percona_log_warnings_suppress.result b/mysql-test/suite/percona/percona_log_warnings_suppress.result
new file mode 100644
index 00000000000..1ee6c46738a
--- /dev/null
+++ b/mysql-test/suite/percona/percona_log_warnings_suppress.result
@@ -0,0 +1,31 @@
+SET @old_log_warnings = @@log_warnings;
+SET @old_log_warnings_suppress = @@log_warnings_suppress;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
+SET GLOBAL log_warnings_suppress='';
+SET GLOBAL LOG_WARNINGS=0;
+SHOW GLOBAL VARIABLES LIKE 'log_warnings_suppress';
+Variable_name Value
+log_warnings_suppress
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SET GLOBAL LOG_WARNINGS=1;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SET GLOBAL log_warnings_suppress='1592';
+SET GLOBAL LOG_WARNINGS=0;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SET GLOBAL LOG_WARNINGS=1;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+DROP TABLE t1;
+SET GLOBAL log_warnings = @old_log_warnings;
+SET GLOBAL log_warnings_suppress = @old_log_warnings_suppress;
+# Count the number of times the "Unsafe" message was printed
+# to the error log.
+Occurrences: 1
diff --git a/mysql-test/suite/percona/percona_suppress_log_warning_1592.test b/mysql-test/suite/percona/percona_log_warnings_suppress.test
index 97fe40469fc..82221013f0b 100644
--- a/mysql-test/suite/percona/percona_suppress_log_warning_1592.test
+++ b/mysql-test/suite/percona/percona_log_warnings_suppress.test
@@ -2,26 +2,27 @@
-- source include/have_binlog_format_statement.inc
SET @old_log_warnings = @@log_warnings;
-SET @old_suppress_log_warning_1592 = @@suppress_log_warning_1592;
+SET @old_log_warnings_suppress = @@log_warnings_suppress;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
-SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 0;
-SET GLOBAL LOG_WARNINGS = 0;
+SET GLOBAL log_warnings_suppress='';
+SET GLOBAL LOG_WARNINGS=0;
+SHOW GLOBAL VARIABLES LIKE 'log_warnings_suppress';
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
-SET GLOBAL LOG_WARNINGS = 1;
+SET GLOBAL LOG_WARNINGS=1;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
-SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 1;
-SET GLOBAL LOG_WARNINGS = 0;
+SET GLOBAL log_warnings_suppress='1592';
+SET GLOBAL LOG_WARNINGS=0;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
-SET GLOBAL LOG_WARNINGS = 1;
+SET GLOBAL LOG_WARNINGS=1;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
DROP TABLE t1;
SET GLOBAL log_warnings = @old_log_warnings;
-SET GLOBAL suppress_log_warning_1592 = @old_suppress_log_warning_1592;
+SET GLOBAL log_warnings_suppress = @old_log_warnings_suppress;
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!`select LENGTH('$log_error_')`)
diff --git a/mysql-test/suite/percona/percona_processlist_row_stats.result b/mysql-test/suite/percona/percona_processlist_row_stats.result
new file mode 100644
index 00000000000..e9b07b2eaea
--- /dev/null
+++ b/mysql-test/suite/percona/percona_processlist_row_stats.result
@@ -0,0 +1,74 @@
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES(10);
+INSERT INTO t2 VALUES(10);
+INSERT INTO t2 VALUES(20);
+INSERT INTO t2 VALUES(10);
+INSERT INTO t2 VALUES(20);
+Issuing operation that should not return any rows and stopping the thread #1
+SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';
+CREATE TABLE t1 (a INT);
+SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
+Thread #1 stopped
+Issuing row-returning query and stopping the thread #2 at the end of query
+SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
+SELECT a FROM t2 WHERE a > 15;
+SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
+Thread #2 stopped
+Look at thread states
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
+### root ### test Query ### ### SHOW PROCESSLIST 0 0 2
+### root ### test Query ### ### CREATE TABLE t1 (a INT) 0 0 1
+### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 2 5 6
+SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist
+ORDER BY id;
+id info rows_sent rows_examined rows_read
+### SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist
+ORDER BY id 0 0 1
+### CREATE TABLE t1 (a INT) 0 0 1
+### SELECT a FROM t2 WHERE a > 15 2 5 6
+Let threads #1 and #2 finish their job
+SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
+a
+20
+20
+Issuing row-returning query and stopping the thread #2 in the middle of query
+SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';
+SELECT a FROM t2 WHERE a > 15;
+SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
+Thread #2 stopped, look at its state
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
+### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
+### root ### test Sleep ### ### NULL 0 0 1
+### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 1 0 3
+SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
+id rows_sent rows_examined rows_read
+### 0 0 1
+### 0 0 1
+### 1 0 3
+SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
+Let thread #2 finish its job
+a
+20
+20
+Issuing an UPDATE and stopping thread #2
+SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
+UPDATE t2 SET a = 15 WHERE a = 10;
+SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
+Thread #2 stopped, look at its state
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
+### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
+### root ### test Sleep ### ### NULL 0 0 1
+### root ### test Query ### ### UPDATE t2 SET a = 15 WHERE a = 10 0 5 6
+SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
+id rows_sent rows_examined rows_read
+### 0 0 1
+### 0 0 1
+### 0 5 6
+SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
+Let thread #2 finish its job
+DROP TABLES t1, t2;
diff --git a/mysql-test/suite/percona/percona_processlist_row_stats.test b/mysql-test/suite/percona/percona_processlist_row_stats.test
new file mode 100644
index 00000000000..230a9f4c311
--- /dev/null
+++ b/mysql-test/suite/percona/percona_processlist_row_stats.test
@@ -0,0 +1,92 @@
+# Testing of INFORMATION_SCHEMA.PROCESSLIST fields ROWS_SENT, ROWS_EXAMINED, ROWS_READ
+--source include/have_debug_sync.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES(10);
+INSERT INTO t2 VALUES(10);
+INSERT INTO t2 VALUES(20);
+INSERT INTO t2 VALUES(10);
+INSERT INTO t2 VALUES(20);
+
+connect (conn1, localhost, root, ,);
+connect (conn2, localhost, root, ,);
+
+--connection conn1
+echo Issuing operation that should not return any rows and stopping the thread #1;
+SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';
+send CREATE TABLE t1 (a INT);
+
+--connection default
+SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
+--echo Thread #1 stopped
+
+--connection conn2
+echo Issuing row-returning query and stopping the thread #2 at the end of query;
+SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
+send SELECT a FROM t2 WHERE a > 15;
+
+--connection default
+SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
+--echo Thread #2 stopped
+--echo Look at thread states
+
+--replace_column 1 ### 3 ### 6 ### 7 ###
+SHOW PROCESSLIST;
+# The running threads are different between SHOW above and SELECT below. Thus select info too to
+# show the difference. Results are in the same order as in SHOW.
+--replace_column 1 ###
+SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist
+ORDER BY id;
+
+echo Let threads #1 and #2 finish their job;
+SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
+
+--connection conn1
+reap;
+
+--connection conn2
+reap;
+echo Issuing row-returning query and stopping the thread #2 in the middle of query;
+SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';
+send SELECT a FROM t2 WHERE a > 15;
+
+--connection default
+SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
+echo Thread #2 stopped, look at its state;
+
+--replace_column 1 ### 3 ### 6 ### 7 ###
+SHOW PROCESSLIST;
+--replace_column 1 ###
+SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
+SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
+echo Let thread #2 finish its job;
+
+--connection conn2
+reap;
+echo Issuing an UPDATE and stopping thread #2;
+SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
+send UPDATE t2 SET a = 15 WHERE a = 10;
+
+--connection default
+SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
+echo Thread #2 stopped, look at its state;
+
+--replace_column 1 ### 3 ### 6 ### 7 ###
+SHOW PROCESSLIST;
+--replace_column 1 ###
+SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
+SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
+echo Let thread #2 finish its job;
+
+--connection conn2
+reap;
+
+--connection default
+disconnect conn1;
+disconnect conn2;
+DROP TABLES t1, t2;
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments.inc b/mysql-test/suite/percona/percona_query_cache_with_comments.inc
new file mode 100644
index 00000000000..d55e52d5b64
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments.inc
@@ -0,0 +1,95 @@
+--source percona_query_cache_with_comments_clear.inc
+let $query=/* with comment first */select * from t1;
+eval $query;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=# with comment first
+select * from t1;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=-- with comment first
+select * from t1;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=/* with comment first and "quote" */select * from t1;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=# with comment first and "quote"
+select * from t1;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=-- with comment first and "quote"
+select * from t1;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=
+ /* with comment and whitespaces first */select * from t1;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=
+ # with comment and whitespaces first
+select * from t1;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=
+ -- with comment and whitespaces first
+select * from t1;
+--source percona_query_cache_with_comments_eval.inc
+
+let $internal=* internal comment *;
+
+let $query=select * /$internal/ from t1;
+--source percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/ from t1;
+--source percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/from t1;
+--source percona_query_cache_with_comments_eval.inc
+
+let $internal=* internal comment with "quote" *;
+
+let $query=select * /$internal/ from t1;
+--source percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/ from t1;
+--source percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/from t1;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 ;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 ;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+/* comment in the end */;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+/* *\/ */;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+/* comment in the end */
+;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 #comment in the end;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 #comment in the end
+;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 -- comment in the end;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 -- comment in the end
+;
+--source percona_query_cache_with_comments_eval.inc
+
+let $query=select ' \' ' from t1;
+--source percona_query_cache_with_comments_eval.inc
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments.test b/mysql-test/suite/percona/percona_query_cache_with_comments.test
index 0190f54d104..0b93441f364 100644
--- a/mysql-test/suite/percona/percona_query_cache_with_comments.test
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments.test
@@ -1,3 +1,4 @@
+--disable_ps_protocol
set global query_cache_strip_comments=ON;
-- source include/percona_query_cache_with_comments_begin.inc
-- source include/percona_query_cache_with_comments.inc
diff --git a/mysql-test/include/percona_query_cache_with_comments_begin.inc b/mysql-test/suite/percona/percona_query_cache_with_comments_begin.inc
index 38bfce20263..6bfd2bfbc83 100644
--- a/mysql-test/include/percona_query_cache_with_comments_begin.inc
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_begin.inc
@@ -9,4 +9,4 @@ drop table if exists t1;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
---source include/percona_query_cache_with_comments_clear.inc
+--source percona_query_cache_with_comments_clear.inc
diff --git a/mysql-test/include/percona_query_cache_with_comments_clear.inc b/mysql-test/suite/percona/percona_query_cache_with_comments_clear.inc
index 728a19a3c97..728a19a3c97 100644
--- a/mysql-test/include/percona_query_cache_with_comments_clear.inc
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_clear.inc
diff --git a/mysql-test/include/percona_query_cache_with_comments_end.inc b/mysql-test/suite/percona/percona_query_cache_with_comments_end.inc
index d5356359d7e..d5356359d7e 100644
--- a/mysql-test/include/percona_query_cache_with_comments_end.inc
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_end.inc
diff --git a/mysql-test/include/percona_query_cache_with_comments_eval.inc b/mysql-test/suite/percona/percona_query_cache_with_comments_eval.inc
index a409786d554..f0c200245e0 100644
--- a/mysql-test/include/percona_query_cache_with_comments_eval.inc
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_eval.inc
@@ -1,7 +1,7 @@
echo -----------------------------------------------------;
echo $query;
echo -----------------------------------------------------;
---source include/percona_query_cache_with_comments_show.inc
+--source percona_query_cache_with_comments_show.inc
eval $query;
eval $query;
---source include/percona_query_cache_with_comments_show.inc
+--source percona_query_cache_with_comments_show.inc
diff --git a/mysql-test/include/percona_query_cache_with_comments_show.inc b/mysql-test/suite/percona/percona_query_cache_with_comments_show.inc
index 71aa5211cfd..71aa5211cfd 100644
--- a/mysql-test/include/percona_query_cache_with_comments_show.inc
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_show.inc
diff --git a/mysql-test/suite/percona/percona_query_response_time-replication.result b/mysql-test/suite/percona/percona_query_response_time-replication.result
index df5c73812df..fd06d07b4d8 100644
--- a/mysql-test/suite/percona/percona_query_response_time-replication.result
+++ b/mysql-test/suite/percona/percona_query_response_time-replication.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT);
SELECT * from t;
@@ -21,12 +17,16 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 10
FLUSH QUERY_RESPONSE_TIME;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=ON;
-INSERT INTO t VALUES(0);
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=ON;
+INSERT INTO t SELECT SLEEP(0.4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
0
-INSERT INTO t VALUES(1);
+INSERT INTO t SELECT SLEEP(0.4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
0
@@ -41,11 +41,15 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 2
FLUSH QUERY_RESPONSE_TIME;
-INSERT INTO t VALUES(0);
+INSERT INTO t SELECT SLEEP(0.4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
0
-INSERT INTO t VALUES(1);
+INSERT INTO t SELECT SLEEP(0.4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
0
@@ -57,4 +61,6 @@ SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
3
DROP TABLE IF EXISTS t;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=OFF;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=OFF;
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/percona/percona_query_response_time-replication.test b/mysql-test/suite/percona/percona_query_response_time-replication.test
index 4f674c2fd19..199ecce0977 100644
--- a/mysql-test/suite/percona/percona_query_response_time-replication.test
+++ b/mysql-test/suite/percona/percona_query_response_time-replication.test
@@ -1,4 +1,10 @@
+--source include/have_response_time_distribution.inc
--source include/master-slave.inc
+--source include/have_binlog_format_statement.inc
+--source include/have_debug.inc
+--disable_query_log
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement:");
+--enable_query_log
connection master;
-- disable_warnings
@@ -16,12 +22,12 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=ON;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=ON;
connection master;
-INSERT INTO t VALUES(0);
+INSERT INTO t SELECT SLEEP(0.4);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
-INSERT INTO t VALUES(1);
+INSERT INTO t SELECT SLEEP(0.4);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
sync_slave_with_master;
@@ -34,9 +40,9 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
connection master;
-INSERT INTO t VALUES(0);
+INSERT INTO t SELECT SLEEP(0.4);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
-INSERT INTO t VALUES(1);
+INSERT INTO t SELECT SLEEP(0.4);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
sync_slave_with_master;
@@ -49,4 +55,7 @@ DROP TABLE IF EXISTS t;
sync_slave_with_master;
connection slave;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=OFF;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=OFF;
+
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/percona/percona_query_response_time-stored.result b/mysql-test/suite/percona/percona_query_response_time-stored.result
index df51f2bfd58..0168c4630be 100644
--- a/mysql-test/suite/percona/percona_query_response_time-stored.result
+++ b/mysql-test/suite/percona/percona_query_response_time-stored.result
@@ -1,15 +1,9 @@
+SET GLOBAL debug="d,query_exec_time_debug";
CREATE FUNCTION test_f()
RETURNS CHAR(30) DETERMINISTIC
BEGIN
-DECLARE first VARCHAR(5);
-DECLARE second VARCHAR(5);
-DECLARE result VARCHAR(20);
-SELECT SLEEP(1.11) INTO first;
-SET first= 'Hello';
-SET second=', ';
-SET result= CONCAT(first,second);
-SET result= CONCAT(result,'world!');
-RETURN result;
+SET SESSION debug="+d,query_exec_time_1.1";
+RETURN 'Hello, world!';
END/
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
Warnings:
@@ -78,7 +72,7 @@ time
4194304.00000
8388608.00000
TOO LONG
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
@@ -91,7 +85,7 @@ Hello, world!
SELECT test_f();
test_f()
Hello, world!
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
@@ -99,8 +93,7 @@ SELECT d.count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count query_count query_total not_zero_region_count region_count
-1 5 4 2 44
-4 5 4 2 44
+4 4 4 1 44
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
44
@@ -158,11 +151,11 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 10
FLUSH QUERY_RESPONSE_TIME;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
@@ -170,8 +163,7 @@ SELECT d.count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count query_count query_total not_zero_region_count region_count
-1 2 1 2 14
-1 2 1 2 14
+1 1 1 1 14
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
14
@@ -199,11 +191,11 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 7
FLUSH QUERY_RESPONSE_TIME;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
@@ -211,8 +203,7 @@ SELECT d.count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count query_count query_total not_zero_region_count region_count
-1 2 1 2 17
-1 2 1 2 17
+1 1 1 1 17
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
17
@@ -243,11 +234,11 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 156
FLUSH QUERY_RESPONSE_TIME;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
@@ -255,8 +246,7 @@ SELECT d.count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count query_count query_total not_zero_region_count region_count
-1 2 1 2 7
-1 2 1 2 7
+1 1 1 1 7
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
7
@@ -277,11 +267,11 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 1000
FLUSH QUERY_RESPONSE_TIME;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
@@ -289,8 +279,7 @@ SELECT d.count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count query_count query_total not_zero_region_count region_count
-1 2 1 2 6
-1 2 1 2 6
+1 1 1 1 6
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
6
@@ -311,6 +300,7 @@ Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 1000
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
DROP FUNCTION test_f;
+SET GLOBAL debug=default;
diff --git a/mysql-test/suite/percona/percona_query_response_time-stored.test b/mysql-test/suite/percona/percona_query_response_time-stored.test
index f761dd7d01c..e80fc3dd3c0 100644
--- a/mysql-test/suite/percona/percona_query_response_time-stored.test
+++ b/mysql-test/suite/percona/percona_query_response_time-stored.test
@@ -1,18 +1,14 @@
-source include/have_innodb.inc;
+--source include/have_response_time_distribution.inc
+--source include/have_debug.inc
+
+SET GLOBAL debug="d,query_exec_time_debug";
delimiter /;
CREATE FUNCTION test_f()
RETURNS CHAR(30) DETERMINISTIC
BEGIN
- DECLARE first VARCHAR(5);
- DECLARE second VARCHAR(5);
- DECLARE result VARCHAR(20);
- SELECT SLEEP(1.11) INTO first;
- SET first= 'Hello';
- SET second=', ';
- SET result= CONCAT(first,second);
- SET result= CONCAT(result,'world!');
- RETURN result;
+ SET SESSION debug="+d,query_exec_time_1.1";
+ RETURN 'Hello, world!';
END/
delimiter ;/
@@ -24,12 +20,12 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
source include/percona_query_response_time_show.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
SELECT test_f();
SELECT test_f();
SELECT test_f();
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
@@ -38,9 +34,9 @@ SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
@@ -49,9 +45,9 @@ SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
@@ -60,9 +56,9 @@ SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
@@ -71,9 +67,9 @@ SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
@@ -81,7 +77,9 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
-DROP FUNCTION test_f; \ No newline at end of file
+DROP FUNCTION test_f;
+
+SET GLOBAL debug=default;
diff --git a/mysql-test/suite/percona/percona_query_response_time.result b/mysql-test/suite/percona/percona_query_response_time.result
index 54657b6ca06..2243c155e39 100644
--- a/mysql-test/suite/percona/percona_query_response_time.result
+++ b/mysql-test/suite/percona/percona_query_response_time.result
@@ -1,3 +1,4 @@
+SET GLOBAL debug="d,query_exec_time_debug";
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
Warnings:
Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
@@ -65,65 +66,27 @@ time
4194304.00000
8388608.00000
TOO LONG
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
-SELECT SLEEP(0.31);
-SLEEP(0.31)
-0
-SELECT SLEEP(0.32);
-SLEEP(0.32)
-0
-SELECT SLEEP(0.33);
-SLEEP(0.33)
-0
-SELECT SLEEP(0.34);
-SLEEP(0.34)
-0
-SELECT SLEEP(0.35);
-SLEEP(0.35)
-0
-SELECT SLEEP(0.36);
-SLEEP(0.36)
-0
-SELECT SLEEP(0.37);
-SLEEP(0.37)
-0
-SELECT SLEEP(0.38);
-SLEEP(0.38)
-0
-SELECT SLEEP(0.39);
-SLEEP(0.39)
-0
-SELECT SLEEP(0.40);
-SLEEP(0.40)
-0
-SELECT SLEEP(1.1);
-SLEEP(1.1)
-0
-SELECT SLEEP(1.2);
-SLEEP(1.2)
-0
-SELECT SLEEP(1.3);
-SLEEP(1.3)
-0
-SELECT SLEEP(1.5);
-SLEEP(1.5)
-0
-SELECT SLEEP(1.4);
-SLEEP(1.4)
-0
-SELECT SLEEP(0.5);
-SLEEP(0.5)
-0
-SELECT SLEEP(2.1);
-SLEEP(2.1)
-0
-SELECT SLEEP(2.3);
-SLEEP(2.3)
-0
-SELECT SLEEP(2.5);
-SLEEP(2.5)
-0
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
+SET SESSION debug="+d,query_exec_time_0.31";
+SET SESSION debug="+d,query_exec_time_0.32";
+SET SESSION debug="+d,query_exec_time_0.33";
+SET SESSION debug="+d,query_exec_time_0.34";
+SET SESSION debug="+d,query_exec_time_0.35";
+SET SESSION debug="+d,query_exec_time_0.36";
+SET SESSION debug="+d,query_exec_time_0.37";
+SET SESSION debug="+d,query_exec_time_0.38";
+SET SESSION debug="+d,query_exec_time_0.39";
+SET SESSION debug="+d,query_exec_time_0.4";
+SET SESSION debug="+d,query_exec_time_1.1";
+SET SESSION debug="+d,query_exec_time_1.2";
+SET SESSION debug="+d,query_exec_time_1.3";
+SET SESSION debug="+d,query_exec_time_1.5";
+SET SESSION debug="+d,query_exec_time_1.4";
+SET SESSION debug="+d,query_exec_time_0.5";
+SET SESSION debug="+d,query_exec_time_2.1";
+SET SESSION debug="+d,query_exec_time_2.3";
+SET SESSION debug="+d,query_exec_time_2.5";
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
@@ -131,11 +94,10 @@ SELECT d.count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count query_count query_total not_zero_region_count region_count
-1 20 15 5 44
-10 20 15 5 44
-1 20 15 5 44
-5 20 15 5 44
-3 20 15 5 44
+10 19 15 4 44
+1 19 15 4 44
+5 19 15 4 44
+3 19 15 4 44
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
44
@@ -193,65 +155,27 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 10
FLUSH QUERY_RESPONSE_TIME;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
-SELECT SLEEP(0.31);
-SLEEP(0.31)
-0
-SELECT SLEEP(0.32);
-SLEEP(0.32)
-0
-SELECT SLEEP(0.33);
-SLEEP(0.33)
-0
-SELECT SLEEP(0.34);
-SLEEP(0.34)
-0
-SELECT SLEEP(0.35);
-SLEEP(0.35)
-0
-SELECT SLEEP(0.36);
-SLEEP(0.36)
-0
-SELECT SLEEP(0.37);
-SLEEP(0.37)
-0
-SELECT SLEEP(0.38);
-SLEEP(0.38)
-0
-SELECT SLEEP(0.39);
-SLEEP(0.39)
-0
-SELECT SLEEP(0.40);
-SLEEP(0.40)
-0
-SELECT SLEEP(1.1);
-SLEEP(1.1)
-0
-SELECT SLEEP(1.2);
-SLEEP(1.2)
-0
-SELECT SLEEP(1.3);
-SLEEP(1.3)
-0
-SELECT SLEEP(1.5);
-SLEEP(1.5)
-0
-SELECT SLEEP(1.4);
-SLEEP(1.4)
-0
-SELECT SLEEP(0.5);
-SLEEP(0.5)
-0
-SELECT SLEEP(2.1);
-SLEEP(2.1)
-0
-SELECT SLEEP(2.3);
-SLEEP(2.3)
-0
-SELECT SLEEP(2.5);
-SLEEP(2.5)
-0
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
+SET SESSION debug="+d,query_exec_time_0.31";
+SET SESSION debug="+d,query_exec_time_0.32";
+SET SESSION debug="+d,query_exec_time_0.33";
+SET SESSION debug="+d,query_exec_time_0.34";
+SET SESSION debug="+d,query_exec_time_0.35";
+SET SESSION debug="+d,query_exec_time_0.36";
+SET SESSION debug="+d,query_exec_time_0.37";
+SET SESSION debug="+d,query_exec_time_0.38";
+SET SESSION debug="+d,query_exec_time_0.39";
+SET SESSION debug="+d,query_exec_time_0.4";
+SET SESSION debug="+d,query_exec_time_1.1";
+SET SESSION debug="+d,query_exec_time_1.2";
+SET SESSION debug="+d,query_exec_time_1.3";
+SET SESSION debug="+d,query_exec_time_1.5";
+SET SESSION debug="+d,query_exec_time_1.4";
+SET SESSION debug="+d,query_exec_time_0.5";
+SET SESSION debug="+d,query_exec_time_2.1";
+SET SESSION debug="+d,query_exec_time_2.3";
+SET SESSION debug="+d,query_exec_time_2.5";
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
@@ -259,9 +183,8 @@ SELECT d.count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count query_count query_total not_zero_region_count region_count
-1 20 17 3 14
-11 20 17 3 14
-8 20 17 3 14
+11 19 17 2 14
+8 19 17 2 14
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
14
@@ -289,65 +212,27 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 7
FLUSH QUERY_RESPONSE_TIME;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
-SELECT SLEEP(0.31);
-SLEEP(0.31)
-0
-SELECT SLEEP(0.32);
-SLEEP(0.32)
-0
-SELECT SLEEP(0.33);
-SLEEP(0.33)
-0
-SELECT SLEEP(0.34);
-SLEEP(0.34)
-0
-SELECT SLEEP(0.35);
-SLEEP(0.35)
-0
-SELECT SLEEP(0.36);
-SLEEP(0.36)
-0
-SELECT SLEEP(0.37);
-SLEEP(0.37)
-0
-SELECT SLEEP(0.38);
-SLEEP(0.38)
-0
-SELECT SLEEP(0.39);
-SLEEP(0.39)
-0
-SELECT SLEEP(0.40);
-SLEEP(0.40)
-0
-SELECT SLEEP(1.1);
-SLEEP(1.1)
-0
-SELECT SLEEP(1.2);
-SLEEP(1.2)
-0
-SELECT SLEEP(1.3);
-SLEEP(1.3)
-0
-SELECT SLEEP(1.5);
-SLEEP(1.5)
-0
-SELECT SLEEP(1.4);
-SLEEP(1.4)
-0
-SELECT SLEEP(0.5);
-SLEEP(0.5)
-0
-SELECT SLEEP(2.1);
-SLEEP(2.1)
-0
-SELECT SLEEP(2.3);
-SLEEP(2.3)
-0
-SELECT SLEEP(2.5);
-SLEEP(2.5)
-0
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
+SET SESSION debug="+d,query_exec_time_0.31";
+SET SESSION debug="+d,query_exec_time_0.32";
+SET SESSION debug="+d,query_exec_time_0.33";
+SET SESSION debug="+d,query_exec_time_0.34";
+SET SESSION debug="+d,query_exec_time_0.35";
+SET SESSION debug="+d,query_exec_time_0.36";
+SET SESSION debug="+d,query_exec_time_0.37";
+SET SESSION debug="+d,query_exec_time_0.38";
+SET SESSION debug="+d,query_exec_time_0.39";
+SET SESSION debug="+d,query_exec_time_0.4";
+SET SESSION debug="+d,query_exec_time_1.1";
+SET SESSION debug="+d,query_exec_time_1.2";
+SET SESSION debug="+d,query_exec_time_1.3";
+SET SESSION debug="+d,query_exec_time_1.5";
+SET SESSION debug="+d,query_exec_time_1.4";
+SET SESSION debug="+d,query_exec_time_0.5";
+SET SESSION debug="+d,query_exec_time_2.1";
+SET SESSION debug="+d,query_exec_time_2.3";
+SET SESSION debug="+d,query_exec_time_2.5";
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
@@ -355,9 +240,8 @@ SELECT d.count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count query_count query_total not_zero_region_count region_count
-1 20 17 3 17
-11 20 17 3 17
-8 20 17 3 17
+11 19 17 2 17
+8 19 17 2 17
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
17
@@ -388,65 +272,27 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 156
FLUSH QUERY_RESPONSE_TIME;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
-SELECT SLEEP(0.31);
-SLEEP(0.31)
-0
-SELECT SLEEP(0.32);
-SLEEP(0.32)
-0
-SELECT SLEEP(0.33);
-SLEEP(0.33)
-0
-SELECT SLEEP(0.34);
-SLEEP(0.34)
-0
-SELECT SLEEP(0.35);
-SLEEP(0.35)
-0
-SELECT SLEEP(0.36);
-SLEEP(0.36)
-0
-SELECT SLEEP(0.37);
-SLEEP(0.37)
-0
-SELECT SLEEP(0.38);
-SLEEP(0.38)
-0
-SELECT SLEEP(0.39);
-SLEEP(0.39)
-0
-SELECT SLEEP(0.40);
-SLEEP(0.40)
-0
-SELECT SLEEP(1.1);
-SLEEP(1.1)
-0
-SELECT SLEEP(1.2);
-SLEEP(1.2)
-0
-SELECT SLEEP(1.3);
-SLEEP(1.3)
-0
-SELECT SLEEP(1.5);
-SLEEP(1.5)
-0
-SELECT SLEEP(1.4);
-SLEEP(1.4)
-0
-SELECT SLEEP(0.5);
-SLEEP(0.5)
-0
-SELECT SLEEP(2.1);
-SLEEP(2.1)
-0
-SELECT SLEEP(2.3);
-SLEEP(2.3)
-0
-SELECT SLEEP(2.5);
-SLEEP(2.5)
-0
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
+SET SESSION debug="+d,query_exec_time_0.31";
+SET SESSION debug="+d,query_exec_time_0.32";
+SET SESSION debug="+d,query_exec_time_0.33";
+SET SESSION debug="+d,query_exec_time_0.34";
+SET SESSION debug="+d,query_exec_time_0.35";
+SET SESSION debug="+d,query_exec_time_0.36";
+SET SESSION debug="+d,query_exec_time_0.37";
+SET SESSION debug="+d,query_exec_time_0.38";
+SET SESSION debug="+d,query_exec_time_0.39";
+SET SESSION debug="+d,query_exec_time_0.4";
+SET SESSION debug="+d,query_exec_time_1.1";
+SET SESSION debug="+d,query_exec_time_1.2";
+SET SESSION debug="+d,query_exec_time_1.3";
+SET SESSION debug="+d,query_exec_time_1.5";
+SET SESSION debug="+d,query_exec_time_1.4";
+SET SESSION debug="+d,query_exec_time_0.5";
+SET SESSION debug="+d,query_exec_time_2.1";
+SET SESSION debug="+d,query_exec_time_2.3";
+SET SESSION debug="+d,query_exec_time_2.5";
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
@@ -454,9 +300,8 @@ SELECT d.count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count query_count query_total not_zero_region_count region_count
-1 20 17 3 7
-11 20 17 3 7
-8 20 17 3 7
+11 19 17 2 7
+8 19 17 2 7
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
7
@@ -477,65 +322,27 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 1000
FLUSH QUERY_RESPONSE_TIME;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
-SELECT SLEEP(0.31);
-SLEEP(0.31)
-0
-SELECT SLEEP(0.32);
-SLEEP(0.32)
-0
-SELECT SLEEP(0.33);
-SLEEP(0.33)
-0
-SELECT SLEEP(0.34);
-SLEEP(0.34)
-0
-SELECT SLEEP(0.35);
-SLEEP(0.35)
-0
-SELECT SLEEP(0.36);
-SLEEP(0.36)
-0
-SELECT SLEEP(0.37);
-SLEEP(0.37)
-0
-SELECT SLEEP(0.38);
-SLEEP(0.38)
-0
-SELECT SLEEP(0.39);
-SLEEP(0.39)
-0
-SELECT SLEEP(0.40);
-SLEEP(0.40)
-0
-SELECT SLEEP(1.1);
-SLEEP(1.1)
-0
-SELECT SLEEP(1.2);
-SLEEP(1.2)
-0
-SELECT SLEEP(1.3);
-SLEEP(1.3)
-0
-SELECT SLEEP(1.5);
-SLEEP(1.5)
-0
-SELECT SLEEP(1.4);
-SLEEP(1.4)
-0
-SELECT SLEEP(0.5);
-SLEEP(0.5)
-0
-SELECT SLEEP(2.1);
-SLEEP(2.1)
-0
-SELECT SLEEP(2.3);
-SLEEP(2.3)
-0
-SELECT SLEEP(2.5);
-SLEEP(2.5)
-0
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
+SET SESSION debug="+d,query_exec_time_0.31";
+SET SESSION debug="+d,query_exec_time_0.32";
+SET SESSION debug="+d,query_exec_time_0.33";
+SET SESSION debug="+d,query_exec_time_0.34";
+SET SESSION debug="+d,query_exec_time_0.35";
+SET SESSION debug="+d,query_exec_time_0.36";
+SET SESSION debug="+d,query_exec_time_0.37";
+SET SESSION debug="+d,query_exec_time_0.38";
+SET SESSION debug="+d,query_exec_time_0.39";
+SET SESSION debug="+d,query_exec_time_0.4";
+SET SESSION debug="+d,query_exec_time_1.1";
+SET SESSION debug="+d,query_exec_time_1.2";
+SET SESSION debug="+d,query_exec_time_1.3";
+SET SESSION debug="+d,query_exec_time_1.5";
+SET SESSION debug="+d,query_exec_time_1.4";
+SET SESSION debug="+d,query_exec_time_0.5";
+SET SESSION debug="+d,query_exec_time_2.1";
+SET SESSION debug="+d,query_exec_time_2.3";
+SET SESSION debug="+d,query_exec_time_2.5";
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
@@ -543,9 +350,8 @@ SELECT d.count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count query_count query_total not_zero_region_count region_count
-1 20 17 3 6
-11 20 17 3 6
-8 20 17 3 6
+11 19 17 2 6
+8 19 17 2 6
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
6
@@ -566,5 +372,6 @@ Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 1000
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
+SET GLOBAL debug=default;
diff --git a/mysql-test/suite/percona/percona_query_response_time.test b/mysql-test/suite/percona/percona_query_response_time.test
index a58cafc8d01..f2df156b13d 100644
--- a/mysql-test/suite/percona/percona_query_response_time.test
+++ b/mysql-test/suite/percona/percona_query_response_time.test
@@ -1,4 +1,8 @@
-source include/have_innodb.inc;
+--source include/have_response_time_distribution.inc
+--source include/have_debug.inc
+
+SET GLOBAL debug="d,query_exec_time_debug";
+
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
@@ -7,9 +11,9 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
source include/percona_query_response_time_show.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
source include/percona_query_response_time_sleep.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
@@ -18,9 +22,9 @@ SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
source include/percona_query_response_time_sleep.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
@@ -29,9 +33,9 @@ SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
source include/percona_query_response_time_sleep.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
@@ -40,9 +44,9 @@ SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
source include/percona_query_response_time_sleep.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
@@ -51,9 +55,9 @@ SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
source include/percona_query_response_time_sleep.inc;
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
@@ -61,5 +65,7 @@ SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
+
+SET GLOBAL debug=default;
diff --git a/mysql-test/include/percona_query_response_time_flush.inc b/mysql-test/suite/percona/percona_query_response_time_flush.inc
index 44bb320fe13..44bb320fe13 100644
--- a/mysql-test/include/percona_query_response_time_flush.inc
+++ b/mysql-test/suite/percona/percona_query_response_time_flush.inc
diff --git a/mysql-test/include/percona_query_response_time_show.inc b/mysql-test/suite/percona/percona_query_response_time_show.inc
index 709abf9872e..709abf9872e 100644
--- a/mysql-test/include/percona_query_response_time_show.inc
+++ b/mysql-test/suite/percona/percona_query_response_time_show.inc
diff --git a/mysql-test/suite/percona/percona_query_response_time_sleep.inc b/mysql-test/suite/percona/percona_query_response_time_sleep.inc
new file mode 100644
index 00000000000..d889fd9f98d
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_response_time_sleep.inc
@@ -0,0 +1,19 @@
+SET SESSION debug="+d,query_exec_time_0.31";
+SET SESSION debug="+d,query_exec_time_0.32";
+SET SESSION debug="+d,query_exec_time_0.33";
+SET SESSION debug="+d,query_exec_time_0.34";
+SET SESSION debug="+d,query_exec_time_0.35";
+SET SESSION debug="+d,query_exec_time_0.36";
+SET SESSION debug="+d,query_exec_time_0.37";
+SET SESSION debug="+d,query_exec_time_0.38";
+SET SESSION debug="+d,query_exec_time_0.39";
+SET SESSION debug="+d,query_exec_time_0.4";
+SET SESSION debug="+d,query_exec_time_1.1";
+SET SESSION debug="+d,query_exec_time_1.2";
+SET SESSION debug="+d,query_exec_time_1.3";
+SET SESSION debug="+d,query_exec_time_1.5";
+SET SESSION debug="+d,query_exec_time_1.4";
+SET SESSION debug="+d,query_exec_time_0.5";
+SET SESSION debug="+d,query_exec_time_2.1";
+SET SESSION debug="+d,query_exec_time_2.3";
+SET SESSION debug="+d,query_exec_time_2.5";
diff --git a/mysql-test/suite/percona/percona_server_variables.inc b/mysql-test/suite/percona/percona_server_variables.inc
new file mode 100644
index 00000000000..60c8e0ba759
--- /dev/null
+++ b/mysql-test/suite/percona/percona_server_variables.inc
@@ -0,0 +1,3 @@
+--source have_response_time_distribution.inc
+--source include/have_xtradb.inc
+SELECT Variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES ORDER BY 1;
diff --git a/mysql-test/suite/percona/percona_server_variables.result b/mysql-test/suite/percona/percona_server_variables.result
deleted file mode 100644
index cb2af0d3d0e..00000000000
--- a/mysql-test/suite/percona/percona_server_variables.result
+++ /dev/null
@@ -1,342 +0,0 @@
-show variables;
-Variable_name Value
-auto_increment_increment Value
-auto_increment_offset Value
-autocommit Value
-automatic_sp_privileges Value
-back_log Value
-basedir Value
-big_tables Value
-binlog_cache_size Value
-binlog_direct_non_transactional_updates Value
-binlog_format Value
-bulk_insert_buffer_size Value
-character_set_client Value
-character_set_connection Value
-character_set_database Value
-character_set_filesystem Value
-character_set_results Value
-character_set_server Value
-character_set_system Value
-character_sets_dir Value
-collation_connection Value
-collation_database Value
-collation_server Value
-completion_type Value
-concurrent_insert Value
-connect_timeout Value
-datadir Value
-date_format Value
-datetime_format Value
-debug Value
-debug_sync Value
-default_week_format Value
-delay_key_write Value
-delayed_insert_limit Value
-delayed_insert_timeout Value
-delayed_queue_size Value
-div_precision_increment Value
-enable_query_response_time_stats Value
-engine_condition_pushdown Value
-error_count Value
-event_scheduler Value
-expire_logs_days Value
-fast_index_creation Value
-flush Value
-flush_time Value
-foreign_key_checks Value
-ft_boolean_syntax Value
-ft_max_word_len Value
-ft_min_word_len Value
-ft_query_expansion_limit Value
-ft_stopword_file Value
-general_log Value
-general_log_file Value
-group_concat_max_len Value
-have_community_features Value
-have_compress Value
-have_crypt Value
-have_csv Value
-have_dynamic_loading Value
-have_geometry Value
-have_innodb Value
-have_ndbcluster Value
-have_openssl Value
-have_partitioning Value
-have_query_cache Value
-have_rtree_keys Value
-have_ssl Value
-have_symlink Value
-hostname Value
-identity Value
-ignore_builtin_innodb Value
-init_connect Value
-init_file Value
-init_slave Value
-innodb_adaptive_checkpoint Value
-innodb_adaptive_flushing Value
-innodb_adaptive_hash_index Value
-innodb_additional_mem_pool_size Value
-innodb_auto_lru_dump Value
-innodb_autoextend_increment Value
-innodb_autoinc_lock_mode Value
-innodb_buffer_pool_shm_checksum Value
-innodb_buffer_pool_shm_key Value
-innodb_buffer_pool_size Value
-innodb_change_buffering Value
-innodb_checkpoint_age_target Value
-innodb_checksums Value
-innodb_commit_concurrency Value
-innodb_concurrency_tickets Value
-innodb_data_file_path Value
-innodb_data_home_dir Value
-innodb_dict_size_limit Value
-innodb_doublewrite Value
-innodb_doublewrite_file Value
-innodb_enable_unsafe_group_commit Value
-innodb_expand_import Value
-innodb_extra_rsegments Value
-innodb_extra_undoslots Value
-innodb_fast_checksum Value
-innodb_fast_recovery Value
-innodb_fast_shutdown Value
-innodb_file_format Value
-innodb_file_format_check Value
-innodb_file_per_table Value
-innodb_flush_log_at_trx_commit Value
-innodb_flush_log_at_trx_commit_session Value
-innodb_flush_method Value
-innodb_flush_neighbor_pages Value
-innodb_force_recovery Value
-innodb_ibuf_accel_rate Value
-innodb_ibuf_active_contract Value
-innodb_ibuf_max_size Value
-innodb_io_capacity Value
-innodb_lock_wait_timeout Value
-innodb_locks_unsafe_for_binlog Value
-innodb_log_buffer_size Value
-innodb_log_file_size Value
-innodb_log_files_in_group Value
-innodb_log_group_home_dir Value
-innodb_max_dirty_pages_pct Value
-innodb_max_purge_lag Value
-innodb_mirrored_log_groups Value
-innodb_old_blocks_pct Value
-innodb_old_blocks_time Value
-innodb_open_files Value
-innodb_overwrite_relay_log_info Value
-innodb_page_size Value
-innodb_pass_corrupt_table Value
-innodb_read_ahead Value
-innodb_read_ahead_threshold Value
-innodb_read_io_threads Value
-innodb_recovery_stats Value
-innodb_replication_delay Value
-innodb_rollback_on_timeout Value
-innodb_show_locks_held Value
-innodb_show_verbose_locks Value
-innodb_spin_wait_delay Value
-innodb_stats_auto_update Value
-innodb_stats_method Value
-innodb_stats_on_metadata Value
-innodb_stats_sample_pages Value
-innodb_stats_update_need_lock Value
-innodb_strict_mode Value
-innodb_support_xa Value
-innodb_sync_spin_loops Value
-innodb_table_locks Value
-innodb_thread_concurrency Value
-innodb_thread_concurrency_timer_based Value
-innodb_thread_sleep_delay Value
-innodb_use_purge_thread Value
-innodb_use_sys_malloc Value
-innodb_use_sys_stats_table Value
-innodb_version Value
-innodb_write_io_threads Value
-insert_id Value
-interactive_timeout Value
-join_buffer_size Value
-keep_files_on_create Value
-key_buffer_size Value
-key_cache_age_threshold Value
-key_cache_block_size Value
-key_cache_division_limit Value
-language Value
-large_files_support Value
-large_page_size Value
-large_pages Value
-last_insert_id Value
-lc_time_names Value
-license Value
-local_infile Value
-locked_in_memory Value
-log Value
-log_bin Value
-log_bin_trust_function_creators Value
-log_bin_trust_routine_creators Value
-log_error Value
-log_output Value
-log_queries_not_using_indexes Value
-log_slave_updates Value
-log_slow_filter Value
-log_slow_queries Value
-log_slow_rate_limit Value
-log_slow_slave_statements Value
-log_slow_sp_statements Value
-log_slow_timestamp_every Value
-log_slow_verbosity Value
-log_warnings Value
-long_query_time Value
-low_priority_updates Value
-lower_case_file_system Value
-lower_case_table_names Value
-max_allowed_packet Value
-max_binlog_cache_size Value
-max_binlog_size Value
-max_connect_errors Value
-max_connections Value
-max_delayed_threads Value
-max_error_count Value
-max_heap_table_size Value
-max_insert_delayed_threads Value
-max_join_size Value
-max_length_for_sort_data Value
-max_prepared_stmt_count Value
-max_relay_log_size Value
-max_seeks_for_key Value
-max_sort_length Value
-max_sp_recursion_depth Value
-max_tmp_tables Value
-max_user_connections Value
-max_write_lock_count Value
-min_examined_row_limit Value
-multi_range_count Value
-myisam_data_pointer_size Value
-myisam_max_sort_file_size Value
-myisam_mmap_size Value
-myisam_recover_options Value
-myisam_repair_threads Value
-myisam_sort_buffer_size Value
-myisam_stats_method Value
-myisam_use_mmap Value
-net_buffer_length Value
-net_read_timeout Value
-net_retry_count Value
-net_write_timeout Value
-new Value
-old Value
-old_alter_table Value
-old_passwords Value
-open_files_limit Value
-optimizer_fix Value
-optimizer_prune_level Value
-optimizer_search_depth Value
-optimizer_switch Value
-pid_file Value
-plugin_dir Value
-port Value
-preload_buffer_size Value
-profiling Value
-profiling_history_size Value
-profiling_server Value
-profiling_use_getrusage Value
-protocol_version Value
-pseudo_thread_id Value
-query_alloc_block_size Value
-query_cache_limit Value
-query_cache_min_res_unit Value
-query_cache_size Value
-query_cache_strip_comments Value
-query_cache_type Value
-query_cache_wlock_invalidate Value
-query_prealloc_size Value
-query_response_time_range_base Value
-rand_seed1 Value
-rand_seed2 Value
-range_alloc_block_size Value
-read_buffer_size Value
-read_only Value
-read_rnd_buffer_size Value
-relay_log Value
-relay_log_index Value
-relay_log_info_file Value
-relay_log_purge Value
-relay_log_space_limit Value
-report_host Value
-report_password Value
-report_port Value
-report_user Value
-rpl_recovery_rank Value
-secure_auth Value
-secure_file_priv Value
-server_id Value
-skip_external_locking Value
-skip_name_resolve Value
-skip_networking Value
-skip_show_database Value
-slave_compressed_protocol Value
-slave_exec_mode Value
-slave_load_tmpdir Value
-slave_net_timeout Value
-slave_skip_errors Value
-slave_transaction_retries Value
-slow_launch_time Value
-slow_query_log Value
-slow_query_log_file Value
-slow_query_log_microseconds_timestamp Value
-socket Value
-sort_buffer_size Value
-sql_auto_is_null Value
-sql_big_selects Value
-sql_big_tables Value
-sql_buffer_result Value
-sql_log_bin Value
-sql_log_off Value
-sql_log_update Value
-sql_low_priority_updates Value
-sql_max_join_size Value
-sql_mode Value
-sql_notes Value
-sql_quote_show_create Value
-sql_safe_updates Value
-sql_select_limit Value
-sql_slave_skip_counter Value
-sql_warnings Value
-ssl_ca Value
-ssl_capath Value
-ssl_cert Value
-ssl_cipher Value
-ssl_key Value
-storage_engine Value
-suppress_log_warning_1592 Value
-sync_binlog Value
-sync_frm Value
-system_time_zone Value
-table_definition_cache Value
-table_lock_wait_timeout Value
-table_open_cache Value
-table_type Value
-thread_cache_size Value
-thread_handling Value
-thread_stack Value
-thread_statistics Value
-time_format Value
-time_zone Value
-timed_mutexes Value
-timestamp Value
-tmp_table_size Value
-tmpdir Value
-transaction_alloc_block_size Value
-transaction_prealloc_size Value
-tx_isolation Value
-unique_checks Value
-updatable_views_with_limit Value
-use_global_log_slow_control Value
-use_global_long_query_time Value
-userstat_running Value
-version Value
-version_comment Value
-version_compile_machine Value
-version_compile_os Value
-wait_timeout Value
-warning_count Value
diff --git a/mysql-test/suite/percona/percona_server_variables.test b/mysql-test/suite/percona/percona_server_variables.test
deleted file mode 100644
index 232cbb15e25..00000000000
--- a/mysql-test/suite/percona/percona_server_variables.test
+++ /dev/null
@@ -1,7 +0,0 @@
---source include/have_innodb.inc
---source include/have_debug.inc
-
-#check the list of variable names
---replace_column 2 Value
-show variables;
-
diff --git a/mysql-test/suite/percona/percona_server_variables_debug.result b/mysql-test/suite/percona/percona_server_variables_debug.result
new file mode 100644
index 00000000000..1ffaa6a7704
--- /dev/null
+++ b/mysql-test/suite/percona/percona_server_variables_debug.result
@@ -0,0 +1,371 @@
+SELECT Variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES ORDER BY 1;
+Variable_name
+AUTOCOMMIT
+AUTOMATIC_SP_PRIVILEGES
+AUTO_INCREMENT_INCREMENT
+AUTO_INCREMENT_OFFSET
+BACK_LOG
+BASEDIR
+BIG_TABLES
+BINLOG_CACHE_SIZE
+BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
+BINLOG_FORMAT
+BINLOG_STMT_CACHE_SIZE
+BULK_INSERT_BUFFER_SIZE
+CHARACTER_SETS_DIR
+CHARACTER_SET_CLIENT
+CHARACTER_SET_CONNECTION
+CHARACTER_SET_DATABASE
+CHARACTER_SET_FILESYSTEM
+CHARACTER_SET_RESULTS
+CHARACTER_SET_SERVER
+CHARACTER_SET_SYSTEM
+COLLATION_CONNECTION
+COLLATION_DATABASE
+COLLATION_SERVER
+COMPLETION_TYPE
+CONCURRENT_INSERT
+CONNECT_TIMEOUT
+DATADIR
+DATETIME_FORMAT
+DATE_FORMAT
+DEBUG
+DEBUG_SYNC
+DEFAULT_STORAGE_ENGINE
+DEFAULT_WEEK_FORMAT
+DELAYED_INSERT_LIMIT
+DELAYED_INSERT_TIMEOUT
+DELAYED_QUEUE_SIZE
+DELAY_KEY_WRITE
+DIV_PRECISION_INCREMENT
+ENGINE_CONDITION_PUSHDOWN
+ERROR_COUNT
+EVENT_SCHEDULER
+EXPIRE_LOGS_DAYS
+EXTERNAL_USER
+FAST_INDEX_CREATION
+FLUSH
+FLUSH_TIME
+FOREIGN_KEY_CHECKS
+FT_BOOLEAN_SYNTAX
+FT_MAX_WORD_LEN
+FT_MIN_WORD_LEN
+FT_QUERY_EXPANSION_LIMIT
+FT_STOPWORD_FILE
+GENERAL_LOG
+GENERAL_LOG_FILE
+GROUP_CONCAT_MAX_LEN
+HAVE_COMPRESS
+HAVE_CRYPT
+HAVE_CSV
+HAVE_DYNAMIC_LOADING
+HAVE_GEOMETRY
+HAVE_INNODB
+HAVE_NDBCLUSTER
+HAVE_OPENSSL
+HAVE_PARTITIONING
+HAVE_PROFILING
+HAVE_QUERY_CACHE
+HAVE_RESPONSE_TIME_DISTRIBUTION
+HAVE_RTREE_KEYS
+HAVE_SSL
+HAVE_SYMLINK
+HOSTNAME
+IDENTITY
+IGNORE_BUILTIN_INNODB
+INIT_CONNECT
+INIT_FILE
+INIT_SLAVE
+INNODB_ADAPTIVE_FLUSHING
+INNODB_ADAPTIVE_FLUSHING_METHOD
+INNODB_ADAPTIVE_HASH_INDEX
+INNODB_ADAPTIVE_HASH_INDEX_PARTITIONS
+INNODB_ADDITIONAL_MEM_POOL_SIZE
+INNODB_AUTOEXTEND_INCREMENT
+INNODB_AUTOINC_LOCK_MODE
+INNODB_BUFFER_POOL_INSTANCES
+INNODB_BUFFER_POOL_RESTORE_AT_STARTUP
+INNODB_BUFFER_POOL_SHM_CHECKSUM
+INNODB_BUFFER_POOL_SHM_KEY
+INNODB_BUFFER_POOL_SIZE
+INNODB_CHANGE_BUFFERING
+INNODB_CHANGE_BUFFERING_DEBUG
+INNODB_CHECKPOINT_AGE_TARGET
+INNODB_CHECKSUMS
+INNODB_COMMIT_CONCURRENCY
+INNODB_CONCURRENCY_TICKETS
+INNODB_CORRUPT_TABLE_ACTION
+INNODB_DATA_FILE_PATH
+INNODB_DATA_HOME_DIR
+INNODB_DICT_SIZE_LIMIT
+INNODB_DOUBLEWRITE
+INNODB_DOUBLEWRITE_FILE
+INNODB_FAST_CHECKSUM
+INNODB_FAST_SHUTDOWN
+INNODB_FILE_FORMAT
+INNODB_FILE_FORMAT_CHECK
+INNODB_FILE_FORMAT_MAX
+INNODB_FILE_PER_TABLE
+INNODB_FLUSH_LOG_AT_TRX_COMMIT
+INNODB_FLUSH_METHOD
+INNODB_FLUSH_NEIGHBOR_PAGES
+INNODB_FORCE_RECOVERY
+INNODB_IBUF_ACCEL_RATE
+INNODB_IBUF_ACTIVE_CONTRACT
+INNODB_IBUF_MAX_SIZE
+INNODB_IMPORT_TABLE_FROM_XTRABACKUP
+INNODB_IO_CAPACITY
+INNODB_LAZY_DROP_TABLE
+INNODB_LOCKS_UNSAFE_FOR_BINLOG
+INNODB_LOCK_WAIT_TIMEOUT
+INNODB_LOG_BLOCK_SIZE
+INNODB_LOG_BUFFER_SIZE
+INNODB_LOG_FILES_IN_GROUP
+INNODB_LOG_FILE_SIZE
+INNODB_LOG_GROUP_HOME_DIR
+INNODB_MAX_DIRTY_PAGES_PCT
+INNODB_MAX_PURGE_LAG
+INNODB_MIRRORED_LOG_GROUPS
+INNODB_OLD_BLOCKS_PCT
+INNODB_OLD_BLOCKS_TIME
+INNODB_OPEN_FILES
+INNODB_PAGE_SIZE
+INNODB_PURGE_BATCH_SIZE
+INNODB_PURGE_THREADS
+INNODB_READ_AHEAD
+INNODB_READ_AHEAD_THRESHOLD
+INNODB_READ_IO_THREADS
+INNODB_RECOVERY_STATS
+INNODB_RECOVERY_UPDATE_RELAY_LOG
+INNODB_REPLICATION_DELAY
+INNODB_ROLLBACK_ON_TIMEOUT
+INNODB_ROLLBACK_SEGMENTS
+INNODB_SHOW_LOCKS_HELD
+INNODB_SHOW_VERBOSE_LOCKS
+INNODB_SPIN_WAIT_DELAY
+INNODB_STATS_AUTO_UPDATE
+INNODB_STATS_METHOD
+INNODB_STATS_ON_METADATA
+INNODB_STATS_SAMPLE_PAGES
+INNODB_STATS_UPDATE_NEED_LOCK
+INNODB_STRICT_MODE
+INNODB_SUPPORT_XA
+INNODB_SYNC_SPIN_LOOPS
+INNODB_TABLE_LOCKS
+INNODB_THREAD_CONCURRENCY
+INNODB_THREAD_CONCURRENCY_TIMER_BASED
+INNODB_THREAD_SLEEP_DELAY
+INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
+INNODB_USE_NATIVE_AIO
+INNODB_USE_SYS_MALLOC
+INNODB_USE_SYS_STATS_TABLE
+INNODB_VERSION
+INNODB_WRITE_IO_THREADS
+INSERT_ID
+INTERACTIVE_TIMEOUT
+JOIN_BUFFER_SIZE
+KEEP_FILES_ON_CREATE
+KEY_BUFFER_SIZE
+KEY_CACHE_AGE_THRESHOLD
+KEY_CACHE_BLOCK_SIZE
+KEY_CACHE_DIVISION_LIMIT
+LARGE_FILES_SUPPORT
+LARGE_PAGES
+LARGE_PAGE_SIZE
+LAST_INSERT_ID
+LC_MESSAGES
+LC_MESSAGES_DIR
+LC_TIME_NAMES
+LICENSE
+LOCAL_INFILE
+LOCKED_IN_MEMORY
+LOCK_WAIT_TIMEOUT
+LOG
+LOG_BIN
+LOG_BIN_TRUST_FUNCTION_CREATORS
+LOG_ERROR
+LOG_OUTPUT
+LOG_QUERIES_NOT_USING_INDEXES
+LOG_SLAVE_UPDATES
+LOG_SLOW_FILTER
+LOG_SLOW_QUERIES
+LOG_SLOW_RATE_LIMIT
+LOG_SLOW_SLAVE_STATEMENTS
+LOG_SLOW_SP_STATEMENTS
+LOG_SLOW_VERBOSITY
+LOG_WARNINGS
+LOG_WARNINGS_SUPPRESS
+LONG_QUERY_TIME
+LOWER_CASE_FILE_SYSTEM
+LOWER_CASE_TABLE_NAMES
+LOW_PRIORITY_UPDATES
+MAX_ALLOWED_PACKET
+MAX_BINLOG_CACHE_SIZE
+MAX_BINLOG_SIZE
+MAX_BINLOG_STMT_CACHE_SIZE
+MAX_CONNECTIONS
+MAX_CONNECT_ERRORS
+MAX_DELAYED_THREADS
+MAX_ERROR_COUNT
+MAX_HEAP_TABLE_SIZE
+MAX_INSERT_DELAYED_THREADS
+MAX_JOIN_SIZE
+MAX_LENGTH_FOR_SORT_DATA
+MAX_LONG_DATA_SIZE
+MAX_PREPARED_STMT_COUNT
+MAX_RELAY_LOG_SIZE
+MAX_SEEKS_FOR_KEY
+MAX_SORT_LENGTH
+MAX_SP_RECURSION_DEPTH
+MAX_TMP_TABLES
+MAX_USER_CONNECTIONS
+MAX_WRITE_LOCK_COUNT
+MIN_EXAMINED_ROW_LIMIT
+MULTI_RANGE_COUNT
+MYISAM_DATA_POINTER_SIZE
+MYISAM_MAX_SORT_FILE_SIZE
+MYISAM_MMAP_SIZE
+MYISAM_RECOVER_OPTIONS
+MYISAM_REPAIR_THREADS
+MYISAM_SORT_BUFFER_SIZE
+MYISAM_STATS_METHOD
+MYISAM_USE_MMAP
+NET_BUFFER_LENGTH
+NET_READ_TIMEOUT
+NET_RETRY_COUNT
+NET_WRITE_TIMEOUT
+NEW
+OLD
+OLD_ALTER_TABLE
+OLD_PASSWORDS
+OPEN_FILES_LIMIT
+OPTIMIZER_FIX
+OPTIMIZER_PRUNE_LEVEL
+OPTIMIZER_SEARCH_DEPTH
+OPTIMIZER_SWITCH
+PERFORMANCE_SCHEMA
+PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE
+PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE
+PERFORMANCE_SCHEMA_MAX_COND_CLASSES
+PERFORMANCE_SCHEMA_MAX_COND_INSTANCES
+PERFORMANCE_SCHEMA_MAX_FILE_CLASSES
+PERFORMANCE_SCHEMA_MAX_FILE_HANDLES
+PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES
+PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES
+PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES
+PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES
+PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES
+PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES
+PERFORMANCE_SCHEMA_MAX_TABLE_INSTANCES
+PERFORMANCE_SCHEMA_MAX_THREAD_CLASSES
+PERFORMANCE_SCHEMA_MAX_THREAD_INSTANCES
+PID_FILE
+PLUGIN_DIR
+PORT
+PRELOAD_BUFFER_SIZE
+PROFILING
+PROFILING_HISTORY_SIZE
+PROTOCOL_VERSION
+PROXY_USER
+PSEUDO_THREAD_ID
+QUERY_ALLOC_BLOCK_SIZE
+QUERY_CACHE_LIMIT
+QUERY_CACHE_MIN_RES_UNIT
+QUERY_CACHE_SIZE
+QUERY_CACHE_STRIP_COMMENTS
+QUERY_CACHE_TYPE
+QUERY_CACHE_WLOCK_INVALIDATE
+QUERY_PREALLOC_SIZE
+QUERY_RESPONSE_TIME_RANGE_BASE
+QUERY_RESPONSE_TIME_STATS
+RAND_SEED1
+RAND_SEED2
+RANGE_ALLOC_BLOCK_SIZE
+READ_BUFFER_SIZE
+READ_ONLY
+READ_RND_BUFFER_SIZE
+RELAY_LOG
+RELAY_LOG_INDEX
+RELAY_LOG_INFO_FILE
+RELAY_LOG_PURGE
+RELAY_LOG_RECOVERY
+RELAY_LOG_SPACE_LIMIT
+REPORT_HOST
+REPORT_PASSWORD
+REPORT_PORT
+REPORT_USER
+RPL_RECOVERY_RANK
+SECURE_AUTH
+SECURE_FILE_PRIV
+SERVER_ID
+SKIP_EXTERNAL_LOCKING
+SKIP_NAME_RESOLVE
+SKIP_NETWORKING
+SKIP_SHOW_DATABASE
+SLAVE_COMPRESSED_PROTOCOL
+SLAVE_EXEC_MODE
+SLAVE_LOAD_TMPDIR
+SLAVE_NET_TIMEOUT
+SLAVE_SKIP_ERRORS
+SLAVE_TRANSACTION_RETRIES
+SLAVE_TYPE_CONVERSIONS
+SLOW_LAUNCH_TIME
+SLOW_QUERY_LOG
+SLOW_QUERY_LOG_FILE
+SLOW_QUERY_LOG_TIMESTAMP_ALWAYS
+SLOW_QUERY_LOG_TIMESTAMP_PRECISION
+SLOW_QUERY_LOG_USE_GLOBAL_CONTROL
+SOCKET
+SORT_BUFFER_SIZE
+SQL_AUTO_IS_NULL
+SQL_BIG_SELECTS
+SQL_BIG_TABLES
+SQL_BUFFER_RESULT
+SQL_LOG_BIN
+SQL_LOG_OFF
+SQL_LOW_PRIORITY_UPDATES
+SQL_MAX_JOIN_SIZE
+SQL_MODE
+SQL_NOTES
+SQL_QUOTE_SHOW_CREATE
+SQL_SAFE_UPDATES
+SQL_SELECT_LIMIT
+SQL_SLAVE_SKIP_COUNTER
+SQL_WARNINGS
+SSL_CA
+SSL_CAPATH
+SSL_CERT
+SSL_CIPHER
+SSL_KEY
+STORAGE_ENGINE
+SYNC_BINLOG
+SYNC_FRM
+SYNC_MASTER_INFO
+SYNC_RELAY_LOG
+SYNC_RELAY_LOG_INFO
+SYSTEM_TIME_ZONE
+TABLE_DEFINITION_CACHE
+TABLE_OPEN_CACHE
+THREAD_CACHE_SIZE
+THREAD_CONCURRENCY
+THREAD_HANDLING
+THREAD_STACK
+THREAD_STATISTICS
+TIMED_MUTEXES
+TIMESTAMP
+TIME_FORMAT
+TIME_ZONE
+TMPDIR
+TMP_TABLE_SIZE
+TRANSACTION_ALLOC_BLOCK_SIZE
+TRANSACTION_PREALLOC_SIZE
+TX_ISOLATION
+UNIQUE_CHECKS
+UPDATABLE_VIEWS_WITH_LIMIT
+USERSTAT
+VERSION
+VERSION_COMMENT
+VERSION_COMPILE_MACHINE
+VERSION_COMPILE_OS
+WAIT_TIMEOUT
+WARNING_COUNT
diff --git a/mysql-test/suite/percona/percona_server_variables_debug.test b/mysql-test/suite/percona/percona_server_variables_debug.test
new file mode 100644
index 00000000000..971f6bae689
--- /dev/null
+++ b/mysql-test/suite/percona/percona_server_variables_debug.test
@@ -0,0 +1,2 @@
+--source include/have_debug.inc
+--source percona_server_variables.inc
diff --git a/mysql-test/suite/percona/percona_server_variables_release.result b/mysql-test/suite/percona/percona_server_variables_release.result
new file mode 100644
index 00000000000..cabd69b19a6
--- /dev/null
+++ b/mysql-test/suite/percona/percona_server_variables_release.result
@@ -0,0 +1,368 @@
+SELECT Variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES ORDER BY 1;
+Variable_name
+AUTOCOMMIT
+AUTOMATIC_SP_PRIVILEGES
+AUTO_INCREMENT_INCREMENT
+AUTO_INCREMENT_OFFSET
+BACK_LOG
+BASEDIR
+BIG_TABLES
+BINLOG_CACHE_SIZE
+BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
+BINLOG_FORMAT
+BINLOG_STMT_CACHE_SIZE
+BULK_INSERT_BUFFER_SIZE
+CHARACTER_SETS_DIR
+CHARACTER_SET_CLIENT
+CHARACTER_SET_CONNECTION
+CHARACTER_SET_DATABASE
+CHARACTER_SET_FILESYSTEM
+CHARACTER_SET_RESULTS
+CHARACTER_SET_SERVER
+CHARACTER_SET_SYSTEM
+COLLATION_CONNECTION
+COLLATION_DATABASE
+COLLATION_SERVER
+COMPLETION_TYPE
+CONCURRENT_INSERT
+CONNECT_TIMEOUT
+DATADIR
+DATETIME_FORMAT
+DATE_FORMAT
+DEFAULT_STORAGE_ENGINE
+DEFAULT_WEEK_FORMAT
+DELAYED_INSERT_LIMIT
+DELAYED_INSERT_TIMEOUT
+DELAYED_QUEUE_SIZE
+DELAY_KEY_WRITE
+DIV_PRECISION_INCREMENT
+ENGINE_CONDITION_PUSHDOWN
+ERROR_COUNT
+EVENT_SCHEDULER
+EXPIRE_LOGS_DAYS
+EXTERNAL_USER
+FAST_INDEX_CREATION
+FLUSH
+FLUSH_TIME
+FOREIGN_KEY_CHECKS
+FT_BOOLEAN_SYNTAX
+FT_MAX_WORD_LEN
+FT_MIN_WORD_LEN
+FT_QUERY_EXPANSION_LIMIT
+FT_STOPWORD_FILE
+GENERAL_LOG
+GENERAL_LOG_FILE
+GROUP_CONCAT_MAX_LEN
+HAVE_COMPRESS
+HAVE_CRYPT
+HAVE_CSV
+HAVE_DYNAMIC_LOADING
+HAVE_GEOMETRY
+HAVE_INNODB
+HAVE_NDBCLUSTER
+HAVE_OPENSSL
+HAVE_PARTITIONING
+HAVE_PROFILING
+HAVE_QUERY_CACHE
+HAVE_RESPONSE_TIME_DISTRIBUTION
+HAVE_RTREE_KEYS
+HAVE_SSL
+HAVE_SYMLINK
+HOSTNAME
+IDENTITY
+IGNORE_BUILTIN_INNODB
+INIT_CONNECT
+INIT_FILE
+INIT_SLAVE
+INNODB_ADAPTIVE_FLUSHING
+INNODB_ADAPTIVE_FLUSHING_METHOD
+INNODB_ADAPTIVE_HASH_INDEX
+INNODB_ADAPTIVE_HASH_INDEX_PARTITIONS
+INNODB_ADDITIONAL_MEM_POOL_SIZE
+INNODB_AUTOEXTEND_INCREMENT
+INNODB_AUTOINC_LOCK_MODE
+INNODB_BUFFER_POOL_INSTANCES
+INNODB_BUFFER_POOL_RESTORE_AT_STARTUP
+INNODB_BUFFER_POOL_SHM_CHECKSUM
+INNODB_BUFFER_POOL_SHM_KEY
+INNODB_BUFFER_POOL_SIZE
+INNODB_CHANGE_BUFFERING
+INNODB_CHECKPOINT_AGE_TARGET
+INNODB_CHECKSUMS
+INNODB_COMMIT_CONCURRENCY
+INNODB_CONCURRENCY_TICKETS
+INNODB_CORRUPT_TABLE_ACTION
+INNODB_DATA_FILE_PATH
+INNODB_DATA_HOME_DIR
+INNODB_DICT_SIZE_LIMIT
+INNODB_DOUBLEWRITE
+INNODB_DOUBLEWRITE_FILE
+INNODB_FAST_CHECKSUM
+INNODB_FAST_SHUTDOWN
+INNODB_FILE_FORMAT
+INNODB_FILE_FORMAT_CHECK
+INNODB_FILE_FORMAT_MAX
+INNODB_FILE_PER_TABLE
+INNODB_FLUSH_LOG_AT_TRX_COMMIT
+INNODB_FLUSH_METHOD
+INNODB_FLUSH_NEIGHBOR_PAGES
+INNODB_FORCE_RECOVERY
+INNODB_IBUF_ACCEL_RATE
+INNODB_IBUF_ACTIVE_CONTRACT
+INNODB_IBUF_MAX_SIZE
+INNODB_IMPORT_TABLE_FROM_XTRABACKUP
+INNODB_IO_CAPACITY
+INNODB_LAZY_DROP_TABLE
+INNODB_LOCKS_UNSAFE_FOR_BINLOG
+INNODB_LOCK_WAIT_TIMEOUT
+INNODB_LOG_BLOCK_SIZE
+INNODB_LOG_BUFFER_SIZE
+INNODB_LOG_FILES_IN_GROUP
+INNODB_LOG_FILE_SIZE
+INNODB_LOG_GROUP_HOME_DIR
+INNODB_MAX_DIRTY_PAGES_PCT
+INNODB_MAX_PURGE_LAG
+INNODB_MIRRORED_LOG_GROUPS
+INNODB_OLD_BLOCKS_PCT
+INNODB_OLD_BLOCKS_TIME
+INNODB_OPEN_FILES
+INNODB_PAGE_SIZE
+INNODB_PURGE_BATCH_SIZE
+INNODB_PURGE_THREADS
+INNODB_READ_AHEAD
+INNODB_READ_AHEAD_THRESHOLD
+INNODB_READ_IO_THREADS
+INNODB_RECOVERY_STATS
+INNODB_RECOVERY_UPDATE_RELAY_LOG
+INNODB_REPLICATION_DELAY
+INNODB_ROLLBACK_ON_TIMEOUT
+INNODB_ROLLBACK_SEGMENTS
+INNODB_SHOW_LOCKS_HELD
+INNODB_SHOW_VERBOSE_LOCKS
+INNODB_SPIN_WAIT_DELAY
+INNODB_STATS_AUTO_UPDATE
+INNODB_STATS_METHOD
+INNODB_STATS_ON_METADATA
+INNODB_STATS_SAMPLE_PAGES
+INNODB_STATS_UPDATE_NEED_LOCK
+INNODB_STRICT_MODE
+INNODB_SUPPORT_XA
+INNODB_SYNC_SPIN_LOOPS
+INNODB_TABLE_LOCKS
+INNODB_THREAD_CONCURRENCY
+INNODB_THREAD_CONCURRENCY_TIMER_BASED
+INNODB_THREAD_SLEEP_DELAY
+INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
+INNODB_USE_NATIVE_AIO
+INNODB_USE_SYS_MALLOC
+INNODB_USE_SYS_STATS_TABLE
+INNODB_VERSION
+INNODB_WRITE_IO_THREADS
+INSERT_ID
+INTERACTIVE_TIMEOUT
+JOIN_BUFFER_SIZE
+KEEP_FILES_ON_CREATE
+KEY_BUFFER_SIZE
+KEY_CACHE_AGE_THRESHOLD
+KEY_CACHE_BLOCK_SIZE
+KEY_CACHE_DIVISION_LIMIT
+LARGE_FILES_SUPPORT
+LARGE_PAGES
+LARGE_PAGE_SIZE
+LAST_INSERT_ID
+LC_MESSAGES
+LC_MESSAGES_DIR
+LC_TIME_NAMES
+LICENSE
+LOCAL_INFILE
+LOCKED_IN_MEMORY
+LOCK_WAIT_TIMEOUT
+LOG
+LOG_BIN
+LOG_BIN_TRUST_FUNCTION_CREATORS
+LOG_ERROR
+LOG_OUTPUT
+LOG_QUERIES_NOT_USING_INDEXES
+LOG_SLAVE_UPDATES
+LOG_SLOW_FILTER
+LOG_SLOW_QUERIES
+LOG_SLOW_RATE_LIMIT
+LOG_SLOW_SLAVE_STATEMENTS
+LOG_SLOW_SP_STATEMENTS
+LOG_SLOW_VERBOSITY
+LOG_WARNINGS
+LOG_WARNINGS_SUPPRESS
+LONG_QUERY_TIME
+LOWER_CASE_FILE_SYSTEM
+LOWER_CASE_TABLE_NAMES
+LOW_PRIORITY_UPDATES
+MAX_ALLOWED_PACKET
+MAX_BINLOG_CACHE_SIZE
+MAX_BINLOG_SIZE
+MAX_BINLOG_STMT_CACHE_SIZE
+MAX_CONNECTIONS
+MAX_CONNECT_ERRORS
+MAX_DELAYED_THREADS
+MAX_ERROR_COUNT
+MAX_HEAP_TABLE_SIZE
+MAX_INSERT_DELAYED_THREADS
+MAX_JOIN_SIZE
+MAX_LENGTH_FOR_SORT_DATA
+MAX_LONG_DATA_SIZE
+MAX_PREPARED_STMT_COUNT
+MAX_RELAY_LOG_SIZE
+MAX_SEEKS_FOR_KEY
+MAX_SORT_LENGTH
+MAX_SP_RECURSION_DEPTH
+MAX_TMP_TABLES
+MAX_USER_CONNECTIONS
+MAX_WRITE_LOCK_COUNT
+MIN_EXAMINED_ROW_LIMIT
+MULTI_RANGE_COUNT
+MYISAM_DATA_POINTER_SIZE
+MYISAM_MAX_SORT_FILE_SIZE
+MYISAM_MMAP_SIZE
+MYISAM_RECOVER_OPTIONS
+MYISAM_REPAIR_THREADS
+MYISAM_SORT_BUFFER_SIZE
+MYISAM_STATS_METHOD
+MYISAM_USE_MMAP
+NET_BUFFER_LENGTH
+NET_READ_TIMEOUT
+NET_RETRY_COUNT
+NET_WRITE_TIMEOUT
+NEW
+OLD
+OLD_ALTER_TABLE
+OLD_PASSWORDS
+OPEN_FILES_LIMIT
+OPTIMIZER_FIX
+OPTIMIZER_PRUNE_LEVEL
+OPTIMIZER_SEARCH_DEPTH
+OPTIMIZER_SWITCH
+PERFORMANCE_SCHEMA
+PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE
+PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE
+PERFORMANCE_SCHEMA_MAX_COND_CLASSES
+PERFORMANCE_SCHEMA_MAX_COND_INSTANCES
+PERFORMANCE_SCHEMA_MAX_FILE_CLASSES
+PERFORMANCE_SCHEMA_MAX_FILE_HANDLES
+PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES
+PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES
+PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES
+PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES
+PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES
+PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES
+PERFORMANCE_SCHEMA_MAX_TABLE_INSTANCES
+PERFORMANCE_SCHEMA_MAX_THREAD_CLASSES
+PERFORMANCE_SCHEMA_MAX_THREAD_INSTANCES
+PID_FILE
+PLUGIN_DIR
+PORT
+PRELOAD_BUFFER_SIZE
+PROFILING
+PROFILING_HISTORY_SIZE
+PROTOCOL_VERSION
+PROXY_USER
+PSEUDO_THREAD_ID
+QUERY_ALLOC_BLOCK_SIZE
+QUERY_CACHE_LIMIT
+QUERY_CACHE_MIN_RES_UNIT
+QUERY_CACHE_SIZE
+QUERY_CACHE_STRIP_COMMENTS
+QUERY_CACHE_TYPE
+QUERY_CACHE_WLOCK_INVALIDATE
+QUERY_PREALLOC_SIZE
+QUERY_RESPONSE_TIME_RANGE_BASE
+QUERY_RESPONSE_TIME_STATS
+RAND_SEED1
+RAND_SEED2
+RANGE_ALLOC_BLOCK_SIZE
+READ_BUFFER_SIZE
+READ_ONLY
+READ_RND_BUFFER_SIZE
+RELAY_LOG
+RELAY_LOG_INDEX
+RELAY_LOG_INFO_FILE
+RELAY_LOG_PURGE
+RELAY_LOG_RECOVERY
+RELAY_LOG_SPACE_LIMIT
+REPORT_HOST
+REPORT_PASSWORD
+REPORT_PORT
+REPORT_USER
+RPL_RECOVERY_RANK
+SECURE_AUTH
+SECURE_FILE_PRIV
+SERVER_ID
+SKIP_EXTERNAL_LOCKING
+SKIP_NAME_RESOLVE
+SKIP_NETWORKING
+SKIP_SHOW_DATABASE
+SLAVE_COMPRESSED_PROTOCOL
+SLAVE_EXEC_MODE
+SLAVE_LOAD_TMPDIR
+SLAVE_NET_TIMEOUT
+SLAVE_SKIP_ERRORS
+SLAVE_TRANSACTION_RETRIES
+SLAVE_TYPE_CONVERSIONS
+SLOW_LAUNCH_TIME
+SLOW_QUERY_LOG
+SLOW_QUERY_LOG_FILE
+SLOW_QUERY_LOG_TIMESTAMP_ALWAYS
+SLOW_QUERY_LOG_TIMESTAMP_PRECISION
+SLOW_QUERY_LOG_USE_GLOBAL_CONTROL
+SOCKET
+SORT_BUFFER_SIZE
+SQL_AUTO_IS_NULL
+SQL_BIG_SELECTS
+SQL_BIG_TABLES
+SQL_BUFFER_RESULT
+SQL_LOG_BIN
+SQL_LOG_OFF
+SQL_LOW_PRIORITY_UPDATES
+SQL_MAX_JOIN_SIZE
+SQL_MODE
+SQL_NOTES
+SQL_QUOTE_SHOW_CREATE
+SQL_SAFE_UPDATES
+SQL_SELECT_LIMIT
+SQL_SLAVE_SKIP_COUNTER
+SQL_WARNINGS
+SSL_CA
+SSL_CAPATH
+SSL_CERT
+SSL_CIPHER
+SSL_KEY
+STORAGE_ENGINE
+SYNC_BINLOG
+SYNC_FRM
+SYNC_MASTER_INFO
+SYNC_RELAY_LOG
+SYNC_RELAY_LOG_INFO
+SYSTEM_TIME_ZONE
+TABLE_DEFINITION_CACHE
+TABLE_OPEN_CACHE
+THREAD_CACHE_SIZE
+THREAD_CONCURRENCY
+THREAD_HANDLING
+THREAD_STACK
+THREAD_STATISTICS
+TIMED_MUTEXES
+TIMESTAMP
+TIME_FORMAT
+TIME_ZONE
+TMPDIR
+TMP_TABLE_SIZE
+TRANSACTION_ALLOC_BLOCK_SIZE
+TRANSACTION_PREALLOC_SIZE
+TX_ISOLATION
+UNIQUE_CHECKS
+UPDATABLE_VIEWS_WITH_LIMIT
+USERSTAT
+VERSION
+VERSION_COMMENT
+VERSION_COMPILE_MACHINE
+VERSION_COMPILE_OS
+WAIT_TIMEOUT
+WARNING_COUNT
diff --git a/mysql-test/suite/percona/percona_server_variables_release.test b/mysql-test/suite/percona/percona_server_variables_release.test
new file mode 100644
index 00000000000..f61446aeb02
--- /dev/null
+++ b/mysql-test/suite/percona/percona_server_variables_release.test
@@ -0,0 +1,2 @@
+--source include/have_nodebug.inc
+--source include/percona_server_variables.inc
diff --git a/mysql-test/suite/percona/percona_show_slave_status_nolock.result b/mysql-test/suite/percona/percona_show_slave_status_nolock.result
new file mode 100644
index 00000000000..1d6114a001e
--- /dev/null
+++ b/mysql-test/suite/percona/percona_show_slave_status_nolock.result
@@ -0,0 +1,21 @@
+include/master-slave.inc
+[connection master]
+DROP TABLE IF EXISTS t;
+CREATE TABLE t(id INT);
+INSERT INTO t SELECT SLEEP(10);
+STOP SLAVE;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+master count(*)
+master 1
+slave count(*)
+slave 0
+SHOW SLAVE STATUS NOLOCK;
+include/wait_for_slave_to_stop.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+slave count(*)
+slave 1
+DROP TABLE t;
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/percona/percona_show_slave_status_nolock.test b/mysql-test/suite/percona/percona_show_slave_status_nolock.test
new file mode 100644
index 00000000000..dcb2eb26a3e
--- /dev/null
+++ b/mysql-test/suite/percona/percona_show_slave_status_nolock.test
@@ -0,0 +1,53 @@
+--source include/master-slave.inc
+--source include/have_binlog_format_statement.inc
+--disable_query_log
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement:");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+--enable_query_log
+connection master;
+ --disable_warnings
+ DROP TABLE IF EXISTS t;
+ --enable_warnings
+ CREATE TABLE t(id INT);
+ sync_slave_with_master;
+
+connection master;
+ send INSERT INTO t SELECT SLEEP(10);
+
+connection slave;
+ sleep 15;
+ send STOP SLAVE;
+
+connection master;
+ reap;
+
+ --disable_query_log
+ select "master",count(*) from t;
+ --enable_query_log
+
+connection slave1;
+ --disable_query_log
+ select "slave",count(*) from t;
+ --enable_query_log
+
+ --disable_result_log
+ SHOW SLAVE STATUS NOLOCK;
+ --enable_result_log
+
+connection slave;
+ reap;
+
+ --source include/wait_for_slave_to_stop.inc
+ START SLAVE;
+ --source include/wait_for_slave_to_start.inc
+
+ --disable_query_log
+ select "slave",count(*) from t;
+ --enable_query_log
+
+connection master;
+ DROP TABLE t;
+sync_slave_with_master;
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter-master.opt b/mysql-test/suite/percona/percona_slow_extended-log_slow_filter-master.opt
index cb93f7abf05..865dc70ba38 100644
--- a/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter-master.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_filter-master.opt
@@ -1 +1 @@
---slow-query-log-file=percona_slow_query_log-log_slow_filter.log --long-query-time=1 \ No newline at end of file
+--slow-query-log-file=percona_slow_query_log-log_slow_filter.log --long-query-time=1 --slow_query_log=OFF
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.result b/mysql-test/suite/percona/percona_slow_extended-log_slow_filter.result
index 9c8f69745a7..2f22ef5457b 100644
--- a/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.result
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_filter.result
@@ -1,4 +1,3 @@
-SET GLOBAL SLOW_QUERY_LOG=OFF;
drop table if exists t;
# Create test table
create table t(id INT PRIMARY KEY) engine=InnoDB;
@@ -20,6 +19,7 @@ sleep(2)
SELECT sleep(2);
sleep(2)
0
+SET GLOBAL SLOW_QUERY_LOG=OFF;
drop table if exists t;
-cat MYSQLD_DATADIR/percona_slow_query_log-log_slow_filter.log | grep -c Query_time
+FLUSH LOGS;
2
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test b/mysql-test/suite/percona/percona_slow_extended-log_slow_filter.test
index 44646de530a..292c1651e34 100644
--- a/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_filter.test
@@ -1,8 +1,4 @@
--- source include/not_windows.inc
-
-source include/have_innodb.inc;
-
-SET GLOBAL SLOW_QUERY_LOG=OFF;
+source include/have_xtradb.inc;
--disable_warnings
drop table if exists t;
@@ -24,12 +20,13 @@ set log_slow_filter=full_join;
SELECT sleep(2) union select t2.id from t as t1,t as t2;
SELECT sleep(2);
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+
--disable_warnings
drop table if exists t;
--enable_warnings
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-log_slow_filter.log | grep -c Query_time;
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-exec echo '$cmd';
-exec $cmd;
+FLUSH LOGS;
+--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-log_slow_filter.log
+--let grep_pattern = Query_time
+--source grep.inc
diff --git a/mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl-master.opt b/mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl-master.opt
new file mode 100644
index 00000000000..4368453928a
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl-master.opt
@@ -0,0 +1 @@
+--log_slow_sp_statements
diff --git a/mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl.result b/mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl.result
new file mode 100644
index 00000000000..c5653429327
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl.result
@@ -0,0 +1,3 @@
+show global variables like 'log_slow_sp_statements';
+Variable_name Value
+log_slow_sp_statements ON
diff --git a/mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl.test b/mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl.test
new file mode 100644
index 00000000000..47bd960feb5
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_sp_statements-cl.test
@@ -0,0 +1 @@
+show global variables like 'log_slow_sp_statements';
diff --git a/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl-master.opt b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl-master.opt
new file mode 100644
index 00000000000..d8809c36981
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl-master.opt
@@ -0,0 +1 @@
+--log_slow_verbosity="full"
diff --git a/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl.result b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl.result
new file mode 100644
index 00000000000..eb8228efb08
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl.result
@@ -0,0 +1,9 @@
+show global variables like 'log_slow_verbosity';
+Variable_name Value
+log_slow_verbosity microtime,query_plan,innodb
+show variables like 'log_slow_verbosity';
+Variable_name Value
+log_slow_verbosity microtime,query_plan,innodb
+select @@log_slow_verbosity;
+@@log_slow_verbosity
+microtime,query_plan,innodb
diff --git a/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl.test b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl.test
new file mode 100644
index 00000000000..740c4deaebd
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-cl.test
@@ -0,0 +1,3 @@
+show global variables like 'log_slow_verbosity';
+show variables like 'log_slow_verbosity';
+select @@log_slow_verbosity;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity-master.opt b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-master.opt
index 8d21f40a34f..19ae9c117f0 100644
--- a/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity-master.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity-master.opt
@@ -1 +1 @@
---slow-query-log-file=percona_slow_query_log-log_slow_verbosity.log --long-query-time=1 \ No newline at end of file
+--slow-query-log-file=percona_slow_query_log-log_slow_verbosity.log --long-query-time=1
diff --git a/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity.result b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity.result
new file mode 100644
index 00000000000..1e7db10c8bd
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity.result
@@ -0,0 +1,9 @@
+SELECT sleep(2);
+sleep(2)
+0
+set log_slow_verbosity=innodb;
+SELECT sleep(2);
+sleep(2)
+0
+FLUSH LOGS;
+1
diff --git a/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity.test b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity.test
new file mode 100644
index 00000000000..e95ab54af61
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-log_slow_verbosity.test
@@ -0,0 +1,12 @@
+source include/have_xtradb.inc;
+
+SELECT sleep(2);
+
+set log_slow_verbosity=innodb;
+
+SELECT sleep(2);
+
+FLUSH LOGS;
+--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-log_slow_verbosity.log
+--let grep_pattern = No InnoDB statistics available for this query
+--source grep.inc
diff --git a/mysql-test/suite/percona/percona_slow_query_log-long_query_time-master.opt b/mysql-test/suite/percona/percona_slow_extended-long_query_time-master.opt
index 5cbb82d1261..62e1e981558 100644
--- a/mysql-test/suite/percona/percona_slow_query_log-long_query_time-master.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-long_query_time-master.opt
@@ -1 +1 @@
---slow-query-log-file=percona_slow_query_log-long_query_time.log --long-query-time=3
+--slow-query-log-file=percona_slow_query_log-long_query_time.log --long-query-time=2 --slow-query-log=OFF
diff --git a/mysql-test/suite/percona/percona_slow_extended-long_query_time.result b/mysql-test/suite/percona/percona_slow_extended-long_query_time.result
new file mode 100644
index 00000000000..f2da4e4d9d6
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-long_query_time.result
@@ -0,0 +1,24 @@
+SET GLOBAL SLOW_QUERY_LOG=ON;
+SELECT sleep(1);
+sleep(1)
+0
+SELECT sleep(3);
+sleep(3)
+0
+SELECT sleep(5);
+sleep(5)
+0
+set long_query_time=4;
+SELECT sleep(1);
+sleep(1)
+0
+SELECT sleep(3);
+sleep(3)
+0
+SELECT sleep(5);
+sleep(5)
+0
+set long_query_time=2;
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+FLUSH LOGS;
+3
diff --git a/mysql-test/suite/percona/percona_slow_extended-long_query_time.test b/mysql-test/suite/percona/percona_slow_extended-long_query_time.test
new file mode 100644
index 00000000000..716cc7cb0c3
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-long_query_time.test
@@ -0,0 +1,23 @@
+source include/have_xtradb.inc;
+
+SET GLOBAL SLOW_QUERY_LOG=ON;
+
+SELECT sleep(1);
+SELECT sleep(3);
+SELECT sleep(5);
+
+set long_query_time=4;
+
+SELECT sleep(1);
+SELECT sleep(3);
+SELECT sleep(5);
+
+set long_query_time=2;
+
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+
+FLUSH LOGS;
+--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-long_query_time.log
+--let grep_pattern = Query_time
+--source grep.inc
+
diff --git a/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log-master.opt b/mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended-master.opt
index 6433539d3d1..ca486d356f5 100644
--- a/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log-master.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended-master.opt
@@ -1 +1 @@
---slow-query-log-file=percona_slow_query_log-microseconds_in_slow_query_log.log --long-query-time=1 \ No newline at end of file
+--slow-query-log-file=percona_slow_query_log-microseconds_in_slow_query_log.log --long-query-time=1 --slow_query_log=OFF
diff --git a/mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended.result b/mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended.result
new file mode 100644
index 00000000000..ce27c518efe
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended.result
@@ -0,0 +1,13 @@
+SET GLOBAL SLOW_QUERY_LOG=ON;
+SELECT sleep(2);
+sleep(2)
+0
+set global slow_query_log_timestamp_precision='microsecond';
+SELECT sleep(2);
+sleep(2)
+0
+set global slow_query_log_timestamp_precision='second';
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+FLUSH LOGS;
+1
+2
diff --git a/mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended.test b/mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended.test
new file mode 100644
index 00000000000..4b437b21e4c
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-microseconds_in_slow_extended.test
@@ -0,0 +1,23 @@
+source include/have_xtradb.inc;
+
+SET GLOBAL SLOW_QUERY_LOG=ON;
+
+SELECT sleep(2);
+
+set global slow_query_log_timestamp_precision='microsecond';
+
+SELECT sleep(2);
+
+set global slow_query_log_timestamp_precision='second';
+
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+
+FLUSH LOGS;
+--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log
+--let grep_pattern = # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+.[0-9]+
+--source grep.inc
+
+--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-microseconds_in_slow_query_log.log
+--let grep_pattern = # Time: [0-9]+[ ]+[0-9]+:[0-9]+:[0-9]+
+--source grep.inc
+
diff --git a/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit-master.opt b/mysql-test/suite/percona/percona_slow_extended-min_examined_row_limit-master.opt
index 6f82556fb0c..c1cf3ebdb30 100644
--- a/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit-master.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-min_examined_row_limit-master.opt
@@ -1 +1 @@
---slow-query-log-file=percona_slow_query_log-min_examined_row_limit.log --long-query-time=1 \ No newline at end of file
+--slow-query-log-file=percona_slow_query_log-min_examined_row_limit.log --long-query-time=1 --slow-query-log=OFF
diff --git a/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.result b/mysql-test/suite/percona/percona_slow_extended-min_examined_row_limit.result
index 32698a59837..1e8bc0723ac 100644
--- a/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.result
+++ b/mysql-test/suite/percona/percona_slow_extended-min_examined_row_limit.result
@@ -1,4 +1,3 @@
-SET GLOBAL SLOW_QUERY_LOG=OFF;
drop table if exists t;
# Create test table
create table t(id INT PRIMARY KEY) engine=InnoDB;
@@ -20,6 +19,7 @@ sleep(2)
SELECT sleep(2);
sleep(2)
0
+SET GLOBAL SLOW_QUERY_LOG=OFF;
drop table if exists t;
-cat MYSQLD_DATADIR/percona_slow_query_log-min_examined_row_limit.log | grep -c Query_time
+FLUSH LOGS;
2
diff --git a/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test b/mysql-test/suite/percona/percona_slow_extended-min_examined_row_limit.test
index 61276423b4d..ca68658a6c5 100644
--- a/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test
+++ b/mysql-test/suite/percona/percona_slow_extended-min_examined_row_limit.test
@@ -1,7 +1,4 @@
-source include/not_windows.inc;
-source include/have_innodb.inc;
-
-SET GLOBAL SLOW_QUERY_LOG=OFF;
+source include/have_xtradb.inc;
--disable_warnings
drop table if exists t;
@@ -23,12 +20,13 @@ set min_examined_row_limit=5;
SELECT sleep(2) union select t2.id from t as t1,t as t2;
SELECT sleep(2);
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+
--disable_warnings
drop table if exists t;
--enable_warnings
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-min_examined_row_limit.log | grep -c Query_time;
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-exec echo '$cmd';
-exec $cmd;
+FLUSH LOGS;
+--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-min_examined_row_limit.log
+--let grep_pattern = Query_time
+--source grep.inc
diff --git a/mysql-test/suite/percona/percona_slave_innodb_stats-master.opt b/mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats-master.opt
index 286a9c4484d..286a9c4484d 100644
--- a/mysql-test/suite/percona/percona_slave_innodb_stats-master.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats-master.opt
diff --git a/mysql-test/suite/percona/percona_slave_innodb_stats-slave.opt b/mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats-slave.opt
index 286a9c4484d..286a9c4484d 100644
--- a/mysql-test/suite/percona/percona_slave_innodb_stats-slave.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats-slave.opt
diff --git a/mysql-test/suite/percona/percona_slave_innodb_stats.result b/mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats.result
index c2406bdfd85..51993e767c2 100644
--- a/mysql-test/suite/percona/percona_slave_innodb_stats.result
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT,data CHAR(30)) ENGINE=InnoDB;
INSERT INTO t VALUES
@@ -15,7 +11,12 @@ INSERT INTO t VALUES
INSERT INTO t SELECT t2.id,t2.data from t as t1, t as t2;
INSERT INTO t SELECT t2.id,t2.data from t as t1, t as t2;
STOP SLAVE;
+include/wait_for_slave_to_stop.inc
START SLAVE;
+include/wait_for_slave_to_start.inc
INSERT INTO t SELECT t.id,t.data from t;
DROP TABLE IF EXISTS t;
+FLUSH LOGS;
4
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/percona/percona_slave_innodb_stats.test b/mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats.test
index defcd1fc406..b0a6c98870c 100644
--- a/mysql-test/suite/percona/percona_slave_innodb_stats.test
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_innodb_stats.test
@@ -1,5 +1,6 @@
-source include/have_innodb.inc;
-source include/master-slave.inc;
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/have_xtradb.inc
+-- source include/master-slave.inc
connection master;
-- disable_warnings
@@ -40,4 +41,11 @@ connection master;
DROP TABLE IF EXISTS t;
sync_slave_with_master;
-exec cat var/mysqld.2/mysqld-slow.log | grep InnoDB_IO_r_ops | wc -l;
+connection slave;
+FLUSH LOGS;
+--let grep_file = $MYSQLTEST_VARDIR/mysqld.2/mysqld-slow.log
+--let grep_pattern = InnoDB_IO_r_ops
+--source grep.inc
+
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-master.opt b/mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time-master.opt
index d600400af08..49038530c56 100644
--- a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-master.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time-master.opt
@@ -1 +1 @@
---slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=1 \ No newline at end of file
+--slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=1
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-slave.opt b/mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time-slave.opt
index c79e637317b..648f309f744 100644
--- a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-slave.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time-slave.opt
@@ -1 +1 @@
---slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=1 \ No newline at end of file
+--slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=1
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.result b/mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time.result
index c17e7a3f508..e5f4568dd58 100644
--- a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.result
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time.result
@@ -1,19 +1,10 @@
-# Activate master-slave replication
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-# Make table t for test
+include/master-slave.inc
+[connection master]
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT);
-# Start slave replication
START SLAVE;
+include/wait_for_slave_to_start.inc
INSERT INTO t VALUES (1);
-# Read information about master binlog
-# Sync(1) slave thread
-# Read and change log_slow_slave_statements to ON on slave
show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements OFF
@@ -22,23 +13,20 @@ show variables like 'log_slow_slave_statements';
Variable_name Value
log_slow_slave_statements ON
INSERT INTO t VALUES (2);
-# Read information about master binlog
-# Sync slave(2) thread
-# Restart slave
STOP SLAVE;
+include/wait_for_slave_to_stop.inc
START SLAVE;
+include/wait_for_slave_to_start.inc
INSERT INTO t VALUES (3);
-# Read information about master binlog
-# Sync(3) slave thread
show variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
-show global variables like 'use_global_long_query_time';
+show global variables like 'slow_query_log_use_global_control';
Variable_name Value
-use_global_long_query_time OFF
+slow_query_log_use_global_control
set global long_query_time=0;
show variables like 'long_query_time';
Variable_name Value
@@ -46,51 +34,49 @@ long_query_time 1.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
-show global variables like 'use_global_long_query_time';
+show global variables like 'slow_query_log_use_global_control';
Variable_name Value
-use_global_long_query_time OFF
+slow_query_log_use_global_control
INSERT INTO t VALUES (4);
-# Read information about master binlog
-# Sync slave(4) thread
show variables like 'long_query_time';
Variable_name Value
long_query_time 1.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
-show global variables like 'use_global_long_query_time';
+show global variables like 'slow_query_log_use_global_control';
Variable_name Value
-use_global_long_query_time OFF
-set global use_global_long_query_time=1;
+slow_query_log_use_global_control
+set global slow_query_log_use_global_control='long_query_time';
show variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
-show global variables like 'use_global_long_query_time';
+show global variables like 'slow_query_log_use_global_control';
Variable_name Value
-use_global_long_query_time ON
+slow_query_log_use_global_control long_query_time
INSERT INTO t VALUES (5);
-# Read information about master binlog
-# Sync slave(5) thread
show variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
show global variables like 'long_query_time';
Variable_name Value
long_query_time 0.000000
-show global variables like 'use_global_long_query_time';
+show global variables like 'slow_query_log_use_global_control';
Variable_name Value
-use_global_long_query_time ON
+slow_query_log_use_global_control long_query_time
set global long_query_time=1;
-set global use_global_long_query_time=0;
+set global slow_query_log_use_global_control='';
+FLUSH LOGS;
# Analyse master slow_query_log
0
0
0
0
0
+FLUSH LOGS;
# Analyse slave slow_query_log
0
0
@@ -99,5 +85,5 @@ set global use_global_long_query_time=0;
1
set global log_slow_slave_statements=OFF;
DROP TABLE t;
-# Read information about master binlog
-# Sync slave(6) thread
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time.test b/mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time.test
new file mode 100644
index 00000000000..c718b2c3d28
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_statements-and-use_global_long_query_time.test
@@ -0,0 +1,107 @@
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+connection master;
+-- disable_warnings
+DROP TABLE IF EXISTS t;
+-- enable_warnings
+CREATE TABLE t(id INT);
+
+-- disable_warnings
+connection slave;
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+-- enable_warnings
+
+connection master;
+INSERT INTO t VALUES (1);
+sync_slave_with_master;
+
+connection slave;
+show variables like 'log_slow_slave_statements';
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+
+connection master;
+INSERT INTO t VALUES (2);
+sync_slave_with_master;
+connection slave;
+
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+
+connection master;
+INSERT INTO t VALUES (3);
+sync_slave_with_master;
+
+connection slave;
+show variables like 'long_query_time';
+show global variables like 'long_query_time';
+show global variables like 'slow_query_log_use_global_control';
+set global long_query_time=0;
+show variables like 'long_query_time';
+show global variables like 'long_query_time';
+show global variables like 'slow_query_log_use_global_control';
+
+connection master;
+INSERT INTO t VALUES (4);
+sync_slave_with_master;
+
+connection slave;
+show variables like 'long_query_time';
+show global variables like 'long_query_time';
+show global variables like 'slow_query_log_use_global_control';
+set global slow_query_log_use_global_control='long_query_time';
+show variables like 'long_query_time';
+show global variables like 'long_query_time';
+show global variables like 'slow_query_log_use_global_control';
+
+#-- echo # Make insert(5) on master
+connection master;
+INSERT INTO t VALUES (5);
+sync_slave_with_master;
+connection slave;
+show variables like 'long_query_time';
+show global variables like 'long_query_time';
+show global variables like 'slow_query_log_use_global_control';
+set global long_query_time=1;
+set global slow_query_log_use_global_control='';
+
+connection master;
+FLUSH LOGS;
+
+-- echo # Analyse master slow_query_log
+let $i=5;
+let $k=1;
+while($i)
+{
+ --let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_log_slow_slave_statements-master.log
+ --let grep_pattern = INSERT INTO t VALUES \($k\)
+ --source grep.inc
+ dec $i;
+ inc $k;
+}
+
+connection slave;
+FLUSH LOGS;
+
+-- echo # Analyse slave slow_query_log
+let $i=5;
+let $k=1;
+while($i)
+{
+ --let grep_file = $MYSQLTEST_VARDIR/mysqld.2/data/percona_log_slow_slave_statements-slave.log
+ --let grep_pattern = INSERT INTO t VALUES \($k\)
+ --source grep.inc
+ dec $i;
+ inc $k;
+}
+set global log_slow_slave_statements=OFF;
+
+connection master;
+DROP TABLE t;
+sync_slave_with_master;
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-master.opt b/mysql-test/suite/percona/percona_slow_extended-slave_statements-master.opt
index dd94fd90a57..ebf25ddd37d 100644
--- a/mysql-test/suite/percona/percona_log_slow_slave_statements-master.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_statements-master.opt
@@ -1 +1 @@
---slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=0 \ No newline at end of file
+--slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=0
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-slave.opt b/mysql-test/suite/percona/percona_slow_extended-slave_statements-slave.opt
index e276b0bcfc8..96cd9004493 100644
--- a/mysql-test/suite/percona/percona_log_slow_slave_statements-slave.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_statements-slave.opt
@@ -1 +1 @@
---slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=0 \ No newline at end of file
+--slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=0
diff --git a/mysql-test/suite/percona/percona_slow_extended-slave_statements.result b/mysql-test/suite/percona/percona_slow_extended-slave_statements.result
new file mode 100644
index 00000000000..0548dc370b4
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_statements.result
@@ -0,0 +1,94 @@
+include/master-slave.inc
+[connection master]
+DROP TABLE IF EXISTS t;
+CREATE TABLE t(id INT);
+START SLAVE;
+include/wait_for_slave_to_start.inc
+INSERT INTO t VALUES (1);
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements OFF
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+INSERT INTO t VALUES (2);
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+INSERT INTO t VALUES (3);
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+set global log_slow_slave_statements=OFF;
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements OFF
+INSERT INTO t VALUES (4);
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements OFF
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements OFF
+INSERT INTO t VALUES (5);
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements OFF
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+INSERT INTO t VALUES (6);
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+INSERT INTO t VALUES (7);
+FLUSH LOGS;
+# Analyse master slow_query_log
+1
+1
+1
+1
+1
+1
+1
+FLUSH LOGS;
+# Analyse slave slow_query_log
+0
+0
+1
+0
+0
+0
+1
+set global log_slow_slave_statements=OFF;
+DROP TABLE t;
+STOP SLAVE;
+include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/percona/percona_slow_extended-slave_statements.test b/mysql-test/suite/percona/percona_slow_extended-slave_statements.test
new file mode 100644
index 00000000000..88c74bab69b
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-slave_statements.test
@@ -0,0 +1,133 @@
+-- source include/have_binlog_format_statement.inc
+-- source include/master-slave.inc
+
+connection master;
+-- disable_warnings
+DROP TABLE IF EXISTS t;
+-- enable_warnings
+
+CREATE TABLE t(id INT);
+
+-- disable_warnings
+connection slave;
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+-- enable_warnings
+
+connection master;
+INSERT INTO t VALUES (1);
+sync_slave_with_master;
+
+connection slave;
+show variables like 'log_slow_slave_statements';
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+
+connection master;
+INSERT INTO t VALUES (2);
+sync_slave_with_master;
+
+connection slave;
+show variables like 'log_slow_slave_statements';
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+
+connection slave;
+show variables like 'log_slow_slave_statements';
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+
+connection master;
+INSERT INTO t VALUES (3);
+sync_slave_with_master;
+
+connection slave;
+show variables like 'log_slow_slave_statements';
+set global log_slow_slave_statements=OFF;
+show variables like 'log_slow_slave_statements';
+
+connection master;
+INSERT INTO t VALUES (4);
+sync_slave_with_master;
+
+connection slave;
+show variables like 'log_slow_slave_statements';
+
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+
+connection slave;
+show variables like 'log_slow_slave_statements';
+
+connection master;
+INSERT INTO t VALUES (5);
+sync_slave_with_master;
+
+connection slave;
+show variables like 'log_slow_slave_statements';
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+
+connection master;
+INSERT INTO t VALUES (6);
+sync_slave_with_master;
+
+connection slave;
+show variables like 'log_slow_slave_statements';
+
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+
+connection slave;
+show variables like 'log_slow_slave_statements';
+
+connection master;
+INSERT INTO t VALUES (7);
+sync_slave_with_master;
+
+connection master;
+FLUSH LOGS;
+
+-- echo # Analyse master slow_query_log
+let $i=7;
+let $k=1;
+while($i)
+{
+ --let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_log_slow_slave_statements-master.log
+ --let grep_pattern = INSERT INTO t VALUES \($k\)
+ --source grep.inc
+ dec $i;
+ inc $k;
+}
+
+connection slave;
+FLUSH LOGS;
+
+-- echo # Analyse slave slow_query_log
+let $i=7;
+let $k=1;
+while($i)
+{
+ --let grep_file = $MYSQLTEST_VARDIR/mysqld.2/data/percona_log_slow_slave_statements-slave.log
+ --let grep_pattern = INSERT INTO t VALUES \($k\)
+ --source grep.inc
+ dec $i;
+ inc $k;
+}
+set global log_slow_slave_statements=OFF;
+
+connection master;
+DROP TABLE t;
+sync_slave_with_master;
+
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl-master.opt b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl-master.opt
new file mode 100644
index 00000000000..c3ebcd95326
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl-master.opt
@@ -0,0 +1 @@
+--slow_query_log_timestamp_precision='microsecond'
diff --git a/mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.result b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.result
new file mode 100644
index 00000000000..5355922bb45
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.result
@@ -0,0 +1,3 @@
+show global variables like 'slow_query_log_timestamp_precision';
+Variable_name Value
+slow_query_log_timestamp_precision microsecond
diff --git a/mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.test b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.test
new file mode 100644
index 00000000000..8f6291e9897
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_microseconds_timestamp-cl.test
@@ -0,0 +1 @@
+show global variables like 'slow_query_log_timestamp_precision';
diff --git a/mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl-master.opt b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl-master.opt
new file mode 100644
index 00000000000..233b50a1f89
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl-master.opt
@@ -0,0 +1 @@
+--slow_query_log_timestamp_always
diff --git a/mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl.result b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl.result
new file mode 100644
index 00000000000..13684fad10c
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl.result
@@ -0,0 +1,3 @@
+show global variables like 'slow_query_log_timestamp_always';
+Variable_name Value
+slow_query_log_timestamp_always ON
diff --git a/mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl.test b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl.test
new file mode 100644
index 00000000000..e73c4202869
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-slow_query_log_timestamp_always-cl.test
@@ -0,0 +1 @@
+show global variables like 'slow_query_log_timestamp_always';
diff --git a/mysql-test/suite/percona/percona_slow_query_log-control_global_slow-master.opt b/mysql-test/suite/percona/percona_slow_extended-use_global_control-master.opt
index 91dd41305cd..bd62c08c475 100644
--- a/mysql-test/suite/percona/percona_slow_query_log-control_global_slow-master.opt
+++ b/mysql-test/suite/percona/percona_slow_extended-use_global_control-master.opt
@@ -1 +1 @@
---slow-query-log-file=percona_slow_query_log-control_global_slow.log --long-query-time=1 \ No newline at end of file
+--slow-query-log-file=percona_slow_query_log-control_global_slow.log --long-query-time=1
diff --git a/mysql-test/suite/percona/percona_slow_extended-use_global_control.result b/mysql-test/suite/percona/percona_slow_extended-use_global_control.result
new file mode 100644
index 00000000000..699c95e9671
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-use_global_control.result
@@ -0,0 +1,12 @@
+SELECT sleep(2);
+sleep(2)
+0
+set global log_slow_verbosity=innodb;
+set global slow_query_log_use_global_control="log_slow_verbosity,long_query_time";
+SELECT sleep(2);
+sleep(2)
+0
+set global slow_query_log_use_global_control='';
+set global log_slow_verbosity='';
+FLUSH LOGS;
+1
diff --git a/mysql-test/suite/percona/percona_slow_extended-use_global_control.test b/mysql-test/suite/percona/percona_slow_extended-use_global_control.test
new file mode 100644
index 00000000000..199b652561c
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-use_global_control.test
@@ -0,0 +1,12 @@
+source include/have_xtradb.inc;
+SELECT sleep(2);
+set global log_slow_verbosity=innodb;
+set global slow_query_log_use_global_control="log_slow_verbosity,long_query_time";
+SELECT sleep(2);
+set global slow_query_log_use_global_control='';
+set global log_slow_verbosity='';
+
+FLUSH LOGS;
+--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-control_global_slow.log
+--let grep_pattern = No InnoDB statistics available for this query
+--source grep.inc
diff --git a/mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time-master.opt b/mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time-master.opt
new file mode 100644
index 00000000000..16b6ca5b714
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time-master.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_slow_query_log-use_global_long_query_time.log --long-query-time=2 --slow_query_log_use_global_control=long_query_time --slow-query-log=OFF
diff --git a/mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time.result b/mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time.result
new file mode 100644
index 00000000000..e89edf0430f
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time.result
@@ -0,0 +1,46 @@
+SET GLOBAL SLOW_QUERY_LOG=ON;
+SELECT sleep(1);
+sleep(1)
+0
+SELECT sleep(3);
+sleep(3)
+0
+SELECT sleep(5);
+sleep(5)
+0
+set global long_query_time=4;
+set global slow_query_log_use_global_control='long_query_time';
+SELECT sleep(1);
+sleep(1)
+0
+SELECT sleep(3);
+sleep(3)
+0
+SELECT sleep(5);
+sleep(5)
+0
+set global long_query_time=2;
+set global slow_query_log_use_global_control='';
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+FLUSH LOGS;
+3
+show global variables like 'slow_query_log_use_global_control';
+Variable_name Value
+slow_query_log_use_global_control
+set global slow_query_log_use_global_control='long_query_time';
+show global variables like 'slow_query_log_use_global_control';
+Variable_name Value
+slow_query_log_use_global_control long_query_time
+set global slow_query_log_use_global_control='log_slow_filter,long_query_time';
+show global variables like 'slow_query_log_use_global_control';
+Variable_name Value
+slow_query_log_use_global_control log_slow_filter,long_query_time
+set global slow_query_log_use_global_control='log_slow_filter';
+show global variables like 'slow_query_log_use_global_control';
+Variable_name Value
+slow_query_log_use_global_control log_slow_filter
+set global slow_query_log_use_global_control='';
+show global variables like 'slow_query_log_use_global_control';
+Variable_name Value
+slow_query_log_use_global_control
+set global slow_query_log_use_global_control='long_query_time';
diff --git a/mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time.test b/mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time.test
new file mode 100644
index 00000000000..61b2dabd23d
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_extended-use_global_long_query_time.test
@@ -0,0 +1,40 @@
+source include/have_xtradb.inc;
+
+SET GLOBAL SLOW_QUERY_LOG=ON;
+
+SELECT sleep(1);
+SELECT sleep(3);
+SELECT sleep(5);
+
+set global long_query_time=4;
+set global slow_query_log_use_global_control='long_query_time';
+
+SELECT sleep(1);
+SELECT sleep(3);
+SELECT sleep(5);
+
+set global long_query_time=2;
+set global slow_query_log_use_global_control='';
+
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+
+FLUSH LOGS;
+--let grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/percona_slow_query_log-use_global_long_query_time.log
+--let grep_pattern = Query_time
+--source grep.inc
+
+show global variables like 'slow_query_log_use_global_control';
+
+set global slow_query_log_use_global_control='long_query_time';
+show global variables like 'slow_query_log_use_global_control';
+
+set global slow_query_log_use_global_control='log_slow_filter,long_query_time';
+show global variables like 'slow_query_log_use_global_control';
+
+set global slow_query_log_use_global_control='log_slow_filter';
+show global variables like 'slow_query_log_use_global_control';
+
+set global slow_query_log_use_global_control='';
+show global variables like 'slow_query_log_use_global_control';
+
+set global slow_query_log_use_global_control='long_query_time';
diff --git a/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.result b/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.result
deleted file mode 100644
index bc6ce100b35..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.result
+++ /dev/null
@@ -1,12 +0,0 @@
-SELECT sleep(2);
-sleep(2)
-0
-set global log_slow_verbosity=innodb;
-set global use_global_log_slow_control="log_slow_verbosity,long_query_time";
-SELECT sleep(2);
-sleep(2)
-0
-set global use_global_log_slow_control=none;
-set global log_slow_verbosity=microtime;
-cat MYSQLD_DATADIR/percona_slow_query_log-control_global_slow.log | grep -c "No InnoDB statistics available for this query"
-1
diff --git a/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test b/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test
deleted file mode 100644
index 1c3dc937937..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test
+++ /dev/null
@@ -1,14 +0,0 @@
---source include/not_windows.inc
-
-source include/have_innodb.inc;
-SELECT sleep(2);
-set global log_slow_verbosity=innodb;
-set global use_global_log_slow_control="log_slow_verbosity,long_query_time";
-SELECT sleep(2);
-set global use_global_log_slow_control=none;
-set global log_slow_verbosity=microtime;
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-control_global_slow.log | grep -c "No InnoDB statistics available for this query";
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-exec echo '$cmd';
-exec $cmd;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.result b/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.result
deleted file mode 100644
index ff42937fa4a..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.result
+++ /dev/null
@@ -1,9 +0,0 @@
-SELECT sleep(2);
-sleep(2)
-0
-set log_slow_verbosity=innodb;
-SELECT sleep(2);
-sleep(2)
-0
-cat MYSQLD_DATADIR/percona_slow_query_log-log_slow_verbosity.log | grep -c "No InnoDB statistics available for this query"
-1
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test b/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test
deleted file mode 100644
index d1dc324fced..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test
+++ /dev/null
@@ -1,15 +0,0 @@
--- source include/not_windows.inc
-
-source include/have_innodb.inc;
-
-SELECT sleep(2);
-
-set log_slow_verbosity=innodb;
-
-SELECT sleep(2);
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-log_slow_verbosity.log | grep -c "No InnoDB statistics available for this query";
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-exec echo '$cmd';
-exec $cmd;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-long_query_time.result b/mysql-test/suite/percona/percona_slow_query_log-long_query_time.result
deleted file mode 100644
index 03f8745ca62..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-long_query_time.result
+++ /dev/null
@@ -1,21 +0,0 @@
-SELECT sleep(1);
-sleep(1)
-0
-SELECT sleep(6);
-sleep(6)
-0
-SELECT sleep(10);
-sleep(10)
-0
-set long_query_time=8;
-SELECT sleep(1);
-sleep(1)
-0
-SELECT sleep(6);
-sleep(6)
-0
-SELECT sleep(12);
-sleep(12)
-0
-cat MYSQLD_DATADIR/percona_slow_query_log-long_query_time.log | grep -c Query_time
-3
diff --git a/mysql-test/suite/percona/percona_slow_query_log-long_query_time.test b/mysql-test/suite/percona/percona_slow_query_log-long_query_time.test
deleted file mode 100644
index 4161690e2ef..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-long_query_time.test
+++ /dev/null
@@ -1,18 +0,0 @@
-source include/not_windows.inc;
-source include/have_innodb.inc;
-
-SELECT sleep(1);
-SELECT sleep(6);
-SELECT sleep(10);
-
-set long_query_time=8;
-
-SELECT sleep(1);
-SELECT sleep(6);
-SELECT sleep(12);
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-long_query_time.log | grep -c Query_time;
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-exec echo '$cmd';
-exec $cmd;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.result b/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.result
deleted file mode 100644
index fbfc954481e..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.result
+++ /dev/null
@@ -1,12 +0,0 @@
-SELECT sleep(2);
-sleep(2)
-0
-set global slow_query_log_microseconds_timestamp=ON;
-SELECT sleep(2);
-sleep(2)
-0
-set global slow_query_log_microseconds_timestamp=OFF;
-cat MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+.[0-9]+'
-1
-cat MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+'
-2
diff --git a/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test b/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test
deleted file mode 100644
index bceada68d79..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test
+++ /dev/null
@@ -1,21 +0,0 @@
-source include/not_windows.inc;
-source include/have_innodb.inc;
-
-SELECT sleep(2);
-
-set global slow_query_log_microseconds_timestamp=ON;
-
-SELECT sleep(2);
-
-set global slow_query_log_microseconds_timestamp=OFF;
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+.[0-9]+';
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-exec echo "$cmd";
-exec $cmd;
-
-let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+';
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-exec echo "$cmd";
-exec $cmd;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time-master.opt b/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time-master.opt
deleted file mode 100644
index e2f3b6f2041..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---slow-query-log-file=percona_slow_query_log-use_global_long_query_time.log --long-query-time=2 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.result b/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.result
deleted file mode 100644
index e294525fdd2..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.result
+++ /dev/null
@@ -1,59 +0,0 @@
-SELECT sleep(1);
-sleep(1)
-0
-SELECT sleep(3);
-sleep(3)
-0
-SELECT sleep(5);
-sleep(5)
-0
-set global long_query_time=4;
-set global use_global_long_query_time=1;
-SELECT sleep(1);
-sleep(1)
-0
-SELECT sleep(3);
-sleep(3)
-0
-SELECT sleep(5);
-sleep(5)
-0
-set global long_query_time=2;
-set global use_global_long_query_time=0;
-cat MYSQLD_DATADIR/percona_slow_query_log-use_global_long_query_time.log | grep -c Query_time
-3
-show global variables like 'use_global_log_slow_control';
-Variable_name Value
-use_global_log_slow_control none
-show global variables like 'use_global_long_query_time';
-Variable_name Value
-use_global_long_query_time OFF
-set global use_global_log_slow_control = long_query_time;
-show global variables like 'use_global_log_slow_control';
-Variable_name Value
-use_global_log_slow_control long_query_time
-show global variables like 'use_global_long_query_time';
-Variable_name Value
-use_global_long_query_time ON
-set global use_global_log_slow_control = log_slow_filter;
-show global variables like 'use_global_log_slow_control';
-Variable_name Value
-use_global_log_slow_control log_slow_filter
-show global variables like 'use_global_long_query_time';
-Variable_name Value
-use_global_long_query_time OFF
-set global use_global_long_query_time = ON;
-show global variables like 'use_global_log_slow_control';
-Variable_name Value
-use_global_log_slow_control log_slow_filter,long_query_time
-show global variables like 'use_global_long_query_time';
-Variable_name Value
-use_global_long_query_time ON
-set global use_global_long_query_time = OFF;
-show global variables like 'use_global_log_slow_control';
-Variable_name Value
-use_global_log_slow_control log_slow_filter
-show global variables like 'use_global_long_query_time';
-Variable_name Value
-use_global_long_query_time OFF
-set global use_global_log_slow_control = none;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test b/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test
deleted file mode 100644
index da627ae72b0..00000000000
--- a/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test
+++ /dev/null
@@ -1,43 +0,0 @@
-source include/not_windows.inc;
-source include/have_innodb.inc;
-
-SELECT sleep(1);
-SELECT sleep(3);
-SELECT sleep(5);
-
-set global long_query_time=4;
-set global use_global_long_query_time=1;
-
-SELECT sleep(1);
-SELECT sleep(3);
-SELECT sleep(5);
-
-set global long_query_time=2;
-set global use_global_long_query_time=0;
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-use_global_long_query_time.log | grep -c Query_time;
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-exec echo '$cmd';
-exec $cmd;
-
-show global variables like 'use_global_log_slow_control';
-show global variables like 'use_global_long_query_time';
-
-set global use_global_log_slow_control = long_query_time;
-show global variables like 'use_global_log_slow_control';
-show global variables like 'use_global_long_query_time';
-
-set global use_global_log_slow_control = log_slow_filter;
-show global variables like 'use_global_log_slow_control';
-show global variables like 'use_global_long_query_time';
-
-set global use_global_long_query_time = ON;
-show global variables like 'use_global_log_slow_control';
-show global variables like 'use_global_long_query_time';
-
-set global use_global_long_query_time = OFF;
-show global variables like 'use_global_log_slow_control';
-show global variables like 'use_global_long_query_time';
-
-set global use_global_log_slow_control = none;
diff --git a/mysql-test/suite/percona/percona_sql_no_fcache.test b/mysql-test/suite/percona/percona_sql_no_fcache.test
index da0c2ecef7d..1ed8be2196b 100644
--- a/mysql-test/suite/percona/percona_sql_no_fcache.test
+++ b/mysql-test/suite/percona/percona_sql_no_fcache.test
@@ -8,4 +8,4 @@ insert into t values (1),(2),(3);
SELECT SQL_NO_FCACHE SLEEP(0);
SELECT /*!40001 SQL_NO_CACHE */ /*!50084 SQL_NO_FCACHE */ * FROM t;
-DROP TABLE t; \ No newline at end of file
+DROP TABLE t;
diff --git a/mysql-test/suite/percona/percona_status_wait_query_cache_mutex.result b/mysql-test/suite/percona/percona_status_wait_query_cache_mutex.result
index 348dcef4d30..f951428abc7 100644
--- a/mysql-test/suite/percona/percona_status_wait_query_cache_mutex.result
+++ b/mysql-test/suite/percona/percona_status_wait_query_cache_mutex.result
@@ -18,10 +18,10 @@ SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
SELECT number from t where id > 0;
SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
SHOW PROCESSLIST;
-Id User Host db Command Time State Info
-Id root localhost test Sleep Time NULL
-Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0
-Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0
-Id root localhost test Query Time NULL SHOW PROCESSLIST
+Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
+Id root localhost test Sleep Time NULL Rows_sent Rows_examined Rows_read
+Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0 Rows_sent Rows_examined Rows_read
+Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0 Rows_sent Rows_examined Rows_read
+Id root localhost test Query Time NULL SHOW PROCESSLIST Rows_sent Rows_examined Rows_read
DROP TABLE t;
set GLOBAL query_cache_size=0;
diff --git a/mysql-test/suite/percona/percona_status_wait_query_cache_mutex.test b/mysql-test/suite/percona/percona_status_wait_query_cache_mutex.test
index 64a9fe7db71..35e2d0ac549 100644
--- a/mysql-test/suite/percona/percona_status_wait_query_cache_mutex.test
+++ b/mysql-test/suite/percona/percona_status_wait_query_cache_mutex.test
@@ -30,8 +30,8 @@ SLEEP 1.0;
--connection conn2
--error 0, ER_UNKNOWN_SYSTEM_VARIABLE
SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
---replace_column 1 Id 6 Time
+--replace_column 1 Id 6 Time 9 Rows_sent 10 Rows_examined 11 Rows_read
SHOW PROCESSLIST;
DROP TABLE t;
-set GLOBAL query_cache_size=0; \ No newline at end of file
+set GLOBAL query_cache_size=0;
diff --git a/mysql-test/suite/percona/percona_suppress_log_warning_1592.result b/mysql-test/suite/percona/percona_suppress_log_warning_1592.result
deleted file mode 100644
index 4715499b08f..00000000000
--- a/mysql-test/suite/percona/percona_suppress_log_warning_1592.result
+++ /dev/null
@@ -1,28 +0,0 @@
-SET @old_log_warnings = @@log_warnings;
-SET @old_suppress_log_warning_1592 = @@suppress_log_warning_1592;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
-SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 0;
-SET GLOBAL LOG_WARNINGS = 0;
-INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-SET GLOBAL LOG_WARNINGS = 1;
-INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 1;
-SET GLOBAL LOG_WARNINGS = 0;
-INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-SET GLOBAL LOG_WARNINGS = 1;
-INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-DROP TABLE t1;
-SET GLOBAL log_warnings = @old_log_warnings;
-SET GLOBAL suppress_log_warning_1592 = @old_suppress_log_warning_1592;
-# Count the number of times the "Unsafe" message was printed
-# to the error log.
-Occurrences: 1
diff --git a/mysql-test/suite/percona/percona_xtradb_bug317074.result b/mysql-test/suite/percona/percona_xtradb_bug317074.result
index 82a98844652..7c1876fb7bf 100644
--- a/mysql-test/suite/percona/percona_xtradb_bug317074.result
+++ b/mysql-test/suite/percona/percona_xtradb_bug317074.result
@@ -1,4 +1,5 @@
SET @old_innodb_file_format=@@innodb_file_format;
+SET @old_innodb_file_format_max=@@innodb_file_format_max;
SET @old_innodb_file_per_table=@@innodb_file_per_table;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=ON;
diff --git a/mysql-test/suite/percona/percona_xtradb_bug317074.test b/mysql-test/suite/percona/percona_xtradb_bug317074.test
index 029e0f8fcdf..5f9db073060 100644
--- a/mysql-test/suite/percona/percona_xtradb_bug317074.test
+++ b/mysql-test/suite/percona/percona_xtradb_bug317074.test
@@ -1,8 +1,8 @@
-- source include/have_xtradb.inc
SET @old_innodb_file_format=@@innodb_file_format;
+SET @old_innodb_file_format_max=@@innodb_file_format_max;
SET @old_innodb_file_per_table=@@innodb_file_per_table;
-let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=ON;
@@ -44,5 +44,5 @@ ALTER TABLE test1 ENGINE=MyISAM;
DROP TABLE test1;
SET GLOBAL innodb_file_format=@old_innodb_file_format;
+SET GLOBAL innodb_file_format_max=@old_innodb_file_format_max;
SET GLOBAL innodb_file_per_table=@old_innodb_file_per_table;
-eval set global innodb_file_format_check=$innodb_file_format_check_orig;
diff --git a/mysql-test/suite/percona/userstat_bug602047.result b/mysql-test/suite/percona/userstat_bug602047.result
new file mode 100644
index 00000000000..966439b817d
--- /dev/null
+++ b/mysql-test/suite/percona/userstat_bug602047.result
@@ -0,0 +1,15 @@
+DROP TABLE IF EXISTS t1;
+SET GLOBAL userstat=ON;
+CREATE TABLE t1 ( id int(10), PRIMARY KEY (id)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT ROWS_READ FROM information_schema.table_statistics WHERE TABLE_NAME='t1';
+ROWS_READ
+10
+SELECT ROWS_READ FROM information_schema.index_statistics WHERE TABLE_NAME='t1';
+ROWS_READ
+10
+SET GLOBAL userstat=OFF;
+DROP TABLE t1;
diff --git a/mysql-test/suite/percona/userstat_bug602047.test b/mysql-test/suite/percona/userstat_bug602047.test
new file mode 100644
index 00000000000..31fc36b80e2
--- /dev/null
+++ b/mysql-test/suite/percona/userstat_bug602047.test
@@ -0,0 +1,12 @@
+--source include/have_xtradb.inc
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+SET GLOBAL userstat=ON;
+CREATE TABLE t1 ( id int(10), PRIMARY KEY (id)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SELECT COUNT(*) FROM t1;
+SELECT ROWS_READ FROM information_schema.table_statistics WHERE TABLE_NAME='t1';
+SELECT ROWS_READ FROM information_schema.index_statistics WHERE TABLE_NAME='t1';
+SET GLOBAL userstat=OFF;
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_method_basic.result b/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_method_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_method_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_adaptive_hash_index_partitions_basic.result b/mysql-test/suite/sys_vars/r/innodb_adaptive_hash_index_partitions_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_adaptive_hash_index_partitions_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_restore_at_startup_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_restore_at_startup_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_restore_at_startup_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_shm_checksum_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_shm_checksum_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_shm_checksum_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_shm_key_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_shm_key_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_shm_key_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_checkpoint_age_target_basic.result b/mysql-test/suite/sys_vars/r/innodb_checkpoint_age_target_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_checkpoint_age_target_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_corrupt_table_action_basic.result b/mysql-test/suite/sys_vars/r/innodb_corrupt_table_action_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_corrupt_table_action_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_dict_size_limit_basic.result b/mysql-test/suite/sys_vars/r/innodb_dict_size_limit_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_dict_size_limit_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_doublewrite_file_basic.result b/mysql-test/suite/sys_vars/r/innodb_doublewrite_file_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_doublewrite_file_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_fast_checksum_basic.result b/mysql-test/suite/sys_vars/r/innodb_fast_checksum_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_fast_checksum_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_file_format_max_basic.result b/mysql-test/suite/sys_vars/r/innodb_file_format_max_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_file_format_max_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result b/mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result
index eabafb26ccb..441fb4cd362 100644
--- a/mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result
@@ -9,11 +9,6 @@ SELECT @@global.innodb_flush_log_at_trx_commit;
@@global.innodb_flush_log_at_trx_commit
1
'#---------------------FN_DYNVARS_046_02-------------------------#'
-SET innodb_flush_log_at_trx_commit = 1;
-ERROR HY000: Variable 'innodb_flush_log_at_trx_commit' is a GLOBAL variable and should be set with SET GLOBAL
-SELECT @@innodb_flush_log_at_trx_commit;
-@@innodb_flush_log_at_trx_commit
-1
SELECT local.innodb_flush_log_at_trx_commit;
ERROR 42S02: Unknown table 'local' in field list
SET global innodb_flush_log_at_trx_commit = 0;
diff --git a/mysql-test/suite/sys_vars/r/innodb_flush_neighbor_pages_basic.result b/mysql-test/suite/sys_vars/r/innodb_flush_neighbor_pages_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_flush_neighbor_pages_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_ibuf_accel_rate_basic.result b/mysql-test/suite/sys_vars/r/innodb_ibuf_accel_rate_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_ibuf_accel_rate_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_ibuf_active_contract_basic.result b/mysql-test/suite/sys_vars/r/innodb_ibuf_active_contract_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_ibuf_active_contract_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_ibuf_max_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_ibuf_max_size_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_ibuf_max_size_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_import_table_from_xtrabackup_basic.result b/mysql-test/suite/sys_vars/r/innodb_import_table_from_xtrabackup_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_import_table_from_xtrabackup_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_large_prefix_basic.result b/mysql-test/suite/sys_vars/r/innodb_large_prefix_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_large_prefix_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_lazy_drop_table_basic.result b/mysql-test/suite/sys_vars/r/innodb_lazy_drop_table_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_lazy_drop_table_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_log_block_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_block_size_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_log_block_size_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_page_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_page_size_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_page_size_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_read_ahead_basic.result b/mysql-test/suite/sys_vars/r/innodb_read_ahead_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_read_ahead_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_recovery_stats_basic.result b/mysql-test/suite/sys_vars/r/innodb_recovery_stats_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_recovery_stats_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_recovery_update_relay_log_basic.result b/mysql-test/suite/sys_vars/r/innodb_recovery_update_relay_log_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_recovery_update_relay_log_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result b/mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_show_locks_held_basic.result b/mysql-test/suite/sys_vars/r/innodb_show_locks_held_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_show_locks_held_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_show_verbose_locks_basic.result b/mysql-test/suite/sys_vars/r/innodb_show_verbose_locks_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_show_verbose_locks_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_auto_update_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_auto_update_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_stats_auto_update_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_method_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_method_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_stats_method_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_update_need_lock_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_update_need_lock_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_stats_update_need_lock_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_thread_concurrency_timer_based_basic.result b/mysql-test/suite/sys_vars/r/innodb_thread_concurrency_timer_based_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_thread_concurrency_timer_based_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_use_global_flush_log_at_trx_commit_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_global_flush_log_at_trx_commit_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_use_global_flush_log_at_trx_commit_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_use_sys_stats_table_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_sys_stats_table_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_use_sys_stats_table_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_method_basic.test b/mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_method_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_method_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_partitions_basic.test b/mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_partitions_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_partitions_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_restore_at_startup_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_restore_at_startup_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_restore_at_startup_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_shm_checksum_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_shm_checksum_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_shm_checksum_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_shm_key_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_shm_key_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_shm_key_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_checkpoint_age_target_basic.test b/mysql-test/suite/sys_vars/t/innodb_checkpoint_age_target_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_checkpoint_age_target_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_corrupt_table_action_basic.test b/mysql-test/suite/sys_vars/t/innodb_corrupt_table_action_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_corrupt_table_action_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_dict_size_limit_basic.test b/mysql-test/suite/sys_vars/t/innodb_dict_size_limit_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_dict_size_limit_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_doublewrite_file_basic.test b/mysql-test/suite/sys_vars/t/innodb_doublewrite_file_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_doublewrite_file_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_fast_checksum_basic.test b/mysql-test/suite/sys_vars/t/innodb_fast_checksum_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_fast_checksum_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_file_format_max_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_format_max_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_file_format_max_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test
index 90da929d199..56cfc2ffebe 100644
--- a/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test
@@ -56,11 +56,6 @@ SELECT @@global.innodb_flush_log_at_trx_commit;
# Check if variable can be accessed with and without @@ sign #
###############################################################################
---Error ER_GLOBAL_VARIABLE
-SET innodb_flush_log_at_trx_commit = 1;
-SELECT @@innodb_flush_log_at_trx_commit;
-
-
--Error ER_UNKNOWN_TABLE
SELECT local.innodb_flush_log_at_trx_commit;
diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_neighbor_pages_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_neighbor_pages_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_flush_neighbor_pages_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_ibuf_accel_rate_basic.test b/mysql-test/suite/sys_vars/t/innodb_ibuf_accel_rate_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ibuf_accel_rate_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_ibuf_active_contract_basic.test b/mysql-test/suite/sys_vars/t/innodb_ibuf_active_contract_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ibuf_active_contract_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_ibuf_max_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_ibuf_max_size_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ibuf_max_size_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_import_table_from_xtrabackup_basic.test b/mysql-test/suite/sys_vars/t/innodb_import_table_from_xtrabackup_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_import_table_from_xtrabackup_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_large_prefix_basic.test b/mysql-test/suite/sys_vars/t/innodb_large_prefix_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_large_prefix_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_lazy_drop_table_basic.test b/mysql-test/suite/sys_vars/t/innodb_lazy_drop_table_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_lazy_drop_table_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_log_block_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_block_size_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_log_block_size_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_page_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_page_size_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_page_size_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_read_ahead_basic.test b/mysql-test/suite/sys_vars/t/innodb_read_ahead_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_read_ahead_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_recovery_stats_basic.test b/mysql-test/suite/sys_vars/t/innodb_recovery_stats_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_recovery_stats_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_recovery_update_relay_log_basic.test b/mysql-test/suite/sys_vars/t/innodb_recovery_update_relay_log_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_recovery_update_relay_log_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test b/mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_show_locks_held_basic.test b/mysql-test/suite/sys_vars/t/innodb_show_locks_held_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_show_locks_held_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_show_verbose_locks_basic.test b/mysql-test/suite/sys_vars/t/innodb_show_verbose_locks_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_show_verbose_locks_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_auto_update_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_auto_update_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_auto_update_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_update_need_lock_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_update_need_lock_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_update_need_lock_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_thread_concurrency_timer_based_basic.test b/mysql-test/suite/sys_vars/t/innodb_thread_concurrency_timer_based_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_thread_concurrency_timer_based_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_use_global_flush_log_at_trx_commit_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_global_flush_log_at_trx_commit_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_use_global_flush_log_at_trx_commit_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_use_sys_stats_table_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_sys_stats_table_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_use_sys_stats_table_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result b/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result
index a2ebc7a8cd8..2108576ce2c 100644
--- a/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result
@@ -25,8 +25,8 @@ a b c
# INSERT INTO tbl_name VALUES... a non-NULL value is specified against vcols
insert into t1 values (1,2,3);
Warnings:
-Warning 1647 The value specified for computed column 'b' in table 't1' ignored
-Warning 1647 The value specified for computed column 'c' in table 't1' ignored
+Warning 1718 The value specified for computed column 'b' in table 't1' ignored
+Warning 1718 The value specified for computed column 'c' in table 't1' ignored
select * from t1;
a b c
1 -1 -1
@@ -65,8 +65,8 @@ a b c
# against vcols
insert into t1 (a,b) values (1,3), (2,4);
Warnings:
-Warning 1647 The value specified for computed column 'b' in table 't1' ignored
-Warning 1647 The value specified for computed column 'b' in table 't1' ignored
+Warning 1718 The value specified for computed column 'b' in table 't1' ignored
+Warning 1718 The value specified for computed column 'b' in table 't1' ignored
select * from t1;
a b c
1 -1 -1
@@ -107,8 +107,8 @@ a b c
create table t2 like t1;
insert into t2 select * from t1;
Warnings:
-Warning 1647 The value specified for computed column 'b' in table 't2' ignored
-Warning 1647 The value specified for computed column 'c' in table 't2' ignored
+Warning 1718 The value specified for computed column 'b' in table 't2' ignored
+Warning 1718 The value specified for computed column 'c' in table 't2' ignored
select * from t1;
a b c
2 -2 -2
@@ -123,8 +123,8 @@ a b c
create table t2 like t1;
insert into t2 (a,b) select a,b from t1;
Warnings:
-Warning 1647 The value specified for computed column 'b' in table 't2' ignored
-Warning 1647 The value specified for computed column 'b' in table 't2' ignored
+Warning 1718 The value specified for computed column 'b' in table 't2' ignored
+Warning 1718 The value specified for computed column 'b' in table 't2' ignored
select * from t2;
a b c
2 -2 -2
@@ -159,7 +159,7 @@ a b c
2 -2 -2
update t1 set c=3 where a=2;
Warnings:
-Warning 1647 The value specified for computed column 'c' in table 't1' ignored
+Warning 1718 The value specified for computed column 'c' in table 't1' ignored
select * from t1;
a b c
1 -1 -1
@@ -189,7 +189,7 @@ a b c
2 -2 -2
update t1 set c=3 where b=-2;
Warnings:
-Warning 1647 The value specified for computed column 'c' in table 't1' ignored
+Warning 1718 The value specified for computed column 'c' in table 't1' ignored
select * from t1;
a b c
1 -1 -1
diff --git a/mysql-test/suite/vcol/r/vcol_select_innodb.result b/mysql-test/suite/vcol/r/vcol_select_innodb.result
index aa32d91142e..a21a230a573 100644
--- a/mysql-test/suite/vcol/r/vcol_select_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_select_innodb.result
@@ -22,7 +22,7 @@ a b c
1 -1 -1
explain select * from t2 where c=-1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref c c 5 const 1
+1 SIMPLE t2 ref c c 5 const 1 Using index condition
# select_type=SIMPLE, type=ALL
select * from t1 where b=-1;
a b c
@@ -53,7 +53,7 @@ a b c a b c
explain select * from t1,t3 where t1.c=t3.c and t3.c=-1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 const c c 5 const 1
-1 SIMPLE t1 ref c c 5 const 2
+1 SIMPLE t1 ref c c 5 const 2 Using index condition
# select_type=PRIMARY, type=index,ALL
select * from t1 where b in (select c from t3);
a b c
@@ -130,7 +130,7 @@ count(distinct c)
3
explain select count(distinct c) from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 5 NULL 5 Using index
+1 SIMPLE t1 range NULL c 5 NULL 6 Using index for group-by (scanning)
###
### filesort & range-based utils
###
@@ -141,7 +141,7 @@ a b c
2 -2 -2
explain select * from t3 where c >= -2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using MRR
+1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Using MRR
# SELECT * FROM tbl_name WHERE <non-vcol expr>
select * from t3 where a between 1 and 2;
a b c
@@ -149,7 +149,7 @@ a b c
2 -2 -2
explain select * from t3 where a between 1 and 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using where
+1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr>
select * from t3 where b between -2 and -1;
a b c
@@ -165,7 +165,7 @@ a b c
2 -2 -2
explain select * from t3 where c between -2 and -1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using MRR
+1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Using MRR
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <non-indexed vcol>
select * from t3 where a between 1 and 2 order by b;
a b c
@@ -173,7 +173,7 @@ a b c
1 -1 -1
explain select * from t3 where a between 1 and 2 order by b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using where; Using filesort
+1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol>
select * from t3 where a between 1 and 2 order by c;
a b c
@@ -181,7 +181,7 @@ a b c
1 -1 -1
explain select * from t3 where a between 1 and 2 order by c;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using where; Using filesort
+1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol>
select * from t3 where b between -2 and -1 order by a;
a b c
@@ -205,7 +205,7 @@ a b c
1 -1 -1
explain select * from t3 where c between -2 and -1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using MRR; Using filesort
+1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Using MRR; Using filesort
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol>
select * from t3 where b between -2 and -1 order by c;
a b c
@@ -221,7 +221,7 @@ a b c
1 -1 -1
explain select * from t3 where c between -2 and -1 order by c;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 range c c 5 NULL 1 Using index condition
+1 SIMPLE t3 range c c 5 NULL 2 Using index condition
# SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol>
select sum(b) from t1 group by b;
sum(b)
diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result
index 83f755a2e7f..c75b8a24575 100644
--- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result
@@ -170,11 +170,11 @@ t1 CREATE TABLE `t1` (
`b` double AS (format(cot(a),6)) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
insert into t1 values (12,default);
-insert into t1 values (0,default);
+insert into t1 values (1,default);
select * from t1;
a b
12 -1.572673
-0 NULL
+1 0.642093
drop table t1;
set sql_warnings = 0;
# CRC32()
diff --git a/mysql-test/suite/vcol/r/vcol_view_innodb.result b/mysql-test/suite/vcol/r/vcol_view_innodb.result
index ae834722606..18991634b62 100644
--- a/mysql-test/suite/vcol/r/vcol_view_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_view_innodb.result
@@ -266,8 +266,8 @@ insert into v1 (a) values (3);
ERROR HY000: CHECK OPTION failed 'test.v1'
insert ignore into v1 (a) values (2),(3),(0);
Warnings:
-Error 1369 CHECK OPTION failed 'test.v1'
-Error 1369 CHECK OPTION failed 'test.v1'
+Warning 1369 CHECK OPTION failed 'test.v1'
+Warning 1369 CHECK OPTION failed 'test.v1'
select * from t1;
a b c
1 -1 -1
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 698bf67b927..4a43969a057 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -536,7 +536,7 @@ connect (user10261,localhost,mysqltest_4,,);
connection user10261;
--sorted_result
SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
-where COLUMN_NAME='TABLE_NAME';
+where COLUMN_NAME='TABLE_NAME' and table_name not like 'innodb%';
connection default;
disconnect user10261;
delete from mysql.user where user='mysqltest_4';
@@ -917,10 +917,10 @@ DROP USER mysql_bug20230@localhost;
# INFORMARTION_SCHEMA.TABLES
#
-SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
+SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test') and table_name not like 'xtradb%';
SELECT table_name from information_schema.tables
WHERE table_name=(SELECT MAX(table_name)
- FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'));
+ FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test') and table_name not like 'xtradb%');
#
# Bug #23037 Bug in field "Default" of query "SHOW COLUMNS FROM table"
#
diff --git a/mysql-test/t/innodb-analyze.test b/mysql-test/t/innodb-analyze.test
deleted file mode 100644
index 9bdb9db697c..00000000000
--- a/mysql-test/t/innodb-analyze.test
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# Test that mysqld does not crash when running ANALYZE TABLE with
-# different values of the parameter innodb_stats_sample_pages.
-#
-
--- source include/have_innodb.inc
-
-# we care only that the following SQL commands do not produce errors
-# and do not crash the server
--- disable_query_log
--- disable_result_log
--- enable_warnings
-
-let $sample_pages=`select @@innodb_stats_sample_pages`;
-SET GLOBAL innodb_stats_sample_pages=0;
-
-# check that the value has been adjusted to 1
--- enable_result_log
-SHOW VARIABLES LIKE 'innodb_stats_sample_pages';
--- disable_result_log
-
-CREATE TABLE innodb_analyze (
- a INT,
- b INT,
- KEY(a),
- KEY(b,a)
-) ENGINE=InnoDB;
-
-# test with empty table
-
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=2;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=4;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=8;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=16;
-ANALYZE TABLE innodb_analyze;
-
-INSERT INTO innodb_analyze VALUES
-(1,1), (1,1), (1,2), (1,3), (1,4), (1,5),
-(8,1), (8,8), (8,2), (7,1), (1,4), (3,5);
-
-SET GLOBAL innodb_stats_sample_pages=1;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=2;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=4;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=8;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=16;
-ANALYZE TABLE innodb_analyze;
-
-DROP TABLE innodb_analyze;
-EVAL SET GLOBAL innodb_stats_sample_pages=$sample_pages;
diff --git a/mysql-test/t/innodb-consistent-master.opt b/mysql-test/t/innodb-consistent-master.opt
deleted file mode 100644
index cb48f1aaf60..00000000000
--- a/mysql-test/t/innodb-consistent-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb_lock_wait_timeout=2
diff --git a/mysql-test/t/innodb-consistent.test b/mysql-test/t/innodb-consistent.test
deleted file mode 100644
index 5a7f4dc392d..00000000000
--- a/mysql-test/t/innodb-consistent.test
+++ /dev/null
@@ -1,58 +0,0 @@
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
-# a consistent read of the source table.
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-connection a;
-set session transaction isolation level read committed;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-create table t2 like t1;
-insert into t2 values (1),(2),(3),(4),(5),(6),(7);
-set autocommit=0;
-
-# REPLACE INTO ... SELECT case
-begin;
-# this should not result in any locks on t2.
-replace into t1 select * from t2;
-
-connection b;
-set session transaction isolation level read committed;
-set autocommit=0;
-# should not cuase a lock wait.
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-connection a;
-commit;
-
-# INSERT INTO ... SELECT case
-begin;
-# this should not result in any locks on t2.
-insert into t1 select * from t2;
-
-connection b;
-set session transaction isolation level read committed;
-set autocommit=0;
-# should not cuase a lock wait.
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-connection a;
-commit;
-
-select * from t1;
-drop table t1;
-drop table t2;
-
-connection default;
-disconnect a;
-disconnect b;
diff --git a/mysql-test/t/innodb-index_ucs2.test b/mysql-test/t/innodb-index_ucs2.test
deleted file mode 100644
index fff9a4da1a8..00000000000
--- a/mysql-test/t/innodb-index_ucs2.test
+++ /dev/null
@@ -1,5 +0,0 @@
--- source include/have_innodb.inc
--- source include/have_ucs2.inc
-
--- let charset = ucs2
--- source include/innodb-index.inc
diff --git a/mysql-test/t/innodb-replace.test b/mysql-test/t/innodb-replace.test
deleted file mode 100644
index 8c3aacde5e8..00000000000
--- a/mysql-test/t/innodb-replace.test
+++ /dev/null
@@ -1,22 +0,0 @@
--- source include/have_innodb.inc
-# embedded server ignores 'delayed', so skip this
--- source include/not_embedded.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Bug #1078
-#
-create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
-select * from t1;
---error ER_DELAYED_NOT_SUPPORTED
-replace delayed into t1 (c1, c2) values ( "text1","11");
-select * from t1;
---error ER_DELAYED_NOT_SUPPORTED
-replace delayed into t1 (c1, c2) values ( "text1","12");
-select * from t1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/innodb-timeout.test b/mysql-test/t/innodb-timeout.test
deleted file mode 100644
index 7f7bcecb4ee..00000000000
--- a/mysql-test/t/innodb-timeout.test
+++ /dev/null
@@ -1,69 +0,0 @@
--- source include/have_innodb.inc
-
-let $timeout=`select @@innodb_lock_wait_timeout`;
-set global innodb_lock_wait_timeout=42;
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-
-connection a;
-select @@innodb_lock_wait_timeout;
-set innodb_lock_wait_timeout=1;
-select @@innodb_lock_wait_timeout;
-
-connection b;
-select @@innodb_lock_wait_timeout;
-set global innodb_lock_wait_timeout=347;
-select @@innodb_lock_wait_timeout;
-set innodb_lock_wait_timeout=1;
-select @@innodb_lock_wait_timeout;
-
-connect (c,localhost,root,,);
-connection c;
-select @@innodb_lock_wait_timeout;
-connection default;
-disconnect c;
-
-connection a;
-create table t1(a int primary key)engine=innodb;
-begin;
-insert into t1 values(1),(2),(3);
-
-connection b;
-set innodb_lock_wait_timeout=5;
---send
-select * from t1 for update;
-
-connection a;
-commit;
-
-connection b;
-reap;
-
-connection a;
-begin;
-insert into t1 values(4);
-
-connection b;
-# Test that we get a lock timeout.
-# We cannot reliably test that the timeout is exactly 1 seconds due to
-# process scheduling differences on the host running the test suite. But we
-# can test that we are within reasonable range.
-set innodb_lock_wait_timeout=2;
-set @a= current_timestamp();
---error ER_LOCK_WAIT_TIMEOUT
-select * from t1 for update;
-set @b= current_timestamp();
-set @c= timestampdiff(SECOND, @a, @b);
-select if(@c >= 1 and @c <= 10, 'OK', concat("NOT OK, time passed=", @c));
-
-connection a;
-commit;
-drop table t1;
-
-connection default;
-
-disconnect a;
-disconnect b;
-
-eval set global innodb_lock_wait_timeout=$timeout;
diff --git a/mysql-test/t/innodb_bug34053.test b/mysql-test/t/innodb_bug34053.test
deleted file mode 100644
index b935e45c06d..00000000000
--- a/mysql-test/t/innodb_bug34053.test
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# Make sure http://bugs.mysql.com/34053 remains fixed.
-#
-
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
-SET storage_engine=InnoDB;
-
-# we do not really care about what gets printed, we are only
-# interested in getting success or failure according to our
-# expectations
--- disable_query_log
--- disable_result_log
-
-GRANT USAGE ON *.* TO 'shane'@'localhost' IDENTIFIED BY '12345';
-FLUSH PRIVILEGES;
-
--- connect (con1,localhost,shane,12345,)
-
--- connection con1
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
-CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB;
-DROP TABLE innodb_monitorx;
-CREATE TABLE innodb_monito (a INT) ENGINE=INNODB;
-DROP TABLE innodb_monito;
-CREATE TABLE xinnodb_monitor (a INT) ENGINE=INNODB;
-DROP TABLE xinnodb_monitor;
-CREATE TABLE nnodb_monitor (a INT) ENGINE=INNODB;
-DROP TABLE nnodb_monitor;
-
--- connection default
-CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
-CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
-
--- connection con1
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-DROP TABLE innodb_monitor;
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-DROP TABLE innodb_mem_validate;
-
--- connection default
-DROP TABLE innodb_monitor;
-DROP TABLE innodb_mem_validate;
-DROP USER 'shane'@'localhost';
-
--- disconnect con1
diff --git a/mysql-test/t/innodb_bug34300.test b/mysql-test/t/innodb_bug34300.test
deleted file mode 100644
index 5b1939e648e..00000000000
--- a/mysql-test/t/innodb_bug34300.test
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Bug#34300 Tinyblob & tinytext fields currupted after export/import and alter in 5.1
-# http://bugs.mysql.com/34300
-#
-
--- source include/have_innodb.inc
-
--- disable_query_log
--- disable_result_log
-
-# set packet size and reconnect
-let $max_packet=`select @@global.max_allowed_packet`;
-SET @@global.max_allowed_packet=16777216;
---connect (newconn, localhost, root,,)
-
-DROP TABLE IF EXISTS bug34300;
-CREATE TABLE bug34300 (
- f4 TINYTEXT,
- f6 MEDIUMTEXT,
- f8 TINYBLOB
-) ENGINE=InnoDB;
-
-INSERT INTO bug34300 VALUES ('xxx', repeat('a', 8459264), 'zzz');
-
--- enable_result_log
-
-SELECT f4, f8 FROM bug34300;
-
-ALTER TABLE bug34300 ADD COLUMN (f10 INT);
-
-SELECT f4, f8 FROM bug34300;
-
-DROP TABLE bug34300;
-disconnect newconn;
-connection default;
-EVAL SET @@global.max_allowed_packet=$max_packet;
diff --git a/mysql-test/t/innodb_bug35220.test b/mysql-test/t/innodb_bug35220.test
deleted file mode 100644
index 26f7d6b1ddd..00000000000
--- a/mysql-test/t/innodb_bug35220.test
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Bug#35220 ALTER TABLE too picky on reserved word "foreign"
-# http://bugs.mysql.com/35220
-#
-
--- source include/have_innodb.inc
-
-SET storage_engine=InnoDB;
-
-# we care only that the following SQL commands do not produce errors
--- disable_query_log
--- disable_result_log
-
-CREATE TABLE bug35220 (foreign_col INT, dummy_cant_delete_all_columns INT);
-ALTER TABLE bug35220 DROP foreign_col;
-DROP TABLE bug35220;
diff --git a/mysql-test/t/innodb_bug36169.test b/mysql-test/t/innodb_bug36169.test
deleted file mode 100644
index 5bf55193b5c..00000000000
--- a/mysql-test/t/innodb_bug36169.test
+++ /dev/null
@@ -1,1159 +0,0 @@
-#
-# Bug#36169 create innodb compressed table with too large row size crashed
-# http://bugs.mysql.com/36169
-#
-
--- source include/have_innodb.inc
-
-let $file_format=`select @@innodb_file_format`;
-let $file_per_table=`select @@innodb_file_per_table`;
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
-
-#
-# The following is copied from http://bugs.mysql.com/36169
-# (http://bugs.mysql.com/file.php?id=9121)
-# Probably it can be simplified but that is not obvious.
-#
-
-# we care only that the following SQL commands do produce errors
-# as expected and do not crash the server
--- disable_query_log
--- disable_result_log
-
-# Generating 10 tables
-# Creating a table with 94 columns and 24 indexes
-DROP TABLE IF EXISTS `table0`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table0`
-(`col0` BOOL,
-`col1` BOOL,
-`col2` TINYINT,
-`col3` DATE,
-`col4` TIME,
-`col5` SET ('test1','test2','test3'),
-`col6` TIME,
-`col7` TEXT,
-`col8` DECIMAL,
-`col9` SET ('test1','test2','test3'),
-`col10` FLOAT,
-`col11` DOUBLE PRECISION,
-`col12` ENUM ('test1','test2','test3'),
-`col13` TINYBLOB,
-`col14` YEAR,
-`col15` SET ('test1','test2','test3'),
-`col16` NUMERIC,
-`col17` NUMERIC,
-`col18` BLOB,
-`col19` DATETIME,
-`col20` DOUBLE PRECISION,
-`col21` DECIMAL,
-`col22` DATETIME,
-`col23` NUMERIC,
-`col24` NUMERIC,
-`col25` LONGTEXT,
-`col26` TINYBLOB,
-`col27` TIME,
-`col28` TINYBLOB,
-`col29` ENUM ('test1','test2','test3'),
-`col30` SMALLINT,
-`col31` REAL,
-`col32` FLOAT,
-`col33` CHAR (175),
-`col34` TINYTEXT,
-`col35` TINYTEXT,
-`col36` TINYBLOB,
-`col37` TINYBLOB,
-`col38` TINYTEXT,
-`col39` MEDIUMBLOB,
-`col40` TIMESTAMP,
-`col41` DOUBLE,
-`col42` SMALLINT,
-`col43` LONGBLOB,
-`col44` VARCHAR (80),
-`col45` MEDIUMTEXT,
-`col46` NUMERIC,
-`col47` BIGINT,
-`col48` DATE,
-`col49` TINYBLOB,
-`col50` DATE,
-`col51` BOOL,
-`col52` MEDIUMINT,
-`col53` FLOAT,
-`col54` TINYBLOB,
-`col55` LONGTEXT,
-`col56` SMALLINT,
-`col57` ENUM ('test1','test2','test3'),
-`col58` DATETIME,
-`col59` MEDIUMTEXT,
-`col60` VARCHAR (232),
-`col61` NUMERIC,
-`col62` YEAR,
-`col63` SMALLINT,
-`col64` TIMESTAMP,
-`col65` BLOB,
-`col66` LONGBLOB,
-`col67` INT,
-`col68` LONGTEXT,
-`col69` ENUM ('test1','test2','test3'),
-`col70` INT,
-`col71` TIME,
-`col72` TIMESTAMP,
-`col73` TIMESTAMP,
-`col74` VARCHAR (170),
-`col75` SET ('test1','test2','test3'),
-`col76` TINYBLOB,
-`col77` BIGINT,
-`col78` NUMERIC,
-`col79` DATETIME,
-`col80` YEAR,
-`col81` NUMERIC,
-`col82` LONGBLOB,
-`col83` TEXT,
-`col84` CHAR (83),
-`col85` DECIMAL,
-`col86` FLOAT,
-`col87` INT,
-`col88` VARCHAR (145),
-`col89` DATE,
-`col90` DECIMAL,
-`col91` DECIMAL,
-`col92` MEDIUMBLOB,
-`col93` TIME,
-KEY `idx0` (`col69`,`col90`,`col8`),
-KEY `idx1` (`col60`),
-KEY `idx2` (`col60`,`col70`,`col74`),
-KEY `idx3` (`col22`,`col32`,`col72`,`col30`),
-KEY `idx4` (`col29`),
-KEY `idx5` (`col19`,`col45`(143)),
-KEY `idx6` (`col46`,`col48`,`col5`,`col39`(118)),
-KEY `idx7` (`col48`,`col61`),
-KEY `idx8` (`col93`),
-KEY `idx9` (`col31`),
-KEY `idx10` (`col30`,`col21`),
-KEY `idx11` (`col67`),
-KEY `idx12` (`col44`,`col6`,`col8`,`col38`(226)),
-KEY `idx13` (`col71`,`col41`,`col15`,`col49`(88)),
-KEY `idx14` (`col78`),
-KEY `idx15` (`col63`,`col67`,`col64`),
-KEY `idx16` (`col17`,`col86`),
-KEY `idx17` (`col77`,`col56`,`col10`,`col55`(24)),
-KEY `idx18` (`col62`),
-KEY `idx19` (`col31`,`col57`,`col56`,`col53`),
-KEY `idx20` (`col46`),
-KEY `idx21` (`col83`(54)),
-KEY `idx22` (`col51`,`col7`(120)),
-KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`)
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 10 columns and 32 indexes
-DROP TABLE IF EXISTS `table1`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table1`
-(`col0` CHAR (113),
-`col1` FLOAT,
-`col2` BIGINT,
-`col3` DECIMAL,
-`col4` BLOB,
-`col5` LONGTEXT,
-`col6` SET ('test1','test2','test3'),
-`col7` BIGINT,
-`col8` BIGINT,
-`col9` TINYBLOB,
-KEY `idx0` (`col5`(101),`col7`,`col8`),
-KEY `idx1` (`col8`),
-KEY `idx2` (`col4`(177),`col9`(126),`col6`,`col3`),
-KEY `idx3` (`col5`(160)),
-KEY `idx4` (`col9`(242)),
-KEY `idx5` (`col4`(139),`col2`,`col3`),
-KEY `idx6` (`col7`),
-KEY `idx7` (`col6`,`col2`,`col0`,`col3`),
-KEY `idx8` (`col9`(66)),
-KEY `idx9` (`col5`(253)),
-KEY `idx10` (`col1`,`col7`,`col2`),
-KEY `idx11` (`col9`(242),`col0`,`col8`,`col5`(163)),
-KEY `idx12` (`col8`),
-KEY `idx13` (`col0`,`col9`(37)),
-KEY `idx14` (`col0`),
-KEY `idx15` (`col5`(111)),
-KEY `idx16` (`col8`,`col0`,`col5`(13)),
-KEY `idx17` (`col4`(139)),
-KEY `idx18` (`col5`(189),`col2`,`col3`,`col9`(136)),
-KEY `idx19` (`col0`,`col3`,`col1`,`col8`),
-KEY `idx20` (`col8`),
-KEY `idx21` (`col0`,`col7`,`col9`(227),`col3`),
-KEY `idx22` (`col0`),
-KEY `idx23` (`col2`),
-KEY `idx24` (`col3`),
-KEY `idx25` (`col2`,`col3`),
-KEY `idx26` (`col0`),
-KEY `idx27` (`col5`(254)),
-KEY `idx28` (`col3`),
-KEY `idx29` (`col3`),
-KEY `idx30` (`col7`,`col3`,`col0`,`col4`(220)),
-KEY `idx31` (`col4`(1),`col0`)
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 141 columns and 18 indexes
-DROP TABLE IF EXISTS `table2`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table2`
-(`col0` BOOL,
-`col1` MEDIUMINT,
-`col2` VARCHAR (209),
-`col3` MEDIUMBLOB,
-`col4` CHAR (13),
-`col5` DOUBLE,
-`col6` TINYTEXT,
-`col7` REAL,
-`col8` SMALLINT,
-`col9` BLOB,
-`col10` TINYINT,
-`col11` DECIMAL,
-`col12` BLOB,
-`col13` DECIMAL,
-`col14` LONGBLOB,
-`col15` SMALLINT,
-`col16` LONGBLOB,
-`col17` TINYTEXT,
-`col18` FLOAT,
-`col19` CHAR (78),
-`col20` MEDIUMTEXT,
-`col21` SET ('test1','test2','test3'),
-`col22` MEDIUMINT,
-`col23` INT,
-`col24` MEDIUMBLOB,
-`col25` ENUM ('test1','test2','test3'),
-`col26` TINYBLOB,
-`col27` VARCHAR (116),
-`col28` TIMESTAMP,
-`col29` BLOB,
-`col30` SMALLINT,
-`col31` DOUBLE PRECISION,
-`col32` DECIMAL,
-`col33` DECIMAL,
-`col34` TEXT,
-`col35` MEDIUMINT,
-`col36` MEDIUMINT,
-`col37` BIGINT,
-`col38` VARCHAR (253),
-`col39` TINYBLOB,
-`col40` MEDIUMBLOB,
-`col41` BIGINT,
-`col42` DOUBLE,
-`col43` TEXT,
-`col44` BLOB,
-`col45` TIME,
-`col46` MEDIUMINT,
-`col47` DOUBLE PRECISION,
-`col48` SET ('test1','test2','test3'),
-`col49` DOUBLE PRECISION,
-`col50` VARCHAR (97),
-`col51` TEXT,
-`col52` NUMERIC,
-`col53` ENUM ('test1','test2','test3'),
-`col54` MEDIUMTEXT,
-`col55` MEDIUMINT,
-`col56` DATETIME,
-`col57` DATETIME,
-`col58` MEDIUMTEXT,
-`col59` CHAR (244),
-`col60` LONGBLOB,
-`col61` MEDIUMBLOB,
-`col62` DOUBLE,
-`col63` SMALLINT,
-`col64` BOOL,
-`col65` SMALLINT,
-`col66` VARCHAR (212),
-`col67` TIME,
-`col68` REAL,
-`col69` BOOL,
-`col70` BIGINT,
-`col71` DATE,
-`col72` TINYINT,
-`col73` ENUM ('test1','test2','test3'),
-`col74` DATE,
-`col75` TIME,
-`col76` DATETIME,
-`col77` BOOL,
-`col78` TINYTEXT,
-`col79` MEDIUMINT,
-`col80` NUMERIC,
-`col81` LONGTEXT,
-`col82` SET ('test1','test2','test3'),
-`col83` DOUBLE PRECISION,
-`col84` NUMERIC,
-`col85` VARCHAR (184),
-`col86` DOUBLE PRECISION,
-`col87` MEDIUMTEXT,
-`col88` MEDIUMBLOB,
-`col89` BOOL,
-`col90` SMALLINT,
-`col91` TINYINT,
-`col92` ENUM ('test1','test2','test3'),
-`col93` BOOL,
-`col94` TIMESTAMP,
-`col95` BOOL,
-`col96` MEDIUMTEXT,
-`col97` DECIMAL,
-`col98` BOOL,
-`col99` DECIMAL,
-`col100` MEDIUMINT,
-`col101` DOUBLE PRECISION,
-`col102` TINYINT,
-`col103` BOOL,
-`col104` MEDIUMINT,
-`col105` DECIMAL,
-`col106` NUMERIC,
-`col107` TIMESTAMP,
-`col108` MEDIUMBLOB,
-`col109` TINYBLOB,
-`col110` SET ('test1','test2','test3'),
-`col111` YEAR,
-`col112` TIMESTAMP,
-`col113` CHAR (201),
-`col114` BOOL,
-`col115` TINYINT,
-`col116` DOUBLE,
-`col117` TINYINT,
-`col118` TIMESTAMP,
-`col119` SET ('test1','test2','test3'),
-`col120` SMALLINT,
-`col121` TINYBLOB,
-`col122` TIMESTAMP,
-`col123` BLOB,
-`col124` DATE,
-`col125` SMALLINT,
-`col126` ENUM ('test1','test2','test3'),
-`col127` MEDIUMBLOB,
-`col128` DOUBLE PRECISION,
-`col129` REAL,
-`col130` VARCHAR (159),
-`col131` MEDIUMBLOB,
-`col132` BIGINT,
-`col133` INT,
-`col134` SET ('test1','test2','test3'),
-`col135` CHAR (198),
-`col136` SET ('test1','test2','test3'),
-`col137` MEDIUMTEXT,
-`col138` SMALLINT,
-`col139` BLOB,
-`col140` LONGBLOB,
-KEY `idx0` (`col14`(139),`col24`(208),`col38`,`col35`),
-KEY `idx1` (`col48`,`col118`,`col29`(131),`col100`),
-KEY `idx2` (`col86`,`col67`,`col43`(175)),
-KEY `idx3` (`col19`),
-KEY `idx4` (`col40`(220),`col67`),
-KEY `idx5` (`col99`,`col56`),
-KEY `idx6` (`col68`,`col28`,`col137`(157)),
-KEY `idx7` (`col51`(160),`col99`,`col45`,`col39`(9)),
-KEY `idx8` (`col15`,`col52`,`col90`,`col94`),
-KEY `idx9` (`col24`(3),`col139`(248),`col108`(118),`col41`),
-KEY `idx10` (`col36`,`col92`,`col114`),
-KEY `idx11` (`col115`,`col9`(116)),
-KEY `idx12` (`col130`,`col93`,`col134`),
-KEY `idx13` (`col123`(65)),
-KEY `idx14` (`col44`(90),`col86`,`col119`),
-KEY `idx15` (`col69`),
-KEY `idx16` (`col132`,`col81`(118),`col18`),
-KEY `idx17` (`col24`(250),`col7`,`col92`,`col45`)
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 199 columns and 1 indexes
-DROP TABLE IF EXISTS `table3`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table3`
-(`col0` SMALLINT,
-`col1` SET ('test1','test2','test3'),
-`col2` TINYTEXT,
-`col3` DOUBLE,
-`col4` NUMERIC,
-`col5` DATE,
-`col6` BIGINT,
-`col7` DOUBLE,
-`col8` TEXT,
-`col9` INT,
-`col10` REAL,
-`col11` TINYINT,
-`col12` NUMERIC,
-`col13` NUMERIC,
-`col14` TIME,
-`col15` DOUBLE,
-`col16` REAL,
-`col17` MEDIUMBLOB,
-`col18` YEAR,
-`col19` TINYTEXT,
-`col20` YEAR,
-`col21` CHAR (250),
-`col22` TINYINT,
-`col23` TINYINT,
-`col24` SMALLINT,
-`col25` DATETIME,
-`col26` MEDIUMINT,
-`col27` LONGBLOB,
-`col28` VARCHAR (106),
-`col29` FLOAT,
-`col30` MEDIUMTEXT,
-`col31` TINYBLOB,
-`col32` BIGINT,
-`col33` YEAR,
-`col34` REAL,
-`col35` MEDIUMBLOB,
-`col36` LONGTEXT,
-`col37` LONGBLOB,
-`col38` BIGINT,
-`col39` FLOAT,
-`col40` TIME,
-`col41` DATETIME,
-`col42` BOOL,
-`col43` BIGINT,
-`col44` SMALLINT,
-`col45` TIME,
-`col46` DOUBLE PRECISION,
-`col47` TIME,
-`col48` TINYTEXT,
-`col49` DOUBLE PRECISION,
-`col50` BIGINT,
-`col51` NUMERIC,
-`col52` TINYBLOB,
-`col53` DATE,
-`col54` DECIMAL,
-`col55` SMALLINT,
-`col56` TINYTEXT,
-`col57` ENUM ('test1','test2','test3'),
-`col58` YEAR,
-`col59` TIME,
-`col60` TINYINT,
-`col61` DECIMAL,
-`col62` DOUBLE,
-`col63` DATE,
-`col64` LONGTEXT,
-`col65` DOUBLE,
-`col66` VARCHAR (88),
-`col67` MEDIUMTEXT,
-`col68` DATE,
-`col69` MEDIUMINT,
-`col70` DECIMAL,
-`col71` MEDIUMTEXT,
-`col72` LONGTEXT,
-`col73` REAL,
-`col74` DOUBLE,
-`col75` TIME,
-`col76` DATE,
-`col77` DECIMAL,
-`col78` MEDIUMBLOB,
-`col79` NUMERIC,
-`col80` BIGINT,
-`col81` YEAR,
-`col82` SMALLINT,
-`col83` MEDIUMINT,
-`col84` TINYINT,
-`col85` MEDIUMBLOB,
-`col86` TIME,
-`col87` MEDIUMBLOB,
-`col88` LONGTEXT,
-`col89` BOOL,
-`col90` BLOB,
-`col91` LONGBLOB,
-`col92` YEAR,
-`col93` BLOB,
-`col94` INT,
-`col95` TINYTEXT,
-`col96` TINYINT,
-`col97` DECIMAL,
-`col98` ENUM ('test1','test2','test3'),
-`col99` MEDIUMINT,
-`col100` TINYINT,
-`col101` MEDIUMBLOB,
-`col102` TINYINT,
-`col103` SET ('test1','test2','test3'),
-`col104` TIMESTAMP,
-`col105` TEXT,
-`col106` DATETIME,
-`col107` MEDIUMTEXT,
-`col108` CHAR (220),
-`col109` TIME,
-`col110` VARCHAR (131),
-`col111` DECIMAL,
-`col112` FLOAT,
-`col113` SMALLINT,
-`col114` BIGINT,
-`col115` LONGBLOB,
-`col116` SET ('test1','test2','test3'),
-`col117` ENUM ('test1','test2','test3'),
-`col118` BLOB,
-`col119` MEDIUMTEXT,
-`col120` SET ('test1','test2','test3'),
-`col121` DATETIME,
-`col122` FLOAT,
-`col123` VARCHAR (242),
-`col124` YEAR,
-`col125` MEDIUMBLOB,
-`col126` TIME,
-`col127` BOOL,
-`col128` TINYBLOB,
-`col129` DOUBLE,
-`col130` TINYINT,
-`col131` BIGINT,
-`col132` SMALLINT,
-`col133` INT,
-`col134` DOUBLE PRECISION,
-`col135` MEDIUMBLOB,
-`col136` SET ('test1','test2','test3'),
-`col137` TINYTEXT,
-`col138` DOUBLE PRECISION,
-`col139` NUMERIC,
-`col140` BLOB,
-`col141` SET ('test1','test2','test3'),
-`col142` INT,
-`col143` VARCHAR (26),
-`col144` BLOB,
-`col145` REAL,
-`col146` SET ('test1','test2','test3'),
-`col147` LONGBLOB,
-`col148` TEXT,
-`col149` BLOB,
-`col150` CHAR (189),
-`col151` LONGTEXT,
-`col152` INT,
-`col153` FLOAT,
-`col154` LONGTEXT,
-`col155` DATE,
-`col156` LONGBLOB,
-`col157` TINYBLOB,
-`col158` REAL,
-`col159` DATE,
-`col160` TIME,
-`col161` YEAR,
-`col162` DOUBLE,
-`col163` VARCHAR (90),
-`col164` FLOAT,
-`col165` NUMERIC,
-`col166` ENUM ('test1','test2','test3'),
-`col167` DOUBLE PRECISION,
-`col168` DOUBLE PRECISION,
-`col169` TINYBLOB,
-`col170` TIME,
-`col171` SMALLINT,
-`col172` TINYTEXT,
-`col173` SMALLINT,
-`col174` DOUBLE,
-`col175` VARCHAR (14),
-`col176` VARCHAR (90),
-`col177` REAL,
-`col178` MEDIUMINT,
-`col179` TINYBLOB,
-`col180` FLOAT,
-`col181` TIMESTAMP,
-`col182` REAL,
-`col183` DOUBLE PRECISION,
-`col184` BIGINT,
-`col185` INT,
-`col186` MEDIUMTEXT,
-`col187` TIME,
-`col188` FLOAT,
-`col189` TIME,
-`col190` INT,
-`col191` FLOAT,
-`col192` MEDIUMINT,
-`col193` TINYINT,
-`col194` MEDIUMTEXT,
-`col195` DATE,
-`col196` TIME,
-`col197` YEAR,
-`col198` CHAR (206),
-KEY `idx0` (`col39`,`col23`)
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 133 columns and 16 indexes
-DROP TABLE IF EXISTS `table4`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table4`
-(`col0` VARCHAR (60),
-`col1` NUMERIC,
-`col2` LONGTEXT,
-`col3` MEDIUMTEXT,
-`col4` LONGTEXT,
-`col5` LONGBLOB,
-`col6` LONGBLOB,
-`col7` DATETIME,
-`col8` TINYTEXT,
-`col9` BLOB,
-`col10` BOOL,
-`col11` BIGINT,
-`col12` TEXT,
-`col13` VARCHAR (213),
-`col14` TINYBLOB,
-`col15` BOOL,
-`col16` MEDIUMTEXT,
-`col17` DOUBLE,
-`col18` TEXT,
-`col19` BLOB,
-`col20` SET ('test1','test2','test3'),
-`col21` TINYINT,
-`col22` DATETIME,
-`col23` TINYINT,
-`col24` ENUM ('test1','test2','test3'),
-`col25` REAL,
-`col26` BOOL,
-`col27` FLOAT,
-`col28` LONGBLOB,
-`col29` DATETIME,
-`col30` FLOAT,
-`col31` SET ('test1','test2','test3'),
-`col32` LONGBLOB,
-`col33` NUMERIC,
-`col34` YEAR,
-`col35` VARCHAR (146),
-`col36` BIGINT,
-`col37` DATETIME,
-`col38` DATE,
-`col39` SET ('test1','test2','test3'),
-`col40` CHAR (112),
-`col41` FLOAT,
-`col42` YEAR,
-`col43` TIME,
-`col44` DOUBLE,
-`col45` NUMERIC,
-`col46` FLOAT,
-`col47` DECIMAL,
-`col48` BIGINT,
-`col49` DECIMAL,
-`col50` YEAR,
-`col51` MEDIUMTEXT,
-`col52` LONGBLOB,
-`col53` SET ('test1','test2','test3'),
-`col54` BLOB,
-`col55` FLOAT,
-`col56` REAL,
-`col57` REAL,
-`col58` TEXT,
-`col59` MEDIUMBLOB,
-`col60` INT,
-`col61` INT,
-`col62` DATE,
-`col63` TEXT,
-`col64` DATE,
-`col65` ENUM ('test1','test2','test3'),
-`col66` DOUBLE PRECISION,
-`col67` TINYTEXT,
-`col68` TINYBLOB,
-`col69` FLOAT,
-`col70` BLOB,
-`col71` DATETIME,
-`col72` DOUBLE,
-`col73` LONGTEXT,
-`col74` TIME,
-`col75` DATETIME,
-`col76` VARCHAR (122),
-`col77` MEDIUMTEXT,
-`col78` MEDIUMTEXT,
-`col79` BOOL,
-`col80` LONGTEXT,
-`col81` TINYTEXT,
-`col82` NUMERIC,
-`col83` DOUBLE PRECISION,
-`col84` DATE,
-`col85` YEAR,
-`col86` BLOB,
-`col87` TINYTEXT,
-`col88` DOUBLE PRECISION,
-`col89` MEDIUMINT,
-`col90` MEDIUMTEXT,
-`col91` NUMERIC,
-`col92` DATETIME,
-`col93` NUMERIC,
-`col94` SET ('test1','test2','test3'),
-`col95` TINYTEXT,
-`col96` SET ('test1','test2','test3'),
-`col97` YEAR,
-`col98` MEDIUMINT,
-`col99` TEXT,
-`col100` TEXT,
-`col101` TIME,
-`col102` VARCHAR (225),
-`col103` TINYTEXT,
-`col104` TEXT,
-`col105` MEDIUMTEXT,
-`col106` TINYINT,
-`col107` TEXT,
-`col108` LONGBLOB,
-`col109` LONGTEXT,
-`col110` TINYTEXT,
-`col111` CHAR (56),
-`col112` YEAR,
-`col113` ENUM ('test1','test2','test3'),
-`col114` TINYBLOB,
-`col115` DATETIME,
-`col116` DATE,
-`col117` TIME,
-`col118` MEDIUMTEXT,
-`col119` DOUBLE PRECISION,
-`col120` FLOAT,
-`col121` TIMESTAMP,
-`col122` MEDIUMINT,
-`col123` YEAR,
-`col124` DATE,
-`col125` TEXT,
-`col126` FLOAT,
-`col127` TINYTEXT,
-`col128` BOOL,
-`col129` NUMERIC,
-`col130` TIMESTAMP,
-`col131` INT,
-`col132` MEDIUMBLOB,
-KEY `idx0` (`col130`),
-KEY `idx1` (`col30`,`col55`,`col19`(31)),
-KEY `idx2` (`col104`(186)),
-KEY `idx3` (`col131`),
-KEY `idx4` (`col64`,`col93`,`col2`(11)),
-KEY `idx5` (`col34`,`col121`,`col22`),
-KEY `idx6` (`col33`,`col55`,`col83`),
-KEY `idx7` (`col17`,`col87`(245),`col99`(17)),
-KEY `idx8` (`col65`,`col120`),
-KEY `idx9` (`col82`),
-KEY `idx10` (`col9`(72)),
-KEY `idx11` (`col88`),
-KEY `idx12` (`col128`,`col9`(200),`col71`,`col66`),
-KEY `idx13` (`col77`(126)),
-KEY `idx14` (`col105`(26),`col13`,`col117`),
-KEY `idx15` (`col4`(246),`col130`,`col115`,`col3`(141))
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 176 columns and 13 indexes
-DROP TABLE IF EXISTS `table5`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table5`
-(`col0` MEDIUMTEXT,
-`col1` VARCHAR (90),
-`col2` TINYTEXT,
-`col3` TIME,
-`col4` BOOL,
-`col5` TINYTEXT,
-`col6` BOOL,
-`col7` TIMESTAMP,
-`col8` TINYBLOB,
-`col9` TINYINT,
-`col10` YEAR,
-`col11` SET ('test1','test2','test3'),
-`col12` TEXT,
-`col13` CHAR (248),
-`col14` BIGINT,
-`col15` TEXT,
-`col16` TINYINT,
-`col17` NUMERIC,
-`col18` SET ('test1','test2','test3'),
-`col19` LONGBLOB,
-`col20` FLOAT,
-`col21` INT,
-`col22` TEXT,
-`col23` BOOL,
-`col24` DECIMAL,
-`col25` DOUBLE PRECISION,
-`col26` FLOAT,
-`col27` TINYBLOB,
-`col28` NUMERIC,
-`col29` MEDIUMBLOB,
-`col30` DATE,
-`col31` LONGTEXT,
-`col32` DATE,
-`col33` FLOAT,
-`col34` BIGINT,
-`col35` TINYTEXT,
-`col36` MEDIUMTEXT,
-`col37` TIME,
-`col38` INT,
-`col39` TINYINT,
-`col40` SET ('test1','test2','test3'),
-`col41` CHAR (130),
-`col42` SMALLINT,
-`col43` INT,
-`col44` MEDIUMTEXT,
-`col45` VARCHAR (126),
-`col46` INT,
-`col47` DOUBLE PRECISION,
-`col48` BIGINT,
-`col49` MEDIUMTEXT,
-`col50` TINYBLOB,
-`col51` MEDIUMINT,
-`col52` TEXT,
-`col53` VARCHAR (208),
-`col54` VARCHAR (207),
-`col55` NUMERIC,
-`col56` DATETIME,
-`col57` ENUM ('test1','test2','test3'),
-`col58` NUMERIC,
-`col59` TINYBLOB,
-`col60` VARCHAR (73),
-`col61` MEDIUMTEXT,
-`col62` TINYBLOB,
-`col63` DATETIME,
-`col64` NUMERIC,
-`col65` MEDIUMINT,
-`col66` DATETIME,
-`col67` NUMERIC,
-`col68` TINYINT,
-`col69` VARCHAR (58),
-`col70` DECIMAL,
-`col71` MEDIUMTEXT,
-`col72` DATE,
-`col73` TIME,
-`col74` DOUBLE PRECISION,
-`col75` DECIMAL,
-`col76` MEDIUMBLOB,
-`col77` REAL,
-`col78` YEAR,
-`col79` YEAR,
-`col80` LONGBLOB,
-`col81` BLOB,
-`col82` BIGINT,
-`col83` ENUM ('test1','test2','test3'),
-`col84` NUMERIC,
-`col85` SET ('test1','test2','test3'),
-`col86` MEDIUMTEXT,
-`col87` LONGBLOB,
-`col88` TIME,
-`col89` ENUM ('test1','test2','test3'),
-`col90` DECIMAL,
-`col91` FLOAT,
-`col92` DATETIME,
-`col93` TINYTEXT,
-`col94` TIMESTAMP,
-`col95` TIMESTAMP,
-`col96` TEXT,
-`col97` REAL,
-`col98` VARCHAR (198),
-`col99` TIME,
-`col100` TINYINT,
-`col101` BIGINT,
-`col102` LONGBLOB,
-`col103` LONGBLOB,
-`col104` MEDIUMINT,
-`col105` MEDIUMTEXT,
-`col106` TIMESTAMP,
-`col107` SMALLINT,
-`col108` NUMERIC,
-`col109` DECIMAL,
-`col110` FLOAT,
-`col111` DECIMAL,
-`col112` REAL,
-`col113` TINYTEXT,
-`col114` FLOAT,
-`col115` VARCHAR (7),
-`col116` LONGTEXT,
-`col117` DATE,
-`col118` BIGINT,
-`col119` TEXT,
-`col120` BIGINT,
-`col121` BLOB,
-`col122` CHAR (110),
-`col123` NUMERIC,
-`col124` MEDIUMBLOB,
-`col125` NUMERIC,
-`col126` NUMERIC,
-`col127` BOOL,
-`col128` TIME,
-`col129` TINYBLOB,
-`col130` TINYBLOB,
-`col131` DATE,
-`col132` INT,
-`col133` VARCHAR (123),
-`col134` CHAR (238),
-`col135` VARCHAR (225),
-`col136` LONGTEXT,
-`col137` LONGBLOB,
-`col138` REAL,
-`col139` TINYBLOB,
-`col140` DATETIME,
-`col141` TINYTEXT,
-`col142` LONGBLOB,
-`col143` BIGINT,
-`col144` VARCHAR (236),
-`col145` TEXT,
-`col146` YEAR,
-`col147` DECIMAL,
-`col148` TEXT,
-`col149` MEDIUMBLOB,
-`col150` TINYINT,
-`col151` BOOL,
-`col152` VARCHAR (72),
-`col153` INT,
-`col154` VARCHAR (165),
-`col155` TINYINT,
-`col156` MEDIUMTEXT,
-`col157` DOUBLE PRECISION,
-`col158` TIME,
-`col159` MEDIUMBLOB,
-`col160` LONGBLOB,
-`col161` DATETIME,
-`col162` DOUBLE PRECISION,
-`col163` BLOB,
-`col164` ENUM ('test1','test2','test3'),
-`col165` TIMESTAMP,
-`col166` DATE,
-`col167` TINYBLOB,
-`col168` TINYBLOB,
-`col169` LONGBLOB,
-`col170` DATETIME,
-`col171` BIGINT,
-`col172` VARCHAR (30),
-`col173` LONGTEXT,
-`col174` TIME,
-`col175` FLOAT,
-KEY `idx0` (`col16`,`col156`(139),`col97`,`col120`),
-KEY `idx1` (`col24`,`col0`(108)),
-KEY `idx2` (`col117`,`col173`(34),`col132`,`col82`),
-KEY `idx3` (`col2`(86)),
-KEY `idx4` (`col2`(43)),
-KEY `idx5` (`col83`,`col35`(87),`col111`),
-KEY `idx6` (`col6`,`col134`,`col92`),
-KEY `idx7` (`col56`),
-KEY `idx8` (`col30`,`col53`,`col129`(66)),
-KEY `idx9` (`col53`,`col113`(211),`col32`,`col15`(75)),
-KEY `idx10` (`col34`),
-KEY `idx11` (`col126`),
-KEY `idx12` (`col24`)
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 179 columns and 46 indexes
-DROP TABLE IF EXISTS `table6`;
--- error ER_TOO_BIG_ROWSIZE
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table6`
-(`col0` ENUM ('test1','test2','test3'),
-`col1` MEDIUMBLOB,
-`col2` MEDIUMBLOB,
-`col3` DATETIME,
-`col4` DATE,
-`col5` YEAR,
-`col6` REAL,
-`col7` NUMERIC,
-`col8` MEDIUMBLOB,
-`col9` TEXT,
-`col10` TIMESTAMP,
-`col11` DOUBLE,
-`col12` DOUBLE,
-`col13` SMALLINT,
-`col14` TIMESTAMP,
-`col15` DECIMAL,
-`col16` DATE,
-`col17` TEXT,
-`col18` LONGBLOB,
-`col19` BIGINT,
-`col20` FLOAT,
-`col21` DATETIME,
-`col22` TINYINT,
-`col23` MEDIUMBLOB,
-`col24` SET ('test1','test2','test3'),
-`col25` TIME,
-`col26` TEXT,
-`col27` LONGTEXT,
-`col28` BIGINT,
-`col29` REAL,
-`col30` YEAR,
-`col31` MEDIUMBLOB,
-`col32` MEDIUMINT,
-`col33` FLOAT,
-`col34` TEXT,
-`col35` DATE,
-`col36` TIMESTAMP,
-`col37` REAL,
-`col38` BLOB,
-`col39` BLOB,
-`col40` BLOB,
-`col41` TINYBLOB,
-`col42` INT,
-`col43` TINYINT,
-`col44` REAL,
-`col45` BIGINT,
-`col46` TIMESTAMP,
-`col47` BLOB,
-`col48` ENUM ('test1','test2','test3'),
-`col49` BOOL,
-`col50` CHAR (109),
-`col51` DOUBLE,
-`col52` DOUBLE PRECISION,
-`col53` ENUM ('test1','test2','test3'),
-`col54` FLOAT,
-`col55` DOUBLE PRECISION,
-`col56` CHAR (166),
-`col57` TEXT,
-`col58` TIME,
-`col59` DECIMAL,
-`col60` TEXT,
-`col61` ENUM ('test1','test2','test3'),
-`col62` LONGTEXT,
-`col63` YEAR,
-`col64` DOUBLE,
-`col65` CHAR (87),
-`col66` DATE,
-`col67` BOOL,
-`col68` MEDIUMBLOB,
-`col69` DATETIME,
-`col70` DECIMAL,
-`col71` TIME,
-`col72` REAL,
-`col73` LONGTEXT,
-`col74` BLOB,
-`col75` REAL,
-`col76` INT,
-`col77` INT,
-`col78` FLOAT,
-`col79` DOUBLE,
-`col80` MEDIUMINT,
-`col81` ENUM ('test1','test2','test3'),
-`col82` VARCHAR (221),
-`col83` BIGINT,
-`col84` TINYINT,
-`col85` BIGINT,
-`col86` FLOAT,
-`col87` MEDIUMBLOB,
-`col88` CHAR (126),
-`col89` MEDIUMBLOB,
-`col90` DATETIME,
-`col91` TINYINT,
-`col92` DOUBLE,
-`col93` NUMERIC,
-`col94` DATE,
-`col95` BLOB,
-`col96` DATETIME,
-`col97` TIME,
-`col98` LONGBLOB,
-`col99` INT,
-`col100` SET ('test1','test2','test3'),
-`col101` TINYBLOB,
-`col102` INT,
-`col103` MEDIUMBLOB,
-`col104` MEDIUMTEXT,
-`col105` FLOAT,
-`col106` TINYBLOB,
-`col107` VARCHAR (26),
-`col108` TINYINT,
-`col109` TIME,
-`col110` TINYBLOB,
-`col111` LONGBLOB,
-`col112` TINYTEXT,
-`col113` FLOAT,
-`col114` TINYINT,
-`col115` NUMERIC,
-`col116` TIME,
-`col117` SET ('test1','test2','test3'),
-`col118` DATE,
-`col119` SMALLINT,
-`col120` BLOB,
-`col121` TINYTEXT,
-`col122` REAL,
-`col123` YEAR,
-`col124` REAL,
-`col125` BOOL,
-`col126` BLOB,
-`col127` REAL,
-`col128` MEDIUMBLOB,
-`col129` TIMESTAMP,
-`col130` LONGBLOB,
-`col131` MEDIUMBLOB,
-`col132` YEAR,
-`col133` YEAR,
-`col134` INT,
-`col135` MEDIUMINT,
-`col136` MEDIUMINT,
-`col137` TINYTEXT,
-`col138` TINYBLOB,
-`col139` BLOB,
-`col140` SET ('test1','test2','test3'),
-`col141` ENUM ('test1','test2','test3'),
-`col142` ENUM ('test1','test2','test3'),
-`col143` TINYTEXT,
-`col144` DATETIME,
-`col145` TEXT,
-`col146` DOUBLE PRECISION,
-`col147` DECIMAL,
-`col148` MEDIUMTEXT,
-`col149` TINYTEXT,
-`col150` SET ('test1','test2','test3'),
-`col151` MEDIUMTEXT,
-`col152` CHAR (126),
-`col153` DOUBLE,
-`col154` CHAR (243),
-`col155` SET ('test1','test2','test3'),
-`col156` SET ('test1','test2','test3'),
-`col157` DATETIME,
-`col158` DOUBLE,
-`col159` NUMERIC,
-`col160` DECIMAL,
-`col161` FLOAT,
-`col162` LONGBLOB,
-`col163` LONGTEXT,
-`col164` INT,
-`col165` TIME,
-`col166` CHAR (27),
-`col167` VARCHAR (63),
-`col168` TEXT,
-`col169` TINYBLOB,
-`col170` TINYBLOB,
-`col171` ENUM ('test1','test2','test3'),
-`col172` INT,
-`col173` TIME,
-`col174` DECIMAL,
-`col175` DOUBLE,
-`col176` MEDIUMBLOB,
-`col177` LONGBLOB,
-`col178` CHAR (43),
-KEY `idx0` (`col131`(219)),
-KEY `idx1` (`col67`,`col122`,`col59`,`col87`(33)),
-KEY `idx2` (`col83`,`col42`,`col57`(152)),
-KEY `idx3` (`col106`(124)),
-KEY `idx4` (`col173`,`col80`,`col165`,`col89`(78)),
-KEY `idx5` (`col174`,`col145`(108),`col23`(228),`col141`),
-KEY `idx6` (`col157`,`col140`),
-KEY `idx7` (`col130`(188),`col15`),
-KEY `idx8` (`col52`),
-KEY `idx9` (`col144`),
-KEY `idx10` (`col155`),
-KEY `idx11` (`col62`(230),`col1`(109)),
-KEY `idx12` (`col151`(24),`col95`(85)),
-KEY `idx13` (`col114`),
-KEY `idx14` (`col42`,`col98`(56),`col146`),
-KEY `idx15` (`col147`,`col39`(254),`col35`),
-KEY `idx16` (`col79`),
-KEY `idx17` (`col65`),
-KEY `idx18` (`col149`(165),`col168`(119),`col32`,`col117`),
-KEY `idx19` (`col64`),
-KEY `idx20` (`col93`),
-KEY `idx21` (`col64`,`col113`,`col104`(182)),
-KEY `idx22` (`col52`,`col111`(189)),
-KEY `idx23` (`col45`),
-KEY `idx24` (`col154`,`col107`,`col110`(159)),
-KEY `idx25` (`col149`(1),`col87`(131)),
-KEY `idx26` (`col58`,`col115`,`col63`),
-KEY `idx27` (`col95`(9),`col0`,`col87`(113)),
-KEY `idx28` (`col92`,`col130`(1)),
-KEY `idx29` (`col151`(129),`col137`(254),`col13`),
-KEY `idx30` (`col49`),
-KEY `idx31` (`col28`),
-KEY `idx32` (`col83`,`col146`),
-KEY `idx33` (`col155`,`col90`,`col17`(245)),
-KEY `idx34` (`col174`,`col169`(44),`col107`),
-KEY `idx35` (`col113`),
-KEY `idx36` (`col52`),
-KEY `idx37` (`col16`,`col120`(190)),
-KEY `idx38` (`col28`),
-KEY `idx39` (`col131`(165)),
-KEY `idx40` (`col135`,`col26`(86)),
-KEY `idx41` (`col69`,`col94`),
-KEY `idx42` (`col105`,`col151`(38),`col97`),
-KEY `idx43` (`col88`),
-KEY `idx44` (`col176`(100),`col42`,`col73`(189),`col94`),
-KEY `idx45` (`col2`(27),`col27`(116))
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-DROP TABLE IF EXISTS table0;
-DROP TABLE IF EXISTS table1;
-DROP TABLE IF EXISTS table2;
-DROP TABLE IF EXISTS table3;
-DROP TABLE IF EXISTS table4;
-DROP TABLE IF EXISTS table5;
-DROP TABLE IF EXISTS table6;
-
-EVAL SET GLOBAL innodb_file_format=$file_format;
-EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
diff --git a/mysql-test/t/innodb_bug40360.test b/mysql-test/t/innodb_bug40360.test
deleted file mode 100644
index e88837aab4f..00000000000
--- a/mysql-test/t/innodb_bug40360.test
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Make sure http://bugs.mysql.com/40360 remains fixed.
-#
-
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
-SET TX_ISOLATION='READ-COMMITTED';
-
-# This is the default since MySQL 5.1.29 SET BINLOG_FORMAT='STATEMENT';
-
-CREATE TABLE bug40360 (a INT) engine=innodb;
-
-INSERT INTO bug40360 VALUES (1);
-
-DROP TABLE bug40360;
diff --git a/mysql-test/t/innodb_bug41904.test b/mysql-test/t/innodb_bug41904.test
deleted file mode 100644
index 365c5229adc..00000000000
--- a/mysql-test/t/innodb_bug41904.test
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Make sure http://bugs.mysql.com/41904 remains fixed.
-#
-
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
-CREATE TABLE bug41904 (id INT PRIMARY KEY, uniquecol CHAR(15)) ENGINE=InnoDB;
-
-INSERT INTO bug41904 VALUES (1,NULL), (2,NULL);
-
-CREATE UNIQUE INDEX ui ON bug41904 (uniquecol);
-
-DROP TABLE bug41904;
diff --git a/mysql-test/t/innodb_bug44571.test b/mysql-test/t/innodb_bug44571.test
deleted file mode 100644
index f5d79e3070a..00000000000
--- a/mysql-test/t/innodb_bug44571.test
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Bug#44571 InnoDB Plugin crashes on ADD INDEX
-# http://bugs.mysql.com/44571
-#
--- source include/have_innodb.inc
-
-CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
-ALTER TABLE bug44571 CHANGE foo bar INT;
--- error ER_KEY_COLUMN_DOES_NOT_EXITS
-ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
-ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
-CREATE INDEX bug44571c ON bug44571 (bar);
-DROP TABLE bug44571;
diff --git a/mysql-test/t/innodb_bug46676.test b/mysql-test/t/innodb_bug46676.test
deleted file mode 100644
index 440666c4226..00000000000
--- a/mysql-test/t/innodb_bug46676.test
+++ /dev/null
@@ -1,16 +0,0 @@
-# This is the test for bug 46676: mysqld got exception 0xc0000005
-# It is reproducible with InnoDB plugin 1.0.4 + MySQL 5.1.37.
-# But no longer reproducible after MySQL 5.1.38 (with plugin 1.0.5).
-
---source include/have_innodb.inc
-
-SET foreign_key_checks=0;
-CREATE TABLE t1 (id int, foreign key (id) references t2(id)) ENGINE=INNODB;
-CREATE TABLE t2 (id int, foreign key (id) references t1(id)) ENGINE=INNODB;
-SET foreign_key_checks=1;
-
-# Server crashes
-SELECT COUNT(*) FROM information_schema.key_column_usage WHERE REFERENCED_TABLE_NAME in ('t1', 't2');
-
-SET foreign_key_checks=0;
-DROP TABLE t1, t2;
diff --git a/mysql-test/t/innodb_information_schema.test b/mysql-test/t/innodb_information_schema.test
deleted file mode 100644
index fc1d38d8d14..00000000000
--- a/mysql-test/t/innodb_information_schema.test
+++ /dev/null
@@ -1,149 +0,0 @@
-#
-# Test that user data is correctly "visualized" in
-# INFORMATION_SCHEMA.innodb_locks.lock_data
-#
-
--- source include/have_innodb.inc
-
--- disable_query_log
--- disable_result_log
-
-SET storage_engine=InnoDB;
-
--- disable_warnings
-DROP TABLE IF EXISTS t_min, t_max;
--- enable_warnings
-
-let $table_def =
-(
- c01 TINYINT,
- c02 TINYINT UNSIGNED,
- c03 SMALLINT,
- c04 SMALLINT UNSIGNED,
- c05 MEDIUMINT,
- c06 MEDIUMINT UNSIGNED,
- c07 INT,
- c08 INT UNSIGNED,
- c09 BIGINT,
- c10 BIGINT UNSIGNED,
- PRIMARY KEY(c01, c02, c03, c04, c05, c06, c07, c08, c09, c10)
-);
-
--- eval CREATE TABLE t_min $table_def;
-INSERT INTO t_min VALUES
-(-128, 0,
- -32768, 0,
- -8388608, 0,
- -2147483648, 0,
- -9223372036854775808, 0);
-
--- eval CREATE TABLE t_max $table_def;
-INSERT INTO t_max VALUES
-(127, 255,
- 32767, 65535,
- 8388607, 16777215,
- 2147483647, 4294967295,
- 9223372036854775807, 18446744073709551615);
-
-CREATE TABLE ```t'\"_str` (
- c1 VARCHAR(32),
- c2 VARCHAR(32),
- c3 VARCHAR(32),
- c4 VARCHAR(32),
- c5 VARCHAR(32),
- c6 VARCHAR(32),
- c7 VARCHAR(32),
- PRIMARY KEY(c1, c2, c3, c4, c5, c6, c7)
-);
-INSERT INTO ```t'\"_str` VALUES
-('1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc''''');
-INSERT INTO ```t'\"_str` VALUES
-('2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""');
-INSERT INTO ```t'\"_str` VALUES
-('3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\');
-INSERT INTO ```t'\"_str` VALUES
-('4', 'abc', 0x00616263, 0x61626300, 0x61006263, 0x6100626300, 0x610062630000);
-
--- connect (con_lock,localhost,root,,)
--- connect (con_min_trylock,localhost,root,,)
--- connect (con_max_trylock,localhost,root,,)
--- connect (con_str_insert_supremum,localhost,root,,)
--- connect (con_str_lock_row1,localhost,root,,)
--- connect (con_str_lock_row2,localhost,root,,)
--- connect (con_str_lock_row3,localhost,root,,)
--- connect (con_str_lock_row4,localhost,root,,)
--- connect (con_verify_innodb_locks,localhost,root,,)
-
--- connection con_lock
-SET autocommit=0;
-SELECT * FROM t_min FOR UPDATE;
-SELECT * FROM t_max FOR UPDATE;
-SELECT * FROM ```t'\"_str` FOR UPDATE;
-
--- connection con_min_trylock
--- send
-SELECT * FROM t_min FOR UPDATE;
-
--- connection con_max_trylock
--- send
-SELECT * FROM t_max FOR UPDATE;
-
--- connection con_str_insert_supremum
--- send
-INSERT INTO ```t'\"_str` VALUES
-('z', 'z', 'z', 'z', 'z', 'z', 'z');
-
--- connection con_str_lock_row1
--- send
-SELECT * FROM ```t'\"_str` WHERE c1 = '1' FOR UPDATE;
-
--- connection con_str_lock_row2
--- send
-SELECT * FROM ```t'\"_str` WHERE c1 = '2' FOR UPDATE;
-
--- connection con_str_lock_row3
--- send
-SELECT * FROM ```t'\"_str` WHERE c1 = '3' FOR UPDATE;
-
--- connection con_str_lock_row4
--- send
-SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE;
-
--- enable_result_log
--- connection con_verify_innodb_locks
-# Wait for the above queries to execute before continuing.
-# Without this, it sometimes happens that the SELECT from innodb_locks
-# executes before some of them, resulting in less than expected number
-# of rows being selected from innodb_locks. If there is a bug and there
-# are no 14 rows in innodb_locks then this test will fail with timeout.
-let $count = 14;
-let $table = INFORMATION_SCHEMA.INNODB_LOCKS;
--- source include/wait_until_rows_count.inc
-# the above enables the query log, re-disable it
--- disable_query_log
-SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data
-FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data;
-
-SELECT lock_table,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
-GROUP BY lock_table;
-
-set @save_sql_mode = @@sql_mode;
-SET SQL_MODE='ANSI_QUOTES';
-SELECT lock_table,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
-GROUP BY lock_table;
-SET @@sql_mode=@save_sql_mode;
--- disable_result_log
-
--- connection default
-
--- disconnect con_lock
--- disconnect con_min_trylock
--- disconnect con_max_trylock
--- disconnect con_str_insert_supremum
--- disconnect con_str_lock_row1
--- disconnect con_str_lock_row2
--- disconnect con_str_lock_row3
--- disconnect con_str_lock_row4
--- disconnect con_verify_innodb_locks
-
-DROP TABLE t_min, t_max, ```t'\"_str`;
diff --git a/mysql-test/t/innodb_trx_weight.test b/mysql-test/t/innodb_trx_weight.test
deleted file mode 100644
index b72eaad345f..00000000000
--- a/mysql-test/t/innodb_trx_weight.test
+++ /dev/null
@@ -1,108 +0,0 @@
-#
-# Ensure that the number of locks (SELECT FOR UPDATE for example) is
-# added to the number of altered rows when choosing the smallest
-# transaction to kill as a victim when a deadlock is detected.
-# Also transactions what had edited non-transactional tables should
-# be heavier than ones that had not.
-#
-
--- source include/have_innodb.inc
-
-SET storage_engine=InnoDB;
-
-# we do not really care about what gets printed, we are only
-# interested in getting the deadlock resolved according to our
-# expectations
--- disable_query_log
--- disable_result_log
-
-# we want to use "-- eval statement1; statement2" which does not work with
-# prepared statements. Because this test should not behave differently with
-# or without prepared statements we disable them so the test does not fail
-# if someone runs ./mysql-test-run.pl --ps-protocol
--- disable_ps_protocol
-
--- disable_warnings
-DROP TABLE IF EXISTS t1, t2, t3, t4, t5_nontrans;
--- enable_warnings
-
-# we will create a simple deadlock with t1, t2 and two connections
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-
-# auxiliary table with a bulk of rows which will be locked by a
-# transaction to increase its weight
-CREATE TABLE t3 (a INT);
-
-# auxiliary empty table which will be inserted by a
-# transaction to increase its weight
-CREATE TABLE t4 (a INT);
-
-# auxiliary non-transactional table which will be edited by a
-# transaction to tremendously increase its weight
-CREATE TABLE t5_nontrans (a INT) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1);
-# insert a lot of rows in t3
-INSERT INTO t3 VALUES (1);
-INSERT INTO t3 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t3;
-
-# test locking weight
-
--- let $con1_extra_sql =
--- let $con1_extra_sql_present = 0
--- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
--- let $con2_extra_sql_present = 1
--- let $con1_should_be_rolledback = 1
--- source include/innodb_trx_weight.inc
-
--- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1)
--- let $con1_extra_sql_present = 1
--- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
--- let $con2_extra_sql_present = 1
--- let $con1_should_be_rolledback = 1
--- source include/innodb_trx_weight.inc
-
--- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1), (1), (1), (1)
--- let $con1_extra_sql_present = 1
--- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
--- let $con2_extra_sql_present = 1
--- let $con1_should_be_rolledback = 0
--- source include/innodb_trx_weight.inc
-
-# test weight when non-transactional tables are edited
-
--- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
--- let $con1_extra_sql_present = 1
--- let $con2_extra_sql =
--- let $con2_extra_sql_present = 0
--- let $con1_should_be_rolledback = 0
--- source include/innodb_trx_weight.inc
-
--- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
--- let $con1_extra_sql_present = 1
--- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1)
--- let $con2_extra_sql_present = 1
--- let $con1_should_be_rolledback = 1
--- source include/innodb_trx_weight.inc
-
--- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
--- let $con1_extra_sql = $con1_extra_sql; INSERT INTO t5_nontrans VALUES (1)
--- let $con1_extra_sql_present = 1
--- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1)
--- let $con2_extra_sql_present = 1
--- let $con1_should_be_rolledback = 0
--- source include/innodb_trx_weight.inc
-
-DROP TABLE t1, t2, t3, t4, t5_nontrans;
diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test
index d0794db68bb..0b5cb947588 100644
--- a/mysql-test/t/subselect_sj2.test
+++ b/mysql-test/t/subselect_sj2.test
@@ -61,6 +61,13 @@ insert into t3 select
A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a
from t0 A, t0 B where B.a <5;
+#
+# InnoDB does not use join buffer here, XtraDB does
+# (despite the comment above which says "no join buffering",
+# because it does not hold when this file is included
+# into subselect_sj2_jcl6.test)
+#
+--replace_regex /Using join buffer//
explain select * from t3 where b in (select a from t0);
select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
diff --git a/sql/slave.cc b/sql/slave.cc
index 1d99d2b606b..1d0781aa7b2 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1006,6 +1006,8 @@ const char *print_slave_db_safe(const char* db)
DBUG_RETURN((db ? db : ""));
}
+#endif /* HAVE_REPLICATION */
+
int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
const char *default_val)
{
@@ -1037,6 +1039,10 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
}
+/*
+ when moving these functions to mysys, don't forget to
+ remove slave.cc from libmysqld/CMakeLists.txt
+*/
int init_intvar_from_file(int* var, IO_CACHE* f, int default_val)
{
char buf[32];
@@ -1165,6 +1171,8 @@ err:
DBUG_RETURN(ret);
}
+#ifdef HAVE_REPLICATION
+
/*
Check if the error is caused by network.
@param[in] errorno Number of the error.
diff --git a/storage/xtradb/CMakeLists.txt.disabled b/storage/xtradb/CMakeLists.txt
index 789dbd5327e..68b0e0cacc4 100644
--- a/storage/xtradb/CMakeLists.txt.disabled
+++ b/storage/xtradb/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2011, Oracle and/or its affiliates. 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
@@ -40,12 +40,9 @@ IF(UNIX)
ENDIF()
ENDIF()
-# Enable InnoDB's UNIV_DEBUG if MySQL's WITH_DEBUG[_FULL] is defined
-# enable when this bug is resolved:
-# Bug#54861 Additional connections not handled properly in mtr --embedded
-#IF(WITH_DEBUG)
-# ADD_DEFINITIONS("-DUNIV_DEBUG")
-#ENDIF()
+# Enable InnoDB's UNIV_DEBUG for debug builds
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DUNIV_DEBUG")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG")
IF(NOT MSVC)
# either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
@@ -127,9 +124,13 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
CHECK_FUNCTION_EXISTS(atomic_cas_ulong HAVE_ATOMIC_CAS_ULONG)
CHECK_FUNCTION_EXISTS(atomic_cas_32 HAVE_ATOMIC_CAS_32)
CHECK_FUNCTION_EXISTS(atomic_cas_64 HAVE_ATOMIC_CAS_64)
- CHECK_FUNCTION_EXISTS(atomic_add_long HAVE_ATOMIC_ADD_LONG)
- IF(HAVE_ATOMIC_CAS_ULONG AND HAVE_ATOMIC_CAS_32 AND
- HAVE_ATOMIC_CAS_64 AND HAVE_ATOMIC_ADD_LONG)
+ CHECK_FUNCTION_EXISTS(atomic_add_long_nv HAVE_ATOMIC_ADD_LONG_NV)
+ CHECK_FUNCTION_EXISTS(atomic_swap_uchar HAVE_ATOMIC_SWAP_UCHAR)
+ IF(HAVE_ATOMIC_CAS_ULONG AND
+ HAVE_ATOMIC_CAS_32 AND
+ HAVE_ATOMIC_CAS_64 AND
+ HAVE_ATOMIC_ADD_LONG_NV AND
+ HAVE_ATOMIC_SWAP_UCHAR)
SET(HAVE_IB_SOLARIS_ATOMICS 1)
ENDIF()
@@ -188,13 +189,13 @@ IF(SIZEOF_PTHREAD_T)
ENDIF()
IF(MSVC)
- ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DHAVE_IB_PAUSE_INSTRUCTION)
+ ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS)
ENDIF()
-# Include directories under innobase
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include
- ${CMAKE_SOURCE_DIR}/storage/innobase/handler)
+# Include directories under xtradb
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/xtradb/include
+ ${CMAKE_SOURCE_DIR}/storage/xtradb/handler)
# Sun Studio bug with -xO2
IF(CMAKE_C_COMPILER_ID MATCHES "SunPro"
@@ -213,9 +214,7 @@ IF (MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
PROPERTIES COMPILE_FLAGS -Od)
ENDIF()
-ADD_DEFINITIONS(-D_WIN32 -D_LIB -DMYSQL_SERVER)
-
-SET(XTRADB_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
+SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
buf/buf0buddy.c buf/buf0buf.c buf/buf0flu.c buf/buf0lru.c buf/buf0rea.c
data/data0data.c data/data0type.c
dict/dict0boot.c dict/dict0crea.c dict/dict0dict.c dict/dict0load.c dict/dict0mem.c
@@ -235,22 +234,23 @@ SET(XTRADB_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
os/os0file.c os/os0proc.c os/os0sync.c os/os0thread.c
page/page0cur.c page/page0page.c page/page0zip.c
que/que0que.c
- handler/ha_innodb.cc handler/handler0alter.cc handler/i_s.cc handler/mysql_addons.cc
+ handler/ha_innodb.cc handler/handler0alter.cc handler/i_s.cc
read/read0read.c
rem/rem0cmp.c rem/rem0rec.c
row/row0ext.c row/row0ins.c row/row0merge.c row/row0mysql.c row/row0purge.c row/row0row.c
row/row0sel.c row/row0uins.c row/row0umod.c row/row0undo.c row/row0upd.c row/row0vers.c
- srv/srv0que.c srv/srv0srv.c srv/srv0start.c
+ srv/srv0srv.c srv/srv0start.c
sync/sync0arr.c sync/sync0rw.c sync/sync0sync.c
- thr/thr0loc.c
trx/trx0i_s.c trx/trx0purge.c trx/trx0rec.c trx/trx0roll.c trx/trx0rseg.c
trx/trx0sys.c trx/trx0trx.c trx/trx0undo.c
usr/usr0sess.c
- ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rbt.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c
- ut/ut0list.c ut/ut0wqueue.c)
-
-# New plugin support, cross-platform , base name for shared module is "ha_innodb"
-MYSQL_ADD_PLUGIN(innobase ${XTRADB_SOURCES} STORAGE_ENGINE
- DEFAULT
- MODULE_OUTPUT_NAME ha_xtradb
- LINK_LIBRARIES ${ZLIB_LIBRARY})
+ ut/ut0byte.c ut/ut0dbg.c ut/ut0list.c ut/ut0mem.c ut/ut0rbt.c ut/ut0rnd.c
+ ut/ut0ut.c ut/ut0vec.c ut/ut0wqueue.c ut/ut0bh.c)
+
+IF(WITH_INNODB)
+ # Legacy option
+ SET(WITH_INNOBASE_STORAGE_ENGINE TRUE)
+ENDIF()
+
+MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
+ LINK_LIBRARIES ${ZLIB_LIBRARY})
diff --git a/storage/xtradb/COPYING.Sun_Microsystems b/storage/xtradb/COPYING.Sun_Microsystems
deleted file mode 100644
index 5a77ef3ab73..00000000000
--- a/storage/xtradb/COPYING.Sun_Microsystems
+++ /dev/null
@@ -1,31 +0,0 @@
-Portions of this software contain modifications contributed by
-Sun Microsystems, Inc. These contributions are used with the following
-license:
-
-Copyright (c) 2009, Sun Microsystems, Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
- * Neither the name of Sun Microsystems, Inc. nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/storage/xtradb/ChangeLog b/storage/xtradb/ChangeLog
deleted file mode 100644
index 43f87a1baf5..00000000000
--- a/storage/xtradb/ChangeLog
+++ /dev/null
@@ -1,1916 +0,0 @@
-2010-08-24 The InnoDB Team
-
- * handler/ha_innodb.c, dict/dict0dict.c:
- Fix Bug #55832 selects crash too easily when innodb_force_recovery>3
-
-2010-08-03 The InnoDB Team
-
- * include/dict0dict.h, include/dict0dict.ic, row/row0mysql.c:
- Fix bug #54678, InnoDB, TRUNCATE, ALTER, I_S SELECT, crash or deadlock
-
-2010-08-03 The InnoDB Team
-
- * dict/dict0load.c, handler/ha_innodb.cc, include/db0err.h,
- include/dict0load.h, include/dict0mem.h, include/que0que.h,
- row/row0merge.c, row/row0mysql.c:
- Fix Bug#54582 stack overflow when opening many tables linked
- with foreign keys at once
-
-2010-08-03 The InnoDB Team
-
- * include/ut0mem.h, ut/ut0mem.c:
- Fix Bug #55627 segv in ut_free pars_lexer_close innobase_shutdown
- innodb-use-sys-malloc=0
-
-2010-08-01 The InnoDB Team
-
- * handler/ha_innodb.cc
- Fix Bug #55382 Assignment with SELECT expressions takes unexpected
- S locks in READ COMMITTED
->>>>>>> MERGE-SOURCE
-
-2010-07-27 The InnoDB Team
-
- * include/mem0pool.h, mem/mem0mem.c, mem/mem0pool.c, srv/srv0start.c:
- Fix Bug#55581 shutdown with innodb-use-sys-malloc=0: assert
- mutex->magic_n == MUTEX_MAGIC_N.
-
-2010-06-30 The InnoDB Team
-
- * btr/btr0sea.c, ha/ha0ha.c, handler/ha_innodb.cc, include/btr0sea.h:
- Fix Bug#54311 Crash on CHECK PARTITION after concurrent LOAD DATA
- and adaptive_hash_index=OFF
-
-2010-06-29 The InnoDB Team
- * row/row0row.c, row/row0undo.c, row/row0upd.c:
- Fix Bug#54408 txn rollback after recovery: row0umod.c:673
- dict_table_get_format(index->table)
-
-2010-06-29 The InnoDB Team
-
- * btr/btr0cur.c, include/btr0cur.h,
- include/row0mysql.h, row/row0merge.c, row/row0sel.c:
- Fix Bug#54358 READ UNCOMMITTED access failure of off-page DYNAMIC
- or COMPRESSED columns
-
-2010-06-24 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#54679 alter table causes compressed row_format to revert
- to compact
-
-2010-06-22 The InnoDB Team
-
- * dict/dict0dict.c, dict/dict0mem.c, include/dict0mem.h,
- include/univ.i, page/page0zip.c, row/row0merge.c:
- Fix Bug#47991 InnoDB Dictionary Cache memory usage increases
- indefinitely when renaming tables
-
-2010-06-22 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#54686: "field->col->mtype == type" assertion error at
- row/row0sel.c
-
-2010-06-22 The InnoDB Team
-
- * handler/ha_innodb.cc, innodb_bug54044.result, innodb_bug54044.test:
- Fix Bug#54044 Create temporary tables and using innodb crashes.
-
-2010-06-21 The InnoDB Team
-
- * dict/dict0load.c, fil/fil0fil.c:
- Fix Bug#54658: InnoDB: Warning: allocated tablespace %lu,
- old maximum was 0 (introduced in Bug #53578 fix)
-
-2010-06-16 The InnoDB Team
-
- * row/row0merge.c:
- Fix Bug#54330 Broken fast index creation
-
-2010-06-10 The InnoDB Team
-
- * include/log0log.ic, row/row0ins.c, row/row0purge.c,
- row/row0uins.c, row/row0umod.c, row/row0upd.c:
- Fix Bug#39168 ERROR: the age of the last checkpoint ... exceeds
- the log group capacity
-
-2010-06-08 The InnoDB Team
-
- * dict/dict0load.c:
- Fix Bug#54009 Server crashes when data is selected from non backed
- up table for InnoDB plugin
-
-2010-06-02 The InnoDB Team
-
- * include/db0err.h, include/lock0lock.h, include/row0mysql.h,
- lock/lock0lock.c, row/row0ins.c, row/row0mysql.c, row/row0sel.c:
- Fix Bug#53674 InnoDB: Error: unlock row could not find a
- 4 mode lock on the record
-
-2010-06-01 The InnoDB Team
-
- * include/sync0rw.h, sync/sync0rw.c:
- Fix Bug#48197 Concurrent rw_lock_free may cause assertion failure
-
-2010-06-01 The InnoDB Team
-
- * row/row0umod.c:
- Fix Bug#53812 assert row/row0umod.c line 660 in txn rollback
- after crash recovery
-
-2010-05-25 The InnoDB Team
-
- * handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c:
- Fix Bug#53592: crash replacing duplicates into table after fast
- alter table added unique key
-
-2010-05-24 The InnoDB Team
-
- * dict/dict0boot.c, dict/dict0crea.c, fil/fil0fil.c,
- include/dict0boot.h, include/fil0fil.h, row/row0mysql.c:
- Fix Bug#53578: assert on invalid page access, in fil_io()
-
-2010-05-14 The InnoDB Team
- * mysql-test/innodb_bug48024.test, mysql-test/innodb_bug48024.result,
- dict/dict0dict.c, handler/ha_innodb.cc, handler/ha_innodb.h,
- include/dict0dict.h, include/ha_prototypes.h, include/row0mysql.h,
- include/trx0trx.h, row/row0mysql.c, trx/trx0i_s.c, trx/trx0trx.c:
- Fix Bug#48024 Innodb doesn't work with multi-statements
- Fix Bug#53644 InnoDB thinks that /*/ starts and ends a comment
-
-2010-05-12 The InnoDB Team
-
- * handler/handler0alter.cc:
- Fix Bug#53591 crash with fast alter table and text/blob prefix
- primary key
-
-2010-05-12 The InnoDB Team
-
- * row/row0merge.c:
- Fix Bug#53471 row_merge_drop_temp_indexes() refers freed memory, SEGVs
-
-2010-05-11 The InnoDB Team
-
- * mysql-test/innodb_bug53290.test, mysql-test/innodb_bug53290.result,
- include/rem0cmp.h, rem/rem0cmp.c, row/row0merge.c:
- Fix Bug#53290 wrong duplicate key error when adding a unique index
- via fast alter table
-
-2010-05-11 The InnoDB Team
- * buf/buf0lru.c, include/buf0buf.ic:
- Fix Bug#53307 valgrind: warnings in main.partition_innodb_plugin
-
-2010-05-05 The InnoDB Team
-
- * row/row0merge.c:
- Fix Bug#53256 in a stress test, assert dict/dict0dict.c:815
- table2 == NULL
-
-2010-05-05 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#53165 Setting innodb_change_buffering=DEFAULT produces
- incorrect result
-
-2010-05-04 The InnoDB Team
-
- * fsp/fsp0fsp.c:
- Fix Bug#53306 valgrind: warnings in innodb.innodb
-
-2010-05-03 The InnoDB Team
-
- * buf0buf.c:
- Fix Bug#53248 compressed tables page checksum mismatch after
- re-enabling innodb_checksums
-
-2010-04-28 The InnoDB Team
-
- * log/log0recv.h, log/log0recv.c:
- Fix Bug#53122 InnoDB recovery uses too big a hash table for redo
- log records
-
-2010-04-27 The InnoDB Team
-
- * handler/ha_innodb.cc, lock/lock0lock.c, row/row0mysql.c,
- row/row0sel.c:
- Fix Bug#48607 READ UNCOMMITTED uses more locks than READ COMMITTED
- in InnoDB 5.1+
-
-2010-04-26 The InnoDB Team
-
- * row/row0sel.c:
- Fix Bug#52663 Lost update incrementing column value under
- READ COMMITTED isolation level
-
-2010-04-22 The InnoDB Team
-
- * include/dict0boot.h, dict/dict0boot.c:
- Fix a bug that prevented the crash recovery of fast CREATE INDEX
- from dropping partially created indexes.
-
-2010-04-21 The InnoDB Team
-
- * btr/btr0btr.c:
- Fix Bug#52964 Infinite loop in btr_page_split_and_insert()
- in ROW_FORMAT=COMPRESSED
-
-2010-04-21 The InnoDB Team
-
- * data/data0data.c:
- Fix Bug#52745 Failing assertion: blob_no < page_zip->n_blobs
-
-2010-04-20 The InnoDB Team
-
- * dict/dict0crea.c, handler/ha_innodb.cc, include/trx0trx.h:
- Fix Bug#50495 'Row size too large' for plugin, but works for
- built-in InnoDB
- Only check the record size at index creation time when
- innodb_strict_mode is set or when ROW_FORMAT is DYNAMIC or COMPRESSED.
-
-2010-04-15 The InnoDB Team
-
- * trx/trx0rec.c:
- Fix Bug#52746 InnoDB purge thread crashed with table containing
- prefix indexed blobs
-
-2010-03-31 The InnoDB Team
-
- * mysql-test/innodb_bug51920.test, mysql-test/innodb_bug51920.result,
- srv/srv0srv.c:
- Fix Bug#51920 InnoDB connections in row lock wait ignore KILL
- until lock wait timeout
-
-2010-03-31 The InnoDB Team
-
- * mysql-test/innodb_bug38231.test:
- Remove non-determinism in the test case.
-
-2010-03-29 The InnoDB Team
-
- InnoDB Plugin 1.0.7 released
-
-2010-03-18 The InnoDB Team
-
- * CMakeLists.txt:
- Fix Bug#52102 InnoDB Plugin shows performance drop compared to
- InnoDB (Windows)
-
-2010-03-18 The InnoDB Team
-
- * buf0buf.ic:
- When comparing the time of the first access to a block against
- innodb_old_blocks_time, use 32-bit arithmetics. The comparison was
- incorrect on 64-bit systems.
-
-2010-03-11 The InnoDB Team
-
- * buf0buf.h, buf0buf.ic:
- Fix and clarify the latching of some buf_block_t members.
- Note that check_index_page_at_flush is not protected by any mutex.
- Note and assert that lock_hash_val is protected by the rw-latch.
-
-2010-03-10 The InnoDB Team
-
- * trx/trx0sys.c:
- Fix Bug#51653 outdated reference to set-variable
-
-2010-03-10 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb_bug21704.result,
- mysql-test/innodb_bug47621.result, mysql-test/innodb_bug47621.test:
- Fix Bug#47621 MySQL and InnoDB data dictionaries will become out of
- sync when renaming columns
-
-2010-03-10 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#51356 Many Valgrind errors in error messages
- with concurrent DDL
-
-2010-03-10 The InnoDB Team
-
- * handler/ha_innodb.cc, handler/handler0alter.cc,
- mysql-test/innodb_bug51378.result, mysql-test/innodb_bug51378.test:
- Fix Bug#51378 Init 'ref_length' to correct value, in case an out
- of bound MySQL primary_key
-
-2010-03-10 The InnoDB Team
-
- * log/log0recv.c:
- Remove a bogus assertion about page numbers exceeding 0x90000000
- in the redo log. Abort when encountering a corrupted redo log
- record, unless innodb_force_recovery is set.
-
-2010-03-09 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Make SHOW ENGINE INNODB MUTEX STATUS display SUM(os_waits)
- for the buffer pool block mutexes and locks.
-
-2010-03-08 The InnoDB Team
-
- * fil/fil0fil.c:
- Fix ALTER TABLE ... IMPORT TABLESPACE of compressed tables.
-
-2010-03-03 The InnoDB Team
-
- * handler/handler0alter.cc, innodb-index.result, innodb-index.test,
- innodb.result, innodb.test:
- Disallow a duplicate index name when creating an index.
-
-2010-02-11 The InnoDB Team
-
- * include/mem0mem.h, include/mem0mem.ic, mem/mem0mem.c:
- Fix Bug#49535 Available memory check slows down crash
- recovery tens of times
-
-2010-02-09 The InnoDB Team
-
- * buf/buf0buf.c:
- Fix Bug#38901 InnoDB logs error repeatedly when trying to load
- page into buffer pool
-
-2010-02-09 The InnoDB Team
-
- * srv/srv0srv.c:
- Let the master thread sleep if the amount of work to be done is
- calibrated as taking less than a second.
-
-2010-02-04 The InnoDB Team
-
- * btr/btr0btr.c, btr/btr0cur.c, btr/btr0pcur.c, buf/buf0buf.c,
- include/btr0btr.h, include/btr0cur.h, include/btr0pcur.h,
- include/btr0pcur.ic, include/buf0buf.h, row/row0ins.c, row/row0sel.c:
- Pass the file name and line number of the caller of the
- b-tree cursor functions to the buffer pool requests, in order
- to make the latch diagnostics more accurate.
-
-2010-02-03 The InnoDB Team
-
- * lock/lock0lock.c:
- Fix Bug#49001 SHOW INNODB STATUS deadlock info incorrect
- when deadlock detection aborts
-
-2010-02-03 The InnoDB Team
-
- * buf/buf0lru.c:
- Fix Bug#35077 Very slow DROP TABLE (ALTER TABLE, OPTIMIZE TABLE)
- on compressed tables
-
-2010-02-03 The InnoDB Team
-
- * handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c:
- Clean up CHECK TABLE error handling.
-
-2010-02-01 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb-autoinc.test,
- mysql-test/innodb-autoinc.result,
- mysql-test/innodb-autoinc-44030.test,
- mysql-test/innodb-autoinc-44030.result:
- Fix Bug#49497 Error 1467 (ER_AUTOINC_READ_FAILED) on inserting
- a negative value
-
-2010-01-28 The InnoDB Team
- * handler/ha_innodb.h, handler/ha_innodb.cc,
- handler/handler0alter.cc,
- mysql-test/innodb_bug47622.test,
- mysql-test/innodb_bug47622.result:
- Fix Bug#47622 the new index is added before the existing ones
- in MySQL, but after one in SE
-
-2010-01-27 The InnoDB Team
-
- * include/row0mysql.h, log/log0recv.c, row/row0mysql.c:
- Drop temporary tables at startup.
- This addresses the third aspect of
- Bug#41609 Crash recovery does not work for InnoDB temporary tables.
-
-2010-01-21 The InnoDB Team
-
- * buf/buf0buf.c:
- Do not merge buffered inserts to compressed pages before
- the redo log has been applied in crash recovery.
-
-2010-01-13 The InnoDB Team
-
- * row/row0sel.c:
- On the READ UNCOMMITTED isolation level, do not attempt to access
- a clustered index record that has been marked for deletion. The
- built-in InnoDB in MySQL 5.1 and earlier would attempt to retrieve
- a previous version of the record in this case.
-
-2010-01-13 The InnoDB Team
-
- * buf/buf0buf.c:
- When disabling the adaptive hash index, check the block state
- before checking block->is_hashed, because the latter may be
- uninitialized right after server startup.
-
-2010-01-12 The InnoDB Team
-
- * handler/ha_innodb.cc, handler/ha_innodb.h:
- Fix Bug#46193 crash when accessing tables after enabling
- innodb_force_recovery option
-
-2010-01-12 The InnoDB Team
-
- * row/row0mysql.c:
- Fix Bug#49238 Creating/Dropping a temporary table while at 1023
- transactions will cause assert.
-
-2009-12-02 The InnoDB Team
-
- * srv/srv0start.c:
- Display the zlib version number at startup.
- InnoDB compressed tables use zlib, and the implementation depends
- on the zlib function compressBound(), whose definition was slightly
- changed in zlib version 1.2.3.1 in 2006. MySQL bundles zlib 1.2.3
- from 2005, but some installations use a more recent zlib.
-
-2009-11-30 The InnoDB Team
-
- * dict/dict0crea.c, dict/dict0mem.c, dict/dict0load.c,
- dict/dict0boot.c, fil/fil0fil.c, handler/ha_innodb.cc,
- include/dict0mem.h, row/row0mysql.c:
- Fix the bogus warning messages for non-existing temporary
- tables that were reported in
- Bug#41609 Crash recovery does not work for InnoDB temporary tables.
- The actual crash recovery bug was corrected on 2009-04-29.
-
-2009-11-27 The InnoDB Team
-
- InnoDB Plugin 1.0.6 released
-
-2009-11-20 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Add a workaround to prevent a crash due to Bug#45961 DDL on
- partitioned innodb tables leaves data dictionary in an inconsistent
- state
-
-2009-11-19 The InnoDB Team
-
- * btr/btr0btr.c:
- Fix Bug#48469 when innodb tablespace is configured too small, crash
- and corruption!
-
-2009-11-19 The InnoDB Team
-
- * data/data0type.c:
- Fix Bug#48526 Data type for float and double is incorrectly reported
- in InnoDB table monitor
-
-2009-11-19 The InnoDB Team
-
- * CMakeLists.txt:
- Fix Bug#48317 cannot build innodb as static library
-
-2009-11-18 The InnoDB Team
-
- * handler/handler0alter.cc:
- Fix Bug#48782 On lock wait timeout, CREATE INDEX (creating primary key)
- attempts DROP TABLE
-
-2009-11-17 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb.result,
- mysql-test/innodb.test, mysql-test/innodb_bug44369.result,
- mysql-test/innodb_bug44369.test, mysql-test/patches/innodb-index.diff,
- row/row0mysql.c:
- Report duplicate table names to the client connection, not to the
- error log.
-
-2009-11-12 The InnoDB Team
-
- * handler/ha_innodb.cc, include/db0err.h, row/row0merge.c,
- row/row0mysql.c:
- Allow CREATE INDEX to be interrupted.
- Also, when CHECK TABLE is interrupted, report ER_QUERY_INTERRUPTED.
-
-2009-11-11 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb_bug47167.result,
- mysql-test/innodb_bug47167.test, mysql-test/innodb_file_format.result:
- Fix Bug#47167 "set global innodb_file_format_check" cannot set value
- by User-Defined Variable
-
-2009-11-11 The InnoDB Team
-
- * include/os0file.h, os/os0file.c:
- Fix Bug#3139 Mysql crashes: 'windows error 995' after several selects
- on a large DB
-
-2009-11-04 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#32430 'show innodb status' causes errors
- Invalid (old?) table or database name in logs
-
-2009-11-02 The InnoDB Team
-
- * btr/btr0sea.c, buf/buf0buf.c, dict/dict0dict.c, fil/fil0fil.c,
- ibuf/ibuf0ibuf.c, include/btr0sea.h, include/dict0dict.h,
- include/fil0fil.h, include/ibuf0ibuf.h, include/lock0lock.h,
- include/log0log.h, include/log0recv.h, include/mem0mem.h,
- include/mem0pool.h, include/os0file.h, include/pars0pars.h,
- include/srv0srv.h, include/thr0loc.h, include/trx0i_s.h,
- include/trx0purge.h, include/trx0rseg.h, include/trx0sys.h,
- include/trx0undo.h, include/usr0sess.h, lock/lock0lock.c,
- log/log0log.c, log/log0recv.c, mem/mem0dbg.c, mem/mem0pool.c,
- os/os0file.c, os/os0sync.c, os/os0thread.c, pars/lexyy.c,
- pars/pars0lex.l, que/que0que.c, srv/srv0srv.c, srv/srv0start.c,
- sync/sync0arr.c, sync/sync0sync.c, thr/thr0loc.c, trx/trx0i_s.c,
- trx/trx0purge.c, trx/trx0rseg.c, trx/trx0sys.c, trx/trx0undo.c,
- usr/usr0sess.c, ut/ut0mem.c:
- Fix Bug#45992 innodb memory not freed after shutdown
- Fix Bug#46656 InnoDB plugin: memory leaks (Valgrind)
-
-2009-10-29 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,
- mysql-test/innodb-autoinc.test:
- Fix Bug#47125 auto_increment start value is ignored if an index is
- created and engine=innodb
-
-2009-10-29 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb_bug47777.result,
- mysql-test/innodb_bug47777.test:
- Fix Bug#47777 innodb dies with spatial pk: Failing assertion: buf <=
- original_buf + buf_len
-
-2009-10-29 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#38996 Race condition in ANALYZE TABLE
-
-2009-10-29 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix bug#42383: Can't create table 'test.bug39438'
-
-2009-10-29 The InnoDB Team
-
- * os/os0proc.c:
- Fix Bug#48237 Error handling in os_mem_alloc_large appears to
- be incorrect
-
-2009-10-29 The InnoDB Team
-
- * buf/buf0buf.c, buf/buf0lru.c, include/buf0buf.h, include/buf0buf.ic:
- Fix corruption of the buf_pool->LRU_old list and improve debug
- assertions.
-
-2009-10-28 The InnoDB Team
-
- * srv/srv0start.c:
- Fix Bug#41490 After enlargement of InnoDB page size, the error message
- become inaccurate
-
-2009-10-26 The InnoDB Team
-
- * row/row0ins.c:
- When allocating a data tuple, zero out the system fields in order
- to avoid Valgrind warnings about uninitialized fields in
- dtuple_validate().
-
-2009-10-22 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb-zip.result,
- mysql-test/innodb-zip.test, mysql-test/innodb_bug44369.result,
- mysql-test/innodb_bug44369.test:
- Fix Bug#47233 Innodb calls push_warning(MYSQL_ERROR::WARN_LEVEL_ERROR)
-
-2009-10-19 The InnoDB Team
-
- * mysql-test/innodb_information_schema.test:
- Fix Bug#47808 innodb_information_schema.test fails when run under
- valgrind
-
-2009-10-15 The InnoDB Team
-
- * include/page0page.ic:
- Fix Bug#47058 Failure to compile innodb_plugin on solaris 10u7 + spro
- cc/CC 5.10
-
-2009-10-13 The InnoDB Team
-
- * buf/buf0flu.c:
- Call fsync() on datafiles after a batch of pages is written to disk
- even when skip_innodb_doublewrite is set.
-
-2009-10-05 The InnoDB Team
-
- * buf/buf0buf.c:
- Do not invalidate buffer pool while an LRU batch is active. Added code
- to buf_pool_invalidate() to wait for the running batches to finish.
-
-2009-10-01 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#47763 typo in error message: Failed to open table %s after %lu
- attemtps.
-
-2009-10-01 The InnoDB Team
-
- * fsp/fsp0fsp.c, row/row0merge.c:
- Clean up after a crash during DROP INDEX. When InnoDB crashes
- while dropping an index, ensure that the index will be completely
- dropped during crash recovery. The MySQL .frm file may still
- contain the dropped index, but there is little that we can do
- about it.
-
-2009-09-28 The InnoDB Team
-
- * handler/ha_innodb.cc:
- When a secondary index exists in the MySQL .frm file but not in
- the InnoDB data dictionary, return an error instead of letting an
- assertion fail in index_read.
-
-2009-09-28 The InnoDB Team
-
- * btr/btr0btr.c, buf/buf0buf.c, include/page0page.h,
- include/page0zip.h, page/page0cur.c, page/page0page.c,
- page/page0zip.c:
- Do not write to PAGE_INDEX_ID when restoring an uncompressed page
- after a compression failure. The field should only be written
- when creating a B-tree page. This fix addresses a race condition
- in a debug assertion.
-
-2009-09-28 The InnoDB Team
-
- * fil/fil0fil.c:
- Try to prevent the reuse of tablespace identifiers after InnoDB
- has crashed during table creation. Also, refuse to start if files
- with duplicate tablespace identifiers are encountered.
-
-2009-09-25 The InnoDB Team
-
- * include/os0file.h, os/os0file.c:
- Fix Bug#47055 unconditional exit(1) on ERROR_WORKING_SET_QUOTA
- 1453 (0x5AD) for InnoDB backend
-
-2009-09-19 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb-consistent-master.opt,
- mysql-test/innodb-consistent.result,
- mysql-test/innodb-consistent.test:
- Fix Bug#37232 Innodb might get too many read locks for DML with
- repeatable-read
-
-2009-09-19 The InnoDB Team
-
- * fsp/fsp0fsp.c:
- Fix Bug#31183 Tablespace full problems not reported in error log,
- error message unclear
-
-2009-09-17 The InnoDB Team
-
- * mysql-test/innodb-zip.result, mysql-test/innodb-zip.test:
- Make the test pass with zlib 1.2.3.3. Apparently, the definition
- of compressBound() has changed between zlib versions, and the
- maximum record size of a table with 1K compressed page size has
- been reduced by one byte. This is an arbitrary test. In practical
- applications, for good write performance, the compressed page size
- should be chosen to be bigger than the absolute minimum.
-
-2009-09-16 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#46256 drop table with unknown collation crashes innodb
-
-2009-09-16 The InnoDB Team
-
- * dict/dict0dict.c, handler/ha_innodb.cc,
- mysql-test/innodb_bug44369.result, mysql-test/innodb_bug44369.test,
- row/row0mysql.c:
- Fix Bug#44369 InnoDB: Does not uniformly disallow disallowed column
- names
-
-2009-09-16 The InnoDB Team
-
- * handler/ha_innodb.cc, include/db0err.h,
- mysql-test/innodb_bug46000.result, mysql-test/innodb_bug46000.test:
- Fix Bug#46000 using index called GEN_CLUST_INDEX crashes server
-
-2009-09-02 The InnoDB Team
-
- * include/lock0lock.h, include/row0mysql.h, lock/lock0lock.c,
- row/row0mysql.c:
- Fix a regression introduced by the fix for MySQL bug#26316. We check
- whether a transaction holds any AUTOINC locks before we acquire
- the kernel mutex and release those locks.
-
-2009-08-27 The InnoDB Team
-
- * dict/dict0dict.c, include/dict0dict.h,
- mysql-test/innodb_bug44571.result, mysql-test/innodb_bug44571.test:
- Fix Bug#44571 InnoDB Plugin crashes on ADD INDEX
-
-2009-08-27 The InnoDB Team
-
- * row/row0merge.c:
- Fix a bug in the merge sort that can corrupt indexes in fast index
- creation. Add some consistency checks. Check that the number of
- records remains constant in every merge sort pass.
-
-2009-08-27 The InnoDB Team
-
- * buf/buf0buf.c, buf/buf0lru.c, buf/buf0rea.c, handler/ha_innodb.cc,
- include/buf0buf.h, include/buf0buf.ic, include/buf0lru.h,
- include/ut0ut.h, ut/ut0ut.c:
- Make it possible to tune the buffer pool LRU eviction policy to be
- more resistant against index scans. Introduce the settable global
- variables innodb_old_blocks_pct and innodb_old_blocks_time for
- controlling the buffer pool eviction policy. The parameter
- innodb_old_blocks_pct (5..95) controls the desired amount of "old"
- blocks in the LRU list. The default is 37, corresponding to the
- old fixed ratio of 3/8. Each time a block is accessed, it will be
- moved to the "new" blocks if its first access was at least
- innodb_old_blocks_time milliseconds ago (default 0, meaning every
- block). The idea is that in index scans, blocks will be accessed
- a few times within innodb_old_blocks_time, and they will remain in
- the "old" section of the LRU list. Thus, when innodb_old_blocks_time
- is nonzero, blocks retrieved for one-time index scans will be more
- likely candidates for eviction than blocks that are accessed in
- random patterns.
-
-2009-08-26 The InnoDB Team
-
- * handler/ha_innodb.cc, os/os0file.c:
- Fix Bug#42885 buf_read_ahead_random, buf_read_ahead_linear counters,
- thread wakeups
-
-2009-08-20 The InnoDB Team
-
- * lock/lock0lock.c:
- Fix Bug#46650 Innodb assertion autoinc_lock == lock in
- lock_table_remove_low on INSERT SELECT
-
-2009-08-13 The InnoDB Team
-
- * handler/handler0alter.cc:
- Fix Bug#46657 InnoDB plugin: invalid read in index_merge_innodb test
- (Valgrind)
-
-2009-08-11 The InnoDB Team
-
- InnoDB Plugin 1.0.4 released
-
-2009-07-20 The InnoDB Team
-
- * buf/buf0rea.c, handler/ha_innodb.cc, include/srv0srv.h,
- srv/srv0srv.c:
- Change the read ahead parameter name to innodb_read_ahead_threshold.
- Change the meaning of this parameter to signify the number of pages
- that must be sequentially accessed for InnoDB to trigger a readahead
- request.
-
-2009-07-20 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#39802 On Windows, 32-bit time_t should be enforced
-
-2009-07-16 The InnoDB Team
-
- * include/univ.i:
- Support inlining of functions and prefetch with Sun Studio.
- These changes are based on contribution from Sun Microsystems Inc.
- under a BSD license.
-
-2009-07-14 The InnoDB Team
-
- * fil/fil0fil.c:
- Fix Bug#45814 URL reference in InnoDB server errors needs adjusting to
- match documentation
-
-2009-07-14 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb_bug21704.result,
- mysql-test/innodb_bug21704.test:
- Fix Bug#21704 Renaming column does not update FK definition
-
-2009-07-10 The InnoDB Team
-
- * handler/ha_innodb.cc, srv/srv0srv.c:
- Change the defaults for
- innodb_sync_spin_loops: 20 -> 30
- innodb_spin_wait_delay: 5 -> 6
-
-2009-07-08 The InnoDB Team
-
- * buf/buf0flu.c, handler/ha_innodb.cc, include/buf0flu.h,
- include/log0log.h, include/log0log.ic, include/srv0srv.h,
- srv/srv0srv.c:
- Implement the adaptive flushing of dirty pages, which uses
- a heuristics based flushing rate of dirty pages to avoid IO
- bursts at checkpoint. Expose new configure knob
- innodb_adaptive_flushing to control whether the new flushing
- algorithm should be used.
-
-2009-07-07 The InnoDB Team
-
- * handler/ha_innodb.cc, include/srv0srv.h, log/log0log.c,
- srv/srv0srv.c:
- Implement IO capacity tuning. Expose new configure knob
- innodb_io_capacity to control the master threads IO rate. The
- ibuf merge is also changed from synchronous to asynchronous.
- These changes are based on contribution from Google Inc.
- under a BSD license.
-
-2009-07-02 The InnoDB Team
-
- * include/ut0ut.h, plug.in, ut/ut0ut.c:
- Use the PAUSE instruction inside the spinloop if it is available,
- Thanks to Mikael Ronstrom <mikael@mysql.com>.
-
-2009-06-29 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb_file_format.test,
- mysql-test/innodb_file_format.result:
- Do not crash on SET GLOBAL innodb_file_format=DEFAULT
- or SET GLOBAL innodb_file_format_check=DEFAULT.
-
-2009-06-29 The InnoDB Team
-
- * buf/buf0buf.c, buf/buf0rea.c, lock/lock0lock.c:
- Tolerate missing tablespaces during crash recovery and when
- printing information on locks.
-
-2009-06-29 The InnoDB Team
-
- * buf/buf0buf.c:
- Fix a race condition when reading buf_fix_count.
- Currently, it is not being protected by the buffer pool mutex,
- but by the block mutex.
-
-2009-06-29 The InnoDB Team
-
- * handler/handler0alter.cc:
- Start the user transaction prebuilt->trx if it was not started
- before adding or dropping an index. Without this fix, the
- table could be locked outside an active transaction.
-
-2009-06-25 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb_bug42101.test,
- mysql-test/innodb_bug42101.result,
- mysql-test/innodb_bug42101-nonzero.test,
- mysql-test/innodb_bug42101-nonzero.result:
- Fix Bug#45749 Race condition in SET GLOBAL
- innodb_commit_concurrency=DEFAULT
-
-2009-06-25 The InnoDB Team
-
- * dict/dict0dict.c:
- When an index column cannot be found in the table during index
- creation, display additional diagnostic before an assertion failure.
- This does NOT fix Bug#44571 InnoDB Plugin crashes on ADD INDEX,
- but it helps understand the reason of the crash.
-
-2009-06-17 The InnoDB Team
-
- * row/row0merge.c:
- Fix Bug#45426 UNIV_DEBUG build cause assertion error at CREATE INDEX
-
-2009-06-17 The InnoDB Team
-
- * mysql-test/innodb_bug45357.result, mysql-test/innodb_bug45357.test,
- row/row0mysql.c:
- Fix Bug#45357 5.1.35 crashes with Failing assertion: index->type &
- DICT_CLUSTERED
-
-2009-06-17 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,
- mysql-test/innodb-autoinc.test:
- Fix Bug#44030 Error: (1500) Couldn't read the MAX(ID) autoinc value
- from the index (PRIMARY)
-
-2009-06-11 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb.result, srv/srv0srv.c:
- Change the following defaults:
- max_dirty_pages_pct: from 90 to 75, max allowed from 100 to 99
- additional_mem_pool_size: from 1 to 8 MB
- buffer_pool_size: from 8 to 128 MB
- log_buffer_size: from 1 to 8 MB
- read_io_threads/write_io_threads: from 1 to 4
-
-2009-06-09 The InnoDB Team
-
- * handler/ha_innodb.cc, include/trx0trx.h, trx/trx0trx.c:
- Enable Group Commit functionality that was broken in 5.0 when
- distributed transactions were introduced.
-
-2009-06-05 The InnoDB Team
-
- * handler/ha_innodb.cc, include/os0file.h, include/srv0srv.h,
- os/os0file.c, srv/srv0srv.c, srv/srv0start.c:
- Enable functionality to have multiple background IO helper threads.
- Expose new configure knobs innodb_read_io_threads and
- innodb_write_io_threads and deprecate innodb_file_io_threads (this
- parameter was relevant only on windows). Internally this allows
- multiple segments for read and write IO request arrays where one
- thread works on one segment.
-
-2009-06-05 The InnoDB Team
-
- * buf/buf0lru.c, buf/buf0rea.c, handler/ha_innodb.cc,
- include/srv0srv.h, srv/srv0srv.c:
- Fix a bug in linear read ahead:
- 1) Take into account access pattern when deciding whether or not to
- do linear read ahead.
- 2) Expose a knob innodb_read_ahead_factor = [0-64] default (8),
- dynamic, global to control linear read ahead behavior. This is the
- value of the number of pages that InnoDB will tolerate within a
- 64 page extent even if they are accessed out of order or have
- not been accessed at all. This number (which varies from 0 to 64)
- is indicative of the slack that we have when deciding about linear
- readahead.
- 3) Disable random read ahead. Keep the code for now.
-
-2009-06-03 The InnoDB Team
-
- * dict/dict0dict.c, mysql-test/t/innodb_mysql.test,
- mysql-test/r/innodb_mysql.result:
- Fix Bug#39793 Foreign keys not constructed when column
- has a '#' in a comment or default value
-
-2009-05-27 The InnoDB Team
-
- * Doxyfile:
- Allow the extraction of documentation from the code base with the
- Doxygen tool. Convert and add many (but not yet all) comments to
- Doxygen format.
-
-2009-05-19 The InnoDB Team
-
- * btr/btr0btr.c, btr/btr0cur.c, lock/lock0lock.c,
- include/page0page.ic, include/lock0lock.h, include/dict0dict.h,
- include/page0page.h, include/dict0dict.ic, ibuf/ibuf0ibuf.c,
- page/page0zip.c, page/page0page.c:
- Write updates of PAGE_MAX_TRX_ID to the redo log and add debug
- assertions for checking that PAGE_MAX_TRX_ID is valid on leaf
- pages of secondary indexes and the insert buffer B-tree. This bug
- could cause failures in secondary index lookups in consistent
- reads right after crash recovery.
-
-2009-05-18 The InnoDB Team
-
- * btr/btr0cur.c:
- Correctly estimate the space needed on the compressed page when
- performing an update by delete-and-insert.
-
-2009-05-14 The InnoDB Team
-
- * handler/ha_innodb.cc, include/srv0srv.h,
- mysql-test/innodb_bug42101-nonzero-master.opt,
- mysql-test/innodb_bug42101-nonzero.result,
- mysql-test/innodb_bug42101-nonzero.test,
- mysql-test/innodb_bug42101.result, mysql-test/innodb_bug42101.test,
- srv/srv0srv.c:
- Fix Bug#42101 Race condition in innodb_commit_concurrency
-
-2009-05-13 The InnoDB Team
-
- * dict/dict0dict.c:
- Fix Bug#44320 InnoDB: missing DB_ROLL_PTR in Table Monitor COLUMNS
- output
-
-2009-04-29 The InnoDB Team
-
- * fil/fil0fil.c, include/fil0fil.h, include/mtr0mtr.h,
- log/log0recv.c:
- Fix Bug#41609 Crash recovery does not work for InnoDB temporary tables
-
-2009-04-23 The InnoDB Team
-
- * row/row0mysql.c:
- When scanning indexes, report in the error log any error codes
- returned by the search function. These error codes will still be
- ignored in CHECK TABLE.
-
-2009-04-23 The InnoDB Team
-
- * include/trx0types.h:
- Define the logical type names trx_id_t, roll_ptr_t, and undo_no_t
- and use them in place of dulint everywhere.
-
-2009-04-18 The InnoDB Team
-
- * handler/ha_innodb.cc, include/pars0pars.h:
- Fix Bug#29125 Windows Server X64: so many compiler warnings
-
-2009-04-16 The InnoDB Team
-
- * include/univ.i:
- Define REFMAN as the base URL of the MySQL Reference Manual and
- use the macro in all diagnostic output.
-
-2009-04-16 The InnoDB Team
-
- * CMakeLists.txt, include/os0sync.h, include/sync0sync.h,
- include/sync0sync.ic, include/univ.i, srv/srv0start.c,
- sync/sync0sync.c:
- Use the Windows Interlocked functions for atomic memory
- access.
-
-2009-04-15 The InnoDB Team
-
- * mysql-test/innodb.result, mysql-test/innodb.test:
- Fix Bug#43309 Test main.innodb can't be run twice
-
-2009-04-14 The InnoDB Team
-
- * CMakeLists.txt, handler/win_delay_loader.cc,
- win-plugin/win-plugin.diff:
- Remove statically linked libraries from MySQL (zlib and strings).
-
-2009-04-11 The InnoDB Team
-
- * CMakeLists.txt, win-plugin/README, win-plugin/win-plugin.diff:
- Rewrite CMakeLists.txt.
-
-2009-04-07 The InnoDB Team
-
- * include/os0sync.h, include/sync0rw.ic, include/sync0sync.h,
- include/sync0sync.ic, include/univ.i, plug.in, srv/srv0srv.c,
- srv/srv0start.c, sync/sync0arr.c, sync/sync0sync.c:
- Enable atomics on Solaris (using the libc functions as defined in
- atomic.h) if GCC atomic builtins are not present.
-
-2009-04-07 The InnoDB Team
-
- * btr/btr0btr.c, dict/dict0dict.c, ibuf/ibuf0ibuf.c,
- include/data0data.h, include/data0data.ic, include/data0type.h,
- include/data0type.ic, include/dict0dict.h, include/dict0dict.ic,
- include/rem0rec.ic, mysql-test/innodb.result, mysql-test/innodb.test,
- pars/pars0pars.c, rem/rem0rec.c, row/row0upd.c:
- Fix Bug#44032 In ROW_FORMAT=REDUNDANT, update UTF-8 CHAR
- to/from NULL is not in-place
-
-2009-04-07 The InnoDB Team
-
- * page/page0cur.c:
- Fix Bug#43660 SHOW INDEXES/ANALYZE does NOT update cardinality for
- indexes of InnoDB table
-
-2009-04-06 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Make the parameter innodb_change_buffering settable by the
- configuration file or mysqld command line options. Before this
- fix, the initial value specified for this parameter was ignored.
-
-2009-04-06 The InnoDB Team
-
- * sync/sync0rw.c:
- Avoid a bogus failure in UNIV_SYNC_DEBUG diagnostics.
-
-2009-04-02 The InnoDB Team
-
- * handler/ha_innodb.cc, include/srv0srv.h, srv/srv0srv.c:
- Add new parameter innodb_spin_wait_delay to set the maximum delay
- between polling for a spin lock.
-
-2009-04-02 The InnoDB Team
-
- * dict/dict0crea.c, handler/ha_innodb.cc, handler/ha_innodb.h,
- include/dict0mem.h, include/row0merge.h, include/row0mysql.h,
- mysql-test/innodb-index.result, mysql-test/innodb-index.test,
- row/row0merge.c, row/row0sel.c:
- In consistent reads, refuse to use newly created indexes that may
- lack history.
-
-2009-03-25 The InnoDB Team
-
- * buf/buf0buf.c, handler/ha_innodb.cc, include/buf0buf.h:
- In SHOW ENGINE INNODB MUTEX do not show the status of block->mutex,
- block->lock, block->lock->mutex (if applicable) and all mutexes and
- rw-locks for which number of os-waits are zero because this can
- be overwhelming particularly when the buffer pool is very large.
-
-2009-03-20 The InnoDB Team
-
- * buf/buf0buf.c, include/log0recv.h, log/log0recv.c:
- Remove the compile-time constant parameters of
- recv_recover_page(), recv_scan_log_recs(), and recv_sys_init().
-
-2009-03-20 The InnoDB Team
-
- * data/data0type.c, handler/ha_innodb.cc, include/ha_prototypes.h:
- Declare innobase_get_at_most_n_mbchars() in ha_prototypes.h.
-
-2009-03-20 The InnoDB Team
-
- * fil/fil0fil.h, fil/fil0fil.c, srv/srv0start.c:
- Add the parameter hash_size to fil_init().
-
-2009-03-20 The InnoDB Team
-
- * fil/fil0fil.c:
- Refer to fil_system directly, not via local variables.
-
-2009-03-20 The InnoDB Team
-
- * page/page0page.c:
- In page_validate(), always report the space id, page number and
- the name of the index when corruption is noticed.
-
-2009-03-20 The InnoDB Team
-
- * include/log0log.h, include/log0log.ic, log/log0log.c:
- Add in/out comments or const qualifiers to some function
- parameters as appropriate.
-
-2009-03-20 The InnoDB Team
-
- * dict/dict0boot.c, dict/dict0dict.c, fsp/fsp0fsp.c,
- include/dict0dict.h, include/srv0srv.h, srv/srv0srv.c,
- page/page0page.c:
- Replace srv_sys->dummy_ind1 and srv_sys->dummy_ind2 with
- dict_ind_redundant and dict_ind_compact, which are
- initialized by dict_init().
-
-2009-03-11 The InnoDB Team
-
- InnoDB Plugin 1.0.3 released
-
-2009-03-05 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,
- mysql-test/innodb-autoinc.test:
- Fix Bug#43203 Overflow from auto incrementing causes server segv
-
-2009-02-25 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,
- mysql-test/innodb-autoinc.test:
- Fix Bug#42714 AUTO_INCREMENT errors in 5.1.31
-
-2009-02-23 The InnoDB Team
-
- * btr/btr0cur.c:
- Fix Bug#43043 Crash on BLOB delete operation
-
-2009-02-20 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Make innodb_use_sys_malloc=ON the default.
-
-2009-02-20 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,
- mysql-test/innodb-autoinc.test:
- Fix Bug#42400 InnoDB autoinc code can't handle floating-point columns
-
-2009-02-18 The InnoDB Team
-
- * include/ut0mem.h, os/os0proc.c, ut/ut0mem.c:
- Protect ut_total_allocated_memory with ut_list_mutex in
- os_mem_alloc_large() and os_mem_free_large(). The lack of this mutex
- protection could cause an assertion failure during fast index
- creation. Also, add UNIV_MEM_ALLOC and UNIV_MEM_FREE instrumentation
- to os_mem_alloc_large() and os_mem_free_large(), so that Valgrind can
- detect more errors.
-
-2009-02-11 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Make innodb_thread_concurrency=0 the default. The old default value
- was 8. A non-zero setting may be useful when InnoDB is showing severe
- scalability problems under multiple concurrent connections.
-
-2009-02-10 The InnoDB Team
-
- * handler/ha_innodb.cc, handler/ha_innodb.h:
- Fix Bug#41676 Table names are case insensitive in locking
-
-2009-02-10 The InnoDB Team
-
- * mem/mem0dbg.c, mem/mem0mem.c, mem/mem0pool.c:
- When innodb_use_sys_malloc is set, ignore
- innodb_additional_mem_pool_size, because nothing will be allocated
- from mem_comm_pool.
-
-2009-02-10 The InnoDB Team
-
- * ut/ut0mem.c:
- Map ut_malloc_low(), ut_realloc(), and ut_free() directly to malloc(),
- realloc(), and free() when innodb_use_sys_malloc is set. As a side
- effect, ut_total_allocated_memory ("Total memory allocated" in the
- "BUFFER POOL AND MEMORY" section of SHOW ENGINE INNODB STATUS) will
- exclude any memory allocated by these functions when
- innodb_use_sys_malloc is set.
-
-2009-02-10 The InnoDB Team
-
- * btr/btr0cur.c, btr/btr0sea.c, buf/buf0buf.c, handler/ha_innodb.cc,
- include/buf0buf.ic, include/os0sync.h, include/srv0srv.h,
- include/sync0rw.h, include/sync0rw.ic, include/sync0sync.h,
- include/sync0sync.ic, include/univ.i, row/row0sel.c, srv/srv0srv.c,
- srv/srv0start.c, sync/sync0arr.c, sync/sync0rw.c, sync/sync0sync.c:
- On those platforms that support it, implement the synchronization
- primitives of InnoDB mutexes and read/write locks with GCC atomic
- builtins instead of Pthreads mutexes and InnoDB mutexes. These changes
- are based on a patch supplied by Mark Callaghan of Google under a BSD
- license.
-
-2009-01-30 The InnoDB Team
-
- * btr/btr0cur.c, btr/btr0sea.c, buf/buf0buf.c, handler/ha_innodb.cc,
- include/btr0sea.h, include/buf0buf.h, include/sync0sync.h,
- sync/sync0sync.c:
- Make the configuration parameter innodb_adaptive_hash_index dynamic,
- so that it can be changed at runtime.
-
-2009-01-29 The InnoDB Team
-
- * handler/ha_innodb.cc, ibuf/ibuf0ibuf.c, include/ibuf0ibuf.h,
- include/ibuf0ibuf.ic:
- Implement the settable global variable innodb_change_buffering,
- with the allowed values 'none' and 'inserts'. The default value
- 'inserts' enables the buffering of inserts to non-unique secondary
- index trees when the B-tree leaf page is not in the buffer pool.
-
-2009-01-27 The InnoDB Team
-
- * buf/buf0lru.c:
- Fix a race condition in buf_LRU_invalidate_tablespace(): The
- compressed page size (zip_size) was read while the block descriptor
- was no longer protected by a mutex. This could lead to corruption
- when a table is dropped on a busy system that contains compressed
- tables.
-
-2009-01-26 The InnoDB Team
-
- * btr/btr0sea.c, buf/buf0buf.c, include/buf0buf.h, include/buf0buf.ic,
- include/mtr0log.ic, include/row0upd.ic, mtr/mtr0mtr.c:
- Implement buf_block_align() with pointer arithmetics, as it is in the
- built-in InnoDB distributed with MySQL. Do not acquire the buffer pool
- mutex before buf_block_align(). This removes a scalability bottleneck
- in the adaptive hash index lookup. In CHECK TABLE, check that
- buf_pool->page_hash is consistent with buf_block_align().
-
-2009-01-23 The InnoDB Team
-
- * btr/btr0sea.c:
- Fix Bug#42279 Race condition in btr_search_drop_page_hash_when_freed()
-
-2009-01-23 The InnoDB Team
-
- * buf/buf0buf.c, include/buf0buf.h:
- Remove the unused mode BUF_GET_NOWAIT of buf_page_get_gen()
-
-2009-01-20 The InnoDB Team
-
- * include/rem0rec.h, include/rem0rec.ic:
- Fix Bug#41571 MySQL segfaults after innodb recovery
-
-2009-01-20 The InnoDB Team
-
- * lock/lock0lock.c:
- Fix Bug#42152 Race condition in lock_is_table_exclusive()
-
-2009-01-14 The InnoDB Team
-
- * include/trx0roll.h, trx/trx0roll.c, trx/trx0trx.c:
- Fix Bug#38187 Error 153 when creating savepoints
-
-2009-01-14 The InnoDB Team
-
- * dict/dict0load.c:
- Fix Bug#42075 dict_load_indexes failure in dict_load_table will
- corrupt the dictionary cache
-
-2009-01-13 The InnoDB Team
-
- * buf/buf0buddy.c, dict/dict0dict.c, dict/dict0mem.c, fil/fil0fil.c,
- ha/ha0storage.c, handler/ha_innodb.cc, handler/win_delay_loader.cc,
- include/buf0buf.ic, include/dict0dict.ic, include/hash0hash.h,
- thr/thr0loc.c, trx/trx0i_s.c:
- Add the parameter ASSERTION to HASH_SEARCH() macro, and use it for
- light validation of the traversed items in hash table lookups when
- UNIV_DEBUG is enabled.
-
-2009-01-09 The InnoDB Team
-
- * buf/buf0flu.c, include/buf0flu.h, include/buf0flu.ic:
- Remove unused code from the functions
- buf_flush_insert_into_flush_list() and
- buf_flush_insert_sorted_into_flush_list().
-
-2009-01-09 The InnoDB Team
-
- * buf/buf0flu.c:
- Simplify the functions buf_flush_try_page() and buf_flush_batch(). Add
- debug assertions and an explanation to buf_flush_write_block_low().
-
-2009-01-07 The InnoDB Team
-
- * row/row0merge.c:
- Fix a bug in recovery when dropping temporary indexes.
-
-2009-01-07 The InnoDB Team
-
- * handler/ha_innodb.cc, handler/ha_innodb.h, handler/handler0alter.cc:
- Fix Bug#41680 calls to trx_allocate_for_mysql are not consistent
-
-2009-01-07 The InnoDB Team
-
- * mysql-test/innodb_bug41904.result, mysql-test/innodb_bug41904.test,
- row/row0merge.c:
- Fix Bug#41904 create unique index problem
-
-2009-01-02 The InnoDB Team
-
- * handler/ha_innodb.cc, include/srv0srv.h, mem/mem0pool.c,
- mysql-test/innodb-use-sys-malloc-master.opt,
- mysql-test/innodb-use-sys-malloc.result,
- mysql-test/innodb-use-sys-malloc.test, srv/srv0srv.c, srv/srv0start.c:
- Implement the configuration parameter innodb_use_sys_malloc (false by
- default), for disabling InnoDB's internal memory allocator and using
- system malloc/free instead. The "BUFFER POOL AND MEMORY" section of
- SHOW ENGINE INNODB STATUS will report "in additional pool allocated
- allocated 0" when innodb_use_sys_malloc is set.
-
-2008-12-30 The InnoDB Team
-
- * btr/btr0btr.c:
- When setting the PAGE_LEVEL of a compressed B-tree page from or to 0,
- compress the page at the same time. This is necessary, because the
- column information stored on the compressed page will differ between
- leaf and non-leaf pages. Leaf pages are identified by PAGE_LEVEL=0.
- This bug can make InnoDB crash when all rows of a compressed table are
- deleted.
-
-2008-12-17 The InnoDB Team
-
- * include/row0sel.h, include/row0upd.h, pars/pars0pars.c,
- row/row0mysql.c, row/row0sel.c, row/row0upd.c:
- Remove update-in-place select from the internal SQL interpreter. It
- was only used for updating the InnoDB internal data dictionary when
- renaming or dropping tables. It could have caused deadlocks when
- acquiring latches on insert buffer bitmap pages.
-
-2008-12-17 The InnoDB Team
-
- * btr/btr0sea.c, buf/buf0buf.c, buf/buf0lru.c, ha/ha0ha.c,
- ha/hash0hash.c, include/buf0buf.h, include/ha0ha.h, include/ha0ha.ic,
- include/hash0hash.h, include/univ.i:
- Introduce the preprocessor symbol UNIV_AHI_DEBUG for enabling adaptive
- hash index debugging independently of UNIV_DEBUG.
-
-2008-12-16 The InnoDB Team
-
- * btr/btr0cur.c:
- Do not update the free bits in the insert buffer bitmap when inserting
- or deleting from the insert buffer B-tree. Assert that records in the
- insert buffer B-tree are never updated.
-
-2008-12-12 The InnoDB Team
-
- * buf/buf0buf.c, fil/fil0fil.c, fsp/fsp0fsp.c, ibuf/ibuf0ibuf.c,
- include/fil0fil.h, include/ibuf0ibuf.h, include/ibuf0ibuf.ic,
- include/ibuf0types.h:
- Clean up the insert buffer subsystem so that only one insert
- buffer B-tree exists.
- Originally, there were provisions in InnoDB for multiple insert
- buffer B-trees, apparently one for each tablespace.
- When Heikki Tuuri implemented multiple InnoDB tablespaces in
- MySQL/InnoDB 4.1, he made the insert buffer live only in the
- system tablespace (space 0) but left the provisions in the code.
-
-2008-12-11 The InnoDB Team
-
- * include/srv0srv.h, os/os0proc.c, srv/srv0srv.c:
- Fix the issue that the InnoDB plugin fails if innodb_buffer_pool_size
- is defined bigger than 4096M on 64-bit Windows. This bug should not
- have affected other 64-bit systems.
-
-2008-12-09 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#40386 Not flushing query cache after truncate.
-
-2008-12-09 The InnoDB Team
-
- * handler/ha_innodb.cc, srv/srv0srv.c, trx/trx0trx.c:
- Fix Bug#40760 "set global innodb_thread_concurrency = 0;" is not safe
-
-2008-12-04 The InnoDB Team
-
- * handler/ha_innodb.cc, handler/mysql_addons.cc,
- include/mysql_addons.h, trx/trx0i_s.c, win-plugin/win-plugin.diff:
- Remove dependencies to MySQL internals (defining MYSQL_SERVER).
-
-2008-12-02 The InnoDB Team
-
- * page/page0cur.c:
- When allocating space for a record from the free list of previously
- purged records, zero out the DB_TRX_ID and DB_ROLL_PTR of the purged
- record if the new record would not overwrite these fields. This fixes
- a harmless content mismatch reported by page_zip_validate().
-
-2008-12-02 The InnoDB Team
-
- * row/row0merge.c:
- Replace the WHILE 1 with WHILE 1=1 in the SQL procedure, so that the
- loop will actually be entered and temporary indexes be dropped during
- crash recovery.
-
-2008-12-01 The InnoDB Team
-
- InnoDB Plugin 1.0.2 released
-
-2008-10-31 The InnoDB Team
-
- * dict/dict0mem.c, include/dict0mem.h, include/lock0lock.h,
- include/row0mysql.h, include/trx0trx.h, include/univ.i,
- include/ut0vec.h, include/ut0vec.ic, lock/lock0lock.c,
- row/row0mysql.c, trx/trx0trx.c:
- Fix Bug#26316 Triggers create duplicate entries on auto-increment
- columns
-
-2008-10-30 The InnoDB Team
-
- * handler/ha_innodb.cc, handler/handler0vars.h,
- handler/win_delay_loader.cc, mysql-test/innodb_bug40360.result,
- mysql-test/innodb_bug40360.test:
- Fix Bug#40360 Binlog related errors with binlog off
-
-2008-10-29 The InnoDB Team
-
- * include/data0type.ic:
- Fix Bug#40369 dtype_get_sql_null_size() returns 0 or 1, not the size
-
-2008-10-29 The InnoDB Team
-
- * handler/ha_innodb.cc, include/srv0srv.h, srv/srv0srv.c:
- Fix Bug#38189 innodb_stats_on_metadata missing
-
-2008-10-28 The InnoDB Team
-
- * CMakeLists.txt, ha_innodb.def, handler/ha_innodb.cc,
- handler/handler0alter.cc, handler/handler0vars.h, handler/i_s.cc,
- handler/win_delay_loader.cc, win-plugin/*:
- Implemented the delayloading of externals for the plugin on Windows.
- This makes it possible to build a dynamic plugin (ha_innodb.dll) on
- Windows.
-
-2008-10-27 The InnoDB Team
-
- * CMakeLists.txt:
- Fix Bug#19424 InnoDB: Possibly a memory overrun of the buffer being
- freed (64-bit Visual C)
-
-2008-10-23 The InnoDB Team
-
- * ibuf/ibuf0ibuf.c:
- ibuf_delete_rec(): When the cursor to the insert buffer record
- cannot be restored, do not complain if the tablespace does not
- exist, because the insert buffer record may have been discarded by
- some other thread. This bug has existed in MySQL/InnoDB since
- version 4.1, when innodb_file_per_table was implemented.
- This may fix Bug#27276 InnoDB Error: ibuf cursor restoration fails.
-
-2008-10-22 The InnoDB Team
-
- * dict/dict0dict.c, dict/dict0mem.c, handler/ha_innodb.cc,
- handler/ha_innodb.h, include/dict0dict.h, include/dict0mem.h,
- row/row0mysql.c:
- Fix Bug#39830 Table autoinc value not updated on first insert
- Fix Bug#35498 Cannot get table test/table1 auto-inccounter value in
- ::info
- Fix Bug#36411 "Failed to read auto-increment value from storage
- engine" in 5.1.24 auto-inc
-
-2008-10-22 The InnoDB Team
-
- * handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c:
- Fix Bug#40224 New AUTOINC changes mask reporting of deadlock/timeout
- errors
-
-2008-10-16 The InnoDB Team
-
- * dict/dict0dict.c, mysql-test/innodb-index.result,
- mysql-test/innodb-index.test:
- Skip the undo log size check when creating REDUNDANT and COMPACT
- tables. In ROW_FORMAT=DYNAMIC and ROW_FORMAT=COMPRESSED, column
- prefix indexes require that prefixes of externally stored columns
- be written to the undo log. This may make the undo log record
- bigger than the record on the B-tree page. The maximum size of an
- undo log record is the page size. That must be checked for, in
- dict_index_add_to_cache(). However, this restriction must not
- be enforced on REDUNDANT or COMPACT tables.
-
-2008-10-15 The InnoDB Team
-
- * btr/btr0cur.c, include/btr0cur.h, row/row0ext.c, row/row0sel.c,
- row/row0upd.c:
- When the server crashes while freeing an externally stored column
- of a compressed table, the BTR_EXTERN_LEN field in the BLOB
- pointer will be written as 0. Tolerate this in the functions that
- deal with externally stored columns. This fixes problems after
- crash recovery, in the rollback of incomplete transactions, and in
- the purge of delete-marked records.
-
-2008-10-15 The InnoDB Team
-
- * btr/btr0btr.c, include/page0zip.h, page/page0zip.c, include/univ.i:
- When a B-tree node of a compressed table is split or merged, the
- compression may fail. In this case, the entire compressed page
- will be copied and the excess records will be deleted. However,
- page_zip_copy(), now renamed to page_zip_copy_recs(), copied too
- many fields in the page header, overwriting PAGE_BTR_SEG_LEAF and
- PAGE_BTR_SEG_TOP when splitting the B-tree root. This caused
- corruption of compressed tables. Furthermore, the lock table and
- the adaptive hash index would be corrupted, because we forgot to
- update them when invoking page_zip_copy_recs().
-
- Introduce the symbol UNIV_ZIP_DEBUG for triggering the copying of
- compressed pages more often, for debugging purposes.
-
-2008-10-10 The InnoDB Team
-
- * handler/handler0alter.cc, include/row0merge.h, row/row0merge.c,
- row/row0mysql.c:
- Fix some locking issues, mainly in fast index creation. The
- InnoDB data dictionary cache should be latched whenever a
- transaction is holding locks on any data dictionary tables.
- Otherwise, lock waits or deadlocks could occur. Furthermore, the
- data dictionary transaction must be committed (and the locks
- released) before the data dictionary latch is released.
-
- ha_innobase::add_index(): Lock the data dictionary before renaming
- or dropping the created indexes, because neither operation will
- commit the data dictionary transaction.
-
- ha_innobase::final_drop_index(): Commit the transactions before
- unlocking the data dictionary.
-
-2008-10-09 The InnoDB Team
-
- * buf/buf0lru.c:
- Fix Bug#39939 DROP TABLE/DISCARD TABLESPACE takes long time in
- buf_LRU_invalidate_tablespace()
-
-2008-10-08 The InnoDB Team
-
- * dict/dict0crea.c, trx/trx0roll.c, include/row0mysql.h,
- row/row0merge.c, row/row0mysql.c:
- When dropping a table, hold the data dictionary latch until the
- transaction has been committed. The data dictionary latch is
- supposed to prevent lock waits and deadlocks in the data
- dictionary tables. Due to this bug, DROP TABLE could cause a
- deadlock or hang. Note that because of Bug#33650 and Bug#39833,
- MySQL may also drop a (temporary) table when executing CREATE INDEX
- or ALTER TABLE ... ADD INDEX.
-
-2008-10-04 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb_bug39438-master.opt,
- mysql-test/innodb_bug39438.result, mysql-test/innodb_bug39438.test:
- Fix Bug#39438 Testcase for Bug#39436 crashes on 5.1 in
- fil_space_get_latch
-
-2008-10-04 The InnoDB Team
-
- * include/lock0lock.h, lock/lock0lock.c,
- mysql-test/innodb_bug38231.result, mysql-test/innodb_bug38231.test,
- row/row0mysql.c:
- Fix Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE +
- LOCK / UNLOCK
-
-2008-10-04 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#35498 Cannot get table test/table1 auto-inccounter value in
- ::info
-
-2008-10-04 The InnoDB Team
-
- * handler/ha_innodb.cc, handler/ha_innodb.h:
- Fix Bug#37788 InnoDB Plugin: AUTO_INCREMENT wrong for compressed
- tables
-
-2008-10-04 The InnoDB Team
-
- * dict/dict0dict.c, handler/ha_innodb.cc, handler/ha_innodb.h,
- include/dict0dict.h, include/dict0mem.h, row/row0mysql.c:
- Fix Bug#39830 Table autoinc value not updated on first insert
-
-2008-10-03 The InnoDB Team
-
- * mysql-test/innodb-index.test, mysql-test/innodb-index.result,
- mysql-test/innodb-timeout.test, mysql-test/innodb-timeout.result,
- srv/srv0srv.c, include/srv0srv.h, handler/ha_innodb.cc,
- include/ha_prototypes.h:
- Fix Bug#36285 innodb_lock_wait_timeout is not dynamic, not per session
-
-2008-09-19 The InnoDB Team
-
- * os/os0proc.c:
- Fix a memory leak on Windows. The memory leak was due to wrong
- parameters passed into VirtualFree() call. As the result, the
- call fails with Windows error 87.
-
-2008-09-17 The InnoDB Team
-
- * mysql-test/innodb.result, mysql-test/innodb-zip.result,
- mysql-test/innodb-zip.test, mysql-test/innodb.test, ibuf/ibuf0ibuf.c,
- dict/dict0crea.c, dict/dict0load.c, dict/dict0boot.c,
- include/dict0dict.h, include/trx0trx.h, dict/dict0dict.c,
- trx/trx0trx.c, include/ha_prototypes.h, handler/ha_innodb.cc:
- When creating an index in innodb_strict_mode, check that the
- maximum record size will never exceed the B-tree page size limit.
- For uncompressed tables, there should always be enough space for
- two records in an empty B-tree page. For compressed tables, there
- should be enough space for storing two node pointer records or one
- data record in an empty page in uncompressed format.
- The purpose of this check is to guarantee that INSERT or UPDATE
- will never fail due to too big record size.
-
-2008-09-17 The InnoDB Team
-
- * btr/btr0cur.c, data/data0data.c, include/page0zip.h,
- include/page0zip.ic, page/page0zip.c, mysql-test/innodb_bug36172.test:
- Prevent infinite B-tree page splits in compressed tables by
- ensuring that there will always be enough space for two node
- pointer records in an empty B-tree page. Also, require that at
- least one data record will fit in an empty compressed page. This
- will reduce the maximum size of records in compressed tables.
-
-2008-09-09 The InnoDB Team
-
- * mysql-test/innodb.result:
- Fix the failing innodb test by merging changes that MySQL made to
- that file (r2646.12.1 in MySQL BZR repository)
-
-2008-09-09 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,
- mysql-test/innodb-autoinc.test:
- Fix Bug#38839 auto increment does not work properly with InnoDB after
- update
-
-2008-09-09 The InnoDB Team
-
- * dict/dict0dict.c, handler/handler0alter.cc, include/dict0dict.h,
- mysql-test/innodb-index.result, mysql-test/innodb-index.test:
- Fix Bug#38786 InnoDB plugin crashes on drop table/create table with FK
-
-2008-08-21 The InnoDB Team
-
- * handler/ha_innodb.cc, include/ha_prototypes.h, row/row0sel.c:
- Fix Bug#37885 row_search_for_mysql may gap lock unnecessarily with SQL
- comments in query
-
-2008-08-21 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Fix Bug#38185 ha_innobase::info can hold locks even when called with
- HA_STATUS_NO_LOCK
-
-2008-08-18 The InnoDB Team
-
- * buf/buf0buf.c, buf/buf0lru.c, include/buf0buf.ic, include/univ.i:
- Introduce UNIV_LRU_DEBUG for debugging the LRU buffer pool cache
-
-2008-08-08 The InnoDB Team
-
- * buf/buf0lru.c, include/buf0buf.h:
- Fix two recovery bugs that could lead to a crash in debug builds with
- small buffer size
-
-2008-08-07 The InnoDB Team
-
- * btr/btr0cur.c, handler/ha_innodb.cc, include/srv0srv.h,
- srv/srv0srv.c:
- Add a parameter innodb_stats_sample_pages to allow users to control
- the number of index dives when InnoDB estimates the cardinality of
- an index (ANALYZE TABLE, SHOW TABLE STATUS etc)
-
-2008-08-07 The InnoDB Team
-
- * trx/trx0i_s.c:
- Fix a bug that would lead to a crash if a SELECT was issued from the
- INFORMATION_SCHEMA tables and there are rolling back transactions at
- the same time
-
-2008-08-06 The InnoDB Team
-
- * btr/btr0btr.c, btr/btr0cur.c, ibuf/ibuf0ibuf.c, include/btr0cur.h,
- include/trx0roll.h, include/trx0types.h, row/row0purge.c,
- row/row0uins.c, row/row0umod.c, trx/trx0roll.c:
- In the rollback of incomplete transactions after crash recovery,
- tolerate clustered index records whose externally stored columns
- have not been written.
-
-2008-07-30 The InnoDB Team
-
- * trx/trx0trx.c:
- Fixes a race in recovery where the recovery thread recovering a
- PREPARED trx and the background rollback thread can both try
- to free the trx after its status is set to COMMITTED_IN_MEMORY.
-
-2008-07-29 The InnoDB Team
-
- * include/trx0rec.h, row/row0purge.c, row/row0vers.c, trx/trx0rec.c:
- Fix a BLOB corruption bug
-
-2008-07-15 The InnoDB Team
-
- * btr/btr0sea.c, dict/dict0dict.c, include/btr0sea.h:
- Fixed a timing hole where a thread dropping an index can free the
- in-memory index struct while another thread is still using that
- structure to remove entries from adaptive hash index belonging
- to one of the pages that belongs to the index being dropped.
-
-2008-07-04 The InnoDB Team
-
- * mysql-test/innodb-index.result:
- Fix the failing innodb-index test by adjusting the result to a new
- MySQL behavior (the change occured in BZR-r2667)
-
-2008-07-03 The InnoDB Team
-
- * mysql-test/innodb-zip.result, mysql-test/innodb-zip.test:
- Remove the negative test cases that produce warnings
-
-2008-07-02 The InnoDB Team
-
- * mysql-test/innodb-replace.result, mysql-test/innodb-index.test:
- Disable part of innodb-index test because MySQL changed its behavior
- and is not calling ::add_index() anymore when adding primary index on
- non-NULL column
-
-2008-07-01 The InnoDB Team
-
- * mysql-test/innodb-replace.result, mysql-test/innodb-replace.test:
- Fix the failing innodb-replace test by merging changes that MySQL
- made to that file (r2659 in MySQL BZR repository)
-
-2008-07-01 The InnoDB Team
-
- * lock/lock0lock.c:
- Fix Bug#36942 Performance problem in lock_get_n_rec_locks (SHOW INNODB
- STATUS)
-
-2008-07-01 The InnoDB Team
-
- * ha/ha0ha.c:
- Fix Bug#36941 Performance problem in ha_print_info (SHOW INNODB
- STATUS)
-
-2008-07-01 The InnoDB Team
-
- * handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,
- mysql-test/innodb-autoinc.test:
- Fix Bug#37531 After truncate, auto_increment behaves incorrectly for
- InnoDB
-
-2008-06-19 The InnoDB Team
-
- * handler/ha_innodb.cc:
- Rewrite the function innodb_plugin_init() to support parameters in
- different order (in static and dynamic InnoDB) and to support more
- parameters in the static InnoDB
-
-2008-06-19 The InnoDB Team
-
- * handler/handler0alter.cc:
- Fix a bug in ::add_index() which set the transaction state to "active"
- but never restored it to the original value. This bug caused warnings
- to be printed by the rpl.rpl_ddl mysql-test.
-
-2008-06-19 The InnoDB Team
-
- * mysql-test/patches:
- Add a directory which contains patches, which need to be applied to
- MySQL source in order to get some mysql-tests to succeed. The patches
- cannot be committed in MySQL repository because they are specific to
- the InnoDB plugin.
-
-2008-06-19 The InnoDB Team
-
- * mysql-test/innodb-zip.result, mysql-test/innodb-zip.test,
- row/row0row.c:
- Fix an anomaly when updating a record with BLOB prefix
-
-2008-06-18 The InnoDB Team
-
- * include/trx0sys.h, srv/srv0start.c, trx/trx0sys.c:
- Fix a bug in recovery which was a side effect of the file_format_check
- changes
-
-2008-06-09 The InnoDB Team
-
- * mysql-test/innodb.result:
- Fix the failing innodb test by merging changes that MySQL made to that
- file
-
-2008-06-06 The InnoDB Team
-
- * buf/buf0buf.c, handler/ha_innodb.cc, include/buf0buf.h,
- include/srv0srv.h, srv/srv0srv.c:
- Fix Bug#36600 SHOW STATUS takes a lot of CPU in
- buf_get_latched_pages_number
-
- * handler/ha_innodb.cc, os/os0file.c:
- Fix Bug#11894 innodb_file_per_table crashes w/ Windows .sym symbolic
- link hack
-
- * include/ut0ut.h, srv/srv0srv.c, ut/ut0ut.c:
- Fix Bug#36819 ut_usectime does not handle errors from gettimeofday
-
- * handler/ha_innodb.cc:
- Fix Bug#35602 Failed to read auto-increment value from storage engine
-
- * srv/srv0start.c:
- Fix Bug#36149 Read buffer overflow in srv0start.c found during "make
- test"
-
-2008-05-08 The InnoDB Team
-
- * btr/btr0btr.c, mysql-test/innodb_bug36172.result,
- mysql-test/innodb_bug36172.test:
- Fix Bug#36172 insert into compressed innodb table crashes
-
-2008-05-08 The InnoDB Team
-
- InnoDB Plugin 1.0.1 released
-
-2008-05-06 The InnoDB Team
-
- * handler/ha_innodb.cc, include/srv0srv.h, include/sync0sync.h,
- include/trx0sys.h, mysql-test/innodb-zip.result,
- mysql-test/innodb-zip.test, srv/srv0srv.c, srv/srv0start.c,
- sync/sync0sync.c, trx/trx0sys.c:
- Implement the system tablespace tagging
-
- * handler/ha_innodb.cc, handler/i_s.cc, include/univ.i,
- srv/srv0start.c:
- Add InnoDB version in INFORMATION_SCHEMA.PLUGINS.PLUGIN_VERSION,
- in the startup message and in a server variable innodb_version.
-
- * sync/sync0sync.c:
- Fix a bug in the sync debug code where a lock with level
- SYNC_LEVEL_VARYING would cause an assertion failure when a thread
- tried to release it.
-
-2008-04-30 The InnoDB Team
-
- * Makefile.am:
- Fix Bug#36434 ha_innodb.so is installed in the wrong directory
-
- * handler/ha_innodb.cc:
- Merge change from MySQL (Fix Bug#35406 5.1-opt crashes on select from
- I_S.REFERENTIAL_CONSTRAINTS):
- ChangeSet@1.2563, 2008-03-18 19:42:04+04:00, gluh@mysql.com +1 -0
-
- * scripts/install_innodb_plugins.sql:
- Added
-
- * mysql-test/innodb.result:
- Merge change from MySQL (this fixes the failing innodb test):
- ChangeSet@1.1810.3601.4, 2008-02-07 02:33:21+04:00
-
- * row/row0sel.c:
- Fix Bug#35226 RBR event crashes slave
-
- * handler/ha_innodb.cc:
- Change the fix for Bug#32440 to show bytes instead of kilobytes in
- INFORMATION_SCHEMA.TABLES.DATA_FREE
-
- * handler/ha_innodb.cc, mysql-test/innodb.result,
- mysql-test/innodb.test:
- Fix Bug#29507 TRUNCATE shows to many rows effected
-
- * handler/ha_innodb.cc, mysql-test/innodb.result,
- mysql-test/innodb.test:
- Fix Bug#35537 Innodb doesn't increment handler_update and
- handler_delete
-
-2008-04-29 The InnoDB Team
-
- * handler/i_s.cc, include/srv0start.h, srv/srv0start.c:
- Fix Bug#36310 InnoDB plugin crash
-
-2008-04-23 The InnoDB Team
-
- * mysql-test/innodb_bug36169.result, mysql-test/innodb_bug36169.test,
- row/row0mysql.c:
- Fix Bug#36169 create innodb compressed table with too large row size
- crashed
-
- * (outside the source tree):
- Fix Bug#36222 New InnoDB plugin 1.0 has wrong MKDIR_P defined in
- Makefile.in
-
-2008-04-15 The InnoDB Team
-
- InnoDB Plugin 1.0.0 released
diff --git a/storage/xtradb/Doxyfile b/storage/xtradb/Doxyfile
index 62aa7dd8abc..7cf5048fa52 100644
--- a/storage/xtradb/Doxyfile
+++ b/storage/xtradb/Doxyfile
@@ -565,7 +565,7 @@ RECURSIVE = YES
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
-EXCLUDE = ut0auxconf_*
+EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded
diff --git a/storage/xtradb/btr/btr0btr.c b/storage/xtradb/btr/btr0btr.c
index ff047095aa4..c0c27128441 100644
--- a/storage/xtradb/btr/btr0btr.c
+++ b/storage/xtradb/btr/btr0btr.c
@@ -42,6 +42,560 @@ Created 6/2/1994 Heikki Tuuri
#include "ibuf0ibuf.h"
#include "trx0trx.h"
+#ifdef UNIV_BLOB_DEBUG
+# include "srv0srv.h"
+# include "ut0rbt.h"
+
+/** TRUE when messages about index->blobs modification are enabled. */
+static ibool btr_blob_dbg_msg;
+
+/** Issue a message about an operation on index->blobs.
+@param op operation
+@param b the entry being subjected to the operation
+@param ctx the context of the operation */
+#define btr_blob_dbg_msg_issue(op, b, ctx) \
+ fprintf(stderr, op " %u:%u:%u->%u %s(%u,%u,%u)\n", \
+ (b)->ref_page_no, (b)->ref_heap_no, \
+ (b)->ref_field_no, (b)->blob_page_no, ctx, \
+ (b)->owner, (b)->always_owner, (b)->del)
+
+/** Insert to index->blobs a reference to an off-page column.
+@param index the index tree
+@param b the reference
+@param ctx context (for logging) */
+UNIV_INTERN
+void
+btr_blob_dbg_rbt_insert(
+/*====================*/
+ dict_index_t* index, /*!< in/out: index tree */
+ const btr_blob_dbg_t* b, /*!< in: the reference */
+ const char* ctx) /*!< in: context (for logging) */
+{
+ if (btr_blob_dbg_msg) {
+ btr_blob_dbg_msg_issue("insert", b, ctx);
+ }
+ mutex_enter(&index->blobs_mutex);
+ rbt_insert(index->blobs, b, b);
+ mutex_exit(&index->blobs_mutex);
+}
+
+/** Remove from index->blobs a reference to an off-page column.
+@param index the index tree
+@param b the reference
+@param ctx context (for logging) */
+UNIV_INTERN
+void
+btr_blob_dbg_rbt_delete(
+/*====================*/
+ dict_index_t* index, /*!< in/out: index tree */
+ const btr_blob_dbg_t* b, /*!< in: the reference */
+ const char* ctx) /*!< in: context (for logging) */
+{
+ if (btr_blob_dbg_msg) {
+ btr_blob_dbg_msg_issue("delete", b, ctx);
+ }
+ mutex_enter(&index->blobs_mutex);
+ ut_a(rbt_delete(index->blobs, b));
+ mutex_exit(&index->blobs_mutex);
+}
+
+/**************************************************************//**
+Comparator for items (btr_blob_dbg_t) in index->blobs.
+The key in index->blobs is (ref_page_no, ref_heap_no, ref_field_no).
+@return negative, 0 or positive if *a<*b, *a=*b, *a>*b */
+static
+int
+btr_blob_dbg_cmp(
+/*=============*/
+ const void* a, /*!< in: first btr_blob_dbg_t to compare */
+ const void* b) /*!< in: second btr_blob_dbg_t to compare */
+{
+ const btr_blob_dbg_t* aa = a;
+ const btr_blob_dbg_t* bb = b;
+
+ ut_ad(aa != NULL);
+ ut_ad(bb != NULL);
+
+ if (aa->ref_page_no != bb->ref_page_no) {
+ return(aa->ref_page_no < bb->ref_page_no ? -1 : 1);
+ }
+ if (aa->ref_heap_no != bb->ref_heap_no) {
+ return(aa->ref_heap_no < bb->ref_heap_no ? -1 : 1);
+ }
+ if (aa->ref_field_no != bb->ref_field_no) {
+ return(aa->ref_field_no < bb->ref_field_no ? -1 : 1);
+ }
+ return(0);
+}
+
+/**************************************************************//**
+Add a reference to an off-page column to the index->blobs map. */
+UNIV_INTERN
+void
+btr_blob_dbg_add_blob(
+/*==================*/
+ const rec_t* rec, /*!< in: clustered index record */
+ ulint field_no, /*!< in: off-page column number */
+ ulint page_no, /*!< in: start page of the column */
+ dict_index_t* index, /*!< in/out: index tree */
+ const char* ctx) /*!< in: context (for logging) */
+{
+ btr_blob_dbg_t b;
+ const page_t* page = page_align(rec);
+
+ ut_a(index->blobs);
+
+ b.blob_page_no = page_no;
+ b.ref_page_no = page_get_page_no(page);
+ b.ref_heap_no = page_rec_get_heap_no(rec);
+ b.ref_field_no = field_no;
+ ut_a(b.ref_field_no >= index->n_uniq);
+ b.always_owner = b.owner = TRUE;
+ b.del = FALSE;
+ ut_a(!rec_get_deleted_flag(rec, page_is_comp(page)));
+ btr_blob_dbg_rbt_insert(index, &b, ctx);
+}
+
+/**************************************************************//**
+Add to index->blobs any references to off-page columns from a record.
+@return number of references added */
+UNIV_INTERN
+ulint
+btr_blob_dbg_add_rec(
+/*=================*/
+ const rec_t* rec, /*!< in: record */
+ dict_index_t* index, /*!< in/out: index */
+ const ulint* offsets,/*!< in: offsets */
+ const char* ctx) /*!< in: context (for logging) */
+{
+ ulint count = 0;
+ ulint i;
+ btr_blob_dbg_t b;
+ ibool del;
+
+ ut_ad(rec_offs_validate(rec, index, offsets));
+
+ if (!rec_offs_any_extern(offsets)) {
+ return(0);
+ }
+
+ b.ref_page_no = page_get_page_no(page_align(rec));
+ b.ref_heap_no = page_rec_get_heap_no(rec);
+ del = (rec_get_deleted_flag(rec, rec_offs_comp(offsets)) != 0);
+
+ for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+ if (rec_offs_nth_extern(offsets, i)) {
+ ulint len;
+ const byte* field_ref = rec_get_nth_field(
+ rec, offsets, i, &len);
+
+ ut_a(len != UNIV_SQL_NULL);
+ ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
+ field_ref += len - BTR_EXTERN_FIELD_REF_SIZE;
+
+ if (!memcmp(field_ref, field_ref_zero,
+ BTR_EXTERN_FIELD_REF_SIZE)) {
+ /* the column has not been stored yet */
+ continue;
+ }
+
+ b.ref_field_no = i;
+ b.blob_page_no = mach_read_from_4(
+ field_ref + BTR_EXTERN_PAGE_NO);
+ ut_a(b.ref_field_no >= index->n_uniq);
+ b.always_owner = b.owner
+ = !(field_ref[BTR_EXTERN_LEN]
+ & BTR_EXTERN_OWNER_FLAG);
+ b.del = del;
+
+ btr_blob_dbg_rbt_insert(index, &b, ctx);
+ count++;
+ }
+ }
+
+ return(count);
+}
+
+/**************************************************************//**
+Display the references to off-page columns.
+This function is to be called from a debugger,
+for example when a breakpoint on ut_dbg_assertion_failed is hit. */
+UNIV_INTERN
+void
+btr_blob_dbg_print(
+/*===============*/
+ const dict_index_t* index) /*!< in: index tree */
+{
+ const ib_rbt_node_t* node;
+
+ if (!index->blobs) {
+ return;
+ }
+
+ /* We intentionally do not acquire index->blobs_mutex here.
+ This function is to be called from a debugger, and the caller
+ should make sure that the index->blobs_mutex is held. */
+
+ for (node = rbt_first(index->blobs);
+ node != NULL; node = rbt_next(index->blobs, node)) {
+ const btr_blob_dbg_t* b
+ = rbt_value(btr_blob_dbg_t, node);
+ fprintf(stderr, "%u:%u:%u->%u%s%s%s\n",
+ b->ref_page_no, b->ref_heap_no, b->ref_field_no,
+ b->blob_page_no,
+ b->owner ? "" : "(disowned)",
+ b->always_owner ? "" : "(has disowned)",
+ b->del ? "(deleted)" : "");
+ }
+}
+
+/**************************************************************//**
+Remove from index->blobs any references to off-page columns from a record.
+@return number of references removed */
+UNIV_INTERN
+ulint
+btr_blob_dbg_remove_rec(
+/*====================*/
+ const rec_t* rec, /*!< in: record */
+ dict_index_t* index, /*!< in/out: index */
+ const ulint* offsets,/*!< in: offsets */
+ const char* ctx) /*!< in: context (for logging) */
+{
+ ulint i;
+ ulint count = 0;
+ btr_blob_dbg_t b;
+
+ ut_ad(rec_offs_validate(rec, index, offsets));
+
+ if (!rec_offs_any_extern(offsets)) {
+ return(0);
+ }
+
+ b.ref_page_no = page_get_page_no(page_align(rec));
+ b.ref_heap_no = page_rec_get_heap_no(rec);
+
+ for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+ if (rec_offs_nth_extern(offsets, i)) {
+ ulint len;
+ const byte* field_ref = rec_get_nth_field(
+ rec, offsets, i, &len);
+
+ ut_a(len != UNIV_SQL_NULL);
+ ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
+ field_ref += len - BTR_EXTERN_FIELD_REF_SIZE;
+
+ b.ref_field_no = i;
+ b.blob_page_no = mach_read_from_4(
+ field_ref + BTR_EXTERN_PAGE_NO);
+
+ switch (b.blob_page_no) {
+ case 0:
+ /* The column has not been stored yet.
+ The BLOB pointer must be all zero.
+ There cannot be a BLOB starting at
+ page 0, because page 0 is reserved for
+ the tablespace header. */
+ ut_a(!memcmp(field_ref, field_ref_zero,
+ BTR_EXTERN_FIELD_REF_SIZE));
+ /* fall through */
+ case FIL_NULL:
+ /* the column has been freed already */
+ continue;
+ }
+
+ btr_blob_dbg_rbt_delete(index, &b, ctx);
+ count++;
+ }
+ }
+
+ return(count);
+}
+
+/**************************************************************//**
+Check that there are no references to off-page columns from or to
+the given page. Invoked when freeing or clearing a page.
+@return TRUE when no orphan references exist */
+UNIV_INTERN
+ibool
+btr_blob_dbg_is_empty(
+/*==================*/
+ dict_index_t* index, /*!< in: index */
+ ulint page_no) /*!< in: page number */
+{
+ const ib_rbt_node_t* node;
+ ibool success = TRUE;
+
+ if (!index->blobs) {
+ return(success);
+ }
+
+ mutex_enter(&index->blobs_mutex);
+
+ for (node = rbt_first(index->blobs);
+ node != NULL; node = rbt_next(index->blobs, node)) {
+ const btr_blob_dbg_t* b
+ = rbt_value(btr_blob_dbg_t, node);
+
+ if (b->ref_page_no != page_no && b->blob_page_no != page_no) {
+ continue;
+ }
+
+ fprintf(stderr,
+ "InnoDB: orphan BLOB ref%s%s%s %u:%u:%u->%u\n",
+ b->owner ? "" : "(disowned)",
+ b->always_owner ? "" : "(has disowned)",
+ b->del ? "(deleted)" : "",
+ b->ref_page_no, b->ref_heap_no, b->ref_field_no,
+ b->blob_page_no);
+
+ if (b->blob_page_no != page_no || b->owner || !b->del) {
+ success = FALSE;
+ }
+ }
+
+ mutex_exit(&index->blobs_mutex);
+ return(success);
+}
+
+/**************************************************************//**
+Count and process all references to off-page columns on a page.
+@return number of references processed */
+UNIV_INTERN
+ulint
+btr_blob_dbg_op(
+/*============*/
+ const page_t* page, /*!< in: B-tree leaf page */
+ const rec_t* rec, /*!< in: record to start from
+ (NULL to process the whole page) */
+ dict_index_t* index, /*!< in/out: index */
+ const char* ctx, /*!< in: context (for logging) */
+ const btr_blob_dbg_op_f op) /*!< in: operation on records */
+{
+ ulint count = 0;
+ mem_heap_t* heap = NULL;
+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ ulint* offsets = offsets_;
+ rec_offs_init(offsets_);
+
+ ut_a(fil_page_get_type(page) == FIL_PAGE_INDEX);
+ ut_a(!rec || page_align(rec) == page);
+
+ if (!index->blobs || !page_is_leaf(page)
+ || !dict_index_is_clust(index)) {
+ return(0);
+ }
+
+ if (rec == NULL) {
+ rec = page_get_infimum_rec(page);
+ }
+
+ do {
+ offsets = rec_get_offsets(rec, index, offsets,
+ ULINT_UNDEFINED, &heap);
+ count += op(rec, index, offsets, ctx);
+ rec = page_rec_get_next_const(rec);
+ } while (!page_rec_is_supremum(rec));
+
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
+ }
+
+ return(count);
+}
+
+/**************************************************************//**
+Count and add to index->blobs any references to off-page columns
+from records on a page.
+@return number of references added */
+UNIV_INTERN
+ulint
+btr_blob_dbg_add(
+/*=============*/
+ const page_t* page, /*!< in: rewritten page */
+ dict_index_t* index, /*!< in/out: index */
+ const char* ctx) /*!< in: context (for logging) */
+{
+ btr_blob_dbg_assert_empty(index, page_get_page_no(page));
+
+ return(btr_blob_dbg_op(page, NULL, index, ctx, btr_blob_dbg_add_rec));
+}
+
+/**************************************************************//**
+Count and remove from index->blobs any references to off-page columns
+from records on a page.
+Used when reorganizing a page, before copying the records.
+@return number of references removed */
+UNIV_INTERN
+ulint
+btr_blob_dbg_remove(
+/*================*/
+ const page_t* page, /*!< in: b-tree page */
+ dict_index_t* index, /*!< in/out: index */
+ const char* ctx) /*!< in: context (for logging) */
+{
+ ulint count;
+
+ count = btr_blob_dbg_op(page, NULL, index, ctx,
+ btr_blob_dbg_remove_rec);
+
+ /* Check that no references exist. */
+ btr_blob_dbg_assert_empty(index, page_get_page_no(page));
+
+ return(count);
+}
+
+/**************************************************************//**
+Restore in index->blobs any references to off-page columns
+Used when page reorganize fails due to compressed page overflow. */
+UNIV_INTERN
+void
+btr_blob_dbg_restore(
+/*=================*/
+ const page_t* npage, /*!< in: page that failed to compress */
+ const page_t* page, /*!< in: copy of original page */
+ dict_index_t* index, /*!< in/out: index */
+ const char* ctx) /*!< in: context (for logging) */
+{
+ ulint removed;
+ ulint added;
+
+ ut_a(page_get_page_no(npage) == page_get_page_no(page));
+ ut_a(page_get_space_id(npage) == page_get_space_id(page));
+
+ removed = btr_blob_dbg_remove(npage, index, ctx);
+ added = btr_blob_dbg_add(page, index, ctx);
+ ut_a(added == removed);
+}
+
+/**************************************************************//**
+Modify the 'deleted' flag of a record. */
+UNIV_INTERN
+void
+btr_blob_dbg_set_deleted_flag(
+/*==========================*/
+ const rec_t* rec, /*!< in: record */
+ dict_index_t* index, /*!< in/out: index */
+ const ulint* offsets,/*!< in: rec_get_offs(rec, index) */
+ ibool del) /*!< in: TRUE=deleted, FALSE=exists */
+{
+ const ib_rbt_node_t* node;
+ btr_blob_dbg_t b;
+ btr_blob_dbg_t* c;
+ ulint i;
+
+ ut_ad(rec_offs_validate(rec, index, offsets));
+ ut_a(dict_index_is_clust(index));
+ ut_a(del == !!del);/* must be FALSE==0 or TRUE==1 */
+
+ if (!rec_offs_any_extern(offsets) || !index->blobs) {
+
+ return;
+ }
+
+ b.ref_page_no = page_get_page_no(page_align(rec));
+ b.ref_heap_no = page_rec_get_heap_no(rec);
+
+ for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+ if (rec_offs_nth_extern(offsets, i)) {
+ ulint len;
+ const byte* field_ref = rec_get_nth_field(
+ rec, offsets, i, &len);
+
+ ut_a(len != UNIV_SQL_NULL);
+ ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
+ field_ref += len - BTR_EXTERN_FIELD_REF_SIZE;
+
+ b.ref_field_no = i;
+ b.blob_page_no = mach_read_from_4(
+ field_ref + BTR_EXTERN_PAGE_NO);
+
+ switch (b.blob_page_no) {
+ case 0:
+ ut_a(memcmp(field_ref, field_ref_zero,
+ BTR_EXTERN_FIELD_REF_SIZE));
+ /* page number 0 is for the
+ page allocation bitmap */
+ case FIL_NULL:
+ /* the column has been freed already */
+ ut_error;
+ }
+
+ mutex_enter(&index->blobs_mutex);
+ node = rbt_lookup(index->blobs, &b);
+ ut_a(node);
+
+ c = rbt_value(btr_blob_dbg_t, node);
+ /* The flag should be modified. */
+ c->del = del;
+ if (btr_blob_dbg_msg) {
+ b = *c;
+ mutex_exit(&index->blobs_mutex);
+ btr_blob_dbg_msg_issue("del_mk", &b, "");
+ } else {
+ mutex_exit(&index->blobs_mutex);
+ }
+ }
+ }
+}
+
+/**************************************************************//**
+Change the ownership of an off-page column. */
+UNIV_INTERN
+void
+btr_blob_dbg_owner(
+/*===============*/
+ const rec_t* rec, /*!< in: record */
+ dict_index_t* index, /*!< in/out: index */
+ const ulint* offsets,/*!< in: rec_get_offs(rec, index) */
+ ulint i, /*!< in: ith field in rec */
+ ibool own) /*!< in: TRUE=owned, FALSE=disowned */
+{
+ const ib_rbt_node_t* node;
+ btr_blob_dbg_t b;
+ const byte* field_ref;
+ ulint len;
+
+ ut_ad(rec_offs_validate(rec, index, offsets));
+ ut_a(rec_offs_nth_extern(offsets, i));
+
+ field_ref = rec_get_nth_field(rec, offsets, i, &len);
+ ut_a(len != UNIV_SQL_NULL);
+ ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
+ field_ref += len - BTR_EXTERN_FIELD_REF_SIZE;
+
+ b.ref_page_no = page_get_page_no(page_align(rec));
+ b.ref_heap_no = page_rec_get_heap_no(rec);
+ b.ref_field_no = i;
+ b.owner = !(field_ref[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG);
+ b.blob_page_no = mach_read_from_4(field_ref + BTR_EXTERN_PAGE_NO);
+
+ ut_a(b.owner == own);
+
+ mutex_enter(&index->blobs_mutex);
+ node = rbt_lookup(index->blobs, &b);
+ /* row_ins_clust_index_entry_by_modify() invokes
+ btr_cur_unmark_extern_fields() also for the newly inserted
+ references, which are all zero bytes until the columns are stored.
+ The node lookup must fail if and only if that is the case. */
+ ut_a(!memcmp(field_ref, field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE)
+ == !node);
+
+ if (node) {
+ btr_blob_dbg_t* c = rbt_value(btr_blob_dbg_t, node);
+ /* Some code sets ownership from TRUE to TRUE.
+ We do not allow changing ownership from FALSE to FALSE. */
+ ut_a(own || c->owner);
+
+ c->owner = own;
+ if (!own) {
+ c->always_owner = FALSE;
+ }
+ }
+
+ mutex_exit(&index->blobs_mutex);
+}
+#endif /* UNIV_BLOB_DEBUG */
+
/*
Latching strategy of the InnoDB B-tree
--------------------------------------
@@ -289,7 +843,7 @@ btr_get_next_user_rec(
/**************************************************************//**
Creates a new index page (not the root, and also not
used in page reorganization). @see btr_page_empty(). */
-static
+UNIV_INTERN
void
btr_page_create(
/*============*/
@@ -302,6 +856,7 @@ btr_page_create(
page_t* page = buf_block_get_frame(block);
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
+ btr_blob_dbg_assert_empty(index, buf_block_get_page_no(block));
if (UNIV_LIKELY_NULL(page_zip)) {
page_create_zip(block, index, level, mtr);
@@ -501,6 +1056,7 @@ btr_page_free_low(
modify clock */
buf_block_modify_clock_inc(block);
+ btr_blob_dbg_assert_empty(index, buf_block_get_page_no(block));
if (dict_index_is_ibuf(index)) {
@@ -631,6 +1187,7 @@ btr_page_get_father_node_ptr_func(
ut_ad(dict_index_get_page(index) != page_no);
level = btr_page_get_level(btr_cur_get_page(cursor), mtr);
+
user_rec = btr_cur_get_rec(cursor);
ut_a(page_rec_is_user_rec(user_rec));
tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, level);
@@ -675,7 +1232,7 @@ btr_page_get_father_node_ptr_func(
" to fix the\n"
"InnoDB: corruption. If the crash happens at "
"the database startup, see\n"
- "InnoDB: " REFMAN "forcing-recovery.html about\n"
+ "InnoDB: " REFMAN "forcing-innodb-recovery.html about\n"
"InnoDB: forcing recovery. "
"Then dump + drop + reimport.\n", stderr);
@@ -746,7 +1303,7 @@ btr_create(
ulint space, /*!< in: space where created */
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
- dulint index_id,/*!< in: index id */
+ index_id_t index_id,/*!< in: index id */
dict_index_t* index, /*!< in: index */
mtr_t* mtr) /*!< in: mini-transaction handle */
{
@@ -785,6 +1342,14 @@ btr_create(
block = buf_page_get(space, zip_size, page_no,
RW_X_LATCH, mtr);
} else {
+#ifdef UNIV_BLOB_DEBUG
+ if ((type & DICT_CLUSTERED) && !index->blobs) {
+ mutex_create(PFS_NOT_INSTRUMENTED,
+ &index->blobs_mutex, SYNC_ANY_LATCH);
+ index->blobs = rbt_create(sizeof(btr_blob_dbg_t),
+ btr_blob_dbg_cmp);
+ }
+#endif /* UNIV_BLOB_DEBUG */
block = fseg_create(space, 0,
PAGE_HEADER + PAGE_BTR_SEG_TOP, mtr);
}
@@ -953,7 +1518,7 @@ btr_free_root(
}
ut_a(block);
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, NULL);
header = buf_block_get_frame(block) + PAGE_HEADER + PAGE_BTR_SEG_TOP;
#ifdef UNIV_BTR_DEBUG
@@ -979,6 +1544,7 @@ btr_page_reorganize_low(
dict_index_t* index, /*!< in: record descriptor */
mtr_t* mtr) /*!< in: mtr */
{
+ buf_pool_t* buf_pool = buf_pool_from_bpage(&block->page);
page_t* page = buf_block_get_frame(block);
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
buf_block_t* temp_block;
@@ -1009,7 +1575,7 @@ btr_page_reorganize_low(
log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
#ifndef UNIV_HOTBACKUP
- temp_block = buf_block_alloc(0);
+ temp_block = buf_block_alloc(buf_pool);
#else /* !UNIV_HOTBACKUP */
ut_ad(block == back_block1);
temp_block = back_block2;
@@ -1021,11 +1587,12 @@ btr_page_reorganize_low(
#ifndef UNIV_HOTBACKUP
if (UNIV_LIKELY(!recovery)) {
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, index);
}
block->check_index_page_at_flush = TRUE;
#endif /* !UNIV_HOTBACKUP */
+ btr_blob_dbg_remove(page, index, "btr_page_reorganize");
/* Recreate the page: note that global data on page (possible
segment headers, next page-field, etc.) is preserved intact */
@@ -1046,7 +1613,7 @@ btr_page_reorganize_low(
/* In crash recovery, dict_index_is_sec_or_ibuf() always
returns TRUE, even for clustered indexes. max_trx_id is
unused in clustered index pages. */
- ut_ad(!ut_dulint_is_zero(max_trx_id) || recovery);
+ ut_ad(max_trx_id != 0 || recovery);
}
if (UNIV_LIKELY_NULL(page_zip)
@@ -1054,6 +1621,8 @@ btr_page_reorganize_low(
(!page_zip_compress(page_zip, page, index, NULL))) {
/* Restore the old page and exit. */
+ btr_blob_dbg_restore(page, temp_page, index,
+ "btr_page_reorganize_compress_fail");
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/* Check that the bytes that we skip are identical. */
@@ -1168,7 +1737,7 @@ btr_parse_page_reorganize(
#ifndef UNIV_HOTBACKUP
/*************************************************************//**
Empties an index page. @see btr_page_create(). */
-static
+UNIV_INTERN
void
btr_page_empty(
/*===========*/
@@ -1186,7 +1755,8 @@ btr_page_empty(
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, index);
+ btr_blob_dbg_remove(page, index, "btr_page_empty");
/* Recreate the page: note that global data on page (possible
segment headers, next page-field, etc.) is preserved intact */
@@ -1729,7 +2299,7 @@ btr_insert_on_non_leaf_level_func(
/**************************************************************//**
Attaches the halves of an index page on the appropriate level in an
index tree. */
-static
+UNIV_INTERN
void
btr_attach_half_pages(
/*==================*/
@@ -1925,7 +2495,6 @@ btr_page_split_and_insert(
buf_block_t* left_block;
buf_block_t* right_block;
buf_block_t* insert_block;
- page_t* insert_page;
page_cur_t* page_cursor;
rec_t* first_rec;
byte* buf = 0; /* remove warning */
@@ -2183,8 +2752,6 @@ insert_empty:
insert_block = right_block;
}
- insert_page = buf_block_get_frame(insert_block);
-
/* 7. Reposition the cursor for insert and try insertion */
page_cursor = btr_cur_get_page_cur(cursor);
@@ -2196,8 +2763,12 @@ insert_empty:
#ifdef UNIV_ZIP_DEBUG
{
+ page_t* insert_page
+ = buf_block_get_frame(insert_block);
+
page_zip_des_t* insert_page_zip
= buf_block_get_page_zip(insert_block);
+
ut_a(!insert_page_zip
|| page_zip_validate(insert_page_zip, insert_page));
}
@@ -2494,7 +3065,7 @@ btr_lift_page_up(
mem_heap_free(heap);
}
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, index);
/* Make the father empty */
btr_page_empty(father_block, father_page_zip, index, page_level, mtr);
@@ -2526,6 +3097,7 @@ btr_lift_page_up(
index);
}
+ btr_blob_dbg_remove(page, index, "btr_lift_page_up");
lock_update_copy_and_discard(father_block, block);
/* Go upward to root page, decrementing levels by one. */
@@ -2590,7 +3162,6 @@ btr_compress(
ulint n_recs;
ulint max_ins_size;
ulint max_ins_size_reorg;
- ulint level;
block = btr_cur_get_block(cursor);
page = btr_cur_get_page(cursor);
@@ -2600,7 +3171,6 @@ btr_compress(
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
- level = btr_page_get_level(page, mtr);
space = dict_index_get_space(index);
zip_size = dict_table_zip_size(index->table);
@@ -2719,7 +3289,7 @@ err_exit:
goto err_exit;
}
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, index);
/* Remove the page from the level list */
btr_level_list_remove(space, zip_size, page, mtr);
@@ -2760,7 +3330,7 @@ err_exit:
goto err_exit;
}
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, index);
#ifdef UNIV_BTR_DEBUG
if (UNIV_LIKELY_NULL(merge_page_zip)) {
@@ -2789,6 +3359,7 @@ err_exit:
lock_update_merge_right(merge_block, orig_succ, block);
}
+ btr_blob_dbg_remove(page, index, "btr_compress");
mem_heap_free(heap);
if (!dict_index_is_clust(index) && page_is_leaf(merge_page)) {
@@ -2874,7 +3445,7 @@ btr_discard_only_page_on_level(
ut_a(btr_page_get_next(page, mtr) == FIL_NULL);
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, index);
btr_page_get_father(index, block, mtr, &cursor);
father = btr_cur_get_block(&cursor);
@@ -2909,7 +3480,7 @@ btr_discard_only_page_on_level(
ibuf_reset_free_bits(block);
if (page_is_leaf(buf_block_get_frame(block))) {
- ut_a(!ut_dulint_is_zero(max_trx_id));
+ ut_a(max_trx_id);
page_set_max_trx_id(block,
buf_block_get_page_zip(block),
max_trx_id, mtr);
@@ -2979,7 +3550,7 @@ btr_discard_page(
page = buf_block_get_frame(block);
ut_a(page_is_comp(merge_page) == page_is_comp(page));
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, index);
if (left_page_no == FIL_NULL && !page_is_leaf(page)) {
@@ -3019,6 +3590,8 @@ btr_discard_page(
block);
}
+ btr_blob_dbg_remove(page, index, "btr_discard_page");
+
/* Free the file page */
btr_page_free(index, block, mtr);
diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c
index 3fc2b48162a..f6ef44e5b5c 100644
--- a/storage/xtradb/btr/btr0cur.c
+++ b/storage/xtradb/btr/btr0cur.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -57,6 +57,8 @@ Created 10/16/1994 Heikki Tuuri
#include "buf0lru.h"
#include "btr0btr.h"
#include "btr0sea.h"
+#include "row0purge.h"
+#include "row0upd.h"
#include "trx0rec.h"
#include "trx0roll.h" /* trx_is_recv() */
#include "que0que.h"
@@ -66,6 +68,15 @@ Created 10/16/1994 Heikki Tuuri
#include "lock0lock.h"
#include "zlib.h"
+/** Buffered B-tree operation types, introduced as part of delete buffering. */
+typedef enum btr_op_enum {
+ BTR_NO_OP = 0, /*!< Not buffered */
+ BTR_INSERT_OP, /*!< Insert, do not ignore UNIQUE */
+ BTR_INSERT_IGNORE_UNIQUE_OP, /*!< Insert, ignoring UNIQUE */
+ BTR_DELETE_OP, /*!< Purge a delete-marked record */
+ BTR_DELMARK_OP /*!< Mark a record for deletion */
+} btr_op_t;
+
#ifdef UNIV_DEBUG
/** If the following is set to TRUE, this module prints a lot of
trace information of individual record operations */
@@ -100,6 +111,18 @@ can be released by page reorganize, then it is reorganized */
/*--------------------------------------*/
#define BTR_BLOB_HDR_SIZE 8 /*!< Size of a BLOB
part header, in bytes */
+
+/** Estimated table level stats from sampled value.
+@param value sampled stats
+@param index index being sampled
+@param sample number of sampled rows
+@param ext_size external stored data size
+@param not_empty table not empty
+@return estimated table wide stats from sampled value */
+#define BTR_TABLE_STATS_FROM_SAMPLE(value, index, sample, ext_size, not_empty)\
+ (((value) * (ib_int64_t) index->stat_n_leaf_pages \
+ + (sample) - 1 + (ext_size) + (not_empty)) / ((sample) + (ext_size)))
+
/* @} */
#endif /* !UNIV_HOTBACKUP */
@@ -174,7 +197,7 @@ static
ulint
btr_rec_get_externally_stored_len(
/*==============================*/
- rec_t* rec, /*!< in: record */
+ const rec_t* rec, /*!< in: record */
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
#endif /* !UNIV_HOTBACKUP */
@@ -358,7 +381,8 @@ btr_cur_search_to_nth_level(
Inserts should always be made using
PAGE_CUR_LE to search the position! */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ..., ORed with
- BTR_INSERT and BTR_ESTIMATE;
+ at most one of BTR_INSERT, BTR_DELETE_MARK,
+ BTR_DELETE, or BTR_ESTIMATE;
cursor->left_block is used to store a pointer
to the left neighbor page, in the cases
BTR_SEARCH_PREV and BTR_MODIFY_PREV;
@@ -376,23 +400,26 @@ btr_cur_search_to_nth_level(
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
- page_cur_t* page_cursor;
page_t* page;
+ buf_block_t* block;
+ ulint space;
buf_block_t* guess;
- rec_t* node_ptr;
+ ulint height;
ulint page_no;
- ulint space;
ulint up_match;
ulint up_bytes;
ulint low_match;
ulint low_bytes;
- ulint height;
ulint savepoint;
+ ulint rw_latch;
ulint page_mode;
- ulint insert_planned;
+ ulint buf_mode;
ulint estimate;
- ulint ignore_sec_unique;
+ ulint zip_size;
+ page_cur_t* page_cursor;
+ btr_op_t btr_op;
ulint root_height = 0; /* remove warning */
+
#ifdef BTR_CUR_ADAPT
btr_search_t* info;
#endif
@@ -405,24 +432,60 @@ btr_cur_search_to_nth_level(
ut_ad(level == 0 || mode == PAGE_CUR_LE);
ut_ad(dict_index_check_search_tuple(index, tuple));
- ut_ad(!dict_index_is_ibuf(index) || ibuf_inside());
+ ut_ad(!dict_index_is_ibuf(index) || ibuf_inside(mtr));
ut_ad(dtuple_check_typed(tuple));
#ifdef UNIV_DEBUG
cursor->up_match = ULINT_UNDEFINED;
cursor->low_match = ULINT_UNDEFINED;
#endif
- insert_planned = latch_mode & BTR_INSERT;
+
+ /* These flags are mutually exclusive, they are lumped together
+ with the latch mode for historical reasons. It's possible for
+ none of the flags to be set. */
+ switch (UNIV_EXPECT(latch_mode
+ & (BTR_INSERT | BTR_DELETE | BTR_DELETE_MARK),
+ 0)) {
+ case 0:
+ btr_op = BTR_NO_OP;
+ break;
+ case BTR_INSERT:
+ btr_op = (latch_mode & BTR_IGNORE_SEC_UNIQUE)
+ ? BTR_INSERT_IGNORE_UNIQUE_OP
+ : BTR_INSERT_OP;
+ break;
+ case BTR_DELETE:
+ btr_op = BTR_DELETE_OP;
+ ut_a(cursor->purge_node);
+ break;
+ case BTR_DELETE_MARK:
+ btr_op = BTR_DELMARK_OP;
+ break;
+ default:
+ /* only one of BTR_INSERT, BTR_DELETE, BTR_DELETE_MARK
+ should be specified at a time */
+ ut_error;
+ }
+
+ /* Operations on the insert buffer tree cannot be buffered. */
+ ut_ad(btr_op == BTR_NO_OP || !dict_index_is_ibuf(index));
+ /* Operations on the clustered index cannot be buffered. */
+ ut_ad(btr_op == BTR_NO_OP || !dict_index_is_clust(index));
+
estimate = latch_mode & BTR_ESTIMATE;
- ignore_sec_unique = latch_mode & BTR_IGNORE_SEC_UNIQUE;
- latch_mode = latch_mode & ~(BTR_INSERT | BTR_ESTIMATE
- | BTR_IGNORE_SEC_UNIQUE);
- ut_ad(!insert_planned || (mode == PAGE_CUR_LE));
+ /* Turn the flags unrelated to the latch mode off. */
+ latch_mode &= ~(BTR_INSERT
+ | BTR_DELETE_MARK
+ | BTR_DELETE
+ | BTR_ESTIMATE
+ | BTR_IGNORE_SEC_UNIQUE);
cursor->flag = BTR_CUR_BINARY;
cursor->index = index;
+ cursor->ibuf_cnt = ULINT_UNDEFINED;
+
#ifndef BTR_CUR_ADAPT
guess = NULL;
#else
@@ -435,8 +498,9 @@ btr_cur_search_to_nth_level(
#ifdef UNIV_SEARCH_PERF_STAT
info->n_searches++;
#endif
- if (rw_lock_get_writer(&btr_search_latch) == RW_LOCK_NOT_LOCKED
- && latch_mode <= BTR_MODIFY_LEAF && info->last_hash_succ
+ if (rw_lock_get_writer(btr_search_get_latch(cursor->index->id)) == RW_LOCK_NOT_LOCKED
+ && latch_mode <= BTR_MODIFY_LEAF
+ && info->last_hash_succ
&& !estimate
#ifdef PAGE_CUR_LE_OR_EXTENDS
&& mode != PAGE_CUR_LE_OR_EXTENDS
@@ -470,7 +534,7 @@ btr_cur_search_to_nth_level(
if (has_search_latch) {
/* Release possible search latch to obey latching order */
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(cursor->index->id));
}
/* Store the position of the tree latch we push to mtr so that we
@@ -525,176 +589,242 @@ btr_cur_search_to_nth_level(
/* Loop and search until we arrive at the desired level */
- for (;;) {
- ulint zip_size;
- buf_block_t* block;
- ulint rw_latch;
- ulint buf_mode;
+search_loop:
+ buf_mode = BUF_GET;
+ rw_latch = RW_NO_LATCH;
- zip_size = dict_table_zip_size(index->table);
- rw_latch = RW_NO_LATCH;
- buf_mode = BUF_GET;
+ if (height != 0) {
+ /* We are about to fetch the root or a non-leaf page. */
+ } else if (latch_mode <= BTR_MODIFY_LEAF) {
+ rw_latch = latch_mode;
- if (height == 0 && latch_mode <= BTR_MODIFY_LEAF) {
+ if (btr_op != BTR_NO_OP
+ && ibuf_should_try(index, btr_op != BTR_INSERT_OP)) {
- rw_latch = latch_mode;
+ /* Try to buffer the operation if the leaf
+ page is not in the buffer pool. */
- if (insert_planned
- && ibuf_should_try(index, ignore_sec_unique)) {
+ buf_mode = btr_op == BTR_DELETE_OP
+ ? BUF_GET_IF_IN_POOL_OR_WATCH
+ : BUF_GET_IF_IN_POOL;
+ }
+ }
- /* Try insert to the insert buffer if the
- page is not in the buffer pool */
+ zip_size = dict_table_zip_size(index->table);
- buf_mode = BUF_GET_IF_IN_POOL;
+retry_page_get:
+ block = buf_page_get_gen(
+ space, zip_size, page_no, rw_latch, guess, buf_mode,
+ file, line, mtr);
+
+ if (block == NULL) {
+ if (srv_pass_corrupt_table
+ && buf_mode != BUF_GET_IF_IN_POOL
+ && buf_mode != BUF_GET_IF_IN_POOL_OR_WATCH) {
+ page_cursor->block = 0;
+ page_cursor->rec = 0;
+ if (estimate) {
+ cursor->path_arr->nth_rec = ULINT_UNDEFINED;
}
+ goto func_exit;
}
+ ut_a(buf_mode == BUF_GET_IF_IN_POOL
+ || buf_mode == BUF_GET_IF_IN_POOL_OR_WATCH);
-retry_page_get:
- block = buf_page_get_gen(space, zip_size, page_no,
- rw_latch, guess, buf_mode,
- file, line, mtr);
- if (block == NULL) {
- if (srv_pass_corrupt_table && buf_mode != BUF_GET_IF_IN_POOL) {
- page_cursor->block = 0;
- page_cursor->rec = 0;
- if (estimate) {
- cursor->path_arr->nth_rec = ULINT_UNDEFINED;
- }
- break;
- }
- ut_a(buf_mode == BUF_GET_IF_IN_POOL);
+ /* This must be a search to perform an insert/delete
+ mark/ delete; try using the insert/delete buffer */
- /* This must be a search to perform an insert;
- try insert to the insert buffer */
+ ut_ad(height == 0);
+ ut_ad(cursor->thr);
+ switch (btr_op) {
+ case BTR_INSERT_OP:
+ case BTR_INSERT_IGNORE_UNIQUE_OP:
ut_ad(buf_mode == BUF_GET_IF_IN_POOL);
- ut_ad(insert_planned);
- ut_ad(cursor->thr);
- if (ibuf_insert(tuple, index, space, zip_size,
- page_no, cursor->thr)) {
- /* Insertion to the insert buffer succeeded */
+ if (ibuf_insert(IBUF_OP_INSERT, tuple, index,
+ space, zip_size, page_no,
+ cursor->thr)) {
+
cursor->flag = BTR_CUR_INSERT_TO_IBUF;
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
+
goto func_exit;
}
+ break;
- /* Insert to the insert buffer did not succeed:
- retry page get */
-
- buf_mode = BUF_GET;
+ case BTR_DELMARK_OP:
+ ut_ad(buf_mode == BUF_GET_IF_IN_POOL);
- goto retry_page_get;
- }
+ if (ibuf_insert(IBUF_OP_DELETE_MARK, tuple,
+ index, space, zip_size,
+ page_no, cursor->thr)) {
- page = buf_block_get_frame(block);
+ cursor->flag = BTR_CUR_DEL_MARK_IBUF;
- if (srv_pass_corrupt_table && !page) {
- page_cursor->block = 0;
- page_cursor->rec = 0;
- if (estimate) {
- cursor->path_arr->nth_rec = ULINT_UNDEFINED;
+ goto func_exit;
}
+
break;
- }
- ut_a(page);
- block->check_index_page_at_flush = TRUE;
+ case BTR_DELETE_OP:
+ ut_ad(buf_mode == BUF_GET_IF_IN_POOL_OR_WATCH);
- if (rw_latch != RW_NO_LATCH) {
-#ifdef UNIV_ZIP_DEBUG
- const page_zip_des_t* page_zip
- = buf_block_get_page_zip(block);
- ut_a(!page_zip || page_zip_validate(page_zip, page));
-#endif /* UNIV_ZIP_DEBUG */
+ if (!row_purge_poss_sec(cursor->purge_node,
+ index, tuple)) {
+
+ /* The record cannot be purged yet. */
+ cursor->flag = BTR_CUR_DELETE_REF;
+ } else if (ibuf_insert(IBUF_OP_DELETE, tuple,
+ index, space, zip_size,
+ page_no,
+ cursor->thr)) {
+
+ /* The purge was buffered. */
+ cursor->flag = BTR_CUR_DELETE_IBUF;
+ } else {
+ /* The purge could not be buffered. */
+ buf_pool_watch_unset(space, page_no);
+ break;
+ }
- buf_block_dbg_add_level(block, SYNC_TREE_NODE);
+ buf_pool_watch_unset(space, page_no);
+ goto func_exit;
+
+ default:
+ ut_error;
}
- ut_ad(0 == ut_dulint_cmp(index->id,
- btr_page_get_index_id(page)));
+ /* Insert to the insert/delete buffer did not succeed, we
+ must read the page from disk. */
- if (UNIV_UNLIKELY(height == ULINT_UNDEFINED)) {
- /* We are in the root node */
+ buf_mode = BUF_GET;
- height = btr_page_get_level(page, mtr);
- root_height = height;
- cursor->tree_height = root_height + 1;
-#ifdef BTR_CUR_ADAPT
- if (block != guess) {
- info->root_guess = block;
- }
-#endif
+ goto retry_page_get;
+ }
+
+ block->check_index_page_at_flush = TRUE;
+ page = buf_block_get_frame(block);
+
+ if (srv_pass_corrupt_table && !page) {
+ page_cursor->block = 0;
+ page_cursor->rec = 0;
+ if (estimate) {
+ cursor->path_arr->nth_rec = ULINT_UNDEFINED;
}
+ goto func_exit;
+ }
+ ut_a(page);
- if (height == 0) {
- if (rw_latch == RW_NO_LATCH) {
+ if (rw_latch != RW_NO_LATCH) {
+#ifdef UNIV_ZIP_DEBUG
+ const page_zip_des_t* page_zip
+ = buf_block_get_page_zip(block);
+ ut_a(!page_zip || page_zip_validate(page_zip, page));
+#endif /* UNIV_ZIP_DEBUG */
- btr_cur_latch_leaves(page, space, zip_size,
- page_no, latch_mode,
- cursor, mtr);
- }
+ buf_block_dbg_add_level(block, SYNC_TREE_NODE);
+ }
- if ((latch_mode != BTR_MODIFY_TREE)
- && (latch_mode != BTR_CONT_MODIFY_TREE)) {
+ ut_ad(index->id == btr_page_get_index_id(page));
- /* Release the tree s-latch */
+ if (UNIV_UNLIKELY(height == ULINT_UNDEFINED)) {
+ /* We are in the root node */
- mtr_release_s_latch_at_savepoint(
- mtr, savepoint,
- dict_index_get_lock(index));
- }
+ height = btr_page_get_level(page, mtr);
+ root_height = height;
+ cursor->tree_height = root_height + 1;
- page_mode = mode;
+#ifdef BTR_CUR_ADAPT
+ if (block != guess) {
+ info->root_guess = block;
}
+#endif
+ }
- page_cur_search_with_match(block, index, tuple, page_mode,
- &up_match, &up_bytes,
- &low_match, &low_bytes,
- page_cursor);
+ if (height == 0) {
+ if (rw_latch == RW_NO_LATCH) {
- if (estimate) {
- btr_cur_add_path_info(cursor, height, root_height);
+ btr_cur_latch_leaves(
+ page, space, zip_size, page_no, latch_mode,
+ cursor, mtr);
}
- /* If this is the desired level, leave the loop */
+ if (latch_mode != BTR_MODIFY_TREE
+ && latch_mode != BTR_CONT_MODIFY_TREE) {
- ut_ad(height == btr_page_get_level(
- page_cur_get_page(page_cursor), mtr));
+ /* Release the tree s-latch */
- if (level == height) {
+ mtr_release_s_latch_at_savepoint(
+ mtr, savepoint, dict_index_get_lock(index));
+ }
- if (level > 0) {
- /* x-latch the page */
- page = btr_page_get(space, zip_size,
- page_no, RW_X_LATCH, mtr);
- ut_a((ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
- }
+ page_mode = mode;
+ }
- break;
- }
+ page_cur_search_with_match(
+ block, index, tuple, page_mode, &up_match, &up_bytes,
+ &low_match, &low_bytes, page_cursor);
+
+ if (estimate) {
+ btr_cur_add_path_info(cursor, height, root_height);
+ }
+
+ /* If this is the desired level, leave the loop */
+
+ ut_ad(height == btr_page_get_level(page_cur_get_page(page_cursor),
+ mtr));
+ if (level != height) {
+
+ const rec_t* node_ptr;
ut_ad(height > 0);
height--;
-
guess = NULL;
node_ptr = page_cur_get_rec(page_cursor);
- offsets = rec_get_offsets(node_ptr, cursor->index, offsets,
- ULINT_UNDEFINED, &heap);
+
+ offsets = rec_get_offsets(
+ node_ptr, index, offsets, ULINT_UNDEFINED, &heap);
+
/* Go to the child node */
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
- }
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
+ if (UNIV_UNLIKELY(height == 0 && dict_index_is_ibuf(index))) {
+ /* We're doing a search on an ibuf tree and we're one
+ level above the leaf page. */
+
+ ulint is_min_rec;
+
+ ut_ad(level == 0);
+
+ is_min_rec = rec_get_info_bits(node_ptr, 0)
+ & REC_INFO_MIN_REC_FLAG;
+
+ if (!is_min_rec) {
+ cursor->ibuf_cnt
+ = ibuf_rec_get_counter(node_ptr);
+
+ ut_a(cursor->ibuf_cnt <= 0xFFFF
+ || cursor->ibuf_cnt == ULINT_UNDEFINED);
+ }
+
+ buf_mode = BUF_GET;
+ rw_latch = RW_NO_LATCH;
+ goto retry_page_get;
+ }
+
+ goto search_loop;
}
- if (level == 0) {
+ if (level != 0) {
+ /* x-latch the page */
+ page = btr_page_get(
+ space, zip_size, page_no, RW_X_LATCH, mtr);
+
+ ut_a((ibool)!!page_is_comp(page)
+ == dict_table_is_comp(index->table));
+ } else {
cursor->low_match = low_match;
cursor->low_bytes = low_bytes;
cursor->up_match = up_match;
@@ -719,9 +849,14 @@ retry_page_get:
}
func_exit:
+
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
+ }
+
if (has_search_latch) {
- rw_lock_s_lock(&btr_search_latch);
+ rw_lock_s_lock(btr_search_get_latch(cursor->index->id));
}
}
@@ -795,8 +930,7 @@ btr_cur_open_at_index_side_func(
}
ut_a(page);
- ut_ad(0 == ut_dulint_cmp(index->id,
- btr_page_get_index_id(page)));
+ ut_ad(index->id == btr_page_get_index_id(page));
block->check_index_page_at_flush = TRUE;
@@ -924,8 +1058,7 @@ btr_cur_open_at_rnd_pos_func(
}
ut_a(page);
- ut_ad(0 == ut_dulint_cmp(index->id,
- btr_page_get_index_id(page)));
+ ut_ad(index->id == btr_page_get_index_id(page));
if (height == ULINT_UNDEFINED) {
/* We are in the root node */
@@ -961,108 +1094,6 @@ btr_cur_open_at_rnd_pos_func(
}
}
-/**********************************************************************//**
-Positions a cursor at a randomly chosen position within a B-tree
-after the given path
-@return TRUE if the position is at the first page, and cursor must point
- the first record for used by the caller.*/
-UNIV_INTERN
-ibool
-btr_cur_open_at_rnd_pos_after_path(
-/*====================*/
- dict_index_t* index, /*!< in: index */
- ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
- btr_path_t* first_rec_path,
- btr_cur_t* cursor, /*!< in/out: B-tree cursor */
- mtr_t* mtr) /*!< in: mtr */
-{
- page_cur_t* page_cursor;
- btr_path_t* slot;
- ibool is_first_rec = TRUE;
- ulint page_no;
- ulint space;
- ulint zip_size;
- ulint height;
- rec_t* node_ptr;
- mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
- rec_offs_init(offsets_);
-
- if (latch_mode == BTR_MODIFY_TREE) {
- mtr_x_lock(dict_index_get_lock(index), mtr);
- } else {
- mtr_s_lock(dict_index_get_lock(index), mtr);
- }
-
- page_cursor = btr_cur_get_page_cur(cursor);
- cursor->index = index;
-
- space = dict_index_get_space(index);
- zip_size = dict_table_zip_size(index->table);
- page_no = dict_index_get_page(index);
-
- height = ULINT_UNDEFINED;
- slot = first_rec_path;
-
- for (;;) {
- buf_block_t* block;
- page_t* page;
-
- block = buf_page_get_gen(space, zip_size, page_no,
- RW_NO_LATCH, NULL, BUF_GET,
- __FILE__, __LINE__, mtr);
- page = buf_block_get_frame(block);
- ut_ad(0 == ut_dulint_cmp(index->id,
- btr_page_get_index_id(page)));
-
- if (height == ULINT_UNDEFINED) {
- /* We are in the root node */
-
- height = btr_page_get_level(page, mtr);
- }
-
- if (height == 0) {
- btr_cur_latch_leaves(page, space, zip_size, page_no,
- latch_mode, cursor, mtr);
- }
-
- if (is_first_rec && slot->nth_rec != ULINT_UNDEFINED) {
- if (height == 0) {
- /* must open the first rec */
- page_cur_open_on_nth_user_rec(block, page_cursor, slot->nth_rec);
- } else {
- is_first_rec = page_cur_open_on_rnd_user_rec_after_nth(block,
- page_cursor, slot->nth_rec);
- }
- } else {
- is_first_rec = FALSE;
- page_cur_open_on_rnd_user_rec(block, page_cursor);
- }
-
- if (height == 0) {
- break;
- }
-
- ut_ad(height > 0);
-
- height--;
- slot++;
-
- node_ptr = page_cur_get_rec(page_cursor);
- offsets = rec_get_offsets(node_ptr, cursor->index, offsets,
- ULINT_UNDEFINED, &heap);
- /* Go to the child node */
- page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
- }
-
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
-
- return (is_first_rec);
-}
-
/*==================== B-TREE INSERT =========================*/
/*************************************************************//**
@@ -1124,7 +1155,7 @@ btr_cur_ins_lock_and_undo(
not zero, the parameters index and thr
should be specified */
btr_cur_t* cursor, /*!< in: cursor on page after which to insert */
- const dtuple_t* entry, /*!< in: entry to insert */
+ dtuple_t* entry, /*!< in/out: entry to insert */
que_thr_t* thr, /*!< in: query thread or NULL */
mtr_t* mtr, /*!< in/out: mini-transaction */
ibool* inherit)/*!< out: TRUE if the inserted new record maybe
@@ -1186,7 +1217,7 @@ btr_cur_trx_report(
const char* op) /*!< in: operation */
{
fprintf(stderr, "Trx with id " TRX_ID_FMT " going to ",
- TRX_ID_PREP_PRINTF(trx->id));
+ (ullint) trx->id);
fputs(op, stderr);
dict_index_name_print(stderr, trx, index);
putc('\n', stderr);
@@ -1803,7 +1834,7 @@ func_exit:
See if there is enough place in the page modification log to log
an update-in-place.
@return TRUE if enough place */
-static
+UNIV_INTERN
ibool
btr_cur_update_alloc_zip(
/*=====================*/
@@ -1883,7 +1914,7 @@ btr_cur_update_in_place(
page_zip_des_t* page_zip;
ulint err;
rec_t* rec;
- roll_ptr_t roll_ptr = ut_dulint_zero;
+ roll_ptr_t roll_ptr = 0;
trx_t* trx;
ulint was_delete_marked;
mem_heap_t* heap = NULL;
@@ -1933,13 +1964,14 @@ btr_cur_update_in_place(
NOT call it if index is secondary */
if (!dict_index_is_clust(index)
- || row_upd_changes_ord_field_binary(NULL, index, update)) {
+ || row_upd_changes_ord_field_binary(index, update, thr,
+ NULL, NULL)) {
/* Remove possible hash index pointer to this record */
btr_search_update_hash_on_delete(cursor);
}
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(cursor->index->id));
}
if (!(flags & BTR_KEEP_SYS_FLAG)) {
@@ -1953,7 +1985,7 @@ btr_cur_update_in_place(
row_upd_rec_in_place(rec, index, offsets, update, page_zip);
if (block->is_hashed) {
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(cursor->index->id));
}
if (page_zip && !dict_index_is_clust(index)
@@ -2013,7 +2045,6 @@ btr_cur_optimistic_update(
page_t* page;
page_zip_des_t* page_zip;
rec_t* rec;
- rec_t* orig_rec;
ulint max_size;
ulint new_rec_size;
ulint old_rec_size;
@@ -2027,7 +2058,7 @@ btr_cur_optimistic_update(
block = btr_cur_get_block(cursor);
page = buf_block_get_frame(block);
- orig_rec = rec = btr_cur_get_rec(cursor);
+ rec = btr_cur_get_rec(cursor);
index = cursor->index;
ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
@@ -2036,6 +2067,9 @@ btr_cur_optimistic_update(
heap = mem_heap_create(1024);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
+#ifdef UNIV_BLOB_NULL_DEBUG
+ ut_a(!rec_offs_any_null_extern(rec, offsets));
+#endif /* UNIV_BLOB_NULL_DEBUG */
#ifdef UNIV_DEBUG
if (btr_cur_print_record_ops && thr) {
@@ -2476,8 +2510,8 @@ make_external:
record on its page? */
was_first = page_cur_is_before_first(page_cursor);
- /* The first parameter means that no lock checking and undo logging
- is made in the insert */
+ /* Lock checks and undo logging were already performed by
+ btr_cur_upd_lock_and_undo(). */
err = btr_cur_pessimistic_insert(BTR_NO_UNDO_LOG_FLAG
| BTR_NO_LOCKING_FLAG
@@ -2686,27 +2720,24 @@ ulint
btr_cur_del_mark_set_clust_rec(
/*===========================*/
ulint flags, /*!< in: undo logging and locking flags */
- btr_cur_t* cursor, /*!< in: cursor */
+ buf_block_t* block, /*!< in/out: buffer block of the record */
+ rec_t* rec, /*!< in/out: record */
+ dict_index_t* index, /*!< in: clustered index of the record */
+ const ulint* offsets,/*!< in: rec_get_offsets(rec) */
ibool val, /*!< in: value to set */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in: mtr */
{
- dict_index_t* index;
- buf_block_t* block;
roll_ptr_t roll_ptr;
ulint err;
- rec_t* rec;
page_zip_des_t* page_zip;
trx_t* trx;
- mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
- rec_offs_init(offsets_);
- rec = btr_cur_get_rec(cursor);
- index = cursor->index;
+ ut_ad(dict_index_is_clust(index));
+ ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
- offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
+ ut_ad(buf_block_get_frame(block) == page_align(rec));
+ ut_ad(page_is_leaf(page_align(rec)));
#ifdef UNIV_DEBUG
if (btr_cur_print_record_ops && thr) {
@@ -2718,13 +2749,12 @@ btr_cur_del_mark_set_clust_rec(
ut_ad(dict_index_is_clust(index));
ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
- err = lock_clust_rec_modify_check_and_lock(flags,
- btr_cur_get_block(cursor),
+ err = lock_clust_rec_modify_check_and_lock(flags, block,
rec, index, offsets, thr);
if (err != DB_SUCCESS) {
- goto func_exit;
+ return(err);
}
err = trx_undo_report_row_operation(flags, TRX_UNDO_MODIFY_OP, thr,
@@ -2732,17 +2762,16 @@ btr_cur_del_mark_set_clust_rec(
&roll_ptr);
if (err != DB_SUCCESS) {
- goto func_exit;
+ return(err);
}
- block = btr_cur_get_block(cursor);
-
if (block->is_hashed) {
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(index->id));
}
page_zip = buf_block_get_page_zip(block);
+ btr_blob_dbg_set_deleted_flag(rec, index, offsets, val);
btr_rec_set_deleted_flag(rec, page_zip, val);
trx = thr_get_trx(thr);
@@ -2753,16 +2782,12 @@ btr_cur_del_mark_set_clust_rec(
}
if (block->is_hashed) {
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(index->id));
}
btr_cur_del_mark_set_clust_rec_log(flags, rec, index, val, trx,
roll_ptr, mtr);
-func_exit:
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
return(err);
}
@@ -2884,13 +2909,13 @@ btr_cur_del_mark_set_sec_rec(
== dict_table_is_comp(cursor->index->table));
if (block->is_hashed) {
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(cursor->index->id));
}
btr_rec_set_deleted_flag(rec, buf_block_get_page_zip(block), val);
if (block->is_hashed) {
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(cursor->index->id));
}
btr_cur_del_mark_set_sec_rec_log(rec, val, mtr);
@@ -2899,25 +2924,26 @@ btr_cur_del_mark_set_sec_rec(
}
/***********************************************************//**
-Clear a secondary index record's delete mark. This function is only
-used by the insert buffer insert merge mechanism. */
+Sets a secondary index record's delete mark to the given value. This
+function is only used by the insert buffer merge mechanism. */
UNIV_INTERN
void
-btr_cur_del_unmark_for_ibuf(
-/*========================*/
- rec_t* rec, /*!< in/out: record to delete unmark */
+btr_cur_set_deleted_flag_for_ibuf(
+/*==============================*/
+ rec_t* rec, /*!< in/out: record */
page_zip_des_t* page_zip, /*!< in/out: compressed page
corresponding to rec, or NULL
when the tablespace is
uncompressed */
+ ibool val, /*!< in: value to set */
mtr_t* mtr) /*!< in: mtr */
{
/* We do not need to reserve btr_search_latch, as the page has just
been read to the buffer pool and there cannot be a hash index to it. */
- btr_rec_set_deleted_flag(rec, page_zip, FALSE);
+ btr_rec_set_deleted_flag(rec, page_zip, val);
- btr_cur_del_mark_set_sec_rec_log(rec, FALSE, mtr);
+ btr_cur_del_mark_set_sec_rec_log(rec, val, mtr);
}
/*==================== B-TREE RECORD REMOVE =========================*/
@@ -3216,6 +3242,7 @@ btr_cur_add_path_info(
{
btr_path_t* slot;
rec_t* rec;
+ page_t* page;
ut_a(cursor->path_arr);
@@ -3238,8 +3265,168 @@ btr_cur_add_path_info(
slot = cursor->path_arr + (root_height - height);
+ page = page_align(rec);
+
slot->nth_rec = page_rec_get_n_recs_before(rec);
- slot->n_recs = page_get_n_recs(page_align(rec));
+ slot->n_recs = page_get_n_recs(page);
+ slot->page_no = page_get_page_no(page);
+ slot->page_level = btr_page_get_level_low(page);
+}
+
+/*******************************************************************//**
+Estimate the number of rows between slot1 and slot2 for any level on a
+B-tree. This function starts from slot1->page and reads a few pages to
+the right, counting their records. If we reach slot2->page quickly then
+we know exactly how many records there are between slot1 and slot2 and
+we set is_n_rows_exact to TRUE. If we cannot reach slot2->page quickly
+then we calculate the average number of records in the pages scanned
+so far and assume that all pages that we did not scan up to slot2->page
+contain the same number of records, then we multiply that average to
+the number of pages between slot1->page and slot2->page (which is
+n_rows_on_prev_level). In this case we set is_n_rows_exact to FALSE.
+@return number of rows (exact or estimated) */
+static
+ib_int64_t
+btr_estimate_n_rows_in_range_on_level(
+/*==================================*/
+ dict_index_t* index, /*!< in: index */
+ btr_path_t* slot1, /*!< in: left border */
+ btr_path_t* slot2, /*!< in: right border */
+ ib_int64_t n_rows_on_prev_level, /*!< in: number of rows
+ on the previous level for the
+ same descend paths; used to
+ determine the numbe of pages
+ on this level */
+ ibool* is_n_rows_exact) /*!< out: TRUE if the returned
+ value is exact i.e. not an
+ estimation */
+{
+ ulint space;
+ ib_int64_t n_rows;
+ ulint n_pages_read;
+ ulint page_no;
+ ulint zip_size;
+ ulint level;
+
+ space = dict_index_get_space(index);
+
+ n_rows = 0;
+ n_pages_read = 0;
+
+ /* Assume by default that we will scan all pages between
+ slot1->page_no and slot2->page_no */
+ *is_n_rows_exact = TRUE;
+
+ /* add records from slot1->page_no which are to the right of
+ the record which serves as a left border of the range, if any */
+ if (slot1->nth_rec < slot1->n_recs) {
+ n_rows += slot1->n_recs - slot1->nth_rec;
+ }
+
+ /* add records from slot2->page_no which are to the left of
+ the record which servers as a right border of the range, if any */
+ if (slot2->nth_rec > 1) {
+ n_rows += slot2->nth_rec - 1;
+ }
+
+ /* count the records in the pages between slot1->page_no and
+ slot2->page_no (non inclusive), if any */
+
+ zip_size = fil_space_get_zip_size(space);
+
+ /* Do not read more than this number of pages in order not to hurt
+ performance with this code which is just an estimation. If we read
+ this many pages before reaching slot2->page_no then we estimate the
+ average from the pages scanned so far */
+# define N_PAGES_READ_LIMIT 10
+
+ page_no = slot1->page_no;
+ level = slot1->page_level;
+
+ do {
+ mtr_t mtr;
+ page_t* page;
+ buf_block_t* block;
+
+ mtr_start(&mtr);
+
+ /* Fetch the page. Because we are not holding the
+ index->lock, the tree may have changed and we may be
+ attempting to read a page that is no longer part of
+ the B-tree. We pass BUF_GET_POSSIBLY_FREED in order to
+ silence a debug assertion about this. */
+ block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH,
+ NULL, BUF_GET_POSSIBLY_FREED,
+ __FILE__, __LINE__, &mtr);
+
+ page = buf_block_get_frame(block);
+
+ /* It is possible that the tree has been reorganized in the
+ meantime and this is a different page. If this happens the
+ calculated estimate will be bogus, which is not fatal as
+ this is only an estimate. We are sure that a page with
+ page_no exists because InnoDB never frees pages, only
+ reuses them. */
+ if (fil_page_get_type(page) != FIL_PAGE_INDEX
+ || btr_page_get_index_id(page) != index->id
+ || btr_page_get_level_low(page) != level) {
+
+ /* The page got reused for something else */
+ mtr_commit(&mtr);
+ goto inexact;
+ }
+
+ /* It is possible but highly unlikely that the page was
+ originally written by an old version of InnoDB that did
+ not initialize FIL_PAGE_TYPE on other than B-tree pages.
+ For example, this could be an almost-empty BLOB page
+ that happens to contain the magic values in the fields
+ that we checked above. */
+
+ n_pages_read++;
+
+ if (page_no != slot1->page_no) {
+ /* Do not count the records on slot1->page_no,
+ we already counted them before this loop. */
+ n_rows += page_get_n_recs(page);
+ }
+
+ page_no = btr_page_get_next(page, &mtr);
+
+ mtr_commit(&mtr);
+
+ if (n_pages_read == N_PAGES_READ_LIMIT
+ || page_no == FIL_NULL) {
+ /* Either we read too many pages or
+ we reached the end of the level without passing
+ through slot2->page_no, the tree must have changed
+ in the meantime */
+ goto inexact;
+ }
+
+ } while (page_no != slot2->page_no);
+
+ return(n_rows);
+
+inexact:
+
+ *is_n_rows_exact = FALSE;
+
+ /* We did interrupt before reaching slot2->page */
+
+ if (n_pages_read > 0) {
+ /* The number of pages on this level is
+ n_rows_on_prev_level, multiply it by the
+ average number of recs per page so far */
+ n_rows = n_rows_on_prev_level
+ * n_rows / n_pages_read;
+ } else {
+ /* The tree changed before we could even
+ start with slot1->page_no */
+ n_rows = 10;
+ }
+
+ return(n_rows);
}
/*******************************************************************//**
@@ -3264,6 +3451,7 @@ btr_estimate_n_rows_in_range(
ibool diverged_lot;
ulint divergence_level;
ib_int64_t n_rows;
+ ibool is_n_rows_exact;
ulint i;
mtr_t mtr;
@@ -3306,6 +3494,7 @@ btr_estimate_n_rows_in_range(
/* We have the path information for the range in path1 and path2 */
n_rows = 1;
+ is_n_rows_exact = TRUE;
diverged = FALSE; /* This becomes true when the path is not
the same any more */
diverged_lot = FALSE; /* This becomes true when the paths are
@@ -3321,7 +3510,7 @@ btr_estimate_n_rows_in_range(
if (slot1->nth_rec == ULINT_UNDEFINED
|| slot2->nth_rec == ULINT_UNDEFINED) {
- if (i > divergence_level + 1) {
+ if (i > divergence_level + 1 && !is_n_rows_exact) {
/* In trees whose height is > 1 our algorithm
tends to underestimate: multiply the estimate
by 2: */
@@ -3333,7 +3522,9 @@ btr_estimate_n_rows_in_range(
to over 1 / 2 of the estimated rows in the whole
table */
- if (n_rows > index->table->stat_n_rows / 2) {
+ if (n_rows > index->table->stat_n_rows / 2
+ && !is_n_rows_exact) {
+
n_rows = index->table->stat_n_rows / 2;
/* If there are just 0 or 1 rows in the table,
@@ -3359,10 +3550,15 @@ btr_estimate_n_rows_in_range(
divergence_level = i;
}
} else {
- /* Maybe the tree has changed between
- searches */
-
- return(10);
+ /* It is possible that
+ slot1->nth_rec >= slot2->nth_rec
+ if, for example, we have a single page
+ tree which contains (inf, 5, 6, supr)
+ and we select where x > 20 and x < 30;
+ in this case slot1->nth_rec will point
+ to the supr record and slot2->nth_rec
+ will point to 6 */
+ n_rows = 0;
}
} else if (diverged && !diverged_lot) {
@@ -3386,156 +3582,51 @@ btr_estimate_n_rows_in_range(
}
} else if (diverged_lot) {
- n_rows = (n_rows * (slot1->n_recs + slot2->n_recs))
- / 2;
+ n_rows = btr_estimate_n_rows_in_range_on_level(
+ index, slot1, slot2, n_rows,
+ &is_n_rows_exact);
}
}
}
/*******************************************************************//**
-Estimates the number of pages which have not null value of the key of n_cols.
-@return estimated number of pages */
-UNIV_INTERN
-ulint
-btr_estimate_n_pages_not_null(
-/*=========================*/
- dict_index_t* index, /*!< in: index */
- ulint n_cols, /*!< in: The cols should be not null */
- btr_path_t* path1) /*!< in: path1[BTR_PATH_ARRAY_N_SLOTS] */
+Record the number of non_null key values in a given index for
+each n-column prefix of the index where n < dict_index_get_n_unique(index).
+The estimates are eventually stored in the array:
+index->stat_n_non_null_key_vals. */
+static
+void
+btr_record_not_null_field_in_rec(
+/*=============================*/
+ rec_t* rec, /*!< in: physical record */
+ ulint n_unique, /*!< in: dict_index_get_n_unique(index),
+ number of columns uniquely determine
+ an index entry */
+ const ulint* offsets, /*!< in: rec_get_offsets(rec, index),
+ its size could be for all fields or
+ that of "n_unique" */
+ ib_int64_t* n_not_null) /*!< in/out: array to record number of
+ not null rows for n-column prefix */
{
- dtuple_t* tuple1;
- btr_path_t path2[BTR_PATH_ARRAY_N_SLOTS];
- btr_cur_t cursor;
- btr_path_t* slot1;
- btr_path_t* slot2;
- ibool diverged;
- ibool diverged_lot;
- ulint divergence_level;
- ulint n_pages;
- ulint i;
- mtr_t mtr;
- mem_heap_t* heap;
-
- heap = mem_heap_create(n_cols * sizeof(dfield_t)
- + sizeof(dtuple_t));
+ ulint i;
- /* make tuple1 (NULL,NULL,,,) from n_cols */
- tuple1 = dtuple_create(heap, n_cols);
- dict_index_copy_types(tuple1, index, n_cols);
+ ut_ad(rec_offs_n_fields(offsets) >= n_unique);
- for (i = 0; i < n_cols; i++) {
- dfield_set_null(dtuple_get_nth_field(tuple1, i));
+ if (n_not_null == NULL) {
+ return;
}
- mtr_start(&mtr);
-
- cursor.path_arr = path1;
-
- btr_cur_search_to_nth_level(index, 0, tuple1, PAGE_CUR_G,
- BTR_SEARCH_LEAF | BTR_ESTIMATE,
- &cursor, 0, __FILE__, __LINE__, &mtr);
-
- mtr_commit(&mtr);
-
-
-
- mtr_start(&mtr);
-
- cursor.path_arr = path2;
-
- btr_cur_open_at_index_side(FALSE, index,
- BTR_SEARCH_LEAF | BTR_ESTIMATE,
- &cursor, &mtr);
-
- mtr_commit(&mtr);
-
- mem_heap_free(heap);
-
- /* We have the path information for the range in path1 and path2 */
-
- n_pages = 1;
- diverged = FALSE; /* This becomes true when the path is not
- the same any more */
- diverged_lot = FALSE; /* This becomes true when the paths are
- not the same or adjacent any more */
- divergence_level = 1000000; /* This is the level where paths diverged
- a lot */
- for (i = 0; ; i++) {
- ut_ad(i < BTR_PATH_ARRAY_N_SLOTS);
-
- slot1 = path1 + i;
- slot2 = path2 + i;
-
- if ((slot1 + 1)->nth_rec == ULINT_UNDEFINED
- || (slot2 + 1)->nth_rec == ULINT_UNDEFINED) {
-
- if (i > divergence_level + 1) {
- /* In trees whose height is > 1 our algorithm
- tends to underestimate: multiply the estimate
- by 2: */
-
- n_pages = n_pages * 2;
- }
-
- /* Do not estimate the number of rows in the range
- to over 1 / 2 of the estimated rows in the whole
- table */
-
- if (n_pages > index->stat_n_leaf_pages / 2) {
- n_pages = index->stat_n_leaf_pages / 2;
+ for (i = 0; i < n_unique; i++) {
+ ulint rec_len;
+ byte* field;
- /* If there are just 0 or 1 rows in the table,
- then we estimate all rows are in the range */
-
- if (n_pages == 0) {
- n_pages = index->stat_n_leaf_pages;
- }
- }
-
- return(n_pages);
- }
-
- if (!diverged && slot1->nth_rec != slot2->nth_rec) {
-
- diverged = TRUE;
-
- if (slot1->nth_rec < slot2->nth_rec) {
- n_pages = slot2->nth_rec - slot1->nth_rec;
-
- if (n_pages > 1) {
- diverged_lot = TRUE;
- divergence_level = i;
- }
- } else {
- /* Maybe the tree has changed between
- searches */
+ field = rec_get_nth_field(rec, offsets, i, &rec_len);
- return(10);
- }
-
- } else if (diverged && !diverged_lot) {
-
- if (slot1->nth_rec < slot1->n_recs
- || slot2->nth_rec > 1) {
-
- diverged_lot = TRUE;
- divergence_level = i;
-
- n_pages = 0;
-
- if (slot1->nth_rec < slot1->n_recs) {
- n_pages += slot1->n_recs
- - slot1->nth_rec;
- }
-
- if (slot2->nth_rec > 1) {
- n_pages += slot2->nth_rec - 1;
- }
- }
- } else if (diverged_lot) {
-
- n_pages = (n_pages * (slot1->n_recs + slot2->n_recs))
- / 2;
+ if (rec_len != UNIV_SQL_NULL) {
+ n_not_null[i]++;
+ } else {
+ /* Break if we hit the first NULL value */
+ break;
}
}
}
@@ -3543,7 +3634,10 @@ btr_estimate_n_pages_not_null(
/*******************************************************************//**
Estimates the number of different key values in a given index, for
each n-column prefix of the index where n <= dict_index_get_n_unique(index).
-The estimates are stored in the array index->stat_n_diff_key_vals. */
+The estimates are stored in the array index->stat_n_diff_key_vals.
+If innodb_stats_method is "nulls_ignored", we also record the number of
+non-null values for each prefix and store the estimates in
+array index->stat_n_non_null_key_vals. */
UNIV_INTERN
void
btr_estimate_number_of_different_key_vals(
@@ -3557,6 +3651,8 @@ btr_estimate_number_of_different_key_vals(
ulint matched_fields;
ulint matched_bytes;
ib_int64_t* n_diff;
+ ib_int64_t* n_not_null;
+ ibool stats_null_not_equal;
ullint n_sample_pages; /* number of pages to sample */
ulint not_empty_flag = 0;
ulint total_external_size = 0;
@@ -3565,44 +3661,49 @@ btr_estimate_number_of_different_key_vals(
ullint add_on;
mtr_t mtr;
mem_heap_t* heap = NULL;
- ulint offsets_rec_[REC_OFFS_NORMAL_SIZE];
- ulint offsets_next_rec_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets_rec = offsets_rec_;
- ulint* offsets_next_rec= offsets_next_rec_;
- ulint stats_method = srv_stats_method;
- btr_path_t first_rec_path[BTR_PATH_ARRAY_N_SLOTS];
- ulint effective_pages; /* effective leaf pages */
- rec_offs_init(offsets_rec_);
- rec_offs_init(offsets_next_rec_);
+ ulint* offsets_rec = NULL;
+ ulint* offsets_next_rec = NULL;
n_cols = dict_index_get_n_unique(index);
- if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) {
- /* estimate effective pages and path for the first effective record */
- /* TODO: make it work also for n_cols > 1. */
- effective_pages = btr_estimate_n_pages_not_null(index, 1 /*k*/, first_rec_path);
+ heap = mem_heap_create((sizeof *n_diff + sizeof *n_not_null)
+ * (n_cols + 1)
+ + dict_index_get_n_fields(index)
+ * (sizeof *offsets_rec
+ + sizeof *offsets_next_rec));
+
+ n_diff = mem_heap_zalloc(heap, (n_cols + 1) * sizeof(ib_int64_t));
+
+ n_not_null = NULL;
+
+ /* Check srv_innodb_stats_method setting, and decide whether we
+ need to record non-null value and also decide if NULL is
+ considered equal (by setting stats_null_not_equal value) */
+ switch (srv_innodb_stats_method) {
+ case SRV_STATS_NULLS_IGNORED:
+ n_not_null = mem_heap_zalloc(heap, (n_cols + 1)
+ * sizeof *n_not_null);
+ /* fall through */
+
+ case SRV_STATS_NULLS_UNEQUAL:
+ /* for both SRV_STATS_NULLS_IGNORED and SRV_STATS_NULLS_UNEQUAL
+ case, we will treat NULLs as unequal value */
+ stats_null_not_equal = TRUE;
+ break;
- if (!effective_pages) {
- dict_index_stat_mutex_enter(index);
- for (j = 0; j <= n_cols; j++) {
- index->stat_n_diff_key_vals[j] = (ib_int64_t)index->stat_n_leaf_pages;
- }
- dict_index_stat_mutex_exit(index);
- return;
- } else if (effective_pages > index->stat_n_leaf_pages) {
- effective_pages = index->stat_n_leaf_pages;
- }
- } else {
- effective_pages = index->stat_n_leaf_pages;
- }
+ case SRV_STATS_NULLS_EQUAL:
+ stats_null_not_equal = FALSE;
+ break;
- n_diff = mem_zalloc((n_cols + 1) * sizeof(ib_int64_t));
+ default:
+ ut_error;
+ }
/* It makes no sense to test more pages than are contained
in the index, thus we lower the number if it is too high */
- if (srv_stats_sample_pages > effective_pages) {
- if (effective_pages > 0) {
- n_sample_pages = effective_pages;
+ if (srv_stats_sample_pages > index->stat_index_size) {
+ if (index->stat_index_size > 0) {
+ n_sample_pages = index->stat_index_size;
} else {
n_sample_pages = 1;
}
@@ -3613,16 +3714,9 @@ btr_estimate_number_of_different_key_vals(
/* We sample some pages in the index to get an estimate */
for (i = 0; i < n_sample_pages; i++) {
- rec_t* supremum;
- ibool is_first_page = TRUE;
mtr_start(&mtr);
- if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) {
- is_first_page = btr_cur_open_at_rnd_pos_after_path(index, BTR_SEARCH_LEAF,
- first_rec_path, &cursor, &mtr);
- } else {
btr_cur_open_at_rnd_pos(index, BTR_SEARCH_LEAF, &cursor, &mtr);
- }
/* Count the number of different key values for each prefix of
the key on this index page. If the prefix does not determine
@@ -3637,25 +3731,25 @@ btr_estimate_number_of_different_key_vals(
}
ut_a(page);
- supremum = page_get_supremum_rec(page);
- if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS && is_first_page) {
- /* the cursor should be the first record of the page. */
- /* Counting should be started from here. */
- rec = btr_cur_get_rec(&cursor);
- } else {
rec = page_rec_get_next(page_get_infimum_rec(page));
- }
- if (rec != supremum) {
+ if (!page_rec_is_supremum(rec)) {
not_empty_flag = 1;
offsets_rec = rec_get_offsets(rec, index, offsets_rec,
ULINT_UNDEFINED, &heap);
+
+ if (n_not_null) {
+ btr_record_not_null_field_in_rec(
+ rec, n_cols, offsets_rec, n_not_null);
+ }
}
- while (rec != supremum) {
- rec_t* next_rec;
- next_rec = page_rec_get_next(rec);
- if (next_rec == supremum) {
+ while (!page_rec_is_supremum(rec)) {
+ rec_t* next_rec = page_rec_get_next(rec);
+ if (page_rec_is_supremum(next_rec)) {
+ total_external_size +=
+ btr_rec_get_externally_stored_len(
+ rec, offsets_rec);
break;
}
@@ -3663,15 +3757,14 @@ btr_estimate_number_of_different_key_vals(
matched_bytes = 0;
offsets_next_rec = rec_get_offsets(next_rec, index,
offsets_next_rec,
- n_cols, &heap);
+ ULINT_UNDEFINED,
+ &heap);
cmp_rec_rec_with_match(rec, next_rec,
offsets_rec, offsets_next_rec,
- index, &matched_fields,
- &matched_bytes,
- (stats_method==SRV_STATS_METHOD_NULLS_NOT_EQUAL) ?
- SRV_STATS_METHOD_NULLS_NOT_EQUAL :
- SRV_STATS_METHOD_NULLS_EQUAL);
+ index, stats_null_not_equal,
+ &matched_fields,
+ &matched_bytes);
for (j = matched_fields + 1; j <= n_cols; j++) {
/* We add one if this index record has
@@ -3680,6 +3773,12 @@ btr_estimate_number_of_different_key_vals(
n_diff[j]++;
}
+ if (n_not_null) {
+ btr_record_not_null_field_in_rec(
+ next_rec, n_cols, offsets_next_rec,
+ n_not_null);
+ }
+
total_external_size
+= btr_rec_get_externally_stored_len(
rec, offsets_rec);
@@ -3714,10 +3813,6 @@ btr_estimate_number_of_different_key_vals(
}
}
- offsets_rec = rec_get_offsets(rec, index, offsets_rec,
- ULINT_UNDEFINED, &heap);
- total_external_size += btr_rec_get_externally_stored_len(
- rec, offsets_rec);
mtr_commit(&mtr);
}
@@ -3729,17 +3824,11 @@ btr_estimate_number_of_different_key_vals(
also the pages used for external storage of fields (those pages are
included in index->stat_n_leaf_pages) */
- dict_index_stat_mutex_enter(index);
-
for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j]
- = ((n_diff[j]
- * (ib_int64_t)effective_pages
- + n_sample_pages - 1
- + total_external_size
- + not_empty_flag)
- / (n_sample_pages
- + total_external_size));
+ = BTR_TABLE_STATS_FROM_SAMPLE(
+ n_diff[j], index, n_sample_pages,
+ total_external_size, not_empty_flag);
/* If the tree is small, smaller than
10 * n_sample_pages + total_external_size, then
@@ -3749,7 +3838,7 @@ btr_estimate_number_of_different_key_vals(
different key values, or even more. Let us try to approximate
that: */
- add_on = effective_pages
+ add_on = index->stat_n_leaf_pages
/ (10 * (n_sample_pages
+ total_external_size));
@@ -3759,55 +3848,80 @@ btr_estimate_number_of_different_key_vals(
index->stat_n_diff_key_vals[j] += add_on;
- if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) {
- /* index->stat_n_diff_key_vals[k] is used for calc rec_per_key,
- as "stats.records / index->stat_n_diff_key_vals[x]".
- So it should be adjusted to the value which is based on whole of the index. */
- index->stat_n_diff_key_vals[j] =
- index->stat_n_diff_key_vals[j] * (ib_int64_t)index->stat_n_leaf_pages
- / (ib_int64_t)effective_pages;
+ /* Update the stat_n_non_null_key_vals[] with our
+ sampled result. stat_n_non_null_key_vals[] is created
+ and initialized to zero in dict_index_add_to_cache(),
+ along with stat_n_diff_key_vals[] array */
+ if (n_not_null != NULL && (j < n_cols)) {
+ index->stat_n_non_null_key_vals[j] =
+ BTR_TABLE_STATS_FROM_SAMPLE(
+ n_not_null[j], index, n_sample_pages,
+ total_external_size, not_empty_flag);
}
}
- dict_index_stat_mutex_exit(index);
-
- mem_free(n_diff);
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
+ mem_heap_free(heap);
}
/*================== EXTERNAL STORAGE OF BIG FIELDS ===================*/
/***********************************************************//**
+Gets the offset of the pointer to the externally stored part of a field.
+@return offset of the pointer to the externally stored part */
+static
+ulint
+btr_rec_get_field_ref_offs(
+/*=======================*/
+ const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ ulint n) /*!< in: index of the external field */
+{
+ ulint field_ref_offs;
+ ulint local_len;
+
+ ut_a(rec_offs_nth_extern(offsets, n));
+ field_ref_offs = rec_get_nth_field_offs(offsets, n, &local_len);
+ ut_a(local_len != UNIV_SQL_NULL);
+ ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
+
+ return(field_ref_offs + local_len - BTR_EXTERN_FIELD_REF_SIZE);
+}
+
+/** Gets a pointer to the externally stored part of a field.
+@param rec record
+@param offsets rec_get_offsets(rec)
+@param n index of the externally stored field
+@return pointer to the externally stored part */
+#define btr_rec_get_field_ref(rec, offsets, n) \
+ ((rec) + btr_rec_get_field_ref_offs(offsets, n))
+
+/***********************************************************//**
Gets the externally stored size of a record, in units of a database page.
@return externally stored part, in units of a database page */
static
ulint
btr_rec_get_externally_stored_len(
/*==============================*/
- rec_t* rec, /*!< in: record */
+ const rec_t* rec, /*!< in: record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint n_fields;
- byte* data;
- ulint local_len;
- ulint extern_len;
ulint total_extern_len = 0;
ulint i;
ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec));
+
+ if (!rec_offs_any_extern(offsets)) {
+ return(0);
+ }
+
n_fields = rec_offs_n_fields(offsets);
for (i = 0; i < n_fields; i++) {
if (rec_offs_nth_extern(offsets, i)) {
- data = rec_get_nth_field(rec, offsets, i, &local_len);
-
- local_len -= BTR_EXTERN_FIELD_REF_SIZE;
-
- extern_len = mach_read_from_4(data + local_len
- + BTR_EXTERN_LEN + 4);
+ ulint extern_len = mach_read_from_4(
+ btr_rec_get_field_ref(rec, offsets, i)
+ + BTR_EXTERN_LEN + 4);
total_extern_len += ut_calc_align(extern_len,
UNIV_PAGE_SIZE);
@@ -3837,7 +3951,7 @@ btr_cur_set_ownership_of_extern_field(
ulint byte_val;
data = rec_get_nth_field(rec, offsets, i, &local_len);
-
+ ut_ad(rec_offs_nth_extern(offsets, i));
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
@@ -3847,6 +3961,9 @@ btr_cur_set_ownership_of_extern_field(
if (val) {
byte_val = byte_val & (~BTR_EXTERN_OWNER_FLAG);
} else {
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ ut_a(!(byte_val & BTR_EXTERN_OWNER_FLAG));
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
byte_val = byte_val | BTR_EXTERN_OWNER_FLAG;
}
@@ -3860,111 +3977,41 @@ btr_cur_set_ownership_of_extern_field(
} else {
mach_write_to_1(data + local_len + BTR_EXTERN_LEN, byte_val);
}
+
+ btr_blob_dbg_owner(rec, index, offsets, i, val);
}
/*******************************************************************//**
-Marks not updated extern fields as not-owned by this record. The ownership
-is transferred to the updated record which is inserted elsewhere in the
+Marks non-updated off-page fields as disowned by this record. The ownership
+must be transferred to the updated record which is inserted elsewhere in the
index tree. In purge only the owner of externally stored field is allowed
-to free the field.
-@return TRUE if BLOB ownership was transferred */
+to free the field. */
UNIV_INTERN
-ibool
-btr_cur_mark_extern_inherited_fields(
-/*=================================*/
+void
+btr_cur_disown_inherited_fields(
+/*============================*/
page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed
part will be updated, or NULL */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
- mtr_t* mtr) /*!< in: mtr, or NULL if not logged */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
- ulint n;
- ulint j;
ulint i;
- ibool change_ownership = FALSE;
- ut_ad(rec_offs_validate(rec, NULL, offsets));
+ ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec));
+ ut_ad(rec_offs_any_extern(offsets));
+ ut_ad(mtr);
- if (!rec_offs_any_extern(offsets)) {
-
- return(FALSE);
- }
-
- n = rec_offs_n_fields(offsets);
-
- for (i = 0; i < n; i++) {
- if (rec_offs_nth_extern(offsets, i)) {
-
- /* Check it is not in updated fields */
-
- if (update) {
- for (j = 0; j < upd_get_n_fields(update);
- j++) {
- if (upd_get_nth_field(update, j)
- ->field_no == i) {
-
- goto updated;
- }
- }
- }
-
+ for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+ if (rec_offs_nth_extern(offsets, i)
+ && !upd_get_field_by_field_no(update, i)) {
btr_cur_set_ownership_of_extern_field(
page_zip, rec, index, offsets, i, FALSE, mtr);
-
- change_ownership = TRUE;
-updated:
- ;
}
}
-
- return(change_ownership);
-}
-
-/*******************************************************************//**
-The complement of the previous function: in an update entry may inherit
-some externally stored fields from a record. We must mark them as inherited
-in entry, so that they are not freed in a rollback. */
-UNIV_INTERN
-void
-btr_cur_mark_dtuple_inherited_extern(
-/*=================================*/
- dtuple_t* entry, /*!< in/out: updated entry to be
- inserted to clustered index */
- const upd_t* update) /*!< in: update vector */
-{
- ulint i;
-
- for (i = 0; i < dtuple_get_n_fields(entry); i++) {
-
- dfield_t* dfield = dtuple_get_nth_field(entry, i);
- byte* data;
- ulint len;
- ulint j;
-
- if (!dfield_is_ext(dfield)) {
- continue;
- }
-
- /* Check if it is in updated fields */
-
- for (j = 0; j < upd_get_n_fields(update); j++) {
- if (upd_get_nth_field(update, j)->field_no == i) {
-
- goto is_updated;
- }
- }
-
- data = dfield_get_data(dfield);
- len = dfield_get_len(dfield);
- data[len - BTR_EXTERN_FIELD_REF_SIZE + BTR_EXTERN_LEN]
- |= BTR_EXTERN_INHERITED_FLAG;
-
-is_updated:
- ;
- }
}
/*******************************************************************//**
@@ -4003,29 +4050,6 @@ btr_cur_unmark_extern_fields(
}
/*******************************************************************//**
-Marks all extern fields in a dtuple as owned by the record. */
-UNIV_INTERN
-void
-btr_cur_unmark_dtuple_extern_fields(
-/*================================*/
- dtuple_t* entry) /*!< in/out: clustered index entry */
-{
- ulint i;
-
- for (i = 0; i < dtuple_get_n_fields(entry); i++) {
- dfield_t* dfield = dtuple_get_nth_field(entry, i);
-
- if (dfield_is_ext(dfield)) {
- byte* data = dfield_get_data(dfield);
- ulint len = dfield_get_len(dfield);
-
- data[len - BTR_EXTERN_FIELD_REF_SIZE + BTR_EXTERN_LEN]
- &= ~BTR_EXTERN_OWNER_FLAG;
- }
- }
-}
-
-/*******************************************************************//**
Flags the data tuple fields that are marked as extern storage in the
update vector. We use this function to remember which fields we must
mark as extern storage in a record inserted for an update.
@@ -4140,15 +4164,16 @@ btr_blob_free(
if there is one */
mtr_t* mtr) /*!< in: mini-transaction to commit */
{
- ulint space = buf_block_get_space(block);
- ulint page_no = buf_block_get_page_no(block);
+ buf_pool_t* buf_pool = buf_pool_from_block(block);
+ ulint space = buf_block_get_space(block);
+ ulint page_no = buf_block_get_page_no(block);
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
mtr_commit(mtr);
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
mutex_enter(&block->mutex);
/* Only free the block if it is still allocated to
@@ -4159,8 +4184,7 @@ btr_blob_free(
&& buf_block_get_space(block) == space
&& buf_block_get_page_no(block) == page_no) {
- if (buf_LRU_free_block(&block->page, all, NULL, TRUE)
- != BUF_LRU_FREED
+ if (buf_LRU_free_block(&block->page, all, TRUE) != BUF_LRU_FREED
&& all && block->page.zip.data
/* Now, buf_LRU_free_block() may release mutex temporarily */
&& buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE
@@ -4169,12 +4193,12 @@ btr_blob_free(
/* Attempt to deallocate the uncompressed page
if the whole block cannot be deallocted. */
- buf_LRU_free_block(&block->page, FALSE, NULL, TRUE);
+ buf_LRU_free_block(&block->page, FALSE, TRUE);
}
}
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
mutex_exit(&block->mutex);
}
@@ -4183,11 +4207,11 @@ Stores the fields in big_rec_vec to the tablespace and puts pointers to
them in rec. The extern flags in rec will have to be set beforehand.
The fields are stored on pages allocated from leaf node
file segment of the index tree.
-@return DB_SUCCESS or error */
+@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
UNIV_INTERN
ulint
-btr_store_big_rec_extern_fields(
-/*============================*/
+btr_store_big_rec_extern_fields_func(
+/*=================================*/
dict_index_t* index, /*!< in: index of rec; the index tree
MUST be X-latched */
buf_block_t* rec_block, /*!< in/out: block containing rec */
@@ -4196,11 +4220,17 @@ btr_store_big_rec_extern_fields(
the "external storage" flags in offsets
will not correspond to rec when
this function returns */
- big_rec_t* big_rec_vec, /*!< in: vector containing fields
+#ifdef UNIV_DEBUG
+ mtr_t* local_mtr, /*!< in: mtr containing the
+ latch to rec and to the tree */
+#endif /* UNIV_DEBUG */
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ ibool update_in_place,/*! in: TRUE if the record is updated
+ in place (not delete+insert) */
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
+ const big_rec_t*big_rec_vec) /*!< in: vector containing fields
to be stored externally */
- mtr_t* local_mtr __attribute__((unused))) /*!< in: mtr
- containing the latch to rec and to the
- tree */
+
{
ulint rec_page_no;
byte* field_ref;
@@ -4218,6 +4248,7 @@ btr_store_big_rec_extern_fields(
z_stream c_stream;
ut_ad(rec_offs_validate(rec, index, offsets));
+ ut_ad(rec_offs_any_extern(offsets));
ut_ad(mtr_memo_contains(local_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(local_mtr, rec_block, MTR_MEMO_PAGE_X_FIX));
@@ -4249,21 +4280,37 @@ btr_store_big_rec_extern_fields(
ut_a(err == Z_OK);
}
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ /* All pointers to externally stored columns in the record
+ must either be zero or they must be pointers to inherited
+ columns, owned by this record or an earlier record version. */
+ for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+ if (!rec_offs_nth_extern(offsets, i)) {
+ continue;
+ }
+ field_ref = btr_rec_get_field_ref(rec, offsets, i);
+
+ ut_a(!(field_ref[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG));
+ /* Either this must be an update in place,
+ or the BLOB must be inherited, or the BLOB pointer
+ must be zero (will be written in this function). */
+ ut_a(update_in_place
+ || (field_ref[BTR_EXTERN_LEN] & BTR_EXTERN_INHERITED_FLAG)
+ || !memcmp(field_ref, field_ref_zero,
+ BTR_EXTERN_FIELD_REF_SIZE));
+ }
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
/* We have to create a file segment to the tablespace
for each field and put the pointer to the field in rec */
for (i = 0; i < big_rec_vec->n_fields; i++) {
- ut_ad(rec_offs_nth_extern(offsets,
- big_rec_vec->fields[i].field_no));
- {
- ulint local_len;
- field_ref = rec_get_nth_field(
- rec, offsets, big_rec_vec->fields[i].field_no,
- &local_len);
- ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
- local_len -= BTR_EXTERN_FIELD_REF_SIZE;
- field_ref += local_len;
- }
+ field_ref = btr_rec_get_field_ref(
+ rec, offsets, big_rec_vec->fields[i].field_no);
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ /* A zero BLOB pointer should have been initially inserted. */
+ ut_a(!memcmp(field_ref, field_ref_zero,
+ BTR_EXTERN_FIELD_REF_SIZE));
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
extern_len = big_rec_vec->fields[i].len;
UNIV_MEM_ASSERT_RW(big_rec_vec->fields[i].data,
extern_len);
@@ -4438,6 +4485,11 @@ btr_store_big_rec_extern_fields(
}
if (prev_page_no == FIL_NULL) {
+ btr_blob_dbg_add_blob(
+ rec, big_rec_vec->fields[i]
+ .field_no, page_no, index,
+ "store");
+
mach_write_to_4(field_ref
+ BTR_EXTERN_SPACE_ID,
space_id);
@@ -4513,6 +4565,11 @@ next_zip_page:
MLOG_4BYTES, &mtr);
if (prev_page_no == FIL_NULL) {
+ btr_blob_dbg_add_blob(
+ rec, big_rec_vec->fields[i]
+ .field_no, page_no, index,
+ "store");
+
mlog_write_ulint(field_ref
+ BTR_EXTERN_SPACE_ID,
space_id,
@@ -4545,6 +4602,23 @@ next_zip_page:
mem_heap_free(heap);
}
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ /* All pointers to externally stored columns in the record
+ must be valid. */
+ for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+ if (!rec_offs_nth_extern(offsets, i)) {
+ continue;
+ }
+
+ field_ref = btr_rec_get_field_ref(rec, offsets, i);
+
+ /* The pointer must not be zero. */
+ ut_a(0 != memcmp(field_ref, field_ref_zero,
+ BTR_EXTERN_FIELD_REF_SIZE));
+ /* The column must not be disowned by this record. */
+ ut_a(!(field_ref[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG));
+ }
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
return(DB_SUCCESS);
}
@@ -4567,6 +4641,7 @@ btr_check_blob_fil_page_type(
if (UNIV_UNLIKELY(type != FIL_PAGE_TYPE_BLOB)) {
ulint flags = fil_space_get_flags(space_id);
+#ifndef UNIV_DEBUG /* Improve debug test coverage */
if (UNIV_LIKELY
((flags & DICT_TF_FORMAT_MASK) == DICT_TF_FORMAT_51)) {
/* Old versions of InnoDB did not initialize
@@ -4575,6 +4650,7 @@ btr_check_blob_fil_page_type(
a BLOB page that is in Antelope format.*/
return;
}
+#endif /* !UNIV_DEBUG */
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -4624,23 +4700,13 @@ btr_free_externally_stored_field(
ulint page_no;
ulint next_page_no;
mtr_t mtr;
-#ifdef UNIV_DEBUG
+
ut_ad(mtr_memo_contains(local_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains_page(local_mtr, field_ref,
MTR_MEMO_PAGE_X_FIX));
ut_ad(!rec || rec_offs_validate(rec, index, offsets));
-
- if (rec) {
- ulint local_len;
- const byte* f = rec_get_nth_field(rec, offsets,
- i, &local_len);
- ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
- local_len -= BTR_EXTERN_FIELD_REF_SIZE;
- f += local_len;
- ut_ad(f == field_ref);
- }
-#endif /* UNIV_DEBUG */
+ ut_ad(!rec || field_ref == btr_rec_get_field_ref(rec, offsets, i));
if (UNIV_UNLIKELY(!memcmp(field_ref, field_ref_zero,
BTR_EXTERN_FIELD_REF_SIZE))) {
@@ -4672,18 +4738,52 @@ btr_free_externally_stored_field(
rec_zip_size = 0;
}
+#ifdef UNIV_BLOB_DEBUG
+ if (!(field_ref[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG)
+ && !((field_ref[BTR_EXTERN_LEN] & BTR_EXTERN_INHERITED_FLAG)
+ && (rb_ctx == RB_NORMAL || rb_ctx == RB_RECOVERY))) {
+ /* This off-page column will be freed.
+ Check that no references remain. */
+
+ btr_blob_dbg_t b;
+
+ b.blob_page_no = mach_read_from_4(
+ field_ref + BTR_EXTERN_PAGE_NO);
+
+ if (rec) {
+ /* Remove the reference from the record to the
+ BLOB. If the BLOB were not freed, the
+ reference would be removed when the record is
+ removed. Freeing the BLOB will overwrite the
+ BTR_EXTERN_PAGE_NO in the field_ref of the
+ record with FIL_NULL, which would make the
+ btr_blob_dbg information inconsistent with the
+ record. */
+ b.ref_page_no = page_get_page_no(page_align(rec));
+ b.ref_heap_no = page_rec_get_heap_no(rec);
+ b.ref_field_no = i;
+ btr_blob_dbg_rbt_delete(index, &b, "free");
+ }
+
+ btr_blob_dbg_assert_empty(index, b.blob_page_no);
+ }
+#endif /* UNIV_BLOB_DEBUG */
+
for (;;) {
+#ifdef UNIV_SYNC_DEBUG
buf_block_t* rec_block;
+#endif /* UNIV_SYNC_DEBUG */
buf_block_t* ext_block;
mtr_start(&mtr);
- rec_block = buf_page_get(page_get_space_id(
- page_align(field_ref)),
- rec_zip_size,
- page_get_page_no(
- page_align(field_ref)),
- RW_X_LATCH, &mtr);
+#ifdef UNIV_SYNC_DEBUG
+ rec_block =
+#endif /* UNIV_SYNC_DEBUG */
+ buf_page_get(page_get_space_id(page_align(field_ref)),
+ rec_zip_size,
+ page_get_page_no(page_align(field_ref)),
+ RW_X_LATCH, &mtr);
buf_block_dbg_add_level(rec_block, SYNC_NO_ORDER_CHECK);
page_no = mach_read_from_4(field_ref + BTR_EXTERN_PAGE_NO);
@@ -4800,13 +4900,8 @@ btr_rec_free_externally_stored_fields(
for (i = 0; i < n_fields; i++) {
if (rec_offs_nth_extern(offsets, i)) {
- ulint len;
- byte* data
- = rec_get_nth_field(rec, offsets, i, &len);
- ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
-
btr_free_externally_stored_field(
- index, data + len - BTR_EXTERN_FIELD_REF_SIZE,
+ index, btr_rec_get_field_ref(rec, offsets, i),
rec, offsets, page_zip, i, rb_ctx, mtr);
}
}
@@ -4918,27 +5013,45 @@ btr_copy_blob_prefix(
/*******************************************************************//**
Copies the prefix of a compressed BLOB. The clustered index record
-that points to this BLOB must be protected by a lock or a page latch. */
+that points to this BLOB must be protected by a lock or a page latch.
+@return number of bytes written to buf */
static
-void
+ulint
btr_copy_zblob_prefix(
/*==================*/
- z_stream* d_stream,/*!< in/out: the decompressing stream */
+ byte* buf, /*!< out: the externally stored part of
+ the field, or a prefix of it */
+ ulint len, /*!< in: length of buf, in bytes */
ulint zip_size,/*!< in: compressed BLOB page size */
ulint space_id,/*!< in: space id of the BLOB pages */
ulint page_no,/*!< in: page number of the first BLOB page */
ulint offset) /*!< in: offset on the first BLOB page */
{
- ulint page_type = FIL_PAGE_TYPE_ZBLOB;
+ ulint page_type = FIL_PAGE_TYPE_ZBLOB;
+ mem_heap_t* heap;
+ int err;
+ z_stream d_stream;
+
+ d_stream.next_out = buf;
+ d_stream.avail_out = len;
+ d_stream.next_in = Z_NULL;
+ d_stream.avail_in = 0;
+
+ /* Zlib inflate needs 32 kilobytes for the default
+ window size, plus a few kilobytes for small objects. */
+ heap = mem_heap_create(40000);
+ page_zip_set_alloc(&d_stream, heap);
ut_ad(ut_is_2pow(zip_size));
ut_ad(zip_size >= PAGE_ZIP_MIN_SIZE);
ut_ad(zip_size <= UNIV_PAGE_SIZE);
ut_ad(space_id);
+ err = inflateInit(&d_stream);
+ ut_a(err == Z_OK);
+
for (;;) {
buf_page_t* bpage;
- int err;
ulint next_page_no;
/* There is no latch on bpage directly. Instead,
@@ -4954,7 +5067,7 @@ btr_copy_zblob_prefix(
" compressed BLOB"
" page %lu space %lu\n",
(ulong) page_no, (ulong) space_id);
- return;
+ goto func_exit;
}
if (UNIV_UNLIKELY
@@ -4980,13 +5093,13 @@ btr_copy_zblob_prefix(
offset += 4;
}
- d_stream->next_in = bpage->zip.data + offset;
- d_stream->avail_in = zip_size - offset;
+ d_stream.next_in = bpage->zip.data + offset;
+ d_stream.avail_in = zip_size - offset;
- err = inflate(d_stream, Z_NO_FLUSH);
+ err = inflate(&d_stream, Z_NO_FLUSH);
switch (err) {
case Z_OK:
- if (!d_stream->avail_out) {
+ if (!d_stream.avail_out) {
goto end_of_blob;
}
break;
@@ -5003,13 +5116,13 @@ inflate_error:
" compressed BLOB"
" page %lu space %lu returned %d (%s)\n",
(ulong) page_no, (ulong) space_id,
- err, d_stream->msg);
+ err, d_stream.msg);
case Z_BUF_ERROR:
goto end_of_blob;
}
if (next_page_no == FIL_NULL) {
- if (!d_stream->avail_in) {
+ if (!d_stream.avail_in) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: unexpected end of"
@@ -5018,7 +5131,7 @@ inflate_error:
(ulong) page_no,
(ulong) space_id);
} else {
- err = inflate(d_stream, Z_FINISH);
+ err = inflate(&d_stream, Z_FINISH);
switch (err) {
case Z_STREAM_END:
case Z_BUF_ERROR:
@@ -5030,7 +5143,7 @@ inflate_error:
end_of_blob:
buf_page_release_zip(bpage);
- return;
+ goto func_exit;
}
buf_page_release_zip(bpage);
@@ -5042,6 +5155,12 @@ end_of_blob:
offset = FIL_PAGE_NEXT;
page_type = FIL_PAGE_TYPE_ZBLOB2;
}
+
+func_exit:
+ inflateEnd(&d_stream);
+ mem_heap_free(heap);
+ UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
+ return(d_stream.total_out);
}
/*******************************************************************//**
@@ -5067,28 +5186,8 @@ btr_copy_externally_stored_field_prefix_low(
}
if (UNIV_UNLIKELY(zip_size)) {
- int err;
- z_stream d_stream;
- mem_heap_t* heap;
-
- /* Zlib inflate needs 32 kilobytes for the default
- window size, plus a few kilobytes for small objects. */
- heap = mem_heap_create(40000);
- page_zip_set_alloc(&d_stream, heap);
-
- err = inflateInit(&d_stream);
- ut_a(err == Z_OK);
-
- d_stream.next_out = buf;
- d_stream.avail_out = len;
- d_stream.avail_in = 0;
-
- btr_copy_zblob_prefix(&d_stream, zip_size,
- space_id, page_no, offset);
- inflateEnd(&d_stream);
- mem_heap_free(heap);
- UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
- return(d_stream.total_out);
+ return(btr_copy_zblob_prefix(buf, len, zip_size,
+ space_id, page_no, offset));
} else {
return(btr_copy_blob_prefix(buf, len, space_id,
page_no, offset));
diff --git a/storage/xtradb/btr/btr0pcur.c b/storage/xtradb/btr/btr0pcur.c
index 537c26f6bf2..f95a5487c94 100644
--- a/storage/xtradb/btr/btr0pcur.c
+++ b/storage/xtradb/btr/btr0pcur.c
@@ -467,7 +467,6 @@ btr_pcur_move_backward_from_page(
mtr_t* mtr) /*!< in: mtr */
{
ulint prev_page_no;
- ulint space;
page_t* page;
buf_block_t* prev_block;
ulint latch_mode;
@@ -503,7 +502,6 @@ btr_pcur_move_backward_from_page(
page = btr_pcur_get_page(cursor);
prev_page_no = btr_page_get_prev(page, mtr);
- space = buf_block_get_space(btr_pcur_get_block(cursor));
if (prev_page_no == FIL_NULL) {
} else if (btr_pcur_is_before_first_on_page(cursor)) {
diff --git a/storage/xtradb/btr/btr0sea.c b/storage/xtradb/btr/btr0sea.c
index 6628333d32a..0630b634b53 100644
--- a/storage/xtradb/btr/btr0sea.c
+++ b/storage/xtradb/btr/btr0sea.c
@@ -48,9 +48,16 @@ Protected by btr_search_latch and btr_search_enabled_mutex. */
UNIV_INTERN char btr_search_enabled = TRUE;
UNIV_INTERN ibool btr_search_fully_disabled = FALSE;
+UNIV_INTERN ulint btr_search_index_num = 1;
+
/** Mutex protecting btr_search_enabled */
static mutex_t btr_search_enabled_mutex;
+#ifdef UNIV_PFS_MUTEX
+/* Key to register btr_search_enabled_mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t btr_search_enabled_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
/** A dummy variable to fool the compiler */
UNIV_INTERN ulint btr_search_this_is_zero = 0;
@@ -74,7 +81,9 @@ indexes. */
/* We will allocate the latch from dynamic memory to get it to the
same DRAM page as other hotspot semaphores */
-UNIV_INTERN rw_lock_t* btr_search_latch_temp;
+//UNIV_INTERN rw_lock_t* btr_search_latch_temp;
+
+UNIV_INTERN rw_lock_t** btr_search_latch_part;
/** padding to prevent other memory update hotspots from residing on
the same memory cache line */
@@ -83,6 +92,11 @@ UNIV_INTERN byte btr_sea_pad2[64];
/** The adaptive hash index */
UNIV_INTERN btr_search_sys_t* btr_search_sys;
+#ifdef UNIV_PFS_RWLOCK
+/* Key to register btr_search_sys with performance schema */
+UNIV_INTERN mysql_pfs_key_t btr_search_latch_key;
+#endif /* UNIV_PFS_RWLOCK */
+
/** If the number of records on the page divided by this parameter
would have been successfully accessed using a hash index, the index
is then built on the page, assuming the global limit has been reached */
@@ -121,18 +135,19 @@ allocate a new node to the hash table, it will succeed. However, the check
will not guarantee success. */
static
void
-btr_search_check_free_space_in_heap(void)
+btr_search_check_free_space_in_heap(
/*=====================================*/
+ index_id_t key)
{
hash_table_t* table;
mem_heap_t* heap;
#ifdef UNIV_SYNC_DEBUG
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ ut_ad(!rw_lock_own(btr_search_get_latch(key), RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(btr_search_get_latch(key), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
- table = btr_search_sys->hash_index;
+ table = btr_search_get_hash_index(key);
heap = table->heap;
@@ -141,9 +156,9 @@ btr_search_check_free_space_in_heap(void)
be enough free space in the hash table. */
if (heap->free_block == NULL) {
- buf_block_t* block = buf_block_alloc(0);
+ buf_block_t* block = buf_block_alloc(NULL);
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(key));
if (heap->free_block == NULL) {
heap->free_block = block;
@@ -151,7 +166,7 @@ btr_search_check_free_space_in_heap(void)
buf_block_free(block);
}
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(key));
}
}
@@ -163,17 +178,30 @@ btr_search_sys_create(
/*==================*/
ulint hash_size) /*!< in: hash index hash table size */
{
+ ulint i;
/* We allocate the search latch from dynamic memory:
see above at the global variable definition */
- btr_search_latch_temp = mem_alloc(sizeof(rw_lock_t));
+ //btr_search_latch_temp = mem_alloc(sizeof(rw_lock_t));
- rw_lock_create(&btr_search_latch, SYNC_SEARCH_SYS);
- mutex_create(&btr_search_enabled_mutex, SYNC_SEARCH_SYS_CONF);
+ //rw_lock_create(btr_search_latch_key, &btr_search_latch,
+ // SYNC_SEARCH_SYS);
+ mutex_create(btr_search_enabled_mutex_key,
+ &btr_search_enabled_mutex, SYNC_SEARCH_SYS_CONF);
btr_search_sys = mem_alloc(sizeof(btr_search_sys_t));
- btr_search_sys->hash_index = ha_create(hash_size, 0, 0);
+ /* btr_search_index_num should be <= 32. (bits of trx->has_search_latch) */
+ btr_search_latch_part = mem_alloc(sizeof(rw_lock_t*) * btr_search_index_num);
+ btr_search_sys->hash_index = mem_alloc(sizeof(hash_table_t*) * btr_search_index_num);
+ for (i = 0; i < btr_search_index_num; i++) {
+ btr_search_latch_part[i] = mem_alloc(sizeof(rw_lock_t));
+
+ rw_lock_create(btr_search_latch_key,
+ btr_search_latch_part[i], SYNC_SEARCH_SYS);
+
+ btr_search_sys->hash_index[i] = ha_create(hash_size, 0, 0);
+ }
}
/*****************************************************************//**
@@ -183,11 +211,22 @@ void
btr_search_sys_free(void)
/*=====================*/
{
- rw_lock_free(&btr_search_latch);
- mem_free(btr_search_latch_temp);
- btr_search_latch_temp = NULL;
- mem_heap_free(btr_search_sys->hash_index->heap);
- hash_table_free(btr_search_sys->hash_index);
+ ulint i;
+
+ for (i = 0; i < btr_search_index_num; i++) {
+ mem_heap_free(btr_search_sys->hash_index[i]->heap);
+ hash_table_free(btr_search_sys->hash_index[i]);
+
+ rw_lock_free(btr_search_latch_part[i]);
+
+ mem_free(btr_search_latch_part[i]);
+ }
+ mem_free(btr_search_sys->hash_index);
+ mem_free(btr_search_latch_part);
+
+ //rw_lock_free(&btr_search_latch);
+ //mem_free(btr_search_latch_temp);
+ //btr_search_latch_temp = NULL;
mem_free(btr_search_sys);
btr_search_sys = NULL;
}
@@ -200,7 +239,7 @@ btr_search_disable(void)
/*====================*/
{
mutex_enter(&btr_search_enabled_mutex);
- rw_lock_x_lock(&btr_search_latch);
+ btr_search_x_lock_all();
/* Disable access to hash index, also tell ha_insert_for_fold()
stop adding new nodes to hash index, but still allow updating
@@ -218,7 +257,7 @@ btr_search_disable(void)
/* btr_search_enabled_mutex should guarantee this. */
ut_ad(!btr_search_enabled);
- rw_lock_x_unlock(&btr_search_latch);
+ btr_search_x_unlock_all();
mutex_exit(&btr_search_enabled_mutex);
}
@@ -230,12 +269,12 @@ btr_search_enable(void)
/*====================*/
{
mutex_enter(&btr_search_enabled_mutex);
- rw_lock_x_lock(&btr_search_latch);
+ btr_search_x_lock_all();
btr_search_enabled = TRUE;
btr_search_fully_disabled = FALSE;
- rw_lock_x_unlock(&btr_search_latch);
+ btr_search_x_unlock_all();
mutex_exit(&btr_search_enabled_mutex);
}
@@ -288,20 +327,21 @@ UNIV_INTERN
ulint
btr_search_info_get_ref_count(
/*==========================*/
- btr_search_t* info) /*!< in: search info. */
+ btr_search_t* info, /*!< in: search info. */
+ index_id_t key)
{
ulint ret;
ut_ad(info);
#ifdef UNIV_SYNC_DEBUG
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ ut_ad(!rw_lock_own(btr_search_get_latch(key), RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(btr_search_get_latch(key), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
- rw_lock_s_lock(&btr_search_latch);
+ rw_lock_s_lock(btr_search_get_latch(key));
ret = info->ref_count;
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(key));
return(ret);
}
@@ -322,8 +362,8 @@ btr_search_info_update_hash(
int cmp;
#ifdef UNIV_SYNC_DEBUG
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index->id), RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index->id), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
index = cursor->index;
@@ -441,8 +481,8 @@ btr_search_update_block_hash_info(
/*!< in: cursor */
{
#ifdef UNIV_SYNC_DEBUG
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index->id), RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index->id), RW_LOCK_EX));
ut_ad(rw_lock_own(&block->lock, RW_LOCK_SHARED)
|| rw_lock_own(&block->lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
@@ -520,13 +560,13 @@ btr_search_update_hash_ref(
buf_block_t* block, /*!< in: buffer block where cursor positioned */
btr_cur_t* cursor) /*!< in: cursor */
{
- ulint fold;
- rec_t* rec;
- dulint index_id;
+ ulint fold;
+ rec_t* rec;
+ index_id_t index_id;
ut_ad(cursor->flag == BTR_CUR_HASH_FAIL);
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ ut_ad(rw_lock_own(btr_search_get_latch(cursor->index->id), RW_LOCK_EX));
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
@@ -566,10 +606,10 @@ btr_search_update_hash_ref(
mem_heap_free(heap);
}
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ ut_ad(rw_lock_own(btr_search_get_latch(cursor->index->id), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
- ha_insert_for_fold(btr_search_sys->hash_index, fold,
+ ha_insert_for_fold(btr_search_get_hash_index(cursor->index->id), fold,
block, rec);
}
}
@@ -589,8 +629,8 @@ btr_search_info_update_slow(
ulint* params2;
#ifdef UNIV_SYNC_DEBUG
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index->id), RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(btr_search_get_latch(cursor->index->id), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
block = btr_cur_get_block(cursor);
@@ -611,7 +651,7 @@ btr_search_info_update_slow(
if (build_index || (cursor->flag == BTR_CUR_HASH_FAIL)) {
- btr_search_check_free_space_in_heap();
+ btr_search_check_free_space_in_heap(cursor->index->id);
}
if (cursor->flag == BTR_CUR_HASH_FAIL) {
@@ -621,11 +661,11 @@ btr_search_info_update_slow(
btr_search_n_hash_fail++;
#endif /* UNIV_SEARCH_PERF_STAT */
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(cursor->index->id));
btr_search_update_hash_ref(info, block, cursor);
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(cursor->index->id));
}
if (build_index) {
@@ -828,10 +868,11 @@ btr_search_guess_on_hash(
RW_S_LATCH, RW_X_LATCH, or 0 */
mtr_t* mtr) /*!< in: mtr */
{
+ buf_pool_t* buf_pool;
buf_block_t* block;
rec_t* rec;
ulint fold;
- dulint index_id;
+ index_id_t index_id;
#ifdef notdefined
btr_cur_t cursor2;
btr_pcur_t pcur;
@@ -868,17 +909,17 @@ btr_search_guess_on_hash(
cursor->flag = BTR_CUR_HASH;
if (UNIV_LIKELY(!has_search_latch)) {
- rw_lock_s_lock(&btr_search_latch);
+ rw_lock_s_lock(btr_search_get_latch(index_id));
if (UNIV_UNLIKELY(!btr_search_enabled)) {
goto failure_unlock;
}
}
- ut_ad(rw_lock_get_writer(&btr_search_latch) != RW_LOCK_EX);
- ut_ad(rw_lock_get_reader_count(&btr_search_latch) > 0);
+ ut_ad(rw_lock_get_writer(btr_search_get_latch(index_id)) != RW_LOCK_EX);
+ ut_ad(rw_lock_get_reader_count(btr_search_get_latch(index_id)) > 0);
- rec = ha_search_and_get_data(btr_search_sys->hash_index, fold);
+ rec = ha_search_and_get_data(btr_search_get_hash_index(index_id), fold);
if (UNIV_UNLIKELY(!rec)) {
goto failure_unlock;
@@ -896,7 +937,7 @@ btr_search_guess_on_hash(
goto failure_unlock;
}
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index_id));
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
}
@@ -923,8 +964,7 @@ btr_search_guess_on_hash(
is positioned on. We cannot look at the next of the previous
record to determine if our guess for the cursor position is
right. */
- if (UNIV_EXPECT
- (ut_dulint_cmp(index_id, btr_page_get_index_id(block->frame)), 0)
+ if (UNIV_UNLIKELY(index_id != btr_page_get_index_id(block->frame))
|| !btr_search_check_guess(cursor,
has_search_latch,
tuple, mode, mtr)) {
@@ -986,7 +1026,7 @@ btr_search_guess_on_hash(
/* Increment the page get statistics though we did not really
fix the page: for user info only */
-
+ buf_pool = buf_pool_from_bpage(&block->page);
buf_pool->stat.n_page_gets++;
return(TRUE);
@@ -994,7 +1034,7 @@ btr_search_guess_on_hash(
/*-------------------------------------------*/
failure_unlock:
if (UNIV_LIKELY(!has_search_latch)) {
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index_id));
}
failure:
cursor->flag = BTR_CUR_HASH_FAIL;
@@ -1017,10 +1057,11 @@ UNIV_INTERN
void
btr_search_drop_page_hash_index(
/*============================*/
- buf_block_t* block) /*!< in: block containing index page,
+ buf_block_t* block, /*!< in: block containing index page,
s- or x-latched, or an index page
for which we know that
block->buf_fix_count == 0 */
+ dict_index_t* index_in)
{
hash_table_t* table;
ulint n_fields;
@@ -1029,7 +1070,7 @@ btr_search_drop_page_hash_index(
const rec_t* rec;
ulint fold;
ulint prev_fold;
- dulint index_id;
+ index_id_t index_id;
ulint n_cached;
ulint n_recs;
ulint* folds;
@@ -1039,22 +1080,60 @@ btr_search_drop_page_hash_index(
ulint* offsets;
#ifdef UNIV_SYNC_DEBUG
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ if (index_in) {
+ ut_ad(!rw_lock_own(btr_search_get_latch(index_in->id), RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(btr_search_get_latch(index_in->id), RW_LOCK_EX));
+ }
#endif /* UNIV_SYNC_DEBUG */
retry:
- rw_lock_s_lock(&btr_search_latch);
+ if (index_in) {
+ index = index_in;
+ rw_lock_s_lock(btr_search_get_latch(index->id));
+ } else if (btr_search_index_num > 1) {
+ rw_lock_t* btr_search_latch;
+
+ /* FIXME: This may be optimistic implementation still. */
+ btr_search_latch = (rw_lock_t*)(block->btr_search_latch);
+ if (UNIV_LIKELY(!btr_search_latch)) {
+ if (block->is_hashed) {
+ goto retry;
+ }
+ return;
+ }
+ rw_lock_s_lock(btr_search_latch);
+ if (UNIV_LIKELY(btr_search_latch != block->btr_search_latch)) {
+ rw_lock_s_unlock(btr_search_latch);
+ goto retry;
+ }
+ if (UNIV_LIKELY(!block->is_hashed)) {
+ rw_lock_s_unlock(btr_search_latch);
+ goto retry;
+ }
+ index = block->index;
+ ut_a(btr_search_latch == btr_search_get_latch(index->id));
+ } else {
+ /* btr_search_index_num == 1 */
+ /* btr_search_latch is only one and able to obtain
+ before evaluating block->is_hashed. */
+ rw_lock_s_lock(btr_search_latch_part[0]);
+ if (UNIV_LIKELY(!block->is_hashed)) {
+ rw_lock_s_unlock(btr_search_latch_part[0]);
+ return;
+ }
+ index = block->index;
+ }
+
page = block->frame;
if (UNIV_LIKELY(!block->is_hashed)) {
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
return;
}
- table = btr_search_sys->hash_index;
+ table = btr_search_get_hash_index(index->id);
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
@@ -1064,14 +1143,14 @@ retry:
n_fields = block->curr_n_fields;
n_bytes = block->curr_n_bytes;
- index = block->index;
+ ut_a(index == block->index);
ut_a(!dict_index_is_ibuf(index));
/* NOTE: The fields of block must not be accessed after
releasing btr_search_latch, as the index page might only
be s-latched! */
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
ut_a(n_fields + n_bytes > 0);
@@ -1089,7 +1168,7 @@ retry:
index_id = btr_page_get_index_id(page);
- ut_a(0 == ut_dulint_cmp(index_id, index->id));
+ ut_a(index_id == index->id);
prev_fold = 0;
@@ -1121,7 +1200,7 @@ next_rec:
mem_heap_free(heap);
}
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(index->id));
if (UNIV_UNLIKELY(!block->is_hashed)) {
/* Someone else has meanwhile dropped the hash index */
@@ -1137,7 +1216,7 @@ next_rec:
/* Someone else has meanwhile built a new hash index on the
page, with different parameters */
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(index->id));
mem_free(folds);
goto retry;
@@ -1153,6 +1232,7 @@ next_rec:
block->is_hashed = FALSE;
block->index = NULL;
+ block->btr_search_latch = NULL;
cleanup:
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
@@ -1165,14 +1245,14 @@ cleanup:
"InnoDB: the hash index to a page of %s,"
" still %lu hash nodes remain.\n",
index->name, (ulong) block->n_pointers);
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(index->id));
btr_search_validate();
} else {
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(index->id));
}
#else /* UNIV_AHI_DEBUG || UNIV_DEBUG */
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(index->id));
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
mem_free(folds);
@@ -1186,7 +1266,7 @@ btr_search_drop_page_hash_index_on_index(
/*=====================================*/
dict_index_t* index) /* in: record descriptor */
{
- buf_page_t* bpage;
+
hash_table_t* table;
buf_block_t* block;
ulint n_fields;
@@ -1195,103 +1275,157 @@ btr_search_drop_page_hash_index_on_index(
const rec_t* rec;
ulint fold;
ulint prev_fold;
- dulint index_id;
+ index_id_t index_id;
ulint n_cached;
ulint n_recs;
ulint* folds;
- ulint i;
+ ulint i, j;
mem_heap_t* heap = NULL;
ulint* offsets;
+ ibool released_search_latch;
- rw_lock_x_lock(&btr_search_latch);
- mutex_enter(&LRU_list_mutex);
+ rw_lock_s_lock(btr_search_get_latch(index->id));
- table = btr_search_sys->hash_index;
+ table = btr_search_get_hash_index(index->id);
- bpage = UT_LIST_GET_LAST(buf_pool->LRU);
+ for (j = 0; j < srv_buf_pool_instances; j++) {
+ buf_pool_t* buf_pool;
- while (bpage != NULL) {
- block = (buf_block_t*) bpage;
- if (block->index == index && block->is_hashed) {
- page = block->frame;
+ buf_pool = buf_pool_from_array(j);
- /* from btr_search_drop_page_hash_index() */
- n_fields = block->curr_n_fields;
- n_bytes = block->curr_n_bytes;
+ do {
+ buf_chunk_t* chunks = buf_pool->chunks;
+ buf_chunk_t* chunk = chunks + buf_pool->n_chunks;
+
+ released_search_latch = FALSE;
+
+ while (--chunk >= chunks) {
+ block = chunk->blocks;
+ i = chunk->size;
+
+retry:
+ for (; i--; block++) {
+ if (buf_block_get_state(block)
+ != BUF_BLOCK_FILE_PAGE
+ || block->index != index
+ || !block->is_hashed) {
+ continue;
+ }
- ut_a(n_fields + n_bytes > 0);
+ page = block->frame;
- n_recs = page_get_n_recs(page);
+ /* from btr_search_drop_page_hash_index() */
+ n_fields = block->curr_n_fields;
+ n_bytes = block->curr_n_bytes;
- /* Calculate and cache fold values into an array for fast deletion
- from the hash index */
- folds = mem_alloc(n_recs * sizeof(ulint));
+ /* keeping latch order */
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
+ released_search_latch = TRUE;
+ rw_lock_x_lock(&block->lock);
- n_cached = 0;
- rec = page_get_infimum_rec(page);
- rec = page_rec_get_next_low(rec, page_is_comp(page));
+ ut_a(n_fields + n_bytes > 0);
- index_id = btr_page_get_index_id(page);
+ n_recs = page_get_n_recs(page);
+
+ /* Calculate and cache fold values into an array for fast deletion
+ from the hash index */
+
+ folds = mem_alloc(n_recs * sizeof(ulint));
+
+ n_cached = 0;
+
+ rec = page_get_infimum_rec(page);
+ rec = page_rec_get_next_low(rec, page_is_comp(page));
+
+ index_id = btr_page_get_index_id(page);
- ut_a(0 == ut_dulint_cmp(index_id, index->id));
+ ut_a(index_id == index->id);
- prev_fold = 0;
+ prev_fold = 0;
- offsets = NULL;
+ offsets = NULL;
- while (!page_rec_is_supremum(rec)) {
- offsets = rec_get_offsets(rec, index, offsets,
- n_fields + (n_bytes > 0), &heap);
- ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
- fold = rec_fold(rec, offsets, n_fields, n_bytes, index_id);
+ while (!page_rec_is_supremum(rec)) {
+ offsets = rec_get_offsets(rec, index, offsets,
+ n_fields + (n_bytes > 0), &heap);
+ ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
+ fold = rec_fold(rec, offsets, n_fields, n_bytes, index_id);
- if (fold == prev_fold && prev_fold != 0) {
+ if (fold == prev_fold && prev_fold != 0) {
- goto next_rec;
- }
+ goto next_rec;
+ }
- /* Remove all hash nodes pointing to this page from the
- hash chain */
+ /* Remove all hash nodes pointing to this page from the
+ hash chain */
- folds[n_cached] = fold;
- n_cached++;
+ folds[n_cached] = fold;
+ n_cached++;
next_rec:
- rec = page_rec_get_next_low(rec, page_rec_is_comp(rec));
- prev_fold = fold;
- }
+ rec = page_rec_get_next_low(rec, page_rec_is_comp(rec));
+ prev_fold = fold;
+ }
- for (i = 0; i < n_cached; i++) {
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_empty(heap);
+ }
- ha_remove_all_nodes_to_page(table, folds[i], page);
- }
+ rw_lock_x_lock(btr_search_get_latch(index->id));
- ut_a(index->search_info->ref_count > 0);
- index->search_info->ref_count--;
+ if (UNIV_UNLIKELY(!block->is_hashed)) {
+ goto cleanup;
+ }
- block->is_hashed = FALSE;
- block->index = NULL;
-
+ ut_a(block->index == index);
+
+ if (UNIV_UNLIKELY(block->curr_n_fields != n_fields)
+ || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
+ rw_lock_x_unlock(btr_search_get_latch(index->id));
+ rw_lock_x_unlock(&block->lock);
+
+ mem_free(folds);
+
+ rw_lock_s_lock(btr_search_get_latch(index->id));
+ goto retry;
+ }
+
+ for (i = 0; i < n_cached; i++) {
+
+ ha_remove_all_nodes_to_page(table, folds[i], page);
+ }
+
+ ut_a(index->search_info->ref_count > 0);
+ index->search_info->ref_count--;
+
+ block->is_hashed = FALSE;
+ block->index = NULL;
+ block->btr_search_latch = NULL;
+
+cleanup:
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- if (UNIV_UNLIKELY(block->n_pointers)) {
- /* Corruption */
- ut_print_timestamp(stderr);
- fprintf(stderr,
-" InnoDB: Corruption of adaptive hash index. After dropping\n"
-"InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n",
- index->name, (ulong) block->n_pointers);
- }
+ if (UNIV_UNLIKELY(block->n_pointers)) {
+ /* Corruption */
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+"InnoDB: The adaptive hash index is corrupted. After dropping\n"
+"InnoDB: the hash index to a page of %s, %lu hash nodes still remain.\n",
+ index->name, (ulong) block->n_pointers);
+ }
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+ rw_lock_x_unlock(btr_search_get_latch(index->id));
+ rw_lock_x_unlock(&block->lock);
- mem_free(folds);
- }
+ mem_free(folds);
- bpage = UT_LIST_GET_PREV(LRU, bpage);
+ rw_lock_s_lock(btr_search_get_latch(index->id));
+ }
+ }
+ } while (released_search_latch);
}
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -1326,8 +1460,8 @@ btr_search_drop_page_hash_when_freed(
having to fear a deadlock. */
block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH, NULL,
- BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
- &mtr);
+ BUF_PEEK_IF_IN_POOL, __FILE__, __LINE__,
+ &mtr);
/* Because the buffer pool mutex was released by
buf_page_peek_if_search_hashed(), it is possible that the
block was removed from the buffer pool by another thread
@@ -1338,7 +1472,7 @@ btr_search_drop_page_hash_when_freed(
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, NULL);
}
mtr_commit(&mtr);
@@ -1366,7 +1500,7 @@ btr_search_build_page_hash_index(
rec_t* next_rec;
ulint fold;
ulint next_fold;
- dulint index_id;
+ index_id_t index_id;
ulint n_cached;
ulint n_recs;
ulint* folds;
@@ -1380,26 +1514,26 @@ btr_search_build_page_hash_index(
ut_ad(index);
ut_a(!dict_index_is_ibuf(index));
- table = btr_search_sys->hash_index;
+ table = btr_search_get_hash_index(index->id);
page = buf_block_get_frame(block);
#ifdef UNIV_SYNC_DEBUG
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ ut_ad(!rw_lock_own(btr_search_get_latch(index->id), RW_LOCK_EX));
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
- rw_lock_s_lock(&btr_search_latch);
+ rw_lock_s_lock(btr_search_get_latch(index->id));
if (block->is_hashed && ((block->curr_n_fields != n_fields)
|| (block->curr_n_bytes != n_bytes)
|| (block->curr_left_side != left_side))) {
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, index);
} else {
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
}
n_recs = page_get_n_recs(page);
@@ -1493,9 +1627,9 @@ btr_search_build_page_hash_index(
fold = next_fold;
}
- btr_search_check_free_space_in_heap();
+ btr_search_check_free_space_in_heap(index->id);
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(index->id));
if (UNIV_UNLIKELY(btr_search_fully_disabled)) {
goto exit_func;
@@ -1523,6 +1657,7 @@ btr_search_build_page_hash_index(
block->curr_n_bytes = n_bytes;
block->curr_left_side = left_side;
block->index = index;
+ block->btr_search_latch = btr_search_get_latch(index->id);
for (i = 0; i < n_cached; i++) {
@@ -1530,7 +1665,7 @@ btr_search_build_page_hash_index(
}
exit_func:
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(index->id));
mem_free(folds);
mem_free(recs);
@@ -1569,13 +1704,13 @@ btr_search_move_or_delete_hash_entries(
ut_a(!(new_block->is_hashed || block->is_hashed)
|| !dict_index_is_ibuf(index));
- rw_lock_s_lock(&btr_search_latch);
+ rw_lock_s_lock(btr_search_get_latch(index->id));
if (new_block->is_hashed) {
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, index);
return;
}
@@ -1590,7 +1725,7 @@ btr_search_move_or_delete_hash_entries(
new_block->n_bytes = block->curr_n_bytes;
new_block->left_side = left_side;
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
ut_a(n_fields + n_bytes > 0);
@@ -1602,7 +1737,7 @@ btr_search_move_or_delete_hash_entries(
return;
}
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
}
/********************************************************************//**
@@ -1619,8 +1754,7 @@ btr_search_update_hash_on_delete(
buf_block_t* block;
rec_t* rec;
ulint fold;
- dulint index_id;
- ibool found;
+ index_id_t index_id;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
mem_heap_t* heap = NULL;
rec_offs_init(offsets_);
@@ -1642,7 +1776,7 @@ btr_search_update_hash_on_delete(
ut_a(block->curr_n_fields + block->curr_n_bytes > 0);
ut_a(!dict_index_is_ibuf(cursor->index));
- table = btr_search_sys->hash_index;
+ table = btr_search_get_hash_index(cursor->index->id);
index_id = cursor->index->id;
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_,
@@ -1651,11 +1785,11 @@ btr_search_update_hash_on_delete(
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(cursor->index->id));
- found = ha_search_and_delete_if_found(table, fold, rec);
+ ha_search_and_delete_if_found(table, fold, rec);
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(cursor->index->id));
}
/********************************************************************//**
@@ -1689,21 +1823,21 @@ btr_search_update_hash_node_on_insert(
ut_a(block->index == cursor->index);
ut_a(!dict_index_is_ibuf(cursor->index));
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(cursor->index->id));
if ((cursor->flag == BTR_CUR_HASH)
&& (cursor->n_fields == block->curr_n_fields)
&& (cursor->n_bytes == block->curr_n_bytes)
&& !block->curr_left_side) {
- table = btr_search_sys->hash_index;
+ table = btr_search_get_hash_index(cursor->index->id);
ha_search_and_update_if_found(table, cursor->fold, rec,
block, page_rec_get_next(rec));
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(cursor->index->id));
} else {
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(cursor->index->id));
btr_search_update_hash_on_insert(cursor);
}
@@ -1725,7 +1859,7 @@ btr_search_update_hash_on_insert(
rec_t* rec;
rec_t* ins_rec;
rec_t* next_rec;
- dulint index_id;
+ index_id_t index_id;
ulint fold;
ulint ins_fold;
ulint next_fold = 0; /* remove warning (??? bug ???) */
@@ -1738,9 +1872,9 @@ btr_search_update_hash_on_insert(
ulint* offsets = offsets_;
rec_offs_init(offsets_);
- table = btr_search_sys->hash_index;
+ table = btr_search_get_hash_index(cursor->index->id);
- btr_search_check_free_space_in_heap();
+ btr_search_check_free_space_in_heap(cursor->index->id);
rec = btr_cur_get_rec(cursor);
@@ -1785,7 +1919,7 @@ btr_search_update_hash_on_insert(
} else {
if (left_side) {
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(index_id));
locked = TRUE;
@@ -1799,7 +1933,7 @@ btr_search_update_hash_on_insert(
if (!locked) {
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(index_id));
locked = TRUE;
}
@@ -1817,7 +1951,7 @@ check_next_rec:
if (!left_side) {
if (!locked) {
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(index_id));
locked = TRUE;
}
@@ -1832,7 +1966,7 @@ check_next_rec:
if (!locked) {
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(index_id));
locked = TRUE;
}
@@ -1855,7 +1989,7 @@ function_exit:
mem_heap_free(heap);
}
if (locked) {
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(index_id));
}
}
@@ -1871,7 +2005,7 @@ btr_search_validate(void)
ha_node_t* node;
ulint n_page_dumps = 0;
ibool ok = TRUE;
- ulint i;
+ ulint i,j;
ulint cell_count;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
@@ -1883,31 +2017,34 @@ btr_search_validate(void)
rec_offs_init(offsets_);
- rw_lock_x_lock(&btr_search_latch);
- //buf_pool_mutex_enter();
- rw_lock_x_lock(&page_hash_latch);
+ btr_search_x_lock_all();
+ buf_pool_page_hash_x_lock_all();
+
+ for (j = 0; j < btr_search_index_num; j++) {
- cell_count = hash_get_n_cells(btr_search_sys->hash_index);
+ cell_count = hash_get_n_cells(btr_search_sys->hash_index[j]);
for (i = 0; i < cell_count; i++) {
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if ((i != 0) && ((i % chunk_size) == 0)) {
- //buf_pool_mutex_exit();
- rw_lock_x_unlock(&page_hash_latch);
- rw_lock_x_unlock(&btr_search_latch);
+ buf_pool_page_hash_x_unlock_all();
+ btr_search_x_unlock_all();
os_thread_yield();
- rw_lock_x_lock(&btr_search_latch);
- //buf_pool_mutex_enter();
- rw_lock_x_lock(&page_hash_latch);
+ btr_search_x_lock_all();
+ buf_pool_page_hash_x_lock_all();
}
- node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;
+ node = hash_get_nth_cell(btr_search_sys->hash_index[j], i)->node;
for (; node != NULL; node = node->next) {
const buf_block_t* block
= buf_block_align(node->data);
const buf_block_t* hash_block;
+ buf_pool_t* buf_pool;
+ index_id_t page_index_id;
+
+ buf_pool = buf_pool_from_bpage((buf_page_t*) block);
if (UNIV_LIKELY(buf_block_get_state(block)
== BUF_BLOCK_FILE_PAGE)) {
@@ -1918,6 +2055,7 @@ btr_search_validate(void)
(BUF_BLOCK_REMOVE_HASH, see the
assertion and the comment below) */
hash_block = buf_block_hash_get(
+ buf_pool,
buf_block_get_space(block),
buf_block_get_page_no(block));
} else {
@@ -1949,12 +2087,15 @@ btr_search_validate(void)
+ (block->curr_n_bytes > 0),
&heap);
- if (!block->is_hashed || node->fold
- != rec_fold((rec_t*)(node->data),
- offsets,
- block->curr_n_fields,
- block->curr_n_bytes,
- btr_page_get_index_id(block->frame))) {
+ page_index_id = btr_page_get_index_id(block->frame);
+
+ if (UNIV_UNLIKELY
+ (!block->is_hashed || node->fold
+ != rec_fold((rec_t*)(node->data),
+ offsets,
+ block->curr_n_fields,
+ block->curr_n_bytes,
+ page_index_id))) {
const page_t* page = block->frame;
ok = FALSE;
@@ -1964,21 +2105,17 @@ btr_search_validate(void)
" InnoDB: Error in an adaptive hash"
" index pointer to page %lu\n"
"InnoDB: ptr mem address %p"
- " index id %lu %lu,"
+ " index id %llu,"
" node fold %lu, rec fold %lu\n",
(ulong) page_get_page_no(page),
node->data,
- (ulong) ut_dulint_get_high(
- btr_page_get_index_id(page)),
- (ulong) ut_dulint_get_low(
- btr_page_get_index_id(page)),
+ (ullint) page_index_id,
(ulong) node->fold,
(ulong) rec_fold((rec_t*)(node->data),
offsets,
block->curr_n_fields,
block->curr_n_bytes,
- btr_page_get_index_id(
- page)));
+ page_index_id));
fputs("InnoDB: Record ", stderr);
rec_print_new(stderr, (rec_t*)node->data,
@@ -2006,23 +2143,22 @@ btr_search_validate(void)
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if (i != 0) {
- //buf_pool_mutex_exit();
- rw_lock_x_unlock(&page_hash_latch);
- rw_lock_x_unlock(&btr_search_latch);
+ buf_pool_page_hash_x_unlock_all();
+ btr_search_x_unlock_all();
os_thread_yield();
- rw_lock_x_lock(&btr_search_latch);
- //buf_pool_mutex_enter();
- rw_lock_x_lock(&page_hash_latch);
+ btr_search_x_lock_all();
+ buf_pool_page_hash_x_lock_all();
}
- if (!ha_validate(btr_search_sys->hash_index, i, end_index)) {
+ if (!ha_validate(btr_search_sys->hash_index[j], i, end_index)) {
ok = FALSE;
}
}
- //buf_pool_mutex_exit();
- rw_lock_x_unlock(&page_hash_latch);
- rw_lock_x_unlock(&btr_search_latch);
+ } /*for (j = 0; j < btr_search_index_num; j++)*/
+
+ buf_pool_page_hash_x_unlock_all();
+ btr_search_x_unlock_all();
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
diff --git a/storage/xtradb/buf/buf0buddy.c b/storage/xtradb/buf/buf0buddy.c
index e6b80bcda55..07898950fab 100644
--- a/storage/xtradb/buf/buf0buddy.c
+++ b/storage/xtradb/buf/buf0buddy.c
@@ -34,17 +34,6 @@ Created December 2006 by Marko Makela
#include "buf0flu.h"
#include "page0zip.h"
-/* Statistic counters */
-
-#ifdef UNIV_DEBUG
-/** Number of frames allocated from the buffer pool to the buddy system.
-Protected by buf_pool_mutex. */
-static ulint buf_buddy_n_frames;
-#endif /* UNIV_DEBUG */
-/** Statistics of the buddy system, indexed by block size.
-Protected by buf_pool_mutex. */
-UNIV_INTERN buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES_MAX + 1];
-
/**********************************************************************//**
Get the offset of the buddy of a compressed page frame.
@return the buddy relative of page */
@@ -73,8 +62,10 @@ UNIV_INLINE
void
buf_buddy_add_to_free(
/*==================*/
- buf_page_t* bpage, /*!< in,own: block to be freed */
- ulint i) /*!< in: index of buf_pool->zip_free[] */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ buf_page_t* bpage, /*!< in,own: block to be freed */
+ ulint i) /*!< in: index of
+ buf_pool->zip_free[] */
{
#ifdef UNIV_DEBUG_VALGRIND
buf_page_t* b = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
@@ -82,8 +73,8 @@ buf_buddy_add_to_free(
if (b) UNIV_MEM_VALID(b, BUF_BUDDY_LOW << i);
#endif /* UNIV_DEBUG_VALGRIND */
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&zip_free_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->zip_free_mutex));
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
ut_ad(buf_pool->zip_free[i].start != bpage);
UT_LIST_ADD_FIRST(zip_list, buf_pool->zip_free[i], bpage);
@@ -100,8 +91,10 @@ UNIV_INLINE
void
buf_buddy_remove_from_free(
/*=======================*/
- buf_page_t* bpage, /*!< in: block to be removed */
- ulint i) /*!< in: index of buf_pool->zip_free[] */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ buf_page_t* bpage, /*!< in: block to be removed */
+ ulint i) /*!< in: index of
+ buf_pool->zip_free[] */
{
#ifdef UNIV_DEBUG_VALGRIND
buf_page_t* prev = UT_LIST_GET_PREV(zip_list, bpage);
@@ -114,8 +107,8 @@ buf_buddy_remove_from_free(
ut_ad(!next || buf_page_get_state(next) == BUF_BLOCK_ZIP_FREE);
#endif /* UNIV_DEBUG_VALGRIND */
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&zip_free_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->zip_free_mutex));
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
UT_LIST_REMOVE(zip_list, buf_pool->zip_free[i], bpage);
@@ -132,12 +125,13 @@ static
void*
buf_buddy_alloc_zip(
/*================*/
- ulint i) /*!< in: index of buf_pool->zip_free[] */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint i) /*!< in: index of buf_pool->zip_free[] */
{
buf_page_t* bpage;
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&zip_free_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->zip_free_mutex));
ut_a(i < BUF_BUDDY_SIZES);
#ifndef UNIV_DEBUG_VALGRIND
@@ -152,19 +146,19 @@ buf_buddy_alloc_zip(
UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i);
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
- buf_buddy_remove_from_free(bpage, i);
+ buf_buddy_remove_from_free(buf_pool, bpage, i);
} else if (i + 1 < BUF_BUDDY_SIZES) {
/* Attempt to split. */
- bpage = buf_buddy_alloc_zip(i + 1);
+ bpage = buf_buddy_alloc_zip(buf_pool, i + 1);
if (bpage) {
buf_page_t* buddy = (buf_page_t*)
(((char*) bpage) + (BUF_BUDDY_LOW << i));
- ut_ad(!buf_pool_contains_zip(buddy));
+ ut_ad(!buf_pool_contains_zip(buf_pool, buddy));
ut_d(memset(buddy, i, BUF_BUDDY_LOW << i));
buddy->state = BUF_BLOCK_ZIP_FREE;
- buf_buddy_add_to_free(buddy, i);
+ buf_buddy_add_to_free(buf_pool, buddy, i);
}
}
@@ -185,18 +179,19 @@ static
void
buf_buddy_block_free(
/*=================*/
- void* buf, /*!< in: buffer frame to deallocate */
- ibool have_page_hash_mutex)
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ void* buf, /*!< in: buffer frame to deallocate */
+ ibool have_page_hash_mutex)
{
const ulint fold = BUF_POOL_ZIP_FOLD_PTR(buf);
buf_page_t* bpage;
buf_block_t* block;
- //ut_ad(buf_pool_mutex_own());
- ut_ad(!mutex_own(&buf_pool_zip_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_a(!ut_align_offset(buf, UNIV_PAGE_SIZE));
- mutex_enter(&zip_hash_mutex);
+ mutex_enter(&buf_pool->zip_hash_mutex);
HASH_SEARCH(hash, buf_pool->zip_hash, fold, buf_page_t*, bpage,
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_MEMORY
@@ -209,7 +204,7 @@ buf_buddy_block_free(
ut_d(bpage->in_zip_hash = FALSE);
HASH_DELETE(buf_page_t, hash, buf_pool->zip_hash, fold, bpage);
- mutex_exit(&zip_hash_mutex);
+ mutex_exit(&buf_pool->zip_hash_mutex);
ut_d(memset(buf, 0, UNIV_PAGE_SIZE));
UNIV_MEM_INVALID(buf, UNIV_PAGE_SIZE);
@@ -219,8 +214,8 @@ buf_buddy_block_free(
buf_LRU_block_free_non_file_page(block, have_page_hash_mutex);
mutex_exit(&block->mutex);
- ut_ad(buf_buddy_n_frames > 0);
- ut_d(buf_buddy_n_frames--);
+ ut_ad(buf_pool->buddy_n_frames > 0);
+ ut_d(buf_pool->buddy_n_frames--);
}
/**********************************************************************//**
@@ -231,9 +226,10 @@ buf_buddy_block_register(
/*=====================*/
buf_block_t* block) /*!< in: buffer frame to allocate */
{
+ buf_pool_t* buf_pool = buf_pool_from_block(block);
const ulint fold = BUF_POOL_ZIP_FOLD(block);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(!mutex_own(&buf_pool_zip_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(buf_block_get_state(block) == BUF_BLOCK_READY_FOR_USE);
buf_block_set_state(block, BUF_BLOCK_MEMORY);
@@ -245,11 +241,11 @@ buf_buddy_block_register(
ut_ad(!block->page.in_zip_hash);
ut_d(block->page.in_zip_hash = TRUE);
- mutex_enter(&zip_hash_mutex);
+ mutex_enter(&buf_pool->zip_hash_mutex);
HASH_INSERT(buf_page_t, hash, buf_pool->zip_hash, fold, &block->page);
- mutex_exit(&zip_hash_mutex);
+ mutex_exit(&buf_pool->zip_hash_mutex);
- ut_d(buf_buddy_n_frames++);
+ ut_d(buf_pool->buddy_n_frames++);
}
/**********************************************************************//**
@@ -259,10 +255,12 @@ static
void*
buf_buddy_alloc_from(
/*=================*/
- void* buf, /*!< in: a block that is free to use */
- ulint i, /*!< in: index of buf_pool->zip_free[] */
- ulint j) /*!< in: size of buf as an index
- of buf_pool->zip_free[] */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ void* buf, /*!< in: a block that is free to use */
+ ulint i, /*!< in: index of
+ buf_pool->zip_free[] */
+ ulint j) /*!< in: size of buf as an index
+ of buf_pool->zip_free[] */
{
ulint offs = BUF_BUDDY_LOW << j;
ut_ad(j <= BUF_BUDDY_SIZES);
@@ -286,7 +284,7 @@ buf_buddy_alloc_from(
ut_list_node_313)
== BUF_BLOCK_ZIP_FREE)));
#endif /* !UNIV_DEBUG_VALGRIND */
- buf_buddy_add_to_free(bpage, j);
+ buf_buddy_add_to_free(buf_pool, bpage, j);
}
return(buf);
@@ -294,41 +292,43 @@ buf_buddy_alloc_from(
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool_mutex and must not hold buf_pool_zip_mutex or any block->mutex.
-The buf_pool_mutex may only be released and reacquired if lru != NULL.
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex.
+The buf_pool->mutex may only be released and reacquired if lru != NULL.
@return allocated block, possibly NULL if lru==NULL */
UNIV_INTERN
void*
buf_buddy_alloc_low(
/*================*/
- ulint i, /*!< in: index of buf_pool->zip_free[],
- or BUF_BUDDY_SIZES */
- ibool* lru, /*!< in: pointer to a variable that will be assigned
- TRUE if storage was allocated from the LRU list
- and buf_pool_mutex was temporarily released,
- or NULL if the LRU list should not be used */
- ibool have_page_hash_mutex)
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint i, /*!< in: index of buf_pool->zip_free[],
+ or BUF_BUDDY_SIZES */
+ ibool* lru, /*!< in: pointer to a variable that
+ will be assigned TRUE if storage was
+ allocated from the LRU list and
+ buf_pool->mutex was temporarily
+ released, or NULL if the LRU list
+ should not be used */
+ ibool have_page_hash_mutex)
{
buf_block_t* block;
- //ut_ad(buf_pool_mutex_own());
- ut_ad(!mutex_own(&buf_pool_zip_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
+ ut_ad(!mutex_own(&buf_pool->zip_mutex));
if (i < BUF_BUDDY_SIZES) {
/* Try to allocate from the buddy system. */
- mutex_enter(&zip_free_mutex);
- block = buf_buddy_alloc_zip(i);
+ mutex_enter(&buf_pool->zip_free_mutex);
+ block = buf_buddy_alloc_zip(buf_pool, i);
if (block) {
-
goto func_exit;
}
-
- mutex_exit(&zip_free_mutex);
+ mutex_exit(&buf_pool->zip_free_mutex);
}
/* Try allocating from the buf_pool->free list. */
- block = buf_LRU_get_free_only();
+ block = buf_LRU_get_free_only(buf_pool);
if (block) {
@@ -341,28 +341,29 @@ buf_buddy_alloc_low(
}
/* Try replacing an uncompressed page in the buffer pool. */
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
if (have_page_hash_mutex) {
- rw_lock_x_unlock(&page_hash_latch);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
- block = buf_LRU_get_free_block(0);
+ block = buf_LRU_get_free_block(buf_pool);
*lru = TRUE;
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
if (have_page_hash_mutex) {
- rw_lock_x_lock(&page_hash_latch);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
}
alloc_big:
buf_buddy_block_register(block);
- mutex_enter(&zip_free_mutex);
- block = buf_buddy_alloc_from(block->frame, i, BUF_BUDDY_SIZES);
+ mutex_enter(&buf_pool->zip_free_mutex);
+ block = buf_buddy_alloc_from(
+ buf_pool, block->frame, i, BUF_BUDDY_SIZES);
func_exit:
- buf_buddy_stat[i].used++;
- mutex_exit(&zip_free_mutex);
+ buf_pool->buddy_stat[i].used++;
+ mutex_exit(&buf_pool->zip_free_mutex);
return(block);
}
@@ -378,10 +379,11 @@ buf_buddy_relocate_block(
buf_page_t* dpage) /*!< in: free block to relocate to */
{
buf_page_t* b;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&page_hash_latch, RW_LOCK_EX));
+ ut_ad(rw_lock_own(&buf_pool->page_hash_latch, RW_LOCK_EX));
#endif
switch (buf_page_get_state(bpage)) {
@@ -400,18 +402,19 @@ buf_buddy_relocate_block(
break;
}
- mutex_enter(&buf_pool_zip_mutex);
- mutex_enter(&zip_free_mutex);
+ mutex_enter(&buf_pool->zip_mutex);
+ mutex_enter(&buf_pool->zip_free_mutex);
if (!buf_page_can_relocate(bpage)) {
- mutex_exit(&buf_pool_zip_mutex);
- mutex_exit(&zip_free_mutex);
+ mutex_exit(&buf_pool->zip_mutex);
+ mutex_exit(&buf_pool->zip_free_mutex);
return(FALSE);
}
- if (bpage != buf_page_hash_get(bpage->space, bpage->offset)) {
- mutex_exit(&buf_pool_zip_mutex);
- mutex_exit(&zip_free_mutex);
+ if (bpage != buf_page_hash_get(buf_pool,
+ bpage->space, bpage->offset)) {
+ mutex_exit(&buf_pool->zip_mutex);
+ mutex_exit(&buf_pool->zip_free_mutex);
return(FALSE);
}
@@ -419,7 +422,6 @@ buf_buddy_relocate_block(
ut_d(bpage->state = BUF_BLOCK_ZIP_FREE);
/* relocate buf_pool->zip_clean */
- mutex_enter(&flush_list_mutex);
b = UT_LIST_GET_PREV(zip_list, dpage);
UT_LIST_REMOVE(zip_list, buf_pool->zip_clean, dpage);
@@ -428,12 +430,11 @@ buf_buddy_relocate_block(
} else {
UT_LIST_ADD_FIRST(zip_list, buf_pool->zip_clean, dpage);
}
- mutex_exit(&flush_list_mutex);
UNIV_MEM_INVALID(bpage, sizeof *bpage);
- mutex_exit(&buf_pool_zip_mutex);
- mutex_exit(&zip_free_mutex);
+ mutex_exit(&buf_pool->zip_mutex);
+ mutex_exit(&buf_pool->zip_free_mutex);
return(TRUE);
}
@@ -444,20 +445,20 @@ static
ibool
buf_buddy_relocate(
/*===============*/
- void* src, /*!< in: block to relocate */
- void* dst, /*!< in: free block to relocate to */
- ulint i, /*!< in: index of buf_pool->zip_free[] */
- ibool have_page_hash_mutex)
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ void* src, /*!< in: block to relocate */
+ void* dst, /*!< in: free block to relocate to */
+ ulint i, /*!< in: index of
+ buf_pool->zip_free[] */
+ ibool have_page_hash_mutex)
{
buf_page_t* bpage;
const ulint size = BUF_BUDDY_LOW << i;
ullint usec = ut_time_us(NULL);
- ulint space;
- ulint page_no;
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&zip_free_mutex));
- ut_ad(!mutex_own(&buf_pool_zip_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->zip_free_mutex));
+ ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(!ut_align_offset(src, size));
ut_ad(!ut_align_offset(dst, size));
UNIV_MEM_ASSERT_W(dst, size);
@@ -477,11 +478,12 @@ buf_buddy_relocate(
if (size >= PAGE_ZIP_MIN_SIZE) {
/* This is a compressed page. */
mutex_t* mutex;
+ ulint space, page_no;
if (!have_page_hash_mutex) {
- mutex_exit(&zip_free_mutex);
- mutex_enter(&LRU_list_mutex);
- rw_lock_x_lock(&page_hash_latch);
+ mutex_exit(&buf_pool->zip_free_mutex);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
}
/* The src block may be split into smaller blocks,
@@ -500,7 +502,7 @@ buf_buddy_relocate(
on uninitialized value. */
UNIV_MEM_VALID(&space, sizeof space);
UNIV_MEM_VALID(&page_no, sizeof page_no);
- bpage = buf_page_hash_get(space, page_no);
+ bpage = buf_page_hash_get(buf_pool, space, page_no);
if (!bpage || bpage->zip.data != src) {
/* The block has probably been freshly
@@ -509,13 +511,15 @@ buf_buddy_relocate(
it cannot be relocated. */
if (!have_page_hash_mutex) {
- mutex_enter(&zip_free_mutex);
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_enter(&buf_pool->zip_free_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
return(FALSE);
}
+ ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
+
if (page_zip_get_size(&bpage->zip) != size) {
/* The block is of different size. We would
have to relocate all blocks covered by src.
@@ -523,16 +527,16 @@ buf_buddy_relocate(
ut_ad(page_zip_get_size(&bpage->zip) < size);
if (!have_page_hash_mutex) {
- mutex_enter(&zip_free_mutex);
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_enter(&buf_pool->zip_free_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
return(FALSE);
}
/* To keep latch order */
if (have_page_hash_mutex)
- mutex_exit(&zip_free_mutex);
+ mutex_exit(&buf_pool->zip_free_mutex);
/* The block must have been allocated, but it may
contain uninitialized data. */
@@ -540,7 +544,7 @@ buf_buddy_relocate(
mutex = buf_page_get_mutex_enter(bpage);
- mutex_enter(&zip_free_mutex);
+ mutex_enter(&buf_pool->zip_free_mutex);
if (mutex && buf_page_can_relocate(bpage)) {
/* Relocate the compressed page. */
@@ -552,22 +556,22 @@ success:
UNIV_MEM_INVALID(src, size);
{
buf_buddy_stat_t* buddy_stat
- = &buf_buddy_stat[i];
+ = &buf_pool->buddy_stat[i];
buddy_stat->relocated++;
buddy_stat->relocated_usec
+= ut_time_us(NULL) - usec;
}
if (!have_page_hash_mutex) {
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
return(TRUE);
}
if (!have_page_hash_mutex) {
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
if (mutex) {
@@ -582,29 +586,29 @@ success:
UNIV_MEM_ASSERT_RW(src, size);
#endif
- mutex_exit(&zip_free_mutex);
+ mutex_exit(&buf_pool->zip_free_mutex);
if (!have_page_hash_mutex) {
- mutex_enter(&LRU_list_mutex);
- rw_lock_x_lock(&page_hash_latch);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
}
if (buf_buddy_relocate_block(src, dst)) {
- mutex_enter(&zip_free_mutex);
+ mutex_enter(&buf_pool->zip_free_mutex);
if (!have_page_hash_mutex) {
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
goto success;
}
- mutex_enter(&zip_free_mutex);
+ mutex_enter(&buf_pool->zip_free_mutex);
if (!have_page_hash_mutex) {
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
}
@@ -617,36 +621,37 @@ UNIV_INTERN
void
buf_buddy_free_low(
/*===============*/
- void* buf, /*!< in: block to be freed, must not be
- pointed to by the buffer pool */
- ulint i, /*!< in: index of buf_pool->zip_free[],
- or BUF_BUDDY_SIZES */
- ibool have_page_hash_mutex)
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ void* buf, /*!< in: block to be freed, must not be
+ pointed to by the buffer pool */
+ ulint i, /*!< in: index of buf_pool->zip_free[],
+ or BUF_BUDDY_SIZES */
+ ibool have_page_hash_mutex)
{
buf_page_t* bpage;
buf_page_t* buddy;
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&zip_free_mutex));
- ut_ad(!mutex_own(&buf_pool_zip_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->zip_free_mutex));
+ ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(i <= BUF_BUDDY_SIZES);
- ut_ad(buf_buddy_stat[i].used > 0);
+ ut_ad(buf_pool->buddy_stat[i].used > 0);
- buf_buddy_stat[i].used--;
+ buf_pool->buddy_stat[i].used--;
recombine:
UNIV_MEM_ASSERT_AND_ALLOC(buf, BUF_BUDDY_LOW << i);
ut_d(((buf_page_t*) buf)->state = BUF_BLOCK_ZIP_FREE);
if (i == BUF_BUDDY_SIZES) {
- mutex_exit(&zip_free_mutex);
- buf_buddy_block_free(buf, have_page_hash_mutex);
- mutex_enter(&zip_free_mutex);
+ mutex_exit(&buf_pool->zip_free_mutex);
+ buf_buddy_block_free(buf_pool, buf, have_page_hash_mutex);
+ mutex_enter(&buf_pool->zip_free_mutex);
return;
}
ut_ad(i < BUF_BUDDY_SIZES);
ut_ad(buf == ut_align_down(buf, BUF_BUDDY_LOW << i));
- ut_ad(!buf_pool_contains_zip(buf));
+ ut_ad(!buf_pool_contains_zip(buf_pool, buf));
/* Try to combine adjacent blocks. */
@@ -672,10 +677,10 @@ recombine:
if (bpage == buddy) {
buddy_free:
/* The buddy is free: recombine */
- buf_buddy_remove_from_free(bpage, i);
+ buf_buddy_remove_from_free(buf_pool, bpage, i);
buddy_free2:
ut_ad(buf_page_get_state(buddy) == BUF_BLOCK_ZIP_FREE);
- ut_ad(!buf_pool_contains_zip(buddy));
+ ut_ad(!buf_pool_contains_zip(buf_pool, buddy));
i++;
buf = ut_align_down(buf, BUF_BUDDY_LOW << i);
@@ -707,16 +712,16 @@ buddy_nonfree:
buf_buddy_relocate() will overwrite bpage->list. */
UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i);
- buf_buddy_remove_from_free(bpage, i);
+ buf_buddy_remove_from_free(buf_pool, bpage, i);
/* Try to relocate the buddy of buf to the free block. */
- if (buf_buddy_relocate(buddy, bpage, i, have_page_hash_mutex)) {
+ if (buf_buddy_relocate(buf_pool, buddy, bpage, i, have_page_hash_mutex)) {
ut_d(buddy->state = BUF_BLOCK_ZIP_FREE);
goto buddy_free2;
}
- buf_buddy_add_to_free(bpage, i);
+ buf_buddy_add_to_free(buf_pool, bpage, i);
/* Try to relocate the buddy of the free block to buf. */
buddy = (buf_page_t*) buf_buddy_get(((byte*) bpage),
@@ -737,7 +742,7 @@ buddy_nonfree:
&& ut_list_node_313 != buddy)));
#endif /* !UNIV_DEBUG_VALGRIND */
- if (buf_buddy_relocate(buddy, buf, i, have_page_hash_mutex)) {
+ if (buf_buddy_relocate(buf_pool, buddy, buf, i, have_page_hash_mutex)) {
buf = bpage;
UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i);
@@ -800,5 +805,5 @@ buddy_nonfree:
}
#endif /* UNIV_DEBUG */
bpage->state = BUF_BLOCK_ZIP_FREE;
- buf_buddy_add_to_free(bpage, i);
+ buf_buddy_add_to_free(buf_pool, bpage, i);
}
diff --git a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c
index 1c08bd6d0bf..aed76e8121c 100644
--- a/storage/xtradb/buf/buf0buf.c
+++ b/storage/xtradb/buf/buf0buf.c
@@ -53,10 +53,6 @@ Created 11/5/1995 Heikki Tuuri
#include "page0zip.h"
#include "trx0trx.h"
#include "srv0start.h"
-#include "que0que.h"
-#include "read0read.h"
-#include "row0row.h"
-#include "ha_prototypes.h"
/* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx();
@@ -123,21 +119,21 @@ in the file along with the file page, resides in the control block.
The buffer buf_pool contains a single mutex which protects all the
control data structures of the buf_pool. The content of a buffer frame is
protected by a separate read-write lock in its control block, though.
-These locks can be locked and unlocked without owning the buf_pool mutex.
+These locks can be locked and unlocked without owning the buf_pool->mutex.
The OS events in the buf_pool struct can be waited for without owning the
-buf_pool mutex.
+buf_pool->mutex.
-The buf_pool mutex is a hot-spot in main memory, causing a lot of
+The buf_pool->mutex is a hot-spot in main memory, causing a lot of
memory bus traffic on multiprocessor systems when processors
alternately access the mutex. On our Pentium, the mutex is accessed
maybe every 10 microseconds. We gave up the solution to have mutexes
for each control block, for instance, because it seemed to be
complicated.
-A solution to reduce mutex contention of the buf_pool mutex is to
+A solution to reduce mutex contention of the buf_pool->mutex is to
create a separate mutex for the page hash table. On Pentium,
accessing the hash table takes 2 microseconds, about half
-of the total buf_pool mutex hold time.
+of the total buf_pool->mutex hold time.
Control blocks
--------------
@@ -192,12 +188,12 @@ list. We also keep a pointer to near the end of the LRU list,
which we can use when we want to artificially age a page in the
buf_pool. This is used if we know that some page is not needed
again for some time: we insert the block right after the pointer,
-causing it to be replaced sooner than would noramlly be the case.
+causing it to be replaced sooner than would normally be the case.
Currently this aging mechanism is used for read-ahead mechanism
of pages, and it can also be used when there is a scan of a full
table which cannot fit in the memory. Putting the pages near the
-of the LRU list, we make sure that most of the buf_pool stays in the
-main memory, undisturbed.
+end of the LRU list, we make sure that most of the buf_pool stays
+in the main memory, undisturbed.
The unzip_LRU list contains a subset of the common LRU list. The
blocks on the unzip_LRU list hold a compressed file page and the
@@ -211,6 +207,7 @@ The chain of modified blocks (buf_pool->flush_list) contains the blocks
holding file pages that have been modified in the memory
but not written to disk yet. The block with the oldest modification
which has not yet been written to disk is at the end of the chain.
+The access to this list is protected by buf_pool->flush_list_mutex.
The chain of unmodified compressed blocks (buf_pool->zip_clean)
contains the control blocks (buf_page_t) of those compressed pages
@@ -284,29 +281,13 @@ static const int WAIT_FOR_READ = 5000;
/** Number of attemtps made to read in a page in the buffer pool */
static const ulint BUF_PAGE_READ_MAX_RETRIES = 100;
-/** The buffer buf_pool of the database */
-UNIV_INTERN buf_pool_t* buf_pool = NULL;
-
-/** mutex protecting the buffer pool struct and control blocks, except the
-read-write lock in them */
-UNIV_INTERN mutex_t buf_pool_mutex;
-UNIV_INTERN mutex_t LRU_list_mutex;
-UNIV_INTERN mutex_t flush_list_mutex;
-UNIV_INTERN rw_lock_t page_hash_latch;
-UNIV_INTERN mutex_t free_list_mutex;
-UNIV_INTERN mutex_t zip_free_mutex;
-UNIV_INTERN mutex_t zip_hash_mutex;
-/** mutex protecting the control blocks of compressed-only pages
-(of type buf_page_t, not buf_block_t) */
-UNIV_INTERN mutex_t buf_pool_zip_mutex;
+/** The buffer pools of the database */
+UNIV_INTERN buf_pool_t* buf_pool_ptr;
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
static ulint buf_dbg_counter = 0; /*!< This is used to insert validation
- operations in excution in the
+ operations in execution in the
debug version */
-/** Flag to forbid the release of the buffer pool mutex.
-Protected by buf_pool_mutex. */
-UNIV_INTERN ulint buf_pool_mutex_exit_forbidden = 0;
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
#ifdef UNIV_DEBUG
/** If this is set TRUE, the program prints info whenever
@@ -314,31 +295,190 @@ read-ahead or flush occurs */
UNIV_INTERN ibool buf_debug_prints = FALSE;
#endif /* UNIV_DEBUG */
-/* Buffer pool shared memory segment information */
-typedef struct buf_shm_info_struct buf_shm_info_t;
+#ifdef UNIV_PFS_RWLOCK
+/* Keys to register buffer block related rwlocks and mutexes with
+performance schema */
+UNIV_INTERN mysql_pfs_key_t buf_pool_page_hash_key;
+UNIV_INTERN mysql_pfs_key_t buf_block_lock_key;
+# ifdef UNIV_SYNC_DEBUG
+UNIV_INTERN mysql_pfs_key_t buf_block_debug_latch_key;
+# endif /* UNIV_SYNC_DEBUG */
+#endif /* UNIV_PFS_RWLOCK */
+
+#ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t buffer_block_mutex_key;
+UNIV_INTERN mysql_pfs_key_t buf_pool_mutex_key;
+UNIV_INTERN mysql_pfs_key_t buf_pool_zip_mutex_key;
+UNIV_INTERN mysql_pfs_key_t buf_pool_LRU_list_mutex_key;
+UNIV_INTERN mysql_pfs_key_t buf_pool_free_list_mutex_key;
+UNIV_INTERN mysql_pfs_key_t buf_pool_zip_free_mutex_key;
+UNIV_INTERN mysql_pfs_key_t buf_pool_zip_hash_mutex_key;
+UNIV_INTERN mysql_pfs_key_t flush_list_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
+#if defined UNIV_PFS_MUTEX || defined UNIV_PFS_RWLOCK
+# ifndef PFS_SKIP_BUFFER_MUTEX_RWLOCK
+
+/* Buffer block mutexes and rwlocks can be registered
+in one group rather than individually. If PFS_GROUP_BUFFER_SYNC
+is defined, register buffer block mutex and rwlock
+in one group after their initialization. */
+# define PFS_GROUP_BUFFER_SYNC
+
+/* This define caps the number of mutexes/rwlocks can
+be registered with performance schema. Developers can
+modify this define if necessary. Please note, this would
+be effective only if PFS_GROUP_BUFFER_SYNC is defined. */
+# define PFS_MAX_BUFFER_MUTEX_LOCK_REGISTER ULINT_MAX
+
+# endif /* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
+#endif /* UNIV_PFS_MUTEX || UNIV_PFS_RWLOCK */
+
+/** A chunk of buffers. The buffer pool is allocated in chunks. (moved to buf0buf.h)*/
+//struct buf_chunk_struct{
+// ulint mem_size; /*!< allocated size of the chunk */
+// ulint size; /*!< size of frames[] and blocks[] */
+// void* mem; /*!< pointer to the memory area which
+// was allocated for the frames */
+// buf_block_t* blocks; /*!< array of buffer control blocks */
+//};
+#endif /* !UNIV_HOTBACKUP */
+
+/********************************************************************//**
+Gets the smallest oldest_modification lsn for any page in the pool. Returns
+zero if all modified pages have been flushed to disk.
+@return oldest modification in pool, zero if none */
+UNIV_INTERN
+ib_uint64_t
+buf_pool_get_oldest_modification(void)
+/*==================================*/
+{
+ ulint i;
+ buf_page_t* bpage;
+ ib_uint64_t lsn = 0;
+ ib_uint64_t oldest_lsn = 0;
-struct buf_shm_info_struct {
- char head_str[8];
- ulint binary_id;
- ibool is_new; /* during initializing */
- ibool clean; /* clean shutdowned and free */
- ibool reusable; /* reusable */
- ulint buf_pool_size; /* backup value */
- ulint page_size; /* backup value */
- ulint frame_offset; /* offset of the first frame based on chunk->mem */
- ulint zip_hash_offset;
- ulint zip_hash_n;
+ /* When we traverse all the flush lists we don't want another
+ thread to add a dirty page to any flush list. */
+ if (srv_buf_pool_instances > 1)
+ log_flush_order_mutex_enter();
- ulint checksum;
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
- buf_pool_t buf_pool_backup;
- buf_chunk_t chunk_backup;
+ buf_pool = buf_pool_from_array(i);
- ib_uint64_t dummy;
-};
+ buf_flush_list_mutex_enter(buf_pool);
-#define BUF_SHM_INFO_HEAD "XTRA_SHM"
-#endif /* !UNIV_HOTBACKUP */
+ bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
+
+ if (bpage != NULL) {
+ ut_ad(bpage->in_flush_list);
+ lsn = bpage->oldest_modification;
+ }
+
+ buf_flush_list_mutex_exit(buf_pool);
+
+ if (!oldest_lsn || oldest_lsn > lsn) {
+ oldest_lsn = lsn;
+ }
+ }
+
+ if (srv_buf_pool_instances > 1)
+ log_flush_order_mutex_exit();
+
+ /* The returned answer may be out of date: the flush_list can
+ change after the mutex has been released. */
+
+ return(oldest_lsn);
+}
+
+/********************************************************************//**
+Get total buffer pool statistics. */
+UNIV_INTERN
+void
+buf_get_total_list_len(
+/*===================*/
+ ulint* LRU_len, /*!< out: length of all LRU lists */
+ ulint* free_len, /*!< out: length of all free lists */
+ ulint* flush_list_len) /*!< out: length of all flush lists */
+{
+ ulint i;
+
+ *LRU_len = 0;
+ *free_len = 0;
+ *flush_list_len = 0;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ *LRU_len += UT_LIST_GET_LEN(buf_pool->LRU);
+ *free_len += UT_LIST_GET_LEN(buf_pool->free);
+ *flush_list_len += UT_LIST_GET_LEN(buf_pool->flush_list);
+ }
+}
+
+/********************************************************************//**
+Get total buffer pool statistics. */
+UNIV_INTERN
+void
+buf_get_total_stat(
+/*===============*/
+ buf_pool_stat_t* tot_stat) /*!< out: buffer pool stats */
+{
+ ulint i;
+
+ memset(tot_stat, 0, sizeof(*tot_stat));
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_stat_t*buf_stat;
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ buf_stat = &buf_pool->stat;
+ tot_stat->n_page_gets += buf_stat->n_page_gets;
+ tot_stat->n_pages_read += buf_stat->n_pages_read;
+ tot_stat->n_pages_written += buf_stat->n_pages_written;
+ tot_stat->n_pages_created += buf_stat->n_pages_created;
+ tot_stat->n_ra_pages_read += buf_stat->n_ra_pages_read;
+ tot_stat->n_ra_pages_evicted += buf_stat->n_ra_pages_evicted;
+ tot_stat->n_pages_made_young += buf_stat->n_pages_made_young;
+
+ tot_stat->n_pages_not_made_young +=
+ buf_stat->n_pages_not_made_young;
+ }
+}
+
+/********************************************************************//**
+Allocates a buffer block.
+@return own: the allocated block, in state BUF_BLOCK_MEMORY */
+UNIV_INTERN
+buf_block_t*
+buf_block_alloc(
+/*============*/
+ buf_pool_t* buf_pool) /*!< in/out: buffer pool instance,
+ or NULL for round-robin selection
+ of the buffer pool */
+{
+ buf_block_t* block;
+ ulint index;
+ static ulint buf_pool_index;
+
+ if (buf_pool == NULL) {
+ /* We are allocating memory from any buffer pool, ensure
+ we spread the grace on all buffer pool instances. */
+ index = buf_pool_index++ % srv_buf_pool_instances;
+ buf_pool = buf_pool_from_array(index);
+ }
+
+ block = buf_LRU_get_free_block(buf_pool);
+
+ buf_block_set_state(block, BUF_BLOCK_MEMORY);
+
+ return(block);
+}
/********************************************************************//**
Calculates a page checksum which is stored to the page when it is written
@@ -445,7 +585,9 @@ buf_page_is_corrupted(
ib_uint64_t current_lsn;
if (log_peek_lsn(&current_lsn)
- && current_lsn < mach_read_ull(read_buf + FIL_PAGE_LSN)) {
+ && UNIV_UNLIKELY
+ (current_lsn
+ < mach_read_from_8(read_buf + FIL_PAGE_LSN))) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -457,11 +599,11 @@ buf_page_is_corrupted(
"you may have copied the InnoDB\n"
"InnoDB: tablespace but not the InnoDB "
"log files. See\n"
- "InnoDB: " REFMAN "forcing-recovery.html\n"
+ "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
"InnoDB: for more information.\n",
(ulong) mach_read_from_4(read_buf
+ FIL_PAGE_OFFSET),
- mach_read_ull(read_buf + FIL_PAGE_LSN),
+ mach_read_from_8(read_buf + FIL_PAGE_LSN),
current_lsn);
}
}
@@ -673,17 +815,15 @@ buf_page_print(
#endif /* !UNIV_HOTBACKUP */
switch (fil_page_get_type(read_buf)) {
+ index_id_t index_id;
case FIL_PAGE_INDEX:
+ index_id = btr_page_get_index_id(read_buf);
fprintf(stderr,
"InnoDB: Page may be an index page where"
- " index id is %lu %lu\n",
- (ulong) ut_dulint_get_high(
- btr_page_get_index_id(read_buf)),
- (ulong) ut_dulint_get_low(
- btr_page_get_index_id(read_buf)));
+ " index id is %llu\n",
+ (ullint) index_id);
#ifndef UNIV_HOTBACKUP
- index = dict_index_find_on_id_low(
- btr_page_get_index_id(read_buf));
+ index = dict_index_find_on_id_low(index_id);
if (index) {
fputs("InnoDB: (", stderr);
dict_index_name_print(stderr, NULL, index);
@@ -735,31 +875,83 @@ buf_page_print(
}
#ifndef UNIV_HOTBACKUP
+
+# ifdef PFS_GROUP_BUFFER_SYNC
+/********************************************************************//**
+This function registers mutexes and rwlocks in buffer blocks with
+performance schema. If PFS_MAX_BUFFER_MUTEX_LOCK_REGISTER is
+defined to be a value less than chunk->size, then only mutexes
+and rwlocks in the first PFS_MAX_BUFFER_MUTEX_LOCK_REGISTER
+blocks are registered. */
+static
+void
+pfs_register_buffer_block(
+/*======================*/
+ buf_chunk_t* chunk) /*!< in/out: chunk of buffers */
+{
+ ulint i;
+ ulint num_to_register;
+ buf_block_t* block;
+
+ block = chunk->blocks;
+
+ num_to_register = ut_min(chunk->size,
+ PFS_MAX_BUFFER_MUTEX_LOCK_REGISTER);
+
+ for (i = 0; i < num_to_register; i++) {
+ mutex_t* mutex;
+ rw_lock_t* rwlock;
+
+# ifdef UNIV_PFS_MUTEX
+ mutex = &block->mutex;
+ ut_a(!mutex->pfs_psi);
+ mutex->pfs_psi = (PSI_server)
+ ? PSI_server->init_mutex(buffer_block_mutex_key, mutex)
+ : NULL;
+# endif /* UNIV_PFS_MUTEX */
+
+# ifdef UNIV_PFS_RWLOCK
+ rwlock = &block->lock;
+ ut_a(!rwlock->pfs_psi);
+ rwlock->pfs_psi = (PSI_server)
+ ? PSI_server->init_rwlock(buf_block_lock_key, rwlock)
+ : NULL;
+# endif /* UNIV_PFS_RWLOCK */
+ block++;
+ }
+}
+# endif /* PFS_GROUP_BUFFER_SYNC */
+
/********************************************************************//**
Initializes a buffer control block when the buf_pool is created. */
static
void
buf_block_init(
/*===========*/
- buf_block_t* block, /*!< in: pointer to control block */
- byte* frame) /*!< in: pointer to buffer frame */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ buf_block_t* block, /*!< in: pointer to control block */
+ byte* frame) /*!< in: pointer to buffer frame */
{
UNIV_MEM_DESC(frame, UNIV_PAGE_SIZE, block);
block->frame = frame;
+ block->page.buf_pool_index = buf_pool_index(buf_pool);
block->page.state = BUF_BLOCK_NOT_USED;
block->page.buf_fix_count = 0;
block->page.io_fix = BUF_IO_NONE;
block->modify_clock = 0;
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
block->page.file_page_was_freed = FALSE;
-#endif /* UNIV_DEBUG_FILE_ACCESSES */
+#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
block->check_index_page_at_flush = FALSE;
block->index = NULL;
+ block->btr_search_latch = NULL;
+
+ block->is_hashed = FALSE;
#ifdef UNIV_DEBUG
block->page.in_page_hash = FALSE;
@@ -767,6 +959,10 @@ buf_block_init(
block->page.in_flush_list = FALSE;
block->page.in_free_list = FALSE;
#endif /* UNIV_DEBUG */
+ block->page.flush_list.prev = NULL;
+ block->page.flush_list.next = NULL;
+ block->page.zip_list.prev = NULL;
+ block->page.zip_list.next = NULL;
block->page.in_LRU_list = FALSE;
block->in_unzip_LRU_list = FALSE;
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
@@ -774,52 +970,25 @@ buf_block_init(
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
page_zip_des_init(&block->page.zip);
- mutex_create(&block->mutex, SYNC_BUF_BLOCK);
-
- rw_lock_create(&block->lock, SYNC_LEVEL_VARYING);
- ut_ad(rw_lock_validate(&(block->lock)));
-
-#ifdef UNIV_SYNC_DEBUG
- rw_lock_create(&block->debug_latch, SYNC_NO_ORDER_CHECK);
-#endif /* UNIV_SYNC_DEBUG */
-}
-
-static
-void
-buf_block_reuse(
-/*============*/
- buf_block_t* block,
- ptrdiff_t frame_offset)
-{
- /* block_init */
- block->frame += frame_offset;
-
- UNIV_MEM_DESC(block->frame, UNIV_PAGE_SIZE, block);
-
- block->index = NULL;
-
-#ifdef UNIV_DEBUG
- /* recreate later */
- block->page.in_page_hash = FALSE;
- block->page.in_zip_hash = FALSE;
-#endif /* UNIV_DEBUG */
+#if defined PFS_SKIP_BUFFER_MUTEX_RWLOCK || defined PFS_GROUP_BUFFER_SYNC
+ /* If PFS_SKIP_BUFFER_MUTEX_RWLOCK is defined, skip registration
+ of buffer block mutex/rwlock with performance schema. If
+ PFS_GROUP_BUFFER_SYNC is defined, skip the registration
+ since buffer block mutex/rwlock will be registered later in
+ pfs_register_buffer_block() */
-#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- block->n_pointers = 0;
-#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+ mutex_create(PFS_NOT_INSTRUMENTED, &block->mutex, SYNC_BUF_BLOCK);
+ rw_lock_create(PFS_NOT_INSTRUMENTED, &block->lock, SYNC_LEVEL_VARYING);
+#else /* PFS_SKIP_BUFFER_MUTEX_RWLOCK || PFS_GROUP_BUFFER_SYNC */
+ mutex_create(buffer_block_mutex_key, &block->mutex, SYNC_BUF_BLOCK);
+ rw_lock_create(buf_block_lock_key, &block->lock, SYNC_LEVEL_VARYING);
+#endif /* PFS_SKIP_BUFFER_MUTEX_RWLOCK || PFS_GROUP_BUFFER_SYNC */
- if (block->page.zip.data)
- block->page.zip.data += frame_offset;
-
- block->is_hashed = FALSE;
-
- mutex_create(&block->mutex, SYNC_BUF_BLOCK);
-
- rw_lock_create(&block->lock, SYNC_LEVEL_VARYING);
ut_ad(rw_lock_validate(&(block->lock)));
#ifdef UNIV_SYNC_DEBUG
- rw_lock_create(&block->debug_latch, SYNC_NO_ORDER_CHECK);
+ rw_lock_create(buf_block_debug_latch_key,
+ &block->debug_latch, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
}
@@ -830,193 +999,34 @@ static
buf_chunk_t*
buf_chunk_init(
/*===========*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
buf_chunk_t* chunk, /*!< out: chunk of buffers */
ulint mem_size) /*!< in: requested size in bytes */
{
buf_block_t* block;
byte* frame;
- ulint zip_hash_n = 0;
- ulint zip_hash_mem_size = 0;
- hash_table_t* zip_hash_tmp = NULL;
ulint i;
- buf_shm_info_t* shm_info = NULL;
+ ulint size_target;
/* Round down to a multiple of page size,
although it already should be. */
mem_size = ut_2pow_round(mem_size, UNIV_PAGE_SIZE);
-
- srv_buffer_pool_shm_is_reused = FALSE;
-
- if (srv_buffer_pool_shm_key) {
- /* zip_hash size */
- zip_hash_n = (mem_size / UNIV_PAGE_SIZE) * 2;
- zip_hash_mem_size = ut_2pow_round(hash_create_needed(zip_hash_n)
- + (UNIV_PAGE_SIZE - 1), UNIV_PAGE_SIZE);
- }
-
+ size_target = (mem_size / UNIV_PAGE_SIZE) - 1;
/* Reserve space for the block descriptors. */
mem_size += ut_2pow_round((mem_size / UNIV_PAGE_SIZE) * (sizeof *block)
+ (UNIV_PAGE_SIZE - 1), UNIV_PAGE_SIZE);
- if (srv_buffer_pool_shm_key) {
- mem_size += ut_2pow_round(sizeof(buf_shm_info_t)
- + (UNIV_PAGE_SIZE - 1), UNIV_PAGE_SIZE);
- mem_size += zip_hash_mem_size;
- }
chunk->mem_size = mem_size;
-
- if (srv_buffer_pool_shm_key) {
- ulint binary_id;
- ibool is_new;
-
- ut_a(buf_pool->n_chunks == 1);
-
- fprintf(stderr,
- "InnoDB: Warning: The innodb_buffer_pool_shm_key option has been specified.\n"
- "InnoDB: Do not change the following between restarts of the server while this option is being used:\n"
- "InnoDB: * the mysqld executable between restarts of the server.\n"
- "InnoDB: * the value of innodb_buffer_pool_size.\n"
- "InnoDB: * the value of innodb_page_size.\n"
- "InnoDB: * datafiles created by InnoDB during this session.\n"
- "InnoDB: Otherwise, data corruption in datafiles may result.\n");
-
- /* FIXME: This is vague id still */
- binary_id = (ulint) ((byte*)mtr_commit - (byte*)btr_root_get)
- + (ulint) ((byte*)os_get_os_version - (byte*)buf_calc_page_new_checksum)
- + (ulint) ((byte*)page_dir_find_owner_slot - (byte*)dfield_data_is_binary_equal)
- + (ulint) ((byte*)que_graph_publish - (byte*)dict_casedn_str)
- + (ulint) ((byte*)read_view_oldest_copy_or_open_new - (byte*)fil_space_get_version)
- + (ulint) ((byte*)rec_get_n_extern_new - (byte*)fsp_get_size_low)
- + (ulint) ((byte*)row_get_trx_id_offset - (byte*)ha_create_func)
- + (ulint) ((byte*)srv_set_io_thread_op_info - (byte*)thd_is_replication_slave_thread)
- + (ulint) ((byte*)mutex_create_func - (byte*)ibuf_inside)
- + (ulint) ((byte*)trx_set_detailed_error - (byte*)lock_check_trx_id_sanity)
- + (ulint) ((byte*)ut_time - (byte*)mem_heap_strdup);
-
- chunk->mem = os_shm_alloc(&chunk->mem_size, srv_buffer_pool_shm_key, &is_new);
-
- if (UNIV_UNLIKELY(chunk->mem == NULL)) {
- return(NULL);
- }
-init_again:
-#ifdef UNIV_SET_MEM_TO_ZERO
- if (is_new) {
- memset(chunk->mem, '\0', chunk->mem_size);
- }
-#endif
- /* for ut_fold_binary_32(), these values should be 32-bit aligned */
- ut_a(sizeof(buf_shm_info_t) % 4 == 0);
- ut_a((ulint)chunk->mem % 4 == 0);
- ut_a(chunk->mem_size % 4 == 0);
-
- shm_info = chunk->mem;
-
- zip_hash_tmp = (hash_table_t*)((byte*)chunk->mem + chunk->mem_size - zip_hash_mem_size);
-
- if (is_new) {
- strncpy(shm_info->head_str, BUF_SHM_INFO_HEAD, 8);
- shm_info->binary_id = binary_id;
- shm_info->is_new = TRUE; /* changed to FALSE when the initialization is finished */
- shm_info->clean = FALSE; /* changed to TRUE when free the segment. */
- shm_info->reusable = FALSE; /* changed to TRUE when validation is finished. */
- shm_info->buf_pool_size = srv_buf_pool_size;
- shm_info->page_size = srv_page_size;
- shm_info->zip_hash_offset = chunk->mem_size - zip_hash_mem_size;
- shm_info->zip_hash_n = zip_hash_n;
- } else {
- ulint checksum;
-
- if (strncmp(shm_info->head_str, BUF_SHM_INFO_HEAD, 8)) {
- fprintf(stderr,
- "InnoDB: Error: The shared memory segment seems not to be for buffer pool.\n");
- return(NULL);
- }
- if (shm_info->binary_id != binary_id) {
- fprintf(stderr,
- "InnoDB: Error: The shared memory segment seems not to be for this binary.\n");
- return(NULL);
- }
- if (shm_info->is_new) {
- fprintf(stderr,
- "InnoDB: Error: The shared memory was not initialized yet.\n");
- return(NULL);
- }
- if (shm_info->buf_pool_size != srv_buf_pool_size) {
- fprintf(stderr,
- "InnoDB: Error: srv_buf_pool_size is different (shm=%lu current=%lu).\n",
- shm_info->buf_pool_size, srv_buf_pool_size);
- return(NULL);
- }
- if (shm_info->page_size != srv_page_size) {
- fprintf(stderr,
- "InnoDB: Error: srv_page_size is different (shm=%lu current=%lu).\n",
- shm_info->page_size, srv_page_size);
- return(NULL);
- }
- if (!shm_info->reusable) {
- fprintf(stderr,
- "InnoDB: Warning: The shared memory has unrecoverable contents.\n"
- "InnoDB: The shared memory segment is initialized.\n");
- is_new = TRUE;
- goto init_again;
- }
- if (!shm_info->clean) {
- fprintf(stderr,
- "InnoDB: Warning: The shared memory was not shut down cleanly.\n"
- "InnoDB: The shared memory segment is initialized.\n");
- is_new = TRUE;
- goto init_again;
- }
-
- ut_a(shm_info->zip_hash_offset == chunk->mem_size - zip_hash_mem_size);
- ut_a(shm_info->zip_hash_n == zip_hash_n);
-
- /* check checksum */
- if (srv_buffer_pool_shm_checksum) {
- checksum = ut_fold_binary_32((byte*)chunk->mem + sizeof(buf_shm_info_t),
- chunk->mem_size - sizeof(buf_shm_info_t));
- } else {
- checksum = BUF_NO_CHECKSUM_MAGIC;
- }
-
- if (shm_info->checksum != BUF_NO_CHECKSUM_MAGIC
- && shm_info->checksum != checksum) {
- fprintf(stderr,
- "InnoDB: Error: checksum of the shared memory is not match. "
- "(stored=%lu calculated=%lu)\n",
- shm_info->checksum, checksum);
- return(NULL);
- }
-
- /* flag to use the segment. */
- shm_info->clean = FALSE; /* changed to TRUE when free the segment. */
- }
-
- /* init zip_hash contents */
- if (is_new) {
- hash_create_init(zip_hash_tmp, zip_hash_n);
- } else {
- /* adjust offset is done later */
- hash_create_reuse(zip_hash_tmp);
-
- srv_buffer_pool_shm_is_reused = TRUE;
- }
- } else {
chunk->mem = os_mem_alloc_large(&chunk->mem_size);
if (UNIV_UNLIKELY(chunk->mem == NULL)) {
return(NULL);
}
- }
/* Allocate the block descriptors from
the start of the memory block. */
- if (srv_buffer_pool_shm_key) {
- chunk->blocks = (buf_block_t*)((byte*)chunk->mem + sizeof(buf_shm_info_t));
- } else {
chunk->blocks = chunk->mem;
- }
/* Align a pointer to the first frame. Note that when
os_large_page_size is smaller than UNIV_PAGE_SIZE,
@@ -1024,13 +1034,8 @@ init_again:
it is bigger, we may allocate more blocks than requested. */
frame = ut_align(chunk->mem, UNIV_PAGE_SIZE);
- if (srv_buffer_pool_shm_key) {
- /* reserve zip_hash space and always -1 for reproductibity */
- chunk->size = (chunk->mem_size - zip_hash_mem_size) / UNIV_PAGE_SIZE - 1;
- } else {
chunk->size = chunk->mem_size / UNIV_PAGE_SIZE
- (frame != chunk->mem);
- }
/* Subtract the space needed for block descriptors. */
{
@@ -1044,98 +1049,10 @@ init_again:
chunk->size = size;
}
- if (shm_info && !(shm_info->is_new)) {
- /* convert the shared memory segment for reuse */
- ptrdiff_t phys_offset;
- ptrdiff_t logi_offset;
- ptrdiff_t blocks_offset;
- byte* previous_frame_address;
-
- if (chunk->size < shm_info->chunk_backup.size) {
- fprintf(stderr,
- "InnoDB: Error: The buffer pool became smaller because of allocated address.\n"
- "InnoDB: Retrying may avoid this situation.\n");
- shm_info->clean = TRUE; /* release the flag for retrying */
- return(NULL);
- }
-
- chunk->size = shm_info->chunk_backup.size;
- phys_offset = frame - ((byte*)chunk->mem + shm_info->frame_offset);
- logi_offset = frame - chunk->blocks[0].frame;
- previous_frame_address = chunk->blocks[0].frame;
- blocks_offset = (byte*)chunk->blocks - (byte*)shm_info->chunk_backup.blocks;
-
- if (phys_offset || logi_offset || blocks_offset) {
- fprintf(stderr,
- "InnoDB: Buffer pool in the shared memory segment should be converted.\n"
- "InnoDB: Previous frames in address : %p\n"
- "InnoDB: Previous frames were located : %p\n"
- "InnoDB: Current frames should be located: %p\n"
- "InnoDB: Pysical offset : %ld (%#lx)\n"
- "InnoDB: Logical offset (frames) : %ld (%#lx)\n"
- "InnoDB: Logical offset (blocks) : %ld (%#lx)\n",
- (byte*)chunk->mem + shm_info->frame_offset,
- chunk->blocks[0].frame, frame,
- (long) phys_offset, (ulong) phys_offset, (long) logi_offset, (ulong) logi_offset,
- (long) blocks_offset, (ulong) blocks_offset);
- } else {
- fprintf(stderr,
- "InnoDB: Buffer pool in the shared memory segment can be used as it is.\n");
- }
-
- if (phys_offset) {
- fprintf(stderr,
- "InnoDB: Aligning physical offset...");
-
- memmove(frame, (byte*)chunk->mem + shm_info->frame_offset,
- chunk->size * UNIV_PAGE_SIZE);
-
- fprintf(stderr,
- " Done.\n");
- }
-
- /* buf_block_t */
- block = chunk->blocks;
- for (i = chunk->size; i--; ) {
- buf_block_reuse(block, logi_offset);
- block++;
- }
-
- if (logi_offset || blocks_offset) {
- fprintf(stderr,
- "InnoDB: Aligning logical offset...");
-
-
- /* buf_pool_t buf_pool_backup */
- UT_LIST_OFFSET(flush_list, buf_page_t, shm_info->buf_pool_backup.flush_list,
- previous_frame_address, logi_offset, blocks_offset);
- UT_LIST_OFFSET(free, buf_page_t, shm_info->buf_pool_backup.free,
- previous_frame_address, logi_offset, blocks_offset);
- UT_LIST_OFFSET(LRU, buf_page_t, shm_info->buf_pool_backup.LRU,
- previous_frame_address, logi_offset, blocks_offset);
- if (shm_info->buf_pool_backup.LRU_old)
- shm_info->buf_pool_backup.LRU_old =
- (buf_page_t*)((byte*)(shm_info->buf_pool_backup.LRU_old)
- + (((byte*)shm_info->buf_pool_backup.LRU_old > previous_frame_address)
- ? logi_offset : blocks_offset));
-
- UT_LIST_OFFSET(unzip_LRU, buf_block_t, shm_info->buf_pool_backup.unzip_LRU,
- previous_frame_address, logi_offset, blocks_offset);
-
- UT_LIST_OFFSET(zip_list, buf_page_t, shm_info->buf_pool_backup.zip_clean,
- previous_frame_address, logi_offset, blocks_offset);
- for (i = 0; i < BUF_BUDDY_SIZES_MAX; i++) {
- UT_LIST_OFFSET(zip_list, buf_page_t, shm_info->buf_pool_backup.zip_free[i],
- previous_frame_address, logi_offset, blocks_offset);
- }
-
- HASH_OFFSET(zip_hash_tmp, buf_page_t, hash,
- previous_frame_address, logi_offset, blocks_offset);
+ if (chunk->size > size_target) {
+ chunk->size = size_target;
+ }
- fprintf(stderr,
- " Done.\n");
- }
- } else {
/* Init block structs and assign frames for them. Then we
assign the frames to the first blocks (we already mapped the
memory above). */
@@ -1144,27 +1061,27 @@ init_again:
for (i = chunk->size; i--; ) {
- buf_block_init(block, frame);
+ buf_block_init(buf_pool, block, frame);
#ifdef HAVE_valgrind
/* Wipe contents of frame to eliminate a Purify warning */
memset(block->frame, '\0', UNIV_PAGE_SIZE);
#endif
/* Add the block to the free list */
- mutex_enter(&free_list_mutex);
+ mutex_enter(&buf_pool->free_list_mutex);
UT_LIST_ADD_LAST(free, buf_pool->free, (&block->page));
+
ut_d(block->page.in_free_list = TRUE);
- mutex_exit(&free_list_mutex);
+ mutex_exit(&buf_pool->free_list_mutex);
+ ut_ad(buf_pool_from_block(block) == buf_pool);
block++;
frame += UNIV_PAGE_SIZE;
}
- }
-
- if (shm_info) {
- shm_info->frame_offset = chunk->blocks[0].frame - (byte*)chunk->mem;
- }
+#ifdef PFS_GROUP_BUFFER_SYNC
+ pfs_register_buffer_block(chunk);
+#endif
return(chunk);
}
@@ -1183,9 +1100,6 @@ buf_chunk_contains_zip(
buf_block_t* block;
ulint i;
- ut_ad(buf_pool);
- //ut_ad(buf_pool_mutex_own());
-
block = chunk->blocks;
for (i = chunk->size; i--; block++) {
@@ -1206,12 +1120,17 @@ UNIV_INTERN
buf_block_t*
buf_pool_contains_zip(
/*==================*/
- const void* data) /*!< in: pointer to compressed page */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ const void* data) /*!< in: pointer to compressed page */
{
ulint n;
buf_chunk_t* chunk = buf_pool->chunks;
+ ut_ad(buf_pool);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->zip_free_mutex));
for (n = buf_pool->n_chunks; n--; chunk++) {
+
buf_block_t* block = buf_chunk_contains_zip(chunk, data);
if (block) {
@@ -1235,9 +1154,6 @@ buf_chunk_not_freed(
buf_block_t* block;
ulint i;
- ut_ad(buf_pool);
- //ut_ad(buf_pool_mutex_own()); /*optimistic...*/
-
block = chunk->blocks;
for (i = chunk->size; i--; block++) {
@@ -1292,9 +1208,6 @@ buf_chunk_all_free(
const buf_block_t* block;
ulint i;
- ut_ad(buf_pool);
- ut_ad(buf_pool_mutex_own()); /* but we need all mutex here */
-
block = chunk->blocks;
for (i = chunk->size; i--; block++) {
@@ -1314,12 +1227,13 @@ static
void
buf_chunk_free(
/*===========*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
buf_chunk_t* chunk) /*!< out: chunk of buffers */
{
buf_block_t* block;
const buf_block_t* block_end;
- ut_ad(buf_pool_mutex_own()); /* but we need all mutex here */
+ //ut_ad(buf_pool_mutex_own(buf_pool)); /* but we need all mutex here */
block_end = chunk->blocks + chunk->size;
@@ -1331,10 +1245,10 @@ buf_chunk_free(
ut_ad(!block->in_unzip_LRU_list);
ut_ad(!block->page.in_flush_list);
/* Remove the block from the free list. */
- mutex_enter(&free_list_mutex);
+ mutex_enter(&buf_pool->free_list_mutex);
ut_ad(block->page.in_free_list);
UT_LIST_REMOVE(free, buf_pool->free, (&block->page));
- mutex_exit(&free_list_mutex);
+ mutex_exit(&buf_pool->free_list_mutex);
/* Free the latches. */
mutex_free(&block->mutex);
@@ -1345,166 +1259,184 @@ buf_chunk_free(
UNIV_MEM_UNDESC(block);
}
- ut_a(!srv_buffer_pool_shm_key);
-
os_mem_free_large(chunk->mem, chunk->mem_size);
}
/********************************************************************//**
-Creates the buffer pool.
-@return own: buf_pool object, NULL if not enough memory or error */
-UNIV_INTERN
-buf_pool_t*
-buf_pool_init(void)
-/*===============*/
+Set buffer pool size variables after resizing it */
+static
+void
+buf_pool_set_sizes(void)
+/*====================*/
{
- buf_chunk_t* chunk;
- ulint i;
-
- buf_pool = mem_zalloc(sizeof(buf_pool_t));
+ ulint i;
+ ulint curr_size = 0;
- /* 1. Initialize general fields
- ------------------------------- */
- mutex_create(&buf_pool_mutex, SYNC_BUF_POOL);
- mutex_create(&LRU_list_mutex, SYNC_BUF_LRU_LIST);
- mutex_create(&flush_list_mutex, SYNC_BUF_FLUSH_LIST);
- rw_lock_create(&page_hash_latch, SYNC_BUF_PAGE_HASH);
- mutex_create(&free_list_mutex, SYNC_BUF_FREE_LIST);
- mutex_create(&zip_free_mutex, SYNC_BUF_ZIP_FREE);
- mutex_create(&zip_hash_mutex, SYNC_BUF_ZIP_HASH);
+ buf_pool_mutex_enter_all();
- mutex_create(&buf_pool_zip_mutex, SYNC_BUF_BLOCK);
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
- mutex_enter(&LRU_list_mutex);
- rw_lock_x_lock(&page_hash_latch);
- buf_pool_mutex_enter();
+ buf_pool = buf_pool_from_array(i);
+ curr_size += buf_pool->curr_pool_size;
+ }
- buf_pool->n_chunks = 1;
- buf_pool->chunks = chunk = mem_alloc(sizeof *chunk);
+ srv_buf_pool_curr_size = curr_size;
+ srv_buf_pool_old_size = srv_buf_pool_size;
- UT_LIST_INIT(buf_pool->free);
+ buf_pool_mutex_exit_all();
+}
- if (!buf_chunk_init(chunk, srv_buf_pool_size)) {
- mem_free(chunk);
- mem_free(buf_pool);
- buf_pool = NULL;
- return(NULL);
- }
+/********************************************************************//**
+Initialize a buffer pool instance.
+@return DB_SUCCESS if all goes well. */
+UNIV_INTERN
+ulint
+buf_pool_init_instance(
+/*===================*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint buf_pool_size, /*!< in: size in bytes */
+ ulint instance_no) /*!< in: id of the instance */
+{
+ ulint i;
+ buf_chunk_t* chunk;
- srv_buf_pool_old_size = srv_buf_pool_size;
- buf_pool->curr_size = chunk->size;
- srv_buf_pool_curr_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
+ /* 1. Initialize general fields
+ ------------------------------- */
+ mutex_create(buf_pool_mutex_key,
+ &buf_pool->mutex, SYNC_BUF_POOL);
+ mutex_create(buf_pool_LRU_list_mutex_key,
+ &buf_pool->LRU_list_mutex, SYNC_BUF_LRU_LIST);
+ rw_lock_create(buf_pool_page_hash_key,
+ &buf_pool->page_hash_latch, SYNC_BUF_PAGE_HASH);
+ mutex_create(buf_pool_free_list_mutex_key,
+ &buf_pool->free_list_mutex, SYNC_BUF_FREE_LIST);
+ mutex_create(buf_pool_zip_free_mutex_key,
+ &buf_pool->zip_free_mutex, SYNC_BUF_ZIP_FREE);
+ mutex_create(buf_pool_zip_hash_mutex_key,
+ &buf_pool->zip_hash_mutex, SYNC_BUF_ZIP_HASH);
+ mutex_create(buf_pool_zip_mutex_key,
+ &buf_pool->zip_mutex, SYNC_BUF_BLOCK);
+
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
+ buf_pool_mutex_enter(buf_pool);
+
+ if (buf_pool_size > 0) {
+ buf_pool->n_chunks = 1;
+ buf_pool->chunks = chunk = mem_zalloc(sizeof *chunk);
+
+ UT_LIST_INIT(buf_pool->free);
+
+ if (!buf_chunk_init(buf_pool, chunk, buf_pool_size)) {
+ mem_free(chunk);
+ mem_free(buf_pool);
+
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ buf_pool_mutex_exit(buf_pool);
+
+ return(DB_ERROR);
+ }
- buf_pool->page_hash = hash_create(2 * buf_pool->curr_size);
- /* zip_hash is allocated to shm when srv_buffer_pool_shm_key is enabled */
- if (!srv_buffer_pool_shm_key) {
- buf_pool->zip_hash = hash_create(2 * buf_pool->curr_size);
- }
+ buf_pool->instance_no = instance_no;
+ buf_pool->old_pool_size = buf_pool_size;
+ buf_pool->curr_size = chunk->size;
+ buf_pool->curr_pool_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
- buf_pool->last_printout_time = time(NULL);
+ buf_pool->page_hash = hash_create(2 * buf_pool->curr_size);
+ buf_pool->zip_hash = hash_create(2 * buf_pool->curr_size);
+ buf_pool->last_printout_time = ut_time();
+ }
/* 2. Initialize flushing fields
-------------------------------- */
+ mutex_create(flush_list_mutex_key, &buf_pool->flush_list_mutex,
+ SYNC_BUF_FLUSH_LIST);
+
for (i = BUF_FLUSH_LRU; i < BUF_FLUSH_N_TYPES; i++) {
buf_pool->no_flush[i] = os_event_create(NULL);
}
/* 3. Initialize LRU fields
--------------------------- */
+
/* All fields are initialized by mem_zalloc(). */
- if (srv_buffer_pool_shm_key) {
- buf_shm_info_t* shm_info;
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ buf_pool_mutex_exit(buf_pool);
- ut_a((byte*)chunk->blocks == (byte*)chunk->mem + sizeof(buf_shm_info_t));
- shm_info = chunk->mem;
+ return(DB_SUCCESS);
+}
- buf_pool->zip_hash = (hash_table_t*)((byte*)chunk->mem + shm_info->zip_hash_offset);
+/********************************************************************//**
+free one buffer pool instance */
+static
+void
+buf_pool_free_instance(
+/*===================*/
+ buf_pool_t* buf_pool) /* in,own: buffer pool instance
+ to free */
+{
+ buf_chunk_t* chunk;
+ buf_chunk_t* chunks;
- if(shm_info->is_new) {
- shm_info->is_new = FALSE; /* initialization was finished */
- } else {
- buf_block_t* block = chunk->blocks;
- buf_page_t* b;
-
- /* shm_info->buf_pool_backup should be converted */
- /* at buf_chunk_init(). So copy simply. */
- buf_pool->flush_list = shm_info->buf_pool_backup.flush_list;
- buf_pool->freed_page_clock = shm_info->buf_pool_backup.freed_page_clock;
- buf_pool->free = shm_info->buf_pool_backup.free;
- buf_pool->LRU = shm_info->buf_pool_backup.LRU;
- buf_pool->LRU_old = shm_info->buf_pool_backup.LRU_old;
- buf_pool->LRU_old_len = shm_info->buf_pool_backup.LRU_old_len;
- buf_pool->unzip_LRU = shm_info->buf_pool_backup.unzip_LRU;
- buf_pool->zip_clean = shm_info->buf_pool_backup.zip_clean;
- for (i = 0; i < BUF_BUDDY_SIZES_MAX; i++) {
- buf_pool->zip_free[i] = shm_info->buf_pool_backup.zip_free[i];
- }
+ chunks = buf_pool->chunks;
+ chunk = chunks + buf_pool->n_chunks;
- for (i = 0; i < chunk->size; i++, block++) {
- if (buf_block_get_state(block)
- == BUF_BLOCK_FILE_PAGE) {
- ut_d(block->page.in_page_hash = TRUE);
- HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
- buf_page_address_fold(
- block->page.space,
- block->page.offset),
- &block->page);
- }
- }
+ while (--chunk >= chunks) {
+ /* Bypass the checks of buf_chunk_free(), since they
+ would fail at shutdown. */
+ os_mem_free_large(chunk->mem, chunk->mem_size);
+ }
- for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
- b = UT_LIST_GET_NEXT(zip_list, b)) {
- ut_ad(!b->in_flush_list);
- ut_ad(b->in_LRU_list);
+ mem_free(buf_pool->chunks);
+ hash_table_free(buf_pool->page_hash);
+ hash_table_free(buf_pool->zip_hash);
+}
- ut_d(b->in_page_hash = TRUE);
- HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
- buf_page_address_fold(b->space, b->offset), b);
- }
+/********************************************************************//**
+Creates the buffer pool.
+@return DB_SUCCESS if success, DB_ERROR if not enough memory or error */
+UNIV_INTERN
+ulint
+buf_pool_init(
+/*==========*/
+ ulint total_size, /*!< in: size of the total pool in bytes */
+ ulint n_instances) /*!< in: number of instances */
+{
+ ulint i;
+ const ulint size = total_size / n_instances;
- for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
- b = UT_LIST_GET_NEXT(flush_list, b)) {
- ut_ad(b->in_flush_list);
- ut_ad(b->in_LRU_list);
-
- switch (buf_page_get_state(b)) {
- case BUF_BLOCK_ZIP_DIRTY:
- ut_d(b->in_page_hash = TRUE);
- HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
- buf_page_address_fold(b->space,
- b->offset), b);
- break;
- case BUF_BLOCK_FILE_PAGE:
- /* uncompressed page */
- break;
- case BUF_BLOCK_ZIP_FREE:
- case BUF_BLOCK_ZIP_PAGE:
- case BUF_BLOCK_NOT_USED:
- case BUF_BLOCK_READY_FOR_USE:
- case BUF_BLOCK_MEMORY:
- case BUF_BLOCK_REMOVE_HASH:
- ut_error;
- break;
- }
- }
+ ut_ad(n_instances > 0);
+ ut_ad(n_instances <= MAX_BUFFER_POOLS);
+ ut_ad(n_instances == srv_buf_pool_instances);
+
+ /* We create an extra buffer pool instance, this instance is used
+ for flushing the flush lists, to keep track of n_flush for all
+ the buffer pools and also used as a waiting object during flushing. */
+ buf_pool_ptr = mem_zalloc(n_instances * sizeof *buf_pool_ptr);
+
+ for (i = 0; i < n_instances; i++) {
+ buf_pool_t* ptr = &buf_pool_ptr[i];
+
+ if (buf_pool_init_instance(ptr, size, i) != DB_SUCCESS) {
+ /* Free all the instances created so far. */
+ buf_pool_free(i);
+ return(DB_ERROR);
}
}
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
- buf_pool_mutex_exit();
+ buf_pool_set_sizes();
+ buf_LRU_old_ratio_update(100 * 3/ 8, FALSE);
- btr_search_sys_create(buf_pool->curr_size
- * UNIV_PAGE_SIZE / sizeof(void*) / 64);
+ btr_search_sys_create(buf_pool_get_curr_size() / sizeof(void*) / 64);
- /* 4. Initialize the buddy allocator fields */
- /* All fields are initialized by mem_zalloc(). */
-
- return(buf_pool);
+ return(DB_SUCCESS);
}
/********************************************************************//**
@@ -1512,57 +1444,90 @@ Frees the buffer pool at shutdown. This must not be invoked before
freeing all mutexes. */
UNIV_INTERN
void
-buf_pool_free(void)
-/*===============*/
+buf_pool_free(
+/*==========*/
+ ulint n_instances) /*!< in: numbere of instances to free */
{
- buf_chunk_t* chunk;
- buf_chunk_t* chunks;
+ ulint i;
- if (srv_buffer_pool_shm_key) {
- buf_shm_info_t* shm_info;
+ for (i = 0; i < n_instances; i++) {
+ buf_pool_free_instance(buf_pool_from_array(i));
+ }
- ut_a(buf_pool->n_chunks == 1);
+ mem_free(buf_pool_ptr);
+ buf_pool_ptr = NULL;
+}
- chunk = buf_pool->chunks;
- shm_info = chunk->mem;
- ut_a((byte*)chunk->blocks == (byte*)chunk->mem + sizeof(buf_shm_info_t));
+/********************************************************************//**
+Drops adaptive hash index for a buffer pool instance. */
+static
+void
+buf_pool_drop_hash_index_instance(
+/*==============================*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ibool* released_search_latch) /*!< out: flag for signalling
+ whether the search latch was
+ released */
+{
+ buf_chunk_t* chunks = buf_pool->chunks;
+ buf_chunk_t* chunk = chunks + buf_pool->n_chunks;
- /* validation the shared memory segment doesn't have unrecoverable contents. */
- /* Currently, validation became not needed */
- shm_info->reusable = TRUE;
+ while (--chunk >= chunks) {
+ ulint i;
+ buf_block_t* block = chunk->blocks;
- memcpy(&(shm_info->buf_pool_backup), buf_pool, sizeof(buf_pool_t));
- memcpy(&(shm_info->chunk_backup), chunk, sizeof(buf_chunk_t));
+ for (i = chunk->size; i--; block++) {
+ /* block->is_hashed cannot be modified
+ when we have an x-latch on btr_search_latch;
+ see the comment in buf0buf.h */
- if (srv_fast_shutdown < 2) {
- if (srv_buffer_pool_shm_checksum) {
- shm_info->checksum = ut_fold_binary_32((byte*)chunk->mem + sizeof(buf_shm_info_t),
- chunk->mem_size - sizeof(buf_shm_info_t));
- } else {
- shm_info->checksum = BUF_NO_CHECKSUM_MAGIC;
+ if (!block->is_hashed) {
+ continue;
}
- shm_info->clean = TRUE;
- }
-
- os_shm_free(chunk->mem, chunk->mem_size);
- } else {
- chunks = buf_pool->chunks;
- chunk = chunks + buf_pool->n_chunks;
-
- while (--chunk >= chunks) {
- /* Bypass the checks of buf_chunk_free(), since they
- would fail at shutdown. */
- os_mem_free_large(chunk->mem, chunk->mem_size);
- }
- }
- mem_free(buf_pool->chunks);
- hash_table_free(buf_pool->page_hash);
- if (!srv_buffer_pool_shm_key) {
- hash_table_free(buf_pool->zip_hash);
+ /* To follow the latching order, we
+ have to release btr_search_latch
+ before acquiring block->latch. */
+ btr_search_x_unlock_all();
+ /* When we release the search latch,
+ we must rescan all blocks, because
+ some may become hashed again. */
+ *released_search_latch = TRUE;
+
+ rw_lock_x_lock(&block->lock);
+
+ /* This should be guaranteed by the
+ callers, which will be holding
+ btr_search_enabled_mutex. */
+ ut_ad(!btr_search_enabled);
+
+ /* Because we did not buffer-fix the
+ block by calling buf_block_get_gen(),
+ it is possible that the block has been
+ allocated for some other use after
+ btr_search_latch was released above.
+ We do not care which file page the
+ block is mapped to. All we want to do
+ is to drop any hash entries referring
+ to the page. */
+
+ /* It is possible that
+ block->page.state != BUF_FILE_PAGE.
+ Even that does not matter, because
+ btr_search_drop_page_hash_index() will
+ check block->is_hashed before doing
+ anything. block->is_hashed can only
+ be set on uncompressed file pages. */
+
+ btr_search_drop_page_hash_index(block, NULL);
+
+ rw_lock_x_unlock(&block->lock);
+
+ btr_search_x_lock_all();
+
+ ut_ad(!btr_search_enabled);
+ }
}
- mem_free(buf_pool);
- buf_pool = NULL;
}
/********************************************************************//**
@@ -1577,74 +1542,28 @@ buf_pool_drop_hash_index(void)
ibool released_search_latch;
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ ulint j;
+
+ for (j = 0; j < btr_search_index_num; j++) {
+ ut_ad(rw_lock_own(btr_search_latch_part[j], RW_LOCK_EX));
+ }
#endif /* UNIV_SYNC_DEBUG */
ut_ad(!btr_search_enabled);
do {
- buf_chunk_t* chunks = buf_pool->chunks;
- buf_chunk_t* chunk = chunks + buf_pool->n_chunks;
+ ulint i;
released_search_latch = FALSE;
- while (--chunk >= chunks) {
- buf_block_t* block = chunk->blocks;
- ulint i = chunk->size;
-
- for (; i--; block++) {
- /* block->is_hashed cannot be modified
- when we have an x-latch on btr_search_latch;
- see the comment in buf0buf.h */
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
- if (buf_block_get_state(block)
- != BUF_BLOCK_FILE_PAGE
- || !block->is_hashed) {
- continue;
- }
+ buf_pool = buf_pool_from_array(i);
- /* To follow the latching order, we
- have to release btr_search_latch
- before acquiring block->latch. */
- rw_lock_x_unlock(&btr_search_latch);
- /* When we release the search latch,
- we must rescan all blocks, because
- some may become hashed again. */
- released_search_latch = TRUE;
-
- rw_lock_x_lock(&block->lock);
-
- /* This should be guaranteed by the
- callers, which will be holding
- btr_search_enabled_mutex. */
- ut_ad(!btr_search_enabled);
-
- /* Because we did not buffer-fix the
- block by calling buf_block_get_gen(),
- it is possible that the block has been
- allocated for some other use after
- btr_search_latch was released above.
- We do not care which file page the
- block is mapped to. All we want to do
- is to drop any hash entries referring
- to the page. */
-
- /* It is possible that
- block->page.state != BUF_FILE_PAGE.
- Even that does not matter, because
- btr_search_drop_page_hash_index() will
- check block->is_hashed before doing
- anything. block->is_hashed can only
- be set on uncompressed file pages. */
-
- btr_search_drop_page_hash_index(block);
-
- rw_lock_x_unlock(&block->lock);
-
- rw_lock_x_lock(&btr_search_latch);
-
- ut_ad(!btr_search_enabled);
- }
+ buf_pool_drop_hash_index_instance(
+ buf_pool, &released_search_latch);
}
+
} while (released_search_latch);
}
@@ -1663,11 +1582,12 @@ buf_relocate(
{
buf_page_t* b;
ulint fold;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&page_hash_latch, RW_LOCK_EX));
+ ut_ad(rw_lock_own(&buf_pool->page_hash_latch, RW_LOCK_EX));
#endif
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
@@ -1675,7 +1595,9 @@ buf_relocate(
ut_ad(bpage->in_LRU_list);
ut_ad(!bpage->in_zip_hash);
ut_ad(bpage->in_page_hash);
- ut_ad(bpage == buf_page_hash_get(bpage->space, bpage->offset));
+ ut_ad(bpage == buf_page_hash_get(buf_pool,
+ bpage->space, bpage->offset));
+ ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
#ifdef UNIV_DEBUG
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
@@ -1734,12 +1656,13 @@ buf_relocate(
}
/********************************************************************//**
-Shrinks the buffer pool. */
+Shrinks a buffer pool instance. */
static
void
-buf_pool_shrink(
-/*============*/
- ulint chunk_size) /*!< in: number of pages to remove */
+buf_pool_shrink_instance(
+/*=====================*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint chunk_size) /*!< in: number of pages to remove */
{
buf_chunk_t* chunks;
buf_chunk_t* chunk;
@@ -1748,17 +1671,12 @@ buf_pool_shrink(
buf_chunk_t* max_chunk;
buf_chunk_t* max_free_chunk;
- ut_ad(!buf_pool_mutex_own());
+ ut_ad(!buf_pool_mutex_own(buf_pool));
try_again:
btr_search_disable(); /* Empty the adaptive hash index again */
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
-
- if (srv_buffer_pool_shm_key) {
- /* Cannot support shrink */
- goto func_done;
- }
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
shrink_again:
if (buf_pool->n_chunks <= 1) {
@@ -1821,7 +1739,7 @@ shrink_again:
mutex_enter(&block->mutex);
/* The following calls will temporarily
- release block->mutex and buf_pool_mutex.
+ release block->mutex and buf_pool->mutex.
Therefore, we have to always retry,
even if !dirty && !nonfree. */
@@ -1829,7 +1747,7 @@ shrink_again:
buf_LRU_make_block_old(&block->page);
dirty++;
- } else if (buf_LRU_free_block(&block->page, TRUE, NULL, FALSE)
+ } else if (buf_LRU_free_block(&block->page, TRUE, TRUE)
!= BUF_LRU_FREED) {
nonfree++;
}
@@ -1837,8 +1755,8 @@ shrink_again:
mutex_exit(&block->mutex);
}
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
/* Request for a flush of the chunk if it helps.
Do not flush if there are non-free blocks, since
@@ -1847,10 +1765,10 @@ shrink_again:
/* Avoid busy-waiting. */
os_thread_sleep(100000);
} else if (dirty
- && buf_flush_batch(BUF_FLUSH_LRU, dirty, 0)
- == ULINT_UNDEFINED) {
+ && buf_flush_LRU(buf_pool, dirty)
+ == ULINT_UNDEFINED) {
- buf_flush_wait_batch_end(BUF_FLUSH_LRU);
+ buf_flush_wait_batch_end(buf_pool, BUF_FLUSH_LRU);
}
goto try_again;
@@ -1859,7 +1777,7 @@ shrink_again:
max_size = max_free_size;
max_chunk = max_free_chunk;
- srv_buf_pool_old_size = srv_buf_pool_size;
+ buf_pool->old_pool_size = buf_pool->curr_pool_size;
/* Rewrite buf_pool->chunks. Copy everything but max_chunk. */
chunks = mem_alloc((buf_pool->n_chunks - 1) * sizeof *chunks);
@@ -1871,9 +1789,9 @@ shrink_again:
- (max_chunk + 1));
ut_a(buf_pool->curr_size > max_chunk->size);
buf_pool->curr_size -= max_chunk->size;
- srv_buf_pool_curr_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
+ buf_pool->curr_pool_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
chunk_size -= max_chunk->size;
- buf_chunk_free(max_chunk);
+ buf_chunk_free(buf_pool, max_chunk);
mem_free(buf_pool->chunks);
buf_pool->chunks = chunks;
buf_pool->n_chunks--;
@@ -1883,34 +1801,56 @@ shrink_again:
goto shrink_again;
}
+ goto func_exit;
func_done:
- srv_buf_pool_old_size = srv_buf_pool_size;
+ buf_pool->old_pool_size = buf_pool->curr_pool_size;
func_exit:
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
btr_search_enable();
}
/********************************************************************//**
-Rebuild buf_pool->page_hash. */
+Shrinks the buffer pool. */
static
void
-buf_pool_page_hash_rebuild(void)
-/*============================*/
+buf_pool_shrink(
+/*============*/
+ ulint chunk_size) /*!< in: number of pages to remove */
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+ ulint instance_chunk_size;
+
+ instance_chunk_size = chunk_size / srv_buf_pool_instances;
+ buf_pool = buf_pool_from_array(i);
+ buf_pool_shrink_instance(buf_pool, instance_chunk_size);
+ }
+
+ buf_pool_set_sizes();
+}
+
+/********************************************************************//**
+Rebuild buf_pool->page_hash for a buffer pool instance. */
+static
+void
+buf_pool_page_hash_rebuild_instance(
+/*================================*/
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
{
ulint i;
- ulint n_chunks;
+ buf_page_t* b;
buf_chunk_t* chunk;
- hash_table_t* page_hash;
+ ulint n_chunks;
hash_table_t* zip_hash;
- buf_page_t* b;
+ hash_table_t* page_hash;
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
- rw_lock_x_lock(&page_hash_latch);
- mutex_enter(&flush_list_mutex);
-
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
/* Free, create, and populate the hash table. */
hash_table_free(buf_pool->page_hash);
@@ -1951,6 +1891,7 @@ buf_pool_page_hash_rebuild(void)
All such blocks are either in buf_pool->zip_clean or
in buf_pool->flush_list. */
+ mutex_enter(&buf_pool->zip_mutex);
for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
b = UT_LIST_GET_NEXT(zip_list, b)) {
ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
@@ -1962,7 +1903,9 @@ buf_pool_page_hash_rebuild(void)
HASH_INSERT(buf_page_t, hash, page_hash,
buf_page_address_fold(b->space, b->offset), b);
}
+ mutex_exit(&buf_pool->zip_mutex);
+ buf_flush_list_mutex_enter(buf_pool);
for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
b = UT_LIST_GET_NEXT(flush_list, b)) {
ut_ad(b->in_flush_list);
@@ -1990,10 +1933,201 @@ buf_pool_page_hash_rebuild(void)
}
}
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
- mutex_exit(&flush_list_mutex);
+ buf_flush_list_mutex_exit(buf_pool);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+}
+
+/********************************************************************
+Determine if a block is a sentinel for a buffer pool watch.
+@return TRUE if a sentinel for a buffer pool watch, FALSE if not */
+UNIV_INTERN
+ibool
+buf_pool_watch_is_sentinel(
+/*=======================*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ const buf_page_t* bpage) /*!< in: block */
+{
+ ut_ad(buf_page_in_file(bpage));
+
+ if (bpage < &buf_pool->watch[0]
+ || bpage >= &buf_pool->watch[BUF_POOL_WATCH_SIZE]) {
+
+ ut_ad(buf_page_get_state(bpage) != BUF_BLOCK_ZIP_PAGE
+ || bpage->zip.data != NULL);
+
+ return(FALSE);
+ }
+
+ ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_PAGE);
+ ut_ad(!bpage->in_zip_hash);
+ ut_ad(bpage->in_page_hash);
+ ut_ad(bpage->zip.data == NULL);
+ ut_ad(bpage->buf_fix_count > 0);
+ return(TRUE);
+}
+
+/****************************************************************//**
+Add watch for the given page to be read in. Caller must have the buffer pool
+mutex reserved.
+@return NULL if watch set, block if the page is in the buffer pool */
+UNIV_INTERN
+buf_page_t*
+buf_pool_watch_set(
+/*===============*/
+ ulint space, /*!< in: space id */
+ ulint offset, /*!< in: page number */
+ ulint fold) /*!< in: buf_page_address_fold(space, offset) */
+{
+ buf_page_t* bpage;
+ ulint i;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
+ mutex_t* block_mutex;
+
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
+ bpage = buf_page_hash_get_low(buf_pool, space, offset, fold);
+ if (bpage) {
+ block_mutex = buf_page_get_mutex_enter(bpage);
+ ut_a(block_mutex);
+ }
+
+ if (UNIV_LIKELY_NULL(bpage)) {
+ if (!buf_pool_watch_is_sentinel(buf_pool, bpage)) {
+ /* The page was loaded meanwhile. */
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ return(bpage);
+ }
+ /* Add to an existing watch. */
+ bpage->buf_fix_count++;
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ mutex_exit(block_mutex);
+ return(NULL);
+ }
+
+ /* buf_pool->watch is protected by zip_mutex for now */
+ mutex_enter(&buf_pool->zip_mutex);
+ for (i = 0; i < BUF_POOL_WATCH_SIZE; i++) {
+ bpage = &buf_pool->watch[i];
+
+ ut_ad(bpage->access_time == 0);
+ ut_ad(bpage->newest_modification == 0);
+ ut_ad(bpage->oldest_modification == 0);
+ ut_ad(bpage->zip.data == NULL);
+ ut_ad(!bpage->in_zip_hash);
+
+ switch (bpage->state) {
+ case BUF_BLOCK_POOL_WATCH:
+ ut_ad(!bpage->in_page_hash);
+ ut_ad(bpage->buf_fix_count == 0);
+
+ /* bpage is pointing to buf_pool->watch[],
+ which is protected by buf_pool->mutex.
+ Normally, buf_page_t objects are protected by
+ buf_block_t::mutex or buf_pool->zip_mutex or both. */
+
+ bpage->state = BUF_BLOCK_ZIP_PAGE;
+ bpage->space = space;
+ bpage->offset = offset;
+ bpage->buf_fix_count = 1;
+ bpage->buf_pool_index = buf_pool_index(buf_pool);
+ ut_d(bpage->in_page_hash = TRUE);
+ HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
+ fold, bpage);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ mutex_exit(&buf_pool->zip_mutex);
+ return(NULL);
+ case BUF_BLOCK_ZIP_PAGE:
+ ut_ad(bpage->in_page_hash);
+ ut_ad(bpage->buf_fix_count > 0);
+ break;
+ default:
+ ut_error;
+ }
+ }
+
+ /* Allocation failed. Either the maximum number of purge
+ threads should never exceed BUF_POOL_WATCH_SIZE, or this code
+ should be modified to return a special non-NULL value and the
+ caller should purge the record directly. */
+ ut_error;
+
+ /* Fix compiler warning */
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ mutex_exit(&buf_pool->zip_mutex);
+ return(NULL);
+}
+
+/********************************************************************//**
+Rebuild buf_pool->page_hash. */
+static
+void
+buf_pool_page_hash_rebuild(void)
+/*============================*/
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_page_hash_rebuild_instance(buf_pool_from_array(i));
+ }
+}
+
+/********************************************************************//**
+Increase the buffer pool size of one buffer pool instance. */
+static
+void
+buf_pool_increase_instance(
+/*=======================*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instane */
+ ulint change_size) /*!< in: new size of the pool */
+{
+ buf_chunk_t* chunks;
+ buf_chunk_t* chunk;
+
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
+ buf_pool_mutex_enter(buf_pool);
+ chunks = mem_alloc((buf_pool->n_chunks + 1) * sizeof *chunks);
+
+ memcpy(chunks, buf_pool->chunks, buf_pool->n_chunks * sizeof *chunks);
+
+ chunk = &chunks[buf_pool->n_chunks];
+
+ if (!buf_chunk_init(buf_pool, chunk, change_size)) {
+ mem_free(chunks);
+ } else {
+ buf_pool->old_pool_size = buf_pool->curr_pool_size;
+ buf_pool->curr_size += chunk->size;
+ buf_pool->curr_pool_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
+ mem_free(buf_pool->chunks);
+ buf_pool->chunks = chunks;
+ buf_pool->n_chunks++;
+ }
+
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ buf_pool_mutex_exit(buf_pool);
+}
+
+/********************************************************************//**
+Increase the buffer pool size. */
+static
+void
+buf_pool_increase(
+/*==============*/
+ ulint change_size)
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_increase_instance(
+ buf_pool_from_array(i),
+ change_size / srv_buf_pool_instances);
+ }
+
+ buf_pool_set_sizes();
}
/********************************************************************//**
@@ -2003,63 +2137,146 @@ void
buf_pool_resize(void)
/*=================*/
{
- if (srv_buffer_pool_shm_key) {
- /* Cannot support resize */
- return;
- }
+ ulint change_size;
+ ulint min_change_size = 1048576 * srv_buf_pool_instances;
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ buf_pool_mutex_enter_all();
- if (srv_buf_pool_old_size == srv_buf_pool_size) {
+ if (srv_buf_pool_old_size == srv_buf_pool_size) {
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- return;
- }
+ buf_pool_mutex_exit_all();
- if (srv_buf_pool_curr_size + 1048576 > srv_buf_pool_size) {
+ return;
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ } else if (srv_buf_pool_curr_size + min_change_size
+ > srv_buf_pool_size) {
- /* Disable adaptive hash indexes and empty the index
- in order to free up memory in the buffer pool chunks. */
- buf_pool_shrink((srv_buf_pool_curr_size - srv_buf_pool_size)
- / UNIV_PAGE_SIZE);
- } else if (srv_buf_pool_curr_size + 1048576 < srv_buf_pool_size) {
+ change_size = (srv_buf_pool_curr_size - srv_buf_pool_size)
+ / UNIV_PAGE_SIZE;
- /* Enlarge the buffer pool by at least one megabyte */
+ buf_pool_mutex_exit_all();
- ulint mem_size
- = srv_buf_pool_size - srv_buf_pool_curr_size;
- buf_chunk_t* chunks;
- buf_chunk_t* chunk;
+ /* Disable adaptive hash indexes and empty the index
+ in order to free up memory in the buffer pool chunks. */
+ buf_pool_shrink(change_size);
- chunks = mem_alloc((buf_pool->n_chunks + 1) * sizeof *chunks);
+ } else if (srv_buf_pool_curr_size + min_change_size
+ < srv_buf_pool_size) {
- memcpy(chunks, buf_pool->chunks, buf_pool->n_chunks
- * sizeof *chunks);
+ /* Enlarge the buffer pool by at least one megabyte */
- chunk = &chunks[buf_pool->n_chunks];
+ change_size = srv_buf_pool_size - srv_buf_pool_curr_size;
- if (!buf_chunk_init(chunk, mem_size)) {
- mem_free(chunks);
- } else {
- buf_pool->curr_size += chunk->size;
- srv_buf_pool_curr_size = buf_pool->curr_size
- * UNIV_PAGE_SIZE;
- mem_free(buf_pool->chunks);
- buf_pool->chunks = chunks;
- buf_pool->n_chunks++;
- }
+ buf_pool_mutex_exit_all();
- srv_buf_pool_old_size = srv_buf_pool_size;
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ buf_pool_increase(change_size);
+ } else {
+ srv_buf_pool_size = srv_buf_pool_old_size;
+
+ buf_pool_mutex_exit_all();
+
+ return;
}
- buf_pool_page_hash_rebuild();
+ buf_pool_page_hash_rebuild();
+}
+
+/****************************************************************//**
+Remove the sentinel block for the watch before replacing it with a real block.
+buf_page_watch_clear() or buf_page_watch_occurred() will notice that
+the block has been replaced with the real block.
+@return reference count, to be added to the replacement block */
+static
+void
+buf_pool_watch_remove(
+/*==================*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ ulint fold, /*!< in: buf_page_address_fold(
+ space, offset) */
+ buf_page_t* watch) /*!< in/out: sentinel for watch */
+{
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(rw_lock_own(&buf_pool->page_hash_latch, RW_LOCK_EX));
+#endif
+ ut_ad(mutex_own(&buf_pool->zip_mutex)); /* for now */
+
+ HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, watch);
+ ut_d(watch->in_page_hash = FALSE);
+ watch->buf_fix_count = 0;
+ watch->state = BUF_BLOCK_POOL_WATCH;
+}
+
+/****************************************************************//**
+Stop watching if the page has been read in.
+buf_pool_watch_set(space,offset) must have returned NULL before. */
+UNIV_INTERN
+void
+buf_pool_watch_unset(
+/*=================*/
+ ulint space, /*!< in: space id */
+ ulint offset) /*!< in: page number */
+{
+ buf_page_t* bpage;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
+ ulint fold = buf_page_address_fold(space, offset);
+
+ //buf_pool_mutex_enter(buf_pool);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
+ bpage = buf_page_hash_get_low(buf_pool, space, offset, fold);
+ /* The page must exist because buf_pool_watch_set()
+ increments buf_fix_count. */
+ ut_a(bpage);
+
+ if (UNIV_UNLIKELY(!buf_pool_watch_is_sentinel(buf_pool, bpage))) {
+ mutex_t* mutex = buf_page_get_mutex_enter(bpage);
+
+ ut_a(bpage->buf_fix_count > 0);
+ bpage->buf_fix_count--;
+ mutex_exit(mutex);
+ } else {
+ mutex_enter(&buf_pool->zip_mutex);
+ ut_a(bpage->buf_fix_count > 0);
+
+ if (UNIV_LIKELY(!--bpage->buf_fix_count)) {
+ buf_pool_watch_remove(buf_pool, fold, bpage);
+ }
+ mutex_exit(&buf_pool->zip_mutex);
+ }
+
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+}
+
+/****************************************************************//**
+Check if the page has been read in.
+This may only be called after buf_pool_watch_set(space,offset)
+has returned NULL and before invoking buf_pool_watch_unset(space,offset).
+@return FALSE if the given page was not read in, TRUE if it was */
+UNIV_INTERN
+ibool
+buf_pool_watch_occurred(
+/*====================*/
+ ulint space, /*!< in: space id */
+ ulint offset) /*!< in: page number */
+{
+ ibool ret;
+ buf_page_t* bpage;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
+ ulint fold = buf_page_address_fold(space, offset);
+
+ //buf_pool_mutex_enter(buf_pool);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
+
+ bpage = buf_page_hash_get_low(buf_pool, space, offset, fold);
+ /* The page must exist because buf_pool_watch_set()
+ increments buf_fix_count. */
+ ut_a(bpage);
+ ret = !buf_pool_watch_is_sentinel(buf_pool, bpage);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
+
+ return(ret);
}
/********************************************************************//**
@@ -2072,15 +2289,17 @@ buf_page_make_young(
/*================*/
buf_page_t* bpage) /*!< in: buffer block of a file page */
{
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
ut_a(buf_page_in_file(bpage));
buf_LRU_make_block_young(bpage);
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
}
/********************************************************************//**
@@ -2098,24 +2317,26 @@ buf_page_set_accessed_make_young(
read under mutex protection,
or 0 if unknown */
{
- ut_ad(!buf_pool_mutex_own());
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
+ ut_ad(!buf_pool_mutex_own(buf_pool));
ut_a(buf_page_in_file(bpage));
if (buf_page_peek_if_too_old(bpage)) {
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
buf_LRU_make_block_young(bpage);
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
} else if (!access_time) {
ulint time_ms = ut_time_ms();
mutex_t* block_mutex = buf_page_get_mutex_enter(bpage);
- //buf_pool_mutex_enter();
+ //buf_pool_mutex_enter(buf_pool);
if (block_mutex) {
buf_page_set_accessed(bpage, time_ms);
mutex_exit(block_mutex);
}
- //buf_pool_mutex_exit();
+ //buf_pool_mutex_exit(buf_pool);
}
}
@@ -2130,18 +2351,20 @@ buf_reset_check_index_page_at_flush(
ulint offset) /*!< in: page number */
{
buf_block_t* block;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
- //buf_pool_mutex_enter();
- rw_lock_s_lock(&page_hash_latch);
+ //buf_pool_mutex_enter(buf_pool);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
- block = (buf_block_t*) buf_page_hash_get(space, offset);
+ block = (buf_block_t*) buf_page_hash_get(buf_pool, space, offset);
if (block && buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE) {
+ ut_ad(!buf_pool_watch_is_sentinel(buf_pool, &block->page));
block->check_index_page_at_flush = FALSE;
}
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
}
/********************************************************************//**
@@ -2158,25 +2381,27 @@ buf_page_peek_if_search_hashed(
{
buf_block_t* block;
ibool is_hashed;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
- //buf_pool_mutex_enter();
- rw_lock_s_lock(&page_hash_latch);
+ //buf_pool_mutex_enter(buf_pool);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
- block = (buf_block_t*) buf_page_hash_get(space, offset);
+ block = (buf_block_t*) buf_page_hash_get(buf_pool, space, offset);
if (!block || buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE) {
is_hashed = FALSE;
} else {
+ ut_ad(!buf_pool_watch_is_sentinel(buf_pool, &block->page));
is_hashed = block->is_hashed;
}
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
return(is_hashed);
}
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
/********************************************************************//**
Sets file_page_was_freed TRUE if the page is found in the buffer pool.
This function should be called when we free a file page and want the
@@ -2191,18 +2416,22 @@ buf_page_set_file_page_was_freed(
ulint offset) /*!< in: page number */
{
buf_page_t* bpage;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
- //buf_pool_mutex_enter();
- rw_lock_s_lock(&page_hash_latch);
+ //buf_pool_mutex_enter(buf_pool);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
- bpage = buf_page_hash_get(space, offset);
+ bpage = buf_page_hash_get(buf_pool, space, offset);
if (bpage) {
+ ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
+ /* bpage->file_page_was_freed can already hold
+ when this code is invoked from dict_drop_index_tree() */
bpage->file_page_was_freed = TRUE;
}
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
return(bpage);
}
@@ -2221,22 +2450,24 @@ buf_page_reset_file_page_was_freed(
ulint offset) /*!< in: page number */
{
buf_page_t* bpage;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
- //buf_pool_mutex_enter();
- rw_lock_s_lock(&page_hash_latch);
+ //buf_pool_mutex_enter(buf_pool);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
- bpage = buf_page_hash_get(space, offset);
+ bpage = buf_page_hash_get(buf_pool, space, offset);
if (bpage) {
+ ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
bpage->file_page_was_freed = FALSE;
}
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
return(bpage);
}
-#endif /* UNIV_DEBUG_FILE_ACCESSES */
+#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
/********************************************************************//**
Get read access to a compressed page (usually of type
@@ -2264,28 +2495,27 @@ buf_page_get_zip(
ulint ms;
ib_uint64_t start_time;
ib_uint64_t finish_time;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
-#ifndef UNIV_LOG_DEBUG
- ut_ad(!ibuf_inside());
-#endif
if (innobase_get_slow_log()) {
trx = innobase_get_trx();
}
buf_pool->stat.n_page_gets++;
for (;;) {
- //buf_pool_mutex_enter();
+ //buf_pool_mutex_enter(buf_pool);
lookup:
- rw_lock_s_lock(&page_hash_latch);
- bpage = buf_page_hash_get(space, offset);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
+ bpage = buf_page_hash_get(buf_pool, space, offset);
if (bpage) {
+ ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
break;
}
/* Page not in buf_pool: needs to be read from file */
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
buf_read_page(space, zip_size, offset, trx);
@@ -2297,22 +2527,23 @@ lookup:
if (UNIV_UNLIKELY(!bpage->zip.data)) {
/* There is no compressed page. */
err_exit:
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
return(NULL);
}
- if (srv_pass_corrupt_table) {
+ if (srv_pass_corrupt_table <= 1) {
if (bpage->is_corrupt) {
- rw_lock_s_unlock(&page_hash_latch);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
return(NULL);
}
}
- ut_a(!(bpage->is_corrupt));
block_mutex = buf_page_get_mutex_enter(bpage);
- rw_lock_s_unlock(&page_hash_latch);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
+
+ ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_NOT_USED:
@@ -2325,20 +2556,38 @@ err_exit:
break;
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
- ut_a(block_mutex == &buf_pool_zip_mutex);
+ ut_a(block_mutex == &buf_pool->zip_mutex);
bpage->buf_fix_count++;
goto got_block;
case BUF_BLOCK_FILE_PAGE:
ut_a(block_mutex == &((buf_block_t*) bpage)->mutex);
- /* Discard the uncompressed page frame if possible. */
- if (buf_LRU_free_block(bpage, FALSE, NULL, FALSE)
- == BUF_LRU_FREED) {
+ /* release mutex to obey to latch-order */
+ mutex_exit(block_mutex);
+ /* get LRU_list_mutex for buf_LRU_free_block() */
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ mutex_enter(block_mutex);
+
+ if (UNIV_UNLIKELY(bpage->space != space
+ || bpage->offset != offset
+ || !bpage->in_LRU_list
+ || !bpage->zip.data)) {
+ /* someone should interrupt, retry */
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ mutex_exit(block_mutex);
+ goto lookup;
+ }
+
+ /* Discard the uncompressed page frame if possible. */
+ if (buf_LRU_free_block(bpage, FALSE, TRUE) == BUF_LRU_FREED) {
+ mutex_exit(&buf_pool->LRU_list_mutex);
mutex_exit(block_mutex);
goto lookup;
}
+ mutex_exit(&buf_pool->LRU_list_mutex);
+
buf_block_buf_fix_inc((buf_block_t*) bpage,
__FILE__, __LINE__);
goto got_block;
@@ -2351,13 +2600,13 @@ got_block:
must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ;
access_time = buf_page_is_accessed(bpage);
- //buf_pool_mutex_exit();
+ //buf_pool_mutex_exit(buf_pool);
mutex_exit(block_mutex);
buf_page_set_accessed_make_young(bpage, access_time);
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ut_a(!bpage->file_page_was_freed);
#endif
@@ -2417,6 +2666,7 @@ buf_block_init_low(
{
block->check_index_page_at_flush = FALSE;
block->index = NULL;
+ block->btr_search_latch = NULL;
block->n_hash_helps = 0;
block->is_hashed = FALSE;
@@ -2494,13 +2744,16 @@ buf_zip_decompress(
#ifndef UNIV_HOTBACKUP
/*******************************************************************//**
-Gets the block to whose frame the pointer is pointing to.
-@return pointer to block, never NULL */
+Gets the block to whose frame the pointer is pointing to if found
+in this buffer pool instance.
+@return pointer to block */
UNIV_INTERN
buf_block_t*
-buf_block_align(
-/*============*/
- const byte* ptr) /*!< in: pointer to a frame */
+buf_block_align_instance(
+/*=====================*/
+ buf_pool_t* buf_pool, /*!< in: buffer in which the block
+ resides */
+ const byte* ptr) /*!< in: pointer to a frame */
{
buf_chunk_t* chunk;
ulint i;
@@ -2508,16 +2761,19 @@ buf_block_align(
/* TODO: protect buf_pool->chunks with a mutex (it will
currently remain constant after buf_pool_init()) */
for (chunk = buf_pool->chunks, i = buf_pool->n_chunks; i--; chunk++) {
- lint offs = ptr - chunk->blocks->frame;
+ ulint offs;
- if (UNIV_UNLIKELY(offs < 0)) {
+ if (UNIV_UNLIKELY(ptr < chunk->blocks->frame)) {
continue;
}
+ /* else */
+
+ offs = ptr - chunk->blocks->frame;
offs >>= UNIV_PAGE_SIZE_SHIFT;
- if (UNIV_LIKELY((ulint) offs < chunk->size)) {
+ if (UNIV_LIKELY(offs < chunk->size)) {
buf_block_t* block = &chunk->blocks[offs];
/* The function buf_chunk_init() invokes
@@ -2526,7 +2782,7 @@ buf_block_align(
ut_ad(block->frame == page_align(ptr));
#ifdef UNIV_DEBUG
/* A thread that updates these fields must
- hold buf_pool_mutex and block->mutex. Acquire
+ hold buf_pool->mutex and block->mutex. Acquire
only the latter. */
mutex_enter(&block->mutex);
@@ -2575,6 +2831,30 @@ buf_block_align(
}
}
+ return(NULL);
+}
+
+/*******************************************************************//**
+Gets the block to whose frame the pointer is pointing to.
+@return pointer to block, never NULL */
+UNIV_INTERN
+buf_block_t*
+buf_block_align(
+/*============*/
+ const byte* ptr) /*!< in: pointer to a frame */
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_block_t* block;
+
+ block = buf_block_align_instance(
+ buf_pool_from_array(i), ptr);
+ if (block) {
+ return(block);
+ }
+ }
+
/* The block should always be found. */
ut_error;
return(NULL);
@@ -2582,14 +2862,15 @@ buf_block_align(
/********************************************************************//**
Find out if a pointer belongs to a buf_block_t. It can be a pointer to
-the buf_block_t itself or a member of it
+the buf_block_t itself or a member of it. This functions checks one of
+the buffer pool instances.
@return TRUE if ptr belongs to a buf_block_t struct */
-UNIV_INTERN
+static
ibool
-buf_pointer_is_block_field(
-/*=======================*/
- const void* ptr) /*!< in: pointer not
- dereferenced */
+buf_pointer_is_block_field_instance(
+/*================================*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ const void* ptr) /*!< in: pointer not dereferenced */
{
const buf_chunk_t* chunk = buf_pool->chunks;
const buf_chunk_t* const echunk = chunk + buf_pool->n_chunks;
@@ -2610,23 +2891,49 @@ buf_pointer_is_block_field(
}
/********************************************************************//**
+Find out if a pointer belongs to a buf_block_t. It can be a pointer to
+the buf_block_t itself or a member of it
+@return TRUE if ptr belongs to a buf_block_t struct */
+UNIV_INTERN
+ibool
+buf_pointer_is_block_field(
+/*=======================*/
+ const void* ptr) /*!< in: pointer not dereferenced */
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ ibool found;
+
+ found = buf_pointer_is_block_field_instance(
+ buf_pool_from_array(i), ptr);
+ if (found) {
+ return(TRUE);
+ }
+ }
+
+ return(FALSE);
+}
+
+/********************************************************************//**
Find out if a buffer block was created by buf_chunk_init().
@return TRUE if "block" has been added to buf_pool->free by buf_chunk_init() */
static
ibool
buf_block_is_uncompressed(
/*======================*/
- const buf_block_t* block) /*!< in: pointer to block,
- not dereferenced */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ const buf_block_t* block) /*!< in: pointer to block,
+ not dereferenced */
{
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
if (UNIV_UNLIKELY((((ulint) block) % sizeof *block) != 0)) {
/* The pointer should be aligned. */
return(FALSE);
}
- return(buf_pointer_is_block_field((void *)block));
+ return(buf_pointer_is_block_field_instance(buf_pool, (void *)block));
}
/********************************************************************//**
@@ -2643,43 +2950,61 @@ buf_page_get_gen(
ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
buf_block_t* guess, /*!< in: guessed block or NULL */
ulint mode, /*!< in: BUF_GET, BUF_GET_IF_IN_POOL,
- BUF_GET_NO_LATCH */
+ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or
+ BUF_GET_IF_IN_POOL_OR_WATCH */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mini-transaction */
{
buf_block_t* block;
+ ulint fold;
unsigned access_time;
ulint fix_type;
ibool must_read;
ulint retries = 0;
- mutex_t* block_mutex;
- trx_t* trx = NULL;
- ulint sec;
- ulint ms;
- ib_uint64_t start_time;
- ib_uint64_t finish_time;
+ mutex_t* block_mutex = NULL;
+ 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);
ut_ad(mtr);
ut_ad(mtr->state == MTR_ACTIVE);
ut_ad((rw_latch == RW_S_LATCH)
|| (rw_latch == RW_X_LATCH)
|| (rw_latch == RW_NO_LATCH));
- ut_ad((mode != BUF_GET_NO_LATCH) || (rw_latch == RW_NO_LATCH));
- ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL)
- || (mode == BUF_GET_NO_LATCH));
+#ifdef UNIV_DEBUG
+ switch (mode) {
+ case BUF_GET_NO_LATCH:
+ ut_ad(rw_latch == RW_NO_LATCH);
+ break;
+ case BUF_GET:
+ case BUF_GET_IF_IN_POOL:
+ case BUF_PEEK_IF_IN_POOL:
+ case BUF_GET_IF_IN_POOL_OR_WATCH:
+ case BUF_GET_POSSIBLY_FREED:
+ break;
+ default:
+ ut_error;
+ }
+#endif /* UNIV_DEBUG */
ut_ad(zip_size == fil_space_get_zip_size(space));
ut_ad(ut_is_2pow(zip_size));
#ifndef UNIV_LOG_DEBUG
- ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset, NULL));
+ ut_ad(!ibuf_inside(mtr)
+ || ibuf_page_low(space, zip_size, offset,
+ FALSE, file, line, NULL));
#endif
if (innobase_get_slow_log()) {
trx = innobase_get_trx();
}
buf_pool->stat.n_page_gets++;
+ fold = buf_page_address_fold(space, offset);
loop:
block = guess;
- //buf_pool_mutex_enter();
+ //buf_pool_mutex_enter(buf_pool);
if (block) {
block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
@@ -2694,7 +3019,7 @@ loop:
if (!block_mutex) {
block = guess = NULL;
- } else if (!buf_block_is_uncompressed(block)
+ } else if (!buf_block_is_uncompressed(buf_pool, block)
|| offset != block->page.offset
|| space != block->page.space
|| buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE) {
@@ -2709,22 +3034,42 @@ loop:
}
if (block == NULL) {
- rw_lock_s_lock(&page_hash_latch);
- block = (buf_block_t*) buf_page_hash_get(space, offset);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
+ block = (buf_block_t*) buf_page_hash_get_low(
+ buf_pool, space, offset, fold);
if (block) {
block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
ut_a(block_mutex);
}
- rw_lock_s_unlock(&page_hash_latch);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
}
loop2:
+ if (block && buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
+ mutex_exit(block_mutex);
+ block = NULL;
+ }
+
if (block == NULL) {
/* Page not in buf_pool: needs to be read from file */
- //buf_pool_mutex_exit();
+ if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
+ block = (buf_block_t*) buf_pool_watch_set(
+ space, offset, fold);
+
+ if (UNIV_LIKELY_NULL(block)) {
+ block_mutex = buf_page_get_mutex((buf_page_t*)block);
+ ut_a(block_mutex);
+ ut_ad(mutex_own(block_mutex));
+ goto got_block;
+ }
+ }
- if (mode == BUF_GET_IF_IN_POOL) {
+ //buf_pool_mutex_exit(buf_pool);
+
+ if (mode == BUF_GET_IF_IN_POOL
+ || mode == BUF_PEEK_IF_IN_POOL
+ || mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
return(NULL);
}
@@ -2759,32 +3104,36 @@ loop2:
goto loop;
}
+got_block:
ut_ad(page_zip_get_size(&block->page.zip) == zip_size);
must_read = buf_block_get_io_fix(block) == BUF_IO_READ;
- if (must_read && mode == BUF_GET_IF_IN_POOL) {
- /* The page is only being read to buffer */
- //buf_pool_mutex_exit();
+ if (must_read && (mode == BUF_GET_IF_IN_POOL
+ || mode == BUF_PEEK_IF_IN_POOL)) {
+
+ /* The page is being read to buffer pool,
+ but we cannot wait around for the read to
+ complete. */
+ //buf_pool_mutex_exit(buf_pool);
mutex_exit(block_mutex);
return(NULL);
}
- if (srv_pass_corrupt_table) {
+ if (srv_pass_corrupt_table <= 1) {
if (block->page.is_corrupt) {
mutex_exit(block_mutex);
return(NULL);
}
}
- ut_a(!(block->page.is_corrupt));
switch (buf_block_get_state(block)) {
buf_page_t* bpage;
ibool success;
case BUF_BLOCK_FILE_PAGE:
- if (block_mutex == &buf_pool_zip_mutex) {
+ if (block_mutex == &buf_pool->zip_mutex) {
/* it is wrong mutex... */
mutex_exit(block_mutex);
goto loop;
@@ -2793,22 +3142,21 @@ loop2:
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
- ut_ad(block_mutex == &buf_pool_zip_mutex);
+ ut_ad(block_mutex == &buf_pool->zip_mutex);
bpage = &block->page;
/* Protect bpage->buf_fix_count. */
- /* Already proteced here. */
- //mutex_enter(&buf_pool_zip_mutex);
+ //mutex_enter(&buf_pool->zip_mutex);
if (bpage->buf_fix_count
|| buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
/* This condition often occurs when the buffer
is not buffer-fixed, but I/O-fixed by
buf_page_init_for_read(). */
- //mutex_exit(&buf_pool_zip_mutex);
+ //mutex_exit(&buf_pool->zip_mutex);
wait_until_unfixed:
/* The block is buffer-fixed or I/O-fixed.
Try again later. */
- //buf_pool_mutex_exit();
+ //buf_pool_mutex_exit(buf_pool);
mutex_exit(block_mutex);
os_thread_sleep(WAIT_FOR_READ);
@@ -2816,26 +3164,28 @@ wait_until_unfixed:
}
/* Allocate an uncompressed page. */
- //buf_pool_mutex_exit();
- //mutex_exit(&buf_pool_zip_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ //mutex_exit(&buf_pool->zip_mutex);
mutex_exit(block_mutex);
- block = buf_LRU_get_free_block(0);
+ block = buf_LRU_get_free_block(buf_pool);
ut_a(block);
block_mutex = &block->mutex;
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
- rw_lock_x_lock(&page_hash_latch);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
mutex_enter(block_mutex);
{
- buf_page_t* hash_bpage
- = buf_page_hash_get(space, offset);
+ buf_page_t* hash_bpage;
+
+ hash_bpage = buf_page_hash_get_low(
+ buf_pool, space, offset, fold);
if (UNIV_UNLIKELY(bpage != hash_bpage)) {
/* The buf_pool->page_hash was modified
- while buf_pool_mutex was released.
+ while buf_pool->mutex was released.
Free the block that was allocated. */
buf_LRU_block_free_non_file_page(block, TRUE);
@@ -2846,40 +3196,38 @@ wait_until_unfixed:
block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
ut_a(block_mutex);
}
- rw_lock_x_unlock(&page_hash_latch);
- mutex_exit(&LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
goto loop2;
}
}
- mutex_enter(&buf_pool_zip_mutex);
+ mutex_enter(&buf_pool->zip_mutex);
if (UNIV_UNLIKELY
(bpage->buf_fix_count
|| buf_page_get_io_fix(bpage) != BUF_IO_NONE)) {
- mutex_exit(&buf_pool_zip_mutex);
+ mutex_exit(&buf_pool->zip_mutex);
/* The block was buffer-fixed or I/O-fixed
- while buf_pool_mutex was not held by this thread.
+ while buf_pool->mutex was not held by this thread.
Free the block that was allocated and try again.
This should be extremely unlikely. */
buf_LRU_block_free_non_file_page(block, TRUE);
//mutex_exit(&block->mutex);
- rw_lock_x_unlock(&page_hash_latch);
- mutex_exit(&LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
goto wait_until_unfixed;
}
/* Move the compressed page from bpage to block,
and uncompress it. */
- mutex_enter(&flush_list_mutex);
-
buf_relocate(bpage, &block->page);
- rw_lock_x_unlock(&page_hash_latch);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
buf_block_init_low(block);
block->lock_hash_val = lock_rec_hash(space, offset);
@@ -2898,8 +3246,6 @@ wait_until_unfixed:
&block->page);
}
- mutex_exit(&flush_list_mutex);
-
/* Buffer-fix, I/O-fix, and X-latch the block
for the duration of the decompression.
Also add the block to the unzip_LRU list. */
@@ -2908,7 +3254,7 @@ wait_until_unfixed:
/* Insert at the front of unzip_LRU list */
buf_unzip_LRU_add_block(block, FALSE);
- mutex_exit(&LRU_list_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
block->page.buf_fix_count = 1;
buf_block_set_io_fix(block, BUF_IO_READ);
@@ -2917,18 +3263,19 @@ wait_until_unfixed:
UNIV_MEM_INVALID(bpage, sizeof *bpage);
mutex_exit(block_mutex);
- mutex_exit(&buf_pool_zip_mutex);
+ mutex_exit(&buf_pool->zip_mutex);
- mutex_enter(&buf_pool_mutex);
+ buf_pool_mutex_enter(buf_pool);
buf_pool->n_pend_unzip++;
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
- buf_buddy_free(bpage, sizeof *bpage, FALSE);
+ bpage->state = BUF_BLOCK_ZIP_FREE;
+ buf_buddy_free(buf_pool, bpage, sizeof *bpage, FALSE);
- //buf_pool_mutex_exit();
+ //buf_pool_mutex_exit(buf_pool);
/* Decompress the page and apply buffered operations
- while not holding buf_pool_mutex or block->mutex. */
+ while not holding buf_pool->mutex or block->mutex. */
success = buf_zip_decompress(block, srv_use_checksums);
ut_a(success);
@@ -2938,16 +3285,17 @@ wait_until_unfixed:
}
/* Unfix and unlatch the block. */
- //buf_pool_mutex_enter();
+ //buf_pool_mutex_enter(buf_pool);
block_mutex = &block->mutex;
mutex_enter(block_mutex);
block->page.buf_fix_count--;
buf_block_set_io_fix(block, BUF_IO_NONE);
- mutex_enter(&buf_pool_mutex);
+ buf_pool_mutex_enter(buf_pool);
buf_pool->n_pend_unzip--;
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
rw_lock_x_unlock(&block->lock);
+
break;
case BUF_BLOCK_ZIP_FREE:
@@ -2968,23 +3316,66 @@ wait_until_unfixed:
bytes. */
UNIV_MEM_ASSERT_RW(&block->page, sizeof block->page);
#endif
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+ if ((mode == BUF_GET_IF_IN_POOL || mode == BUF_GET_IF_IN_POOL_OR_WATCH)
+ && ibuf_debug) {
+ /* Try to evict the block from the buffer pool, to use the
+ insert buffer (change buffer) as much as possible. */
- buf_block_buf_fix_inc(block, file, line);
+ if (buf_LRU_free_block(&block->page, TRUE, FALSE) == BUF_LRU_FREED) {
+ mutex_exit(block_mutex);
+ if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
+ /* Set the watch, as it would have
+ been set if the page were not in the
+ buffer pool in the first place. */
+ block = (buf_block_t*) buf_pool_watch_set(
+ space, offset, fold);
+
+ if (UNIV_LIKELY_NULL(block)) {
+ block_mutex = buf_page_get_mutex((buf_page_t*)block);
+ ut_a(block_mutex);
+ ut_ad(mutex_own(block_mutex));
+ /* The page entered the buffer
+ pool for some reason. Try to
+ evict it again. */
+ goto got_block;
+ }
+ }
+ //buf_pool_mutex_exit(buf_pool);
+ fprintf(stderr,
+ "innodb_change_buffering_debug evict %u %u\n",
+ (unsigned) space, (unsigned) offset);
+ return(NULL);
+ } else if (buf_flush_page_try(buf_pool, block)) {
+ fprintf(stderr,
+ "innodb_change_buffering_debug flush %u %u\n",
+ (unsigned) space, (unsigned) offset);
+ guess = block;
+ goto loop;
+ }
+
+ /* Failed to evict the page; change it directly */
+ }
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+
+ buf_block_buf_fix_inc(block, file, line);
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
+ ut_a(mode == BUF_GET_POSSIBLY_FREED
+ || !block->page.file_page_was_freed);
+#endif
//mutex_exit(&block->mutex);
/* Check if this is the first access to the page */
access_time = buf_page_is_accessed(&block->page);
- //buf_pool_mutex_exit();
+ //buf_pool_mutex_exit(buf_pool);
mutex_exit(block_mutex);
- buf_page_set_accessed_make_young(&block->page, access_time);
-
-#ifdef UNIV_DEBUG_FILE_ACCESSES
- ut_a(!block->page.file_page_was_freed);
-#endif
+ if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL)) {
+ buf_page_set_accessed_make_young(&block->page, access_time);
+ }
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 5771 || buf_validate());
@@ -3046,11 +3437,12 @@ wait_until_unfixed:
mtr_memo_push(mtr, block, fix_type);
- if (!access_time) {
+ if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL) && !access_time) {
/* In the case of a first access, try to apply linear
read-ahead */
- buf_read_ahead_linear(space, zip_size, offset, trx);
+ buf_read_ahead_linear(space, zip_size, offset,
+ ibuf_inside(mtr), trx);
}
#ifdef UNIV_IBUF_COUNT_DEBUG
@@ -3080,6 +3472,7 @@ buf_page_optimistic_get(
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mini-transaction */
{
+ buf_pool_t* buf_pool;
unsigned access_time;
ibool success;
ulint fix_type;
@@ -3111,7 +3504,7 @@ buf_page_optimistic_get(
access_time = buf_page_is_accessed(&block->page);
buf_page_set_accessed_make_young(&block->page, access_time);
- ut_ad(!ibuf_inside()
+ ut_ad(!ibuf_inside(mtr)
|| ibuf_page(buf_block_get_space(block),
buf_block_get_zip_size(block),
buf_block_get_page_no(block), NULL));
@@ -3158,7 +3551,7 @@ buf_page_optimistic_get(
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ut_a(block->page.file_page_was_freed == FALSE);
#endif
if (innobase_get_slow_log()) {
@@ -3171,13 +3564,15 @@ buf_page_optimistic_get(
buf_read_ahead_linear(buf_block_get_space(block),
buf_block_get_zip_size(block),
- buf_block_get_page_no(block), trx);
+ buf_block_get_page_no(block),
+ ibuf_inside(mtr), trx);
}
#ifdef UNIV_IBUF_COUNT_DEBUG
ut_a(ibuf_count_get(buf_block_get_space(block),
buf_block_get_page_no(block)) == 0);
#endif
+ buf_pool = buf_pool_from_block(block);
buf_pool->stat.n_page_gets++;
if (innobase_get_slow_log()) {
@@ -3202,6 +3597,7 @@ buf_page_get_known_nowait(
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mini-transaction */
{
+ buf_pool_t* buf_pool;
ibool success;
ulint fix_type;
trx_t* trx = NULL;
@@ -3231,12 +3627,14 @@ buf_page_get_known_nowait(
mutex_exit(&block->mutex);
+ buf_pool = buf_pool_from_block(block);
+
if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) {
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
buf_LRU_make_block_young(&block->page);
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
} else if (!buf_page_is_accessed(&block->page)) {
/* Above, we do a dirty read on purpose, to avoid
mutex contention. The field buf_page_t::access_time
@@ -3244,14 +3642,14 @@ buf_page_get_known_nowait(
field must be protected by mutex, however. */
ulint time_ms = ut_time_ms();
- //buf_pool_mutex_enter();
+ //buf_pool_mutex_enter(buf_pool);
mutex_enter(&block->mutex);
buf_page_set_accessed(&block->page, time_ms);
- //buf_pool_mutex_exit();
+ //buf_pool_mutex_exit(buf_pool);
mutex_exit(&block->mutex);
}
- ut_ad(!ibuf_inside() || (mode == BUF_KEEP_OLD));
+ ut_ad(!ibuf_inside(mtr) || mode == BUF_KEEP_OLD);
if (rw_latch == RW_S_LATCH) {
success = rw_lock_s_lock_nowait(&(block->lock),
@@ -3278,7 +3676,7 @@ buf_page_get_known_nowait(
ut_a(block->page.buf_fix_count > 0);
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ut_a(block->page.file_page_was_freed == FALSE);
#endif
@@ -3315,23 +3713,26 @@ buf_page_try_get_func(
buf_block_t* block;
ibool success;
ulint fix_type;
+ buf_pool_t* buf_pool = buf_pool_get(space_id, page_no);
ut_ad(mtr);
ut_ad(mtr->state == MTR_ACTIVE);
- //buf_pool_mutex_enter();
- rw_lock_s_lock(&page_hash_latch);
- block = buf_block_hash_get(space_id, page_no);
+ //buf_pool_mutex_enter(buf_pool);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
+ block = buf_block_hash_get(buf_pool, space_id, page_no);
- if (!block) {
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ if (!block || buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE) {
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
return(NULL);
}
+ ut_ad(!buf_pool_watch_is_sentinel(buf_pool, &block->page));
+
mutex_enter(&block->mutex);
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
@@ -3369,9 +3770,9 @@ buf_page_try_get_func(
ut_a(block->page.buf_fix_count > 0);
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ut_a(block->page.file_page_was_freed == FALSE);
-#endif /* UNIV_DEBUG_FILE_ACCESSES */
+#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
buf_pool->stat.n_page_gets++;
@@ -3401,9 +3802,9 @@ buf_page_init_low(
bpage->oldest_modification = 0;
HASH_INVALIDATE(bpage, hash);
bpage->is_corrupt = FALSE;
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
bpage->file_page_was_freed = FALSE;
-#endif /* UNIV_DEBUG_FILE_ACCESSES */
+#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
}
/********************************************************************//**
@@ -3415,13 +3816,15 @@ buf_page_init(
ulint space, /*!< in: space id */
ulint offset, /*!< in: offset of the page within space
in units of a page */
+ ulint fold, /*!< in: buf_page_address_fold(space,offset) */
buf_block_t* block) /*!< in: block to init */
{
buf_page_t* hash_page;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&page_hash_latch, RW_LOCK_EX));
+ ut_ad(rw_lock_own(&buf_pool->page_hash_latch, RW_LOCK_EX));
#endif
ut_ad(mutex_own(&(block->mutex)));
ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE);
@@ -3440,13 +3843,26 @@ buf_page_init(
buf_block_init_low(block);
- block->lock_hash_val = lock_rec_hash(space, offset);
+ block->lock_hash_val = lock_rec_hash(space, offset);
+
+ buf_page_init_low(&block->page);
/* Insert into the hash table of file pages */
- hash_page = buf_page_hash_get(space, offset);
+ hash_page = buf_page_hash_get_low(buf_pool, space, offset, fold);
- if (UNIV_LIKELY_NULL(hash_page)) {
+ if (UNIV_LIKELY(!hash_page)) {
+ } else if (buf_pool_watch_is_sentinel(buf_pool, hash_page)) {
+ /* Preserve the reference count. */
+ ulint buf_fix_count;
+
+ mutex_enter(&buf_pool->zip_mutex);
+ buf_fix_count = hash_page->buf_fix_count;
+ ut_a(buf_fix_count > 0);
+ block->page.buf_fix_count += buf_fix_count;
+ buf_pool_watch_remove(buf_pool, fold, hash_page);
+ mutex_exit(&buf_pool->zip_mutex);
+ } else {
fprintf(stderr,
"InnoDB: Error: page %lu %lu already found"
" in the hash table: %p, %p\n",
@@ -3455,8 +3871,8 @@ buf_page_init(
(const void*) hash_page, (const void*) block);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
mutex_exit(&block->mutex);
- //buf_pool_mutex_exit();
- rw_lock_x_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
buf_print();
buf_LRU_print();
buf_validate();
@@ -3465,13 +3881,11 @@ buf_page_init(
ut_error;
}
- buf_page_init_low(&block->page);
-
ut_ad(!block->page.in_zip_hash);
ut_ad(!block->page.in_page_hash);
ut_d(block->page.in_page_hash = TRUE);
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
- buf_page_address_fold(space, offset), &block->page);
+ fold, &block->page);
}
/********************************************************************//**
@@ -3493,16 +3907,20 @@ buf_page_init_for_read(
ulint space, /*!< in: space id */
ulint zip_size,/*!< in: compressed page size, or 0 */
ibool unzip, /*!< in: TRUE=request uncompressed page */
- ib_int64_t tablespace_version,/*!< in: prevents reading from a wrong
+ ib_int64_t tablespace_version,
+ /*!< in: prevents reading from a wrong
version of the tablespace in case we have done
DISCARD + IMPORT */
ulint offset) /*!< in: page number */
{
buf_block_t* block;
- buf_page_t* bpage;
+ buf_page_t* bpage = NULL;
+ buf_page_t* watch_page;
mtr_t mtr;
+ ulint fold;
ibool lru = FALSE;
void* data;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(buf_pool);
@@ -3512,14 +3930,13 @@ buf_page_init_for_read(
/* It is a read-ahead within an ibuf routine */
ut_ad(!ibuf_bitmap_page(zip_size, offset));
- ut_ad(ibuf_inside());
- mtr_start(&mtr);
+ ibuf_mtr_start(&mtr);
if (!recv_no_ibuf_operations
&& !ibuf_page(space, zip_size, offset, &mtr)) {
- mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
return(NULL);
}
@@ -3531,27 +3948,32 @@ buf_page_init_for_read(
&& UNIV_LIKELY(!recv_recovery_is_on())) {
block = NULL;
} else {
- block = buf_LRU_get_free_block(0);
+ block = buf_LRU_get_free_block(buf_pool);
ut_ad(block);
+ ut_ad(buf_pool_from_block(block) == buf_pool);
}
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
- rw_lock_x_lock(&page_hash_latch);
+ fold = buf_page_address_fold(space, offset);
- if (buf_page_hash_get(space, offset)) {
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
+
+ watch_page = buf_page_hash_get_low(buf_pool, space, offset, fold);
+ if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) {
/* The page is already in the buffer pool. */
+ watch_page = NULL;
err_exit:
if (block) {
mutex_enter(&block->mutex);
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
buf_LRU_block_free_non_file_page(block, FALSE);
mutex_exit(&block->mutex);
}
else {
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
bpage = NULL;
@@ -3570,9 +3992,12 @@ err_exit:
if (block) {
bpage = &block->page;
mutex_enter(&block->mutex);
- buf_page_init(space, offset, block);
- rw_lock_x_unlock(&page_hash_latch);
+ ut_ad(buf_pool_from_bpage(bpage) == buf_pool);
+
+ buf_page_init(space, offset, fold, block);
+
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
/* The block must be put to the LRU list, to the old blocks */
buf_LRU_add_block(bpage, TRUE/* to old blocks */);
@@ -3592,16 +4017,16 @@ err_exit:
if (UNIV_UNLIKELY(zip_size)) {
page_zip_set_size(&block->page.zip, zip_size);
- /* buf_pool_mutex may be released and
+ /* buf_pool->mutex may be released and
reacquired by buf_buddy_alloc(). Thus, we
must release block->mutex in order not to
break the latching order in the reacquisition
- of buf_pool_mutex. We also must defer this
+ of buf_pool->mutex. We also must defer this
operation until after the block descriptor has
been added to buf_pool->LRU and
buf_pool->page_hash. */
mutex_exit(&block->mutex);
- data = buf_buddy_alloc(zip_size, &lru, FALSE);
+ data = buf_buddy_alloc(buf_pool, zip_size, &lru, FALSE);
mutex_enter(&block->mutex);
block->page.zip.data = data;
@@ -3614,7 +4039,7 @@ err_exit:
buf_unzip_LRU_add_block(block, TRUE);
}
- mutex_exit(&LRU_list_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
mutex_exit(&block->mutex);
} else {
/* Defer buf_buddy_alloc() until after the block has
@@ -3626,37 +4051,53 @@ err_exit:
control block (bpage), in order to avoid the
invocation of buf_buddy_relocate_block() on
uninitialized data. */
- data = buf_buddy_alloc(zip_size, &lru, TRUE);
- bpage = buf_buddy_alloc(sizeof *bpage, &lru, TRUE);
+ data = buf_buddy_alloc(buf_pool, zip_size, &lru, TRUE);
+ bpage = buf_buddy_alloc(buf_pool, sizeof *bpage, &lru, TRUE);
+
+ /* Initialize the buf_pool pointer. */
+ bpage->buf_pool_index = buf_pool_index(buf_pool);
/* If buf_buddy_alloc() allocated storage from the LRU list,
- it released and reacquired buf_pool_mutex. Thus, we must
+ it released and reacquired buf_pool->mutex. Thus, we must
check the page_hash again, as it may have been modified. */
- if (UNIV_UNLIKELY(lru)
- && UNIV_LIKELY_NULL(buf_page_hash_get(space, offset))) {
+ if (UNIV_UNLIKELY(lru)) {
- /* The block was added by some other thread. */
- buf_buddy_free(bpage, sizeof *bpage, TRUE);
- buf_buddy_free(data, zip_size, TRUE);
+ watch_page = buf_page_hash_get_low(
+ buf_pool, space, offset, fold);
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ if (watch_page
+ && !buf_pool_watch_is_sentinel(buf_pool,
+ watch_page)) {
- bpage = NULL;
- goto func_exit;
+ /* The block was added by some other thread. */
+ watch_page = NULL;
+ bpage->state = BUF_BLOCK_ZIP_FREE;
+ buf_buddy_free(buf_pool, bpage, sizeof *bpage, TRUE);
+ buf_buddy_free(buf_pool, data, zip_size, TRUE);
+
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+
+ bpage = NULL;
+ goto func_exit;
+ }
}
page_zip_des_init(&bpage->zip);
page_zip_set_size(&bpage->zip, zip_size);
bpage->zip.data = data;
- mutex_enter(&buf_pool_zip_mutex);
+ mutex_enter(&buf_pool->zip_mutex);
UNIV_MEM_DESC(bpage->zip.data,
page_zip_get_size(&bpage->zip), bpage);
+
buf_page_init_low(bpage);
+
bpage->state = BUF_BLOCK_ZIP_PAGE;
bpage->space = space;
bpage->offset = offset;
+ bpage->space_was_being_deleted = FALSE;
+
#ifdef UNIV_DEBUG
bpage->in_page_hash = FALSE;
@@ -3667,33 +4108,41 @@ err_exit:
bpage->in_LRU_list = FALSE;
ut_d(bpage->in_page_hash = TRUE);
- HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
- buf_page_address_fold(space, offset), bpage);
- rw_lock_x_unlock(&page_hash_latch);
+ if (UNIV_LIKELY_NULL(watch_page)) {
+ /* Preserve the reference count. */
+ ulint buf_fix_count = watch_page->buf_fix_count;
+ ut_a(buf_fix_count > 0);
+ bpage->buf_fix_count += buf_fix_count;
+ ut_ad(buf_pool_watch_is_sentinel(buf_pool, watch_page));
+ buf_pool_watch_remove(buf_pool, fold, watch_page);
+ }
+
+ HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold,
+ bpage);
+
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
/* The block must be put to the LRU list, to the old blocks */
buf_LRU_add_block(bpage, TRUE/* to old blocks */);
- mutex_enter(&flush_list_mutex);
buf_LRU_insert_zip_clean(bpage);
- mutex_exit(&flush_list_mutex);
- mutex_exit(&LRU_list_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
buf_page_set_io_fix(bpage, BUF_IO_READ);
- mutex_exit(&buf_pool_zip_mutex);
+ mutex_exit(&buf_pool->zip_mutex);
}
- mutex_enter(&buf_pool_mutex);
+ buf_pool_mutex_enter(buf_pool);
buf_pool->n_pend_reads++;
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
func_exit:
- //buf_pool_mutex_exit();
+ //buf_pool_mutex_exit(buf_pool);
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
- mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
}
ut_ad(!bpage || buf_page_in_file(bpage));
@@ -3718,33 +4167,40 @@ buf_page_create(
{
buf_frame_t* frame;
buf_block_t* block;
+ ulint fold;
buf_block_t* free_block = NULL;
ulint time_ms = ut_time_ms();
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mtr);
ut_ad(mtr->state == MTR_ACTIVE);
ut_ad(space || !zip_size);
- free_block = buf_LRU_get_free_block(0);
+ free_block = buf_LRU_get_free_block(buf_pool);
+
+ fold = buf_page_address_fold(space, offset);
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
- rw_lock_x_lock(&page_hash_latch);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
- block = (buf_block_t*) buf_page_hash_get(space, offset);
+ block = (buf_block_t*) buf_page_hash_get_low(
+ buf_pool, space, offset, fold);
- if (block && buf_page_in_file(&block->page)) {
+ if (block
+ && buf_page_in_file(&block->page)
+ && !buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
#ifdef UNIV_IBUF_COUNT_DEBUG
ut_a(ibuf_count_get(space, offset) == 0);
#endif
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
block->page.file_page_was_freed = FALSE;
-#endif /* UNIV_DEBUG_FILE_ACCESSES */
+#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
/* Page can be found in buf_pool */
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
buf_block_free(free_block);
@@ -3765,8 +4221,8 @@ buf_page_create(
mutex_enter(&block->mutex);
- buf_page_init(space, offset, block);
- rw_lock_x_unlock(&page_hash_latch);
+ buf_page_init(space, offset, fold, block);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
/* The block must be put to the LRU list */
buf_LRU_add_block(&block->page, FALSE);
@@ -3779,7 +4235,7 @@ buf_page_create(
ibool lru;
/* Prevent race conditions during buf_buddy_alloc(),
- which may release and reacquire buf_pool_mutex,
+ which may release and reacquire buf_pool->mutex,
by IO-fixing and X-latching the block. */
buf_page_set_io_fix(&block->page, BUF_IO_READ);
@@ -3787,13 +4243,13 @@ buf_page_create(
page_zip_set_size(&block->page.zip, zip_size);
mutex_exit(&block->mutex);
- /* buf_pool_mutex may be released and reacquired by
+ /* buf_pool->mutex may be released and reacquired by
buf_buddy_alloc(). Thus, we must release block->mutex
in order not to break the latching order in
- the reacquisition of buf_pool_mutex. We also must
+ the reacquisition of buf_pool->mutex. We also must
defer this operation until after the block descriptor
has been added to buf_pool->LRU and buf_pool->page_hash. */
- data = buf_buddy_alloc(zip_size, &lru, FALSE);
+ data = buf_buddy_alloc(buf_pool, zip_size, &lru, FALSE);
mutex_enter(&block->mutex);
block->page.zip.data = data;
@@ -3811,8 +4267,8 @@ buf_page_create(
buf_page_set_accessed(&block->page, time_ms);
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
@@ -3824,7 +4280,7 @@ buf_page_create(
ibuf_merge_or_delete_for_page(NULL, space, offset, zip_size, TRUE);
/* Flush pages from the end of the LRU list if necessary */
- buf_flush_free_margin(FALSE);
+ buf_flush_free_margin(buf_pool, FALSE);
frame = block->frame;
@@ -3857,13 +4313,13 @@ UNIV_INTERN
void
buf_page_io_complete(
/*=================*/
- buf_page_t* bpage, /*!< in: pointer to the block in question */
- trx_t* trx)
+ buf_page_t* bpage) /*!< in: pointer to the block in question */
{
enum buf_io_fix io_type;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
const ibool uncompressed = (buf_page_get_state(bpage)
== BUF_BLOCK_FILE_PAGE);
- enum buf_flush flush_type;
+ ibool have_LRU_mutex = FALSE;
mutex_t* block_mutex;
ut_a(buf_page_in_file(bpage));
@@ -3975,19 +4431,23 @@ corrupt:
"InnoDB: TABLE to scan your"
" table for corruption.\n"
"InnoDB: See also "
- REFMAN "forcing-recovery.html\n"
+ REFMAN "forcing-innodb-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
if (srv_pass_corrupt_table && !trx_sys_sys_space(bpage->space)
&& bpage->space < SRV_LOG_SPACE_FIRST_ID) {
+ trx_t* trx;
+
fprintf(stderr,
"InnoDB: space %u will be treated as corrupt.\n",
bpage->space);
fil_space_set_corrupt(bpage->space);
- if (trx && trx->dict_operation_lock_mode == 0) {
- dict_table_set_corrupt_by_space(bpage->space, TRUE);
- } else {
+
+ trx = innobase_get_trx();
+ if (trx && trx->dict_operation_lock_mode == RW_X_LATCH) {
dict_table_set_corrupt_by_space(bpage->space, FALSE);
+ } else {
+ dict_table_set_corrupt_by_space(bpage->space, TRUE);
}
bpage->is_corrupt = TRUE;
} else
@@ -4017,17 +4477,26 @@ corrupt:
}
}
- //buf_pool_mutex_enter();
- if (io_type == BUF_IO_WRITE) {
- flush_type = buf_page_get_flush_type(bpage);
+ if (io_type == BUF_IO_WRITE
+ && (buf_page_get_state(bpage) == BUF_BLOCK_ZIP_DIRTY
+ || buf_page_get_flush_type(bpage) == BUF_FLUSH_LRU)) {
/* to keep consistency at buf_LRU_insert_zip_clean() */
- //if (flush_type == BUF_FLUSH_LRU) { /* optimistic! */
- mutex_enter(&LRU_list_mutex);
- //}
+ have_LRU_mutex = TRUE; /* optimistic */
}
+retry_mutex:
+ if (have_LRU_mutex)
+ mutex_enter(&buf_pool->LRU_list_mutex);
block_mutex = buf_page_get_mutex_enter(bpage);
ut_a(block_mutex);
- mutex_enter(&buf_pool_mutex);
+ if (io_type == BUF_IO_WRITE
+ && (buf_page_get_state(bpage) == BUF_BLOCK_ZIP_DIRTY
+ || buf_page_get_flush_type(bpage) == BUF_FLUSH_LRU)
+ && !have_LRU_mutex) {
+ mutex_exit(block_mutex);
+ have_LRU_mutex = TRUE;
+ goto retry_mutex;
+ }
+ buf_pool_mutex_enter(buf_pool);
#ifdef UNIV_IBUF_COUNT_DEBUG
if (io_type == BUF_IO_WRITE || uncompressed) {
@@ -4050,6 +4519,7 @@ corrupt:
the x-latch to this OS thread: do not let this confuse you in
debugging! */
+ ut_a(!have_LRU_mutex);
ut_ad(buf_pool->n_pend_reads > 0);
buf_pool->n_pend_reads--;
buf_pool->stat.n_pages_read++;
@@ -4067,10 +4537,8 @@ corrupt:
buf_flush_write_complete(bpage);
- /* to keep consistency at buf_LRU_insert_zip_clean() */
- //if (flush_type == BUF_FLUSH_LRU) { /* optimistic! */
- mutex_exit(&LRU_list_mutex);
- //}
+ if (have_LRU_mutex)
+ mutex_exit(&buf_pool->LRU_list_mutex);
if (uncompressed) {
rw_lock_s_unlock_gen(&((buf_block_t*) bpage)->lock,
@@ -4094,24 +4562,92 @@ corrupt:
}
#endif /* UNIV_DEBUG */
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
mutex_exit(block_mutex);
- //buf_pool_mutex_exit();
}
-/*********************************************************************//**
-Invalidates the file pages in the buffer pool when an archive recovery is
-completed. All the file pages buffered must be in a replaceable state when
-this function is called: not latched and not modified. */
+/********************************************************************//**
+*/
UNIV_INTERN
+buf_block_t*
+buf_page_from_array(
+/*================*/
+ buf_pool_t* buf_pool,
+ ulint n_block)
+{
+ ulint n_chunks, offset;
+ buf_chunk_t* chunk;
+
+ ut_a(n_block < buf_pool->curr_size);
+
+ chunk = buf_pool->chunks;
+ offset = n_block;
+
+ for (n_chunks = buf_pool->n_chunks; n_chunks--; chunk++) {
+ if (offset < chunk->size) {
+ return(&chunk->blocks[offset]);
+ }
+
+ offset -= chunk->size;
+ }
+
+ ut_error;
+
+ return(NULL);
+}
+
+/*********************************************************************//**
+Asserts that all file pages in the buffer are in a replaceable state.
+@return TRUE */
+static
+ibool
+buf_all_freed_instance(
+/*===================*/
+ buf_pool_t* buf_pool) /*!< in: buffer pool instancce */
+{
+ ulint i;
+ buf_chunk_t* chunk;
+
+ ut_ad(buf_pool);
+
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
+
+ chunk = buf_pool->chunks;
+
+ for (i = buf_pool->n_chunks; i--; chunk++) {
+
+ const buf_block_t* block = buf_chunk_not_freed(chunk);
+
+ if (UNIV_LIKELY_NULL(block)) {
+ fprintf(stderr,
+ "Page %lu %lu still fixed or dirty\n",
+ (ulong) block->page.space,
+ (ulong) block->page.offset);
+ ut_error;
+ }
+ }
+
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+
+ return(TRUE);
+}
+
+/*********************************************************************//**
+Invalidates file pages in one buffer pool instance */
+static
void
-buf_pool_invalidate(void)
-/*=====================*/
+buf_pool_invalidate_instance(
+/*=========================*/
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
{
ibool freed;
enum buf_flush i;
- buf_pool_mutex_enter();
+ buf_pool_mutex_enter(buf_pool);
for (i = BUF_FLUSH_LRU; i < BUF_FLUSH_N_TYPES; i++) {
@@ -4127,24 +4663,24 @@ buf_pool_invalidate(void)
pool invalidation to proceed we must ensure there is NO
write activity happening. */
if (buf_pool->n_flush[i] > 0) {
- buf_pool_mutex_exit();
- buf_flush_wait_batch_end(i);
- buf_pool_mutex_enter();
+ buf_pool_mutex_exit(buf_pool);
+ buf_flush_wait_batch_end(buf_pool, i);
+ buf_pool_mutex_enter(buf_pool);
}
}
- buf_pool_mutex_exit();
+ buf_pool_mutex_exit(buf_pool);
- ut_ad(buf_all_freed());
+ ut_ad(buf_all_freed_instance(buf_pool));
freed = TRUE;
while (freed) {
- freed = buf_LRU_search_and_free_block(100);
+ freed = buf_LRU_search_and_free_block(buf_pool, 100);
}
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == 0);
ut_ad(UT_LIST_GET_LEN(buf_pool->unzip_LRU) == 0);
@@ -4155,20 +4691,37 @@ buf_pool_invalidate(void)
buf_pool->LRU_flush_ended = 0;
memset(&buf_pool->stat, 0x00, sizeof(buf_pool->stat));
- buf_refresh_io_stats();
+ buf_refresh_io_stats(buf_pool);
+
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+}
+
+/*********************************************************************//**
+Invalidates the file pages in the buffer pool when an archive recovery is
+completed. All the file pages buffered must be in a replaceable state when
+this function is called: not latched and not modified. */
+UNIV_INTERN
+void
+buf_pool_invalidate(void)
+/*=====================*/
+{
+ ulint i;
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_invalidate_instance(buf_pool_from_array(i));
+ }
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/*********************************************************************//**
-Validates the buffer buf_pool data structure.
+Validates data in one buffer pool instance
@return TRUE */
-UNIV_INTERN
+static
ibool
-buf_validate(void)
-/*==============*/
+buf_pool_validate_instance(
+/*=======================*/
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
{
buf_page_t* b;
buf_chunk_t* chunk;
@@ -4183,9 +4736,9 @@ buf_validate(void)
ut_ad(buf_pool);
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
- rw_lock_x_lock(&page_hash_latch);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
/* for keep the new latch order, it cannot validate correctly... */
chunk = buf_pool->chunks;
@@ -4211,7 +4764,8 @@ buf_validate(void)
break;
case BUF_BLOCK_FILE_PAGE:
- ut_a(buf_page_hash_get(buf_block_get_space(
+ ut_a(buf_page_hash_get(buf_pool,
+ buf_block_get_space(
block),
buf_block_get_page_no(
block))
@@ -4258,11 +4812,6 @@ buf_validate(void)
}
n_lru++;
-
- if (block->page.oldest_modification > 0) {
- n_flush++;
- }
-
break;
case BUF_BLOCK_NOT_USED:
@@ -4280,7 +4829,7 @@ buf_validate(void)
}
}
- mutex_enter(&buf_pool_zip_mutex);
+ mutex_enter(&buf_pool->zip_mutex);
/* Check clean compressed-only blocks. */
@@ -4301,31 +4850,34 @@ buf_validate(void)
ut_error;
break;
}
+
+ /* It is OK to read oldest_modification here because
+ we have acquired buf_pool->zip_mutex above which acts
+ as the 'block->mutex' for these bpages. */
ut_a(!b->oldest_modification);
- ut_a(buf_page_hash_get(b->space, b->offset) == b);
+ ut_a(buf_page_hash_get(buf_pool, b->space, b->offset) == b);
n_lru++;
n_zip++;
}
- /* Check dirty compressed-only blocks. */
+ /* Check dirty blocks. */
- mutex_enter(&flush_list_mutex);
+ buf_flush_list_mutex_enter(buf_pool);
for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
b = UT_LIST_GET_NEXT(flush_list, b)) {
ut_ad(b->in_flush_list);
+ ut_a(b->oldest_modification);
+ n_flush++;
switch (buf_page_get_state(b)) {
case BUF_BLOCK_ZIP_DIRTY:
- ut_a(b->oldest_modification);
n_lru++;
- n_flush++;
n_zip++;
switch (buf_page_get_io_fix(b)) {
case BUF_IO_NONE:
case BUF_IO_READ:
break;
-
case BUF_IO_WRITE:
switch (buf_page_get_flush_type(b)) {
case BUF_FLUSH_LRU:
@@ -4355,11 +4907,14 @@ buf_validate(void)
ut_error;
break;
}
- ut_a(buf_page_hash_get(b->space, b->offset) == b);
+ ut_a(buf_page_hash_get(buf_pool, b->space, b->offset) == b);
}
- mutex_exit(&flush_list_mutex);
- mutex_exit(&buf_pool_zip_mutex);
+ ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush);
+
+ buf_flush_list_mutex_exit(buf_pool);
+
+ mutex_exit(&buf_pool->zip_mutex);
if (n_lru + n_free > buf_pool->curr_size + n_zip) {
fprintf(stderr, "n LRU %lu, n free %lu, pool %lu zip %lu\n",
@@ -4369,7 +4924,7 @@ buf_validate(void)
}
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
- /* because of latching order with block->mutex, we cannot get free_list_mutex before that */
+ /* because of latching order with block->mutex, we cannot get needed mutexes before that */
/*
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
fprintf(stderr, "Free list len %lu, free blocks %lu\n",
@@ -4377,41 +4932,59 @@ buf_validate(void)
(ulong) n_free);
ut_error;
}
-*/
- /* because of latching order with block->mutex, we cannot get flush_list_mutex before that */
-/*
- ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE] == n_single_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_LIST] == n_list_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_LRU] == n_lru_flush);
*/
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
ut_a(buf_LRU_validate());
- ut_a(buf_flush_validate());
+ ut_a(buf_flush_validate(buf_pool));
return(TRUE);
}
+
+/*********************************************************************//**
+Validates the buffer buf_pool data structure.
+@return TRUE */
+UNIV_INTERN
+ibool
+buf_validate(void)
+/*==============*/
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ buf_pool_validate_instance(buf_pool);
+ }
+ return(TRUE);
+}
+
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
#if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/*********************************************************************//**
-Prints info of the buffer buf_pool data structure. */
-UNIV_INTERN
+Prints info of the buffer buf_pool data structure for one instance. */
+static
void
-buf_print(void)
-/*===========*/
+buf_print_instance(
+/*===============*/
+ buf_pool_t* buf_pool)
{
- dulint* index_ids;
+ index_id_t* index_ids;
ulint* counts;
ulint size;
ulint i;
ulint j;
- dulint id;
+ index_id_t id;
ulint n_found;
buf_chunk_t* chunk;
dict_index_t* index;
@@ -4420,13 +4993,13 @@ buf_print(void)
size = buf_pool->curr_size;
- index_ids = mem_alloc(sizeof(dulint) * size);
+ index_ids = mem_alloc(size * sizeof *index_ids);
counts = mem_alloc(sizeof(ulint) * size);
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
- mutex_enter(&free_list_mutex);
- mutex_enter(&flush_list_mutex);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ mutex_enter(&buf_pool->free_list_mutex);
+ buf_flush_list_mutex_enter(buf_pool);
fprintf(stderr,
"buf_pool size %lu\n"
@@ -4453,6 +5026,8 @@ buf_print(void)
(ulong) buf_pool->stat.n_pages_created,
(ulong) buf_pool->stat.n_pages_written);
+ buf_flush_list_mutex_exit(buf_pool);
+
/* Count the number of blocks belonging to each index in the buffer */
n_found = 0;
@@ -4475,8 +5050,7 @@ buf_print(void)
while (j < n_found) {
- if (ut_dulint_cmp(index_ids[j],
- id) == 0) {
+ if (index_ids[j] == id) {
counts[j]++;
break;
@@ -4493,17 +5067,16 @@ buf_print(void)
}
}
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- mutex_exit(&free_list_mutex);
- mutex_exit(&flush_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ mutex_exit(&buf_pool->free_list_mutex);
for (i = 0; i < n_found; i++) {
index = dict_index_get_if_in_cache(index_ids[i]);
fprintf(stderr,
- "Block count for index %lu in buffer is about %lu",
- (ulong) ut_dulint_get_low(index_ids[i]),
+ "Block count for index %llu in buffer is about %lu",
+ (ullint) index_ids[i],
(ulong) counts[i]);
if (index) {
@@ -4517,7 +5090,24 @@ buf_print(void)
mem_free(index_ids);
mem_free(counts);
- ut_a(buf_validate());
+ ut_a(buf_pool_validate_instance(buf_pool));
+}
+
+/*********************************************************************//**
+Prints info of the buffer buf_pool data structure. */
+UNIV_INTERN
+void
+buf_print(void)
+/*===========*/
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ buf_print_instance(buf_pool);
+ }
}
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
@@ -4527,15 +5117,16 @@ Returns the number of latched pages in the buffer pool.
@return number of latched pages */
UNIV_INTERN
ulint
-buf_get_latched_pages_number(void)
-/*==============================*/
+buf_get_latched_pages_number_instance(
+/*==================================*/
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
{
- buf_chunk_t* chunk;
buf_page_t* b;
ulint i;
+ buf_chunk_t* chunk;
ulint fixed_pages_number = 0;
- //buf_pool_mutex_enter();
+ //buf_pool_mutex_enter(buf_pool);
chunk = buf_pool->chunks;
@@ -4564,7 +5155,7 @@ buf_get_latched_pages_number(void)
}
}
- mutex_enter(&buf_pool_zip_mutex);
+ mutex_enter(&buf_pool->zip_mutex);
/* Traverse the lists of clean and dirty compressed-only blocks. */
@@ -4579,7 +5170,7 @@ buf_get_latched_pages_number(void)
}
}
- mutex_enter(&flush_list_mutex);
+ buf_flush_list_mutex_enter(buf_pool);
for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
b = UT_LIST_GET_NEXT(flush_list, b)) {
ut_ad(b->in_flush_list);
@@ -4604,13 +5195,37 @@ buf_get_latched_pages_number(void)
break;
}
}
- mutex_exit(&flush_list_mutex);
- mutex_exit(&buf_pool_zip_mutex);
- //buf_pool_mutex_exit();
+ buf_flush_list_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->zip_mutex);
+ //buf_pool_mutex_exit(buf_pool);
return(fixed_pages_number);
}
+
+/*********************************************************************//**
+Returns the number of latched pages in all the buffer pools.
+@return number of latched pages */
+UNIV_INTERN
+ulint
+buf_get_latched_pages_number(void)
+/*==============================*/
+{
+ ulint i;
+ ulint total_latched_pages = 0;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ total_latched_pages += buf_get_latched_pages_number_instance(
+ buf_pool);
+ }
+
+ return(total_latched_pages);
+}
+
#endif /* UNIV_DEBUG */
/*********************************************************************//**
@@ -4621,10 +5236,22 @@ ulint
buf_get_n_pending_ios(void)
/*=======================*/
{
- return(buf_pool->n_pend_reads
- + buf_pool->n_flush[BUF_FLUSH_LRU]
- + buf_pool->n_flush[BUF_FLUSH_LIST]
- + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
+ ulint i;
+ ulint pend_ios = 0;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ pend_ios +=
+ buf_pool->n_pend_reads
+ + buf_pool->n_flush[BUF_FLUSH_LRU]
+ + buf_pool->n_flush[BUF_FLUSH_LIST]
+ + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE];
+ }
+
+ return(pend_ios);
}
/*********************************************************************//**
@@ -4636,40 +5263,224 @@ ulint
buf_get_modified_ratio_pct(void)
/*============================*/
{
- ulint ratio;
+ ulint ratio;
+ ulint lru_len = 0;
+ ulint free_len = 0;
+ ulint flush_list_len = 0;
- //buf_pool_mutex_enter(); /* optimistic */
+ buf_get_total_list_len(&lru_len, &free_len, &flush_list_len);
- ratio = (100 * UT_LIST_GET_LEN(buf_pool->flush_list))
- / (1 + UT_LIST_GET_LEN(buf_pool->LRU)
- + UT_LIST_GET_LEN(buf_pool->free));
+ ratio = (100 * flush_list_len) / (1 + lru_len + free_len);
/* 1 + is there to avoid division by zero */
- //buf_pool_mutex_exit(); /* optimistic */
-
return(ratio);
}
+/*******************************************************************//**
+Aggregates a pool stats information with the total buffer pool stats */
+static
+void
+buf_stats_aggregate_pool_info(
+/*==========================*/
+ buf_pool_info_t* total_info, /*!< in/out: the buffer pool
+ info to store aggregated
+ result */
+ const buf_pool_info_t* pool_info) /*!< in: individual buffer pool
+ stats info */
+{
+ ut_a(total_info && pool_info);
+
+ /* Nothing to copy if total_info is the same as pool_info */
+ if (total_info == pool_info) {
+ return;
+ }
+
+ total_info->pool_size += pool_info->pool_size;
+ total_info->pool_size_bytes += pool_info->pool_size_bytes;
+ total_info->lru_len += pool_info->lru_len;
+ total_info->old_lru_len += pool_info->old_lru_len;
+ total_info->free_list_len += pool_info->free_list_len;
+ total_info->flush_list_len += pool_info->flush_list_len;
+ total_info->n_pend_unzip += pool_info->n_pend_unzip;
+ total_info->n_pend_reads += pool_info->n_pend_reads;
+ total_info->n_pending_flush_lru += pool_info->n_pending_flush_lru;
+ total_info->n_pending_flush_list += pool_info->n_pending_flush_list;
+ total_info->n_pending_flush_single_page +=
+ pool_info->n_pending_flush_single_page;
+ total_info->n_pages_made_young += pool_info->n_pages_made_young;
+ total_info->n_pages_not_made_young += pool_info->n_pages_not_made_young;
+ total_info->n_pages_read += pool_info->n_pages_read;
+ total_info->n_pages_created += pool_info->n_pages_created;
+ total_info->n_pages_written += pool_info->n_pages_written;
+ total_info->n_page_gets += pool_info->n_page_gets;
+ total_info->n_ra_pages_read += pool_info->n_ra_pages_read;
+ total_info->n_ra_pages_evicted += pool_info->n_ra_pages_evicted;
+ total_info->page_made_young_rate += pool_info->page_made_young_rate;
+ total_info->page_not_made_young_rate +=
+ pool_info->page_not_made_young_rate;
+ total_info->pages_read_rate += pool_info->pages_read_rate;
+ total_info->pages_created_rate += pool_info->pages_created_rate;
+ total_info->pages_written_rate += pool_info->pages_written_rate;
+ total_info->n_page_get_delta += pool_info->n_page_get_delta;
+ total_info->page_read_delta += pool_info->page_read_delta;
+ total_info->young_making_delta += pool_info->young_making_delta;
+ total_info->not_young_making_delta += pool_info->not_young_making_delta;
+ total_info->pages_readahead_rate += pool_info->pages_readahead_rate;
+ total_info->pages_evicted_rate += pool_info->pages_evicted_rate;
+ total_info->unzip_lru_len += pool_info->unzip_lru_len;
+ total_info->io_sum += pool_info->io_sum;
+ total_info->io_cur += pool_info->io_cur;
+ total_info->unzip_sum += pool_info->unzip_sum;
+ total_info->unzip_cur += pool_info->unzip_cur;
+}
+/*******************************************************************//**
+Collect buffer pool stats information for a buffer pool. Also
+record aggregated stats if there are more than one buffer pool
+in the server */
+static
+void
+buf_stats_get_pool_info(
+/*====================*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool */
+ ulint pool_id, /*!< in: buffer pool ID */
+ buf_pool_info_t* all_pool_info) /*!< in/out: buffer pool info
+ to fill */
+{
+ buf_pool_info_t* pool_info;
+ time_t current_time;
+ double time_elapsed;
+
+ /* Find appropriate pool_info to store stats for this buffer pool */
+ pool_info = &all_pool_info[pool_id];
+
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ mutex_enter(&buf_pool->free_list_mutex);
+ buf_pool_mutex_enter(buf_pool);
+ buf_flush_list_mutex_enter(buf_pool);
+
+ pool_info->pool_unique_id = pool_id;
+
+ pool_info->pool_size = buf_pool->curr_size;
+
+ pool_info->pool_size_bytes = buf_pool->curr_pool_size;
+
+ pool_info->lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
+
+ pool_info->old_lru_len = buf_pool->LRU_old_len;
+
+ pool_info->free_list_len = UT_LIST_GET_LEN(buf_pool->free);
+
+ pool_info->flush_list_len = UT_LIST_GET_LEN(buf_pool->flush_list);
+
+ pool_info->n_pend_unzip = UT_LIST_GET_LEN(buf_pool->unzip_LRU);
+
+ pool_info->n_pend_reads = buf_pool->n_pend_reads;
+
+ pool_info->n_pending_flush_lru =
+ (buf_pool->n_flush[BUF_FLUSH_LRU]
+ + buf_pool->init_flush[BUF_FLUSH_LRU]);
+
+ pool_info->n_pending_flush_list =
+ (buf_pool->n_flush[BUF_FLUSH_LIST]
+ + buf_pool->init_flush[BUF_FLUSH_LIST]);
+
+ pool_info->n_pending_flush_single_page =
+ buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE];
+
+ buf_flush_list_mutex_exit(buf_pool);
+
+ current_time = time(NULL);
+ time_elapsed = 0.001 + difftime(current_time,
+ buf_pool->last_printout_time);
+
+ pool_info->n_pages_made_young = buf_pool->stat.n_pages_made_young;
+
+ pool_info->n_pages_not_made_young =
+ buf_pool->stat.n_pages_not_made_young;
+
+ pool_info->n_pages_read = buf_pool->stat.n_pages_read;
+
+ pool_info->n_pages_created = buf_pool->stat.n_pages_created;
+
+ pool_info->n_pages_written = buf_pool->stat.n_pages_written;
+
+ pool_info->n_page_gets = buf_pool->stat.n_page_gets;
+
+ pool_info->n_ra_pages_read = buf_pool->stat.n_ra_pages_read;
+
+ pool_info->n_ra_pages_evicted = buf_pool->stat.n_ra_pages_evicted;
+
+ pool_info->page_made_young_rate =
+ (buf_pool->stat.n_pages_made_young
+ - buf_pool->old_stat.n_pages_made_young) / time_elapsed;
+
+ pool_info->page_not_made_young_rate =
+ (buf_pool->stat.n_pages_not_made_young
+ - buf_pool->old_stat.n_pages_not_made_young) / time_elapsed;
+
+ pool_info->pages_read_rate =
+ (buf_pool->stat.n_pages_read
+ - buf_pool->old_stat.n_pages_read) / time_elapsed;
+
+ pool_info->pages_created_rate =
+ (buf_pool->stat.n_pages_created
+ - buf_pool->old_stat.n_pages_created) / time_elapsed;
+
+ pool_info->pages_written_rate =
+ (buf_pool->stat.n_pages_written
+ - buf_pool->old_stat.n_pages_written) / time_elapsed;
+
+ pool_info->n_page_get_delta = buf_pool->stat.n_page_gets
+ - buf_pool->old_stat.n_page_gets;
+
+ if (pool_info->n_page_get_delta) {
+ pool_info->page_read_delta = buf_pool->stat.n_pages_read
+ - buf_pool->old_stat.n_pages_read;
+
+ pool_info->young_making_delta =
+ buf_pool->stat.n_pages_made_young
+ - buf_pool->old_stat.n_pages_made_young;
+
+ pool_info->not_young_making_delta =
+ buf_pool->stat.n_pages_not_made_young
+ - buf_pool->old_stat.n_pages_not_made_young;
+ }
+
+ pool_info->pages_readahead_rate =
+ (buf_pool->stat.n_ra_pages_read
+ - buf_pool->old_stat.n_ra_pages_read) / time_elapsed;
+
+ pool_info->pages_evicted_rate =
+ (buf_pool->stat.n_ra_pages_evicted
+ - buf_pool->old_stat.n_ra_pages_evicted) / time_elapsed;
+
+ pool_info->unzip_lru_len = UT_LIST_GET_LEN(buf_pool->unzip_LRU);
+
+ pool_info->io_sum = buf_LRU_stat_sum.io;
+
+ pool_info->io_cur = buf_LRU_stat_cur.io;
+
+ pool_info->unzip_sum = buf_LRU_stat_sum.unzip;
+
+ pool_info->unzip_cur = buf_LRU_stat_cur.unzip;
+
+ buf_refresh_io_stats(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ mutex_exit(&buf_pool->free_list_mutex);
+ buf_pool_mutex_exit(buf_pool);
+}
+
/*********************************************************************//**
Prints info of the buffer i/o. */
UNIV_INTERN
void
-buf_print_io(
-/*=========*/
- FILE* file) /*!< in/out: buffer where to print */
+buf_print_io_instance(
+/*==================*/
+ buf_pool_info_t*pool_info, /*!< in: buffer pool info */
+ FILE* file) /*!< in/out: buffer where to print */
{
- time_t current_time;
- double time_elapsed;
- ulint n_gets_diff;
-
- ut_ad(buf_pool);
-
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
- mutex_enter(&free_list_mutex);
- mutex_enter(&buf_pool_mutex);
- mutex_enter(&flush_list_mutex);
+ ut_ad(pool_info);
fprintf(file,
"Buffer pool size %lu\n"
@@ -4680,68 +5491,43 @@ buf_print_io(
"Modified db pages %lu\n"
"Pending reads %lu\n"
"Pending writes: LRU %lu, flush list %lu, single page %lu\n",
- (ulong) buf_pool->curr_size,
- (ulong) buf_pool->curr_size * UNIV_PAGE_SIZE,
- (ulong) UT_LIST_GET_LEN(buf_pool->free),
- (ulong) UT_LIST_GET_LEN(buf_pool->LRU),
- (ulong) buf_pool->LRU_old_len,
- (ulong) UT_LIST_GET_LEN(buf_pool->flush_list),
- (ulong) buf_pool->n_pend_reads,
- (ulong) buf_pool->n_flush[BUF_FLUSH_LRU]
- + buf_pool->init_flush[BUF_FLUSH_LRU],
- (ulong) buf_pool->n_flush[BUF_FLUSH_LIST]
- + buf_pool->init_flush[BUF_FLUSH_LIST],
- (ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
-
- current_time = time(NULL);
- time_elapsed = 0.001 + difftime(current_time,
- buf_pool->last_printout_time);
+ pool_info->pool_size,
+ pool_info->pool_size_bytes,
+ pool_info->free_list_len,
+ pool_info->lru_len,
+ pool_info->old_lru_len,
+ pool_info->flush_list_len,
+ pool_info->n_pend_reads,
+ pool_info->n_pending_flush_lru,
+ pool_info->n_pending_flush_list,
+ pool_info->n_pending_flush_single_page);
fprintf(file,
"Pages made young %lu, not young %lu\n"
"%.2f youngs/s, %.2f non-youngs/s\n"
"Pages read %lu, created %lu, written %lu\n"
"%.2f reads/s, %.2f creates/s, %.2f writes/s\n",
- (ulong) buf_pool->stat.n_pages_made_young,
- (ulong) buf_pool->stat.n_pages_not_made_young,
- (buf_pool->stat.n_pages_made_young
- - buf_pool->old_stat.n_pages_made_young)
- / time_elapsed,
- (buf_pool->stat.n_pages_not_made_young
- - buf_pool->old_stat.n_pages_not_made_young)
- / time_elapsed,
- (ulong) buf_pool->stat.n_pages_read,
- (ulong) buf_pool->stat.n_pages_created,
- (ulong) buf_pool->stat.n_pages_written,
- (buf_pool->stat.n_pages_read
- - buf_pool->old_stat.n_pages_read)
- / time_elapsed,
- (buf_pool->stat.n_pages_created
- - buf_pool->old_stat.n_pages_created)
- / time_elapsed,
- (buf_pool->stat.n_pages_written
- - buf_pool->old_stat.n_pages_written)
- / time_elapsed);
-
- n_gets_diff = buf_pool->stat.n_page_gets - buf_pool->old_stat.n_page_gets;
-
- if (n_gets_diff) {
+ pool_info->n_pages_made_young,
+ pool_info->n_pages_not_made_young,
+ pool_info->page_made_young_rate,
+ pool_info->page_not_made_young_rate,
+ pool_info->n_pages_read,
+ pool_info->n_pages_created,
+ pool_info->n_pages_written,
+ pool_info->pages_read_rate,
+ pool_info->pages_created_rate,
+ pool_info->pages_written_rate);
+
+ if (pool_info->n_page_get_delta) {
fprintf(file,
"Buffer pool hit rate %lu / 1000,"
" young-making rate %lu / 1000 not %lu / 1000\n",
- (ulong)
- (1000 - ((1000 * (buf_pool->stat.n_pages_read
- - buf_pool->old_stat.n_pages_read))
- / (buf_pool->stat.n_page_gets
- - buf_pool->old_stat.n_page_gets))),
- (ulong)
- (1000 * (buf_pool->stat.n_pages_made_young
- - buf_pool->old_stat.n_pages_made_young)
- / n_gets_diff),
- (ulong)
- (1000 * (buf_pool->stat.n_pages_not_made_young
- - buf_pool->old_stat.n_pages_not_made_young)
- / n_gets_diff));
+ (ulong) (1000 - (1000 * pool_info->page_read_delta
+ / pool_info->n_page_get_delta)),
+ (ulong) (1000 * pool_info->young_making_delta
+ / pool_info->n_page_get_delta),
+ (ulong) (1000 * pool_info->not_young_making_delta
+ / pool_info->n_page_get_delta));
} else {
fputs("No buffer pool page gets since the last printout\n",
file);
@@ -4750,73 +5536,130 @@ buf_print_io(
/* Statistics about read ahead algorithm */
fprintf(file, "Pages read ahead %.2f/s,"
" evicted without access %.2f/s\n",
- (buf_pool->stat.n_ra_pages_read
- - buf_pool->old_stat.n_ra_pages_read)
- / time_elapsed,
- (buf_pool->stat.n_ra_pages_evicted
- - buf_pool->old_stat.n_ra_pages_evicted)
- / time_elapsed);
+ pool_info->pages_readahead_rate,
+ pool_info->pages_evicted_rate);
/* Print some values to help us with visualizing what is
happening with LRU eviction. */
fprintf(file,
"LRU len: %lu, unzip_LRU len: %lu\n"
"I/O sum[%lu]:cur[%lu], unzip sum[%lu]:cur[%lu]\n",
- UT_LIST_GET_LEN(buf_pool->LRU),
- UT_LIST_GET_LEN(buf_pool->unzip_LRU),
- buf_LRU_stat_sum.io, buf_LRU_stat_cur.io,
- buf_LRU_stat_sum.unzip, buf_LRU_stat_cur.unzip);
-
- buf_refresh_io_stats();
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- mutex_exit(&free_list_mutex);
- mutex_exit(&buf_pool_mutex);
- mutex_exit(&flush_list_mutex);
+ pool_info->lru_len, pool_info->unzip_lru_len,
+ pool_info->io_sum, pool_info->io_cur,
+ pool_info->unzip_sum, pool_info->unzip_cur);
+}
+
+/*********************************************************************//**
+Prints info of the buffer i/o. */
+UNIV_INTERN
+void
+buf_print_io(
+/*=========*/
+ FILE* file) /*!< in/out: buffer where to print */
+{
+ ulint i;
+ buf_pool_info_t* pool_info;
+ buf_pool_info_t* pool_info_total;
+
+ /* If srv_buf_pool_instances is greater than 1, allocate
+ one extra buf_pool_info_t, the last one stores
+ aggregated/total values from all pools */
+ if (srv_buf_pool_instances > 1) {
+ pool_info = (buf_pool_info_t*) mem_zalloc((
+ srv_buf_pool_instances + 1) * sizeof *pool_info);
+
+ pool_info_total = &pool_info[srv_buf_pool_instances];
+ } else {
+ ut_a(srv_buf_pool_instances == 1);
+ pool_info_total = pool_info = (buf_pool_info_t*) mem_zalloc(
+ sizeof *pool_info)
+ }
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ /* Fetch individual buffer pool info and calculate
+ aggregated stats along the way */
+ buf_stats_get_pool_info(buf_pool, i, pool_info);
+
+ /* If we have more than one buffer pool, store
+ the aggregated stats */
+ if (srv_buf_pool_instances > 1) {
+ buf_stats_aggregate_pool_info(pool_info_total,
+ &pool_info[i]);
+ }
+ }
+
+ /* Print the aggreate buffer pool info */
+ buf_print_io_instance(pool_info_total, file);
+
+ /* If there are more than one buffer pool, print each individual pool
+ info */
+ if (srv_buf_pool_instances > 1) {
+ fputs("----------------------\n"
+ "INDIVIDUAL BUFFER POOL INFO\n"
+ "----------------------\n", file);
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ fprintf(file, "---BUFFER POOL %lu\n", i);
+ buf_print_io_instance(&pool_info[i], file);
+ }
+ }
+
+ mem_free(pool_info);
}
/**********************************************************************//**
Refreshes the statistics used to print per-second averages. */
UNIV_INTERN
void
-buf_refresh_io_stats(void)
-/*======================*/
+buf_refresh_io_stats(
+/*=================*/
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
{
- buf_pool->last_printout_time = time(NULL);
+ buf_pool->last_printout_time = ut_time();
buf_pool->old_stat = buf_pool->stat;
}
-/*********************************************************************//**
-Asserts that all file pages in the buffer are in a replaceable state.
-@return TRUE */
+/**********************************************************************//**
+Refreshes the statistics used to print per-second averages. */
UNIV_INTERN
-ibool
-buf_all_freed(void)
-/*===============*/
+void
+buf_refresh_io_stats_all(void)
+/*==========================*/
{
- buf_chunk_t* chunk;
ulint i;
- ut_ad(buf_pool);
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
- //buf_pool_mutex_enter(); /* optimistic */
+ buf_pool = buf_pool_from_array(i);
- chunk = buf_pool->chunks;
+ buf_refresh_io_stats(buf_pool);
+ }
+}
- for (i = buf_pool->n_chunks; i--; chunk++) {
+/**********************************************************************//**
+Check if all pages in all buffer pools are in a replacable state.
+@return FALSE if not */
+UNIV_INTERN
+ibool
+buf_all_freed(void)
+/*===============*/
+{
+ ulint i;
- const buf_block_t* block = buf_chunk_not_freed(chunk);
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
- if (UNIV_LIKELY_NULL(block)) {
- fprintf(stderr,
- "Page %lu %lu still fixed or dirty\n",
- (ulong) block->page.space,
- (ulong) block->page.offset);
- ut_error;
- }
- }
+ buf_pool = buf_pool_from_array(i);
- //buf_pool_mutex_exit(); /* optimistic */
+ if (!buf_all_freed_instance(buf_pool)) {
+ return(FALSE);
+ }
+ }
return(TRUE);
}
@@ -4830,25 +5673,32 @@ ibool
buf_pool_check_no_pending_io(void)
/*==============================*/
{
- ibool ret;
+ ulint i;
+ ibool ret = TRUE;
- //buf_pool_mutex_enter();
- mutex_enter(&buf_pool_mutex);
+ buf_pool_mutex_enter_all();
- if (buf_pool->n_pend_reads + buf_pool->n_flush[BUF_FLUSH_LRU]
- + buf_pool->n_flush[BUF_FLUSH_LIST]
- + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]) {
- ret = FALSE;
- } else {
- ret = TRUE;
+ for (i = 0; i < srv_buf_pool_instances && ret; i++) {
+ const buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ if (buf_pool->n_pend_reads
+ + buf_pool->n_flush[BUF_FLUSH_LRU]
+ + buf_pool->n_flush[BUF_FLUSH_LIST]
+ + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]) {
+
+ ret = FALSE;
+ }
}
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit_all();
return(ret);
}
+#if 0
+Code currently not used
/*********************************************************************//**
Gets the current length of the free list of buffer blocks.
@return length of the free list */
@@ -4859,16 +5709,18 @@ buf_get_free_list_len(void)
{
ulint len;
- //buf_pool_mutex_enter();
- mutex_enter(&free_list_mutex);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->free_list_mutex);
len = UT_LIST_GET_LEN(buf_pool->free);
- //buf_pool_mutex_exit();
- mutex_exit(&free_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->free_list_mutex);
return(len);
}
+#endif
+
#else /* !UNIV_HOTBACKUP */
/********************************************************************//**
Inits a page to the buffer buf_pool, for use in ibbackup --restore. */
diff --git a/storage/xtradb/buf/buf0flu.c b/storage/xtradb/buf/buf0flu.c
index 0a03d583549..09d11dd21db 100644
--- a/storage/xtradb/buf/buf0flu.c
+++ b/storage/xtradb/buf/buf0flu.c
@@ -43,6 +43,8 @@ Created 11/11/1995 Heikki Tuuri
#include "log0log.h"
#include "os0file.h"
#include "trx0sys.h"
+#include "mysql/plugin.h"
+#include "mysql/service_thd_wait.h"
/**********************************************************************
These statistics are generated for heuristics used in estimating the
@@ -73,7 +75,7 @@ Updated by buf_flush_stat_update(). Not protected by any mutex. */
static buf_flush_stat_t buf_flush_stat_sum;
/** Number of pages flushed through non flush_list flushes. */
-static ulint buf_lru_flush_page_count = 0;
+// static ulint buf_lru_flush_page_count = 0;
/* @} */
@@ -83,27 +85,56 @@ Validates the flush list.
@return TRUE if ok */
static
ibool
-buf_flush_validate_low(void);
-/*========================*/
+buf_flush_validate_low(
+/*===================*/
+ buf_pool_t* buf_pool); /*!< in: Buffer pool instance */
+
+/******************************************************************//**
+Validates the flush list some of the time.
+@return TRUE if ok or the check was skipped */
+static
+ibool
+buf_flush_validate_skip(
+/*====================*/
+ buf_pool_t* buf_pool) /*!< in: Buffer pool instance */
+{
+/** Try buf_flush_validate_low() every this many times */
+# define BUF_FLUSH_VALIDATE_SKIP 23
+
+ /** The buf_flush_validate_low() call skip counter.
+ Use a signed type because of the race condition below. */
+ static int buf_flush_validate_count = BUF_FLUSH_VALIDATE_SKIP;
+
+ /* There is a race condition below, but it does not matter,
+ because this call is only for heuristic purposes. We want to
+ reduce the call frequency of the costly buf_flush_validate_low()
+ check in debug builds. */
+ if (--buf_flush_validate_count > 0) {
+ return(TRUE);
+ }
+
+ buf_flush_validate_count = BUF_FLUSH_VALIDATE_SKIP;
+ return(buf_flush_validate_low(buf_pool));
+}
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
-/********************************************************************//**
+/******************************************************************//**
Insert a block in the flush_rbt and returns a pointer to its
predecessor or NULL if no predecessor. The ordering is maintained
on the basis of the <oldest_modification, space, offset> key.
-@return pointer to the predecessor or NULL if no predecessor. */
+@return pointer to the predecessor or NULL if no predecessor. */
static
buf_page_t*
buf_flush_insert_in_flush_rbt(
/*==========================*/
- buf_page_t* bpage) /*!< in: bpage to be inserted. */
+ buf_page_t* bpage) /*!< in: bpage to be inserted. */
{
- buf_page_t* prev = NULL;
const ib_rbt_node_t* c_node;
const ib_rbt_node_t* p_node;
+ buf_page_t* prev = NULL;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&flush_list_mutex));
+ ut_ad(buf_flush_list_mutex_own(buf_pool));
/* Insert this buffer into the rbt. */
c_node = rbt_insert(buf_pool->flush_rbt, &bpage, &bpage);
@@ -113,31 +144,39 @@ buf_flush_insert_in_flush_rbt(
p_node = rbt_prev(buf_pool->flush_rbt, c_node);
if (p_node != NULL) {
- prev = *rbt_value(buf_page_t*, p_node);
+ buf_page_t** value;
+ value = rbt_value(buf_page_t*, p_node);
+ prev = *value;
ut_a(prev != NULL);
}
return(prev);
}
-/********************************************************************//**
+/*********************************************************//**
Delete a bpage from the flush_rbt. */
static
void
buf_flush_delete_from_flush_rbt(
/*============================*/
- buf_page_t* bpage) /*!< in: bpage to be removed. */
+ buf_page_t* bpage) /*!< in: bpage to be removed. */
{
+#ifdef UNIV_DEBUG
+ ibool ret = FALSE;
+#endif /* UNIV_DEBUG */
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
+ ut_ad(buf_flush_list_mutex_own(buf_pool));
- ibool ret = FALSE;
+#ifdef UNIV_DEBUG
+ ret =
+#endif /* UNIV_DEBUG */
+ rbt_delete(buf_pool->flush_rbt, &bpage);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&flush_list_mutex));
- ret = rbt_delete(buf_pool->flush_rbt, &bpage);
ut_ad(ret);
}
-/********************************************************************//**
+/*****************************************************************//**
Compare two modified blocks in the buffer pool. The key for comparison
is:
key = <oldest_modification, space, offset>
@@ -146,7 +185,7 @@ buf_pool->flush_rbt.
Note that for the purpose of flush_rbt, we only need to order blocks
on the oldest_modification. The other two fields are used to uniquely
identify the blocks.
-@return < 0 if b2 < b1, 0 if b2 == b1, > 0 if b2 > b1 */
+@return < 0 if b2 < b1, 0 if b2 == b1, > 0 if b2 > b1 */
static
int
buf_flush_block_cmp(
@@ -154,29 +193,24 @@ buf_flush_block_cmp(
const void* p1, /*!< in: block1 */
const void* p2) /*!< in: block2 */
{
- int ret;
- const buf_page_t* b1;
- const buf_page_t* b2;
-
- ut_ad(p1 != NULL);
- ut_ad(p2 != NULL);
-
- b1 = *(const buf_page_t**) p1;
- b2 = *(const buf_page_t**) p2;
+ int ret;
+ const buf_page_t* b1 = *(const buf_page_t**) p1;
+ const buf_page_t* b2 = *(const buf_page_t**) p2;
+#ifdef UNIV_DEBUG
+ buf_pool_t* buf_pool = buf_pool_from_bpage(b1);
+#endif /* UNIV_DEBUG */
ut_ad(b1 != NULL);
ut_ad(b2 != NULL);
+ ut_ad(buf_flush_list_mutex_own(buf_pool));
+
ut_ad(b1->in_flush_list);
ut_ad(b2->in_flush_list);
- if (b2->oldest_modification
- > b1->oldest_modification) {
+ if (b2->oldest_modification > b1->oldest_modification) {
return(1);
- }
-
- if (b2->oldest_modification
- < b1->oldest_modification) {
+ } else if (b2->oldest_modification < b1->oldest_modification) {
return(-1);
}
@@ -196,14 +230,21 @@ void
buf_flush_init_flush_rbt(void)
/*==========================*/
{
- //buf_pool_mutex_enter();
- mutex_enter(&flush_list_mutex);
-
- /* Create red black tree for speedy insertions in flush list. */
- buf_pool->flush_rbt = rbt_create(sizeof(buf_page_t*),
- buf_flush_block_cmp);
- //buf_pool_mutex_exit();
- mutex_exit(&flush_list_mutex);
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ buf_flush_list_mutex_enter(buf_pool);
+
+ /* Create red black tree for speedy insertions in flush list. */
+ buf_pool->flush_rbt = rbt_create(
+ sizeof(buf_page_t*), buf_flush_block_cmp);
+
+ buf_flush_list_mutex_exit(buf_pool);
+ }
}
/********************************************************************//**
@@ -213,18 +254,24 @@ void
buf_flush_free_flush_rbt(void)
/*==========================*/
{
- //buf_pool_mutex_enter();
- mutex_enter(&flush_list_mutex);
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ buf_flush_list_mutex_enter(buf_pool);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
- ut_a(buf_flush_validate_low());
+ ut_a(buf_flush_validate_low(buf_pool));
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
- rbt_free(buf_pool->flush_rbt);
- buf_pool->flush_rbt = NULL;
+ rbt_free(buf_pool->flush_rbt);
+ buf_pool->flush_rbt = NULL;
- //buf_pool_mutex_exit();
- mutex_exit(&flush_list_mutex);
+ buf_flush_list_mutex_exit(buf_pool);
+ }
}
/********************************************************************//**
@@ -233,28 +280,33 @@ UNIV_INTERN
void
buf_flush_insert_into_flush_list(
/*=============================*/
- buf_block_t* block) /*!< in/out: block which is modified */
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ buf_block_t* block, /*!< in/out: block which is modified */
+ ib_uint64_t lsn) /*!< in: oldest modification */
{
- //ut_ad(buf_pool_mutex_own());
+ ut_ad(!buf_pool_mutex_own(buf_pool));
+ ut_ad(log_flush_order_mutex_own());
ut_ad(mutex_own(&block->mutex));
- ut_ad(mutex_own(&flush_list_mutex));
+
+ buf_flush_list_mutex_enter(buf_pool);
+
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
|| (UT_LIST_GET_FIRST(buf_pool->flush_list)->oldest_modification
- <= block->page.oldest_modification));
+ <= lsn));
/* If we are in the recovery then we need to update the flush
red-black tree as well. */
if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
- buf_flush_insert_sorted_into_flush_list(block);
+ buf_flush_list_mutex_exit(buf_pool);
+ buf_flush_insert_sorted_into_flush_list(buf_pool, block, lsn);
return;
}
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
- ut_ad(block->page.in_LRU_list);
- ut_ad(block->page.in_page_hash);
- ut_ad(!block->page.in_zip_hash);
ut_ad(!block->page.in_flush_list);
+
ut_d(block->page.in_flush_list = TRUE);
+ block->page.oldest_modification = lsn;
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, &block->page);
#ifdef UNIV_DEBUG_VALGRIND
@@ -269,8 +321,10 @@ buf_flush_insert_into_flush_list(
}
#endif /* UNIV_DEBUG_VALGRIND */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
- ut_a(buf_flush_validate_low());
+ ut_a(buf_flush_validate_skip(buf_pool));
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
+
+ buf_flush_list_mutex_exit(buf_pool);
}
/********************************************************************//**
@@ -281,21 +335,39 @@ UNIV_INTERN
void
buf_flush_insert_sorted_into_flush_list(
/*====================================*/
- buf_block_t* block) /*!< in/out: block which is modified */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ buf_block_t* block, /*!< in/out: block which is modified */
+ ib_uint64_t lsn) /*!< in: oldest modification */
{
buf_page_t* prev_b;
buf_page_t* b;
- //ut_ad(buf_pool_mutex_own());
+ ut_ad(!buf_pool_mutex_own(buf_pool));
+ ut_ad(log_flush_order_mutex_own());
ut_ad(mutex_own(&block->mutex));
- ut_ad(mutex_own(&flush_list_mutex));
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
+ buf_flush_list_mutex_enter(buf_pool);
+
+ /* The field in_LRU_list is protected by buf_pool->mutex, which
+ we are not holding. However, while a block is in the flush
+ list, it is dirty and cannot be discarded, not from the
+ page_hash or from the LRU list. At most, the uncompressed
+ page frame of a compressed block may be discarded or created
+ (copying the block->page to or from a buf_page_t that is
+ dynamically allocated from buf_buddy_alloc()). Because those
+ transitions hold block->mutex and the flush list mutex (via
+ buf_flush_relocate_on_flush_list()), there is no possibility
+ of a race condition in the assertions below. */
ut_ad(block->page.in_LRU_list);
ut_ad(block->page.in_page_hash);
+ /* buf_buddy_block_register() will take a block in the
+ BUF_BLOCK_MEMORY state, not a file page. */
ut_ad(!block->page.in_zip_hash);
+
ut_ad(!block->page.in_flush_list);
ut_d(block->page.in_flush_list = TRUE);
+ block->page.oldest_modification = lsn;
#ifdef UNIV_DEBUG_VALGRIND
{
@@ -341,8 +413,10 @@ buf_flush_insert_sorted_into_flush_list(
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
- ut_a(buf_flush_validate_low());
+ ut_a(buf_flush_validate_low(buf_pool));
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
+
+ buf_flush_list_mutex_exit(buf_pool);
}
/********************************************************************//**
@@ -356,13 +430,16 @@ buf_flush_ready_for_replace(
buf_page_t* bpage) /*!< in: buffer control block, must be
buf_page_in_file(bpage) and in the LRU list */
{
- //ut_ad(buf_pool_mutex_own());
+#ifdef UNIV_DEBUG
+ //buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+#endif
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
- //ut_ad(bpage->in_LRU_list); /* optimistic use */
+ //ut_ad(bpage->in_LRU_list);
if (UNIV_LIKELY(bpage->in_LRU_list && buf_page_in_file(bpage))) {
- return(bpage->oldest_modification == 0
+ return((bpage->oldest_modification == 0 || bpage->space_was_being_deleted)
&& buf_page_get_io_fix(bpage) == BUF_IO_NONE
&& bpage->buf_fix_count == 0);
}
@@ -392,8 +469,11 @@ buf_flush_ready_for_flush(
buf_page_in_file(bpage) */
enum buf_flush flush_type)/*!< in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
{
+#ifdef UNIV_DEBUG
+ //buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+#endif
//ut_a(buf_page_in_file(bpage));
- //ut_ad(buf_pool_mutex_own()); /*optimistic...*/
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(flush_type == BUF_FLUSH_LRU || BUF_FLUSH_LIST);
@@ -401,6 +481,13 @@ buf_flush_ready_for_flush(
&& buf_page_get_io_fix(bpage) == BUF_IO_NONE) {
ut_ad(bpage->in_flush_list);
+ if (bpage->space_was_being_deleted) {
+ /* should be removed from flush_list here */
+ /* because buf_flush_try_neighbors() cannot flush without fil_space_get_size(space) */
+ buf_flush_remove(bpage);
+ return(FALSE);
+ }
+
if (flush_type != BUF_FLUSH_LRU) {
return(TRUE);
@@ -426,22 +513,22 @@ buf_flush_remove(
/*=============*/
buf_page_t* bpage) /*!< in: pointer to the block in question */
{
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(buf_page_get_mutex(bpage)));
-
- mutex_enter(&flush_list_mutex);
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(bpage->in_flush_list);
+ buf_flush_list_mutex_enter(buf_pool);
+
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_PAGE:
- /* clean compressed pages should not be on the flush list */
+ /* Clean compressed pages should not be on the flush list */
case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE:
case BUF_BLOCK_MEMORY:
case BUF_BLOCK_REMOVE_HASH:
- mutex_exit(&flush_list_mutex);
ut_error;
return;
case BUF_BLOCK_ZIP_DIRTY:
@@ -454,7 +541,7 @@ buf_flush_remove(
break;
}
- /* If the flush_rbt is active then delete from it as well. */
+ /* If the flush_rbt is active then delete from there as well. */
if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
buf_flush_delete_from_flush_rbt(bpage);
}
@@ -465,15 +552,24 @@ buf_flush_remove(
bpage->oldest_modification = 0;
- ut_d(UT_LIST_VALIDATE(flush_list, buf_page_t, buf_pool->flush_list,
- ut_ad(ut_list_node_313->in_flush_list)));
- mutex_exit(&flush_list_mutex);
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
+ ut_a(buf_flush_validate_skip(buf_pool));
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
+
+ buf_flush_list_mutex_exit(buf_pool);
}
-/********************************************************************//**
+/*******************************************************************//**
Relocates a buffer control block on the flush_list.
-Note that it is assumed that the contents of bpage has already been
-copied to dpage. */
+Note that it is assumed that the contents of bpage have already been
+copied to dpage.
+IMPORTANT: When this function is called bpage and dpage are not
+exact copies of each other. For example, they both will have different
+::state. Also the ::list pointers in dpage may be stale. We need to
+use the current list node (bpage) to do the list manipulation because
+the list pointers could have changed between the time that we copied
+the contents of bpage to the dpage and the flush list manipulation
+below. */
UNIV_INTERN
void
buf_flush_relocate_on_flush_list(
@@ -481,14 +577,25 @@ buf_flush_relocate_on_flush_list(
buf_page_t* bpage, /*!< in/out: control block being moved */
buf_page_t* dpage) /*!< in/out: destination block */
{
- buf_page_t* prev;
- buf_page_t* prev_b = NULL;
+ buf_page_t* prev;
+ buf_page_t* prev_b = NULL;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&flush_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ /* Must reside in the same buffer pool. */
+ ut_ad(buf_pool == buf_pool_from_bpage(dpage));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
+ buf_flush_list_mutex_enter(buf_pool);
+
+ /* FIXME: At this point we have both buf_pool and flush_list
+ mutexes. Theoretically removal of a block from flush list is
+ only covered by flush_list mutex but currently we do
+ have buf_pool mutex in buf_flush_remove() therefore this block
+ is guaranteed to be in the flush list. We need to check if
+ this will work without the assumption of block removing code
+ having the buf_pool mutex. */
ut_ad(bpage->in_flush_list);
ut_ad(dpage->in_flush_list);
@@ -524,8 +631,10 @@ buf_flush_relocate_on_flush_list(
ut_a(!buf_pool->flush_rbt || prev_b == prev);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
- ut_a(buf_flush_validate_low());
+ ut_a(buf_flush_validate_low(buf_pool));
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
+
+ buf_flush_list_mutex_exit(buf_pool);
}
/********************************************************************//**
@@ -537,6 +646,7 @@ buf_flush_write_complete(
buf_page_t* bpage) /*!< in: pointer to the block in question */
{
enum buf_flush flush_type;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(bpage);
@@ -557,8 +667,8 @@ buf_flush_write_complete(
/* fprintf(stderr, "n pending flush %lu\n",
buf_pool->n_flush[flush_type]); */
- if ((buf_pool->n_flush[flush_type] == 0)
- && (buf_pool->init_flush[flush_type] == FALSE)) {
+ if (buf_pool->n_flush[flush_type] == 0
+ && buf_pool->init_flush[flush_type] == FALSE) {
/* The running flush batch has ended */
@@ -757,7 +867,7 @@ corrupted_page:
flush:
/* Now flush the doublewrite buffer data to disk */
- fil_flush(srv_doublewrite_file ? TRX_DOUBLEWRITE_SPACE : TRX_SYS_SPACE);
+ fil_flush(srv_doublewrite_file ? TRX_DOUBLEWRITE_SPACE : TRX_SYS_SPACE, FALSE);
/* We know that the writes have been flushed to disk now
and in recovery we will find them in the doublewrite buffer
@@ -920,8 +1030,8 @@ buf_flush_init_for_writing(
case FIL_PAGE_TYPE_ZBLOB:
case FIL_PAGE_TYPE_ZBLOB2:
case FIL_PAGE_INDEX:
- mach_write_ull(page_zip->data
- + FIL_PAGE_LSN, newest_lsn);
+ mach_write_to_8(page_zip->data
+ + FIL_PAGE_LSN, newest_lsn);
memset(page_zip->data + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);
mach_write_to_4(page_zip->data
+ FIL_PAGE_SPACE_OR_CHKSUM,
@@ -943,10 +1053,10 @@ buf_flush_init_for_writing(
}
/* Write the newest modification lsn to the page header and trailer */
- mach_write_ull(page + FIL_PAGE_LSN, newest_lsn);
+ mach_write_to_8(page + FIL_PAGE_LSN, newest_lsn);
- mach_write_ull(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- newest_lsn);
+ mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
+ newest_lsn);
/* Store the new formula checksum */
@@ -981,20 +1091,26 @@ buf_flush_write_block_low(
{
ulint zip_size = buf_page_get_zip_size(bpage);
page_t* frame = NULL;
+
+#ifdef UNIV_DEBUG
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ //ut_ad(!buf_pool_mutex_own(buf_pool));
+#endif
+
#ifdef UNIV_LOG_DEBUG
static ibool univ_log_debug_warned;
#endif /* UNIV_LOG_DEBUG */
ut_ad(buf_page_in_file(bpage));
- /* We are not holding buf_pool_mutex or block_mutex here.
+ /* We are not holding buf_pool->mutex or block_mutex here.
Nevertheless, it is safe to access bpage, because it is
io_fixed and oldest_modification != 0. Thus, it cannot be
relocated in the buffer pool or removed from flush_list or
LRU_list. */
- //ut_ad(!buf_pool_mutex_own());
- ut_ad(!mutex_own(&LRU_list_mutex));
- ut_ad(!mutex_own(&flush_list_mutex));
+ //ut_ad(!buf_pool_mutex_own(buf_pool));
+ ut_ad(!mutex_own(&buf_pool->LRU_list_mutex));
+ ut_ad(!buf_flush_list_mutex_own(buf_pool));
ut_ad(!mutex_own(buf_page_get_mutex(bpage)));
ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_WRITE);
ut_ad(bpage->oldest_modification != 0);
@@ -1031,8 +1147,8 @@ buf_flush_write_block_low(
ut_a(mach_read_from_4(frame + FIL_PAGE_SPACE_OR_CHKSUM)
== page_zip_calc_checksum(frame, zip_size));
}
- mach_write_ull(frame + FIL_PAGE_LSN,
- bpage->newest_modification);
+ mach_write_to_8(frame + FIL_PAGE_LSN,
+ bpage->newest_modification);
memset(frame + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);
break;
case BUF_BLOCK_FILE_PAGE:
@@ -1059,17 +1175,98 @@ buf_flush_write_block_low(
}
}
+# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+/********************************************************************//**
+Writes a flushable page asynchronously from the buffer pool to a file.
+NOTE: buf_pool->mutex and block->mutex must be held upon entering this
+function, and they will be released by this function after flushing.
+This is loosely based on buf_flush_batch() and buf_flush_page().
+@return TRUE if the page was flushed and the mutexes released */
+UNIV_INTERN
+ibool
+buf_flush_page_try(
+/*===============*/
+ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
+ buf_block_t* block) /*!< in/out: buffer control block */
+{
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
+ ut_ad(mutex_own(&block->mutex));
+
+ if (!buf_flush_ready_for_flush(&block->page, BUF_FLUSH_LRU)) {
+ return(FALSE);
+ }
+
+ buf_pool_mutex_enter(buf_pool);
+
+ if (buf_pool->n_flush[BUF_FLUSH_LRU] > 0
+ || buf_pool->init_flush[BUF_FLUSH_LRU]) {
+ buf_pool_mutex_exit(buf_pool);
+ /* There is already a flush batch of the same type running */
+ return(FALSE);
+ }
+
+ buf_pool->init_flush[BUF_FLUSH_LRU] = TRUE;
+
+ buf_page_set_io_fix(&block->page, BUF_IO_WRITE);
+
+ buf_page_set_flush_type(&block->page, BUF_FLUSH_LRU);
+
+ if (buf_pool->n_flush[BUF_FLUSH_LRU]++ == 0) {
+
+ os_event_reset(buf_pool->no_flush[BUF_FLUSH_LRU]);
+ }
+
+ /* VERY IMPORTANT:
+ Because any thread may call the LRU flush, even when owning
+ locks on pages, to avoid deadlocks, we must make sure that the
+ s-lock is acquired on the page without waiting: this is
+ accomplished because buf_flush_ready_for_flush() must hold,
+ and that requires the page not to be bufferfixed. */
+
+ rw_lock_s_lock_gen(&block->lock, BUF_IO_WRITE);
+
+ /* Note that the s-latch is acquired before releasing the
+ buf_pool mutex: this ensures that the latch is acquired
+ immediately. */
+
+ mutex_exit(&block->mutex);
+ buf_pool_mutex_exit(buf_pool);
+
+ /* Even though block is not protected by any mutex at this
+ point, it is safe to access block, because it is io_fixed and
+ oldest_modification != 0. Thus, it cannot be relocated in the
+ buffer pool or removed from flush_list or LRU_list. */
+
+ buf_flush_write_block_low(&block->page);
+
+ buf_pool_mutex_enter(buf_pool);
+ buf_pool->init_flush[BUF_FLUSH_LRU] = FALSE;
+
+ if (buf_pool->n_flush[BUF_FLUSH_LRU] == 0) {
+ /* The running flush batch has ended */
+ os_event_set(buf_pool->no_flush[BUF_FLUSH_LRU]);
+ }
+
+ buf_pool_mutex_exit(buf_pool);
+ buf_flush_buffered_writes();
+
+ return(TRUE);
+}
+# endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+
/********************************************************************//**
Writes a flushable page asynchronously from the buffer pool to a file.
NOTE: in simulated aio we must call
os_aio_simulated_wake_handler_threads after we have posted a batch of
-writes! NOTE: buf_pool_mutex and buf_page_get_mutex(bpage) must be
+writes! NOTE: buf_pool->mutex and buf_page_get_mutex(bpage) must be
held upon entering this function, and they will be released by this
function. */
static
void
buf_flush_page(
/*===========*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
buf_page_t* bpage, /*!< in: buffer control block */
enum buf_flush flush_type) /*!< in: BUF_FLUSH_LRU
or BUF_FLUSH_LIST */
@@ -1078,18 +1275,17 @@ buf_flush_page(
ibool is_uncompressed;
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST);
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&page_hash_latch, RW_LOCK_EX)
- || rw_lock_own(&page_hash_latch, RW_LOCK_SHARED));
+ ut_ad(rw_lock_own(&buf_pool->page_hash_latch, RW_LOCK_SHARED));
#endif
ut_ad(buf_page_in_file(bpage));
block_mutex = buf_page_get_mutex(bpage);
ut_ad(mutex_own(block_mutex));
- mutex_enter(&buf_pool_mutex);
- rw_lock_s_unlock(&page_hash_latch);
+ buf_pool_mutex_enter(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
ut_ad(buf_flush_ready_for_flush(bpage, flush_type));
@@ -1105,7 +1301,7 @@ buf_flush_page(
buf_pool->n_flush[flush_type]++;
is_uncompressed = (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
- ut_ad(is_uncompressed == (block_mutex != &buf_pool_zip_mutex));
+ ut_ad(is_uncompressed == (block_mutex != &buf_pool->zip_mutex));
switch (flush_type) {
ibool is_s_latched;
@@ -1121,8 +1317,7 @@ buf_flush_page(
}
mutex_exit(block_mutex);
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
/* Even though bpage is not protected by any mutex at
this point, it is safe to access bpage, because it is
@@ -1159,8 +1354,7 @@ buf_flush_page(
immediately. */
mutex_exit(block_mutex);
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
break;
default:
@@ -1193,27 +1387,35 @@ buf_flush_try_neighbors(
ulint offset, /*!< in: page offset */
enum buf_flush flush_type, /*!< in: BUF_FLUSH_LRU or
BUF_FLUSH_LIST */
- ulint flush_neighbors)
+ ulint n_flushed, /*!< in: number of pages
+ flushed so far in this batch */
+ ulint n_to_flush) /*!< in: maximum number of pages
+ we are allowed to flush */
{
- buf_page_t* bpage;
- ulint low, high;
- ulint count = 0;
ulint i;
+ ulint low;
+ ulint high;
+ ulint count = 0;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST);
- if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN || !flush_neighbors) {
- /* If there is little space, it is better not to flush any
- block except from the end of the LRU list */
+ if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN || !srv_flush_neighbor_pages) {
+ /* If there is little space, it is better not to flush
+ any block except from the end of the LRU list */
low = offset;
high = offset + 1;
} else {
- /* When flushed, dirty blocks are searched in neighborhoods of
- this size, and flushed along with the original page. */
+ /* When flushed, dirty blocks are searched in
+ neighborhoods of this size, and flushed along with the
+ original page. */
- ulint buf_flush_area = ut_min(BUF_READ_AHEAD_AREA,
- buf_pool->curr_size / 16);
+ ulint buf_flush_area;
+
+ buf_flush_area = ut_min(
+ BUF_READ_AHEAD_AREA(buf_pool),
+ buf_pool->curr_size / 16);
low = (offset / buf_flush_area) * buf_flush_area;
high = (offset / buf_flush_area + 1) * buf_flush_area;
@@ -1225,15 +1427,37 @@ buf_flush_try_neighbors(
high = fil_space_get_size(space);
}
- //buf_pool_mutex_enter();
- rw_lock_s_lock(&page_hash_latch);
-
for (i = low; i < high; i++) {
- bpage = buf_page_hash_get(space, i);
+ buf_page_t* bpage;
+
+ if ((count + n_flushed) >= n_to_flush) {
+
+ /* We have already flushed enough pages and
+ should call it a day. There is, however, one
+ exception. If the page whose neighbors we
+ are flushing has not been flushed yet then
+ we'll try to flush the victim that we
+ selected originally. */
+ if (i <= offset) {
+ i = offset;
+ } else {
+ break;
+ }
+ }
+
+ buf_pool = buf_pool_get(space, i);
+
+ //buf_pool_mutex_enter(buf_pool);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
+
+ /* We only want to flush pages from this buffer pool. */
+ bpage = buf_page_hash_get(buf_pool, space, i);
if (!bpage) {
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
continue;
}
@@ -1250,27 +1474,259 @@ buf_flush_try_neighbors(
if (block_mutex && buf_flush_ready_for_flush(bpage, flush_type)
&& (i == offset || !bpage->buf_fix_count)) {
/* We only try to flush those
- neighbors != offset where the buf fix count is
- zero, as we then know that we probably can
- latch the page without a semaphore wait.
- Semaphore waits are expensive because we must
- flush the doublewrite buffer before we start
+ neighbors != offset where the buf fix
+ count is zero, as we then know that we
+ probably can latch the page without a
+ semaphore wait. Semaphore waits are
+ expensive because we must flush the
+ doublewrite buffer before we start
waiting. */
- buf_flush_page(bpage, flush_type);
+ buf_flush_page(buf_pool, bpage, flush_type);
ut_ad(!mutex_own(block_mutex));
+ ut_ad(!buf_pool_mutex_own(buf_pool));
count++;
-
- //buf_pool_mutex_enter();
- rw_lock_s_lock(&page_hash_latch);
+ continue;
} else if (block_mutex) {
mutex_exit(block_mutex);
}
}
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
+ }
+
+ return(count);
+}
+
+/********************************************************************//**
+Check if the block is modified and ready for flushing. If the the block
+is ready to flush then flush the page and try o flush its neighbors.
+
+@return TRUE if buf_pool mutex was not released during this function.
+This does not guarantee that some pages were written as well.
+Number of pages written are incremented to the count. */
+static
+ibool
+buf_flush_page_and_try_neighbors(
+/*=============================*/
+ buf_page_t* bpage, /*!< in: buffer control block,
+ must be
+ buf_page_in_file(bpage) */
+ enum buf_flush flush_type, /*!< in: BUF_FLUSH_LRU
+ or BUF_FLUSH_LIST */
+ ulint n_to_flush, /*!< in: number of pages to
+ flush */
+ ulint* count) /*!< in/out: number of pages
+ flushed */
+{
+ mutex_t* block_mutex;
+ ibool flushed = FALSE;
+#ifdef UNIV_DEBUG
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+#endif /* UNIV_DEBUG */
+
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(flush_type != BUF_FLUSH_LRU
+ || mutex_own(&buf_pool->LRU_list_mutex));
+
+ block_mutex = buf_page_get_mutex_enter(bpage);
+
+ //ut_a(buf_page_in_file(bpage));
+
+ if (block_mutex && buf_flush_ready_for_flush(bpage, flush_type)) {
+ ulint space;
+ ulint offset;
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_bpage(bpage);
+
+ //buf_pool_mutex_exit(buf_pool);
+ if (flush_type == BUF_FLUSH_LRU) {
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ }
+
+ /* These fields are protected by both the
+ buffer pool mutex and block mutex. */
+ space = buf_page_get_space(bpage);
+ offset = buf_page_get_page_no(bpage);
+
+ mutex_exit(block_mutex);
+
+ /* Try to flush also all the neighbors */
+ *count += buf_flush_try_neighbors(space,
+ offset,
+ flush_type,
+ *count,
+ n_to_flush);
+
+ //buf_pool_mutex_enter(buf_pool);
+ if (flush_type == BUF_FLUSH_LRU) {
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ }
+ flushed = TRUE;
+ } else if (block_mutex) {
+ mutex_exit(block_mutex);
}
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(flush_type != BUF_FLUSH_LRU
+ || mutex_own(&buf_pool->LRU_list_mutex));
+
+ return(flushed);
+}
+
+/*******************************************************************//**
+This utility flushes dirty blocks from the end of the LRU list.
+In the case of an LRU flush the calling thread may own latches to
+pages: to avoid deadlocks, this function must be written so that it
+cannot end up waiting for these latches!
+@return number of blocks for which the write request was queued. */
+static
+ulint
+buf_flush_LRU_list_batch(
+/*=====================*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint max) /*!< in: max of blocks to flush */
+{
+ buf_page_t* bpage;
+ ulint count = 0;
+
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
+
+ do {
+ /* Start from the end of the list looking for a
+ suitable block to be flushed. */
+ bpage = UT_LIST_GET_LAST(buf_pool->LRU);
+
+ /* Iterate backwards over the flush list till we find
+ a page that isn't ready for flushing. */
+ while (bpage != NULL
+ && !buf_flush_page_and_try_neighbors(
+ bpage, BUF_FLUSH_LRU, max, &count)) {
+
+ bpage = UT_LIST_GET_PREV(LRU, bpage);
+ }
+ } while (bpage != NULL && count < max);
+
+ /* We keep track of all flushes happening as part of LRU
+ flush. When estimating the desired rate at which flush_list
+ should be flushed, we factor in this value. */
+ buf_lru_flush_page_count += count;
+
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
+
+ return(count);
+}
+
+/*******************************************************************//**
+This utility flushes dirty blocks from the end of the flush_list.
+the calling thread is not allowed to own any latches on pages!
+@return number of blocks for which the write request was queued;
+ULINT_UNDEFINED if there was a flush of the same type already
+running */
+static
+ulint
+buf_flush_flush_list_batch(
+/*=======================*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint min_n, /*!< in: wished minimum mumber
+ of blocks flushed (it is not
+ guaranteed that the actual
+ number is that big, though) */
+ ib_uint64_t lsn_limit) /*!< all blocks whose
+ oldest_modification is smaller
+ than this should be flushed (if
+ their number does not exceed
+ min_n) */
+{
+ ulint len;
+ buf_page_t* bpage;
+ buf_page_t* prev_bpage = NULL;
+ ulint count = 0;
+
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+
+ /* If we have flushed enough, leave the loop */
+ do {
+ /* Start from the end of the list looking for a suitable
+ block to be flushed. */
+
+ buf_flush_list_mutex_enter(buf_pool);
+
+ /* We use len here because theoretically insertions can
+ happen in the flush_list below while we are traversing
+ it for a suitable candidate for flushing. We'd like to
+ set a limit on how farther we are willing to traverse
+ the list. */
+ len = UT_LIST_GET_LEN(buf_pool->flush_list);
+ bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
+
+ if (bpage) {
+ ut_a(bpage->oldest_modification > 0);
+ prev_bpage = UT_LIST_GET_PREV(flush_list, bpage);
+ }
+
+ if (!bpage || bpage->oldest_modification >= lsn_limit) {
+
+ /* We have flushed enough */
+ buf_flush_list_mutex_exit(buf_pool);
+ break;
+ }
+
+ ut_a(bpage->oldest_modification > 0);
+
+ ut_ad(bpage->in_flush_list);
+
+ buf_flush_list_mutex_exit(buf_pool);
+
+ /* The list may change during the flushing and we cannot
+ safely preserve within this function a pointer to a
+ block in the list! */
+ while (bpage != NULL
+ && len > 0
+ && !buf_flush_page_and_try_neighbors(
+ bpage, BUF_FLUSH_LIST, min_n, &count)) {
+
+ buf_flush_list_mutex_enter(buf_pool);
+
+ /* If we are here that means that buf_pool->mutex
+ was not released in buf_flush_page_and_try_neighbors()
+ above and this guarantees that bpage didn't get
+ relocated since we released the flush_list
+ mutex above. There is a chance, however, that
+ the bpage got removed from flush_list (not
+ currently possible because flush_list_remove()
+ also obtains buf_pool mutex but that may change
+ in future). To avoid this scenario we check
+ the oldest_modification and if it is zero
+ we start all over again. */
+ if (bpage->oldest_modification == 0) {
+ buf_flush_list_mutex_exit(buf_pool);
+ break;
+ }
+
+ bpage = UT_LIST_GET_PREV(flush_list, bpage);
+
+ //ut_ad(!bpage || bpage->in_flush_list);
+ if (bpage != prev_bpage) {
+ /* the search might warp.. retrying */
+ buf_flush_list_mutex_exit(buf_pool);
+ break;
+ }
+ if (bpage) {
+ prev_bpage = UT_LIST_GET_PREV(flush_list, bpage);
+ }
+
+ buf_flush_list_mutex_exit(buf_pool);
+
+ --len;
+ }
+
+ } while (count < min_n && bpage != NULL && len > 0);
+
+ //ut_ad(buf_pool_mutex_own(buf_pool));
return(count);
}
@@ -1283,10 +1739,11 @@ end up waiting for these latches! NOTE 2: in the case of a flush list flush,
the calling thread is not allowed to own any latches on pages!
@return number of blocks for which the write request was queued;
ULINT_UNDEFINED if there was a flush of the same type already running */
-UNIV_INTERN
+static
ulint
buf_flush_batch(
/*============*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
enum buf_flush flush_type, /*!< in: BUF_FLUSH_LRU or
BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
then the caller must not own any
@@ -1294,157 +1751,127 @@ buf_flush_batch(
ulint min_n, /*!< in: wished minimum mumber of blocks
flushed (it is not guaranteed that the
actual number is that big, though) */
- ib_uint64_t lsn_limit) /*!< in the case BUF_FLUSH_LIST all
- blocks whose oldest_modification is
+ ib_uint64_t lsn_limit) /*!< in: in the case of BUF_FLUSH_LIST
+ all blocks whose oldest_modification is
smaller than this should be flushed
(if their number does not exceed
min_n), otherwise ignored */
{
- buf_page_t* bpage;
- buf_page_t* prev_bpage = NULL;
- ulint page_count = 0;
- ulint old_page_count;
- ulint space;
- ulint offset;
- ulint remaining = 0;
-
- ut_ad((flush_type == BUF_FLUSH_LRU)
- || (flush_type == BUF_FLUSH_LIST));
+ ulint count = 0;
+
+ ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST);
#ifdef UNIV_SYNC_DEBUG
ut_ad((flush_type != BUF_FLUSH_LIST)
- || sync_thread_levels_empty_gen(TRUE));
+ || sync_thread_levels_empty_except_dict());
#endif /* UNIV_SYNC_DEBUG */
- //buf_pool_mutex_enter();
- mutex_enter(&buf_pool_mutex);
-
- if ((buf_pool->n_flush[flush_type] > 0)
- || (buf_pool->init_flush[flush_type] == TRUE)) {
-
- /* There is already a flush batch of the same type running */
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ //buf_pool_mutex_enter(buf_pool);
- return(ULINT_UNDEFINED);
+ /* Note: The buffer pool mutex is released and reacquired within
+ the flush functions. */
+ switch(flush_type) {
+ case BUF_FLUSH_LRU:
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ count = buf_flush_LRU_list_batch(buf_pool, min_n);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ break;
+ case BUF_FLUSH_LIST:
+ count = buf_flush_flush_list_batch(buf_pool, min_n, lsn_limit);
+ break;
+ default:
+ ut_error;
}
- buf_pool->init_flush[flush_type] = TRUE;
+ //buf_pool_mutex_exit(buf_pool);
- mutex_exit(&buf_pool_mutex);
+ buf_flush_buffered_writes();
- if (flush_type == BUF_FLUSH_LRU) {
- mutex_enter(&LRU_list_mutex);
+#ifdef UNIV_DEBUG
+ if (buf_debug_prints && count > 0) {
+ fprintf(stderr, flush_type == BUF_FLUSH_LRU
+ ? "Flushed %lu pages in LRU flush\n"
+ : "Flushed %lu pages in flush list flush\n",
+ (ulong) count);
}
+#endif /* UNIV_DEBUG */
- for (;;) {
-flush_next:
- /* If we have flushed enough, leave the loop */
- if (page_count >= min_n) {
+ srv_buf_pool_flushed += count;
- break;
- }
+ return(count);
+}
- /* Start from the end of the list looking for a suitable
- block to be flushed. */
+/******************************************************************//**
+Gather the aggregated stats for both flush list and LRU list flushing */
+static
+void
+buf_flush_common(
+/*=============*/
+ enum buf_flush flush_type, /*!< in: type of flush */
+ ulint page_count) /*!< in: number of pages flushed */
+{
+ buf_flush_buffered_writes();
- if (flush_type == BUF_FLUSH_LRU) {
- bpage = UT_LIST_GET_LAST(buf_pool->LRU);
- } else {
- ut_ad(flush_type == BUF_FLUSH_LIST);
+ ut_a(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST);
- mutex_enter(&flush_list_mutex);
- remaining = UT_LIST_GET_LEN(buf_pool->flush_list);
- bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
- if (bpage) {
- prev_bpage = UT_LIST_GET_PREV(flush_list, bpage);
- }
- mutex_exit(&flush_list_mutex);
- if (!bpage
- || bpage->oldest_modification >= lsn_limit) {
- /* We have flushed enough */
+#ifdef UNIV_DEBUG
+ if (buf_debug_prints && page_count > 0) {
+ fprintf(stderr, flush_type == BUF_FLUSH_LRU
+ ? "Flushed %lu pages in LRU flush\n"
+ : "Flushed %lu pages in flush list flush\n",
+ (ulong) page_count);
+ }
+#endif /* UNIV_DEBUG */
- break;
- }
- ut_ad(bpage->in_flush_list);
- }
+ srv_buf_pool_flushed += page_count;
- /* Note that after finding a single flushable page, we try to
- flush also all its neighbors, and after that start from the
- END of the LRU list or flush list again: the list may change
- during the flushing and we cannot safely preserve within this
- function a pointer to a block in the list! */
+ if (flush_type == BUF_FLUSH_LRU) {
+ /* We keep track of all flushes happening as part of LRU
+ flush. When estimating the desired rate at which flush_list
+ should be flushed we factor in this value. */
+ buf_lru_flush_page_count += page_count;
+ }
+}
- do {
- mutex_t*block_mutex = buf_page_get_mutex_enter(bpage);
- ibool ready;
+/******************************************************************//**
+Start a buffer flush batch for LRU or flush list */
+static
+ibool
+buf_flush_start(
+/*============*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ enum buf_flush flush_type) /*!< in: BUF_FLUSH_LRU
+ or BUF_FLUSH_LIST */
+{
+ buf_pool_mutex_enter(buf_pool);
- //ut_a(buf_page_in_file(bpage));
+ if (buf_pool->n_flush[flush_type] > 0
+ || buf_pool->init_flush[flush_type] == TRUE) {
- if (block_mutex) {
- ready = buf_flush_ready_for_flush(bpage, flush_type);
- mutex_exit(block_mutex);
- } else {
- ready = FALSE;
- }
+ /* There is already a flush batch of the same type running */
- if (ready) {
- space = buf_page_get_space(bpage);
- offset = buf_page_get_page_no(bpage);
-
- //buf_pool_mutex_exit();
- if (flush_type == BUF_FLUSH_LRU) {
- mutex_exit(&LRU_list_mutex);
- }
-
- old_page_count = page_count;
-
- /* Try to flush also all the neighbors */
- page_count += buf_flush_try_neighbors(
- space, offset, flush_type, srv_flush_neighbor_pages);
- /* fprintf(stderr,
- "Flush type %lu, page no %lu, neighb %lu\n",
- flush_type, offset,
- page_count - old_page_count); */
-
- //buf_pool_mutex_enter();
- if (flush_type == BUF_FLUSH_LRU) {
- mutex_enter(&LRU_list_mutex);
- }
- goto flush_next;
-
- } else if (flush_type == BUF_FLUSH_LRU) {
- bpage = UT_LIST_GET_PREV(LRU, bpage);
- } else {
- ut_ad(flush_type == BUF_FLUSH_LIST);
-
- mutex_enter(&flush_list_mutex);
- bpage = UT_LIST_GET_PREV(flush_list, bpage);
- //ut_ad(!bpage || bpage->in_flush_list); /* optimistic */
- if (bpage != prev_bpage) {
- /* the search may warp.. retrying */
- bpage = NULL;
- }
- if (bpage) {
- prev_bpage = UT_LIST_GET_PREV(flush_list, bpage);
- }
- mutex_exit(&flush_list_mutex);
- remaining--;
- }
- } while (bpage != NULL);
+ buf_pool_mutex_exit(buf_pool);
- if (remaining)
- goto flush_next;
+ return(FALSE);
+ }
- /* If we could not find anything to flush, leave the loop */
+ buf_pool->init_flush[flush_type] = TRUE;
- break;
- }
+ buf_pool_mutex_exit(buf_pool);
- if (flush_type == BUF_FLUSH_LRU) {
- mutex_exit(&LRU_list_mutex);
- }
+ return(TRUE);
+}
- mutex_enter(&buf_pool_mutex);
+/******************************************************************//**
+End a buffer flush batch for LRU or flush list */
+static
+void
+buf_flush_end(
+/*==========*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ enum buf_flush flush_type) /*!< in: BUF_FLUSH_LRU
+ or BUF_FLUSH_LIST */
+{
+ buf_pool_mutex_enter(buf_pool);
buf_pool->init_flush[flush_type] = FALSE;
@@ -1455,47 +1882,140 @@ flush_next:
os_event_set(buf_pool->no_flush[flush_type]);
}
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
+}
- buf_flush_buffered_writes();
+/******************************************************************//**
+Waits until a flush batch of the given type ends */
+UNIV_INTERN
+void
+buf_flush_wait_batch_end(
+/*=====================*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ enum buf_flush type) /*!< in: BUF_FLUSH_LRU
+ or BUF_FLUSH_LIST */
+{
+ ut_ad(type == BUF_FLUSH_LRU || type == BUF_FLUSH_LIST);
-#ifdef UNIV_DEBUG
- if (buf_debug_prints && page_count > 0) {
- ut_a(flush_type == BUF_FLUSH_LRU
- || flush_type == BUF_FLUSH_LIST);
- fprintf(stderr, flush_type == BUF_FLUSH_LRU
- ? "Flushed %lu pages in LRU flush\n"
- : "Flushed %lu pages in flush list flush\n",
- (ulong) page_count);
+ if (buf_pool == NULL) {
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; ++i) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ thd_wait_begin(NULL, THD_WAIT_DISKIO);
+ os_event_wait(buf_pool->no_flush[type]);
+ thd_wait_end(NULL);
+ }
+ } else {
+ thd_wait_begin(NULL, THD_WAIT_DISKIO);
+ os_event_wait(buf_pool->no_flush[type]);
+ thd_wait_end(NULL);
}
-#endif /* UNIV_DEBUG */
+}
- srv_buf_pool_flushed += page_count;
+/*******************************************************************//**
+This utility flushes dirty blocks from the end of the LRU list.
+NOTE: The calling thread may own latches to pages: to avoid deadlocks,
+this function must be written so that it cannot end up waiting for these
+latches!
+@return number of blocks for which the write request was queued;
+ULINT_UNDEFINED if there was a flush of the same type already running */
+UNIV_INTERN
+ulint
+buf_flush_LRU(
+/*==========*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint min_n) /*!< in: wished minimum mumber of blocks
+ flushed (it is not guaranteed that the
+ actual number is that big, though) */
+{
+ ulint page_count;
- /* We keep track of all flushes happening as part of LRU
- flush. When estimating the desired rate at which flush_list
- should be flushed we factor in this value. */
- if (flush_type == BUF_FLUSH_LRU) {
- buf_lru_flush_page_count += page_count;
+ if (!buf_flush_start(buf_pool, BUF_FLUSH_LRU)) {
+ return(ULINT_UNDEFINED);
}
+ page_count = buf_flush_batch(buf_pool, BUF_FLUSH_LRU, min_n, 0);
+
+ buf_flush_end(buf_pool, BUF_FLUSH_LRU);
+
+ buf_flush_common(BUF_FLUSH_LRU, page_count);
+
return(page_count);
}
-/******************************************************************//**
-Waits until a flush batch of the given type ends */
+/*******************************************************************//**
+This utility flushes dirty blocks from the end of the flush list of
+all buffer pool instances.
+NOTE: The calling thread is not allowed to own any latches on pages!
+@return number of blocks for which the write request was queued;
+ULINT_UNDEFINED if there was a flush of the same type already running */
UNIV_INTERN
-void
-buf_flush_wait_batch_end(
-/*=====================*/
- enum buf_flush type) /*!< in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
+ulint
+buf_flush_list(
+/*===========*/
+ ulint min_n, /*!< in: wished minimum mumber of blocks
+ flushed (it is not guaranteed that the
+ actual number is that big, though) */
+ ib_uint64_t lsn_limit) /*!< in the case BUF_FLUSH_LIST all
+ blocks whose oldest_modification is
+ smaller than this should be flushed
+ (if their number does not exceed
+ min_n), otherwise ignored */
{
- ut_ad((type == BUF_FLUSH_LRU) || (type == BUF_FLUSH_LIST));
+ ulint i;
+ ulint total_page_count = 0;
+ ibool skipped = FALSE;
+
+ if (min_n != ULINT_MAX) {
+ /* Ensure that flushing is spread evenly amongst the
+ buffer pool instances. When min_n is ULINT_MAX
+ we need to flush everything up to the lsn limit
+ so no limit here. */
+ min_n = (min_n + srv_buf_pool_instances - 1)
+ / srv_buf_pool_instances;
+ }
- os_event_wait(buf_pool->no_flush[type]);
-}
+ /* Flush to lsn_limit in all buffer pool instances */
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+ ulint page_count = 0;
+
+ buf_pool = buf_pool_from_array(i);
+
+ if (!buf_flush_start(buf_pool, BUF_FLUSH_LIST)) {
+ /* We have two choices here. If lsn_limit was
+ specified then skipping an instance of buffer
+ pool means we cannot guarantee that all pages
+ up to lsn_limit has been flushed. We can
+ return right now with failure or we can try
+ to flush remaining buffer pools up to the
+ lsn_limit. We attempt to flush other buffer
+ pools based on the assumption that it will
+ help in the retry which will follow the
+ failure. */
+ skipped = TRUE;
+ continue;
+ }
+
+ page_count = buf_flush_batch(
+ buf_pool, BUF_FLUSH_LIST, min_n, lsn_limit);
+
+ buf_flush_end(buf_pool, BUF_FLUSH_LIST);
+
+ buf_flush_common(BUF_FLUSH_LIST, page_count);
+
+ total_page_count += page_count;
+ }
+
+ return(lsn_limit != IB_ULONGLONG_MAX && skipped
+ ? ULINT_UNDEFINED : total_page_count);
+}
+
/******************************************************************//**
Gives a recommendation of how many blocks should be flushed to establish
a big enough margin of replaceable blocks near the end of the LRU list
@@ -1504,8 +2024,9 @@ and in the free list.
LRU list */
static
ulint
-buf_flush_LRU_recommendation(void)
-/*==============================*/
+buf_flush_LRU_recommendation(
+/*=========================*/
+ buf_pool_t* buf_pool) /*!< in: Buffer pool instance */
{
buf_page_t* bpage;
ulint n_replaceable;
@@ -1515,18 +2036,18 @@ buf_flush_LRU_recommendation(void)
if(UT_LIST_GET_LEN(buf_pool->unzip_LRU))
have_LRU_mutex = TRUE;
retry:
- //buf_pool_mutex_enter();
+ //buf_pool_mutex_enter(buf_pool);
if (have_LRU_mutex)
- mutex_enter(&LRU_list_mutex);
+ mutex_enter(&buf_pool->LRU_list_mutex);
n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
bpage = UT_LIST_GET_LAST(buf_pool->LRU);
while ((bpage != NULL)
- && (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN
- + BUF_FLUSH_EXTRA_MARGIN)
- && (distance < BUF_LRU_FREE_SEARCH_LEN)) {
+ && (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN(buf_pool)
+ + BUF_FLUSH_EXTRA_MARGIN(buf_pool))
+ && (distance < BUF_LRU_FREE_SEARCH_LEN(buf_pool))) {
mutex_t* block_mutex;
if (!bpage->in_LRU_list) {
@@ -1549,11 +2070,11 @@ retry:
bpage = UT_LIST_GET_PREV(LRU, bpage);
}
- //buf_pool_mutex_exit();
+ //buf_pool_mutex_exit(buf_pool);
if (have_LRU_mutex)
- mutex_exit(&LRU_list_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
- if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN) {
+ if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN(buf_pool)) {
return(0);
} else if (!have_LRU_mutex) {
@@ -1563,7 +2084,8 @@ retry:
goto retry;
}
- return(BUF_FLUSH_FREE_BLOCK_MARGIN + BUF_FLUSH_EXTRA_MARGIN
+ return(BUF_FLUSH_FREE_BLOCK_MARGIN(buf_pool)
+ + BUF_FLUSH_EXTRA_MARGIN(buf_pool)
- n_replaceable);
}
@@ -1576,25 +2098,47 @@ immediately, without waiting. */
UNIV_INTERN
void
buf_flush_free_margin(
-/*=======================*/
- ibool wait)
+/*==================*/
+ buf_pool_t* buf_pool, /*!< in: Buffer pool instance */
+ ibool wait)
{
ulint n_to_flush;
- ulint n_flushed;
- n_to_flush = buf_flush_LRU_recommendation();
+ n_to_flush = buf_flush_LRU_recommendation(buf_pool);
if (n_to_flush > 0) {
- n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush, 0);
+ ulint n_flushed;
+
+ n_flushed = buf_flush_LRU(buf_pool, n_to_flush);
+
if (wait && n_flushed == ULINT_UNDEFINED) {
/* There was an LRU type flush batch already running;
let us wait for it to end */
- buf_flush_wait_batch_end(BUF_FLUSH_LRU);
+ buf_flush_wait_batch_end(buf_pool, BUF_FLUSH_LRU);
}
}
}
+/*********************************************************************//**
+Flushes pages from the end of all the LRU lists. */
+UNIV_INTERN
+void
+buf_flush_free_margins(
+/*========================*/
+ ibool wait)
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ buf_flush_free_margin(buf_pool, wait);
+ }
+}
+
/*********************************************************************
Update the historical stats that we are collecting for flush rate
heuristics at the end of each interval.
@@ -1655,22 +2199,28 @@ ulint
buf_flush_get_desired_flush_rate(void)
/*==================================*/
{
- ulint redo_avg;
- ulint lru_flush_avg;
- ulint n_dirty;
- ulint n_flush_req;
- lint rate;
- ib_uint64_t lsn = log_get_lsn();
- ulint log_capacity = log_get_capacity();
+ ulint i;
+ lint rate;
+ ulint redo_avg;
+ ulint n_dirty = 0;
+ ulint n_flush_req;
+ ulint lru_flush_avg;
+ ib_uint64_t lsn = log_get_lsn();
+ ulint log_capacity = log_get_capacity();
/* log_capacity should never be zero after the initialization
of log subsystem. */
ut_ad(log_capacity != 0);
/* Get total number of dirty pages. It is OK to access
- flush_list without holding any mtex as we are using this
+ flush_list without holding any mutex as we are using this
only for heuristics. */
- n_dirty = UT_LIST_GET_LEN(buf_pool->flush_list);
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ n_dirty += UT_LIST_GET_LEN(buf_pool->flush_list);
+ }
/* An overflow can happen if we generate more than 2^32 bytes
of redo in this interval i.e.: 4G of redo in 1 second. We can
@@ -1712,12 +2262,15 @@ Validates the flush list.
@return TRUE if ok */
static
ibool
-buf_flush_validate_low(void)
-/*========================*/
+buf_flush_validate_low(
+/*===================*/
+ buf_pool_t* buf_pool) /*!< in: Buffer pool instance */
{
buf_page_t* bpage;
const ib_rbt_node_t* rnode = NULL;
+ ut_ad(buf_flush_list_mutex_own(buf_pool));
+
UT_LIST_VALIDATE(flush_list, buf_page_t, buf_pool->flush_list,
ut_ad(ut_list_node_313->in_flush_list));
@@ -1732,16 +2285,29 @@ buf_flush_validate_low(void)
while (bpage != NULL) {
const ib_uint64_t om = bpage->oldest_modification;
+
+ ut_ad(buf_pool_from_bpage(bpage) == buf_pool);
+
ut_ad(bpage->in_flush_list);
- //ut_a(buf_page_in_file(bpage)); /* optimistic */
+
+ /* A page in buf_pool->flush_list can be in
+ BUF_BLOCK_REMOVE_HASH state. This happens when a page
+ is in the middle of being relocated. In that case the
+ original descriptor can have this state and still be
+ in the flush list waiting to acquire the
+ buf_pool->flush_list_mutex to complete the relocation. */
+ ut_a(buf_page_in_file(bpage)
+ || buf_page_get_state(bpage) == BUF_BLOCK_REMOVE_HASH);
ut_a(om > 0);
if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
+ buf_page_t** prpage;
+
ut_a(rnode);
- buf_page_t* rpage = *rbt_value(buf_page_t*,
- rnode);
- ut_a(rpage);
- ut_a(rpage == bpage);
+ prpage = rbt_value(buf_page_t*, rnode);
+
+ ut_a(*prpage);
+ ut_a(*prpage == bpage);
rnode = rbt_next(buf_pool->flush_rbt, rnode);
}
@@ -1762,18 +2328,17 @@ Validates the flush list.
@return TRUE if ok */
UNIV_INTERN
ibool
-buf_flush_validate(void)
-/*====================*/
+buf_flush_validate(
+/*===============*/
+ buf_pool_t* buf_pool) /*!< buffer pool instance */
{
ibool ret;
- //buf_pool_mutex_enter();
- mutex_enter(&flush_list_mutex);
+ buf_flush_list_mutex_enter(buf_pool);
- ret = buf_flush_validate_low();
+ ret = buf_flush_validate_low(buf_pool);
- //buf_pool_mutex_exit();
- mutex_exit(&flush_list_mutex);
+ buf_flush_list_mutex_exit(buf_pool);
return(ret);
}
diff --git a/storage/xtradb/buf/buf0lru.c b/storage/xtradb/buf/buf0lru.c
index 94828940fd4..49f3b09c817 100644
--- a/storage/xtradb/buf/buf0lru.c
+++ b/storage/xtradb/buf/buf0lru.c
@@ -50,7 +50,7 @@ Created 11/5/1995 Heikki Tuuri
#include "srv0srv.h"
/** The number of blocks from the LRU_old pointer onward, including
-the block pointed to, must be buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
+the block pointed to, must be buf_pool->LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
of the whole LRU list length, except that the tolerance defined below
is allowed. Note that the tolerance must be small enough such that for
even the BUF_LRU_OLD_MIN_LEN long LRU list, the LRU_old pointer is not
@@ -96,8 +96,9 @@ with page_zip_decompress() operations. */
#define BUF_LRU_IO_TO_UNZIP_FACTOR 50
/** Sampled values buf_LRU_stat_cur.
-Protected by buf_pool_mutex. Updated by buf_LRU_stat_update(). */
+Not protected by any mutex. Updated by buf_LRU_stat_update(). */
static buf_LRU_stat_t buf_LRU_stat_arr[BUF_LRU_STAT_N_INTERVAL];
+
/** Cursor to buf_LRU_stat_arr[] that is updated in a round-robin fashion. */
static ulint buf_LRU_stat_arr_ind;
@@ -106,15 +107,12 @@ by buf_LRU_stat_update(). */
UNIV_INTERN buf_LRU_stat_t buf_LRU_stat_cur;
/** Running sum of past values of buf_LRU_stat_cur.
-Updated by buf_LRU_stat_update(). Protected by buf_pool_mutex. */
+Updated by buf_LRU_stat_update(). Not Protected by any mutex. */
UNIV_INTERN buf_LRU_stat_t buf_LRU_stat_sum;
/* @} */
/** @name Heuristics for detecting index scan @{ */
-/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
-"old" blocks. Protected by buf_pool_mutex. */
-UNIV_INTERN uint buf_LRU_old_ratio;
/** Move blocks to "new" LRU list only if the first access was at
least this many milliseconds ago. Not protected by any mutex or latch. */
UNIV_INTERN uint buf_LRU_old_threshold_ms;
@@ -123,7 +121,7 @@ UNIV_INTERN uint buf_LRU_old_threshold_ms;
/******************************************************************//**
Takes a block out of the LRU list and page hash table.
If the block is compressed-only (BUF_BLOCK_ZIP_PAGE),
-the object will be freed and buf_pool_zip_mutex will be released.
+the object will be freed and buf_pool->zip_mutex will be released.
If a compressed page or a compressed-only block descriptor is freed,
other compressed pages or compressed-only block descriptors may be
@@ -156,20 +154,21 @@ instead of the general LRU list.
UNIV_INLINE
ibool
buf_LRU_evict_from_unzip_LRU(
+/*=========================*/
+ buf_pool_t* buf_pool,
ibool have_LRU_mutex)
-/*==============================*/
{
ulint io_avg;
ulint unzip_avg;
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
if (!have_LRU_mutex)
- mutex_enter(&LRU_list_mutex);
+ mutex_enter(&buf_pool->LRU_list_mutex);
/* If the unzip_LRU list is empty, we can only use the LRU. */
if (UT_LIST_GET_LEN(buf_pool->unzip_LRU) == 0) {
if (!have_LRU_mutex)
- mutex_exit(&LRU_list_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
return(FALSE);
}
@@ -179,7 +178,7 @@ buf_LRU_evict_from_unzip_LRU(
if (UT_LIST_GET_LEN(buf_pool->unzip_LRU)
<= UT_LIST_GET_LEN(buf_pool->LRU) / 10) {
if (!have_LRU_mutex)
- mutex_exit(&LRU_list_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
return(FALSE);
}
@@ -187,11 +186,11 @@ buf_LRU_evict_from_unzip_LRU(
that a workload is disk bound. */
if (buf_pool->freed_page_clock == 0) {
if (!have_LRU_mutex)
- mutex_exit(&LRU_list_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
return(TRUE);
}
if (!have_LRU_mutex)
- mutex_exit(&LRU_list_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
/* Calculate the average over past intervals, and add the values
of the current interval. */
@@ -240,7 +239,8 @@ static
void
buf_LRU_drop_page_hash_for_tablespace(
/*==================================*/
- ulint id) /*!< in: space id */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint id) /*!< in: space id */
{
buf_page_t* bpage;
ulint* page_arr;
@@ -255,22 +255,25 @@ buf_LRU_drop_page_hash_for_tablespace(
return;
}
- page_arr = ut_malloc(sizeof(ulint)
- * BUF_LRU_DROP_SEARCH_HASH_SIZE);
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ page_arr = ut_malloc(
+ sizeof(ulint) * BUF_LRU_DROP_SEARCH_HASH_SIZE);
-scan_again:
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
num_entries = 0;
+
+scan_again:
bpage = UT_LIST_GET_LAST(buf_pool->LRU);
while (bpage != NULL) {
+ /* bpage->state,space,io_fix,buf_fix_count are protected by block_mutex at XtraDB */
mutex_t* block_mutex = buf_page_get_mutex_enter(bpage);
buf_page_t* prev_bpage;
+ ibool is_fixed;
prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
- if (!block_mutex) {
+ if (UNIV_UNLIKELY(!block_mutex)) {
goto next_page;
}
@@ -278,63 +281,84 @@ scan_again:
if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE
|| bpage->space != id
- || bpage->buf_fix_count > 0
|| bpage->io_fix != BUF_IO_NONE) {
- /* We leave the fixed pages as is in this scan.
- To be dealt with later in the final scan. */
+ /* Compressed pages are never hashed.
+ Skip blocks of other tablespaces.
+ Skip I/O-fixed blocks (to be dealt with later). */
mutex_exit(block_mutex);
- goto next_page;
+next_page:
+ bpage = prev_bpage;
+ continue;
}
- if (((buf_block_t*) bpage)->is_hashed) {
+ //mutex_enter(&((buf_block_t*) bpage)->mutex);
+ is_fixed = bpage->buf_fix_count > 0
+ || !((buf_block_t*) bpage)->is_hashed;
+ //mutex_exit(&((buf_block_t*) bpage)->mutex);
- /* Store the offset(i.e.: page_no) in the array
- so that we can drop hash index in a batch
- later. */
- page_arr[num_entries] = bpage->offset;
+ if (is_fixed) {
mutex_exit(block_mutex);
- ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE);
- ++num_entries;
+ goto next_page;
+ }
- if (num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE) {
- goto next_page;
- }
- /* Array full. We release the buf_pool_mutex to
- obey the latching order. */
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
-
- buf_LRU_drop_page_hash_batch(id, zip_size, page_arr,
- num_entries);
- num_entries = 0;
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
- } else {
- mutex_exit(block_mutex);
+ /* Store the page number so that we can drop the hash
+ index in a batch later. */
+ page_arr[num_entries] = bpage->offset;
+ mutex_exit(block_mutex);
+
+ ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE);
+ ++num_entries;
+
+ if (num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE) {
+ goto next_page;
}
-next_page:
- /* Note that we may have released the buf_pool mutex
- above after reading the prev_bpage during processing
- of a page_hash_batch (i.e.: when the array was full).
- This means that prev_bpage can change in LRU list.
- This is OK because this function is a 'best effort'
- to drop as many search hash entries as possible and
- it does not guarantee that ALL such entries will be
- dropped. */
- bpage = prev_bpage;
+ /* Array full. We release the buf_pool->mutex to obey
+ the latching order. */
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+
+ buf_LRU_drop_page_hash_batch(
+ id, zip_size, page_arr, num_entries);
+
+ num_entries = 0;
+
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+
+ /* Note that we released the buf_pool mutex above
+ after reading the prev_bpage during processing of a
+ page_hash_batch (i.e.: when the array was full).
+ Because prev_bpage could belong to a compressed-only
+ block, it may have been relocated, and thus the
+ pointer cannot be trusted. Because bpage is of type
+ buf_block_t, it is safe to dereference.
+
+ bpage can change in the LRU list. This is OK because
+ this function is a 'best effort' to drop as many
+ search hash entries as possible and it does not
+ guarantee that ALL such entries will be dropped. */
/* If, however, bpage has been removed from LRU list
to the free list then we should restart the scan.
bpage->state is protected by buf_pool mutex. */
- if (bpage && !buf_page_in_file(bpage)) {
- ut_a(num_entries == 0);
+
+ /* obtain block_mutex again to avoid race condition of bpage->state */
+ block_mutex = buf_page_get_mutex_enter(bpage);
+ if (!block_mutex) {
goto scan_again;
}
+
+ if (bpage
+ && buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
+ mutex_exit(block_mutex);
+ goto scan_again;
+ }
+ mutex_exit(block_mutex);
}
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
/* Drop any remaining batch of search hashed pages. */
buf_LRU_drop_page_hash_batch(id, zip_size, page_arr, num_entries);
@@ -342,29 +366,23 @@ next_page:
}
/******************************************************************//**
-Invalidates all pages belonging to a given tablespace when we are deleting
-the data file(s) of that tablespace. */
-UNIV_INTERN
+Invalidates all pages belonging to a given tablespace inside a specific
+buffer pool instance when we are deleting the data file(s) of that
+tablespace. */
+static
void
-buf_LRU_invalidate_tablespace(
-/*==========================*/
- ulint id) /*!< in: space id */
+buf_LRU_invalidate_tablespace_buf_pool_instance(
+/*============================================*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ ulint id) /*!< in: space id */
{
buf_page_t* bpage;
ibool all_freed;
- /* Before we attempt to drop pages one by one we first
- attempt to drop page hash index entries in batches to make
- it more efficient. The batching attempt is a best effort
- attempt and does not guarantee that all pages hash entries
- will be dropped. We get rid of remaining page hash entries
- one by one below. */
- buf_LRU_drop_page_hash_for_tablespace(id);
-
scan_again:
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
- rw_lock_x_lock(&page_hash_latch);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
all_freed = TRUE;
@@ -379,8 +397,8 @@ scan_again:
prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
/* bpage->space and bpage->io_fix are protected by
- buf_pool_mutex and block_mutex. It is safe to check
- them while holding buf_pool_mutex only. */
+ buf_pool->mutex and block_mutex. It is safe to check
+ them while holding buf_pool->mutex only. */
if (buf_page_get_space(bpage) != id) {
/* Skip this block, as it does not belong to
@@ -434,7 +452,7 @@ scan_again:
/* Descriptors of uncompressed
blocks will not be relocated,
because we are holding the
- buf_pool_mutex. */
+ buf_pool->mutex. */
break;
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
@@ -446,7 +464,7 @@ scan_again:
buf_pool_zip_mutex, it is
not necessary to acquire
further mutexes. */
- ut_ad(&buf_pool_zip_mutex
+ ut_ad(&buf_pool->zip_mutex
== block_mutex);
ut_ad(mutex_own(block_mutex));
prev_bpage_buf_fix = TRUE;
@@ -460,9 +478,9 @@ scan_again:
ulint page_no;
ulint zip_size;
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
zip_size = buf_page_get_zip_size(bpage);
page_no = buf_page_get_page_no(bpage);
@@ -492,7 +510,7 @@ scan_again:
/* The block_mutex should have been
released by buf_LRU_block_remove_hashed_page()
when it returns BUF_BLOCK_ZIP_FREE. */
- ut_ad(block_mutex == &buf_pool_zip_mutex);
+ ut_ad(block_mutex == &buf_pool->zip_mutex);
ut_ad(!mutex_own(block_mutex));
if (prev_bpage_buf_fix) {
@@ -519,9 +537,9 @@ next_page_no_mutex:
bpage = prev_bpage;
}
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
if (!all_freed) {
os_thread_sleep(20000);
@@ -530,6 +548,63 @@ next_page_no_mutex:
}
}
+/******************************************************************//**
+Invalidates all pages belonging to a given tablespace when we are deleting
+the data file(s) of that tablespace. */
+UNIV_INTERN
+void
+buf_LRU_invalidate_tablespace(
+/*==========================*/
+ ulint id) /*!< in: space id */
+{
+ ulint i;
+
+ /* Before we attempt to drop pages one by one we first
+ attempt to drop page hash index entries in batches to make
+ it more efficient. The batching attempt is a best effort
+ attempt and does not guarantee that all pages hash entries
+ will be dropped. We get rid of remaining page hash entries
+ one by one below. */
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ buf_LRU_drop_page_hash_for_tablespace(buf_pool, id);
+ buf_LRU_invalidate_tablespace_buf_pool_instance(buf_pool, id);
+ }
+}
+
+/******************************************************************//**
+*/
+UNIV_INTERN
+void
+buf_LRU_mark_space_was_deleted(
+/*===========================*/
+ ulint id) /*!< in: space id */
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+ buf_page_t* bpage;
+
+ buf_pool = buf_pool_from_array(i);
+
+ mutex_enter(&buf_pool->LRU_list_mutex);
+
+ bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
+
+ while (bpage != NULL) {
+ if (buf_page_get_space(bpage) == id) {
+ bpage->space_was_being_deleted = TRUE;
+ }
+ bpage = UT_LIST_GET_NEXT(LRU, bpage);
+ }
+
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ }
+}
+
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
UNIV_INTERN
@@ -539,10 +614,11 @@ buf_LRU_insert_zip_clean(
buf_page_t* bpage) /*!< in: pointer to the block in question */
{
buf_page_t* b;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
- ut_ad(mutex_own(&flush_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
+ ut_ad(mutex_own(&buf_pool->zip_mutex));
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_PAGE);
/* Find the first successor of bpage in the LRU list
@@ -572,17 +648,20 @@ UNIV_INLINE
ibool
buf_LRU_free_from_unzip_LRU_list(
/*=============================*/
- ulint n_iterations, /*!< in: how many times this has been called
- repeatedly without result: a high value means
- that we should search farther; we will search
- n_iterations / 5 of the unzip_LRU list,
- or nothing if n_iterations >= 5 */
- ibool have_LRU_mutex)
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint n_iterations, /*!< in: how many times this has
+ been called repeatedly without
+ result: a high value means that
+ we should search farther; we will
+ search n_iterations / 5 of the
+ unzip_LRU list, or nothing if
+ n_iterations >= 5 */
+ ibool have_LRU_mutex)
{
buf_block_t* block;
ulint distance;
- //ut_ad(buf_pool_mutex_own()); /* optimistic */
+ //ut_ad(buf_pool_mutex_own(buf_pool));
/* Theoratically it should be much easier to find a victim
from unzip_LRU as we can choose even a dirty block (as we'll
@@ -592,7 +671,7 @@ buf_LRU_free_from_unzip_LRU_list(
if we have done five iterations so far. */
if (UNIV_UNLIKELY(n_iterations >= 5)
- || !buf_LRU_evict_from_unzip_LRU(have_LRU_mutex)) {
+ || !buf_LRU_evict_from_unzip_LRU(buf_pool, have_LRU_mutex)) {
return(FALSE);
}
@@ -618,7 +697,7 @@ restart:
ut_ad(block->in_unzip_LRU_list);
ut_ad(block->page.in_LRU_list);
- freed = buf_LRU_free_block(&block->page, FALSE, NULL, have_LRU_mutex);
+ freed = buf_LRU_free_block(&block->page, FALSE, have_LRU_mutex);
mutex_exit(&block->mutex);
switch (freed) {
@@ -651,18 +730,20 @@ UNIV_INLINE
ibool
buf_LRU_free_from_common_LRU_list(
/*==============================*/
- ulint n_iterations, /*!< in: how many times this has been called
+ buf_pool_t* buf_pool,
+ ulint n_iterations,
+ /*!< in: how many times this has been called
repeatedly without result: a high value means
that we should search farther; if
n_iterations < 10, then we search
n_iterations / 10 * buf_pool->curr_size
pages from the end of the LRU list */
- ibool have_LRU_mutex)
+ ibool have_LRU_mutex)
{
buf_page_t* bpage;
ulint distance;
- //ut_ad(buf_pool_mutex_own()); /* optimistic */
+ //ut_ad(buf_pool_mutex_own(buf_pool));
distance = 100 + (n_iterations * buf_pool->curr_size) / 10;
@@ -690,7 +771,7 @@ restart:
ut_ad(bpage->in_LRU_list);
accessed = buf_page_is_accessed(bpage);
- freed = buf_LRU_free_block(bpage, TRUE, NULL, have_LRU_mutex);
+ freed = buf_LRU_free_block(bpage, TRUE, have_LRU_mutex);
mutex_exit(block_mutex);
switch (freed) {
@@ -729,7 +810,10 @@ UNIV_INTERN
ibool
buf_LRU_search_and_free_block(
/*==========================*/
- ulint n_iterations) /*!< in: how many times this has been called
+ buf_pool_t* buf_pool,
+ /*!< in: buffer pool instance */
+ ulint n_iterations)
+ /*!< in: how many times this has been called
repeatedly without result: a high value means
that we should search farther; if
n_iterations < 10, then we search
@@ -744,28 +828,27 @@ buf_LRU_search_and_free_block(
if (UT_LIST_GET_LEN(buf_pool->unzip_LRU))
have_LRU_mutex = TRUE;
- /* optimistic search... */
- //buf_pool_mutex_enter();
+ //buf_pool_mutex_enter(buf_pool);
if (have_LRU_mutex)
- mutex_enter(&LRU_list_mutex);
+ mutex_enter(&buf_pool->LRU_list_mutex);
- freed = buf_LRU_free_from_unzip_LRU_list(n_iterations, have_LRU_mutex);
+ freed = buf_LRU_free_from_unzip_LRU_list(buf_pool, n_iterations, have_LRU_mutex);
if (!freed) {
- freed = buf_LRU_free_from_common_LRU_list(n_iterations, have_LRU_mutex);
+ freed = buf_LRU_free_from_common_LRU_list(
+ buf_pool, n_iterations, have_LRU_mutex);
}
- mutex_enter(&buf_pool_mutex);
+ buf_pool_mutex_enter(buf_pool);
if (!freed) {
buf_pool->LRU_flush_ended = 0;
} else if (buf_pool->LRU_flush_ended > 0) {
buf_pool->LRU_flush_ended--;
}
- mutex_exit(&buf_pool_mutex);
- //buf_pool_mutex_exit();
+ buf_pool_mutex_exit(buf_pool);
if (have_LRU_mutex)
- mutex_exit(&LRU_list_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
return(freed);
}
@@ -780,52 +863,68 @@ operations need new buffer blocks, and the i/o work done in flushing would be
wasted. */
UNIV_INTERN
void
-buf_LRU_try_free_flushed_blocks(void)
-/*=================================*/
+buf_LRU_try_free_flushed_blocks(
+/*============================*/
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
{
- //buf_pool_mutex_enter();
- mutex_enter(&buf_pool_mutex);
- while (buf_pool->LRU_flush_ended > 0) {
+ if (buf_pool == NULL) {
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool = buf_pool_from_array(i);
+ buf_LRU_try_free_flushed_blocks(buf_pool);
+ }
+ } else {
+ buf_pool_mutex_enter(buf_pool);
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ while (buf_pool->LRU_flush_ended > 0) {
- buf_LRU_search_and_free_block(1);
+ buf_pool_mutex_exit(buf_pool);
- //buf_pool_mutex_enter();
- mutex_enter(&buf_pool_mutex);
- }
+ buf_LRU_search_and_free_block(buf_pool, 1);
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_enter(buf_pool);
+ }
+
+ buf_pool_mutex_exit(buf_pool);
+ }
}
/******************************************************************//**
-Returns TRUE if less than 25 % of the buffer pool is available. This can be
-used in heuristics to prevent huge transactions eating up the whole buffer
-pool for their locks.
+Returns TRUE if less than 25 % of the buffer pool in any instance is
+available. This can be used in heuristics to prevent huge transactions
+eating up the whole buffer pool for their locks.
@return TRUE if less than 25 % of buffer pool left */
UNIV_INTERN
ibool
buf_LRU_buf_pool_running_out(void)
/*==============================*/
{
- ibool ret = FALSE;
+ ulint i;
+ ibool ret = FALSE;
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
- mutex_enter(&free_list_mutex);
+ for (i = 0; i < srv_buf_pool_instances && !ret; i++) {
+ buf_pool_t* buf_pool;
- if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
- + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->curr_size / 4) {
+ buf_pool = buf_pool_from_array(i);
- ret = TRUE;
- }
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ mutex_enter(&buf_pool->free_list_mutex);
+
+ if (!recv_recovery_on
+ && UT_LIST_GET_LEN(buf_pool->free)
+ + UT_LIST_GET_LEN(buf_pool->LRU)
+ < buf_pool->curr_size / 4) {
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- mutex_exit(&free_list_mutex);
+ ret = TRUE;
+ }
+
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ mutex_exit(&buf_pool->free_list_mutex);
+ }
return(ret);
}
@@ -836,17 +935,19 @@ free list. If it is empty, returns NULL.
@return a free control block, or NULL if the buf_block->free list is empty */
UNIV_INTERN
buf_block_t*
-buf_LRU_get_free_only(void)
-/*=======================*/
+buf_LRU_get_free_only(
+/*==================*/
+ buf_pool_t* buf_pool)
{
buf_block_t* block;
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
- mutex_enter(&free_list_mutex);
+ mutex_enter(&buf_pool->free_list_mutex);
block = (buf_block_t*) UT_LIST_GET_LAST(buf_pool->free);
if (block) {
+
ut_ad(block->page.in_free_list);
ut_d(block->page.in_free_list = FALSE);
ut_ad(!block->page.in_flush_list);
@@ -854,16 +955,18 @@ buf_LRU_get_free_only(void)
ut_a(!buf_page_in_file(&block->page));
UT_LIST_REMOVE(free, buf_pool->free, (&block->page));
- mutex_exit(&free_list_mutex);
+ mutex_exit(&buf_pool->free_list_mutex);
mutex_enter(&block->mutex);
buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE);
UNIV_MEM_ALLOC(block->frame, UNIV_PAGE_SIZE);
+ ut_ad(buf_pool_from_block(block) == buf_pool);
+
mutex_exit(&block->mutex);
} else {
- mutex_exit(&free_list_mutex);
+ mutex_exit(&buf_pool->free_list_mutex);
}
return(block);
@@ -878,8 +981,7 @@ UNIV_INTERN
buf_block_t*
buf_LRU_get_free_block(
/*===================*/
- ulint zip_size) /*!< in: compressed page size in bytes,
- or 0 if uncompressed tablespace */
+ buf_pool_t* buf_pool) /*!< in/out: buffer pool instance */
{
buf_block_t* block = NULL;
ibool freed;
@@ -887,7 +989,7 @@ buf_LRU_get_free_block(
ibool mon_value_was = FALSE;
ibool started_monitor = FALSE;
loop:
- //buf_pool_mutex_enter();
+ //buf_pool_mutex_enter(buf_pool);
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->curr_size / 20) {
@@ -954,29 +1056,12 @@ loop:
}
/* If there is a block in the free list, take it */
- block = buf_LRU_get_free_only();
- if (block) {
-
-#ifdef UNIV_DEBUG
- block->page.zip.m_start =
-#endif /* UNIV_DEBUG */
- block->page.zip.m_end =
- block->page.zip.m_nonempty =
- block->page.zip.n_blobs = 0;
-
- if (UNIV_UNLIKELY(zip_size)) {
- ibool lru;
- page_zip_set_size(&block->page.zip, zip_size);
- mutex_enter(&LRU_list_mutex);
- block->page.zip.data = buf_buddy_alloc(zip_size, &lru, FALSE);
- mutex_exit(&LRU_list_mutex);
- UNIV_MEM_DESC(block->page.zip.data, zip_size, block);
- } else {
- page_zip_set_size(&block->page.zip, 0);
- block->page.zip.data = NULL;
- }
+ block = buf_LRU_get_free_only(buf_pool);
+ //buf_pool_mutex_exit(buf_pool);
- //buf_pool_mutex_exit();
+ if (block) {
+ ut_ad(buf_pool_from_block(block) == buf_pool);
+ memset(&block->page.zip, 0, sizeof block->page.zip);
if (started_monitor) {
srv_print_innodb_monitor = mon_value_was;
@@ -988,9 +1073,7 @@ loop:
/* If no block was in the free list, search from the end of the LRU
list and try to free a block there */
- //buf_pool_mutex_exit();
-
- freed = buf_LRU_search_and_free_block(n_iterations);
+ freed = buf_LRU_search_and_free_block(buf_pool, n_iterations);
if (freed > 0) {
goto loop;
@@ -1032,26 +1115,23 @@ loop:
/* No free block was found: try to flush the LRU list */
- buf_flush_free_margin(TRUE);
+ buf_flush_free_margin(buf_pool, TRUE);
++srv_buf_pool_wait_free;
os_aio_simulated_wake_handler_threads();
- //buf_pool_mutex_enter();
- mutex_enter(&buf_pool_mutex);
+ buf_pool_mutex_enter(buf_pool);
if (buf_pool->LRU_flush_ended > 0) {
/* We have written pages in an LRU flush. To make the insert
buffer more efficient, we try to move these pages to the free
list. */
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
- buf_LRU_try_free_flushed_blocks();
+ buf_LRU_try_free_flushed_blocks(buf_pool);
} else {
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
}
if (n_iterations > 10) {
@@ -1069,17 +1149,18 @@ Moves the LRU_old pointer so that the length of the old blocks list
is inside the allowed limits. */
UNIV_INLINE
void
-buf_LRU_old_adjust_len(void)
-/*========================*/
+buf_LRU_old_adjust_len(
+/*===================*/
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
{
ulint old_len;
ulint new_len;
ut_a(buf_pool->LRU_old);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
- ut_ad(buf_LRU_old_ratio >= BUF_LRU_OLD_RATIO_MIN);
- ut_ad(buf_LRU_old_ratio <= BUF_LRU_OLD_RATIO_MAX);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
+ ut_ad(buf_pool->LRU_old_ratio >= BUF_LRU_OLD_RATIO_MIN);
+ ut_ad(buf_pool->LRU_old_ratio <= BUF_LRU_OLD_RATIO_MAX);
#if BUF_LRU_OLD_RATIO_MIN * BUF_LRU_OLD_MIN_LEN <= BUF_LRU_OLD_RATIO_DIV * (BUF_LRU_OLD_TOLERANCE + 5)
# error "BUF_LRU_OLD_RATIO_MIN * BUF_LRU_OLD_MIN_LEN <= BUF_LRU_OLD_RATIO_DIV * (BUF_LRU_OLD_TOLERANCE + 5)"
#endif
@@ -1095,7 +1176,7 @@ buf_LRU_old_adjust_len(void)
old_len = buf_pool->LRU_old_len;
new_len = ut_min(UT_LIST_GET_LEN(buf_pool->LRU)
- * buf_LRU_old_ratio / BUF_LRU_OLD_RATIO_DIV,
+ * buf_pool->LRU_old_ratio / BUF_LRU_OLD_RATIO_DIV,
UT_LIST_GET_LEN(buf_pool->LRU)
- (BUF_LRU_OLD_TOLERANCE
+ BUF_LRU_NON_OLD_MIN_LEN));
@@ -1137,13 +1218,14 @@ Initializes the old blocks pointer in the LRU list. This function should be
called when the LRU list grows to BUF_LRU_OLD_MIN_LEN length. */
static
void
-buf_LRU_old_init(void)
-/*==================*/
+buf_LRU_old_init(
+/*=============*/
+ buf_pool_t* buf_pool)
{
buf_page_t* bpage;
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN);
/* We first initialize all blocks in the LRU list as old and then use
@@ -1162,7 +1244,7 @@ buf_LRU_old_init(void)
buf_pool->LRU_old = UT_LIST_GET_FIRST(buf_pool->LRU);
buf_pool->LRU_old_len = UT_LIST_GET_LEN(buf_pool->LRU);
- buf_LRU_old_adjust_len();
+ buf_LRU_old_adjust_len(buf_pool);
}
/******************************************************************//**
@@ -1173,11 +1255,13 @@ buf_unzip_LRU_remove_block_if_needed(
/*=================================*/
buf_page_t* bpage) /*!< in/out: control block */
{
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
ut_ad(buf_pool);
ut_ad(bpage);
ut_ad(buf_page_in_file(bpage));
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
if (buf_page_belongs_to_unzip_LRU(bpage)) {
buf_block_t* block = (buf_block_t*) bpage;
@@ -1197,10 +1281,12 @@ buf_LRU_remove_block(
/*=================*/
buf_page_t* bpage) /*!< in: control block */
{
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
ut_ad(buf_pool);
ut_ad(bpage);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_a(buf_page_in_file(bpage));
@@ -1214,7 +1300,7 @@ buf_LRU_remove_block(
/* Below: the previous block is guaranteed to exist,
because the LRU_old pointer is only allowed to differ
by BUF_LRU_OLD_TOLERANCE from strict
- buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV of the LRU
+ buf_pool->LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV of the LRU
list length. */
buf_page_t* prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
@@ -1260,7 +1346,7 @@ buf_LRU_remove_block(
}
/* Adjust the length of the old block list if necessary */
- buf_LRU_old_adjust_len();
+ buf_LRU_old_adjust_len(buf_pool);
}
/******************************************************************//**
@@ -1273,10 +1359,12 @@ buf_unzip_LRU_add_block(
ibool old) /*!< in: TRUE if should be put to the end
of the list, else put to the start */
{
+ buf_pool_t* buf_pool = buf_pool_from_block(block);
+
ut_ad(buf_pool);
ut_ad(block);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_a(buf_page_belongs_to_unzip_LRU(&block->page));
@@ -1298,10 +1386,12 @@ buf_LRU_add_block_to_end_low(
/*=========================*/
buf_page_t* bpage) /*!< in: control block */
{
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
ut_ad(buf_pool);
ut_ad(bpage);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_a(buf_page_in_file(bpage));
@@ -1317,14 +1407,14 @@ buf_LRU_add_block_to_end_low(
buf_page_set_old(bpage, TRUE);
buf_pool->LRU_old_len++;
- buf_LRU_old_adjust_len();
+ buf_LRU_old_adjust_len(buf_pool);
} else if (UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN) {
/* The LRU list is now long enough for LRU_old to become
defined: init it */
- buf_LRU_old_init();
+ buf_LRU_old_init(buf_pool);
} else {
buf_page_set_old(bpage, buf_pool->LRU_old != NULL);
}
@@ -1348,10 +1438,12 @@ buf_LRU_add_block_low(
LRU list is very short, the block is added to
the start, regardless of this parameter */
{
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
ut_ad(buf_pool);
ut_ad(bpage);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_a(buf_page_in_file(bpage));
ut_ad(!bpage->in_LRU_list);
@@ -1385,14 +1477,14 @@ buf_LRU_add_block_low(
/* Adjust the length of the old block list if necessary */
buf_page_set_old(bpage, old);
- buf_LRU_old_adjust_len();
+ buf_LRU_old_adjust_len(buf_pool);
} else if (UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN) {
/* The LRU list is now long enough for LRU_old to become
defined: init it */
- buf_LRU_old_init();
+ buf_LRU_old_init(buf_pool);
} else {
buf_page_set_old(bpage, buf_pool->LRU_old != NULL);
}
@@ -1428,8 +1520,10 @@ buf_LRU_make_block_young(
/*=====================*/
buf_page_t* bpage) /*!< in: control block */
{
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
if (bpage->old) {
buf_pool->stat.n_pages_made_young++;
@@ -1456,10 +1550,10 @@ Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
NOTE: If this function returns BUF_LRU_FREED, it will temporarily
-release buf_pool_mutex. Furthermore, the page frame will no longer be
+release buf_pool->mutex. Furthermore, the page frame will no longer be
accessible via bpage.
-The caller must hold buf_pool_mutex and buf_page_get_mutex(bpage) and
+The caller must hold buf_pool->mutex and buf_page_get_mutex(bpage) and
release these two mutexes after the call. No other
buf_page_get_mutex() may be held when calling this function.
@return BUF_LRU_FREED if freed, BUF_LRU_CANNOT_RELOCATE or
@@ -1471,16 +1565,13 @@ buf_LRU_free_block(
buf_page_t* bpage, /*!< in: block to be freed */
ibool zip, /*!< in: TRUE if should remove also the
compressed page of an uncompressed page */
- ibool* buf_pool_mutex_released,
- /*!< in: pointer to a variable that will
- be assigned TRUE if buf_pool_mutex
- was temporarily released, or NULL */
ibool have_LRU_mutex)
{
buf_page_t* b = NULL;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
mutex_t* block_mutex = buf_page_get_mutex(bpage);
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(mutex_own(block_mutex));
ut_ad(buf_page_in_file(bpage));
//ut_ad(bpage->in_LRU_list);
@@ -1498,6 +1589,10 @@ buf_LRU_free_block(
return(BUF_LRU_NOT_FREED);
}
+ if (bpage->space_was_being_deleted && bpage->oldest_modification != 0) {
+ buf_flush_remove(bpage);
+ }
+
#ifdef UNIV_IBUF_COUNT_DEBUG
ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0);
#endif /* UNIV_IBUF_COUNT_DEBUG */
@@ -1524,9 +1619,9 @@ buf_LRU_free_block(
If it cannot be allocated (without freeing a block
from the LRU list), refuse to free bpage. */
alloc:
- //buf_pool_mutex_exit_forbid();
- b = buf_buddy_alloc(sizeof *b, NULL, FALSE);
- //buf_pool_mutex_exit_allow();
+ //buf_pool_mutex_exit_forbid(buf_pool);
+ b = buf_buddy_alloc(buf_pool, sizeof *b, NULL, FALSE);
+ //buf_pool_mutex_exit_allow(buf_pool);
if (UNIV_UNLIKELY(!b)) {
return(BUF_LRU_CANNOT_RELOCATE);
@@ -1547,8 +1642,8 @@ alloc:
mutex_exit(block_mutex);
if (!have_LRU_mutex)
- mutex_enter(&LRU_list_mutex); /* optimistic */
- rw_lock_x_lock(&page_hash_latch);
+ mutex_enter(&buf_pool->LRU_list_mutex); /* optimistic */
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
mutex_enter(block_mutex);
/* recheck states of block */
@@ -1556,11 +1651,11 @@ alloc:
|| !buf_page_can_relocate(bpage)) {
not_freed:
if (b) {
- buf_buddy_free(b, sizeof *b, TRUE);
+ buf_buddy_free(buf_pool, b, sizeof *b, TRUE);
}
if (!have_LRU_mutex)
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
return(BUF_LRU_NOT_FREED);
} else if (zip || !bpage->zip.data) {
if (bpage->oldest_modification)
@@ -1581,11 +1676,16 @@ not_freed:
ut_a(bpage->buf_fix_count == 0);
if (b) {
+ buf_page_t* hash_b;
buf_page_t* prev_b = UT_LIST_GET_PREV(LRU, b);
- const ulint fold = buf_page_address_fold(
+
+ const ulint fold = buf_page_address_fold(
bpage->space, bpage->offset);
- ut_a(!buf_page_hash_get(bpage->space, bpage->offset));
+ hash_b = buf_page_hash_get_low(
+ buf_pool, bpage->space, bpage->offset, fold);
+
+ ut_a(!hash_b);
while (prev_b && !prev_b->in_LRU_list) {
prev_b = UT_LIST_GET_PREV(LRU, prev_b);
@@ -1649,12 +1749,12 @@ not_freed:
ut_ad(buf_pool->LRU_old);
/* Adjust the length of the
old block list if necessary */
- buf_LRU_old_adjust_len();
+ buf_LRU_old_adjust_len(buf_pool);
} else if (lru_len == BUF_LRU_OLD_MIN_LEN) {
/* The LRU list is now long
enough for LRU_old to become
defined: init it */
- buf_LRU_old_init();
+ buf_LRU_old_init(buf_pool);
}
#ifdef UNIV_LRU_DEBUG
/* Check that the "old" flag is consistent
@@ -1666,32 +1766,28 @@ not_freed:
buf_LRU_add_block_low(b, buf_page_is_old(b));
}
- mutex_enter(&flush_list_mutex);
+ mutex_enter(&buf_pool->zip_mutex);
if (b->state == BUF_BLOCK_ZIP_PAGE) {
buf_LRU_insert_zip_clean(b);
} else {
/* Relocate on buf_pool->flush_list. */
buf_flush_relocate_on_flush_list(bpage, b);
}
- mutex_exit(&flush_list_mutex);
bpage->zip.data = NULL;
page_zip_set_size(&bpage->zip, 0);
/* Prevent buf_page_get_gen() from
decompressing the block while we release
- buf_pool_mutex and block_mutex. */
+ buf_pool->mutex and block_mutex. */
b->buf_fix_count++;
b->io_fix = BUF_IO_READ;
+ mutex_exit(&buf_pool->zip_mutex);
}
- if (buf_pool_mutex_released) {
- *buf_pool_mutex_released = TRUE;
- }
-
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
mutex_exit(block_mutex);
/* Remove possible adaptive hash index on the page.
@@ -1702,7 +1798,7 @@ not_freed:
UNIV_MEM_VALID(((buf_block_t*) bpage)->frame,
UNIV_PAGE_SIZE);
- btr_search_drop_page_hash_index((buf_block_t*) bpage);
+ btr_search_drop_page_hash_index((buf_block_t*) bpage, NULL);
UNIV_MEM_INVALID(((buf_block_t*) bpage)->frame,
UNIV_PAGE_SIZE);
@@ -1723,16 +1819,16 @@ not_freed:
: BUF_NO_CHECKSUM_MAGIC);
}
- //buf_pool_mutex_enter();
+ //buf_pool_mutex_enter(buf_pool);
if (have_LRU_mutex)
- mutex_enter(&LRU_list_mutex);
+ mutex_enter(&buf_pool->LRU_list_mutex);
mutex_enter(block_mutex);
if (b) {
- mutex_enter(&buf_pool_zip_mutex);
+ mutex_enter(&buf_pool->zip_mutex);
b->buf_fix_count--;
buf_page_set_io_fix(b, BUF_IO_NONE);
- mutex_exit(&buf_pool_zip_mutex);
+ mutex_exit(&buf_pool->zip_mutex);
}
buf_LRU_block_free_hashed_page((buf_block_t*) bpage, FALSE);
@@ -1740,12 +1836,12 @@ not_freed:
/* The block_mutex should have been released by
buf_LRU_block_remove_hashed_page() when it returns
BUF_BLOCK_ZIP_FREE. */
- ut_ad(block_mutex == &buf_pool_zip_mutex);
+ ut_ad(block_mutex == &buf_pool->zip_mutex);
mutex_enter(block_mutex);
if (!have_LRU_mutex)
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
return(BUF_LRU_FREED);
@@ -1760,10 +1856,11 @@ buf_LRU_block_free_non_file_page(
buf_block_t* block, /*!< in: block, must not contain a file page */
ibool have_page_hash_mutex)
{
- void* data;
+ void* data;
+ buf_pool_t* buf_pool = buf_pool_from_block(block);
ut_ad(block);
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(mutex_own(&block->mutex));
switch (buf_block_get_state(block)) {
@@ -1797,17 +1894,21 @@ buf_LRU_block_free_non_file_page(
if (data) {
block->page.zip.data = NULL;
mutex_exit(&block->mutex);
- //buf_pool_mutex_exit_forbid();
- buf_buddy_free(data, page_zip_get_size(&block->page.zip), have_page_hash_mutex);
- //buf_pool_mutex_exit_allow();
+ //buf_pool_mutex_exit_forbid(buf_pool);
+
+ buf_buddy_free(
+ buf_pool, data, page_zip_get_size(&block->page.zip),
+ have_page_hash_mutex);
+
+ //buf_pool_mutex_exit_allow(buf_pool);
mutex_enter(&block->mutex);
page_zip_set_size(&block->page.zip, 0);
}
- mutex_enter(&free_list_mutex);
+ mutex_enter(&buf_pool->free_list_mutex);
UT_LIST_ADD_FIRST(free, buf_pool->free, (&block->page));
ut_d(block->page.in_free_list = TRUE);
- mutex_exit(&free_list_mutex);
+ mutex_exit(&buf_pool->free_list_mutex);
UNIV_MEM_ASSERT_AND_FREE(block->frame, UNIV_PAGE_SIZE);
}
@@ -1815,7 +1916,7 @@ buf_LRU_block_free_non_file_page(
/******************************************************************//**
Takes a block out of the LRU list and page hash table.
If the block is compressed-only (BUF_BLOCK_ZIP_PAGE),
-the object will be freed and buf_pool_zip_mutex will be released.
+the object will be freed and buf_pool->zip_mutex will be released.
If a compressed page or a compressed-only block descriptor is freed,
other compressed pages or compressed-only block descriptors may be
@@ -1832,12 +1933,15 @@ buf_LRU_block_remove_hashed_page(
ibool zip) /*!< in: TRUE if should remove also the
compressed page of an uncompressed page */
{
+ ulint fold;
const buf_page_t* hashed_bpage;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
ut_ad(bpage);
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&page_hash_latch, RW_LOCK_EX));
+ ut_ad(rw_lock_own(&buf_pool->page_hash_latch, RW_LOCK_EX));
#endif
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
@@ -1924,7 +2028,9 @@ buf_LRU_block_remove_hashed_page(
break;
}
- hashed_bpage = buf_page_hash_get(bpage->space, bpage->offset);
+ fold = buf_page_address_fold(bpage->space, bpage->offset);
+ hashed_bpage = buf_page_hash_get_low(
+ buf_pool, bpage->space, bpage->offset, fold);
if (UNIV_UNLIKELY(bpage != hashed_bpage)) {
fprintf(stderr,
@@ -1944,9 +2050,9 @@ buf_LRU_block_remove_hashed_page(
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
mutex_exit(buf_page_get_mutex(bpage));
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
buf_print();
buf_LRU_print();
buf_validate();
@@ -1958,9 +2064,7 @@ buf_LRU_block_remove_hashed_page(
ut_ad(!bpage->in_zip_hash);
ut_ad(bpage->in_page_hash);
ut_d(bpage->in_page_hash = FALSE);
- HASH_DELETE(buf_page_t, hash, buf_pool->page_hash,
- buf_page_address_fold(bpage->space, bpage->offset),
- bpage);
+ HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, bpage);
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_PAGE:
ut_ad(!bpage->in_free_list);
@@ -1971,12 +2075,17 @@ buf_LRU_block_remove_hashed_page(
UT_LIST_REMOVE(zip_list, buf_pool->zip_clean, bpage);
- mutex_exit(&buf_pool_zip_mutex);
- //buf_pool_mutex_exit_forbid();
- buf_buddy_free(bpage->zip.data,
- page_zip_get_size(&bpage->zip), TRUE);
- buf_buddy_free(bpage, sizeof(*bpage), TRUE);
- //buf_pool_mutex_exit_allow();
+ mutex_exit(&buf_pool->zip_mutex);
+ //buf_pool_mutex_exit_forbid(buf_pool);
+
+ buf_buddy_free(
+ buf_pool, bpage->zip.data,
+ page_zip_get_size(&bpage->zip), TRUE);
+
+ bpage->state = BUF_BLOCK_ZIP_FREE;
+ buf_buddy_free(buf_pool, bpage, sizeof(*bpage), TRUE);
+ //buf_pool_mutex_exit_allow(buf_pool);
+
UNIV_MEM_UNDESC(bpage);
return(BUF_BLOCK_ZIP_FREE);
@@ -1998,9 +2107,13 @@ buf_LRU_block_remove_hashed_page(
ut_ad(!bpage->in_flush_list);
ut_ad(!bpage->in_LRU_list);
mutex_exit(&((buf_block_t*) bpage)->mutex);
- //buf_pool_mutex_exit_forbid();
- buf_buddy_free(data, page_zip_get_size(&bpage->zip), TRUE);
- //buf_pool_mutex_exit_allow();
+ //buf_pool_mutex_exit_forbid(buf_pool);
+
+ buf_buddy_free(
+ buf_pool, data,
+ page_zip_get_size(&bpage->zip), TRUE);
+
+ //buf_pool_mutex_exit_allow(buf_pool);
mutex_enter(&((buf_block_t*) bpage)->mutex);
page_zip_set_size(&bpage->zip, 0);
}
@@ -2030,7 +2143,10 @@ buf_LRU_block_free_hashed_page(
be in a state where it can be freed */
ibool have_page_hash_mutex)
{
- //ut_ad(buf_pool_mutex_own());
+#ifdef UNIV_DEBUG
+ //buf_pool_t* buf_pool = buf_pool_from_block(block);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+#endif
ut_ad(mutex_own(&block->mutex));
buf_block_set_state(block, BUF_BLOCK_MEMORY);
@@ -2039,17 +2155,18 @@ buf_LRU_block_free_hashed_page(
}
/**********************************************************************//**
-Updates buf_LRU_old_ratio.
+Updates buf_pool->LRU_old_ratio for one buffer pool instance.
@return updated old_pct */
-UNIV_INTERN
+static
uint
-buf_LRU_old_ratio_update(
-/*=====================*/
- uint old_pct,/*!< in: Reserve this percentage of
- the buffer pool for "old" blocks. */
- ibool adjust) /*!< in: TRUE=adjust the LRU list;
- FALSE=just assign buf_LRU_old_ratio
- during the initialization of InnoDB */
+buf_LRU_old_ratio_update_instance(
+/*==============================*/
+ buf_pool_t* buf_pool,/*!< in: buffer pool instance */
+ uint old_pct,/*!< in: Reserve this percentage of
+ the buffer pool for "old" blocks. */
+ ibool adjust) /*!< in: TRUE=adjust the LRU list;
+ FALSE=just assign buf_pool->LRU_old_ratio
+ during the initialization of InnoDB */
{
uint ratio;
@@ -2061,29 +2178,57 @@ buf_LRU_old_ratio_update(
}
if (adjust) {
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
- if (ratio != buf_LRU_old_ratio) {
- buf_LRU_old_ratio = ratio;
+ if (ratio != buf_pool->LRU_old_ratio) {
+ buf_pool->LRU_old_ratio = ratio;
if (UT_LIST_GET_LEN(buf_pool->LRU)
- >= BUF_LRU_OLD_MIN_LEN) {
- buf_LRU_old_adjust_len();
+ >= BUF_LRU_OLD_MIN_LEN) {
+
+ buf_LRU_old_adjust_len(buf_pool);
}
}
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
} else {
- buf_LRU_old_ratio = ratio;
+ buf_pool->LRU_old_ratio = ratio;
}
-
/* the reverse of
ratio = old_pct * BUF_LRU_OLD_RATIO_DIV / 100 */
return((uint) (ratio * 100 / (double) BUF_LRU_OLD_RATIO_DIV + 0.5));
}
+/**********************************************************************//**
+Updates buf_pool->LRU_old_ratio.
+@return updated old_pct */
+UNIV_INTERN
+ulint
+buf_LRU_old_ratio_update(
+/*=====================*/
+ uint old_pct,/*!< in: Reserve this percentage of
+ the buffer pool for "old" blocks. */
+ ibool adjust) /*!< in: TRUE=adjust the LRU list;
+ FALSE=just assign buf_pool->LRU_old_ratio
+ during the initialization of InnoDB */
+{
+ ulint i;
+ ulint new_ratio = 0;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ new_ratio = buf_LRU_old_ratio_update_instance(
+ buf_pool, old_pct, adjust);
+ }
+
+ return(new_ratio);
+}
+
/********************************************************************//**
Update the historical stats that we are collecting for LRU eviction
policy at the end of each interval. */
@@ -2092,30 +2237,45 @@ void
buf_LRU_stat_update(void)
/*=====================*/
{
+ ulint i;
buf_LRU_stat_t* item;
+ buf_pool_t* buf_pool;
+ ibool evict_started = FALSE;
+ buf_LRU_stat_t cur_stat;
/* If we haven't started eviction yet then don't update stats. */
- if (buf_pool->freed_page_clock == 0) {
- goto func_exit;
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+
+ buf_pool = buf_pool_from_array(i);
+
+ if (buf_pool->freed_page_clock != 0) {
+ evict_started = TRUE;
+ break;
+ }
}
- //buf_pool_mutex_enter();
- mutex_enter(&buf_pool_mutex);
+ if (!evict_started) {
+ goto func_exit;
+ }
/* Update the index. */
item = &buf_LRU_stat_arr[buf_LRU_stat_arr_ind];
buf_LRU_stat_arr_ind++;
buf_LRU_stat_arr_ind %= BUF_LRU_STAT_N_INTERVAL;
- /* Add the current value and subtract the obsolete entry. */
- buf_LRU_stat_sum.io += buf_LRU_stat_cur.io - item->io;
- buf_LRU_stat_sum.unzip += buf_LRU_stat_cur.unzip - item->unzip;
+ /* Add the current value and subtract the obsolete entry.
+ Since buf_LRU_stat_cur is not protected by any mutex,
+ it can be changing between adding to buf_LRU_stat_sum
+ and copying to item. Assign it to local variables to make
+ sure the same value assign to the buf_LRU_stat_sum
+ and item */
+ cur_stat = buf_LRU_stat_cur;
- /* Put current entry in the array. */
- memcpy(item, &buf_LRU_stat_cur, sizeof *item);
+ buf_LRU_stat_sum.io += cur_stat.io - item->io;
+ buf_LRU_stat_sum.unzip += cur_stat.unzip - item->unzip;
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ /* Put current entry in the array. */
+ memcpy(item, &cur_stat, sizeof *item);
func_exit:
/* Clear the current entry. */
@@ -2145,8 +2305,8 @@ buf_LRU_file_dump(void)
if (strstr(srv_data_file_names[i], LRU_DUMP_FILE) != NULL) {
fprintf(stderr,
" InnoDB: The name '%s' seems to be used for"
- " innodb_data_file_path. Dumping LRU list is not"
- " done for safeness.\n", LRU_DUMP_FILE);
+ " innodb_data_file_path. For safety, dumping of the LRU list"
+ " is not being done.\n", LRU_DUMP_FILE);
goto end;
}
}
@@ -2159,7 +2319,7 @@ buf_LRU_file_dump(void)
goto end;
}
- dump_file = os_file_create(LRU_DUMP_FILE, OS_FILE_OVERWRITE,
+ dump_file = os_file_create(innodb_file_temp_key, LRU_DUMP_FILE, OS_FILE_OVERWRITE,
OS_FILE_NORMAL, OS_DATA_FILE, &success);
if (!success) {
os_file_get_last_error(TRUE);
@@ -2168,39 +2328,46 @@ buf_LRU_file_dump(void)
goto end;
}
- mutex_enter(&LRU_list_mutex);
- bpage = UT_LIST_GET_LAST(buf_pool->LRU);
-
buffers = offset = 0;
- while (bpage != NULL) {
- if (offset == 0) {
- memset(buffer, 0, UNIV_PAGE_SIZE);
- }
- mach_write_to_4(buffer + offset * 4, bpage->space);
- offset++;
- mach_write_to_4(buffer + offset * 4, bpage->offset);
- offset++;
-
- if (offset == UNIV_PAGE_SIZE/4) {
- success = os_file_write(LRU_DUMP_FILE, dump_file, buffer,
- (buffers << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFFUL,
- (buffers >> (32 - UNIV_PAGE_SIZE_SHIFT)),
- UNIV_PAGE_SIZE);
- if (!success) {
- mutex_exit(&LRU_list_mutex);
- fprintf(stderr,
- " InnoDB: cannot write page %lu of %s\n",
- buffers, LRU_DUMP_FILE);
- goto end;
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ bpage = UT_LIST_GET_LAST(buf_pool->LRU);
+
+ while (bpage != NULL) {
+ if (offset == 0) {
+ memset(buffer, 0, UNIV_PAGE_SIZE);
}
- buffers++;
- offset = 0;
- }
- bpage = UT_LIST_GET_PREV(LRU, bpage);
+ mach_write_to_4(buffer + offset * 4, bpage->space);
+ offset++;
+ mach_write_to_4(buffer + offset * 4, bpage->offset);
+ offset++;
+
+ if (offset == UNIV_PAGE_SIZE/4) {
+ success = os_file_write(LRU_DUMP_FILE, dump_file, buffer,
+ (buffers << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFFUL,
+ (buffers >> (32 - UNIV_PAGE_SIZE_SHIFT)),
+ UNIV_PAGE_SIZE);
+ if (!success) {
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ fprintf(stderr,
+ " InnoDB: cannot write page %lu of %s\n",
+ buffers, LRU_DUMP_FILE);
+ goto end;
+ }
+ buffers++;
+ offset = 0;
+ }
+
+ bpage = UT_LIST_GET_PREV(LRU, bpage);
+ }
+ mutex_exit(&buf_pool->LRU_list_mutex);
}
- mutex_exit(&LRU_list_mutex);
if (offset == 0) {
memset(buffer, 0, UNIV_PAGE_SIZE);
@@ -2265,12 +2432,12 @@ buf_LRU_file_restore(void)
ulint req = 0;
ibool terminated = FALSE;
ibool ret = FALSE;
- dump_record_t* records= 0;
+ dump_record_t* records = NULL;
ulint size;
ulint size_high;
ulint length;
- dump_file = os_file_create_simple_no_error_handling(
+ dump_file = os_file_create_simple_no_error_handling(innodb_file_temp_key,
LRU_DUMP_FILE, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success || !os_file_get_size(dump_file, &size, &size_high)) {
os_file_get_last_error(TRUE);
@@ -2300,8 +2467,8 @@ buf_LRU_file_restore(void)
UNIV_PAGE_SIZE);
if (!success) {
fprintf(stderr,
- " InnoDB: cannot read page %lu of %s,"
- " or meet unexpected terminal.\n",
+ " InnoDB: either could not read page %lu of %s,"
+ " or terminated unexpectedly.\n",
buffers, LRU_DUMP_FILE);
goto end;
}
@@ -2353,7 +2520,7 @@ buf_LRU_file_restore(void)
if (offset % 16 == 15) {
os_aio_simulated_wake_handler_threads();
- buf_flush_free_margin(FALSE);
+ buf_flush_free_margins(FALSE);
}
zip_size = fil_space_get_zip_size(space_id);
@@ -2361,8 +2528,7 @@ buf_LRU_file_restore(void)
continue;
}
- if (fil_area_is_exist(space_id, zip_size, page_no, 0,
- zip_size ? zip_size : UNIV_PAGE_SIZE)) {
+ if (fil_is_exist(space_id, page_no)) {
tablespace_version = fil_space_get_version(space_id);
@@ -2376,7 +2542,7 @@ buf_LRU_file_restore(void)
}
os_aio_simulated_wake_handler_threads();
- buf_flush_free_margin(FALSE);
+ buf_flush_free_margins(FALSE);
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -2396,12 +2562,12 @@ end:
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/**********************************************************************//**
-Validates the LRU list.
-@return TRUE */
-UNIV_INTERN
-ibool
-buf_LRU_validate(void)
-/*==================*/
+Validates the LRU list for one buffer pool instance. */
+static
+void
+buf_LRU_validate_instance(
+/*======================*/
+ buf_pool_t* buf_pool)
{
buf_page_t* bpage;
buf_block_t* block;
@@ -2409,15 +2575,16 @@ buf_LRU_validate(void)
ulint new_len;
ut_ad(buf_pool);
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
ut_a(buf_pool->LRU_old);
old_len = buf_pool->LRU_old_len;
new_len = ut_min(UT_LIST_GET_LEN(buf_pool->LRU)
- * buf_LRU_old_ratio / BUF_LRU_OLD_RATIO_DIV,
+ * buf_pool->LRU_old_ratio
+ / BUF_LRU_OLD_RATIO_DIV,
UT_LIST_GET_LEN(buf_pool->LRU)
- (BUF_LRU_OLD_TOLERANCE
+ BUF_LRU_NON_OLD_MIN_LEN));
@@ -2470,8 +2637,8 @@ buf_LRU_validate(void)
ut_a(buf_pool->LRU_old_len == old_len);
- mutex_exit(&LRU_list_mutex);
- mutex_enter(&free_list_mutex);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ mutex_enter(&buf_pool->free_list_mutex);
UT_LIST_VALIDATE(free, buf_page_t, buf_pool->free,
ut_ad(ut_list_node_313->in_free_list));
@@ -2483,8 +2650,8 @@ buf_LRU_validate(void)
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_NOT_USED);
}
- mutex_exit(&free_list_mutex);
- mutex_enter(&LRU_list_mutex);
+ mutex_exit(&buf_pool->free_list_mutex);
+ mutex_enter(&buf_pool->LRU_list_mutex);
UT_LIST_VALIDATE(unzip_LRU, buf_block_t, buf_pool->unzip_LRU,
ut_ad(ut_list_node_313->in_unzip_LRU_list
@@ -2499,30 +2666,51 @@ buf_LRU_validate(void)
ut_a(buf_page_belongs_to_unzip_LRU(&block->page));
}
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+}
+
+/**********************************************************************//**
+Validates the LRU list.
+@return TRUE */
+UNIV_INTERN
+ibool
+buf_LRU_validate(void)
+/*==================*/
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ buf_LRU_validate_instance(buf_pool);
+ }
+
return(TRUE);
}
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
#if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/**********************************************************************//**
-Prints the LRU list. */
+Prints the LRU list for one buffer pool instance. */
UNIV_INTERN
void
-buf_LRU_print(void)
-/*===============*/
+buf_LRU_print_instance(
+/*===================*/
+ buf_pool_t* buf_pool)
{
const buf_page_t* bpage;
ut_ad(buf_pool);
- //buf_pool_mutex_enter();
- mutex_enter(&LRU_list_mutex);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
while (bpage != NULL) {
+ mutex_enter(buf_page_get_mutex(bpage));
fprintf(stderr, "BLOCK space %lu page %lu ",
(ulong) buf_page_get_space(bpage),
(ulong) buf_page_get_page_no(bpage));
@@ -2550,19 +2738,17 @@ buf_LRU_print(void)
case BUF_BLOCK_FILE_PAGE:
frame = buf_block_get_frame((buf_block_t*) bpage);
fprintf(stderr, "\ntype %lu"
- " index id %lu\n",
+ " index id %llu\n",
(ulong) fil_page_get_type(frame),
- (ulong) ut_dulint_get_low(
- btr_page_get_index_id(frame)));
+ (ullint) btr_page_get_index_id(frame));
break;
case BUF_BLOCK_ZIP_PAGE:
frame = bpage->zip.data;
fprintf(stderr, "\ntype %lu size %lu"
- " index id %lu\n",
+ " index id %llu\n",
(ulong) fil_page_get_type(frame),
(ulong) buf_page_get_zip_size(bpage),
- (ulong) ut_dulint_get_low(
- btr_page_get_index_id(frame)));
+ (ullint) btr_page_get_index_id(frame));
break;
default:
@@ -2571,10 +2757,27 @@ buf_LRU_print(void)
break;
}
+ mutex_exit(buf_page_get_mutex(bpage));
bpage = UT_LIST_GET_NEXT(LRU, bpage);
}
- //buf_pool_mutex_exit();
- mutex_exit(&LRU_list_mutex);
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+}
+
+/**********************************************************************//**
+Prints the LRU list. */
+UNIV_INTERN
+void
+buf_LRU_print(void)
+/*===============*/
+{
+ ulint i;
+ buf_pool_t* buf_pool;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool = buf_pool_from_array(i);
+ buf_LRU_print_instance(buf_pool);
+ }
}
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
diff --git a/storage/xtradb/buf/buf0rea.c b/storage/xtradb/buf/buf0rea.c
index 59de70d9a8a..587b982b3e0 100644
--- a/storage/xtradb/buf/buf0rea.c
+++ b/storage/xtradb/buf/buf0rea.c
@@ -37,6 +37,8 @@ Created 11/5/1995 Heikki Tuuri
#include "os0file.h"
#include "srv0start.h"
#include "srv0srv.h"
+#include "mysql/plugin.h"
+#include "mysql/service_thd_wait.h"
/** The linear read-ahead area size */
#define BUF_READ_AHEAD_LINEAR_AREA BUF_READ_AHEAD_AREA
@@ -178,6 +180,7 @@ not_to_recover:
ut_ad(buf_page_in_file(bpage));
+ thd_wait_begin(NULL, THD_WAIT_DISKIO);
if (zip_size) {
*err = _fil_io(OS_FILE_READ | wake_later,
sync, space, zip_size, offset, 0, zip_size,
@@ -189,6 +192,7 @@ not_to_recover:
sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
((buf_block_t*) bpage)->frame, bpage, trx);
}
+ thd_wait_end(NULL);
if (srv_pass_corrupt_table) {
if (*err != DB_SUCCESS) {
@@ -201,7 +205,7 @@ not_to_recover:
if (sync) {
/* The i/o is already completed when we arrive from
fil_read */
- buf_page_io_complete(bpage, trx);
+ buf_page_io_complete(bpage);
}
return(1);
@@ -222,6 +226,7 @@ buf_read_page(
ulint offset, /*!< in: page number */
trx_t* trx)
{
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
ib_int64_t tablespace_version;
ulint count;
ulint err;
@@ -246,7 +251,7 @@ buf_read_page(
}
/* Flush pages from the end of the LRU list if necessary */
- buf_flush_free_margin(FALSE);
+ buf_flush_free_margin(buf_pool, TRUE);
/* Increment number of I/O operations used for LRU policy. */
buf_LRU_stat_inc_io();
@@ -282,12 +287,13 @@ UNIV_INTERN
ulint
buf_read_ahead_linear(
/*==================*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
- ulint offset, /*!< in: page number of a page; NOTE: the current thread
- must want access to this page (see NOTE 3 above) */
+ ulint space, /*!< in: space id */
+ ulint zip_size, /*!< in: compressed page size in bytes, or 0 */
+ ulint offset, /*!< in: page number; see NOTE 3 above */
+ ibool inside_ibuf, /*!< in: TRUE if we are inside ibuf routine */
trx_t* trx)
{
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
ib_int64_t tablespace_version;
buf_page_t* bpage;
buf_frame_t* frame;
@@ -303,12 +309,12 @@ buf_read_ahead_linear(
ulint err;
ulint i;
const ulint buf_read_ahead_linear_area
- = BUF_READ_AHEAD_LINEAR_AREA;
+ = BUF_READ_AHEAD_LINEAR_AREA(buf_pool);
ulint threshold;
- if (!(srv_read_ahead & 2)) {
- return(0);
- }
+ if (!(srv_read_ahead & 2)) {
+ return(0);
+ }
if (UNIV_UNLIKELY(srv_startup_is_before_trx_rollback_phase)) {
/* No read-ahead to avoid thread deadlocks */
@@ -342,12 +348,10 @@ buf_read_ahead_linear(
tablespace_version = fil_space_get_version(space);
- //buf_pool_mutex_enter();
- mutex_enter(&buf_pool_mutex);
+ buf_pool_mutex_enter(buf_pool);
if (high > fil_space_get_size(space)) {
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
/* The area is not whole, return */
return(0);
@@ -355,12 +359,11 @@ buf_read_ahead_linear(
if (buf_pool->n_pend_reads
> buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
- //buf_pool_mutex_exit();
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
return(0);
}
- mutex_exit(&buf_pool_mutex);
+ buf_pool_mutex_exit(buf_pool);
/* Check that almost all pages in the area have been accessed; if
offset == low, the accesses must be in a descending order, otherwise,
@@ -375,15 +378,15 @@ buf_read_ahead_linear(
/* How many out of order accessed pages can we ignore
when working out the access pattern for linear readahead */
threshold = ut_min((64 - srv_read_ahead_threshold),
- BUF_READ_AHEAD_AREA);
+ BUF_READ_AHEAD_AREA(buf_pool));
fail_count = 0;
- rw_lock_s_lock(&page_hash_latch);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
for (i = low; i < high; i++) {
- bpage = buf_page_hash_get(space, i);
+ bpage = buf_page_hash_get(buf_pool, space, i);
- if ((bpage == NULL) || !buf_page_is_accessed(bpage)) {
+ if (bpage == NULL || !buf_page_is_accessed(bpage)) {
/* Not accessed */
fail_count++;
@@ -407,8 +410,8 @@ buf_read_ahead_linear(
if (fail_count > threshold) {
/* Too many failures: return */
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
return(0);
}
@@ -420,11 +423,11 @@ buf_read_ahead_linear(
/* If we got this far, we know that enough pages in the area have
been accessed in the right order: linear read-ahead can be sensible */
- bpage = buf_page_hash_get(space, offset);
+ bpage = buf_page_hash_get(buf_pool, space, offset);
if (bpage == NULL) {
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
return(0);
}
@@ -450,8 +453,8 @@ buf_read_ahead_linear(
pred_offset = fil_page_get_prev(frame);
succ_offset = fil_page_get_next(frame);
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
if ((offset == low) && (succ_offset == offset + 1)) {
@@ -487,11 +490,9 @@ buf_read_ahead_linear(
/* If we got this far, read-ahead can be sensible: do it */
- if (ibuf_inside()) {
- ibuf_mode = BUF_READ_IBUF_PAGES_ONLY;
- } else {
- ibuf_mode = BUF_READ_ANY_PAGE;
- }
+ ibuf_mode = inside_ibuf
+ ? BUF_READ_IBUF_PAGES_ONLY | OS_AIO_SIMULATED_WAKE_LATER
+ : BUF_READ_ANY_PAGE | OS_AIO_SIMULATED_WAKE_LATER;
count = 0;
@@ -508,7 +509,7 @@ buf_read_ahead_linear(
if (!ibuf_bitmap_page(zip_size, i)) {
count += buf_read_page_low(
&err, FALSE,
- ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
+ ibuf_mode,
space, zip_size, FALSE, tablespace_version, i, trx);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
@@ -530,7 +531,7 @@ buf_read_ahead_linear(
os_aio_simulated_wake_handler_threads();
/* Flush pages from the end of the LRU list if necessary */
- buf_flush_free_margin(FALSE);
+ buf_flush_free_margin(buf_pool, TRUE);
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) {
@@ -578,18 +579,21 @@ buf_read_ibuf_merge_pages(
{
ulint i;
- ut_ad(!ibuf_inside());
#ifdef UNIV_IBUF_DEBUG
ut_a(n_stored < UNIV_PAGE_SIZE);
#endif
- while (buf_pool->n_pend_reads
- > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
- os_thread_sleep(500000);
- }
for (i = 0; i < n_stored; i++) {
- ulint zip_size = fil_space_get_zip_size(space_ids[i]);
- ulint err;
+ ulint err;
+ buf_pool_t* buf_pool;
+ ulint zip_size = fil_space_get_zip_size(space_ids[i]);
+
+ buf_pool = buf_pool_get(space_ids[i], page_nos[i]);
+
+ while (buf_pool->n_pend_reads
+ > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
+ os_thread_sleep(500000);
+ }
if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
@@ -614,8 +618,8 @@ tablespace_deleted:
os_aio_simulated_wake_handler_threads();
- /* Flush pages from the end of the LRU list if necessary */
- buf_flush_free_margin(FALSE);
+ /* Flush pages from the end of all the LRU lists if necessary */
+ buf_flush_free_margins(FALSE);
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
@@ -708,11 +712,12 @@ not_to_recover:
tablespace_version = fil_space_get_version(space);
for (i = 0; i < n_stored; i++) {
+ buf_pool_t* buf_pool;
count = 0;
os_aio_print_debug = FALSE;
-
+ buf_pool = buf_pool_get(space, page_nos[i]);
while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) {
os_aio_simulated_wake_handler_threads();
@@ -751,8 +756,8 @@ not_to_recover:
os_aio_simulated_wake_handler_threads();
- /* Flush pages from the end of the LRU list if necessary */
- buf_flush_free_margin(FALSE);
+ /* Flush pages from the end of all the LRU lists if necessary */
+ buf_flush_free_margins(FALSE);
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
diff --git a/storage/xtradb/build/debian/README.Maintainer b/storage/xtradb/build/debian/README.Maintainer
deleted file mode 100644
index 9554bdd7c62..00000000000
--- a/storage/xtradb/build/debian/README.Maintainer
+++ /dev/null
@@ -1,116 +0,0 @@
-
-###########################
-## FIXME for 5.1 ##
-###########################
-
-* put this trigger-recreation thing into the init scripts -- what?!
-* Let debian-i10n-english review all template changes before the translaters start.
-* Mark debconf translations as obsolete with debconf-updatepo.
-
-###########################################################################
-# Here are some information that are only of interest for the current and #
-# following Debian maintainers of MySQL. #
-###########################################################################
-
-The debian/ directory is under SVN control, see debian/control for URL.
-
-#
-# Preparing a new version
-#
-The new orig.tar.gz (without non-free documentation) is created in /tmp/ when
-running this command:
-
-debian/rules get-orig-source
-
-#
-# mysqlreport
-#
-The authors e-mail address is <public@codenode.com>.
-
-#
-# Remarks to dependencies
-#
-libwrap0-dev (>= 7.6-8.3)
- According to bug report 114582 where where build problems on
- IA-64/sid with at least two prior versions.
-psmisc
- /usr/bin/killall in the initscript
-
-zlib1g in libmysqlclient-dev:
- "mysql_config --libs" ads "-lz"
-
-Build-Dep:
-
-debhelper (>=4.1.16):
- See po-debconf(7).
-
-autoconf (>= 2.13-20), automake1.7
- Try to get rid of them.
-
-doxygen, tetex-bin, tetex-extra, gs
- for ndb/docs/*tex
-
-#
-# Remarks to the start scripts
-#
-
-## initscripts rely on mysqladmin from a different package
-We have the problem that "/etc/init.d/mysql stop" relies on mysqladmin which
-is in another package (mysql-client) and a passwordless access that's maybe
-only available if the user configured his /root/.my.cnf. Can this be a problem?
-* normal mode: not because the user is required to have it. Else:
-* purge/remove: not, same as normal mode
-* upgrade: not, same as normal mode
-* first install: not, it depends on mysql-client which at least is unpacked
- so mysqladmin is there (to ping). It is not yet configured
- passwordles but if there's a server running then there's a
- /root/.my.cnf. Anyways, we simply kill anything that's mysqld.
-
-## Passwordless access for the maintainer scripts
-Another issue is that the scripts needs passwordless access. To ensure this
-a debian-sys-maint user is configured which has process and shutdown privs.
-The file with the randomly (that's important!) generated password must be
-present as long as the databases remain installed because else a new install
-would have no access. This file should be used like:
- mysqladmin --defaults-file=/etc/mysql/debian.cnf restart
-to avoid providing the password in plaintext on a commandline where it would
-be visible to any user via the "ps" command.
-
-## When to start the daemon?
-We aim to give the admin full control on when MySQL is running.
-Issues to be faced here:
-OLD:
- 1. Debconf asks whether MySQL should be started on boot so update-rc.d is
- only run if the answer has been yes. The admin is likely to forget
- this decision but update-rc.d checks for an existing line in
- /etc/runlevel.conf and leaves it intact.
- 2. On initial install, if the answer is yes, the daemon has to be started.
- 3. On upgrades it should only be started if it was already running, everything
- else is confusing. Especiall relying on an debconf decision made month ago
- is considered suboptimal. See bug #274264
- Implementation so far:
- prerm (called on upgrade before stopping the server):
- check for a running server and set flag if necessary
- preinst (called on initial install and before unpacking when upgrading):
- check for the debconf variable and set flag if necessary
- postinst (called on initial install and after each upgrade after unpacking):
- call update-rc.d if debconf says yes
- call invoce-rc.d if the flag has been set
- Problems remaining:
- dpkg-reconfigure and setting mysql start on boot to yes did not start mysql
- (ok "start on boot" literally does not mean "start now" so that might have been ok)
-NEW:
- 1. --- no debconf anymore for the sake of simplicity. We have runlevel.conf,
- the admin should use it
- 2. On initial install the server is started.
- 3. On upgrades the server is started exactly if it was running before so the
- runlevel configuration is irrelevant. It will be preserved by the mean of
- update-rc.d's builtin check.
- Implementation:
- prerm (called on upgrade before stopping the server):
- check for a running server and set flag if necessary
- preinst (called on initial install and before unpacking when upgrading):
- check for $1 beeing (initial) "install" and set flag
- postinst (called on initial install and after each upgrade after unpacking):
- call update-rc.d
- call invoce-rc.d if the flag has been set
diff --git a/storage/xtradb/build/debian/additions/Docs__Images__Makefile.in b/storage/xtradb/build/debian/additions/Docs__Images__Makefile.in
deleted file mode 100644
index f7316d4e345..00000000000
--- a/storage/xtradb/build/debian/additions/Docs__Images__Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-all:
-
-distclean:
- -rm -f Makefile
-
-.PHONY: all distclean clean install check
diff --git a/storage/xtradb/build/debian/additions/Docs__Makefile.in b/storage/xtradb/build/debian/additions/Docs__Makefile.in
deleted file mode 100644
index f7316d4e345..00000000000
--- a/storage/xtradb/build/debian/additions/Docs__Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-all:
-
-distclean:
- -rm -f Makefile
-
-.PHONY: all distclean clean install check
diff --git a/storage/xtradb/build/debian/additions/debian-start b/storage/xtradb/build/debian/additions/debian-start
deleted file mode 100644
index 10628019e40..00000000000
--- a/storage/xtradb/build/debian/additions/debian-start
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-#
-# This script is executed by "/etc/init.d/mysql" on every (re)start.
-#
-# Changes to this file will be preserved when updating the Debian package.
-#
-
-source /usr/share/mysql/debian-start.inc.sh
-
-MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
-MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
-MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf"
-MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
-MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
-MYCHECK_PARAMS="--all-databases --fast --silent"
-MYCHECK_RCPT="root"
-
-# The following commands should be run when the server is up but in background
-# where they do not block the server start and in one shell instance so that
-# they run sequentially. They are supposed not to echo anything to stdout.
-# If you want to disable the check for crashed tables comment
-# "check_for_crashed_tables" out.
-# (There may be no output to stdout inside the background process!)
-echo "Checking for corrupt, not cleanly closed and upgrade needing tables."
-(
- upgrade_system_tables_if_necessary;
- check_root_accounts;
- check_for_crashed_tables;
-) >&2 &
-
-exit 0
diff --git a/storage/xtradb/build/debian/additions/debian-start.inc.sh b/storage/xtradb/build/debian/additions/debian-start.inc.sh
deleted file mode 100644
index 736cb3448eb..00000000000
--- a/storage/xtradb/build/debian/additions/debian-start.inc.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-#
-# This file is included by /etc/mysql/debian-start
-#
-
-## Check all unclosed tables.
-# - Requires the server to be up.
-# - Is supposed to run silently in background.
-function check_for_crashed_tables() {
- set -e
- set -u
-
- # But do it in the background to not stall the boot process.
- logger -p daemon.info -i -t$0 "Triggering myisam-recover for all MyISAM tables"
-
- # Checking for $? is unreliable so the size of the output is checked.
- # Some table handlers like HEAP do not support CHECK TABLE.
- tempfile=`tempfile`
- # We have to use xargs in this case, because a for loop barfs on the
- # spaces in the thing to be looped over.
- LC_ALL=C $MYSQL --skip-column-names --batch -e '
- select concat("select count(*) into @discard from `",
- TABLE_SCHEMA, "`.`", TABLE_NAME, "`")
- from information_schema.TABLES where ENGINE="MyISAM"' | \
- xargs -i $MYSQL --skip-column-names --silent --batch \
- --force -e "{}" >$tempfile
- if [ -s $tempfile ]; then
- (
- /bin/echo -e "\n" \
- "Improperly closed tables are also reported if clients are accessing\n" \
- "the tables *now*. A list of current connections is below.\n";
- $MYADMIN processlist status
- ) >> $tempfile
- # Check for presence as a dependency on mailx would require an MTA.
- if [ -x /usr/bin/mailx ]; then
- mailx -e -s"$MYCHECK_SUBJECT" $MYCHECK_RCPT < $tempfile
- fi
- (echo "$MYCHECK_SUBJECT"; cat $tempfile) | logger -p daemon.warn -i -t$0
- fi
- rm $tempfile
-}
-
-## Check for tables needing an upgrade.
-# - Requires the server to be up.
-# - Is supposed to run silently in background.
-function upgrade_system_tables_if_necessary() {
- set -e
- set -u
-
- logger -p daemon.info -i -t$0 "Upgrading MySQL tables if necessary."
-
- # Filter all "duplicate column", "duplicate key" and "unknown column"
- # errors as the script is designed to be idempotent.
- LC_ALL=C $MYUPGRADE \
- 2>&1 \
- | egrep -v '^(1|@had|ERROR (1054|1060|1061))' \
- | logger -p daemon.warn -i -t$0
-}
-
-## Check for the presence of both, root accounts with and without password.
-# This might have been caused by a bug related to mysql_install_db (#418672).
-function check_root_accounts() {
- set -e
- set -u
-
- logger -p daemon.info -i -t$0 "Checking for insecure root accounts."
-
- ret=$( echo "SELECT count(*) FROM mysql.user WHERE user='root' and password='';" | $MYSQL --skip-column-names )
- if [ "$ret" -ne "0" ]; then
- logger -p daemon.warn -i -t$0 "WARNING: mysql.user contains $ret root accounts without password!"
- fi
-}
diff --git a/storage/xtradb/build/debian/additions/echo_stderr b/storage/xtradb/build/debian/additions/echo_stderr
deleted file mode 100644
index 67b3ed7cfb3..00000000000
--- a/storage/xtradb/build/debian/additions/echo_stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-echo "$*" 1>&2
diff --git a/storage/xtradb/build/debian/additions/innotop/InnoDBParser.pm b/storage/xtradb/build/debian/additions/innotop/InnoDBParser.pm
deleted file mode 100644
index 3aaa7acd5b8..00000000000
--- a/storage/xtradb/build/debian/additions/innotop/InnoDBParser.pm
+++ /dev/null
@@ -1,1089 +0,0 @@
-use strict;
-use warnings FATAL => 'all';
-
-package InnoDBParser;
-
-# This program is copyright (c) 2006 Baron Schwartz, baron at xaprb dot com.
-# Feedback and improvements are gratefully received.
-#
-# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-# 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; OR the Perl Artistic License. On UNIX and similar
-# systems, you can issue `man perlgpl' or `man perlartistic' to read these
-
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA
-
-our $VERSION = '1.6.0';
-
-use Data::Dumper;
-$Data::Dumper::Sortkeys = 1;
-use English qw(-no_match_vars);
-use List::Util qw(max);
-
-# Some common patterns
-my $d = qr/(\d+)/; # Digit
-my $f = qr/(\d+\.\d+)/; # Float
-my $t = qr/(\d+ \d+)/; # Transaction ID
-my $i = qr/((?:\d{1,3}\.){3}\d+)/; # IP address
-my $n = qr/([^`\s]+)/; # MySQL object name
-my $w = qr/(\w+)/; # Words
-my $fl = qr/([\w\.\/]+) line $d/; # Filename and line number
-my $h = qr/((?:0x)?[0-9a-f]*)/; # Hex
-my $s = qr/(\d{6} .\d:\d\d:\d\d)/; # InnoDB timestamp
-
-# If you update this variable, also update the SYNOPSIS in the pod.
-my %innodb_section_headers = (
- "TRANSACTIONS" => "tx",
- "BUFFER POOL AND MEMORY" => "bp",
- "SEMAPHORES" => "sm",
- "LOG" => "lg",
- "ROW OPERATIONS" => "ro",
- "INSERT BUFFER AND ADAPTIVE HASH INDEX" => "ib",
- "FILE I/O" => "io",
- "LATEST DETECTED DEADLOCK" => "dl",
- "LATEST FOREIGN KEY ERROR" => "fk",
-);
-
-my %parser_for = (
- tx => \&parse_tx_section,
- bp => \&parse_bp_section,
- sm => \&parse_sm_section,
- lg => \&parse_lg_section,
- ro => \&parse_ro_section,
- ib => \&parse_ib_section,
- io => \&parse_io_section,
- dl => \&parse_dl_section,
- fk => \&parse_fk_section,
-);
-
-my %fk_parser_for = (
- Transaction => \&parse_fk_transaction_error,
- Error => \&parse_fk_bad_constraint_error,
- Cannot => \&parse_fk_cant_drop_parent_error,
-);
-
-# A thread's proc_info can be at least 98 different things I've found in the
-# source. Fortunately, most of them begin with a gerunded verb. These are
-# the ones that don't.
-my %is_proc_info = (
- 'After create' => 1,
- 'Execution of init_command' => 1,
- 'FULLTEXT initialization' => 1,
- 'Reopen tables' => 1,
- 'Repair done' => 1,
- 'Repair with keycache' => 1,
- 'System lock' => 1,
- 'Table lock' => 1,
- 'Thread initialized' => 1,
- 'User lock' => 1,
- 'copy to tmp table' => 1,
- 'discard_or_import_tablespace' => 1,
- 'end' => 1,
- 'got handler lock' => 1,
- 'got old table' => 1,
- 'init' => 1,
- 'key cache' => 1,
- 'locks' => 1,
- 'malloc' => 1,
- 'query end' => 1,
- 'rename result table' => 1,
- 'rename' => 1,
- 'setup' => 1,
- 'statistics' => 1,
- 'status' => 1,
- 'table cache' => 1,
- 'update' => 1,
-);
-
-sub new {
- bless {}, shift;
-}
-
-# Parse the status and return it.
-# See srv_printf_innodb_monitor in innobase/srv/srv0srv.c
-# Pass in the text to parse, whether to be in debugging mode, which sections
-# to parse (hashref; if empty, parse all), and whether to parse full info from
-# locks and such (probably shouldn't unless you need to).
-sub parse_status_text {
- my ( $self, $fulltext, $debug, $sections, $full ) = @_;
-
- die "I can't parse undef" unless defined $fulltext;
- $fulltext =~ s/[\r\n]+/\n/g;
-
- $sections ||= {};
- die '$sections must be a hashref' unless ref($sections) eq 'HASH';
-
- my %innodb_data = (
- got_all => 0, # Whether I was able to get the whole thing
- ts => '', # Timestamp the server put on it
- last_secs => 0, # Num seconds the averages are over
- sections => {}, # Parsed values from each section
- );
-
- if ( $debug ) {
- $innodb_data{'fulltext'} = $fulltext;
- }
-
- # Get the most basic info about the status: beginning and end, and whether
- # I got the whole thing (if there has been a big deadlock and there are
- # too many locks to print, the output might be truncated)
- my ( $time_text ) = $fulltext =~ m/^$s INNODB MONITOR OUTPUT$/m;
- $innodb_data{'ts'} = [ parse_innodb_timestamp( $time_text ) ];
- $innodb_data{'timestring'} = ts_to_string($innodb_data{'ts'});
- ( $innodb_data{'last_secs'} ) = $fulltext
- =~ m/Per second averages calculated from the last $d seconds/;
-
- ( my $got_all ) = $fulltext =~ m/END OF INNODB MONITOR OUTPUT/;
- $innodb_data{'got_all'} = $got_all || 0;
-
- # Split it into sections. Each section begins with
- # -----
- # LABEL
- # -----
- my %innodb_sections;
- my @matches = $fulltext
- =~ m#\n(---+)\n([A-Z /]+)\n\1\n(.*?)(?=\n(---+)\n[A-Z /]+\n\4\n|$)#gs;
- while ( my ( $start, $name, $text, $end ) = splice(@matches, 0, 4) ) {
- $innodb_sections{$name} = [ $text, $end ? 1 : 0 ];
- }
- # The Row Operations section is a special case, because instead of ending
- # with the beginning of another section, it ends with the end of the file.
- # So this section is complete if the entire file is complete.
- $innodb_sections{'ROW OPERATIONS'}->[1] ||= $innodb_data{'got_all'};
-
- # Just for sanity's sake, make sure I understand what to do with each
- # section
- eval {
- foreach my $section ( keys %innodb_sections ) {
- my $header = $innodb_section_headers{$section};
- die "Unknown section $section in $fulltext\n"
- unless $header;
- $innodb_data{'sections'}->{ $header }
- ->{'fulltext'} = $innodb_sections{$section}->[0];
- $innodb_data{'sections'}->{ $header }
- ->{'complete'} = $innodb_sections{$section}->[1];
- }
- };
- if ( $EVAL_ERROR ) {
- _debug( $debug, $EVAL_ERROR);
- }
-
- # ################################################################
- # Parse the detailed data out of the sections.
- # ################################################################
- eval {
- foreach my $section ( keys %parser_for ) {
- if ( defined $innodb_data{'sections'}->{$section}
- && (!%$sections || (defined($sections->{$section} && $sections->{$section})) )) {
- $parser_for{$section}->(
- $innodb_data{'sections'}->{$section},
- $innodb_data{'sections'}->{$section}->{'complete'},
- $debug,
- $full )
- or delete $innodb_data{'sections'}->{$section};
- }
- else {
- delete $innodb_data{'sections'}->{$section};
- }
- }
- };
- if ( $EVAL_ERROR ) {
- _debug( $debug, $EVAL_ERROR);
- }
-
- return \%innodb_data;
-}
-
-# Parses the status text and returns it flattened out as a single hash.
-sub get_status_hash {
- my ( $self, $fulltext, $debug, $sections, $full ) = @_;
-
- # Parse the status text...
- my $innodb_status
- = $self->parse_status_text($fulltext, $debug, $sections, $full );
-
- # Flatten the hierarchical structure into a single list by grabbing desired
- # sections from it.
- return
- (map { 'IB_' . $_ => $innodb_status->{$_} } qw(timestring last_secs got_all)),
- (map { 'IB_bp_' . $_ => $innodb_status->{'sections'}->{'bp'}->{$_} }
- qw( writes_pending buf_pool_hit_rate total_mem_alloc buf_pool_reads
- awe_mem_alloc pages_modified writes_pending_lru page_creates_sec
- reads_pending pages_total buf_pool_hits writes_pending_single_page
- page_writes_sec pages_read pages_written page_reads_sec
- writes_pending_flush_list buf_pool_size add_pool_alloc
- dict_mem_alloc pages_created buf_free complete )),
- (map { 'IB_tx_' . $_ => $innodb_status->{'sections'}->{'tx'}->{$_} }
- qw( num_lock_structs history_list_len purge_done_for transactions
- purge_undo_for is_truncated trx_id_counter complete )),
- (map { 'IB_ib_' . $_ => $innodb_status->{'sections'}->{'ib'}->{$_} }
- qw( hash_table_size hash_searches_s non_hash_searches_s
- bufs_in_node_heap used_cells size free_list_len seg_size inserts
- merged_recs merges complete )),
- (map { 'IB_lg_' . $_ => $innodb_status->{'sections'}->{'lg'}->{$_} }
- qw( log_ios_done pending_chkp_writes last_chkp log_ios_s
- log_flushed_to log_seq_no pending_log_writes complete )),
- (map { 'IB_sm_' . $_ => $innodb_status->{'sections'}->{'sm'}->{$_} }
- qw( wait_array_size rw_shared_spins rw_excl_os_waits mutex_os_waits
- mutex_spin_rounds mutex_spin_waits rw_excl_spins rw_shared_os_waits
- waits signal_count reservation_count complete )),
- (map { 'IB_ro_' . $_ => $innodb_status->{'sections'}->{'ro'}->{$_} }
- qw( queries_in_queue n_reserved_extents main_thread_state
- main_thread_proc_no main_thread_id read_sec del_sec upd_sec ins_sec
- read_views_open num_rows_upd num_rows_ins num_rows_read
- queries_inside num_rows_del complete )),
- (map { 'IB_fk_' . $_ => $innodb_status->{'sections'}->{'fk'}->{$_} }
- qw( trigger parent_table child_index parent_index attempted_op
- child_db timestring fk_name records col_name reason txn parent_db
- type child_table parent_col complete )),
- (map { 'IB_io_' . $_ => $innodb_status->{'sections'}->{'io'}->{$_} }
- qw( pending_buffer_pool_flushes pending_pwrites pending_preads
- pending_normal_aio_reads fsyncs_s os_file_writes pending_sync_ios
- reads_s flush_type avg_bytes_s pending_ibuf_aio_reads writes_s
- threads os_file_reads pending_aio_writes pending_log_ios os_fsyncs
- pending_log_flushes complete )),
- (map { 'IB_dl_' . $_ => $innodb_status->{'sections'}->{'dl'}->{$_} }
- qw( timestring rolled_back txns complete ));
-
-}
-
-sub ts_to_string {
- my $parts = shift;
- return sprintf('%02d-%02d-%02d %02d:%02d:%02d', @$parts);
-}
-
-sub parse_innodb_timestamp {
- my $text = shift;
- my ( $y, $m, $d, $h, $i, $s )
- = $text =~ m/^(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)$/;
- die("Can't get timestamp from $text\n") unless $y;
- $y += 2000;
- return ( $y, $m, $d, $h, $i, $s );
-}
-
-sub parse_fk_section {
- my ( $section, $complete, $debug, $full ) = @_;
- my $fulltext = $section->{'fulltext'};
-
- return 0 unless $fulltext;
-
- my ( $ts, $type ) = $fulltext =~ m/^$s\s+(\w+)/m;
- $section->{'ts'} = [ parse_innodb_timestamp( $ts ) ];
- $section->{'timestring'} = ts_to_string($section->{'ts'});
- $section->{'type'} = $type;
-
- # Decide which type of FK error happened, and dispatch to the right parser.
- if ( $type && $fk_parser_for{$type} ) {
- $fk_parser_for{$type}->( $section, $complete, $debug, $fulltext, $full );
- }
-
- delete $section->{'fulltext'} unless $debug;
-
- return 1;
-}
-
-sub parse_fk_cant_drop_parent_error {
- my ( $section, $complete, $debug, $fulltext, $full ) = @_;
-
- # Parse the parent/child table info out
- @{$section}{ qw(attempted_op parent_db parent_table) } = $fulltext
- =~ m{Cannot $w table `(.*)/(.*)`}m;
- @{$section}{ qw(child_db child_table) } = $fulltext
- =~ m{because it is referenced by `(.*)/(.*)`}m;
-
- ( $section->{'reason'} ) = $fulltext =~ m/(Cannot .*)/s;
- $section->{'reason'} =~ s/\n(?:InnoDB: )?/ /gm
- if $section->{'reason'};
-
- # Certain data may not be present. Make them '' if not present.
- map { $section->{$_} ||= "" }
- qw(child_index fk_name col_name parent_col);
-}
-
-# See dict/dict0dict.c, function dict_foreign_error_report
-# I don't care much about these. There are lots of different messages, and
-# they come from someone trying to create a foreign key, or similar
-# statements. They aren't indicative of some transaction trying to insert,
-# delete or update data. Sometimes it is possible to parse out a lot of
-# information about the tables and indexes involved, but often the message
-# contains the DDL string the user entered, which is way too much for this
-# module to try to handle.
-sub parse_fk_bad_constraint_error {
- my ( $section, $complete, $debug, $fulltext, $full ) = @_;
-
- # Parse the parent/child table and index info out
- @{$section}{ qw(child_db child_table) } = $fulltext
- =~ m{Error in foreign key constraint of table (.*)/(.*):$}m;
- $section->{'attempted_op'} = 'DDL';
-
- # FK name, parent info... if possible.
- @{$section}{ qw(fk_name col_name parent_db parent_table parent_col) }
- = $fulltext
- =~ m/CONSTRAINT `?$n`? FOREIGN KEY \(`?$n`?\) REFERENCES (?:`?$n`?\.)?`?$n`? \(`?$n`?\)/;
-
- if ( !defined($section->{'fk_name'}) ) {
- # Try to parse SQL a user might have typed in a CREATE statement or such
- @{$section}{ qw(col_name parent_db parent_table parent_col) }
- = $fulltext
- =~ m/FOREIGN\s+KEY\s*\(`?$n`?\)\s+REFERENCES\s+(?:`?$n`?\.)?`?$n`?\s*\(`?$n`?\)/i;
- }
- $section->{'parent_db'} ||= $section->{'child_db'};
-
- # Name of the child index (index in the same table where the FK is, see
- # definition of dict_foreign_struct in include/dict0mem.h, where it is
- # called foreign_index, as opposed to referenced_index which is in the
- # parent table. This may not be possible to find.
- @{$section}{ qw(child_index) } = $fulltext
- =~ m/^The index in the foreign key in table is $n$/m;
-
- @{$section}{ qw(reason) } = $fulltext =~ m/:\s*([^:]+)(?= Constraint:|$)/ms;
- $section->{'reason'} =~ s/\s+/ /g
- if $section->{'reason'};
-
- # Certain data may not be present. Make them '' if not present.
- map { $section->{$_} ||= "" }
- qw(child_index fk_name col_name parent_table parent_col);
-}
-
-# see source file row/row0ins.c
-sub parse_fk_transaction_error {
- my ( $section, $complete, $debug, $fulltext, $full ) = @_;
-
- # Parse the txn info out
- my ( $txn ) = $fulltext
- =~ m/Transaction:\n(TRANSACTION.*)\nForeign key constraint fails/s;
- if ( $txn ) {
- $section->{'txn'} = parse_tx_text( $txn, $complete, $debug, $full );
- }
-
- # Parse the parent/child table and index info out. There are two types: an
- # update or a delete of a parent record leaves a child orphaned
- # (row_ins_foreign_report_err), and an insert or update of a child record has
- # no matching parent record (row_ins_foreign_report_add_err).
-
- @{$section}{ qw(reason child_db child_table) }
- = $fulltext =~ m{^(Foreign key constraint fails for table `(.*)/(.*)`:)$}m;
-
- @{$section}{ qw(fk_name col_name parent_db parent_table parent_col) }
- = $fulltext
- =~ m/CONSTRAINT `$n` FOREIGN KEY \(`$n`\) REFERENCES (?:`$n`\.)?`$n` \(`$n`\)/;
- $section->{'parent_db'} ||= $section->{'child_db'};
-
- # Special case, which I don't know how to trigger, but see
- # innobase/row/row0ins.c row_ins_check_foreign_constraint
- if ( $fulltext =~ m/ibd file does not currently exist!/ ) {
- my ( $attempted_op, $index, $records )
- = $fulltext =~ m/^Trying to (add to index) `$n` tuple:\n(.*))?/sm;
- $section->{'child_index'} = $index;
- $section->{'attempted_op'} = $attempted_op || '';
- if ( $records && $full ) {
- ( $section->{'records'} )
- = parse_innodb_record_dump( $records, $complete, $debug );
- }
- @{$section}{qw(parent_db parent_table)}
- =~ m/^But the parent table `$n`\.`$n`$/m;
- }
- else {
- my ( $attempted_op, $which, $index )
- = $fulltext =~ m/^Trying to ([\w ]*) in (child|parent) table, in index `$n` tuple:$/m;
- if ( $which ) {
- $section->{$which . '_index'} = $index;
- $section->{'attempted_op'} = $attempted_op || '';
-
- # Parse out the related records in the other table.
- my ( $search_index, $records );
- if ( $which eq 'child' ) {
- ( $search_index, $records ) = $fulltext
- =~ m/^But in parent table [^,]*, in index `$n`,\nthe closest match we can find is record:\n(.*)/ms;
- $section->{'parent_index'} = $search_index;
- }
- else {
- ( $search_index, $records ) = $fulltext
- =~ m/^But in child table [^,]*, in index `$n`, (?:the record is not available|there is a record:\n(.*))?/ms;
- $section->{'child_index'} = $search_index;
- }
- if ( $records && $full ) {
- $section->{'records'}
- = parse_innodb_record_dump( $records, $complete, $debug );
- }
- else {
- $section->{'records'} = '';
- }
- }
- }
-
- # Parse out the tuple trying to be updated, deleted or inserted.
- my ( $trigger ) = $fulltext =~ m/^(DATA TUPLE: \d+ fields;\n.*)$/m;
- if ( $trigger ) {
- $section->{'trigger'} = parse_innodb_record_dump( $trigger, $complete, $debug );
- }
-
- # Certain data may not be present. Make them '' if not present.
- map { $section->{$_} ||= "" }
- qw(child_index fk_name col_name parent_table parent_col);
-}
-
-# There are new-style and old-style record formats. See rem/rem0rec.c
-# TODO: write some tests for this
-sub parse_innodb_record_dump {
- my ( $dump, $complete, $debug ) = @_;
- return undef unless $dump;
-
- my $result = {};
-
- if ( $dump =~ m/PHYSICAL RECORD/ ) {
- my $style = $dump =~ m/compact format/ ? 'new' : 'old';
- $result->{'style'} = $style;
-
- # This is a new-style record.
- if ( $style eq 'new' ) {
- @{$result}{qw( heap_no type num_fields info_bits )}
- = $dump
- =~ m/^(?:Record lock, heap no $d )?([A-Z ]+): n_fields $d; compact format; info bits $d$/m;
- }
-
- # OK, it's old-style. Unfortunately there are variations here too.
- elsif ( $dump =~ m/-byte offs / ) {
- # Older-old style.
- @{$result}{qw( heap_no type num_fields byte_offset info_bits )}
- = $dump
- =~ m/^(?:Record lock, heap no $d )?([A-Z ]+): n_fields $d; $d-byte offs [A-Z]+; info bits $d$/m;
- if ( $dump !~ m/-byte offs TRUE/ ) {
- $result->{'byte_offset'} = 0;
- }
- }
- else {
- # Newer-old style.
- @{$result}{qw( heap_no type num_fields byte_offset info_bits )}
- = $dump
- =~ m/^(?:Record lock, heap no $d )?([A-Z ]+): n_fields $d; $d-byte offsets; info bits $d$/m;
- }
-
- }
- else {
- $result->{'style'} = 'tuple';
- @{$result}{qw( type num_fields )}
- = $dump =~ m/^(DATA TUPLE): $d fields;$/m;
- }
-
- # Fill in default values for things that couldn't be parsed.
- map { $result->{$_} ||= 0 }
- qw(heap_no num_fields byte_offset info_bits);
- map { $result->{$_} ||= '' }
- qw(style type );
-
- my @fields = $dump =~ m/ (\d+:.*?;?);(?=$| \d+:)/gm;
- $result->{'fields'} = [ map { parse_field($_, $complete, $debug ) } @fields ];
-
- return $result;
-}
-
-# New/old-style applies here. See rem/rem0rec.c
-# $text should not include the leading space or the second trailing semicolon.
-sub parse_field {
- my ( $text, $complete, $debug ) = @_;
-
- # Sample fields:
- # '4: SQL NULL, size 4 '
- # '1: len 6; hex 000000005601; asc V ;'
- # '6: SQL NULL'
- # '5: len 30; hex 687474703a2f2f7777772e737765657477617465722e636f6d2f73746f72; asc http://www.sweetwater.com/stor;...(truncated)'
- my ( $id, $nullsize, $len, $hex, $asc, $truncated );
- ( $id, $nullsize ) = $text =~ m/^$d: SQL NULL, size $d $/;
- if ( !defined($id) ) {
- ( $id ) = $text =~ m/^$d: SQL NULL$/;
- }
- if ( !defined($id) ) {
- ( $id, $len, $hex, $asc, $truncated )
- = $text =~ m/^$d: len $d; hex $h; asc (.*);(\.\.\.\(truncated\))?$/;
- }
-
- die "Could not parse this field: '$text'" unless defined $id;
- return {
- id => $id,
- len => defined($len) ? $len : defined($nullsize) ? $nullsize : 0,
- 'hex' => defined($hex) ? $hex : '',
- asc => defined($asc) ? $asc : '',
- trunc => $truncated ? 1 : 0,
- };
-
-}
-
-sub parse_dl_section {
- my ( $dl, $complete, $debug, $full ) = @_;
- return unless $dl;
- my $fulltext = $dl->{'fulltext'};
- return 0 unless $fulltext;
-
- my ( $ts ) = $fulltext =~ m/^$s$/m;
- return 0 unless $ts;
-
- $dl->{'ts'} = [ parse_innodb_timestamp( $ts ) ];
- $dl->{'timestring'} = ts_to_string($dl->{'ts'});
- $dl->{'txns'} = {};
-
- my @sections
- = $fulltext
- =~ m{
- ^\*{3}\s([^\n]*) # *** (1) WAITING FOR THIS...
- (.*?) # Followed by anything, non-greedy
- (?=(?:^\*{3})|\z) # Followed by another three stars or EOF
- }gmsx;
-
-
- # Loop through each section. There are no assumptions about how many
- # there are, who holds and wants what locks, and who gets rolled back.
- while ( my ($header, $body) = splice(@sections, 0, 2) ) {
- my ( $txn_id, $what ) = $header =~ m/^\($d\) (.*):$/;
- next unless $txn_id;
- $dl->{'txns'}->{$txn_id} ||= {};
- my $txn = $dl->{'txns'}->{$txn_id};
-
- if ( $what eq 'TRANSACTION' ) {
- $txn->{'tx'} = parse_tx_text( $body, $complete, $debug, $full );
- }
- else {
- push @{$txn->{'locks'}}, parse_innodb_record_locks( $body, $complete, $debug, $full );
- }
- }
-
- @{ $dl }{ qw(rolled_back) }
- = $fulltext =~ m/^\*\*\* WE ROLL BACK TRANSACTION \($d\)$/m;
-
- # Make sure certain values aren't undef
- map { $dl->{$_} ||= '' } qw(rolled_back);
-
- delete $dl->{'fulltext'} unless $debug;
- return 1;
-}
-
-sub parse_innodb_record_locks {
- my ( $text, $complete, $debug, $full ) = @_;
- my @result;
-
- foreach my $lock ( $text =~ m/(^(?:RECORD|TABLE) LOCKS?.*$)/gm ) {
- my $hash = {};
- @{$hash}{ qw(lock_type space_id page_no n_bits index db table txn_id lock_mode) }
- = $lock
- =~ m{^(RECORD|TABLE) LOCKS? (?:space id $d page no $d n bits $d index `?$n`? of )?table `$n(?:/|`\.`)$n` trx id $t lock.mode (\S+)}m;
- ( $hash->{'special'} )
- = $lock =~ m/^(?:RECORD|TABLE) .*? locks (rec but not gap|gap before rec)/m;
- $hash->{'insert_intention'}
- = $lock =~ m/^(?:RECORD|TABLE) .*? insert intention/m ? 1 : 0;
- $hash->{'waiting'}
- = $lock =~ m/^(?:RECORD|TABLE) .*? waiting/m ? 1 : 0;
-
- # Some things may not be in the text, so make sure they are not
- # undef.
- map { $hash->{$_} ||= 0 } qw(n_bits page_no space_id);
- map { $hash->{$_} ||= "" } qw(index special);
- push @result, $hash;
- }
-
- return @result;
-}
-
-sub parse_tx_text {
- my ( $txn, $complete, $debug, $full ) = @_;
-
- my ( $txn_id, $txn_status, $active_secs, $proc_no, $os_thread_id )
- = $txn
- =~ m/^(?:---)?TRANSACTION $t, (\D*?)(?: $d sec)?, (?:process no $d, )?OS thread id $d/m;
- my ( $thread_status, $thread_decl_inside )
- = $txn
- =~ m/OS thread id \d+(?: ([^,]+?))?(?:, thread declared inside InnoDB $d)?$/m;
-
- # Parsing the line that begins 'MySQL thread id' is complicated. The only
- # thing always in the line is the thread and query id. See function
- # innobase_mysql_print_thd in InnoDB source file sql/ha_innodb.cc.
- my ( $thread_line ) = $txn =~ m/^(MySQL thread id .*)$/m;
- my ( $mysql_thread_id, $query_id, $hostname, $ip, $user, $query_status );
-
- if ( $thread_line ) {
- # These parts can always be gotten.
- ( $mysql_thread_id, $query_id ) = $thread_line =~ m/^MySQL thread id $d, query id $d/m;
-
- # If it's a master/slave thread, "Has (read|sent) all" may be the thread's
- # proc_info. In these cases, there won't be any host/ip/user info
- ( $query_status ) = $thread_line =~ m/(Has (?:read|sent) all .*$)/m;
- if ( defined($query_status) ) {
- $user = 'system user';
- }
-
- # It may be the case that the query id is the last thing in the line.
- elsif ( $thread_line =~ m/query id \d+ / ) {
- # The IP address is the only non-word thing left, so it's the most
- # useful marker for where I have to start guessing.
- ( $hostname, $ip ) = $thread_line =~ m/query id \d+(?: ([A-Za-z]\S+))? $i/m;
- if ( defined $ip ) {
- ( $user, $query_status ) = $thread_line =~ m/$ip $w(?: (.*))?$/;
- }
- else { # OK, there wasn't an IP address.
- # There might not be ANYTHING except the query status.
- ( $query_status ) = $thread_line =~ m/query id \d+ (.*)$/;
- if ( $query_status !~ m/^\w+ing/ && !exists($is_proc_info{$query_status}) ) {
- # The remaining tokens are, in order: hostname, user, query_status.
- # It's basically impossible to know which is which.
- ( $hostname, $user, $query_status ) = $thread_line
- =~ m/query id \d+(?: ([A-Za-z]\S+))?(?: $w(?: (.*))?)?$/m;
- }
- else {
- $user = 'system user';
- }
- }
- }
- }
-
- my ( $lock_wait_status, $lock_structs, $heap_size, $row_locks, $undo_log_entries )
- = $txn
- =~ m/^(?:(\D*) )?$d lock struct\(s\), heap size $d(?:, $d row lock\(s\))?(?:, undo log entries $d)?$/m;
- my ( $lock_wait_time )
- = $txn
- =~ m/^------- TRX HAS BEEN WAITING $d SEC/m;
-
- my $locks;
- # If the transaction has locks, grab the locks.
- if ( $txn =~ m/^TABLE LOCK|RECORD LOCKS/ ) {
- $locks = [parse_innodb_record_locks($txn, $complete, $debug, $full)];
- }
-
- my ( $tables_in_use, $tables_locked )
- = $txn
- =~ m/^mysql tables in use $d, locked $d$/m;
- my ( $txn_doesnt_see_ge, $txn_sees_lt )
- = $txn
- =~ m/^Trx read view will not see trx with id >= $t, sees < $t$/m;
- my $has_read_view = defined($txn_doesnt_see_ge);
- # Only a certain number of bytes of the query text are included here, at least
- # under some circumstances. Some versions include 300, some 600.
- my ( $query_text )
- = $txn
- =~ m{
- ^MySQL\sthread\sid\s[^\n]+\n # This comes before the query text
- (.*?) # The query text
- (?= # Followed by any of...
- ^Trx\sread\sview
- |^-------\sTRX\sHAS\sBEEN\sWAITING
- |^TABLE\sLOCK
- |^RECORD\sLOCKS\sspace\sid
- |^(?:---)?TRANSACTION
- |^\*\*\*\s\(\d\)
- |\Z
- )
- }xms;
- if ( $query_text ) {
- $query_text =~ s/\s+$//;
- }
- else {
- $query_text = '';
- }
-
- my %stuff = (
- active_secs => $active_secs,
- has_read_view => $has_read_view,
- heap_size => $heap_size,
- hostname => $hostname,
- ip => $ip,
- lock_structs => $lock_structs,
- lock_wait_status => $lock_wait_status,
- lock_wait_time => $lock_wait_time,
- mysql_thread_id => $mysql_thread_id,
- os_thread_id => $os_thread_id,
- proc_no => $proc_no,
- query_id => $query_id,
- query_status => $query_status,
- query_text => $query_text,
- row_locks => $row_locks,
- tables_in_use => $tables_in_use,
- tables_locked => $tables_locked,
- thread_decl_inside => $thread_decl_inside,
- thread_status => $thread_status,
- txn_doesnt_see_ge => $txn_doesnt_see_ge,
- txn_id => $txn_id,
- txn_sees_lt => $txn_sees_lt,
- txn_status => $txn_status,
- undo_log_entries => $undo_log_entries,
- user => $user,
- );
- $stuff{'fulltext'} = $txn if $debug;
- $stuff{'locks'} = $locks if $locks;
-
- # Some things may not be in the txn text, so make sure they are not
- # undef.
- map { $stuff{$_} ||= 0 } qw(active_secs heap_size lock_structs
- tables_in_use undo_log_entries tables_locked has_read_view
- thread_decl_inside lock_wait_time proc_no row_locks);
- map { $stuff{$_} ||= "" } qw(thread_status txn_doesnt_see_ge
- txn_sees_lt query_status ip query_text lock_wait_status user);
- $stuff{'hostname'} ||= $stuff{'ip'};
-
- return \%stuff;
-}
-
-sub parse_tx_section {
- my ( $section, $complete, $debug, $full ) = @_;
- return unless $section && $section->{'fulltext'};
- my $fulltext = $section->{'fulltext'};
- $section->{'transactions'} = [];
-
- # Handle the individual transactions
- my @transactions = $fulltext =~ m/(---TRANSACTION \d.*?)(?=\n---TRANSACTION|$)/gs;
- foreach my $txn ( @transactions ) {
- my $stuff = parse_tx_text( $txn, $complete, $debug, $full );
- delete $stuff->{'fulltext'} unless $debug;
- push @{$section->{'transactions'}}, $stuff;
- }
-
- # Handle the general info
- @{$section}{ 'trx_id_counter' }
- = $fulltext =~ m/^Trx id counter $t$/m;
- @{$section}{ 'purge_done_for', 'purge_undo_for' }
- = $fulltext =~ m/^Purge done for trx's n:o < $t undo n:o < $t$/m;
- @{$section}{ 'history_list_len' } # This isn't present in some 4.x versions
- = $fulltext =~ m/^History list length $d$/m;
- @{$section}{ 'num_lock_structs' }
- = $fulltext =~ m/^Total number of lock structs in row lock hash table $d$/m;
- @{$section}{ 'is_truncated' }
- = $fulltext =~ m/^\.\.\. truncated\.\.\.$/m ? 1 : 0;
-
- # Fill in things that might not be present
- foreach ( qw(history_list_len) ) {
- $section->{$_} ||= 0;
- }
-
- delete $section->{'fulltext'} unless $debug;
- return 1;
-}
-
-# I've read the source for this section.
-sub parse_ro_section {
- my ( $section, $complete, $debug, $full ) = @_;
- return unless $section && $section->{'fulltext'};
- my $fulltext = $section->{'fulltext'};
-
- # Grab the info
- @{$section}{ 'queries_inside', 'queries_in_queue' }
- = $fulltext =~ m/^$d queries inside InnoDB, $d queries in queue$/m;
- ( $section->{ 'read_views_open' } )
- = $fulltext =~ m/^$d read views open inside InnoDB$/m;
- ( $section->{ 'n_reserved_extents' } )
- = $fulltext =~ m/^$d tablespace extents now reserved for B-tree/m;
- @{$section}{ 'main_thread_proc_no', 'main_thread_id', 'main_thread_state' }
- = $fulltext =~ m/^Main thread (?:process no. $d, )?id $d, state: (.*)$/m;
- @{$section}{ 'num_rows_ins', 'num_rows_upd', 'num_rows_del', 'num_rows_read' }
- = $fulltext =~ m/^Number of rows inserted $d, updated $d, deleted $d, read $d$/m;
- @{$section}{ 'ins_sec', 'upd_sec', 'del_sec', 'read_sec' }
- = $fulltext =~ m#^$f inserts/s, $f updates/s, $f deletes/s, $f reads/s$#m;
- $section->{'main_thread_proc_no'} ||= 0;
-
- map { $section->{$_} ||= 0 } qw(read_views_open n_reserved_extents);
- delete $section->{'fulltext'} unless $debug;
- return 1;
-}
-
-sub parse_lg_section {
- my ( $section, $complete, $debug, $full ) = @_;
- return unless $section;
- my $fulltext = $section->{'fulltext'};
-
- # Grab the info
- ( $section->{ 'log_seq_no' } )
- = $fulltext =~ m/Log sequence number \s*(\d.*)$/m;
- ( $section->{ 'log_flushed_to' } )
- = $fulltext =~ m/Log flushed up to \s*(\d.*)$/m;
- ( $section->{ 'last_chkp' } )
- = $fulltext =~ m/Last checkpoint at \s*(\d.*)$/m;
- @{$section}{ 'pending_log_writes', 'pending_chkp_writes' }
- = $fulltext =~ m/$d pending log writes, $d pending chkp writes/;
- @{$section}{ 'log_ios_done', 'log_ios_s' }
- = $fulltext =~ m#$d log i/o's done, $f log i/o's/second#;
-
- delete $section->{'fulltext'} unless $debug;
- return 1;
-}
-
-sub parse_ib_section {
- my ( $section, $complete, $debug, $full ) = @_;
- return unless $section && $section->{'fulltext'};
- my $fulltext = $section->{'fulltext'};
-
- # Some servers will output ibuf information for tablespace 0, as though there
- # might be many tablespaces with insert buffers. (In practice I believe
- # the source code shows there will only ever be one). I have to parse both
- # cases here, but I assume there will only be one.
- @{$section}{ 'size', 'free_list_len', 'seg_size' }
- = $fulltext =~ m/^Ibuf(?: for space 0)?: size $d, free list len $d, seg size $d,$/m;
- @{$section}{ 'inserts', 'merged_recs', 'merges' }
- = $fulltext =~ m/^$d inserts, $d merged recs, $d merges$/m;
-
- @{$section}{ 'hash_table_size', 'used_cells', 'bufs_in_node_heap' }
- = $fulltext =~ m/^Hash table size $d, used cells $d, node heap has $d buffer\(s\)$/m;
- @{$section}{ 'hash_searches_s', 'non_hash_searches_s' }
- = $fulltext =~ m{^$f hash searches/s, $f non-hash searches/s$}m;
-
- delete $section->{'fulltext'} unless $debug;
- return 1;
-}
-
-sub parse_wait_array {
- my ( $text, $complete, $debug, $full ) = @_;
- my %result;
-
- @result{ qw(thread waited_at_filename waited_at_line waited_secs) }
- = $text =~ m/^--Thread $d has waited at $fl for $f seconds/m;
-
- # Depending on whether it's a SYNC_MUTEX,RW_LOCK_EX,RW_LOCK_SHARED,
- # there will be different text output
- if ( $text =~ m/^Mutex at/m ) {
- $result{'request_type'} = 'M';
- @result{ qw( lock_mem_addr lock_cfile_name lock_cline lock_var) }
- = $text =~ m/^Mutex at $h created file $fl, lock var $d$/m;
- @result{ qw( waiters_flag )}
- = $text =~ m/^waiters flag $d$/m;
- }
- else {
- @result{ qw( request_type lock_mem_addr lock_cfile_name lock_cline) }
- = $text =~ m/^(.)-lock on RW-latch at $h created in file $fl$/m;
- @result{ qw( writer_thread writer_lock_mode ) }
- = $text =~ m/^a writer \(thread id $d\) has reserved it in mode (.*)$/m;
- @result{ qw( num_readers waiters_flag )}
- = $text =~ m/^number of readers $d, waiters flag $d$/m;
- @result{ qw(last_s_file_name last_s_line ) }
- = $text =~ m/Last time read locked in file $fl$/m;
- @result{ qw(last_x_file_name last_x_line ) }
- = $text =~ m/Last time write locked in file $fl$/m;
- }
-
- $result{'cell_waiting'} = $text =~ m/^wait has ended$/m ? 0 : 1;
- $result{'cell_event_set'} = $text =~ m/^wait is ending$/m ? 1 : 0;
-
- # Because there are two code paths, some things won't get set.
- map { $result{$_} ||= '' }
- qw(last_s_file_name last_x_file_name writer_lock_mode);
- map { $result{$_} ||= 0 }
- qw(num_readers lock_var last_s_line last_x_line writer_thread);
-
- return \%result;
-}
-
-sub parse_sm_section {
- my ( $section, $complete, $debug, $full ) = @_;
- return 0 unless $section && $section->{'fulltext'};
- my $fulltext = $section->{'fulltext'};
-
- # Grab the info
- @{$section}{ 'reservation_count', 'signal_count' }
- = $fulltext =~ m/^OS WAIT ARRAY INFO: reservation count $d, signal count $d$/m;
- @{$section}{ 'mutex_spin_waits', 'mutex_spin_rounds', 'mutex_os_waits' }
- = $fulltext =~ m/^Mutex spin waits $d, rounds $d, OS waits $d$/m;
- @{$section}{ 'rw_shared_spins', 'rw_shared_os_waits', 'rw_excl_spins', 'rw_excl_os_waits' }
- = $fulltext =~ m/^RW-shared spins $d, OS waits $d; RW-excl spins $d, OS waits $d$/m;
-
- # Look for info on waits.
- my @waits = $fulltext =~ m/^(--Thread.*?)^(?=Mutex spin|--Thread)/gms;
- $section->{'waits'} = [ map { parse_wait_array($_, $complete, $debug) } @waits ];
- $section->{'wait_array_size'} = scalar(@waits);
-
- delete $section->{'fulltext'} unless $debug;
- return 1;
-}
-
-# I've read the source for this section.
-sub parse_bp_section {
- my ( $section, $complete, $debug, $full ) = @_;
- return unless $section && $section->{'fulltext'};
- my $fulltext = $section->{'fulltext'};
-
- # Grab the info
- @{$section}{ 'total_mem_alloc', 'add_pool_alloc' }
- = $fulltext =~ m/^Total memory allocated $d; in additional pool allocated $d$/m;
- @{$section}{'dict_mem_alloc'} = $fulltext =~ m/Dictionary memory allocated $d/;
- @{$section}{'awe_mem_alloc'} = $fulltext =~ m/$d MB of AWE memory/;
- @{$section}{'buf_pool_size'} = $fulltext =~ m/^Buffer pool size\s*$d$/m;
- @{$section}{'buf_free'} = $fulltext =~ m/^Free buffers\s*$d$/m;
- @{$section}{'pages_total'} = $fulltext =~ m/^Database pages\s*$d$/m;
- @{$section}{'pages_modified'} = $fulltext =~ m/^Modified db pages\s*$d$/m;
- @{$section}{'pages_read', 'pages_created', 'pages_written'}
- = $fulltext =~ m/^Pages read $d, created $d, written $d$/m;
- @{$section}{'page_reads_sec', 'page_creates_sec', 'page_writes_sec'}
- = $fulltext =~ m{^$f reads/s, $f creates/s, $f writes/s$}m;
- @{$section}{'buf_pool_hits', 'buf_pool_reads'}
- = $fulltext =~ m{Buffer pool hit rate $d / $d$}m;
- if ($fulltext =~ m/^No buffer pool page gets since the last printout$/m) {
- @{$section}{'buf_pool_hits', 'buf_pool_reads'} = (0, 0);
- @{$section}{'buf_pool_hit_rate'} = '--';
- }
- else {
- @{$section}{'buf_pool_hit_rate'}
- = $fulltext =~ m{Buffer pool hit rate (\d+ / \d+)$}m;
- }
- @{$section}{'reads_pending'} = $fulltext =~ m/^Pending reads $d/m;
- @{$section}{'writes_pending_lru', 'writes_pending_flush_list', 'writes_pending_single_page' }
- = $fulltext =~ m/^Pending writes: LRU $d, flush list $d, single page $d$/m;
-
- map { $section->{$_} ||= 0 }
- qw(writes_pending_lru writes_pending_flush_list writes_pending_single_page
- awe_mem_alloc dict_mem_alloc);
- @{$section}{'writes_pending'} = List::Util::sum(
- @{$section}{ qw(writes_pending_lru writes_pending_flush_list writes_pending_single_page) });
-
- delete $section->{'fulltext'} unless $debug;
- return 1;
-}
-
-# I've read the source for this.
-sub parse_io_section {
- my ( $section, $complete, $debug, $full ) = @_;
- return unless $section && $section->{'fulltext'};
- my $fulltext = $section->{'fulltext'};
- $section->{'threads'} = {};
-
- # Grab the I/O thread info
- my @threads = $fulltext =~ m<^(I/O thread \d+ .*)$>gm;
- foreach my $thread (@threads) {
- my ( $tid, $state, $purpose, $event_set )
- = $thread =~ m{I/O thread $d state: (.+?) \((.*)\)(?: ev set)?$}m;
- if ( defined $tid ) {
- $section->{'threads'}->{$tid} = {
- thread => $tid,
- state => $state,
- purpose => $purpose,
- event_set => $event_set ? 1 : 0,
- };
- }
- }
-
- # Grab the reads/writes/flushes info
- @{$section}{ 'pending_normal_aio_reads', 'pending_aio_writes' }
- = $fulltext =~ m/^Pending normal aio reads: $d, aio writes: $d,$/m;
- @{$section}{ 'pending_ibuf_aio_reads', 'pending_log_ios', 'pending_sync_ios' }
- = $fulltext =~ m{^ ibuf aio reads: $d, log i/o's: $d, sync i/o's: $d$}m;
- @{$section}{ 'flush_type', 'pending_log_flushes', 'pending_buffer_pool_flushes' }
- = $fulltext =~ m/^Pending flushes \($w\) log: $d; buffer pool: $d$/m;
- @{$section}{ 'os_file_reads', 'os_file_writes', 'os_fsyncs' }
- = $fulltext =~ m/^$d OS file reads, $d OS file writes, $d OS fsyncs$/m;
- @{$section}{ 'reads_s', 'avg_bytes_s', 'writes_s', 'fsyncs_s' }
- = $fulltext =~ m{^$f reads/s, $d avg bytes/read, $f writes/s, $f fsyncs/s$}m;
- @{$section}{ 'pending_preads', 'pending_pwrites' }
- = $fulltext =~ m/$d pending preads, $d pending pwrites$/m;
- @{$section}{ 'pending_preads', 'pending_pwrites' } = (0, 0)
- unless defined($section->{'pending_preads'});
-
- delete $section->{'fulltext'} unless $debug;
- return 1;
-}
-
-sub _debug {
- my ( $debug, $msg ) = @_;
- if ( $debug ) {
- die $msg;
- }
- else {
- warn $msg;
- }
- return 1;
-}
-
-1;
-
-# end_of_package
-# ############################################################################
-# Perldoc section. I put this last as per the Dog book.
-# ############################################################################
-=pod
-
-=head1 NAME
-
-InnoDBParser - Parse InnoDB monitor text.
-
-=head1 DESCRIPTION
-
-InnoDBParser tries to parse the output of the InnoDB monitor. One way to get
-this output is to connect to a MySQL server and issue the command SHOW ENGINE
-INNODB STATUS (omit 'ENGINE' on earlier versions of MySQL). The goal is to
-turn text into data that something else (e.g. innotop) can use.
-
-The output comes from all over, but the place to start in the source is
-innobase/srv/srv0srv.c.
-
-=head1 SYNOPSIS
-
- use InnoDBParser;
- use DBI;
-
- # Get the status text.
- my $dbh = DBI->connect(
- "DBI::mysql:test;host=localhost",
- 'user',
- 'password'
- );
- my $query = 'SHOW /*!5 ENGINE */ INNODB STATUS';
- my $text = $dbh->selectcol_arrayref($query)->[0];
-
- # 1 or 0
- my $debug = 1;
-
- # Choose sections of the monitor text you want. Possible values:
- # TRANSACTIONS => tx
- # BUFFER POOL AND MEMORY => bp
- # SEMAPHORES => sm
- # LOG => lg
- # ROW OPERATIONS => ro
- # INSERT BUFFER AND ADAPTIVE HASH INDEX => ib
- # FILE I/O => io
- # LATEST DETECTED DEADLOCK => dl
- # LATEST FOREIGN KEY ERROR => fk
-
- my $required_sections = {
- tx => 1,
- };
-
- # Parse the status text.
- my $parser = InnoDBParser->new;
- $innodb_status = $parser->parse_status_text(
- $text,
- $debug,
- # Omit the following parameter to get all sections.
- $required_sections,
- );
-
-=head1 COPYRIGHT, LICENSE AND WARRANTY
-
-This package is copyright (c) 2006 Baron Schwartz, baron at xaprb dot com.
-Feedback and improvements are gratefully received.
-
-THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-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; OR the Perl Artistic License. On UNIX and similar
-systems, you can issue `man perlgpl' or `man perlartistic' to read these
-licenses.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-=head1 AUTHOR
-
-Baron Schwartz, baron at xaprb dot com.
-
-=head1 BUGS
-
-None known, but I bet there are some. The InnoDB monitor text wasn't really
-designed to be parsable.
-
-=head1 SEE ALSO
-
-innotop - a program that can format the parsed status information for humans
-to read and enjoy.
-
-=cut
diff --git a/storage/xtradb/build/debian/additions/innotop/changelog.innotop b/storage/xtradb/build/debian/additions/innotop/changelog.innotop
deleted file mode 100644
index baff706e235..00000000000
--- a/storage/xtradb/build/debian/additions/innotop/changelog.innotop
+++ /dev/null
@@ -1,318 +0,0 @@
-Changelog for innotop and InnoDBParser:
-
-2007-11-09: version 1.6.0
-
- * S mode crashed on non-numeric values.
- * New user-defined columns crashed upon restart.
- * Added --color option to control terminal coloring.
-
-2007-09-18: version 1.5.2
-
- * Added the ability to monitor InnoDB status from a file.
- * Changed W mode to L mode; it monitors all locks, not just lock waits.
-
-2007-09-16: version 1.5.1
-
- * Added C (Command Summary) mode.
- * Fixed a bug in the 'avg' aggregate function.
-
-2007-09-10: version 1.5.0
-
- Changes:
- * Added plugin functionality.
- * Added group-by functionality.
- * Moved the configuration file to a directory.
- * Enhanced filtering and sorting on pivoted tables.
- * Many small bug fixes.
-
-2007-07-16: version 1.4.3
-
- Changes:
- * Added standard --version command-line option
- * Changed colors to cyan instead of blue; more visible on dark terminals.
- * Added information to the filter-choosing dialog.
- * Added column auto-completion when entering a filter expression.
- * Changed Term::ReadKey from optional to mandatory.
- * Clarified username in password prompting.
- * Ten thousand words of documentation!
-
- Bugs fixed:
- * innotop crashed in W mode when InnoDB status data was truncated.
- * innotop didn't display errors in tables if debug was enabled.
- * The colored() subroutine wasn't being created in non-interactive mode.
- * Don't prompt to save password except the first time.
-
-2007-05-03: version 1.4.2
-
- This version contains all changes to the trunk until revision 239; some
- changes in revisions 240:250 are included.
-
- MAJOR CHANGES:
-
- * Quick-filters to easily filter any column in any display
- * Compatibility with MySQL 3.23 through 6.0
- * Improved error handling when a server is down, permissions denied, etc
- * Use additional SHOW INNODB STATUS information in 5.1.x
- * Make all modes use tables consistently, so they can all be edited,
- filtered, colored and sorted consistently
- * Combine V, G and S modes into S mode, with v, g, and s hot-keys
- * Let DBD driver read MySQL option files; permit connections without
- user/pass/etc
- * Compile SQL-like expressions into Perl subroutines; eliminate need to
- know Perl
- * Do not save all config data to config file, only save user's customizations
- * Rewritten and improved command-line option handling
- * Added --count, --delay, and other command-line options to support
- run-and-exit operation
- * Improve built-in variable sets
- * Improve help screen with three-part balanced-column layout
- * Simplify table-editor and improve hotkey support
- * Require Perl to have high-resolution time support (Time::HiRes)
- * Help the user choose a query to analyze or kill
- * Enable EXPLAIN, show-full-query in T mode just like Q mode
- * Let data-extraction access current, previous and incremental data sets
- all at once
-
- MINOR CHANGES:
-
- * Column stabilizing for Q mode
- * New color rules for T, Q, W modes
- * Apply slave I/O filter to Q mode
- * Improve detection of server version and other meta-data
- * Make connection timeout a config variable
- * Improve cross-version-compatible SQL syntax
- * Get some information from the DBD driver instead of asking MySQL for it
- * Improved error messages
- * Improve server group creation/editing
- * Improve connection/thread killing
- * Fix broken key bindings and restore previously mapped hot-keys for
- choosing columns
- * Some documentation updates (but not nearly enough)
- * Allow the user to specify graphing char in S mode (formerly G mode)
- * Allow easy switching between variable sets in S mode
- * Bind 'n' key globally to choose the 'next' server connection
- * Bind '%' key globally to filter displayed tables
- * Allow aligning columns on the decimal place for easy readability
- * Add hide_hdr config variable to hide column headers in tables
- * Add a feature to smartly run PURGE MASTER LOGS in Replication mode
- * Enable debug mode as a globally configurable variable
- * Improve error messages when an expression or filter doesn't compile or has
- a run-time error; die on error when debug is enabled
- * Allow user-configurable delays after executing SQL (to let the server
- settle down before taking another measurement)
- * Add an expression to show how long until a transaction is finished
- * Add skip_innodb as a global config variable
- * Add '%' after percentages to help disambiguate (user-configurable)
- * Add column to M mode to help see how fast slave is catching up to master
-
- BUG FIXES:
-
- * T and W modes had wrong value for wait_status column
- * Error tracking on connections didn't reset when the connection recovered
- * wait_timeout on connections couldn't be set before MySQL 4.0.3
- * There was a crash on 3.23 when wiping deadlocks
- * Lettercase changes in some result sets (SHOW MASTER/SLAVE STATUS) between
- MySQL versions crashed innotop
- * Inactive connections crashed innotop upon access to DBD driver
- * set_precision did not respect user defaults for number of digits
- * --inc command-line option could not be negated
- * InnoDB status parsing was not always parsing all needed information
- * S mode (formerly G mode) could crash trying to divide non-numeric data
- * M table didn't show Slave_open_temp_tables variable; incorrect lettercase
- * DBD drivers with broken AutoCommit would crash innotop
- * Some key bindings had incorrect labels
- * Some config-file loading routines could load data for things that didn't
- exist
- * Headers printed too often in S mode
- * High-resolution time was not used even when the user had it
- * Non-interactive mode printed blank lines sometimes
- * Q-mode header and statusbar showed different QPS numbers
- * Formulas for key-cache and query-cache hit ratios were wrong
- * Mac OS "Darwin" machines were mis-identified as Microsoft Windows
- * Some multiplications crashed when given undefined input
- * The commify transformation did not check its input and could crash
- * Specifying an invalid mode on the command line or config file could crash
- innotop
-
-2007-03-29: version 1.4.1
-
- * More tweaks to display of connection errors.
- * Fixed a problem with skip-innodb in MySQL 5.1.
- * Fix a bug with dead connections in single-connection mode.
- * Fix a regex to allow parsing more data from truncated deadlocks.
- * Don't load active cxns from the config file if the cxn isn't defined.
-
-2007-03-03: version 1.4.0
-
- * Further tweak error handling and display of connection errors
- * More centralization of querying
- * Fix forking so it doesn't kill all database connections
- * Allow user to run innotop without permissions for GLOBAL variables and status
-
-2007-02-11: version 1.3.6
-
- * Handle some connection failures so innotop doesn't crash because of one server.
- * Enable incremental display in more modes.
- * Tweaks to colorizing, color editor, and default color rules.
- * Tweaks to default sorting rules.
- * Use prepared statements for efficiency.
- * Bug fixes and code cleanups.
- * Data storage is keyed on clock ticks now.
-
-2007-02-03: version 1.3.5
-
- * Bug fixes.
- * More tools for editing configuration from within innotop.
- * Filters and transformations are constrained to valid values.
- * Support for colorizing rows.
- * Sorting by multiple columns.
- * Compress headers when display is very wide.
- * Stabilize and limit column widths.
- * Check config file formats when upgrading so upgrades go smoothly.
- * Make D mode handle many connections at once.
- * Extract simple expressions from data sets in column src property.
- This makes innotop more awk-ish.
-
-2007-01-16: version 1.3
-
- * Readline support.
- * Can be used unattended, or in a pipe-and-filter mode
- where it outputs tab-separated data to standard output.
- * You can specify a config file on the command line.
- Config files can be marked read-only.
- * Monitor multiple servers simultaneously.
- * Server groups to help manage many servers conveniently.
- * Monitor master/slave status, and control slaves.
- * Columns can have user-defined expressions as their data sources.
- * Better configuration tools.
- * InnoDB status information is merged into SHOW VARIABLES and
- SHOW STATUS information, so you can access it all together.
- * High-precision time support in more places.
- * Lots of tweaks to make things display more readably and compactly.
- * Column transformations and filters.
-
-2007-01-16: version 1.0.1
- * NOTE: innotop is now hosted at Sourceforge, in Subversion not CVS.
- The new project homepage is http://sourceforge.net/projects/innotop/
- * Tweak default T/Q mode sort columns to match what people expect.
- * Fix broken InnoDBParser.pm documentation (and hence man page).
-
-2007-01-06: version 1.0
- * NOTE: innotop is now hosted at Sourceforge, in Subversion not CVS.
- The new project homepage is http://sourceforge.net/projects/innotop/
- * Prevent control characters from freaking terminal out.
- * Set timeout to keep busy servers from closing connection.
- * There is only one InnoDB insert buffer.
- * Make licenses clear and consistent.
-
-2006-11-14: innotop 0.1.160, InnoDBParser version 1.69
- * Support for ANSI color on Microsoft Windows (more readable, compact
- display; thanks Gisbert W. Selke).
- * Better handling of $ENV{HOME} on Windows.
- * Added a LICENSE file to the package as per Gentoo bug:
- http://bugs.gentoo.org/show_bug.cgi?id=147600
-
-2006-11-11: innotop 0.1.157, InnoDBParser version 1.69
- * Add Microsoft Windows support.
-
-2006-10-19: innotop 0.1.154, InnoDBParser version 1.69
- * Add O (Open Tables) mode
- * Add some more checks to handle incomplete InnoDB status information
-
-2006-09-30: innotop 0.1.152, InnoDBParser version 1.69
- * Figured out what was wrong with package $VERSION variable: it wasn't
- after the package declaration!
-
-2006-09-28: innotop 0.1.152, InnoDBParser version 1.67
- * Make more efforts towards crash-resistance and tolerance of completely
- messed-up inputs. If innotop itself is broken, it is now much harder to
- tell, because it just keeps on running without complaining.
- * Fix a small bug parsing out some information and displaying it.
-
-2006-09-05: innotop 0.1.149, InnoDBParser version 1.64
- * Try to find and eliminate any parsing code that assumes pattern matches
- will succeed.
-
-2006-09-05: innotop 0.1.149, InnoDBParser version 1.62
- * Make innotop crash-resistant, so I can declare it STABLE finally.
- * Instead of using SQL conditional comments, detect MySQL version.
-
-2006-08-22: innotop 0.1.147, InnoDBParser version 1.60
- * Fix some innotop bugs with undefined values, bad formatting etc.
-
-2006-08-19: innotop 0.1.146, InnoDBParser version 1.60
- * Make innotop handle some unexpected NULL values in Q mode.
- * Add OS wait information to W mode, so it is now "everything that waits."
- * Center section captions better.
- * Make R mode more readable and compact.
- * Make InnoDBParser parse lock waits even when they've been waiting 0 secs.
-
-2006-08-12: innotop 0.1.139, InnoDBParser version 1.59
- * Add more documentation
- * Tweak V mode to show more info in less space.
- * Fix a bug in G mode.
-
-2006-08-10: innotop 0.1.132, InnoDBParser version 1.58
- * Handle yet more types of FK error... it will never end!
- * Handle some special cases when DEADLOCK info truncated
- * Add a bit more FK info to F mode in innotop
- * More tests added to the test suite
-
-2006-08-07: innotop 0.1.131, InnoDBParser version 1.55
- * Fix another issue with configuration
- * Handle another type of FK error
-
-2006-08-03: innotop 0.1.130, InnoDBParser version 1.54
- * Fix an issue loading config file
- * Add heap_no to 'D' (InnoDB Deadlock) mode to ease deadlock debugging.
-
-2006-08-02: innotop 0.1.128, InnoDBParser version 1.54
- * Parse lock wait information from the TRANSACTION section.
- * Even more OS-specific parsing... pain in the butt...
- * Add 'W' (InnoDB Lock Wait) mode.
- * Fix some minor display issues with statusbar.
-
-2006-08-02: innotop 0.1.125, InnoDBParser version 1.50
- * Don't try to get references to Perl built-in functions like time()
- * Handle more OS-specific variations of InnoDB status text
- * Add some more information to various places in innotop
-
-2006-08-01: innotop 0.1.123, InnoDBParser version 1.47
-
- * Enhance S and G modes: clear screen and re-print headers
- * Don't crash when deadlock data is truncated
- * Make Analyze mode say how to get back to whatever you came from
- * Display 'nothing to display' when there is nothing
- * Add ability to read InnoDB status text from a file (mostly helps test)
- * Add table of Wait Array Information in Row Op/Semaphore mode
- * Add table of lock information in InnoDB deadlock mode
- * Ensure new features in upgrades don't get masked by existing config files
- * Tweak default column choices for T mode
- * Enhance foreign key parsing
- * Enhance physical record and data tuple parsing
- * Enhance lock parsing (handle old-style and new-style formats)
-
-2006-07-24: innotop 0.1.112, InnoDBParser version 1.36
-
- * InnoDBParser enhancements for FK error messages.
- * A fix to innotop to prevent it from crashing while trying to display a FK
- error message.
- * Some minor cosmetic changes to number formatting in innotop.
-
-2006-07-22: innotop 0.1.106, InnoDBParser version 1.35
-
- * InnoDBParser is much more complete and accurate.
- * Tons of bug fixes.
- * Add partitions to EXPLAIN mode.
- * Enhance Q mode header, add T mode header.
- * Share some configuration variables across modes.
- * Add formatted time columns to Q, T modes.
- * Add command-line argument parsing.
- * Turn off echo when asking for password.
- * Add option to specify port when connecting.
- * Let display-optimized-query display multiple notes.
- * Lots of small improvements, such as showing more info in statusbar.
-
-2006-07-02: innotop 0.1.74, InnoDBParser version 1.24
-
- * Initial release for public consumption.
diff --git a/storage/xtradb/build/debian/additions/innotop/innotop b/storage/xtradb/build/debian/additions/innotop/innotop
deleted file mode 100644
index e2bfc1bd965..00000000000
--- a/storage/xtradb/build/debian/additions/innotop/innotop
+++ /dev/null
@@ -1,9485 +0,0 @@
-#!/usr/bin/perl
-
-# vim: tw=160:nowrap:expandtab:tabstop=3:shiftwidth=3:softtabstop=3
-
-use strict;
-use warnings FATAL => 'all';
-use sigtrap qw(handler finish untrapped normal-signals);
-
-use Data::Dumper;
-use DBI;
-use English qw(-no_match_vars);
-use File::Basename qw(dirname);
-use Getopt::Long;
-use List::Util qw(max min maxstr sum);
-use InnoDBParser;
-use POSIX qw(ceil);
-use Time::HiRes qw(time sleep);
-use Term::ReadKey qw(ReadMode ReadKey);
-
-# Version, license and warranty information. {{{1
-# ###########################################################################
-our $VERSION = '1.6.0';
-our $SVN_REV = sprintf("%d", q$Revision: 383 $ =~ m/(\d+)/g);
-our $SVN_URL = sprintf("%s", q$URL: https://innotop.svn.sourceforge.net/svnroot/innotop/trunk/innotop $ =~ m$svnroot/innotop/(\S+)$g);
-
-my $innotop_license = <<"LICENSE";
-
-This is innotop version $VERSION, a MySQL and InnoDB monitor.
-
-This program is copyright (c) 2006 Baron Schwartz.
-Feedback and improvements are welcome.
-
-THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-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; OR the Perl Artistic License. On UNIX and similar
-systems, you can issue `man perlgpl' or `man perlartistic' to read these
-licenses.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
-LICENSE
-
-# Configuration information and global setup {{{1
-# ###########################################################################
-
-# Really, really, super-global variables.
-my @config_versions = (
- "000-000-000", "001-003-000", # config file was one big name-value hash.
- "001-003-000", "001-004-002", # config file contained non-user-defined stuff.
-);
-
-my $clear_screen_sub;
-
-# This defines expected properties and defaults for the column definitions that
-# eventually end up in tbl_meta.
-my %col_props = (
- hdr => '',
- just => '-',
- dec => 0, # Whether to align the column on the decimal point
- num => 0,
- label => '',
- user => 0,
- src => '',
- tbl => '', # Helps when writing/reading custom columns in config files
- minw => 0,
- maxw => 0,
- trans => [],
- agg => 'first', # Aggregate function
- aggonly => 0, # Whether to show only when tbl_meta->{aggregate} is true
-);
-
-# Actual DBI connections to MySQL servers.
-my %dbhs;
-
-# Command-line parameters {{{2
-# ###########################################################################
-
-my @opt_spec = (
- { s => 'help', d => 'Show this help message' },
- { s => 'color|C!', d => 'Use terminal coloring (default)', c => 'color' },
- { s => 'config|c=s', d => 'Config file to read' },
- { s => 'nonint|n', d => 'Non-interactive, output tab-separated fields' },
- { s => 'count=i', d => 'Number of updates before exiting' },
- { s => 'delay|d=f', d => 'Delay between updates in seconds', c => 'interval' },
- { s => 'mode|m=s', d => 'Operating mode to start in', c => 'mode' },
- { s => 'inc|i!', d => 'Measure incremental differences', c => 'status_inc' },
- { s => 'version', d => 'Output version information and exit' },
-);
-
-# This is the container for the command-line options' values to be stored in
-# after processing. Initial values are defaults.
-my %opts = (
- n => !( -t STDIN && -t STDOUT ), # If in/out aren't to terminals, we're interactive
-);
-# Post-process...
-my %opt_seen;
-foreach my $spec ( @opt_spec ) {
- my ( $long, $short ) = $spec->{s} =~ m/^(\w+)(?:\|([^!+=]*))?/;
- $spec->{k} = $short || $long;
- $spec->{l} = $long;
- $spec->{t} = $short;
- $spec->{n} = $spec->{s} =~ m/!/;
- $opts{$spec->{k}} = undef unless defined $opts{$spec->{k}};
- die "Duplicate option $spec->{k}" if $opt_seen{$spec->{k}}++;
-}
-
-Getopt::Long::Configure('no_ignore_case', 'bundling');
-GetOptions( map { $_->{s} => \$opts{$_->{k}} } @opt_spec) or $opts{help} = 1;
-
-if ( $opts{version} ) {
- print "innotop Ver $VERSION Changeset $SVN_REV from $SVN_URL\n";
- exit(0);
-}
-
-if ( $opts{'help'} ) {
- print "Usage: innotop <options> <innodb-status-file>\n\n";
- my $maxw = max(map { length($_->{l}) + ($_->{n} ? 4 : 0)} @opt_spec);
- foreach my $spec ( sort { $a->{l} cmp $b->{l} } @opt_spec ) {
- my $long = $spec->{n} ? "[no]$spec->{l}" : $spec->{l};
- my $short = $spec->{t} ? "-$spec->{t}" : '';
- printf(" --%-${maxw}s %-4s %s\n", $long, $short, $spec->{d});
- }
- print <<USAGE;
-
-innotop is a MySQL and InnoDB transaction/status monitor, like 'top' for
-MySQL. It displays queries, InnoDB transactions, lock waits, deadlocks,
-foreign key errors, open tables, replication status, buffer information,
-row operations, logs, I/O operations, load graph, and more. You can
-monitor many servers at once with innotop.
-
-USAGE
- exit(1);
-}
-
-# Meta-data (table definitions etc) {{{2
-# ###########################################################################
-
-# Expressions {{{3
-# Convenience so I can copy/paste these in several places...
-# ###########################################################################
-my %exprs = (
- Host => q{my $host = host || hostname || ''; ($host) = $host =~ m/^((?:[\d.]+(?=:))|(?:[a-zA-Z]\w+))/; return $host || ''},
- Port => q{my ($p) = host =~ m/:(.*)$/; return $p || 0},
- OldVersions => q{dulint_to_int(IB_tx_trx_id_counter) - dulint_to_int(IB_tx_purge_done_for)},
- MaxTxnTime => q/max(map{ $_->{active_secs} } @{ IB_tx_transactions }) || 0/,
- NumTxns => q{scalar @{ IB_tx_transactions } },
- DirtyBufs => q{ $cur->{IB_bp_pages_modified} / ($cur->{IB_bp_buf_pool_size} || 1) },
- BufPoolFill => q{ $cur->{IB_bp_pages_total} / ($cur->{IB_bp_buf_pool_size} || 1) },
- ServerLoad => q{ $cur->{Threads_connected}/(Questions||1)/Uptime_hires },
- TxnTimeRemain => q{ defined undo_log_entries && defined $pre->{undo_log_entries} && undo_log_entries < $pre->{undo_log_entries} ? undo_log_entries / (($pre->{undo_log_entries} - undo_log_entries)/((active_secs-$pre->{active_secs})||1))||1 : 0},
- SlaveCatchupRate => ' defined $cur->{seconds_behind_master} && defined $pre->{seconds_behind_master} && $cur->{seconds_behind_master} < $pre->{seconds_behind_master} ? ($pre->{seconds_behind_master}-$cur->{seconds_behind_master})/($cur->{Uptime_hires}-$pre->{Uptime_hires}) : 0',
- QcacheHitRatio => q{(Qcache_hits||0)/(((Com_select||0)+(Qcache_hits||0))||1)},
-);
-
-# ###########################################################################
-# Column definitions {{{3
-# Defines every column in every table. A named column has the following
-# properties:
-# * hdr Column header/title
-# * label Documentation for humans.
-# * num Whether it's numeric (for sorting).
-# * just Alignment; generated from num, user-overridable in tbl_meta
-# * minw, maxw Auto-generated, user-overridable.
-# Values from this hash are just copied to tbl_meta, which is where everything
-# else in the program should read from.
-# ###########################################################################
-
-my %columns = (
- active_secs => { hdr => 'SecsActive', num => 1, label => 'Seconds transaction has been active', },
- add_pool_alloc => { hdr => 'Add\'l Pool', num => 1, label => 'Additonal pool allocated' },
- attempted_op => { hdr => 'Action', num => 0, label => 'The action that caused the error' },
- awe_mem_alloc => { hdr => 'AWE Memory', num => 1, label => '[Windows] AWE memory allocated' },
- binlog_cache_overflow => { hdr => 'Binlog Cache', num => 1, label => 'Transactions too big for binlog cache that went to disk' },
- binlog_do_db => { hdr => 'Binlog Do DB', num => 0, label => 'binlog-do-db setting' },
- binlog_ignore_db => { hdr => 'Binlog Ignore DB', num => 0, label => 'binlog-ignore-db setting' },
- bps_in => { hdr => 'BpsIn', num => 1, label => 'Bytes per second received by the server', },
- bps_out => { hdr => 'BpsOut', num => 1, label => 'Bytes per second sent by the server', },
- buf_free => { hdr => 'Free Bufs', num => 1, label => 'Buffers free in the buffer pool' },
- buf_pool_hit_rate => { hdr => 'Hit Rate', num => 0, label => 'Buffer pool hit rate' },
- buf_pool_hits => { hdr => 'Hits', num => 1, label => 'Buffer pool hits' },
- buf_pool_reads => { hdr => 'Reads', num => 1, label => 'Buffer pool reads' },
- buf_pool_size => { hdr => 'Size', num => 1, label => 'Buffer pool size' },
- bufs_in_node_heap => { hdr => 'Node Heap Bufs', num => 1, label => 'Buffers in buffer pool node heap' },
- bytes_behind_master => { hdr => 'ByteLag', num => 1, label => 'Bytes the slave lags the master in binlog' },
- cell_event_set => { hdr => 'Ending?', num => 1, label => 'Whether the cell event is set' },
- cell_waiting => { hdr => 'Waiting?', num => 1, label => 'Whether the cell is waiting' },
- child_db => { hdr => 'Child DB', num => 0, label => 'The database of the child table' },
- child_index => { hdr => 'Child Index', num => 0, label => 'The index in the child table' },
- child_table => { hdr => 'Child Table', num => 0, label => 'The child table' },
- cmd => { hdr => 'Cmd', num => 0, label => 'Type of command being executed', },
- cnt => { hdr => 'Cnt', num => 0, label => 'Count', agg => 'count', aggonly => 1 },
- connect_retry => { hdr => 'Connect Retry', num => 1, label => 'Slave connect-retry timeout' },
- cxn => { hdr => 'CXN', num => 0, label => 'Connection from which the data came', },
- db => { hdr => 'DB', num => 0, label => 'Current database', },
- dict_mem_alloc => { hdr => 'Dict Mem', num => 1, label => 'Dictionary memory allocated' },
- dirty_bufs => { hdr => 'Dirty Buf', num => 1, label => 'Dirty buffer pool pages' },
- dl_txn_num => { hdr => 'Num', num => 0, label => 'Deadlocked transaction number', },
- event_set => { hdr => 'Evt Set?', num => 1, label => '[Win32] if a wait event is set', },
- exec_master_log_pos => { hdr => 'Exec Master Log Pos', num => 1, label => 'Exec Master Log Position' },
- fk_name => { hdr => 'Constraint', num => 0, label => 'The name of the FK constraint' },
- free_list_len => { hdr => 'Free List Len', num => 1, label => 'Length of the free list' },
- has_read_view => { hdr => 'Rd View', num => 1, label => 'Whether the transaction has a read view' },
- hash_searches_s => { hdr => 'Hash/Sec', num => 1, label => 'Number of hash searches/sec' },
- hash_table_size => { hdr => 'Size', num => 1, label => 'Number of non-hash searches/sec' },
- heap_no => { hdr => 'Heap', num => 1, label => 'Heap number' },
- heap_size => { hdr => 'Heap', num => 1, label => 'Heap size' },
- history_list_len => { hdr => 'History', num => 1, label => 'History list length' },
- host_and_domain => { hdr => 'Host', num => 0, label => 'Hostname/IP and domain' },
- host_and_port => { hdr => 'Host/IP', num => 0, label => 'Hostname or IP address, and port number', },
- hostname => { hdr => 'Host', num => 0, label => 'Hostname' },
- index => { hdr => 'Index', num => 0, label => 'The index involved' },
- index_ref => { hdr => 'Index Ref', num => 0, label => 'Index referenced' },
- info => { hdr => 'Query', num => 0, label => 'Info or the current query', },
- insert_intention => { hdr => 'Ins Intent', num => 1, label => 'Whether the thread was trying to insert' },
- inserts => { hdr => 'Inserts', num => 1, label => 'Inserts' },
- io_bytes_s => { hdr => 'Bytes/Sec', num => 1, label => 'Average I/O bytes/sec' },
- io_flush_type => { hdr => 'Flush Type', num => 0, label => 'I/O Flush Type' },
- io_fsyncs_s => { hdr => 'fsyncs/sec', num => 1, label => 'I/O fsyncs/sec' },
- io_reads_s => { hdr => 'Reads/Sec', num => 1, label => 'Average I/O reads/sec' },
- io_writes_s => { hdr => 'Writes/Sec', num => 1, label => 'Average I/O writes/sec' },
- ip => { hdr => 'IP', num => 0, label => 'IP address' },
- is_name_locked => { hdr => 'Locked', num => 1, label => 'Whether table is name locked', },
- key_buffer_hit => { hdr => 'KCacheHit', num => 1, label => 'Key cache hit ratio', },
- key_len => { hdr => 'Key Length', num => 1, label => 'Number of bytes used in the key' },
- last_chkp => { hdr => 'Last Checkpoint', num => 0, label => 'Last log checkpoint' },
- last_errno => { hdr => 'Last Errno', num => 1, label => 'Last error number' },
- last_error => { hdr => 'Last Error', num => 0, label => 'Last error' },
- last_s_file_name => { hdr => 'S-File', num => 0, label => 'Filename where last read locked' },
- last_s_line => { hdr => 'S-Line', num => 1, label => 'Line where last read locked' },
- last_x_file_name => { hdr => 'X-File', num => 0, label => 'Filename where last write locked' },
- last_x_line => { hdr => 'X-Line', num => 1, label => 'Line where last write locked' },
- last_pct => { hdr => 'Pct', num => 1, label => 'Last Percentage' },
- last_total => { hdr => 'Last Total', num => 1, label => 'Last Total' },
- last_value => { hdr => 'Last Incr', num => 1, label => 'Last Value' },
- load => { hdr => 'Load', num => 1, label => 'Server load' },
- lock_cfile_name => { hdr => 'Crtd File', num => 0, label => 'Filename where lock created' },
- lock_cline => { hdr => 'Crtd Line', num => 1, label => 'Line where lock created' },
- lock_mem_addr => { hdr => 'Addr', num => 0, label => 'The lock memory address' },
- lock_mode => { hdr => 'Mode', num => 0, label => 'The lock mode' },
- lock_structs => { hdr => 'LStrcts', num => 1, label => 'Number of lock structs' },
- lock_type => { hdr => 'Type', num => 0, label => 'The lock type' },
- lock_var => { hdr => 'Lck Var', num => 1, label => 'The lock variable' },
- lock_wait_time => { hdr => 'Wait', num => 1, label => 'How long txn has waited for a lock' },
- log_flushed_to => { hdr => 'Flushed To', num => 0, label => 'Log position flushed to' },
- log_ios_done => { hdr => 'IO Done', num => 1, label => 'Log I/Os done' },
- log_ios_s => { hdr => 'IO/Sec', num => 1, label => 'Average log I/Os per sec' },
- log_seq_no => { hdr => 'Sequence No.', num => 0, label => 'Log sequence number' },
- main_thread_id => { hdr => 'Main Thread ID', num => 1, label => 'Main thread ID' },
- main_thread_proc_no => { hdr => 'Main Thread Proc', num => 1, label => 'Main thread process number' },
- main_thread_state => { hdr => 'Main Thread State', num => 0, label => 'Main thread state' },
- master_file => { hdr => 'File', num => 0, label => 'Master file' },
- master_host => { hdr => 'Master', num => 0, label => 'Master server hostname' },
- master_log_file => { hdr => 'Master Log File', num => 0, label => 'Master log file' },
- master_port => { hdr => 'Master Port', num => 1, label => 'Master port' },
- master_pos => { hdr => 'Position', num => 1, label => 'Master position' },
- master_ssl_allowed => { hdr => 'Master SSL Allowed', num => 0, label => 'Master SSL Allowed' },
- master_ssl_ca_file => { hdr => 'Master SSL CA File', num => 0, label => 'Master SSL Cert Auth File' },
- master_ssl_ca_path => { hdr => 'Master SSL CA Path', num => 0, label => 'Master SSL Cert Auth Path' },
- master_ssl_cert => { hdr => 'Master SSL Cert', num => 0, label => 'Master SSL Cert' },
- master_ssl_cipher => { hdr => 'Master SSL Cipher', num => 0, label => 'Master SSL Cipher' },
- master_ssl_key => { hdr => 'Master SSL Key', num => 0, label => 'Master SSL Key' },
- master_user => { hdr => 'Master User', num => 0, label => 'Master username' },
- max_txn => { hdr => 'MaxTxnTime', num => 1, label => 'MaxTxn' },
- merged_recs => { hdr => 'Merged Recs', num => 1, label => 'Merged records' },
- merges => { hdr => 'Merges', num => 1, label => 'Merges' },
- mutex_os_waits => { hdr => 'Waits', num => 1, label => 'Mutex OS Waits' },
- mutex_spin_rounds => { hdr => 'Rounds', num => 1, label => 'Mutex Spin Rounds' },
- mutex_spin_waits => { hdr => 'Spins', num => 1, label => 'Mutex Spin Waits' },
- mysql_thread_id => { hdr => 'ID', num => 1, label => 'MySQL connection (thread) ID', },
- name => { hdr => 'Name', num => 0, label => 'Variable Name' },
- n_bits => { hdr => '# Bits', num => 1, label => 'Number of bits' },
- non_hash_searches_s => { hdr => 'Non-Hash/Sec', num => 1, label => 'Non-hash searches/sec' },
- num_deletes => { hdr => 'Del', num => 1, label => 'Number of deletes' },
- num_deletes_sec => { hdr => 'Del/Sec', num => 1, label => 'Number of deletes' },
- num_inserts => { hdr => 'Ins', num => 1, label => 'Number of inserts' },
- num_inserts_sec => { hdr => 'Ins/Sec', num => 1, label => 'Number of inserts' },
- num_readers => { hdr => 'Readers', num => 1, label => 'Number of readers' },
- num_reads => { hdr => 'Read', num => 1, label => 'Number of reads' },
- num_reads_sec => { hdr => 'Read/Sec', num => 1, label => 'Number of reads' },
- num_res_ext => { hdr => 'BTree Extents', num => 1, label => 'Number of extents reserved for B-Tree' },
- num_rows => { hdr => 'Row Count', num => 1, label => 'Number of rows estimated to examine' },
- num_times_open => { hdr => 'In Use', num => 1, label => '# times table is opened', },
- num_txns => { hdr => 'Txns', num => 1, label => 'Number of transactions' },
- num_updates => { hdr => 'Upd', num => 1, label => 'Number of updates' },
- num_updates_sec => { hdr => 'Upd/Sec', num => 1, label => 'Number of updates' },
- os_file_reads => { hdr => 'OS Reads', num => 1, label => 'OS file reads' },
- os_file_writes => { hdr => 'OS Writes', num => 1, label => 'OS file writes' },
- os_fsyncs => { hdr => 'OS fsyncs', num => 1, label => 'OS fsyncs' },
- os_thread_id => { hdr => 'OS Thread', num => 1, label => 'The operating system thread ID' },
- p_aio_writes => { hdr => 'Async Wrt', num => 1, label => 'Pending asynchronous I/O writes' },
- p_buf_pool_flushes => { hdr => 'Buffer Pool Flushes', num => 1, label => 'Pending buffer pool flushes' },
- p_ibuf_aio_reads => { hdr => 'IBuf Async Rds', num => 1, label => 'Pending insert buffer asynch I/O reads' },
- p_log_flushes => { hdr => 'Log Flushes', num => 1, label => 'Pending log flushes' },
- p_log_ios => { hdr => 'Log I/Os', num => 1, label => 'Pending log I/O operations' },
- p_normal_aio_reads => { hdr => 'Async Rds', num => 1, label => 'Pending asynchronous I/O reads' },
- p_preads => { hdr => 'preads', num => 1, label => 'Pending p-reads' },
- p_pwrites => { hdr => 'pwrites', num => 1, label => 'Pending p-writes' },
- p_sync_ios => { hdr => 'Sync I/Os', num => 1, label => 'Pending synchronous I/O operations' },
- page_creates_sec => { hdr => 'Creates/Sec', num => 1, label => 'Page creates/sec' },
- page_no => { hdr => 'Page', num => 1, label => 'Page number' },
- page_reads_sec => { hdr => 'Reads/Sec', num => 1, label => 'Page reads per second' },
- page_writes_sec => { hdr => 'Writes/Sec', num => 1, label => 'Page writes per second' },
- pages_created => { hdr => 'Created', num => 1, label => 'Pages created' },
- pages_modified => { hdr => 'Dirty Pages', num => 1, label => 'Pages modified (dirty)' },
- pages_read => { hdr => 'Reads', num => 1, label => 'Pages read' },
- pages_total => { hdr => 'Pages', num => 1, label => 'Pages total' },
- pages_written => { hdr => 'Writes', num => 1, label => 'Pages written' },
- parent_col => { hdr => 'Parent Column', num => 0, label => 'The referred column in the parent table', },
- parent_db => { hdr => 'Parent DB', num => 0, label => 'The database of the parent table' },
- parent_index => { hdr => 'Parent Index', num => 0, label => 'The referred index in the parent table' },
- parent_table => { hdr => 'Parent Table', num => 0, label => 'The parent table' },
- part_id => { hdr => 'Part ID', num => 1, label => 'Sub-part ID of the query' },
- partitions => { hdr => 'Partitions', num => 0, label => 'Query partitions used' },
- pct => { hdr => 'Pct', num => 1, label => 'Percentage' },
- pending_chkp_writes => { hdr => 'Chkpt Writes', num => 1, label => 'Pending log checkpoint writes' },
- pending_log_writes => { hdr => 'Log Writes', num => 1, label => 'Pending log writes' },
- port => { hdr => 'Port', num => 1, label => 'Client port number', },
- possible_keys => { hdr => 'Poss. Keys', num => 0, label => 'Possible keys' },
- proc_no => { hdr => 'Proc', num => 1, label => 'Process number' },
- q_cache_hit => { hdr => 'QCacheHit', num => 1, label => 'Query cache hit ratio', },
- qps => { hdr => 'QPS', num => 1, label => 'How many queries/sec', },
- queries_in_queue => { hdr => 'Queries Queued', num => 1, label => 'Queries in queue' },
- queries_inside => { hdr => 'Queries Inside', num => 1, label => 'Queries inside InnoDB' },
- query_id => { hdr => 'Query ID', num => 1, label => 'Query ID' },
- query_status => { hdr => 'Query Status', num => 0, label => 'The query status' },
- query_text => { hdr => 'Query Text', num => 0, label => 'The query text' },
- questions => { hdr => 'Questions', num => 1, label => 'How many queries the server has gotten', },
- read_master_log_pos => { hdr => 'Read Master Pos', num => 1, label => 'Read master log position' },
- read_views_open => { hdr => 'Rd Views', num => 1, label => 'Number of read views open' },
- reads_pending => { hdr => 'Pending Reads', num => 1, label => 'Reads pending' },
- relay_log_file => { hdr => 'Relay File', num => 0, label => 'Relay log file' },
- relay_log_pos => { hdr => 'Relay Pos', num => 1, label => 'Relay log position' },
- relay_log_size => { hdr => 'Relay Size', num => 1, label => 'Relay log size' },
- relay_master_log_file => { hdr => 'Relay Master File', num => 0, label => 'Relay master log file' },
- replicate_do_db => { hdr => 'Do DB', num => 0, label => 'Replicate-do-db setting' },
- replicate_do_table => { hdr => 'Do Table', num => 0, label => 'Replicate-do-table setting' },
- replicate_ignore_db => { hdr => 'Ignore DB', num => 0, label => 'Replicate-ignore-db setting' },
- replicate_ignore_table => { hdr => 'Ignore Table', num => 0, label => 'Replicate-do-table setting' },
- replicate_wild_do_table => { hdr => 'Wild Do Table', num => 0, label => 'Replicate-wild-do-table setting' },
- replicate_wild_ignore_table => { hdr => 'Wild Ignore Table', num => 0, label => 'Replicate-wild-ignore-table setting' },
- request_type => { hdr => 'Type', num => 0, label => 'Type of lock the thread waits for' },
- reservation_count => { hdr => 'ResCnt', num => 1, label => 'Reservation Count' },
- row_locks => { hdr => 'RLocks', num => 1, label => 'Number of row locks' },
- rw_excl_os_waits => { hdr => 'RW Waits', num => 1, label => 'R/W Excl. OS Waits' },
- rw_excl_spins => { hdr => 'RW Spins', num => 1, label => 'R/W Excl. Spins' },
- rw_shared_os_waits => { hdr => 'Sh Waits', num => 1, label => 'R/W Shared OS Waits' },
- rw_shared_spins => { hdr => 'Sh Spins', num => 1, label => 'R/W Shared Spins' },
- scan_type => { hdr => 'Type', num => 0, label => 'Scan type in chosen' },
- seg_size => { hdr => 'Seg. Size', num => 1, label => 'Segment size' },
- select_type => { hdr => 'Select Type', num => 0, label => 'Type of select used' },
- signal_count => { hdr => 'Signals', num => 1, label => 'Signal Count' },
- size => { hdr => 'Size', num => 1, label => 'Size of the tablespace' },
- skip_counter => { hdr => 'Skip Counter', num => 1, label => 'Skip counter' },
- slave_catchup_rate => { hdr => 'Catchup', num => 1, label => 'How fast the slave is catching up in the binlog' },
- slave_io_running => { hdr => 'Slave-IO', num => 0, label => 'Whether the slave I/O thread is running' },
- slave_io_state => { hdr => 'Slave IO State', num => 0, label => 'Slave I/O thread state' },
- slave_open_temp_tables => { hdr => 'Temp', num => 1, label => 'Slave open temp tables' },
- slave_sql_running => { hdr => 'Slave-SQL', num => 0, label => 'Whether the slave SQL thread is running' },
- slow => { hdr => 'Slow', num => 1, label => 'How many slow queries', },
- space_id => { hdr => 'Space', num => 1, label => 'Tablespace ID' },
- special => { hdr => 'Special', num => 0, label => 'Special/Other info' },
- state => { hdr => 'State', num => 0, label => 'Connection state', maxw => 18, },
- tables_in_use => { hdr => 'Tbl Used', num => 1, label => 'Number of tables in use' },
- tables_locked => { hdr => 'Tbl Lck', num => 1, label => 'Number of tables locked' },
- tbl => { hdr => 'Table', num => 0, label => 'Table', },
- thread => { hdr => 'Thread', num => 1, label => 'Thread number' },
- thread_decl_inside => { hdr => 'Thread Inside', num => 0, label => 'What the thread is declared inside' },
- thread_purpose => { hdr => 'Purpose', num => 0, label => "The thread's purpose" },
- thread_status => { hdr => 'Thread Status', num => 0, label => 'The thread status' },
- time => { hdr => 'Time', num => 1, label => 'Time since the last event', },
- time_behind_master => { hdr => 'TimeLag', num => 1, label => 'Time slave lags master' },
- timestring => { hdr => 'Timestring', num => 0, label => 'Time the event occurred' },
- total => { hdr => 'Total', num => 1, label => 'Total' },
- total_mem_alloc => { hdr => 'Memory', num => 1, label => 'Total memory allocated' },
- truncates => { hdr => 'Trunc', num => 0, label => 'Whether the deadlock is truncating InnoDB status' },
- txn_doesnt_see_ge => { hdr => "Txn Won't See", num => 0, label => 'Where txn read view is limited' },
- txn_id => { hdr => 'ID', num => 0, label => 'Transaction ID' },
- txn_sees_lt => { hdr => 'Txn Sees', num => 1, label => 'Where txn read view is limited' },
- txn_status => { hdr => 'Txn Status', num => 0, label => 'Transaction status' },
- txn_time_remain => { hdr => 'Remaining', num => 1, label => 'Time until txn rollback/commit completes' },
- undo_log_entries => { hdr => 'Undo', num => 1, label => 'Number of undo log entries' },
- undo_for => { hdr => 'Undo', num => 0, label => 'Undo for' },
- until_condition => { hdr => 'Until Condition', num => 0, label => 'Slave until condition' },
- until_log_file => { hdr => 'Until Log File', num => 0, label => 'Slave until log file' },
- until_log_pos => { hdr => 'Until Log Pos', num => 1, label => 'Slave until log position' },
- used_cells => { hdr => 'Cells Used', num => 1, label => 'Number of cells used' },
- used_bufs => { hdr => 'Used Bufs', num => 1, label => 'Number of buffer pool pages used' },
- user => { hdr => 'User', num => 0, label => 'Database username', },
- value => { hdr => 'Value', num => 1, label => 'Value' },
- versions => { hdr => 'Versions', num => 1, label => 'Number of InnoDB MVCC versions unpurged' },
- victim => { hdr => 'Victim', num => 0, label => 'Whether this txn was the deadlock victim' },
- wait_array_size => { hdr => 'Wait Array Size', num => 1, label => 'Wait Array Size' },
- wait_status => { hdr => 'Lock Status', num => 0, label => 'Status of txn locks' },
- waited_at_filename => { hdr => 'File', num => 0, label => 'Filename at which thread waits' },
- waited_at_line => { hdr => 'Line', num => 1, label => 'Line at which thread waits' },
- waiters_flag => { hdr => 'Waiters', num => 1, label => 'Waiters Flag' },
- waiting => { hdr => 'Waiting', num => 1, label => 'Whether lock is being waited for' },
- when => { hdr => 'When', num => 0, label => 'Time scale' },
- writer_lock_mode => { hdr => 'Wrtr Lck Mode', num => 0, label => 'Writer lock mode' },
- writer_thread => { hdr => 'Wrtr Thread', num => 1, label => 'Writer thread ID' },
- writes_pending => { hdr => 'Writes', num => 1, label => 'Number of writes pending' },
- writes_pending_flush_list => { hdr => 'Flush List Writes', num => 1, label => 'Number of flush list writes pending' },
- writes_pending_lru => { hdr => 'LRU Writes', num => 1, label => 'Number of LRU writes pending' },
- writes_pending_single_page => { hdr => '1-Page Writes', num => 1, label => 'Number of 1-page writes pending' },
-);
-
-# Apply a default property or three. By default, columns are not width-constrained,
-# aligned left, and sorted alphabetically, not numerically.
-foreach my $col ( values %columns ) {
- map { $col->{$_} ||= 0 } qw(num minw maxw);
- $col->{just} = $col->{num} ? '' : '-';
-}
-
-# Filters {{{3
-# This hash defines every filter that can be applied to a table. These
-# become part of tbl_meta as well. Each filter is just an expression that
-# returns true or false.
-# Properties of each entry:
-# * func: the subroutine
-# * name: the name, repeated
-# * user: whether it's a user-defined filter (saved in config)
-# * text: text of the subroutine
-# * note: explanation
-my %filters = ();
-
-# These are pre-processed to live in %filters above, by compiling them.
-my %builtin_filters = (
- hide_self => {
- text => <<' END',
- return ( !$set->{info} || $set->{info} ne 'SHOW FULL PROCESSLIST' )
- && ( !$set->{query_text} || $set->{query_text} !~ m/INNODB STATUS$/ );
- END
- note => 'Removes the innotop processes from the list',
- tbls => [qw(innodb_transactions processlist)],
- },
- hide_inactive => {
- text => <<' END',
- return ( !defined($set->{txn_status}) || $set->{txn_status} ne 'not started' )
- && ( !defined($set->{cmd}) || $set->{cmd} !~ m/Sleep|Binlog Dump/ )
- && ( !defined($set->{info}) || $set->{info} =~ m/\S/ );
- END
- note => 'Removes processes which are not doing anything',
- tbls => [qw(innodb_transactions processlist)],
- },
- hide_slave_io => {
- text => <<' END',
- return !$set->{state} || $set->{state} !~ m/^(?:Waiting for master|Has read all relay)/;
- END
- note => 'Removes slave I/O threads from the list',
- tbls => [qw(processlist slave_io_status)],
- },
- table_is_open => {
- text => <<' END',
- return $set->{num_times_open} + $set->{is_name_locked};
- END
- note => 'Removes tables that are not in use or locked',
- tbls => [qw(open_tables)],
- },
- cxn_is_master => {
- text => <<' END',
- return $set->{master_file} ? 1 : 0;
- END
- note => 'Removes servers that are not masters',
- tbls => [qw(master_status)],
- },
- cxn_is_slave => {
- text => <<' END',
- return $set->{master_host} ? 1 : 0;
- END
- note => 'Removes servers that are not slaves',
- tbls => [qw(slave_io_status slave_sql_status)],
- },
- thd_is_not_waiting => {
- text => <<' END',
- return $set->{thread_status} !~ m#waiting for i/o request#;
- END
- note => 'Removes idle I/O threads',
- tbls => [qw(io_threads)],
- },
-);
-foreach my $key ( keys %builtin_filters ) {
- my ( $sub, $err ) = compile_filter($builtin_filters{$key}->{text});
- $filters{$key} = {
- func => $sub,
- text => $builtin_filters{$key}->{text},
- user => 0,
- name => $key, # useful for later
- note => $builtin_filters{$key}->{note},
- tbls => $builtin_filters{$key}->{tbls},
- }
-}
-
-# Variable sets {{{3
-# Sets (arrayrefs) of variables that are used in S mode. They are read/written to
-# the config file.
-my %var_sets = (
- general => {
- text => join(
- ', ',
- 'set_precision(Questions/Uptime_hires) as QPS',
- 'set_precision(Com_commit/Uptime_hires) as Commit_PS',
- 'set_precision((Com_rollback||0)/(Com_commit||1)) as Rollback_Commit',
- 'set_precision(('
- . join('+', map { "($_||0)" }
- qw(Com_delete Com_delete_multi Com_insert Com_insert_select Com_replace
- Com_replace_select Com_select Com_update Com_update_multi))
- . ')/(Com_commit||1)) as Write_Commit',
- 'set_precision((Com_select+(Qcache_hits||0))/(('
- . join('+', map { "($_||0)" }
- qw(Com_delete Com_delete_multi Com_insert Com_insert_select Com_replace
- Com_replace_select Com_select Com_update Com_update_multi))
- . ')||1)) as R_W_Ratio',
- 'set_precision(Opened_tables/Uptime_hires) as Opens_PS',
- 'percent($cur->{Open_tables}/($cur->{table_cache})) as Table_Cache_Used',
- 'set_precision(Threads_created/Uptime_hires) as Threads_PS',
- 'percent($cur->{Threads_cached}/($cur->{thread_cache_size}||1)) as Thread_Cache_Used',
- 'percent($cur->{Max_used_connections}/($cur->{max_connections}||1)) as CXN_Used_Ever',
- 'percent($cur->{Threads_connected}/($cur->{max_connections}||1)) as CXN_Used_Now',
- ),
- },
- commands => {
- text => join(
- ', ',
- qw(Uptime Questions Com_delete Com_delete_multi Com_insert
- Com_insert_select Com_replace Com_replace_select Com_select Com_update
- Com_update_multi)
- ),
- },
- query_status => {
- text => join(
- ',',
- qw( Uptime Select_full_join Select_full_range_join Select_range
- Select_range_check Select_scan Slow_queries Sort_merge_passes
- Sort_range Sort_rows Sort_scan)
- ),
- },
- innodb => {
- text => join(
- ',',
- qw( Uptime Innodb_row_lock_current_waits Innodb_row_lock_time
- Innodb_row_lock_time_avg Innodb_row_lock_time_max Innodb_row_lock_waits
- Innodb_rows_deleted Innodb_rows_inserted Innodb_rows_read
- Innodb_rows_updated)
- ),
- },
- txn => {
- text => join(
- ',',
- qw( Uptime Com_begin Com_commit Com_rollback Com_savepoint
- Com_xa_commit Com_xa_end Com_xa_prepare Com_xa_recover Com_xa_rollback
- Com_xa_start)
- ),
- },
- key_cache => {
- text => join(
- ',',
- qw( Uptime Key_blocks_not_flushed Key_blocks_unused Key_blocks_used
- Key_read_requests Key_reads Key_write_requests Key_writes )
- ),
- },
- query_cache => {
- text => join(
- ',',
- "percent($exprs{QcacheHitRatio}) as Hit_Pct",
- 'set_precision((Qcache_hits||0)/(Qcache_inserts||1)) as Hit_Ins',
- 'set_precision((Qcache_lowmem_prunes||0)/Uptime_hires) as Lowmem_Prunes_sec',
- 'percent(1-((Qcache_free_blocks||0)/(Qcache_total_blocks||1))) as Blocks_used',
- qw( Qcache_free_blocks Qcache_free_memory Qcache_not_cached Qcache_queries_in_cache)
- ),
- },
- handler => {
- text => join(
- ',',
- qw( Uptime Handler_read_key Handler_read_first Handler_read_next
- Handler_read_prev Handler_read_rnd Handler_read_rnd_next Handler_delete
- Handler_update Handler_write)
- ),
- },
- cxns_files_threads => {
- text => join(
- ',',
- qw( Uptime Aborted_clients Aborted_connects Bytes_received Bytes_sent
- Compression Connections Created_tmp_disk_tables Created_tmp_files
- Created_tmp_tables Max_used_connections Open_files Open_streams
- Open_tables Opened_tables Table_locks_immediate Table_locks_waited
- Threads_cached Threads_connected Threads_created Threads_running)
- ),
- },
- prep_stmt => {
- text => join(
- ',',
- qw( Uptime Com_dealloc_sql Com_execute_sql Com_prepare_sql Com_reset
- Com_stmt_close Com_stmt_execute Com_stmt_fetch Com_stmt_prepare
- Com_stmt_reset Com_stmt_send_long_data )
- ),
- },
- innodb_health => {
- text => join(
- ',',
- "$exprs{OldVersions} as OldVersions",
- qw(IB_sm_mutex_spin_waits IB_sm_mutex_spin_rounds IB_sm_mutex_os_waits),
- "$exprs{NumTxns} as NumTxns",
- "$exprs{MaxTxnTime} as MaxTxnTime",
- qw(IB_ro_queries_inside IB_ro_queries_in_queue),
- "set_precision($exprs{DirtyBufs} * 100) as dirty_bufs",
- "set_precision($exprs{BufPoolFill} * 100) as buf_fill",
- qw(IB_bp_pages_total IB_bp_pages_read IB_bp_pages_written IB_bp_pages_created)
- ),
- },
- innodb_health2 => {
- text => join(
- ', ',
- 'percent(1-((Innodb_buffer_pool_pages_free||0)/($cur->{Innodb_buffer_pool_pages_total}||1))) as BP_page_cache_usage',
- 'percent(1-((Innodb_buffer_pool_reads||0)/(Innodb_buffer_pool_read_requests||1))) as BP_cache_hit_ratio',
- 'Innodb_buffer_pool_wait_free',
- 'Innodb_log_waits',
- ),
- },
- slow_queries => {
- text => join(
- ', ',
- 'set_precision(Slow_queries/Uptime_hires) as Slow_PS',
- 'set_precision(Select_full_join/Uptime_hires) as Full_Join_PS',
- 'percent(Select_full_join/(Com_select||1)) as Full_Join_Ratio',
- ),
- },
-);
-
-# Server sets {{{3
-# Defines sets of servers between which the user can quickly switch.
-my %server_groups;
-
-# Connections {{{3
-# This hash defines server connections. Each connection is a string that can be passed to
-# the DBI connection. These are saved in the connections section in the config file.
-my %connections;
-# Defines the parts of connections.
-my @conn_parts = qw(user have_user pass have_pass dsn savepass dl_table);
-
-# Graph widths {{{3
-# This hash defines the max values seen for various status/variable values, for graphing.
-# These are stored in their own section in the config file. These are just initial values:
-my %mvs = (
- Com_select => 50,
- Com_insert => 50,
- Com_update => 50,
- Com_delete => 50,
- Questions => 100,
-);
-
-# ###########################################################################
-# Valid Term::ANSIColor color strings.
-# ###########################################################################
-my %ansicolors = map { $_ => 1 }
- qw( black blink blue bold clear concealed cyan dark green magenta on_black
- on_blue on_cyan on_green on_magenta on_red on_white on_yellow red reset
- reverse underline underscore white yellow);
-
-# ###########################################################################
-# Valid comparison operators for color rules
-# ###########################################################################
-my %comp_ops = (
- '==' => 'Numeric equality',
- '>' => 'Numeric greater-than',
- '<' => 'Numeric less-than',
- '>=' => 'Numeric greater-than/equal',
- '<=' => 'Numeric less-than/equal',
- '!=' => 'Numeric not-equal',
- 'eq' => 'String equality',
- 'gt' => 'String greater-than',
- 'lt' => 'String less-than',
- 'ge' => 'String greater-than/equal',
- 'le' => 'String less-than/equal',
- 'ne' => 'String not-equal',
- '=~' => 'Pattern match',
- '!~' => 'Negated pattern match',
-);
-
-# ###########################################################################
-# Valid aggregate functions.
-# ###########################################################################
-my %agg_funcs = (
- first => sub {
- return $_[0]
- },
- count => sub {
- return 0 + @_;
- },
- avg => sub {
- my @args = grep { defined $_ } @_;
- return (sum(map { m/([\d\.-]+)/g } @args) || 0) / (scalar(@args) || 1);
- },
- sum => \&sum,
-);
-
-# ###########################################################################
-# Valid functions for transformations.
-# ###########################################################################
-my %trans_funcs = (
- shorten => \&shorten,
- secs_to_time => \&secs_to_time,
- no_ctrl_char => \&no_ctrl_char,
- percent => \&percent,
- commify => \&commify,
- dulint_to_int => \&dulint_to_int,
- set_precision => \&set_precision,
-);
-
-# Table definitions {{{3
-# This hash defines every table that can get displayed in every mode. Each
-# table specifies columns and column data sources. The column is
-# defined by the %columns hash.
-#
-# Example: foo => { src => 'bar' } means the foo column (look at
-# $columns{foo} for its definition) gets its data from the 'bar' element of
-# the current data set, whatever that is.
-#
-# These columns are post-processed after being defined, because they get stuff
-# from %columns. After all the config is loaded for columns, there's more
-# post-processing too; the subroutines compiled from src get added to
-# the hash elements for extract_values to use.
-# ###########################################################################
-
-my %tbl_meta = (
- adaptive_hash_index => {
- capt => 'Adaptive Hash Index',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- hash_table_size => { src => 'IB_ib_hash_table_size', trans => [qw(shorten)], },
- used_cells => { src => 'IB_ib_used_cells' },
- bufs_in_node_heap => { src => 'IB_ib_bufs_in_node_heap' },
- hash_searches_s => { src => 'IB_ib_hash_searches_s' },
- non_hash_searches_s => { src => 'IB_ib_non_hash_searches_s' },
- },
- visible => [ qw(cxn hash_table_size used_cells bufs_in_node_heap hash_searches_s non_hash_searches_s) ],
- filters => [],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => 'ib',
- group_by => [],
- aggregate => 0,
- },
- buffer_pool => {
- capt => 'Buffer Pool',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- total_mem_alloc => { src => 'IB_bp_total_mem_alloc', trans => [qw(shorten)], },
- awe_mem_alloc => { src => 'IB_bp_awe_mem_alloc', trans => [qw(shorten)], },
- add_pool_alloc => { src => 'IB_bp_add_pool_alloc', trans => [qw(shorten)], },
- buf_pool_size => { src => 'IB_bp_buf_pool_size', trans => [qw(shorten)], },
- buf_free => { src => 'IB_bp_buf_free' },
- buf_pool_hit_rate => { src => 'IB_bp_buf_pool_hit_rate' },
- buf_pool_reads => { src => 'IB_bp_buf_pool_reads' },
- buf_pool_hits => { src => 'IB_bp_buf_pool_hits' },
- dict_mem_alloc => { src => 'IB_bp_dict_mem_alloc' },
- pages_total => { src => 'IB_bp_pages_total' },
- pages_modified => { src => 'IB_bp_pages_modified' },
- reads_pending => { src => 'IB_bp_reads_pending' },
- writes_pending => { src => 'IB_bp_writes_pending' },
- writes_pending_lru => { src => 'IB_bp_writes_pending_lru' },
- writes_pending_flush_list => { src => 'IB_bp_writes_pending_flush_list' },
- writes_pending_single_page => { src => 'IB_bp_writes_pending_single_page' },
- page_creates_sec => { src => 'IB_bp_page_creates_sec' },
- page_reads_sec => { src => 'IB_bp_page_reads_sec' },
- page_writes_sec => { src => 'IB_bp_page_writes_sec' },
- pages_created => { src => 'IB_bp_pages_created' },
- pages_read => { src => 'IB_bp_pages_read' },
- pages_written => { src => 'IB_bp_pages_written' },
- },
- visible => [ qw(cxn buf_pool_size buf_free pages_total pages_modified buf_pool_hit_rate total_mem_alloc add_pool_alloc)],
- filters => [],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => 'bp',
- group_by => [],
- aggregate => 0,
- },
- # TODO: a new step in set_to_tbl: join result to itself, grouped?
- # TODO: this would also enable pulling Q and T data together.
- # TODO: using a SQL-ish language would also allow pivots to be easier -- treat the pivoted data as a view and SELECT from it.
- cmd_summary => {
- capt => 'Command Summary',
- cust => {},
- cols => {
- name => { src => 'name' },
- total => { src => 'total' },
- value => { src => 'value', agg => 'sum'},
- pct => { src => 'value/total', trans => [qw(percent)] },
- last_total => { src => 'last_total' },
- last_value => { src => 'last_value', agg => 'sum'},
- last_pct => { src => 'last_value/last_total', trans => [qw(percent)] },
- },
- visible => [qw(name value pct last_value last_pct)],
- filters => [qw()],
- sort_cols => '-value',
- sort_dir => '1',
- innodb => '',
- group_by => [qw(name)],
- aggregate => 1,
- },
- deadlock_locks => {
- capt => 'Deadlock Locks',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- mysql_thread_id => { src => 'mysql_thread_id' },
- dl_txn_num => { src => 'dl_txn_num' },
- lock_type => { src => 'lock_type' },
- space_id => { src => 'space_id' },
- page_no => { src => 'page_no' },
- heap_no => { src => 'heap_no' },
- n_bits => { src => 'n_bits' },
- index => { src => 'index' },
- db => { src => 'db' },
- tbl => { src => 'table' },
- lock_mode => { src => 'lock_mode' },
- special => { src => 'special' },
- insert_intention => { src => 'insert_intention' },
- waiting => { src => 'waiting' },
- },
- visible => [ qw(cxn mysql_thread_id waiting lock_mode db tbl index special insert_intention)],
- filters => [],
- sort_cols => 'cxn mysql_thread_id',
- sort_dir => '1',
- innodb => 'dl',
- group_by => [],
- aggregate => 0,
- },
- deadlock_transactions => {
- capt => 'Deadlock Transactions',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- active_secs => { src => 'active_secs' },
- dl_txn_num => { src => 'dl_txn_num' },
- has_read_view => { src => 'has_read_view' },
- heap_size => { src => 'heap_size' },
- host_and_domain => { src => 'hostname' },
- hostname => { src => $exprs{Host} },
- ip => { src => 'ip' },
- lock_structs => { src => 'lock_structs' },
- lock_wait_time => { src => 'lock_wait_time', trans => [ qw(secs_to_time) ] },
- mysql_thread_id => { src => 'mysql_thread_id' },
- os_thread_id => { src => 'os_thread_id' },
- proc_no => { src => 'proc_no' },
- query_id => { src => 'query_id' },
- query_status => { src => 'query_status' },
- query_text => { src => 'query_text', trans => [ qw(no_ctrl_char) ] },
- row_locks => { src => 'row_locks' },
- tables_in_use => { src => 'tables_in_use' },
- tables_locked => { src => 'tables_locked' },
- thread_decl_inside => { src => 'thread_decl_inside' },
- thread_status => { src => 'thread_status' },
- 'time' => { src => 'active_secs', trans => [ qw(secs_to_time) ] },
- timestring => { src => 'timestring' },
- txn_doesnt_see_ge => { src => 'txn_doesnt_see_ge' },
- txn_id => { src => 'txn_id' },
- txn_sees_lt => { src => 'txn_sees_lt' },
- txn_status => { src => 'txn_status' },
- truncates => { src => 'truncates' },
- undo_log_entries => { src => 'undo_log_entries' },
- user => { src => 'user' },
- victim => { src => 'victim' },
- wait_status => { src => 'lock_wait_status' },
- },
- visible => [ qw(cxn mysql_thread_id timestring user hostname victim time undo_log_entries lock_structs query_text)],
- filters => [],
- sort_cols => 'cxn mysql_thread_id',
- sort_dir => '1',
- innodb => 'dl',
- group_by => [],
- aggregate => 0,
- },
- explain => {
- capt => 'EXPLAIN Results',
- cust => {},
- cols => {
- part_id => { src => 'id' },
- select_type => { src => 'select_type' },
- tbl => { src => 'table' },
- partitions => { src => 'partitions' },
- scan_type => { src => 'type' },
- possible_keys => { src => 'possible_keys' },
- index => { src => 'key' },
- key_len => { src => 'key_len' },
- index_ref => { src => 'ref' },
- num_rows => { src => 'rows' },
- special => { src => 'extra' },
- },
- visible => [ qw(select_type tbl partitions scan_type possible_keys index key_len index_ref num_rows special)],
- filters => [],
- sort_cols => '',
- sort_dir => '1',
- innodb => '',
- group_by => [],
- aggregate => 0,
- },
- file_io_misc => {
- capt => 'File I/O Misc',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- io_bytes_s => { src => 'IB_io_avg_bytes_s' },
- io_flush_type => { src => 'IB_io_flush_type' },
- io_fsyncs_s => { src => 'IB_io_fsyncs_s' },
- io_reads_s => { src => 'IB_io_reads_s' },
- io_writes_s => { src => 'IB_io_writes_s' },
- os_file_reads => { src => 'IB_io_os_file_reads' },
- os_file_writes => { src => 'IB_io_os_file_writes' },
- os_fsyncs => { src => 'IB_io_os_fsyncs' },
- },
- visible => [ qw(cxn os_file_reads os_file_writes os_fsyncs io_reads_s io_writes_s io_bytes_s)],
- filters => [],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => 'io',
- group_by => [],
- aggregate => 0,
- },
- fk_error => {
- capt => 'Foreign Key Error Info',
- cust => {},
- cols => {
- timestring => { src => 'IB_fk_timestring' },
- child_db => { src => 'IB_fk_child_db' },
- child_table => { src => 'IB_fk_child_table' },
- child_index => { src => 'IB_fk_child_index' },
- fk_name => { src => 'IB_fk_fk_name' },
- parent_db => { src => 'IB_fk_parent_db' },
- parent_table => { src => 'IB_fk_parent_table' },
- parent_col => { src => 'IB_fk_parent_col' },
- parent_index => { src => 'IB_fk_parent_index' },
- attempted_op => { src => 'IB_fk_attempted_op' },
- },
- visible => [ qw(timestring child_db child_table child_index parent_db parent_table parent_col parent_index fk_name attempted_op)],
- filters => [],
- sort_cols => '',
- sort_dir => '1',
- innodb => 'fk',
- group_by => [],
- aggregate => 0,
- },
- insert_buffers => {
- capt => 'Insert Buffers',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- inserts => { src => 'IB_ib_inserts' },
- merged_recs => { src => 'IB_ib_merged_recs' },
- merges => { src => 'IB_ib_merges' },
- size => { src => 'IB_ib_size' },
- free_list_len => { src => 'IB_ib_free_list_len' },
- seg_size => { src => 'IB_ib_seg_size' },
- },
- visible => [ qw(cxn inserts merged_recs merges size free_list_len seg_size)],
- filters => [],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => 'ib',
- group_by => [],
- aggregate => 0,
- },
- innodb_locks => {
- capt => 'InnoDB Locks',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- db => { src => 'db' },
- index => { src => 'index' },
- insert_intention => { src => 'insert_intention' },
- lock_mode => { src => 'lock_mode' },
- lock_type => { src => 'lock_type' },
- lock_wait_time => { src => 'lock_wait_time', trans => [ qw(secs_to_time) ] },
- mysql_thread_id => { src => 'mysql_thread_id' },
- n_bits => { src => 'n_bits' },
- page_no => { src => 'page_no' },
- space_id => { src => 'space_id' },
- special => { src => 'special' },
- tbl => { src => 'table' },
- 'time' => { src => 'active_secs', hdr => 'Active', trans => [ qw(secs_to_time) ] },
- txn_id => { src => 'txn_id' },
- waiting => { src => 'waiting' },
- },
- visible => [ qw(cxn mysql_thread_id lock_type waiting lock_wait_time time lock_mode db tbl index insert_intention special)],
- filters => [],
- sort_cols => 'cxn -lock_wait_time',
- sort_dir => '1',
- innodb => 'tx',
- colors => [
- { col => 'lock_wait_time', op => '>', arg => 60, color => 'red' },
- { col => 'lock_wait_time', op => '>', arg => 30, color => 'yellow' },
- { col => 'lock_wait_time', op => '>', arg => 10, color => 'green' },
- ],
- group_by => [],
- aggregate => 0,
- },
- innodb_transactions => {
- capt => 'InnoDB Transactions',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- active_secs => { src => 'active_secs' },
- has_read_view => { src => 'has_read_view' },
- heap_size => { src => 'heap_size' },
- hostname => { src => $exprs{Host} },
- ip => { src => 'ip' },
- wait_status => { src => 'lock_wait_status' },
- lock_wait_time => { src => 'lock_wait_time', trans => [ qw(secs_to_time) ] },
- lock_structs => { src => 'lock_structs' },
- mysql_thread_id => { src => 'mysql_thread_id' },
- os_thread_id => { src => 'os_thread_id' },
- proc_no => { src => 'proc_no' },
- query_id => { src => 'query_id' },
- query_status => { src => 'query_status' },
- query_text => { src => 'query_text', trans => [ qw(no_ctrl_char) ] },
- txn_time_remain => { src => $exprs{TxnTimeRemain}, trans => [ qw(secs_to_time) ] },
- row_locks => { src => 'row_locks' },
- tables_in_use => { src => 'tables_in_use' },
- tables_locked => { src => 'tables_locked' },
- thread_decl_inside => { src => 'thread_decl_inside' },
- thread_status => { src => 'thread_status' },
- 'time' => { src => 'active_secs', trans => [ qw(secs_to_time) ], agg => 'sum' },
- txn_doesnt_see_ge => { src => 'txn_doesnt_see_ge' },
- txn_id => { src => 'txn_id' },
- txn_sees_lt => { src => 'txn_sees_lt' },
- txn_status => { src => 'txn_status', minw => 10, maxw => 10 },
- undo_log_entries => { src => 'undo_log_entries' },
- user => { src => 'user', maxw => 10 },
- cnt => { src => 'mysql_thread_id', minw => 0 },
- },
- visible => [ qw(cxn cnt mysql_thread_id user hostname txn_status time undo_log_entries query_text)],
- filters => [ qw( hide_self hide_inactive ) ],
- sort_cols => '-active_secs txn_status cxn mysql_thread_id',
- sort_dir => '1',
- innodb => 'tx',
- hide_caption => 1,
- colors => [
- { col => 'wait_status', op => 'eq', arg => 'LOCK WAIT', color => 'black on_red' },
- { col => 'time', op => '>', arg => 600, color => 'red' },
- { col => 'time', op => '>', arg => 300, color => 'yellow' },
- { col => 'time', op => '>', arg => 60, color => 'green' },
- { col => 'time', op => '>', arg => 30, color => 'cyan' },
- { col => 'txn_status', op => 'eq', arg => 'not started', color => 'white' },
- ],
- group_by => [ qw(cxn txn_status) ],
- aggregate => 0,
- },
- io_threads => {
- capt => 'I/O Threads',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- thread => { src => 'thread' },
- thread_purpose => { src => 'purpose' },
- event_set => { src => 'event_set' },
- thread_status => { src => 'state' },
- },
- visible => [ qw(cxn thread thread_purpose thread_status)],
- filters => [ qw() ],
- sort_cols => 'cxn thread',
- sort_dir => '1',
- innodb => 'io',
- group_by => [],
- aggregate => 0,
- },
- log_statistics => {
- capt => 'Log Statistics',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- last_chkp => { src => 'IB_lg_last_chkp' },
- log_flushed_to => { src => 'IB_lg_log_flushed_to' },
- log_ios_done => { src => 'IB_lg_log_ios_done' },
- log_ios_s => { src => 'IB_lg_log_ios_s' },
- log_seq_no => { src => 'IB_lg_log_seq_no' },
- pending_chkp_writes => { src => 'IB_lg_pending_chkp_writes' },
- pending_log_writes => { src => 'IB_lg_pending_log_writes' },
- },
- visible => [ qw(cxn log_seq_no log_flushed_to last_chkp log_ios_done log_ios_s)],
- filters => [],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => 'lg',
- group_by => [],
- aggregate => 0,
- },
- master_status => {
- capt => 'Master Status',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- binlog_do_db => { src => 'binlog_do_db' },
- binlog_ignore_db => { src => 'binlog_ignore_db' },
- master_file => { src => 'file' },
- master_pos => { src => 'position' },
- binlog_cache_overflow => { src => '(Binlog_cache_disk_use||0)/(Binlog_cache_use||1)', trans => [ qw(percent) ] },
- },
- visible => [ qw(cxn master_file master_pos binlog_cache_overflow)],
- filters => [ qw(cxn_is_master) ],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => '',
- group_by => [],
- aggregate => 0,
- },
- pending_io => {
- capt => 'Pending I/O',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- p_normal_aio_reads => { src => 'IB_io_pending_normal_aio_reads' },
- p_aio_writes => { src => 'IB_io_pending_aio_writes' },
- p_ibuf_aio_reads => { src => 'IB_io_pending_ibuf_aio_reads' },
- p_sync_ios => { src => 'IB_io_pending_sync_ios' },
- p_buf_pool_flushes => { src => 'IB_io_pending_buffer_pool_flushes' },
- p_log_flushes => { src => 'IB_io_pending_log_flushes' },
- p_log_ios => { src => 'IB_io_pending_log_ios' },
- p_preads => { src => 'IB_io_pending_preads' },
- p_pwrites => { src => 'IB_io_pending_pwrites' },
- },
- visible => [ qw(cxn p_normal_aio_reads p_aio_writes p_ibuf_aio_reads p_sync_ios p_log_flushes p_log_ios)],
- filters => [],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => 'io',
- group_by => [],
- aggregate => 0,
- },
- open_tables => {
- capt => 'Open Tables',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- db => { src => 'database' },
- tbl => { src => 'table' },
- num_times_open => { src => 'in_use' },
- is_name_locked => { src => 'name_locked' },
- },
- visible => [ qw(cxn db tbl num_times_open is_name_locked)],
- filters => [ qw(table_is_open) ],
- sort_cols => '-num_times_open cxn db tbl',
- sort_dir => '1',
- innodb => '',
- group_by => [],
- aggregate => 0,
- },
- page_statistics => {
- capt => 'Page Statistics',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- pages_read => { src => 'IB_bp_pages_read' },
- pages_written => { src => 'IB_bp_pages_written' },
- pages_created => { src => 'IB_bp_pages_created' },
- page_reads_sec => { src => 'IB_bp_page_reads_sec' },
- page_writes_sec => { src => 'IB_bp_page_writes_sec' },
- page_creates_sec => { src => 'IB_bp_page_creates_sec' },
- },
- visible => [ qw(cxn pages_read pages_written pages_created page_reads_sec page_writes_sec page_creates_sec)],
- filters => [],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => 'bp',
- group_by => [],
- aggregate => 0,
- },
- processlist => {
- capt => 'MySQL Process List',
- cust => {},
- cols => {
- cxn => { src => 'cxn', minw => 6, maxw => 10 },
- mysql_thread_id => { src => 'id', minw => 6, maxw => 0 },
- user => { src => 'user', minw => 5, maxw => 8 },
- hostname => { src => $exprs{Host}, minw => 13, maxw => 8, },
- port => { src => $exprs{Port}, minw => 0, maxw => 0, },
- host_and_port => { src => 'host', minw => 0, maxw => 0 },
- db => { src => 'db', minw => 6, maxw => 12 },
- cmd => { src => 'command', minw => 5, maxw => 0 },
- time => { src => 'time', minw => 5, maxw => 0, trans => [ qw(secs_to_time) ], agg => 'sum' },
- state => { src => 'state', minw => 0, maxw => 0 },
- info => { src => 'info', minw => 0, maxw => 0, trans => [ qw(no_ctrl_char) ] },
- cnt => { src => 'id', minw => 0, maxw => 0 },
- },
- visible => [ qw(cxn cmd cnt mysql_thread_id user hostname db time info)],
- filters => [ qw(hide_self hide_inactive hide_slave_io) ],
- sort_cols => '-time cxn hostname mysql_thread_id',
- sort_dir => '1',
- innodb => '',
- hide_caption => 1,
- colors => [
- { col => 'state', op => 'eq', arg => 'Locked', color => 'black on_red' },
- { col => 'cmd', op => 'eq', arg => 'Sleep', color => 'white' },
- { col => 'user', op => 'eq', arg => 'system user', color => 'white' },
- { col => 'cmd', op => 'eq', arg => 'Connect', color => 'white' },
- { col => 'cmd', op => 'eq', arg => 'Binlog Dump', color => 'white' },
- { col => 'time', op => '>', arg => 600, color => 'red' },
- { col => 'time', op => '>', arg => 120, color => 'yellow' },
- { col => 'time', op => '>', arg => 60, color => 'green' },
- { col => 'time', op => '>', arg => 30, color => 'cyan' },
- ],
- group_by => [qw(cxn cmd)],
- aggregate => 0,
- },
-
- # TODO: some more columns:
- # kb_used=hdr='BufUsed' minw='0' num='0' src='percent(1 - ((Key_blocks_unused * key_cache_block_size) / (key_buffer_size||1)))' dec='0' trans='' tbl='q_header' just='-' user='1' maxw='0' label='User-defined'
- # retries=hdr='Retries' minw='0' num='0' src='Slave_retried_transactions' dec='0' trans='' tbl='slave_sql_status' just='-' user='1' maxw='0' label='User-defined'
- # thd=hdr='Thd' minw='0' num='0' src='Threads_connected' dec='0' trans='' tbl='slave_sql_status' just='-' user='1' maxw='0' label='User-defined'
-
- q_header => {
- capt => 'Q-mode Header',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- questions => { src => 'Questions' },
- qps => { src => 'Questions/Uptime_hires', dec => 1, trans => [qw(shorten)] },
- load => { src => $exprs{ServerLoad}, dec => 1, trans => [qw(shorten)] },
- slow => { src => 'Slow_queries', dec => 1, trans => [qw(shorten)] },
- q_cache_hit => { src => $exprs{QcacheHitRatio}, dec => 1, trans => [qw(percent)] },
- key_buffer_hit => { src => '1-(Key_reads/(Key_read_requests||1))', dec => 1, trans => [qw(percent)] },
- bps_in => { src => 'Bytes_received/Uptime_hires', dec => 1, trans => [qw(shorten)] },
- bps_out => { src => 'Bytes_sent/Uptime_hires', dec => 1, trans => [qw(shorten)] },
- when => { src => 'when' },
- },
- visible => [ qw(cxn when load qps slow q_cache_hit key_buffer_hit bps_in bps_out)],
- filters => [],
- sort_cols => 'when cxn',
- sort_dir => '1',
- innodb => '',
- hide_caption => 1,
- group_by => [],
- aggregate => 0,
- },
- row_operations => {
- capt => 'InnoDB Row Operations',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- num_inserts => { src => 'IB_ro_num_rows_ins' },
- num_updates => { src => 'IB_ro_num_rows_upd' },
- num_reads => { src => 'IB_ro_num_rows_read' },
- num_deletes => { src => 'IB_ro_num_rows_del' },
- num_inserts_sec => { src => 'IB_ro_ins_sec' },
- num_updates_sec => { src => 'IB_ro_upd_sec' },
- num_reads_sec => { src => 'IB_ro_read_sec' },
- num_deletes_sec => { src => 'IB_ro_del_sec' },
- },
- visible => [ qw(cxn num_inserts num_updates num_reads num_deletes num_inserts_sec
- num_updates_sec num_reads_sec num_deletes_sec)],
- filters => [],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => 'ro',
- group_by => [],
- aggregate => 0,
- },
- row_operation_misc => {
- capt => 'Row Operation Misc',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- queries_in_queue => { src => 'IB_ro_queries_in_queue' },
- queries_inside => { src => 'IB_ro_queries_inside' },
- read_views_open => { src => 'IB_ro_read_views_open' },
- main_thread_id => { src => 'IB_ro_main_thread_id' },
- main_thread_proc_no => { src => 'IB_ro_main_thread_proc_no' },
- main_thread_state => { src => 'IB_ro_main_thread_state' },
- num_res_ext => { src => 'IB_ro_n_reserved_extents' },
- },
- visible => [ qw(cxn queries_in_queue queries_inside read_views_open main_thread_state)],
- filters => [],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => 'ro',
- group_by => [],
- aggregate => 0,
- },
- semaphores => {
- capt => 'InnoDB Semaphores',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- mutex_os_waits => { src => 'IB_sm_mutex_os_waits' },
- mutex_spin_rounds => { src => 'IB_sm_mutex_spin_rounds' },
- mutex_spin_waits => { src => 'IB_sm_mutex_spin_waits' },
- reservation_count => { src => 'IB_sm_reservation_count' },
- rw_excl_os_waits => { src => 'IB_sm_rw_excl_os_waits' },
- rw_excl_spins => { src => 'IB_sm_rw_excl_spins' },
- rw_shared_os_waits => { src => 'IB_sm_rw_shared_os_waits' },
- rw_shared_spins => { src => 'IB_sm_rw_shared_spins' },
- signal_count => { src => 'IB_sm_signal_count' },
- wait_array_size => { src => 'IB_sm_wait_array_size' },
- },
- visible => [ qw(cxn mutex_os_waits mutex_spin_waits mutex_spin_rounds
- rw_excl_os_waits rw_excl_spins rw_shared_os_waits rw_shared_spins
- signal_count reservation_count )],
- filters => [],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => 'sm',
- group_by => [],
- aggregate => 0,
- },
- slave_io_status => {
- capt => 'Slave I/O Status',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- connect_retry => { src => 'connect_retry' },
- master_host => { src => 'master_host', hdr => 'Master'},
- master_log_file => { src => 'master_log_file', hdr => 'File' },
- master_port => { src => 'master_port' },
- master_ssl_allowed => { src => 'master_ssl_allowed' },
- master_ssl_ca_file => { src => 'master_ssl_ca_file' },
- master_ssl_ca_path => { src => 'master_ssl_ca_path' },
- master_ssl_cert => { src => 'master_ssl_cert' },
- master_ssl_cipher => { src => 'master_ssl_cipher' },
- master_ssl_key => { src => 'master_ssl_key' },
- master_user => { src => 'master_user' },
- read_master_log_pos => { src => 'read_master_log_pos', hdr => 'Pos' },
- relay_log_size => { src => 'relay_log_space', trans => [qw(shorten)] },
- slave_io_running => { src => 'slave_io_running', hdr => 'On?' },
- slave_io_state => { src => 'slave_io_state', hdr => 'State' },
- },
- visible => [ qw(cxn master_host slave_io_running master_log_file relay_log_size read_master_log_pos slave_io_state)],
- filters => [ qw( cxn_is_slave ) ],
- sort_cols => 'slave_io_running cxn',
- colors => [
- { col => 'slave_io_running', op => 'ne', arg => 'Yes', color => 'black on_red' },
- ],
- sort_dir => '1',
- innodb => '',
- group_by => [],
- aggregate => 0,
- },
- slave_sql_status => {
- capt => 'Slave SQL Status',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- exec_master_log_pos => { src => 'exec_master_log_pos', hdr => 'Master Pos' },
- last_errno => { src => 'last_errno' },
- last_error => { src => 'last_error' },
- master_host => { src => 'master_host', hdr => 'Master' },
- relay_log_file => { src => 'relay_log_file' },
- relay_log_pos => { src => 'relay_log_pos' },
- relay_log_size => { src => 'relay_log_space', trans => [qw(shorten)] },
- relay_master_log_file => { src => 'relay_master_log_file', hdr => 'Master File' },
- replicate_do_db => { src => 'replicate_do_db' },
- replicate_do_table => { src => 'replicate_do_table' },
- replicate_ignore_db => { src => 'replicate_ignore_db' },
- replicate_ignore_table => { src => 'replicate_ignore_table' },
- replicate_wild_do_table => { src => 'replicate_wild_do_table' },
- replicate_wild_ignore_table => { src => 'replicate_wild_ignore_table' },
- skip_counter => { src => 'skip_counter' },
- slave_sql_running => { src => 'slave_sql_running', hdr => 'On?' },
- until_condition => { src => 'until_condition' },
- until_log_file => { src => 'until_log_file' },
- until_log_pos => { src => 'until_log_pos' },
- time_behind_master => { src => 'seconds_behind_master', trans => [ qw(secs_to_time) ] },
- bytes_behind_master => { src => 'master_log_file && master_log_file eq relay_master_log_file ? read_master_log_pos - exec_master_log_pos : 0', trans => [qw(shorten)] },
- slave_catchup_rate => { src => $exprs{SlaveCatchupRate}, trans => [ qw(set_precision) ] },
- slave_open_temp_tables => { src => 'Slave_open_temp_tables' },
- },
- visible => [ qw(cxn master_host slave_sql_running time_behind_master slave_catchup_rate slave_open_temp_tables relay_log_pos last_error)],
- filters => [ qw( cxn_is_slave ) ],
- sort_cols => 'slave_sql_running cxn',
- sort_dir => '1',
- innodb => '',
- colors => [
- { col => 'slave_sql_running', op => 'ne', arg => 'Yes', color => 'black on_red' },
- { col => 'time_behind_master', op => '>', arg => 600, color => 'red' },
- { col => 'time_behind_master', op => '>', arg => 60, color => 'yellow' },
- { col => 'time_behind_master', op => '==', arg => 0, color => 'white' },
- ],
- group_by => [],
- aggregate => 0,
- },
- t_header => {
- capt => 'T-Mode Header',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- dirty_bufs => { src => $exprs{DirtyBufs}, trans => [qw(percent)] },
- history_list_len => { src => 'IB_tx_history_list_len' },
- lock_structs => { src => 'IB_tx_num_lock_structs' },
- num_txns => { src => $exprs{NumTxns} },
- max_txn => { src => $exprs{MaxTxnTime}, trans => [qw(secs_to_time)] },
- undo_for => { src => 'IB_tx_purge_undo_for' },
- used_bufs => { src => $exprs{BufPoolFill}, trans => [qw(percent)]},
- versions => { src => $exprs{OldVersions} },
- },
- visible => [ qw(cxn history_list_len versions undo_for dirty_bufs used_bufs num_txns max_txn lock_structs)],
- filters => [ ],
- sort_cols => 'cxn',
- sort_dir => '1',
- innodb => '',
- colors => [],
- hide_caption => 1,
- group_by => [],
- aggregate => 0,
- },
- var_status => {
- capt => 'Variables & Status',
- cust => {},
- cols => {}, # Generated from current varset
- visible => [], # Generated from current varset
- filters => [],
- sort_cols => '',
- sort_dir => 1,
- innodb => '',
- temp => 1, # Do not persist to config file.
- hide_caption => 1,
- pivot => 0,
- group_by => [],
- aggregate => 0,
- },
- wait_array => {
- capt => 'InnoDB Wait Array',
- cust => {},
- cols => {
- cxn => { src => 'cxn' },
- thread => { src => 'thread' },
- waited_at_filename => { src => 'waited_at_filename' },
- waited_at_line => { src => 'waited_at_line' },
- 'time' => { src => 'waited_secs', trans => [ qw(secs_to_time) ] },
- request_type => { src => 'request_type' },
- lock_mem_addr => { src => 'lock_mem_addr' },
- lock_cfile_name => { src => 'lock_cfile_name' },
- lock_cline => { src => 'lock_cline' },
- writer_thread => { src => 'writer_thread' },
- writer_lock_mode => { src => 'writer_lock_mode' },
- num_readers => { src => 'num_readers' },
- lock_var => { src => 'lock_var' },
- waiters_flag => { src => 'waiters_flag' },
- last_s_file_name => { src => 'last_s_file_name' },
- last_s_line => { src => 'last_s_line' },
- last_x_file_name => { src => 'last_x_file_name' },
- last_x_line => { src => 'last_x_line' },
- cell_waiting => { src => 'cell_waiting' },
- cell_event_set => { src => 'cell_event_set' },
- },
- visible => [ qw(cxn thread time waited_at_filename waited_at_line request_type num_readers lock_var waiters_flag cell_waiting cell_event_set)],
- filters => [],
- sort_cols => 'cxn -time',
- sort_dir => '1',
- innodb => 'sm',
- group_by => [],
- aggregate => 0,
- },
-);
-
-# Initialize %tbl_meta from %columns and do some checks.
-foreach my $table_name ( keys %tbl_meta ) {
- my $table = $tbl_meta{$table_name};
- my $cols = $table->{cols};
-
- foreach my $col_name ( keys %$cols ) {
- my $col_def = $table->{cols}->{$col_name};
- die "I can't find a column named '$col_name' for '$table_name'" unless $columns{$col_name};
- $columns{$col_name}->{referenced} = 1;
-
- foreach my $prop ( keys %col_props ) {
- # Each column gets non-existing values set from %columns or defaults from %col_props.
- if ( !$col_def->{$prop} ) {
- $col_def->{$prop}
- = defined($columns{$col_name}->{$prop})
- ? $columns{$col_name}->{$prop}
- : $col_props{$prop};
- }
- }
-
- # Ensure transformations and aggregate functions are valid
- die "Unknown aggregate function '$col_def->{agg}' "
- . "for column '$col_name' in table '$table_name'"
- unless exists $agg_funcs{$col_def->{agg}};
- foreach my $trans ( @{$col_def->{trans}} ) {
- die "Unknown transformation '$trans' "
- . "for column '$col_name' in table '$table_name'"
- unless exists $trans_funcs{$trans};
- }
- }
-
- # Ensure each column in visible and group_by exists in cols
- foreach my $place ( qw(visible group_by) ) {
- foreach my $col_name ( @{$table->{$place}} ) {
- if ( !exists $cols->{$col_name} ) {
- die "Column '$col_name' is listed in '$place' for '$table_name', but doesn't exist";
- }
- }
- }
-
- # Compile sort and color subroutines
- $table->{sort_func} = make_sort_func($table);
- $table->{color_func} = make_color_func($table);
-}
-
-# This is for code cleanup:
-{
- my @unused_cols = grep { !$columns{$_}->{referenced} } sort keys %columns;
- if ( @unused_cols ) {
- die "The following columns are not used: "
- . join(' ', @unused_cols);
- }
-}
-
-# ###########################################################################
-# Operating modes {{{3
-# ###########################################################################
-my %modes = (
- B => {
- hdr => 'InnoDB Buffers',
- cust => {},
- note => 'Shows buffer info from InnoDB',
- action_for => {
- i => {
- action => sub { toggle_config('status_inc') },
- label => 'Toggle incremental status display',
- },
- },
- display_sub => \&display_B,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(buffer_pool page_statistics insert_buffers adaptive_hash_index)],
- visible_tables => [qw(buffer_pool page_statistics insert_buffers adaptive_hash_index)],
- },
- C => {
- hdr => 'Command Summary',
- cust => {},
- note => 'Shows relative magnitude of variables',
- action_for => {
- s => {
- action => sub { get_config_interactive('cmd_filter') },
- label => 'Choose variable prefix',
- },
- },
- display_sub => \&display_C,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(cmd_summary)],
- visible_tables => [qw(cmd_summary)],
- },
- D => {
- hdr => 'InnoDB Deadlocks',
- cust => {},
- note => 'View InnoDB deadlock information',
- action_for => {
- c => {
- action => sub { edit_table('deadlock_transactions') },
- label => 'Choose visible columns',
- },
- w => {
- action => \&create_deadlock,
- label => 'Wipe deadlock status info by creating a deadlock',
- },
- },
- display_sub => \&display_D,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(deadlock_transactions deadlock_locks)],
- visible_tables => [qw(deadlock_transactions deadlock_locks)],
- },
- F => {
- hdr => 'InnoDB FK Err',
- cust => {},
- note => 'View the latest InnoDB foreign key error',
- action_for => {},
- display_sub => \&display_F,
- connections => [],
- server_group => '',
- one_connection => 1,
- tables => [qw(fk_error)],
- visible_tables => [qw(fk_error)],
- },
- I => {
- hdr => 'InnoDB I/O Info',
- cust => {},
- note => 'Shows I/O info (i/o, log...) from InnoDB',
- action_for => {
- i => {
- action => sub { toggle_config('status_inc') },
- label => 'Toggle incremental status display',
- },
- },
- display_sub => \&display_I,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(io_threads pending_io file_io_misc log_statistics)],
- visible_tables => [qw(io_threads pending_io file_io_misc log_statistics)],
- },
- L => {
- hdr => 'Locks',
- cust => {},
- note => 'Shows transaction locks',
- action_for => {
- a => {
- action => sub { send_cmd_to_servers('CREATE TABLE IF NOT EXISTS test.innodb_lock_monitor(a int) ENGINE=InnoDB', 0, '', []); },
- label => 'Start the InnoDB Lock Monitor',
- },
- o => {
- action => sub { send_cmd_to_servers('DROP TABLE IF EXISTS test.innodb_lock_monitor', 0, '', []); },
- label => 'Stop the InnoDB Lock Monitor',
- },
- },
- display_sub => \&display_L,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(innodb_locks)],
- visible_tables => [qw(innodb_locks)],
- },
- M => {
- hdr => 'Replication Status',
- cust => {},
- note => 'Shows replication (master and slave) status',
- action_for => {
- a => {
- action => sub { send_cmd_to_servers('START SLAVE', 0, 'START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE = ?, MASTER_LOG_POS = ?', []); },
- label => 'Start slave(s)',
- },
- i => {
- action => sub { toggle_config('status_inc') },
- label => 'Toggle incremental status display',
- },
- o => {
- action => sub { send_cmd_to_servers('STOP SLAVE', 0, '', []); },
- label => 'Stop slave(s)',
- },
- b => {
- action => sub { purge_master_logs() },
- label => 'Purge unused master logs',
- },
- },
- display_sub => \&display_M,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(slave_sql_status slave_io_status master_status)],
- visible_tables => [qw(slave_sql_status slave_io_status master_status)],
- },
- O => {
- hdr => 'Open Tables',
- cust => {},
- note => 'Shows open tables in MySQL',
- action_for => {
- r => {
- action => sub { reverse_sort('open_tables'); },
- label => 'Reverse sort order',
- },
- s => {
- action => sub { choose_sort_cols('open_tables'); },
- label => "Choose sort column",
- },
- },
- display_sub => \&display_O,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(open_tables)],
- visible_tables => [qw(open_tables)],
- },
- Q => {
- hdr => 'Query List',
- cust => {},
- note => 'Shows queries from SHOW FULL PROCESSLIST',
- action_for => {
- a => {
- action => sub { toggle_filter('processlist', 'hide_self') },
- label => 'Toggle the innotop process',
- },
- c => {
- action => sub { edit_table('processlist') },
- label => 'Choose visible columns',
- },
- e => {
- action => sub { analyze_query('e'); },
- label => "Explain a thread's query",
- },
- f => {
- action => sub { analyze_query('f'); },
- label => "Show a thread's full query",
- },
- h => {
- action => sub { toggle_visible_table('Q', 'q_header') },
- label => 'Toggle the header on and off',
- },
- i => {
- action => sub { toggle_filter('processlist', 'hide_inactive') },
- label => 'Toggle idle processes',
- },
- k => {
- action => sub { kill_query('CONNECTION') },
- label => "Kill a query's connection",
- },
- r => {
- action => sub { reverse_sort('processlist'); },
- label => 'Reverse sort order',
- },
- s => {
- action => sub { choose_sort_cols('processlist'); },
- label => "Change the display's sort column",
- },
- x => {
- action => sub { kill_query('QUERY') },
- label => "Kill a query",
- },
- },
- display_sub => \&display_Q,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(q_header processlist)],
- visible_tables => [qw(q_header processlist)],
- },
- R => {
- hdr => 'InnoDB Row Ops',
- cust => {},
- note => 'Shows InnoDB row operation and semaphore info',
- action_for => {
- i => {
- action => sub { toggle_config('status_inc') },
- label => 'Toggle incremental status display',
- },
- },
- display_sub => \&display_R,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(row_operations row_operation_misc semaphores wait_array)],
- visible_tables => [qw(row_operations row_operation_misc semaphores wait_array)],
- },
- S => {
- hdr => 'Variables & Status',
- cust => {},
- note => 'Shows query load statistics a la vmstat',
- action_for => {
- '>' => {
- action => sub { switch_var_set('S_set', 1) },
- label => 'Switch to next variable set',
- },
- '<' => {
- action => sub { switch_var_set('S_set', -1) },
- label => 'Switch to prev variable set',
- },
- c => {
- action => sub {
- choose_var_set('S_set');
- start_S_mode();
- },
- label => "Choose which set to display",
- },
- e => {
- action => \&edit_current_var_set,
- label => 'Edit the current set of variables',
- },
- i => {
- action => sub { $clear_screen_sub->(); toggle_config('status_inc') },
- label => 'Toggle incremental status display',
- },
- '-' => {
- action => sub { set_display_precision(-1) },
- label => 'Decrease fractional display precision',
- },
- '+' => {
- action => sub { set_display_precision(1) },
- label => 'Increase fractional display precision',
- },
- g => {
- action => sub { set_s_mode('g') },
- label => 'Switch to graph (tload) view',
- },
- s => {
- action => sub { set_s_mode('s') },
- label => 'Switch to standard (vmstat) view',
- },
- v => {
- action => sub { set_s_mode('v') },
- label => 'Switch to pivoted view',
- },
- },
- display_sub => \&display_S,
- no_clear_screen => 1,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(var_status)],
- visible_tables => [qw(var_status)],
- },
- T => {
- hdr => 'InnoDB Txns',
- cust => {},
- note => 'Shows InnoDB transactions in top-like format',
- action_for => {
- a => {
- action => sub { toggle_filter('innodb_transactions', 'hide_self') },
- label => 'Toggle the innotop process',
- },
- c => {
- action => sub { edit_table('innodb_transactions') },
- label => 'Choose visible columns',
- },
- e => {
- action => sub { analyze_query('e'); },
- label => "Explain a thread's query",
- },
- f => {
- action => sub { analyze_query('f'); },
- label => "Show a thread's full query",
- },
- h => {
- action => sub { toggle_visible_table('T', 't_header') },
- label => 'Toggle the header on and off',
- },
- i => {
- action => sub { toggle_filter('innodb_transactions', 'hide_inactive') },
- label => 'Toggle inactive transactions',
- },
- k => {
- action => sub { kill_query('CONNECTION') },
- label => "Kill a transaction's connection",
- },
- r => {
- action => sub { reverse_sort('innodb_transactions'); },
- label => 'Reverse sort order',
- },
- s => {
- action => sub { choose_sort_cols('innodb_transactions'); },
- label => "Change the display's sort column",
- },
- x => {
- action => sub { kill_query('QUERY') },
- label => "Kill a query",
- },
- },
- display_sub => \&display_T,
- connections => [],
- server_group => '',
- one_connection => 0,
- tables => [qw(t_header innodb_transactions)],
- visible_tables => [qw(t_header innodb_transactions)],
- },
-);
-
-# ###########################################################################
-# Global key mappings {{{3
-# Keyed on a single character, which is read from the keyboard. Uppercase
-# letters switch modes. Lowercase letters access commands when in a mode.
-# These can be overridden by action_for in %modes.
-# ###########################################################################
-my %action_for = (
- '$' => {
- action => \&edit_configuration,
- label => 'Edit configuration settings',
- },
- '?' => {
- action => \&display_help,
- label => 'Show help',
- },
- '!' => {
- action => \&display_license,
- label => 'Show license and warranty',
- },
- '^' => {
- action => \&edit_table,
- label => "Edit the displayed table(s)",
- },
- '#' => {
- action => \&choose_server_groups,
- label => 'Select/create server groups',
- },
- '@' => {
- action => \&choose_servers,
- label => 'Select/create server connections',
- },
- '/' => {
- action => \&add_quick_filter,
- label => 'Quickly filter what you see',
- },
- '\\' => {
- action => \&clear_quick_filters,
- label => 'Clear quick-filters',
- },
- '%' => {
- action => \&choose_filters,
- label => 'Choose and edit table filters',
- },
- "\t" => {
- action => \&next_server_group,
- label => 'Switch to the next server group',
- key => 'TAB',
- },
- '=' => {
- action => \&toggle_aggregate,
- label => 'Toggle aggregation',
- },
- # TODO: can these be auto-generated from %modes?
- B => {
- action => sub { switch_mode('B') },
- label => '',
- },
- C => {
- action => sub { switch_mode('C') },
- label => '',
- },
- D => {
- action => sub { switch_mode('D') },
- label => '',
- },
- F => {
- action => sub { switch_mode('F') },
- label => '',
- },
- I => {
- action => sub { switch_mode('I') },
- label => '',
- },
- L => {
- action => sub { switch_mode('L') },
- label => '',
- },
- M => {
- action => sub { switch_mode('M') },
- label => '',
- },
- O => {
- action => sub { switch_mode('O') },
- label => '',
- },
- Q => {
- action => sub { switch_mode('Q') },
- label => '',
- },
- R => {
- action => sub { switch_mode('R') },
- label => '',
- },
- S => {
- action => \&start_S_mode,
- label => '',
- },
- T => {
- action => sub { switch_mode('T') },
- label => '',
- },
- d => {
- action => sub { get_config_interactive('interval') },
- label => 'Change refresh interval',
- },
- n => { action => \&next_server, label => 'Switch to the next connection' },
- p => { action => \&pause, label => 'Pause innotop', },
- q => { action => \&finish, label => 'Quit innotop', },
-);
-
-# ###########################################################################
-# Sleep times after certain statements {{{3
-# ###########################################################################
-my %stmt_sleep_time_for = ();
-
-# ###########################################################################
-# Config editor key mappings {{{3
-# ###########################################################################
-my %cfg_editor_action = (
- c => {
- note => 'Edit columns, etc in the displayed table(s)',
- func => \&edit_table,
- },
- g => {
- note => 'Edit general configuration',
- func => \&edit_configuration_variables,
- },
- k => {
- note => 'Edit row-coloring rules',
- func => \&edit_color_rules,
- },
- p => {
- note => 'Manage plugins',
- func => \&edit_plugins,
- },
- s => {
- note => 'Edit server groups',
- func => \&edit_server_groups,
- },
- S => {
- note => 'Edit SQL statement sleep delays',
- func => \&edit_stmt_sleep_times,
- },
- t => {
- note => 'Choose which table(s) to display in this mode',
- func => \&choose_mode_tables,
- },
-);
-
-# ###########################################################################
-# Color editor key mappings {{{3
-# ###########################################################################
-my %color_editor_action = (
- n => {
- note => 'Create a new color rule',
- func => sub {
- my ( $tbl, $idx ) = @_;
- my $meta = $tbl_meta{$tbl};
-
- $clear_screen_sub->();
- my $col;
- do {
- $col = prompt_list(
- 'Choose the target column for the rule',
- '',
- sub { return keys %{$meta->{cols}} },
- { map { $_ => $meta->{cols}->{$_}->{label} } keys %{$meta->{cols}} });
- } while ( !$col );
- ( $col ) = grep { $_ } split(/\W+/, $col);
- return $idx unless $col && exists $meta->{cols}->{$col};
-
- $clear_screen_sub->();
- my $op;
- do {
- $op = prompt_list(
- 'Choose the comparison operator for the rule',
- '',
- sub { return keys %comp_ops },
- { map { $_ => $comp_ops{$_} } keys %comp_ops } );
- } until ( $op );
- $op =~ s/\s+//g;
- return $idx unless $op && exists $comp_ops{$op};
-
- my $arg;
- do {
- $arg = prompt('Specify an argument for the comparison');
- } until defined $arg;
-
- my $color;
- do {
- $color = prompt_list(
- 'Choose the color(s) the row should be when the rule matches',
- '',
- sub { return keys %ansicolors },
- { map { $_ => $_ } keys %ansicolors } );
- } until defined $color;
- $color = join(' ', unique(grep { exists $ansicolors{$_} } split(/\W+/, $color)));
- return $idx unless $color;
-
- push @{$tbl_meta{$tbl}->{colors}}, {
- col => $col,
- op => $op,
- arg => $arg,
- color => $color
- };
- $tbl_meta{$tbl}->{cust}->{colors} = 1;
-
- return $idx;
- },
- },
- d => {
- note => 'Remove the selected rule',
- func => sub {
- my ( $tbl, $idx ) = @_;
- my @rules = @{ $tbl_meta{$tbl}->{colors} };
- return 0 unless @rules > 0 && $idx < @rules && $idx >= 0;
- splice(@{$tbl_meta{$tbl}->{colors}}, $idx, 1);
- $tbl_meta{$tbl}->{cust}->{colors} = 1;
- return $idx == @rules ? $#rules : $idx;
- },
- },
- j => {
- note => 'Move highlight down one',
- func => sub {
- my ( $tbl, $idx ) = @_;
- my $num_rules = scalar @{$tbl_meta{$tbl}->{colors}};
- return ($idx + 1) % $num_rules;
- },
- },
- k => {
- note => 'Move highlight up one',
- func => sub {
- my ( $tbl, $idx ) = @_;
- my $num_rules = scalar @{$tbl_meta{$tbl}->{colors}};
- return ($idx - 1) % $num_rules;
- },
- },
- '+' => {
- note => 'Move selected rule up one',
- func => sub {
- my ( $tbl, $idx ) = @_;
- my $meta = $tbl_meta{$tbl};
- my $dest = $idx == 0 ? scalar(@{$meta->{colors}} - 1) : $idx - 1;
- my $temp = $meta->{colors}->[$idx];
- $meta->{colors}->[$idx] = $meta->{colors}->[$dest];
- $meta->{colors}->[$dest] = $temp;
- $meta->{cust}->{colors} = 1;
- return $dest;
- },
- },
- '-' => {
- note => 'Move selected rule down one',
- func => sub {
- my ( $tbl, $idx ) = @_;
- my $meta = $tbl_meta{$tbl};
- my $dest = $idx == scalar(@{$meta->{colors}} - 1) ? 0 : $idx + 1;
- my $temp = $meta->{colors}->[$idx];
- $meta->{colors}->[$idx] = $meta->{colors}->[$dest];
- $meta->{colors}->[$dest] = $temp;
- $meta->{cust}->{colors} = 1;
- return $dest;
- },
- },
-);
-
-# ###########################################################################
-# Plugin editor key mappings {{{3
-# ###########################################################################
-my %plugin_editor_action = (
- '*' => {
- note => 'Toggle selected plugin active/inactive',
- func => sub {
- my ( $plugins, $idx ) = @_;
- my $plugin = $plugins->[$idx];
- $plugin->{active} = $plugin->{active} ? 0 : 1;
- return $idx;
- },
- },
- j => {
- note => 'Move highlight down one',
- func => sub {
- my ( $plugins, $idx ) = @_;
- return ($idx + 1) % scalar(@$plugins);
- },
- },
- k => {
- note => 'Move highlight up one',
- func => sub {
- my ( $plugins, $idx ) = @_;
- return $idx == 0 ? @$plugins - 1 : $idx - 1;
- },
- },
-);
-
-# ###########################################################################
-# Table editor key mappings {{{3
-# ###########################################################################
-my %tbl_editor_action = (
- a => {
- note => 'Add a column to the table',
- func => sub {
- my ( $tbl, $col ) = @_;
- my @visible_cols = @{ $tbl_meta{$tbl}->{visible} };
- my %all_cols = %{ $tbl_meta{$tbl}->{cols} };
- delete @all_cols{@visible_cols};
- my $choice = prompt_list(
- 'Choose a column',
- '',
- sub { return keys %all_cols; },
- { map { $_ => $all_cols{$_}->{label} || $all_cols{$_}->{hdr} } keys %all_cols });
- if ( $all_cols{$choice} ) {
- push @{$tbl_meta{$tbl}->{visible}}, $choice;
- $tbl_meta{$tbl}->{cust}->{visible} = 1;
- return $choice;
- }
- return $col;
- },
- },
- n => {
- note => 'Create a new column and add it to the table',
- func => sub {
- my ( $tbl, $col ) = @_;
-
- $clear_screen_sub->();
- print word_wrap("Choose a name for the column. This name is not displayed, and is used only "
- . "for internal reference. It can contain only lowercase letters, numbers, "
- . "and underscores.");
- print "\n\n";
- do {
- $col = prompt("Enter column name");
- $col = '' if $col =~ m/[^a-z0-9_]/;
- } while ( !$col );
-
- $clear_screen_sub->();
- my $hdr;
- do {
- $hdr = prompt("Enter column header");
- } while ( !$hdr );
-
- $clear_screen_sub->();
- print "Choose a source for the column's data\n\n";
- my ( $src, $sub, $err );
- do {
- if ( $err ) {
- print "Error: $err\n\n";
- }
- $src = prompt("Enter column source");
- if ( $src ) {
- ( $sub, $err ) = compile_expr($src);
- }
- } until ( !$err);
-
- # TODO: this duplicates %col_props.
- $tbl_meta{$tbl}->{cols}->{$col} = {
- hdr => $hdr,
- src => $src,
- just => '-',
- num => 0,
- label => 'User-defined',
- user => 1,
- tbl => $tbl,
- minw => 0,
- maxw => 0,
- trans => [],
- func => $sub,
- dec => 0,
- agg => 0,
- aggonly => 0,
- };
-
- $tbl_meta{$tbl}->{visible} = [ unique(@{$tbl_meta{$tbl}->{visible}}, $col) ];
- $tbl_meta{$tbl}->{cust}->{visible} = 1;
- return $col;
- },
- },
- d => {
- note => 'Remove selected column',
- func => sub {
- my ( $tbl, $col ) = @_;
- my @visible_cols = @{ $tbl_meta{$tbl}->{visible} };
- my $idx = 0;
- return $col unless @visible_cols > 1;
- while ( $visible_cols[$idx] ne $col ) {
- $idx++;
- }
- $tbl_meta{$tbl}->{visible} = [ grep { $_ ne $col } @visible_cols ];
- $tbl_meta{$tbl}->{cust}->{visible} = 1;
- return $idx == $#visible_cols ? $visible_cols[$idx - 1] : $visible_cols[$idx + 1];
- },
- },
- e => {
- note => 'Edit selected column',
- func => sub {
- # TODO: make this editor hotkey-driven and give readline support.
- my ( $tbl, $col ) = @_;
- $clear_screen_sub->();
- my $meta = $tbl_meta{$tbl}->{cols}->{$col};
- my @prop = qw(hdr label src just num minw maxw trans agg); # TODO redundant
-
- my $answer;
- do {
- # Do what the user asked...
- if ( $answer && grep { $_ eq $answer } @prop ) {
- # Some properties are arrays, others scalars.
- my $ini = ref $col_props{$answer} ? join(' ', @{$meta->{$answer}}) : $meta->{$answer};
- my $val = prompt("New value for $answer", undef, $ini);
- $val = [ split(' ', $val) ] if ref($col_props{$answer});
- if ( $answer eq 'trans' ) {
- $val = [ unique(grep{ exists $trans_funcs{$_} } @$val) ];
- }
- @{$meta}{$answer, 'user', 'tbl' } = ( $val, 1, $tbl );
- }
-
- my @display_lines = (
- '',
- "You are editing column $tbl.$col.\n",
- );
-
- push @display_lines, create_table2(
- \@prop,
- { map { $_ => $_ } @prop },
- { map { $_ => ref $meta->{$_} eq 'ARRAY' ? join(' ', @{$meta->{$_}})
- : ref $meta->{$_} ? '[expression code]'
- : $meta->{$_}
- } @prop
- },
- { sep => ' ' });
- draw_screen(\@display_lines, { raw => 1 });
- print "\n\n"; # One to add space, one to clear readline artifacts
- $answer = prompt('Edit what? (q to quit)');
- } while ( $answer ne 'q' );
-
- return $col;
- },
- },
- j => {
- note => 'Move highlight down one',
- func => sub {
- my ( $tbl, $col ) = @_;
- my @visible_cols = @{ $tbl_meta{$tbl}->{visible} };
- my $idx = 0;
- while ( $visible_cols[$idx] ne $col ) {
- $idx++;
- }
- return $visible_cols[ ($idx + 1) % @visible_cols ];
- },
- },
- k => {
- note => 'Move highlight up one',
- func => sub {
- my ( $tbl, $col ) = @_;
- my @visible_cols = @{ $tbl_meta{$tbl}->{visible} };
- my $idx = 0;
- while ( $visible_cols[$idx] ne $col ) {
- $idx++;
- }
- return $visible_cols[ $idx - 1 ];
- },
- },
- '+' => {
- note => 'Move selected column up one',
- func => sub {
- my ( $tbl, $col ) = @_;
- my $meta = $tbl_meta{$tbl};
- my @visible_cols = @{$meta->{visible}};
- my $idx = 0;
- while ( $visible_cols[$idx] ne $col ) {
- $idx++;
- }
- if ( $idx ) {
- $visible_cols[$idx] = $visible_cols[$idx - 1];
- $visible_cols[$idx - 1] = $col;
- $meta->{visible} = \@visible_cols;
- }
- else {
- shift @{$meta->{visible}};
- push @{$meta->{visible}}, $col;
- }
- $meta->{cust}->{visible} = 1;
- return $col;
- },
- },
- '-' => {
- note => 'Move selected column down one',
- func => sub {
- my ( $tbl, $col ) = @_;
- my $meta = $tbl_meta{$tbl};
- my @visible_cols = @{$meta->{visible}};
- my $idx = 0;
- while ( $visible_cols[$idx] ne $col ) {
- $idx++;
- }
- if ( $idx == $#visible_cols ) {
- unshift @{$meta->{visible}}, $col;
- pop @{$meta->{visible}};
- }
- else {
- $visible_cols[$idx] = $visible_cols[$idx + 1];
- $visible_cols[$idx + 1] = $col;
- $meta->{visible} = \@visible_cols;
- }
- $meta->{cust}->{visible} = 1;
- return $col;
- },
- },
- f => {
- note => 'Choose filters',
- func => sub {
- my ( $tbl, $col ) = @_;
- choose_filters($tbl);
- return $col;
- },
- },
- o => {
- note => 'Edit color rules',
- func => sub {
- my ( $tbl, $col ) = @_;
- edit_color_rules($tbl);
- return $col;
- },
- },
- s => {
- note => 'Choose sort columns',
- func => sub {
- my ( $tbl, $col ) = @_;
- choose_sort_cols($tbl);
- return $col;
- },
- },
- g => {
- note => 'Choose group-by (aggregate) columns',
- func => sub {
- my ( $tbl, $col ) = @_;
- choose_group_cols($tbl);
- return $col;
- },
- },
-);
-
-# ###########################################################################
-# Global variables and environment {{{2
-# ###########################################################################
-
-my @this_term_size; # w_chars, h_chars, w_pix, h_pix
-my @last_term_size; # w_chars, h_chars, w_pix, h_pix
-my $char;
-my $windows = $OSNAME =~ m/MSWin/;
-my $have_color = 0;
-my $MAX_ULONG = 4294967295; # 2^32-1
-my $num_regex = qr/^[+-]?(?=\d|\.)\d*(?:\.\d+)?(?:E[+-]?\d+|)$/i;
-my $int_regex = qr/^\d+$/;
-my $bool_regex = qr/^[01]$/;
-my $term = undef;
-my $file = undef; # File to watch for InnoDB monitor output
-my $file_mtime = undef; # Status of watched file
-my $file_data = undef; # Last chunk of text read from file
-my $innodb_parser = InnoDBParser->new;
-
-my $nonfatal_errs = join('|',
- 'Access denied for user',
- 'Unknown MySQL server host',
- 'Unknown database',
- 'Can\'t connect to local MySQL server through socket',
- 'Can\'t connect to MySQL server on',
- 'MySQL server has gone away',
- 'Cannot call SHOW INNODB STATUS',
- 'Access denied',
- 'AutoCommit',
-);
-
-if ( !$opts{n} ) {
- require Term::ReadLine;
- $term = Term::ReadLine->new('innotop');
-}
-
-# Stores status, variables, innodb status, master/slave status etc.
-# Keyed on connection name. Each entry is a hashref of current and past data sets,
-# keyed on clock tick.
-my %vars;
-my %info_gotten = (); # Which things have been retrieved for the current clock tick.
-
-# Stores info on currently displayed queries: cxn, connection ID, query text.
-my @current_queries;
-
-my $lines_printed = 0;
-my $clock = 0; # Incremented with every wake-sleep cycle
-my $clearing_deadlocks = 0;
-
-# Find the home directory; it's different on different OSes.
-my $homepath = $ENV{HOME} || $ENV{HOMEPATH} || $ENV{USERPROFILE} || '.';
-
-# If terminal coloring is available, use it. The only function I want from
-# the module is the colored() function.
-eval {
- if ( !$opts{n} ) {
- if ( $windows ) {
- require Win32::Console::ANSI;
- }
- require Term::ANSIColor;
- import Term::ANSIColor qw(colored);
- $have_color = 1;
- }
-};
-if ( $EVAL_ERROR || $opts{n} ) {
- # If there was an error, manufacture my own colored() function that does no
- # coloring.
- *colored = sub { pop @_; @_; };
-}
-
-if ( $opts{n} ) {
- $clear_screen_sub = sub {};
-}
-elsif ( $windows ) {
- $clear_screen_sub = sub { $lines_printed = 0; system("cls") };
-}
-else {
- my $clear = `clear`;
- $clear_screen_sub = sub { $lines_printed = 0; print $clear };
-}
-
-# ###########################################################################
-# Config storage. {{{2
-# ###########################################################################
-my %config = (
- color => {
- val => $have_color,
- note => 'Whether to use terminal coloring',
- conf => 'ALL',
- pat => $bool_regex,
- },
- cmd_filter => {
- val => 'Com_',
- note => 'Prefix for values in C mode',
- conf => [qw(C)],
- },
- plugin_dir => {
- val => "$homepath/.innotop/plugins",
- note => 'Directory where plugins can be found',
- conf => 'ALL',
- },
- show_percent => {
- val => 1,
- note => 'Show the % symbol after percentages',
- conf => 'ALL',
- pat => $bool_regex,
- },
- skip_innodb => {
- val => 0,
- note => 'Disable SHOW INNODB STATUS',
- conf => 'ALL',
- pat => $bool_regex,
- },
- S_func => {
- val => 's',
- note => 'What to display in S mode: graph, status, pivoted status',
- conf => [qw(S)],
- pat => qr/^[gsv]$/,
- },
- cxn_timeout => {
- val => 28800,
- note => 'Connection timeout for keeping unused connections alive',
- conf => 'ALL',
- pat => $int_regex,
- },
- graph_char => {
- val => '*',
- note => 'Character for drawing graphs',
- conf => [ qw(S) ],
- pat => qr/^.$/,
- },
- show_cxn_errors_in_tbl => {
- val => 1,
- note => 'Whether to display connection errors as rows in the table',
- conf => 'ALL',
- pat => $bool_regex,
- },
- hide_hdr => {
- val => 0,
- note => 'Whether to show column headers',
- conf => 'ALL',
- pat => $bool_regex,
- },
- show_cxn_errors => {
- val => 1,
- note => 'Whether to print connection errors to STDOUT',
- conf => 'ALL',
- pat => $bool_regex,
- },
- readonly => {
- val => 0,
- note => 'Whether the config file is read-only',
- conf => [ qw() ],
- pat => $bool_regex,
- },
- global => {
- val => 1,
- note => 'Whether to show GLOBAL variables and status',
- conf => 'ALL',
- pat => $bool_regex,
- },
- header_highlight => {
- val => 'bold',
- note => 'How to highlight table column headers',
- conf => 'ALL',
- pat => qr/^(?:bold|underline)$/,
- },
- display_table_captions => {
- val => 1,
- note => 'Whether to put captions on tables',
- conf => 'ALL',
- pat => $bool_regex,
- },
- charset => {
- val => 'ascii',
- note => 'What type of characters should be displayed in queries (ascii, unicode, none)',
- conf => 'ALL',
- pat => qr/^(?:ascii|unicode|none)$/,
- },
- auto_wipe_dl => {
- val => 0,
- note => 'Whether to auto-wipe InnoDB deadlocks',
- conf => 'ALL',
- pat => $bool_regex,
- },
- max_height => {
- val => 30,
- note => '[Win32] Max window height',
- conf => 'ALL',
- },
- debug => {
- val => 0,
- pat => $bool_regex,
- note => 'Debug mode (more verbose errors, uses more memory)',
- conf => 'ALL',
- },
- num_digits => {
- val => 2,
- pat => $int_regex,
- note => 'How many digits to show in fractional numbers and percents',
- conf => 'ALL',
- },
- debugfile => {
- val => "$homepath/.innotop/core_dump",
- note => 'A debug file in case you are interested in error output',
- },
- show_statusbar => {
- val => 1,
- pat => $bool_regex,
- note => 'Whether to show the status bar in the display',
- conf => 'ALL',
- },
- mode => {
- val => "T",
- note => "Which mode to start in",
- cmdline => 1,
- },
- status_inc => {
- val => 0,
- note => 'Whether to show raw or incremental values for status variables',
- pat => $bool_regex,
- },
- interval => {
- val => 10,
- pat => qr/^(?:(?:\d*?[1-9]\d*(?:\.\d*)?)|(?:\d*\.\d*?[1-9]\d*))$/,
- note => "The interval at which the display will be refreshed. Fractional values allowed.",
- },
- num_status_sets => {
- val => 9,
- pat => $int_regex,
- note => 'How many sets of STATUS and VARIABLES values to show',
- conf => [ qw(S) ],
- },
- S_set => {
- val => 'general',
- pat => qr/^\w+$/,
- note => 'Which set of variables to display in S (Variables & Status) mode',
- conf => [ qw(S) ],
- },
-);
-
-# ###########################################################################
-# Config file sections {{{2
-# The configuration file is broken up into sections like a .ini file. This
-# variable defines those sections and the subroutines responsible for reading
-# and writing them.
-# ###########################################################################
-my %config_file_sections = (
- plugins => {
- reader => \&load_config_plugins,
- writer => \&save_config_plugins,
- },
- group_by => {
- reader => \&load_config_group_by,
- writer => \&save_config_group_by,
- },
- filters => {
- reader => \&load_config_filters,
- writer => \&save_config_filters,
- },
- active_filters => {
- reader => \&load_config_active_filters,
- writer => \&save_config_active_filters,
- },
- visible_tables => {
- reader => \&load_config_visible_tables,
- writer => \&save_config_visible_tables,
- },
- sort_cols => {
- reader => \&load_config_sort_cols,
- writer => \&save_config_sort_cols,
- },
- active_columns => {
- reader => \&load_config_active_columns,
- writer => \&save_config_active_columns,
- },
- tbl_meta => {
- reader => \&load_config_tbl_meta,
- writer => \&save_config_tbl_meta,
- },
- general => {
- reader => \&load_config_config,
- writer => \&save_config_config,
- },
- connections => {
- reader => \&load_config_connections,
- writer => \&save_config_connections,
- },
- active_connections => {
- reader => \&load_config_active_connections,
- writer => \&save_config_active_connections,
- },
- server_groups => {
- reader => \&load_config_server_groups,
- writer => \&save_config_server_groups,
- },
- active_server_groups => {
- reader => \&load_config_active_server_groups,
- writer => \&save_config_active_server_groups,
- },
- max_values_seen => {
- reader => \&load_config_mvs,
- writer => \&save_config_mvs,
- },
- varsets => {
- reader => \&load_config_varsets,
- writer => \&save_config_varsets,
- },
- colors => {
- reader => \&load_config_colors,
- writer => \&save_config_colors,
- },
- stmt_sleep_times => {
- reader => \&load_config_stmt_sleep_times,
- writer => \&save_config_stmt_sleep_times,
- },
-);
-
-# Config file sections have some dependencies, so they have to be read/written in order.
-my @ordered_config_file_sections = qw(general plugins filters active_filters tbl_meta
- connections active_connections server_groups active_server_groups max_values_seen
- active_columns sort_cols visible_tables varsets colors stmt_sleep_times
- group_by);
-
-# All events for which plugins may register themselves. Entries are arrayrefs.
-my %event_listener_for = map { $_ => [] }
- qw(
- extract_values
- set_to_tbl_pre_filter set_to_tbl_pre_sort set_to_tbl_pre_group
- set_to_tbl_pre_colorize set_to_tbl_pre_transform set_to_tbl_pre_pivot
- set_to_tbl_pre_create set_to_tbl_post_create
- draw_screen
- );
-
-# All variables to which plugins have access.
-my %pluggable_vars = (
- action_for => \%action_for,
- agg_funcs => \%agg_funcs,
- config => \%config,
- connections => \%connections,
- dbhs => \%dbhs,
- filters => \%filters,
- modes => \%modes,
- server_groups => \%server_groups,
- tbl_meta => \%tbl_meta,
- trans_funcs => \%trans_funcs,
- var_sets => \%var_sets,
-);
-
-# ###########################################################################
-# Contains logic to generate prepared statements for a given function for a
-# given DB connection. Returns a $sth.
-# ###########################################################################
-my %stmt_maker_for = (
- INNODB_STATUS => sub {
- my ( $dbh ) = @_;
- return $dbh->prepare(version_ge( $dbh, '5.0.0' )
- ? 'SHOW ENGINE INNODB STATUS'
- : 'SHOW INNODB STATUS');
- },
- SHOW_VARIABLES => sub {
- my ( $dbh ) = @_;
- return $dbh->prepare($config{global}->{val} && version_ge( $dbh, '4.0.3' )
- ? 'SHOW GLOBAL VARIABLES'
- : 'SHOW VARIABLES');
- },
- SHOW_STATUS => sub {
- my ( $dbh ) = @_;
- return $dbh->prepare($config{global}->{val} && version_ge( $dbh, '5.0.2' )
- ? 'SHOW GLOBAL STATUS'
- : 'SHOW STATUS');
- },
- KILL_QUERY => sub {
- my ( $dbh ) = @_;
- return $dbh->prepare(version_ge( $dbh, '5.0.0' )
- ? 'KILL QUERY ?'
- : 'KILL ?');
- },
- SHOW_MASTER_LOGS => sub {
- my ( $dbh ) = @_;
- return $dbh->prepare('SHOW MASTER LOGS');
- },
- SHOW_MASTER_STATUS => sub {
- my ( $dbh ) = @_;
- return $dbh->prepare('SHOW MASTER STATUS');
- },
- SHOW_SLAVE_STATUS => sub {
- my ( $dbh ) = @_;
- return $dbh->prepare('SHOW SLAVE STATUS');
- },
- KILL_CONNECTION => sub {
- my ( $dbh ) = @_;
- return $dbh->prepare(version_ge( $dbh, '5.0.0' )
- ? 'KILL CONNECTION ?'
- : 'KILL ?');
- },
- OPEN_TABLES => sub {
- my ( $dbh ) = @_;
- return version_ge($dbh, '4.0.0')
- ? $dbh->prepare('SHOW OPEN TABLES')
- : undef;
- },
- PROCESSLIST => sub {
- my ( $dbh ) = @_;
- return $dbh->prepare('SHOW FULL PROCESSLIST');
- },
-);
-
-# Plugins!
-my %plugins = (
-);
-
-# ###########################################################################
-# Run the program {{{1
-# ###########################################################################
-
-# This config variable is only useful for MS Windows because its terminal
-# can't tell how tall it is.
-if ( !$windows ) {
- delete $config{max_height};
-}
-
-# Try to lower my priority.
-eval { setpriority(0, 0, getpriority(0, 0) + 10); };
-
-# Print stuff to the screen immediately, don't wait for a newline.
-$OUTPUT_AUTOFLUSH = 1;
-
-# Clear the screen and load the configuration.
-$clear_screen_sub->();
-load_config();
-post_process_tbl_meta();
-
-# Make sure no changes are written to config file in non-interactive mode.
-if ( $opts{n} ) {
- $config{readonly}->{val} = 1;
-}
-
-eval {
-
- # Open the file for InnoDB status
- if ( @ARGV ) {
- my $filename = shift @ARGV;
- open $file, "<", $filename
- or die "Cannot open '$filename': $OS_ERROR";
- }
-
- # In certain modes we might have to collect data for two cycles
- # before printing anything out, so we need to bump up the count one.
- if ( $opts{n} && $opts{count} && $config{status_inc}->{val}
- && $config{mode}->{val} =~ m/[S]/ )
- {
- $opts{count}++;
- }
-
- while (++$clock) {
-
- my $mode = $config{mode}->{val} || 'T';
- if ( !$modes{$mode} ) {
- die "Mode '$mode' doesn't exist; try one of these:\n"
- . join("\n", map { " $_ $modes{$_}->{hdr}" } sort keys %modes)
- . "\n";
- }
-
- if ( !$opts{n} ) {
- @last_term_size = @this_term_size;
- @this_term_size = Term::ReadKey::GetTerminalSize(\*STDOUT);
- if ( $windows ) {
- $this_term_size[0]--;
- $this_term_size[1]
- = min($this_term_size[1], $config{max_height}->{val});
- }
- die("Can't read terminal size") unless @this_term_size;
- }
-
- # If there's no connection to a database server, we need to fix that...
- if ( !%connections ) {
- print "You have not defined any database connections.\n\n";
- add_new_dsn();
- }
-
- # See whether there are any connections defined for this mode. If there's only one
- # connection total, assume the user wants to just use innotop for a single server
- # and don't ask which server to connect to. Also, if we're monitoring from a file,
- # we just use the first connection.
- if ( !get_connections() ) {
- if ( $file || 1 == scalar keys %connections ) {
- $modes{$config{mode}->{val}}->{connections} = [ keys %connections ];
- }
- else {
- choose_connections();
- }
- }
-
- # Term::ReadLine might have re-set $OUTPUT_AUTOFLUSH.
- $OUTPUT_AUTOFLUSH = 1;
-
- # Prune old data
- my $sets = $config{num_status_sets}->{val};
- foreach my $store ( values %vars ) {
- delete @{$store}{ grep { $_ < $clock - $sets } keys %$store };
- }
- %info_gotten = ();
-
- # Call the subroutine to display this mode.
- $modes{$mode}->{display_sub}->();
-
- # It may be time to quit now.
- if ( $opts{count} && $clock >= $opts{count} ) {
- finish();
- }
-
- # Wait for a bit.
- if ( $opts{n} ) {
- sleep($config{interval}->{val});
- }
- else {
- ReadMode('cbreak');
- $char = ReadKey($config{interval}->{val});
- ReadMode('normal');
- }
-
- # Handle whatever action the key indicates.
- do_key_action();
-
- }
-};
-if ( $EVAL_ERROR ) {
- core_dump( $EVAL_ERROR );
-}
-finish();
-
-# Subroutines {{{1
-# Mode functions{{{2
-# switch_mode {{{3
-sub switch_mode {
- my $mode = shift;
- $config{mode}->{val} = $mode;
-}
-
-# Prompting functions {{{2
-# prompt_list {{{3
-# Prompts the user for a value, given a question, initial value,
-# a completion function and a hashref of hints.
-sub prompt_list {
- die "Can't call in non-interactive mode" if $opts{n};
- my ( $question, $init, $completion, $hints ) = @_;
- if ( $hints ) {
- # Figure out how wide the table will be
- my $max_name = max(map { length($_) } keys %$hints );
- $max_name ||= 0;
- $max_name += 3;
- my @meta_rows = create_table2(
- [ sort keys %$hints ],
- { map { $_ => $_ } keys %$hints },
- { map { $_ => trunc($hints->{$_}, $this_term_size[0] - $max_name) } keys %$hints },
- { sep => ' ' });
- if (@meta_rows > 10) {
- # Try to split and stack the meta rows next to each other
- my $split = int(@meta_rows / 2);
- @meta_rows = stack_next(
- [@meta_rows[0..$split - 1]],
- [@meta_rows[$split..$#meta_rows]],
- { pad => ' | '},
- );
- }
- print join( "\n",
- '',
- map { ref $_ ? colored(@$_) : $_ } create_caption('Choose from', @meta_rows), ''),
- "\n";
- }
- $term->Attribs->{completion_function} = $completion;
- my $answer = $term->readline("$question: ", $init);
- $OUTPUT_AUTOFLUSH = 1;
- $answer = '' if !defined($answer);
- $answer =~ s/\s+$//;
- return $answer;
-}
-
-# prompt {{{3
-# Prints out a prompt and reads from the keyboard, then validates with the
-# validation regex until the input is correct.
-sub prompt {
- die "Can't call in non-interactive mode" if $opts{n};
- my ( $prompt, $regex, $init, $completion ) = @_;
- my $response;
- my $success = 0;
- do {
- if ( $completion ) {
- $term->Attribs->{completion_function} = $completion;
- }
- $response = $term->readline("$prompt: ", $init);
- if ( $regex && $response !~ m/$regex/ ) {
- print "Invalid response.\n\n";
- }
- else {
- $success = 1;
- }
- } while ( !$success );
- $OUTPUT_AUTOFLUSH = 1;
- $response =~ s/\s+$//;
- return $response;
-}
-
-# prompt_noecho {{{3
-# Unfortunately, suppressing echo with Term::ReadLine isn't reliable; the user might not
-# have that library, or it might not support that feature.
-sub prompt_noecho {
- my ( $prompt ) = @_;
- print colored("$prompt: ", 'underline');
- my $response;
- ReadMode('noecho');
- $response = <STDIN>;
- chomp($response);
- ReadMode('normal');
- return $response;
-}
-
-# do_key_action {{{3
-# Depending on whether a key was read, do something. Keys have certain
-# actions defined in lookup tables. Each mode may have its own lookup table,
-# which trumps the global table -- so keys can be context-sensitive. The key
-# may be read and written in a subroutine, so it's a global.
-sub do_key_action {
- if ( defined $char ) {
- my $mode = $config{mode}->{val};
- my $action
- = defined($modes{$mode}->{action_for}->{$char})
- ? $modes{$mode}->{action_for}->{$char}->{action}
- : defined($action_for{$char})
- ? $action_for{$char}->{action}
- : sub{};
- $action->();
- }
-}
-
-# pause {{{3
-sub pause {
- die "Can't call in non-interactive mode" if $opts{n};
- my $msg = shift;
- print defined($msg) ? "\n$msg" : "\nPress any key to continue";
- ReadMode('cbreak');
- my $char = ReadKey(0);
- ReadMode('normal');
- return $char;
-}
-
-# reverse_sort {{{3
-sub reverse_sort {
- my $tbl = shift;
- $tbl_meta{$tbl}->{sort_dir} *= -1;
-}
-
-# select_cxn {{{3
-# Selects connection(s). If the mode (or argument list) has only one, returns
-# it without prompt.
-sub select_cxn {
- my ( $prompt, @cxns ) = @_;
- if ( !@cxns ) {
- @cxns = get_connections();
- }
- if ( @cxns == 1 ) {
- return $cxns[0];
- }
- my $choices = prompt_list(
- $prompt,
- $cxns[0],
- sub{ return @cxns },
- { map { $_ => $connections{$_}->{dsn} } @cxns });
- my @result = unique(grep { my $a = $_; grep { $_ eq $a } @cxns } split(/\s+/, $choices));
- return @result;
-}
-
-# kill_query {{{3
-# Kills a connection, or on new versions, optionally a query but not connection.
-sub kill_query {
- my ( $q_or_c ) = @_;
-
- my $info = choose_thread(
- sub { 1 },
- 'Select a thread to kill the ' . $q_or_c,
- );
- return unless $info;
- return unless pause("Kill $info->{id}?") =~ m/y/i;
-
- eval {
- do_stmt($info->{cxn}, $q_or_c eq 'QUERY' ? 'KILL_QUERY' : 'KILL_CONNECTION', $info->{id} );
- };
-
- if ( $EVAL_ERROR ) {
- print "\nError: $EVAL_ERROR";
- pause();
- }
-}
-
-# set_display_precision {{{3
-sub set_display_precision {
- my $dir = shift;
- $config{num_digits}->{val} = min(9, max(0, $config{num_digits}->{val} + $dir));
-}
-
-sub toggle_visible_table {
- my ( $mode, $table ) = @_;
- my $visible = $modes{$mode}->{visible_tables};
- if ( grep { $_ eq $table } @$visible ) {
- $modes{$mode}->{visible_tables} = [ grep { $_ ne $table } @$visible ];
- }
- else {
- unshift @$visible, $table;
- }
- $modes{$mode}->{cust}->{visible_tables} = 1;
-}
-
-# toggle_filter{{{3
-sub toggle_filter {
- my ( $tbl, $filter ) = @_;
- my $filters = $tbl_meta{$tbl}->{filters};
- if ( grep { $_ eq $filter } @$filters ) {
- $tbl_meta{$tbl}->{filters} = [ grep { $_ ne $filter } @$filters ];
- }
- else {
- push @$filters, $filter;
- }
- $tbl_meta{$tbl}->{cust}->{filters} = 1;
-}
-
-# toggle_config {{{3
-sub toggle_config {
- my ( $key ) = @_;
- $config{$key}->{val} ^= 1;
-}
-
-# create_deadlock {{{3
-sub create_deadlock {
- $clear_screen_sub->();
-
- print "This function will deliberately cause a small deadlock, "
- . "clearing deadlock information from the InnoDB monitor.\n\n";
-
- my $answer = prompt("Are you sure you want to proceed? Say 'y' if you do");
- return 0 unless $answer eq 'y';
-
- my ( $cxn ) = select_cxn('Clear on which server? ');
- return unless $cxn && exists($connections{$cxn});
-
- clear_deadlock($cxn);
-}
-
-# deadlock_thread {{{3
-sub deadlock_thread {
- my ( $id, $tbl, $cxn ) = @_;
-
- eval {
- my $dbh = get_new_db_connection($cxn, 1);
- my @stmts = (
- "set transaction isolation level serializable",
- (version_ge($dbh, '4.0.11') ? "start transaction" : 'begin'),
- "select * from $tbl where a = $id",
- "update $tbl set a = $id where a <> $id",
- );
-
- foreach my $stmt (@stmts[0..2]) {
- $dbh->do($stmt);
- }
- sleep(1 + $id);
- $dbh->do($stmts[-1]);
- };
- if ( $EVAL_ERROR ) {
- if ( $EVAL_ERROR !~ m/Deadlock found/ ) {
- die $EVAL_ERROR;
- }
- }
- exit(0);
-}
-
-# Purges unused binlogs on the master, up to but not including the latest log.
-# TODO: guess which connections are slaves of a given master.
-sub purge_master_logs {
- my @cxns = get_connections();
-
- get_master_slave_status(@cxns);
-
- # Toss out the rows that don't have master/slave status...
- my @vars =
- grep { $_ && ($_->{file} || $_->{master_host}) }
- map { $vars{$_}->{$clock} } @cxns;
- @cxns = map { $_->{cxn} } @vars;
-
- # Figure out which master to purge ons.
- my @masters = map { $_->{cxn} } grep { $_->{file} } @vars;
- my ( $master ) = select_cxn('Which master?', @masters );
- return unless $master;
- my ($master_status) = grep { $_->{cxn} eq $master } @vars;
-
- # Figure out the result order (not lexical order) of master logs.
- my @master_logs = get_master_logs($master);
- my $i = 0;
- my %master_logs = map { $_->{log_name} => $i++ } @master_logs;
-
- # Ask which slave(s) are reading from this master.
- my @slave_status = grep { $_->{master_host} } @vars;
- my @slaves = map { $_->{cxn} } @slave_status;
- @slaves = select_cxn("Which slaves are reading from $master?", @slaves);
- @slave_status = grep { my $item = $_; grep { $item->{cxn} eq $_ } @slaves } @slave_status;
- return unless @slave_status;
-
- # Find the minimum binary log in use.
- my $min_log = min(map { $master_logs{$_->{master_log_file}} } @slave_status);
- my $log_name = $master_logs[$min_log]->{log_name};
-
- my $stmt = "PURGE MASTER LOGS TO '$log_name'";
- send_cmd_to_servers($stmt, 0, 'PURGE {MASTER | BINARY} LOGS {TO "log_name" | BEFORE "date"}', [$master]);
-}
-
-sub send_cmd_to_servers {
- my ( $cmd, $all, $hint, $cxns ) = @_;
- if ( $all ) {
- @$cxns = get_connections();
- }
- elsif ( !@$cxns ) {
- @$cxns = select_cxn('Which servers?', @$cxns);
- }
- if ( $hint ) {
- print "\nHint: $hint\n";
- }
- $cmd = prompt('Command to send', undef, $cmd);
- foreach my $cxn ( @$cxns ) {
- eval {
- my $sth = do_query($cxn, $cmd);
- };
- if ( $EVAL_ERROR ) {
- print "Error from $cxn: $EVAL_ERROR\n";
- }
- else {
- print "Success on $cxn\n";
- }
- }
- pause();
-}
-
-# Display functions {{{2
-
-sub set_s_mode {
- my ( $func ) = @_;
- $clear_screen_sub->();
- $config{S_func}->{val} = $func;
-}
-
-# start_S_mode {{{3
-sub start_S_mode {
- $clear_screen_sub->();
- switch_mode('S');
-}
-
-# display_B {{{3
-sub display_B {
- my @display_lines;
- my @cxns = get_connections();
- get_innodb_status(\@cxns);
-
- my @buffer_pool;
- my @page_statistics;
- my @insert_buffers;
- my @adaptive_hash_index;
- my %rows_for = (
- buffer_pool => \@buffer_pool,
- page_statistics => \@page_statistics,
- insert_buffers => \@insert_buffers,
- adaptive_hash_index => \@adaptive_hash_index,
- );
-
- my @visible = get_visible_tables();
- my %wanted = map { $_ => 1 } @visible;
-
- foreach my $cxn ( @cxns ) {
- my $set = $vars{$cxn}->{$clock};
- my $pre = $vars{$cxn}->{$clock-1} || $set;
-
- if ( $set->{IB_bp_complete} ) {
- if ( $wanted{buffer_pool} ) {
- push @buffer_pool, extract_values($set, $set, $pre, 'buffer_pool');
- }
- if ( $wanted{page_statistics} ) {
- push @page_statistics, extract_values($set, $set, $pre, 'page_statistics');
- }
- }
- if ( $set->{IB_ib_complete} ) {
- if ( $wanted{insert_buffers} ) {
- push @insert_buffers, extract_values(
- $config{status_inc}->{val} ? inc(0, $cxn) : $set, $set, $pre,
- 'insert_buffers');
- }
- if ( $wanted{adaptive_hash_index} ) {
- push @adaptive_hash_index, extract_values($set, $set, $pre, 'adaptive_hash_index');
- }
- }
- }
-
- my $first_table = 0;
- foreach my $tbl ( @visible ) {
- push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
- push @display_lines, get_cxn_errors(@cxns)
- if ( $config{debug}->{val} || !$first_table++ );
- }
-
- draw_screen(\@display_lines);
-}
-
-# display_C {{{3
-sub display_C {
- my @display_lines;
- my @cxns = get_connections();
- get_status_info(@cxns);
-
- my @cmd_summary;
- my %rows_for = (
- cmd_summary => \@cmd_summary,
- );
-
- my @visible = get_visible_tables();
- my %wanted = map { $_ => 1 } @visible;
-
- # For now, I'm manually pulling these variables out and pivoting. Eventually a SQL-ish
- # dialect should let me join a table to a grouped and pivoted table and do this more easily.
- # TODO: make it so.
- my $prefix = qr/^$config{cmd_filter}->{val}/; # TODO: this is a total hack
- my @values;
- my ($total, $last_total) = (0, 0);
- foreach my $cxn ( @cxns ) {
- my $set = $vars{$cxn}->{$clock};
- my $pre = $vars{$cxn}->{$clock-1} || $set;
- foreach my $key ( keys %$set ) {
- next unless $key =~ m/$prefix/i;
- my $val = $set->{$key};
- next unless defined $val && $val =~ m/^\d+$/;
- my $last_val = $val - ($pre->{$key} || 0);
- $total += $val;
- $last_total += $last_val;
- push @values, {
- name => $key,
- value => $val,
- last_value => $last_val,
- };
- }
- }
-
- # Add aggregation and turn into a real set TODO: total hack
- if ( $wanted{cmd_summary} ) {
- foreach my $value ( @values ) {
- @{$value}{qw(total last_total)} = ($total, $last_total);
- push @cmd_summary, extract_values($value, $value, $value, 'cmd_summary');
- }
- }
-
- my $first_table = 0;
- foreach my $tbl ( @visible ) {
- push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
- push @display_lines, get_cxn_errors(@cxns)
- if ( $config{debug}->{val} || !$first_table++ );
- }
-
- draw_screen(\@display_lines);
-}
-
-# display_D {{{3
-sub display_D {
- my @display_lines;
- my @cxns = get_connections();
- get_innodb_status(\@cxns);
-
- my @deadlock_transactions;
- my @deadlock_locks;
- my %rows_for = (
- deadlock_transactions => \@deadlock_transactions,
- deadlock_locks => \@deadlock_locks,
- );
-
- my @visible = get_visible_tables();
- my %wanted = map { $_ => 1 } @visible;
-
- foreach my $cxn ( @cxns ) {
- my $innodb_status = $vars{$cxn}->{$clock};
- my $prev_status = $vars{$cxn}->{$clock-1} || $innodb_status;
-
- if ( $innodb_status->{IB_dl_timestring} ) {
-
- my $victim = $innodb_status->{IB_dl_rolled_back} || 0;
-
- if ( %wanted ) {
- foreach my $txn_id ( keys %{$innodb_status->{IB_dl_txns}} ) {
- my $txn = $innodb_status->{IB_dl_txns}->{$txn_id};
- my $pre = $prev_status->{IB_dl_txns}->{$txn_id} || $txn;
-
- if ( $wanted{deadlock_transactions} ) {
- my $hash = extract_values($txn->{tx}, $txn->{tx}, $pre->{tx}, 'deadlock_transactions');
- $hash->{cxn} = $cxn;
- $hash->{dl_txn_num} = $txn_id;
- $hash->{victim} = $txn_id == $victim ? 'Yes' : 'No';
- $hash->{timestring} = $innodb_status->{IB_dl_timestring};
- $hash->{truncates} = $innodb_status->{IB_dl_complete} ? 'No' : 'Yes';
- push @deadlock_transactions, $hash;
- }
-
- if ( $wanted{deadlock_locks} ) {
- foreach my $lock ( @{$txn->{locks}} ) {
- my $hash = extract_values($lock, $lock, $lock, 'deadlock_locks');
- $hash->{dl_txn_num} = $txn_id;
- $hash->{cxn} = $cxn;
- $hash->{mysql_thread_id} = $txn->{tx}->{mysql_thread_id};
- push @deadlock_locks, $hash;
- }
- }
-
- }
- }
- }
- }
-
- my $first_table = 0;
- foreach my $tbl ( @visible ) {
- push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
- push @display_lines, get_cxn_errors(@cxns)
- if ( $config{debug}->{val} || !$first_table++ );
- }
-
- draw_screen(\@display_lines);
-}
-
-# display_F {{{3
-sub display_F {
- my @display_lines;
- my ( $cxn ) = get_connections();
- get_innodb_status([$cxn]);
- my $innodb_status = $vars{$cxn}->{$clock};
-
- if ( $innodb_status->{IB_fk_timestring} ) {
-
- push @display_lines, 'Reason: ' . $innodb_status->{IB_fk_reason};
-
- # Display FK errors caused by invalid DML.
- if ( $innodb_status->{IB_fk_txn} ) {
- my $txn = $innodb_status->{IB_fk_txn};
- push @display_lines,
- '',
- "User $txn->{user} from $txn->{hostname}, thread $txn->{mysql_thread_id} was executing:",
- '', no_ctrl_char($txn->{query_text});
- }
-
- my @fk_table = create_table2(
- $tbl_meta{fk_error}->{visible},
- meta_to_hdr('fk_error'),
- extract_values($innodb_status, $innodb_status, $innodb_status, 'fk_error'),
- { just => '-', sep => ' '});
- push @display_lines, '', @fk_table;
-
- }
- else {
- push @display_lines, '', 'No foreign key error data.';
- }
- draw_screen(\@display_lines, { raw => 1 } );
-}
-
-# display_I {{{3
-sub display_I {
- my @display_lines;
- my @cxns = get_connections();
- get_innodb_status(\@cxns);
-
- my @io_threads;
- my @pending_io;
- my @file_io_misc;
- my @log_statistics;
- my %rows_for = (
- io_threads => \@io_threads,
- pending_io => \@pending_io,
- file_io_misc => \@file_io_misc,
- log_statistics => \@log_statistics,
- );
-
- my @visible = get_visible_tables();
- my %wanted = map { $_ => 1 } @visible;
-
- foreach my $cxn ( @cxns ) {
- my $set = $vars{$cxn}->{$clock};
- my $pre = $vars{$cxn}->{$clock-1} || $set;
-
- if ( $set->{IB_io_complete} ) {
- if ( $wanted{io_threads} ) {
- my $cur_threads = $set->{IB_io_threads};
- my $pre_threads = $pre->{IB_io_threads} || $cur_threads;
- foreach my $key ( sort keys %$cur_threads ) {
- my $cur_thd = $cur_threads->{$key};
- my $pre_thd = $pre_threads->{$key} || $cur_thd;
- my $hash = extract_values($cur_thd, $cur_thd, $pre_thd, 'io_threads');
- $hash->{cxn} = $cxn;
- push @io_threads, $hash;
- }
- }
- if ( $wanted{pending_io} ) {
- push @pending_io, extract_values($set, $set, $pre, 'pending_io');
- }
- if ( $wanted{file_io_misc} ) {
- push @file_io_misc, extract_values(
- $config{status_inc}->{val} ? inc(0, $cxn) : $set,
- $set, $pre, 'file_io_misc');
- }
- }
- if ( $set->{IB_lg_complete} && $wanted{log_statistics} ) {
- push @log_statistics, extract_values($set, $set, $pre, 'log_statistics');
- }
- }
-
- my $first_table = 0;
- foreach my $tbl ( @visible ) {
- push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
- push @display_lines, get_cxn_errors(@cxns)
- if ( $config{debug}->{val} || !$first_table++ );
- }
-
- draw_screen(\@display_lines);
-}
-
-# display_L {{{3
-sub display_L {
- my @display_lines;
- my @cxns = get_connections();
- get_innodb_status(\@cxns);
-
- my @innodb_locks;
- my %rows_for = (
- innodb_locks => \@innodb_locks,
- );
-
- my @visible = get_visible_tables();
- my %wanted = map { $_ => 1 } @visible;
-
- # Get info on locks
- foreach my $cxn ( @cxns ) {
- my $set = $vars{$cxn}->{$clock} or next;
- my $pre = $vars{$cxn}->{$clock-1} || $set;
-
- if ( $wanted{innodb_locks} && defined $set->{IB_tx_transactions} && @{$set->{IB_tx_transactions}} ) {
-
- my $cur_txns = $set->{IB_tx_transactions};
- my $pre_txns = $pre->{IB_tx_transactions} || $cur_txns;
- my %cur_txns = map { $_->{mysql_thread_id} => $_ } @$cur_txns;
- my %pre_txns = map { $_->{mysql_thread_id} => $_ } @$pre_txns;
- foreach my $txn ( @$cur_txns ) {
- foreach my $lock ( @{$txn->{locks}} ) {
- my %hash = map { $_ => $txn->{$_} } qw(txn_id mysql_thread_id lock_wait_time active_secs);
- map { $hash{$_} = $lock->{$_} } qw(lock_type space_id page_no n_bits index db table txn_id lock_mode special insert_intention waiting);
- $hash{cxn} = $cxn;
- push @innodb_locks, extract_values(\%hash, \%hash, \%hash, 'innodb_locks');
- }
- }
- }
- }
-
- my $first_table = 0;
- foreach my $tbl ( @visible ) {
- push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
- push @display_lines, get_cxn_errors(@cxns)
- if ( $config{debug}->{val} || !$first_table++ );
- }
-
- draw_screen(\@display_lines);
-}
-
-# display_M {{{3
-sub display_M {
- my @display_lines;
- my @cxns = get_connections();
- get_master_slave_status(@cxns);
- get_status_info(@cxns);
-
- my @slave_sql_status;
- my @slave_io_status;
- my @master_status;
- my %rows_for = (
- slave_sql_status => \@slave_sql_status,
- slave_io_status => \@slave_io_status,
- master_status => \@master_status,
- );
-
- my @visible = get_visible_tables();
- my %wanted = map { $_ => 1 } @visible;
-
- foreach my $cxn ( @cxns ) {
- my $set = $config{status_inc}->{val} ? inc(0, $cxn) : $vars{$cxn}->{$clock};
- my $pre = $vars{$cxn}->{$clock - 1} || $set;
- if ( $wanted{slave_sql_status} ) {
- push @slave_sql_status, extract_values($set, $set, $pre, 'slave_sql_status');
- }
- if ( $wanted{slave_io_status} ) {
- push @slave_io_status, extract_values($set, $set, $pre, 'slave_io_status');
- }
- if ( $wanted{master_status} ) {
- push @master_status, extract_values($set, $set, $pre, 'master_status');
- }
- }
-
- my $first_table = 0;
- foreach my $tbl ( @visible ) {
- push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
- push @display_lines, get_cxn_errors(@cxns)
- if ( $config{debug}->{val} || !$first_table++ );
- }
-
- draw_screen(\@display_lines);
-}
-
-# display_O {{{3
-sub display_O {
- my @display_lines = ('');
- my @cxns = get_connections();
- my @open_tables = get_open_tables(@cxns);
- my @tables = map { extract_values($_, $_, $_, 'open_tables') } @open_tables;
- push @display_lines, set_to_tbl(\@tables, 'open_tables'), get_cxn_errors(@cxns);
- draw_screen(\@display_lines);
-}
-
-# display_Q {{{3
-sub display_Q {
- my @display_lines;
-
- my @q_header;
- my @processlist;
- my %rows_for = (
- q_header => \@q_header,
- processlist => \@processlist,
- );
-
- my @visible = $opts{n} ? 'processlist' : get_visible_tables();
- my %wanted = map { $_ => 1 } @visible;
-
- # Get the data
- my @cxns = get_connections();
- my @full_processlist = get_full_processlist(@cxns);
-
- # Create header
- if ( $wanted{q_header} ) {
- get_status_info(@cxns);
- foreach my $cxn ( @cxns ) {
- my $set = $vars{$cxn}->{$clock};
- my $pre = $vars{$cxn}->{$clock-1} || $set;
- my $hash = extract_values($set, $set, $pre, 'q_header');
- $hash->{cxn} = $cxn;
- $hash->{when} = 'Total';
- push @q_header, $hash;
-
- if ( exists $vars{$cxn}->{$clock - 1} ) {
- my $inc = inc(0, $cxn);
- my $hash = extract_values($inc, $set, $pre, 'q_header');
- $hash->{cxn} = $cxn;
- $hash->{when} = 'Now';
- push @q_header, $hash;
- }
- }
- }
-
- if ( $wanted{processlist} ) {
- # TODO: save prev values
- push @processlist, map { extract_values($_, $_, $_, 'processlist') } @full_processlist;
- }
-
- my $first_table = 0;
- foreach my $tbl ( @visible ) {
- next unless $wanted{$tbl};
- push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
- push @display_lines, get_cxn_errors(@cxns)
- if ( $config{debug}->{val} || !$first_table++ );
- }
-
- # Save queries in global variable for analysis. The rows in %rows_for have been
- # filtered, etc as a side effect of set_to_tbl(), so they are the same as the rows
- # that get pushed to the screen.
- @current_queries = map {
- my %hash;
- @hash{ qw(cxn id db query secs) } = @{$_}{ qw(cxn mysql_thread_id db info secs) };
- \%hash;
- } @{$rows_for{processlist}};
-
- draw_screen(\@display_lines);
-}
-
-# display_R {{{3
-sub display_R {
- my @display_lines;
- my @cxns = get_connections();
- get_innodb_status(\@cxns);
-
- my @row_operations;
- my @row_operation_misc;
- my @semaphores;
- my @wait_array;
- my %rows_for = (
- row_operations => \@row_operations,
- row_operation_misc => \@row_operation_misc,
- semaphores => \@semaphores,
- wait_array => \@wait_array,
- );
-
- my @visible = get_visible_tables();
- my %wanted = map { $_ => 1 } @visible;
- my $incvar = $config{status_inc}->{val};
-
- foreach my $cxn ( @cxns ) {
- my $set = $vars{$cxn}->{$clock};
- my $pre = $vars{$cxn}->{$clock-1} || $set;
- my $inc; # Only assigned to if wanted
-
- if ( $set->{IB_ro_complete} ) {
- if ( $wanted{row_operations} ) {
- $inc ||= $incvar ? inc(0, $cxn) : $set;
- push @row_operations, extract_values($inc, $set, $pre, 'row_operations');
- }
- if ( $wanted{row_operation_misc} ) {
- push @row_operation_misc, extract_values($set, $set, $pre, 'row_operation_misc'),
- }
- }
-
- if ( $set->{IB_sm_complete} && $wanted{semaphores} ) {
- $inc ||= $incvar ? inc(0, $cxn) : $set;
- push @semaphores, extract_values($inc, $set, $pre, 'semaphores');
- }
-
- if ( $set->{IB_sm_wait_array_size} && $wanted{wait_array} ) {
- foreach my $wait ( @{$set->{IB_sm_waits}} ) {
- my $hash = extract_values($wait, $wait, $wait, 'wait_array');
- $hash->{cxn} = $cxn;
- push @wait_array, $hash;
- }
- }
- }
-
- my $first_table = 0;
- foreach my $tbl ( @visible ) {
- push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
- push @display_lines, get_cxn_errors(@cxns)
- if ( $config{debug}->{val} || !$first_table++ );
- }
-
- draw_screen(\@display_lines);
-}
-
-# display_T {{{3
-sub display_T {
- my @display_lines;
-
- my @t_header;
- my @innodb_transactions;
- my %rows_for = (
- t_header => \@t_header,
- innodb_transactions => \@innodb_transactions,
- );
-
- my @visible = $opts{n} ? 'innodb_transactions' : get_visible_tables();
- my %wanted = map { $_ => 1 } @visible;
-
- my @cxns = get_connections();
-
- # If the header is to be shown, buffer pool data is required.
- get_innodb_status( \@cxns, [ $wanted{t_header} ? qw(bp) : () ] );
-
- foreach my $cxn ( get_connections() ) {
- my $set = $vars{$cxn}->{$clock};
- my $pre = $vars{$cxn}->{$clock-1} || $set;
-
- next unless $set->{IB_tx_transactions};
-
- if ( $wanted{t_header} ) {
- my $hash = extract_values($set, $set, $pre, 't_header');
- push @t_header, $hash;
- }
-
- if ( $wanted{innodb_transactions} ) {
- my $cur_txns = $set->{IB_tx_transactions};
- my $pre_txns = $pre->{IB_tx_transactions} || $cur_txns;
- my %cur_txns = map { $_->{mysql_thread_id} => $_ } @$cur_txns;
- my %pre_txns = map { $_->{mysql_thread_id} => $_ } @$pre_txns;
- foreach my $thd_id ( sort keys %cur_txns ) {
- my $cur_txn = $cur_txns{$thd_id};
- my $pre_txn = $pre_txns{$thd_id} || $cur_txn;
- my $hash = extract_values($cur_txn, $cur_txn, $pre_txn, 'innodb_transactions');
- $hash->{cxn} = $cxn;
- push @innodb_transactions, $hash;
- }
- }
-
- }
-
- my $first_table = 0;
- foreach my $tbl ( @visible ) {
- push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
- push @display_lines, get_cxn_errors(@cxns)
- if ( $config{debug}->{val} || !$first_table++ );
- }
-
- # Save queries in global variable for analysis. The rows in %rows_for have been
- # filtered, etc as a side effect of set_to_tbl(), so they are the same as the rows
- # that get pushed to the screen.
- @current_queries = map {
- my %hash;
- @hash{ qw(cxn id db query secs) } = @{$_}{ qw(cxn mysql_thread_id db query_text active_secs) };
- \%hash;
- } @{$rows_for{innodb_transactions}};
-
- draw_screen(\@display_lines);
-}
-
-# display_S {{{3
-sub display_S {
- my $fmt = get_var_set('S_set');
- my $func = $config{S_func}->{val};
- my $inc = $func eq 'g' || $config{status_inc}->{val};
-
- # The table's meta-data is generated from the compiled var_set.
- my ( $cols, $visible );
- if ( $tbl_meta{var_status}->{fmt} && $fmt eq $tbl_meta{var_status}->{fmt} ) {
- ( $cols, $visible ) = @{$tbl_meta{var_status}}{qw(cols visible)};
- }
- else {
- ( $cols, $visible ) = compile_select_stmt($fmt);
-
- # Apply missing values to columns. Always apply averages across all connections.
- map {
- $_->{agg} = 'avg';
- $_->{label} = $_->{hdr};
- } values %$cols;
-
- $tbl_meta{var_status}->{cols} = $cols;
- $tbl_meta{var_status}->{visible} = $visible;
- $tbl_meta{var_status}->{fmt} = $fmt;
- map { $tbl_meta{var_status}->{cols}->{$_}->{just} = ''} @$visible;
- }
-
- my @var_status;
- my %rows_for = (
- var_status => \@var_status,
- );
-
- my @visible = get_visible_tables();
- my %wanted = map { $_ => 1 } @visible;
- my @cxns = get_connections();
-
- get_status_info(@cxns);
- get_innodb_status(\@cxns);
-
- # Set up whether to pivot and how many sets to extract.
- $tbl_meta{var_status}->{pivot} = $func eq 'v';
-
- my $num_sets
- = $func eq 'v'
- ? $config{num_status_sets}->{val}
- : 0;
- foreach my $set ( 0 .. $num_sets ) {
- my @rows;
- foreach my $cxn ( @cxns ) {
- my $vars = $inc ? inc($set, $cxn) : $vars{$cxn}->{$clock - $set};
- my $cur = $vars{$cxn}->{$clock-$set};
- my $pre = $vars{$cxn}->{$clock-$set-1} || $cur;
- next unless $vars && %$vars;
- my $hash = extract_values($vars, $cur, $pre, 'var_status');
- push @rows, $hash;
- }
- @rows = apply_group_by('var_status', [], @rows);
- push @var_status, @rows;
- }
-
- # Recompile the sort func. TODO: avoid recompiling at every refresh.
- # Figure out whether the data is all numeric and decide on a sort type.
- # my $cmp
- # = scalar(
- # grep { !defined $_ || $_ !~ m/^\d+$/ }
- # map { my $col = $_; map { $_->{$col} } @var_status }
- # $tbl_meta{var_status}->{sort_cols} =~ m/(\w+)/g)
- # ? 'cmp'
- # : '<=>';
- $tbl_meta{var_status}->{sort_func} = make_sort_func($tbl_meta{var_status});
-
- # ################################################################
- # Now there is specific display code based on $config{S_func}
- # ################################################################
- if ( $func =~ m/s|g/ ) {
- my $min_width = 4;
-
- # Clear the screen if the display width changed.
- if ( @last_term_size && $this_term_size[0] != $last_term_size[0] ) {
- $lines_printed = 0;
- $clear_screen_sub->();
- }
-
- if ( $func eq 's' ) {
- # Decide how wide columns should be.
- my $num_cols = scalar(@$visible);
- my $width = $opts{n} ? 0 : max($min_width, int(($this_term_size[0] - $num_cols + 1) / $num_cols));
- my $g_format = $opts{n} ? ( "%s\t" x $num_cols ) : ( "%-${width}s " x $num_cols );
-
- # Print headers every now and then. Headers can get really long, so compact them.
- my @hdr = @$visible;
- if ( $opts{n} ) {
- if ( $lines_printed == 0 ) {
- print join("\t", @hdr), "\n";
- $lines_printed++;
- }
- }
- elsif ( $lines_printed == 0 || $lines_printed > $this_term_size[1] - 2 ) {
- @hdr = map { donut(crunch($_, $width), $width) } @hdr;
- print join(' ', map { sprintf( "%${width}s", donut($_, $width)) } @hdr) . "\n";
- $lines_printed = 1;
- }
-
- # Design a column format for the values.
- my $format
- = $opts{n}
- ? join("\t", map { '%s' } @$visible) . "\n"
- : join(' ', map { "%${width}s" } @hdr) . "\n";
-
- foreach my $row ( @var_status ) {
- printf($format, map { defined $_ ? $_ : '' } @{$row}{ @$visible });
- $lines_printed++;
- }
- }
- else { # 'g' mode
- # Design a column format for the values.
- my $num_cols = scalar(@$visible);
- my $width = $opts{n} ? 0 : int(($this_term_size[0] - $num_cols + 1) / $num_cols);
- my $format = $opts{n} ? ( "%s\t" x $num_cols ) : ( "%-${width}s " x $num_cols );
- $format =~ s/\s$/\n/;
-
- # Print headers every now and then.
- if ( $opts{n} ) {
- if ( $lines_printed == 0 ) {
- print join("\t", @$visible), "\n";
- print join("\t", map { shorten($mvs{$_}) } @$visible), "\n";
- }
- }
- elsif ( $lines_printed == 0 || $lines_printed > $this_term_size[1] - 2 ) {
- printf($format, map { donut(crunch($_, $width), $width) } @$visible);
- printf($format, map { shorten($mvs{$_} || 0) } @$visible);
- $lines_printed = 2;
- }
-
- # Update the max ever seen, and scale by the max ever seen.
- my $set = $var_status[0];
- foreach my $col ( @$visible ) {
- $set->{$col} = 1 unless defined $set->{$col} && $set->{$col} =~ m/$num_regex/;
- $set->{$col} = ($set->{$col} || 1) / ($set->{Uptime_hires} || 1);
- $mvs{$col} = max($mvs{$col} || 1, $set->{$col});
- $set->{$col} /= $mvs{$col};
- }
- printf($format, map { ( $config{graph_char}->{val} x int( $width * $set->{$_} )) || '.' } @$visible );
- $lines_printed++;
-
- }
- }
- else { # 'v'
- my $first_table = 0;
- my @display_lines;
- foreach my $tbl ( @visible ) {
- push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl);
- push @display_lines, get_cxn_errors(@cxns)
- if ( $config{debug}->{val} || !$first_table++ );
- }
- $clear_screen_sub->();
- draw_screen( \@display_lines );
- }
-}
-
-# display_explain {{{3
-sub display_explain {
- my $info = shift;
- my $cxn = $info->{cxn};
- my $db = $info->{db};
-
- my ( $mods, $query ) = rewrite_for_explain($info->{query});
-
- my @display_lines;
-
- if ( $query ) {
-
- my $part = version_ge($dbhs{$cxn}->{dbh}, '5.1.5') ? 'PARTITIONS' : '';
- $query = "EXPLAIN $part\n" . $query;
-
- eval {
- if ( $db ) {
- do_query($cxn, "use $db");
- }
- my $sth = do_query($cxn, $query);
-
- my $res;
- while ( $res = $sth->fetchrow_hashref() ) {
- map { $res->{$_} ||= '' } ( 'partitions', keys %$res);
- my @this_table = create_caption("Sub-Part $res->{id}",
- create_table2(
- $tbl_meta{explain}->{visible},
- meta_to_hdr('explain'),
- extract_values($res, $res, $res, 'explain')));
- @display_lines = stack_next(\@display_lines, \@this_table, { pad => ' ', vsep => 2 });
- }
- };
-
- if ( $EVAL_ERROR ) {
- push @display_lines,
- '',
- "The query could not be explained. Only SELECT queries can be "
- . "explained; innotop tries to rewrite certain REPLACE and INSERT queries "
- . "into SELECT, but this doesn't always succeed.";
- }
-
- }
- else {
- push @display_lines, '', 'The query could not be explained.';
- }
-
- if ( $mods ) {
- push @display_lines, '', '[This query has been re-written to be explainable]';
- }
-
- unshift @display_lines, no_ctrl_char($query);
- draw_screen(\@display_lines, { raw => 1 } );
-}
-
-# rewrite_for_explain {{{3
-sub rewrite_for_explain {
- my $query = shift;
-
- my $mods = 0;
- my $orig = $query;
- $mods += $query =~ s/^\s*(?:replace|insert).*?select/select/is;
- $mods += $query =~ s/^
- \s*create\s+(?:temporary\s+)?table
- \s+(?:\S+\s+)as\s+select/select/xis;
- $mods += $query =~ s/\s+on\s+duplicate\s+key\s+update.*$//is;
- return ( $mods, $query );
-}
-
-# show_optimized_query {{{3
-sub show_optimized_query {
- my $info = shift;
- my $cxn = $info->{cxn};
- my $db = $info->{db};
- my $meta = $dbhs{$cxn};
-
- my @display_lines;
-
- my ( $mods, $query ) = rewrite_for_explain($info->{query});
-
- if ( $mods ) {
- push @display_lines, '[This query has been re-written to be explainable]';
- }
-
- if ( $query ) {
- push @display_lines, no_ctrl_char($info->{query});
-
- eval {
- if ( $db ) {
- do_query($cxn, "use $db");
- }
- do_query( $cxn, 'EXPLAIN EXTENDED ' . $query ) or die "Can't explain query";
- my $sth = do_query($cxn, 'SHOW WARNINGS');
- my $res = $sth->fetchall_arrayref({});
-
- if ( $res ) {
- foreach my $result ( @$res ) {
- push @display_lines, 'Note:', no_ctrl_char($result->{message});
- }
- }
- else {
- push @display_lines, '', 'The query optimization could not be generated.';
- }
- };
-
- if ( $EVAL_ERROR ) {
- push @display_lines, '', "The optimization could not be generated: $EVAL_ERROR";
- }
-
- }
- else {
- push @display_lines, '', 'The query optimization could not be generated.';
- }
-
- draw_screen(\@display_lines, { raw => 1 } );
-}
-
-# display_help {{{3
-sub display_help {
- my $mode = $config{mode}->{val};
-
- # Get globally mapped keys, then overwrite them with mode-specific ones.
- my %keys = map {
- $_ => $action_for{$_}->{label}
- } keys %action_for;
- foreach my $key ( keys %{$modes{$mode}->{action_for}} ) {
- $keys{$key} = $modes{$mode}->{action_for}->{$key}->{label};
- }
- delete $keys{'?'};
-
- # Split them into three kinds of keys: MODE keys, action keys, and
- # magic (special character) keys.
- my @modes = sort grep { m/[A-Z]/ } keys %keys;
- my @actions = sort grep { m/[a-z]/ } keys %keys;
- my @magic = sort grep { m/[^A-Z]/i } keys %keys;
-
- my @display_lines = ( '', 'Switch to a different mode:' );
-
- # Mode keys
- my @all_modes = map { "$_ $modes{$_}->{hdr}" } @modes;
- my @col1 = splice(@all_modes, 0, ceil(@all_modes/3));
- my @col2 = splice(@all_modes, 0, ceil(@all_modes/2));
- my $max1 = max(map {length($_)} @col1);
- my $max2 = max(map {length($_)} @col2);
- while ( @col1 ) {
- push @display_lines, sprintf(" %-${max1}s %-${max2}s %s",
- (shift @col1 || ''),
- (shift @col2 || ''),
- (shift @all_modes || ''));
- }
-
- # Action keys
- my @all_actions = map { "$_ $keys{$_}" } @actions;
- @col1 = splice(@all_actions, 0, ceil(@all_actions/2));
- $max1 = max(map {length($_)} @col1);
- push @display_lines, '', 'Actions:';
- while ( @col1 ) {
- push @display_lines, sprintf(" %-${max1}s %s",
- (shift @col1 || ''),
- (shift @all_actions || ''));
- }
-
- # Magic keys
- my @all_magic = map { sprintf('%4s', $action_for{$_}->{key} || $_) . " $keys{$_}" } @magic;
- @col1 = splice(@all_magic, 0, ceil(@all_magic/2));
- $max1 = max(map {length($_)} @col1);
- push @display_lines, '', 'Other:';
- while ( @col1 ) {
- push @display_lines, sprintf("%-${max1}s%s",
- (shift @col1 || ''),
- (shift @all_magic || ''));
- }
-
- $clear_screen_sub->();
- draw_screen(\@display_lines, { show_all => 1 } );
- pause();
- $clear_screen_sub->();
-}
-
-# show_full_query {{{3
-sub show_full_query {
- my $info = shift;
- my @display_lines = no_ctrl_char($info->{query});
- draw_screen(\@display_lines, { raw => 1 });
-}
-
-# Formatting functions {{{2
-
-# create_table2 {{{3
-# Makes a two-column table, labels on left, data on right.
-# Takes refs of @cols, %labels and %data, %user_prefs
-sub create_table2 {
- my ( $cols, $labels, $data, $user_prefs ) = @_;
- my @rows;
-
- if ( @$cols && %$data ) {
-
- # Override defaults
- my $p = {
- just => '',
- sep => ':',
- just1 => '-',
- };
- if ( $user_prefs ) {
- map { $p->{$_} = $user_prefs->{$_} } keys %$user_prefs;
- }
-
- # Fix undef values
- map { $data->{$_} = '' unless defined $data->{$_} } @$cols;
-
- # Format the table
- my $max_l = max(map{ length($labels->{$_}) } @$cols);
- my $max_v = max(map{ length($data->{$_}) } @$cols);
- my $format = "%$p->{just}${max_l}s$p->{sep} %$p->{just1}${max_v}s";
- foreach my $col ( @$cols ) {
- push @rows, sprintf($format, $labels->{$col}, $data->{$col});
- }
- }
- return @rows;
-}
-
-# stack_next {{{3
-# Stacks one display section next to the other. Accepts left-hand arrayref,
-# right-hand arrayref, and options hashref. Tries to stack as high as
-# possible, so
-# aaaaaa
-# bbb
-# can stack ccc next to the bbb.
-# NOTE: this DOES modify its arguments, even though it returns a new array.
-sub stack_next {
- my ( $left, $right, $user_prefs ) = @_;
- my @result;
-
- my $p = {
- pad => ' ',
- vsep => 0,
- };
- if ( $user_prefs ) {
- map { $p->{$_} = $user_prefs->{$_} } keys %$user_prefs;
- }
-
- # Find out how wide the LHS can be and still let the RHS fit next to it.
- my $pad = $p->{pad};
- my $max_r = max( map { length($_) } @$right) || 0;
- my $max_l = $this_term_size[0] - $max_r - length($pad);
-
- # Find the minimum row on the LHS that the RHS will fit next to.
- my $i = scalar(@$left) - 1;
- while ( $i >= 0 && length($left->[$i]) <= $max_l ) {
- $i--;
- }
- $i++;
- my $offset = $i;
-
- if ( $i < scalar(@$left) ) {
- # Find the max width of the section of the LHS against which the RHS
- # will sit.
- my $max_i_in_common = min($i + scalar(@$right) - 1, scalar(@$left) - 1);
- my $max_width = max( map { length($_) } @{$left}[$i..$max_i_in_common]);
-
- # Append the RHS onto the LHS until one runs out.
- while ( $i < @$left && $i - $offset < @$right ) {
- my $format = "%-${max_width}s$pad%${max_r}s";
- $left->[$i] = sprintf($format, $left->[$i], $right->[$i - $offset]);
- $i++;
- }
- while ( $i - $offset < @$right ) {
- # There is more RHS to push on the end of the array
- push @$left,
- sprintf("%${max_width}s$pad%${max_r}s", ' ', $right->[$i - $offset]);
- $i++;
- }
- push @result, @$left;
- }
- else {
- # There is no room to put them side by side. Add them below, with
- # a blank line above them if specified.
- push @result, @$left;
- push @result, (' ' x $this_term_size[0]) if $p->{vsep} && @$left;
- push @result, @$right;
- }
- return @result;
-}
-
-# create_caption {{{3
-sub create_caption {
- my ( $caption, @rows ) = @_;
- if ( @rows ) {
-
- # Calculate the width of what will be displayed, so it can be centered
- # in that space. When the thing is wider than the display, center the
- # caption in the display.
- my $width = min($this_term_size[0], max(map { length(ref($_) ? $_->[0] : $_) } @rows));
-
- my $cap_len = length($caption);
-
- # It may be narrow enough to pad the sides with underscores and save a
- # line on the screen.
- if ( $cap_len <= $width - 6 ) {
- my $left = int(($width - 2 - $cap_len) / 2);
- unshift @rows,
- ("_" x $left) . " $caption " . ("_" x ($width - $left - $cap_len - 2));
- }
-
- # The caption is too wide to add underscores on each side.
- else {
-
- # Color is supported, so we can use terminal underlining.
- if ( $config{color}->{val} ) {
- my $left = int(($width - $cap_len) / 2);
- unshift @rows, [
- (" " x $left) . $caption . (" " x ($width - $left - $cap_len)),
- 'underline',
- ];
- }
-
- # Color is not supported, so we have to add a line underneath to separate the
- # caption from whatever it's captioning.
- else {
- my $left = int(($width - $cap_len) / 2);
- unshift @rows, ('-' x $width);
- unshift @rows, (" " x $left) . $caption . (" " x ($width - $left - $cap_len));
- }
-
- # The caption is wider than the thing it labels, so we have to pad the
- # thing it labels to a consistent width.
- if ( $cap_len > $width ) {
- @rows = map {
- ref($_)
- ? [ sprintf('%-' . $cap_len . 's', $_->[0]), $_->[1] ]
- : sprintf('%-' . $cap_len . 's', $_);
- } @rows;
- }
-
- }
- }
- return @rows;
-}
-
-# create_table {{{3
-# Input: an arrayref of columns, hashref of col info, and an arrayref of hashes
-# Example: [ 'a', 'b' ]
-# { a => spec, b => spec }
-# [ { a => 1, b => 2}, { a => 3, b => 4 } ]
-# The 'spec' is a hashref of hdr => label, just => ('-' or ''). It also supports min and max-widths
-# vi the minw and maxw params.
-# Output: an array of strings, one per row.
-# Example:
-# Column One Column Two
-# ---------- ----------
-# 1 2
-# 3 4
-sub create_table {
- my ( $cols, $info, $data, $prefs ) = @_;
- $prefs ||= {};
- $prefs->{no_hdr} ||= ($opts{n} && $clock != 1);
-
- # Truncate rows that will surely be off screen even if this is the only table.
- if ( !$opts{n} && !$prefs->{raw} && !$prefs->{show_all} && $this_term_size[1] < @$data-1 ) {
- $data = [ @$data[0..$this_term_size[1] - 1] ];
- }
-
- my @rows = ();
-
- if ( @$cols && %$info ) {
-
- # Fix undef values, collapse whitespace.
- foreach my $row ( @$data ) {
- map { $row->{$_} = collapse_ws($row->{$_}) } @$cols;
- }
-
- my $col_sep = $opts{n} ? "\t" : ' ';
-
- # Find each column's max width.
- my %width_for;
- if ( !$opts{n} ) {
- %width_for = map {
- my $col_name = $_;
- if ( $info->{$_}->{dec} ) {
- # Align along the decimal point
- my $max_rodp = max(0, map { $_->{$col_name} =~ m/([^\s\d-].*)$/ ? length($1) : 0 } @$data);
- foreach my $row ( @$data ) {
- my $col = $row->{$col_name};
- my ( $l, $r ) = $col =~ m/^([\s\d]*)(.*)$/;
- $row->{$col_name} = sprintf("%s%-${max_rodp}s", $l, $r);
- }
- }
- my $max_width = max( length($info->{$_}->{hdr}), map { length($_->{$col_name}) } @$data);
- if ( $info->{$col_name}->{maxw} ) {
- $max_width = min( $max_width, $info->{$col_name}->{maxw} );
- }
- if ( $info->{$col_name}->{minw} ) {
- $max_width = max( $max_width, $info->{$col_name}->{minw} );
- }
- $col_name => $max_width;
- } @$cols;
- }
-
- # The table header.
- if ( !$config{hide_hdr}->{val} && !$prefs->{no_hdr} ) {
- push @rows, $opts{n}
- ? join( $col_sep, @$cols )
- : join( $col_sep, map { sprintf( "%-$width_for{$_}s", trunc($info->{$_}->{hdr}, $width_for{$_}) ) } @$cols );
- if ( $config{color}->{val} && $config{header_highlight}->{val} ) {
- push @rows, [ pop @rows, $config{header_highlight}->{val} ];
- }
- elsif ( !$opts{n} ) {
- push @rows, join( $col_sep, map { "-" x $width_for{$_} } @$cols );
- }
- }
-
- # The table data.
- if ( $opts{n} ) {
- foreach my $item ( @$data ) {
- push @rows, join($col_sep, map { $item->{$_} } @$cols );
- }
- }
- else {
- my $format = join( $col_sep,
- map { "%$info->{$_}->{just}$width_for{$_}s" } @$cols );
- foreach my $item ( @$data ) {
- my $row = sprintf($format, map { trunc($item->{$_}, $width_for{$_}) } @$cols );
- if ( $config{color}->{val} && $item->{_color} ) {
- push @rows, [ $row, $item->{_color} ];
- }
- else {
- push @rows, $row;
- }
- }
- }
- }
-
- return @rows;
-}
-
-# Aggregates a table. If $group_by is an arrayref of columns, the grouping key
-# is the specified columns; otherwise it's just the empty string (e.g.
-# everything is grouped as one group).
-sub apply_group_by {
- my ( $tbl, $group_by, @rows ) = @_;
- my $meta = $tbl_meta{$tbl};
- my %is_group = map { $_ => 1 } @$group_by;
- my @non_grp = grep { !$is_group{$_} } keys %{$meta->{cols}};
-
- my %temp_table;
- foreach my $row ( @rows ) {
- my $group_key
- = @$group_by
- ? '{' . join('}{', map { defined $_ ? $_ : '' } @{$row}{@$group_by}) . '}'
- : '';
- $temp_table{$group_key} ||= [];
- push @{$temp_table{$group_key}}, $row;
- }
-
- # Crush the rows together...
- my @new_rows;
- foreach my $key ( sort keys %temp_table ) {
- my $group = $temp_table{$key};
- my %new_row;
- @new_row{@$group_by} = @{$group->[0]}{@$group_by};
- foreach my $col ( @non_grp ) {
- my $agg = $meta->{cols}->{$col}->{agg} || 'first';
- $new_row{$col} = $agg_funcs{$agg}->( map { $_->{$col} } @$group );
- }
- push @new_rows, \%new_row;
- }
- return @new_rows;
-}
-
-# set_to_tbl {{{3
-# Unifies all the work of filtering, sorting etc. Alters the input.
-# TODO: pull all the little pieces out into subroutines and stick events in each of them.
-sub set_to_tbl {
- my ( $rows, $tbl ) = @_;
- my $meta = $tbl_meta{$tbl} or die "No such table $tbl in tbl_meta";
-
- if ( !$meta->{pivot} ) {
-
- # Hook in event listeners
- foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_filter}} ) {
- $listener->set_to_tbl_pre_filter($rows, $tbl);
- }
-
- # Apply filters. Note that if the table is pivoted, filtering and sorting
- # are applied later.
- foreach my $filter ( @{$meta->{filters}} ) {
- eval {
- @$rows = grep { $filters{$filter}->{func}->($_) } @$rows;
- };
- if ( $EVAL_ERROR && $config{debug}->{val} ) {
- die $EVAL_ERROR;
- }
- }
-
- foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_sort}} ) {
- $listener->set_to_tbl_pre_sort($rows, $tbl);
- }
-
- # Sort. Note that if the table is pivoted, sorting might have the wrong
- # columns and it could crash. This will only be an issue if it's possible
- # to toggle pivoting on and off, which it's not at the moment.
- if ( @$rows && $meta->{sort_func} && !$meta->{aggregate} ) {
- if ( $meta->{sort_dir} > 0 ) {
- @$rows = $meta->{sort_func}->( @$rows );
- }
- else {
- @$rows = reverse $meta->{sort_func}->( @$rows );
- }
- }
-
- }
-
- # Stop altering arguments now.
- my @rows = @$rows;
-
- foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_group}} ) {
- $listener->set_to_tbl_pre_group(\@rows, $tbl);
- }
-
- # Apply group-by.
- if ( $meta->{aggregate} ) {
- @rows = apply_group_by($tbl, $meta->{group_by}, @rows);
-
- # Sort. Note that if the table is pivoted, sorting might have the wrong
- # columns and it could crash. This will only be an issue if it's possible
- # to toggle pivoting on and off, which it's not at the moment.
- if ( @rows && $meta->{sort_func} ) {
- if ( $meta->{sort_dir} > 0 ) {
- @rows = $meta->{sort_func}->( @rows );
- }
- else {
- @rows = reverse $meta->{sort_func}->( @rows );
- }
- }
-
- }
-
- foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_colorize}} ) {
- $listener->set_to_tbl_pre_colorize(\@rows, $tbl);
- }
-
- if ( !$meta->{pivot} ) {
- # Colorize. Adds a _color column to rows.
- if ( @rows && $meta->{color_func} ) {
- eval {
- foreach my $row ( @rows ) {
- $row->{_color} = $meta->{color_func}->($row);
- }
- };
- if ( $EVAL_ERROR ) {
- pause($EVAL_ERROR);
- }
- }
- }
-
- foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_transform}} ) {
- $listener->set_to_tbl_pre_transform(\@rows, $tbl);
- }
-
- # Apply_transformations.
- if ( @rows ) {
- my $cols = $meta->{cols};
- foreach my $col ( keys %{$rows->[0]} ) {
- # Don't auto-vivify $tbl_meta{tbl}-{cols}->{_color}->{trans}
- next if $col eq '_color';
- foreach my $trans ( @{$cols->{$col}->{trans}} ) {
- map { $_->{$col} = $trans_funcs{$trans}->($_->{$col}) } @rows;
- }
- }
- }
-
- my ($fmt_cols, $fmt_meta);
-
- # Pivot.
- if ( $meta->{pivot} ) {
-
- foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_pivot}} ) {
- $listener->set_to_tbl_pre_pivot(\@rows, $tbl);
- }
-
- my @vars = @{$meta->{visible}};
- my @tmp = map { { name => $_ } } @vars;
- my @cols = 'name';
- foreach my $i ( 0..@$rows-1 ) {
- my $col = "set_$i";
- push @cols, $col;
- foreach my $j ( 0..@vars-1 ) {
- $tmp[$j]->{$col} = $rows[$i]->{$vars[$j]};
- }
- }
- $fmt_meta = { map { $_ => { hdr => $_, just => '-' } } @cols };
- $fmt_cols = \@cols;
- @rows = @tmp;
-
- # Hook in event listeners
- foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_filter}} ) {
- $listener->set_to_tbl_pre_filter($rows, $tbl);
- }
-
- # Apply filters.
- foreach my $filter ( @{$meta->{filters}} ) {
- eval {
- @rows = grep { $filters{$filter}->{func}->($_) } @rows;
- };
- if ( $EVAL_ERROR && $config{debug}->{val} ) {
- die $EVAL_ERROR;
- }
- }
-
- foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_sort}} ) {
- $listener->set_to_tbl_pre_sort($rows, $tbl);
- }
-
- # Sort.
- if ( @rows && $meta->{sort_func} ) {
- if ( $meta->{sort_dir} > 0 ) {
- @rows = $meta->{sort_func}->( @rows );
- }
- else {
- @rows = reverse $meta->{sort_func}->( @rows );
- }
- }
-
- }
- else {
- # If the table isn't pivoted, just show all columns that are supposed to
- # be shown; but eliminate aggonly columns if the table isn't aggregated.
- my $aggregated = $meta->{aggregate};
- $fmt_cols = [ grep { $aggregated || !$meta->{cols}->{$_}->{aggonly} } @{$meta->{visible}} ];
- $fmt_meta = { map { $_ => $meta->{cols}->{$_} } @$fmt_cols };
-
- # If the table is aggregated, re-order the group_by columns to the left of
- # the display.
- if ( $aggregated ) {
- my %is_group = map { $_ => 1 } @{$meta->{group_by}};
- $fmt_cols = [ @{$meta->{group_by}}, grep { !$is_group{$_} } @$fmt_cols ];
- }
- }
-
- foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_create}} ) {
- $listener->set_to_tbl_pre_create(\@rows, $tbl);
- }
-
- @rows = create_table( $fmt_cols, $fmt_meta, \@rows);
- if ( !$meta->{hide_caption} && !$opts{n} && $config{display_table_captions}->{val} ) {
- @rows = create_caption($meta->{capt}, @rows)
- }
-
- foreach my $listener ( @{$event_listener_for{set_to_tbl_post_create}} ) {
- $listener->set_to_tbl_post_create(\@rows, $tbl);
- }
-
- return @rows;
-}
-
-# meta_to_hdr {{{3
-sub meta_to_hdr {
- my $tbl = shift;
- my $meta = $tbl_meta{$tbl};
- my %labels = map { $_ => $meta->{cols}->{$_}->{hdr} } @{$meta->{visible}};
- return \%labels;
-}
-
-# commify {{{3
-# From perlfaq5: add commas.
-sub commify {
- my ( $num ) = @_;
- $num = 0 unless defined $num;
- $num =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g;
- return $num;
-}
-
-# set_precision {{{3
-# Trim to desired precision.
-sub set_precision {
- my ( $num, $precision ) = @_;
- $precision = $config{num_digits}->{val} if !defined $precision;
- sprintf("%.${precision}f", $num);
-}
-
-# percent {{{3
-# Convert to percent
-sub percent {
- my ( $num ) = @_;
- $num = 0 unless defined $num;
- my $digits = $config{num_digits}->{val};
- return sprintf("%.${digits}f", $num * 100)
- . ($config{show_percent}->{val} ? '%' : '');
-}
-
-# shorten {{{3
-sub shorten {
- my ( $num, $opts ) = @_;
-
- return $num if !defined($num) || $opts{n} || $num !~ m/$num_regex/;
-
- $opts ||= {};
- my $pad = defined $opts->{pad} ? $opts->{pad} : '';
- my $num_digits = defined $opts->{num_digits}
- ? $opts->{num_digits}
- : $config{num_digits}->{val};
- my $force = defined $opts->{force};
-
- my $n = 0;
- while ( $num >= 1_024 ) {
- $num /= 1_024;
- ++$n;
- }
- return sprintf(
- $num =~ m/\./ || $n || $force
- ? "%.${num_digits}f%s"
- : '%d',
- $num, ($pad,'k','M','G', 'T')[$n]);
-
-}
-
-# Utility functions {{{2
-# unique {{{3
-sub unique {
- my %seen;
- return grep { !$seen{$_}++ } @_;
-}
-
-# make_color_func {{{3
-sub make_color_func {
- my ( $tbl ) = @_;
- my @criteria;
- foreach my $spec ( @{$tbl->{colors}} ) {
- next unless exists $comp_ops{$spec->{op}};
- my $val = $spec->{op} =~ m/^(?:eq|ne|le|ge|lt|gt)$/ ? "'$spec->{arg}'"
- : $spec->{op} =~ m/^(?:=~|!~)$/ ? "m/" . quotemeta($spec->{arg}) . "/"
- : $spec->{arg};
- push @criteria,
- "( defined \$set->{$spec->{col}} && \$set->{$spec->{col}} $spec->{op} $val ) { return '$spec->{color}'; }";
- }
- return undef unless @criteria;
- my $sub = eval 'sub { my ( $set ) = @_; if ' . join(" elsif ", @criteria) . '}';
- die if $EVAL_ERROR;
- return $sub;
-}
-
-# make_sort_func {{{3
-# Gets a list of sort columns from the table, like "+cxn -time" and returns a
-# subroutine that will sort that way.
-sub make_sort_func {
- my ( $tbl ) = @_;
- my @criteria;
-
- # Pivoted tables can be sorted by 'name' and set_x columns; others must be
- # sorted by existing columns. TODO: this will crash if you toggle between
- # pivoted and nonpivoted. I have several other 'crash' notes about this if
- # this ever becomes possible.
-
- if ( $tbl->{pivot} ) {
- # Sort type is not really possible on pivoted columns, because a 'column'
- # contains data from an entire non-pivoted row, so there could be a mix of
- # numeric and non-numeric data. Thus everything has to be 'cmp' type.
- foreach my $col ( split(/\s+/, $tbl->{sort_cols} ) ) {
- next unless $col;
- my ( $dir, $name ) = $col =~ m/([+-])?(\w+)$/;
- next unless $name && $name =~ m/^(?:name|set_\d+)$/;
- $dir ||= '+';
- my $op = 'cmp';
- my $df = "''";
- push @criteria,
- $dir eq '+'
- ? "(\$a->{$name} || $df) $op (\$b->{$name} || $df)"
- : "(\$b->{$name} || $df) $op (\$a->{$name} || $df)";
- }
- }
- else {
- foreach my $col ( split(/\s+/, $tbl->{sort_cols} ) ) {
- next unless $col;
- my ( $dir, $name ) = $col =~ m/([+-])?(\w+)$/;
- next unless $name && $tbl->{cols}->{$name};
- $dir ||= '+';
- my $op = $tbl->{cols}->{$name}->{num} ? "<=>" : "cmp";
- my $df = $tbl->{cols}->{$name}->{num} ? "0" : "''";
- push @criteria,
- $dir eq '+'
- ? "(\$a->{$name} || $df) $op (\$b->{$name} || $df)"
- : "(\$b->{$name} || $df) $op (\$a->{$name} || $df)";
- }
- }
- return sub { return @_ } unless @criteria;
- my $sub = eval 'sub { sort {' . join("||", @criteria) . '} @_; }';
- die if $EVAL_ERROR;
- return $sub;
-}
-
-# trunc {{{3
-# Shortens text to specified length.
-sub trunc {
- my ( $text, $len ) = @_;
- if ( length($text) <= $len ) {
- return $text;
- }
- return substr($text, 0, $len);
-}
-
-# donut {{{3
-# Takes out the middle of text to shorten it.
-sub donut {
- my ( $text, $len ) = @_;
- return $text if length($text) <= $len;
- my $max = length($text) - $len;
- my $min = $max - 1;
-
- # Try to remove a single "word" from somewhere in the center
- if ( $text =~ s/_[^_]{$min,$max}_/_/ ) {
- return $text;
- }
-
- # Prefer removing the end of a "word"
- if ( $text =~ s/([^_]+)[^_]{$max}_/$1_/ ) {
- return $text;
- }
-
- $text = substr($text, 0, int($len/2))
- . "_"
- . substr($text, int($len/2) + $max + 1);
- return $text;
-}
-
-# crunch {{{3
-# Removes vowels and compacts repeated letters to shorten text.
-sub crunch {
- my ( $text, $len ) = @_;
- return $text if $len && length($text) <= $len;
- $text =~ s/^IB_\w\w_//;
- $text =~ s/(?<![_ ])[aeiou]//g;
- $text =~ s/(.)\1+/$1/g;
- return $text;
-}
-
-# collapse_ws {{{3
-# Collapses all whitespace to a single space.
-sub collapse_ws {
- my ( $text ) = @_;
- return '' unless defined $text;
- $text =~ s/\s+/ /g;
- return $text;
-}
-
-# Strips out non-printable characters within fields, which freak terminals out.
-sub no_ctrl_char {
- my ( $text ) = @_;
- return '' unless defined $text;
- my $charset = $config{charset}->{val};
- if ( $charset && $charset eq 'unicode' ) {
- $text =~ s/
- ("(?:(?!(?<!\\)").)*" # Double-quoted string
- |'(?:(?!(?<!\\)').)*') # Or single-quoted string
- /$1 =~ m#\p{IsC}# ? "[BINARY]" : $1/egx;
- }
- elsif ( $charset && $charset eq 'none' ) {
- $text =~ s/
- ("(?:(?!(?<!\\)").)*"
- |'(?:(?!(?<!\\)').)*')
- /[TEXT]/gx;
- }
- else { # The default is 'ascii'
- $text =~ s/
- ("(?:(?!(?<!\\)").)*"
- |'(?:(?!(?<!\\)').)*')
- /$1 =~ m#[^\040-\176]# ? "[BINARY]" : $1/egx;
- }
- return $text;
-}
-
-# word_wrap {{{3
-# Wraps text at word boundaries so it fits the screen.
-sub word_wrap {
- my ( $text, $width) = @_;
- $width ||= $this_term_size[0];
- $text =~ s/(.{0,$width})(?:\s+|$)/$1\n/g;
- $text =~ s/ +$//mg;
- return $text;
-}
-
-# draw_screen {{{3
-# Prints lines to the screen. The first argument is an arrayref. Each
-# element of the array is either a string or an arrayref. If it's a string it
-# just gets printed. If it's an arrayref, the first element is the string to
-# print, and the second is args to colored().
-sub draw_screen {
- my ( $display_lines, $prefs ) = @_;
- if ( !$opts{n} && $config{show_statusbar}->{val} ) {
- unshift @$display_lines, create_statusbar();
- }
-
- foreach my $listener ( @{$event_listener_for{draw_screen}} ) {
- $listener->draw_screen($display_lines);
- }
-
- $clear_screen_sub->()
- if $prefs->{clear} || !$modes{$config{mode}->{val}}->{no_clear_screen};
- if ( $opts{n} || $prefs->{raw} ) {
- my $num_lines = 0;
- print join("\n",
- map {
- $num_lines++;
- ref $_
- ? colored($_->[0], $_->[1])
- : $_;
- }
- grep { !$opts{n} || $_ } # Suppress empty lines
- @$display_lines);
- if ( $opts{n} && $num_lines ) {
- print "\n";
- }
- }
- else {
- my $max_lines = $prefs->{show_all}
- ? scalar(@$display_lines)- 1
- : min(scalar(@$display_lines), $this_term_size[1]);
- print join("\n",
- map {
- ref $_
- ? colored(substr($_->[0], 0, $this_term_size[0]), $_->[1])
- : substr($_, 0, $this_term_size[0]);
- } @$display_lines[0..$max_lines - 1]);
- }
-}
-
-# secs_to_time {{{3
-sub secs_to_time {
- my ( $secs, $fmt ) = @_;
- $secs ||= 0;
- return '00:00' unless $secs;
-
- # Decide what format to use, if not given
- $fmt ||= $secs >= 86_400 ? 'd'
- : $secs >= 3_600 ? 'h'
- : 'm';
-
- return
- $fmt eq 'd' ? sprintf(
- "%d+%02d:%02d:%02d",
- int($secs / 86_400),
- int(($secs % 86_400) / 3_600),
- int(($secs % 3_600) / 60),
- $secs % 60)
- : $fmt eq 'h' ? sprintf(
- "%02d:%02d:%02d",
- int(($secs % 86_400) / 3_600),
- int(($secs % 3_600) / 60),
- $secs % 60)
- : sprintf(
- "%02d:%02d",
- int(($secs % 3_600) / 60),
- $secs % 60);
-}
-
-# dulint_to_int {{{3
-# Takes a number that InnoDB formats as two ulint integers, like transaction IDs
-# and such, and turns it into a single integer
-sub dulint_to_int {
- my $num = shift;
- return 0 unless $num;
- my ( $high, $low ) = $num =~ m/^(\d+) (\d+)$/;
- return $low unless $high;
- return $low + ( $high * $MAX_ULONG );
-}
-
-# create_statusbar {{{3
-sub create_statusbar {
- my $mode = $config{mode}->{val};
- my @cxns = sort { $a cmp $b } get_connections();
-
- my $modeline = ( $config{readonly}->{val} ? '[RO] ' : '' )
- . $modes{$mode}->{hdr} . " (? for help)";
- my $mode_width = length($modeline);
- my $remaining_width = $this_term_size[0] - $mode_width - 1;
- my $result;
-
- # The thingie in top-right that says what we're monitoring.
- my $cxn = '';
-
- if ( 1 == @cxns && $dbhs{$cxns[0]} && $dbhs{$cxns[0]}->{dbh} ) {
- $cxn = $dbhs{$cxns[0]}->{dbh}->{mysql_serverinfo} || '';
- }
- else {
- if ( $modes{$mode}->{server_group} ) {
- $cxn = "Servers: " . $modes{$mode}->{server_group};
- my $err_count = grep { $dbhs{$_} && $dbhs{$_}->{err_count} } @cxns;
- if ( $err_count ) {
- $cxn .= "(" . ( scalar(@cxns) - $err_count ) . "/" . scalar(@cxns) . ")";
- }
- }
- else {
- $cxn = join(' ', map { ($dbhs{$_}->{err_count} ? '!' : '') . $_ }
- grep { $dbhs{$_} } @cxns);
- }
- }
-
- if ( 1 == @cxns ) {
- get_driver_status(@cxns);
- my $vars = $vars{$cxns[0]}->{$clock};
- my $inc = inc(0, $cxns[0]);
-
- # Format server uptime human-readably, calculate QPS...
- my $uptime = secs_to_time( $vars->{Uptime_hires} );
- my $qps = ($inc->{Questions}||0) / ($inc->{Uptime_hires}||1);
- my $ibinfo = '';
-
- if ( exists $vars->{IB_last_secs} ) {
- $ibinfo .= "InnoDB $vars->{IB_last_secs}s ";
- if ( $vars->{IB_got_all} ) {
- if ( ($mode eq 'T' || $mode eq 'W')
- && $vars->{IB_tx_is_truncated} ) {
- $ibinfo .= ':^|';
- }
- else {
- $ibinfo .= ':-)';
- }
- }
- else {
- $ibinfo .= ':-(';
- }
- }
- $result = sprintf(
- "%-${mode_width}s %${remaining_width}s",
- $modeline,
- join(', ', grep { $_ } (
- $cxns[0],
- $uptime,
- $ibinfo,
- shorten($qps) . " QPS",
- ($vars->{Threads} || 0) . " thd",
- $cxn)));
- }
- else {
- $result = sprintf(
- "%-${mode_width}s %${remaining_width}s",
- $modeline,
- $cxn);
- }
-
- return $config{color}->{val} ? [ $result, 'bold reverse' ] : $result;
-}
-
-# Database connections {{{3
-sub add_new_dsn {
- my ( $name ) = @_;
-
- if ( defined $name ) {
- $name =~ s/[\s:;]//g;
- }
-
- if ( !$name ) {
- print word_wrap("Choose a name for the connection. It cannot contain "
- . "whitespace, colons or semicolons."), "\n\n";
- do {
- $name = prompt("Enter a name");
- $name =~ s/[\s:;]//g;
- } until ( $name );
- }
-
- my $dsn;
- do {
- $clear_screen_sub->();
- print "Typical DSN strings look like\n DBI:mysql:;host=hostname;port=port\n"
- . "The db and port are optional and can usually be omitted.\n"
- . "If you specify 'mysql_read_default_group=mysql' many options can be read\n"
- . "from your mysql options files (~/.my.cnf, /etc/my.cnf).\n\n";
- $dsn = prompt("Enter a DSN string", undef, "DBI:mysql:;mysql_read_default_group=mysql;host=$name");
- } until ( $dsn );
-
- $clear_screen_sub->();
- my $dl_table = prompt("Optional: enter a table (must not exist) to use when resetting InnoDB deadlock information",
- undef, 'test.innotop_dl');
-
- $connections{$name} = {
- dsn => $dsn,
- dl_table => $dl_table,
- };
-}
-
-sub add_new_server_group {
- my ( $name ) = @_;
-
- if ( defined $name ) {
- $name =~ s/[\s:;]//g;
- }
-
- if ( !$name ) {
- print word_wrap("Choose a name for the group. It cannot contain "
- . "whitespace, colons or semicolons."), "\n\n";
- do {
- $name = prompt("Enter a name");
- $name =~ s/[\s:;]//g;
- } until ( $name );
- }
-
- my @cxns;
- do {
- $clear_screen_sub->();
- @cxns = select_cxn("Choose servers for $name", keys %connections);
- } until ( @cxns );
-
- $server_groups{$name} = \@cxns;
- return $name;
-}
-
-sub get_var_set {
- my ( $name ) = @_;
- while ( !$name || !exists($var_sets{$config{$name}->{val}}) ) {
- $name = choose_var_set($name);
- }
- return $var_sets{$config{$name}->{val}}->{text};
-}
-
-sub add_new_var_set {
- my ( $name ) = @_;
-
- if ( defined $name ) {
- $name =~ s/\W//g;
- }
-
- if ( !$name ) {
- do {
- $name = prompt("Enter a name");
- $name =~ s/\W//g;
- } until ( $name );
- }
-
- my $variables;
- do {
- $clear_screen_sub->();
- $variables = prompt("Enter variables for $name", undef );
- } until ( $variables );
-
- $var_sets{$name} = { text => $variables, user => 1 };
-}
-
-sub next_server {
- my $mode = $config{mode}->{val};
- my @cxns = sort keys %connections;
- my ($cur) = get_connections($mode);
- $cur ||= $cxns[0];
- my $pos = grep { $_ lt $cur } @cxns;
- my $newpos = ($pos + 1) % @cxns;
- $modes{$mode}->{server_group} = '';
- $modes{$mode}->{connections} = [ $cxns[$newpos] ];
- $clear_screen_sub->();
-}
-
-sub next_server_group {
- my $mode = shift || $config{mode}->{val};
- my @grps = sort keys %server_groups;
- my $curr = $modes{$mode}->{server_group};
-
- return unless @grps;
-
- if ( $curr ) {
- # Find the current group's position.
- my $pos = 0;
- while ( $curr ne $grps[$pos] ) {
- $pos++;
- }
- $modes{$mode}->{server_group} = $grps[ ($pos + 1) % @grps ];
- }
- else {
- $modes{$mode}->{server_group} = $grps[0];
- }
-}
-
-# Get a list of connection names used in this mode.
-sub get_connections {
- if ( $file ) {
- return qw(file);
- }
- my $mode = shift || $config{mode}->{val};
- my @connections = $modes{$mode}->{server_group}
- ? @{$server_groups{$modes{$mode}->{server_group}}}
- : @{$modes{$mode}->{connections}};
- if ( $modes{$mode}->{one_connection} ) {
- @connections = @connections ? $connections[0] : ();
- }
- return unique(@connections);
-}
-
-# Get a list of tables used in this mode. If innotop is running non-interactively, just use the first.
-sub get_visible_tables {
- my $mode = shift || $config{mode}->{val};
- my @tbls = @{$modes{$mode}->{visible_tables}};
- if ( $opts{n} ) {
- return $tbls[0];
- }
- else {
- return @tbls;
- }
-}
-
-# Choose from among available connections or server groups.
-# If the mode has a server set in use, prefers that instead.
-sub choose_connections {
- $clear_screen_sub->();
- my $mode = $config{mode}->{val};
- my $meta = { map { $_ => $connections{$_}->{dsn} } keys %connections };
- foreach my $group ( keys %server_groups ) {
- $meta->{"#$group"} = join(' ', @{$server_groups{$group}});
- }
-
- my $choices = prompt_list("Choose connections or a group for $mode mode",
- undef, sub { return keys %$meta }, $meta);
-
- my @choices = unique(grep { $_ } split(/\s+/, $choices));
- if ( @choices ) {
- if ( $choices[0] =~ s/^#// && exists $server_groups{$choices[0]} ) {
- $modes{$mode}->{server_group} = $choices[0];
- }
- else {
- $modes{$mode}->{connections} = [ grep { exists $connections{$_} } @choices ];
- }
- }
-}
-
-# Accepts a DB connection name and the name of a prepared query (e.g. status, kill).
-# Also a list of params for the prepared query. This allows not storing prepared
-# statements globally. Returns a $sth that's been executed.
-# ERROR-HANDLING SEMANTICS: if the statement throws an error, propagate, but if the
-# connection has gone away or can't connect, DO NOT. Just return undef.
-sub do_stmt {
- my ( $cxn, $stmt_name, @args ) = @_;
-
- return undef if $file;
-
- # Test if the cxn should not even be tried
- return undef if $dbhs{$cxn}
- && $dbhs{$cxn}->{err_count}
- && ( !$dbhs{$cxn}->{dbh} || !$dbhs{$cxn}->{dbh}->{Active} || $dbhs{$cxn}->{mode} eq $config{mode}->{val} )
- && $dbhs{$cxn}->{wake_up} > $clock;
-
- my $sth;
- my $retries = 1;
- my $success = 0;
- TRY:
- while ( $retries-- >= 0 && !$success ) {
-
- eval {
- my $dbh = connect_to_db($cxn);
-
- # If the prepared query doesn't exist, make it.
- if ( !exists $dbhs{$cxn}->{stmts}->{$stmt_name} ) {
- $dbhs{$cxn}->{stmts}->{$stmt_name} = $stmt_maker_for{$stmt_name}->($dbh);
- }
-
- $sth = $dbhs{$cxn}->{stmts}->{$stmt_name};
- if ( $sth ) {
- $sth->execute(@args);
- }
- $success = 1;
- };
- if ( $EVAL_ERROR ) {
- if ( $EVAL_ERROR =~ m/$nonfatal_errs/ ) {
- handle_cxn_error($cxn, $EVAL_ERROR);
- }
- else {
- die "$cxn $stmt_name: $EVAL_ERROR";
- }
- if ( $retries < 0 ) {
- $sth = undef;
- }
- }
- }
-
- if ( $sth && $sth->{NUM_OF_FIELDS} ) {
- sleep($stmt_sleep_time_for{$stmt_name}) if $stmt_sleep_time_for{$stmt_name};
- return $sth;
- }
-}
-
-# Keeps track of error count, sleep times till retries, etc etc.
-# When there's an error we retry the connection every so often, increasing in
-# Fibonacci series to prevent too much banging on the server.
-sub handle_cxn_error {
- my ( $cxn, $err ) = @_;
- my $meta = $dbhs{$cxn};
- $meta->{err_count}++;
-
- # This is used so errors that have to do with permissions needed by the current
- # mode will get displayed as long as we're in this mode, but get ignored if the
- # mode changes.
- $meta->{mode} = $config{mode}->{val};
-
- # Strip garbage from the error text if possible.
- $err =~ s/\s+/ /g;
- if ( $err =~ m/failed: (.*?) at \S*innotop line/ ) {
- $err = $1;
- }
-
- $meta->{last_err} = $err;
- my $sleep_time = $meta->{this_sleep} + $meta->{prev_sleep};
- $meta->{prev_sleep} = $meta->{this_sleep};
- $meta->{this_sleep} = $sleep_time;
- $meta->{wake_up} = $clock + $sleep_time;
- if ( $config{show_cxn_errors}->{val} ) {
- print STDERR "Error at tick $clock $cxn $err" if $config{debug}->{val};
- }
-}
-
-# Accepts a DB connection name and a (string) query. Returns a $sth that's been
-# executed.
-sub do_query {
- my ( $cxn, $query ) = @_;
-
- return undef if $file;
-
- # Test if the cxn should not even be tried
- return undef if $dbhs{$cxn}
- && $dbhs{$cxn}->{err_count}
- && ( !$dbhs{$cxn}->{dbh} || !$dbhs{$cxn}->{dbh}->{Active} || $dbhs{$cxn}->{mode} eq $config{mode}->{val} )
- && $dbhs{$cxn}->{wake_up} > $clock;
-
- my $sth;
- my $retries = 1;
- my $success = 0;
- TRY:
- while ( $retries-- >= 0 && !$success ) {
-
- eval {
- my $dbh = connect_to_db($cxn);
-
- $sth = $dbh->prepare($query);
- $sth->execute();
- $success = 1;
- };
- if ( $EVAL_ERROR ) {
- if ( $EVAL_ERROR =~ m/$nonfatal_errs/ ) {
- handle_cxn_error($cxn, $EVAL_ERROR);
- }
- else {
- die $EVAL_ERROR;
- }
- if ( $retries < 0 ) {
- $sth = undef;
- }
- }
- }
-
- return $sth;
-}
-
-sub get_uptime {
- my ( $cxn ) = @_;
- $dbhs{$cxn}->{start_time} ||= time();
- # Avoid dividing by zero
- return (time() - $dbhs{$cxn}->{start_time}) || .001;
-}
-
-sub connect_to_db {
- my ( $cxn ) = @_;
-
- $dbhs{$cxn} ||= {
- stmts => {}, # bucket for prepared statements.
- prev_sleep => 0,
- this_sleep => 1,
- wake_up => 0,
- start_time => 0,
- dbh => undef,
- };
- my $href = $dbhs{$cxn};
-
- if ( !$href->{dbh} || ref($href->{dbh}) !~ m/DBI/ || !$href->{dbh}->ping ) {
- my $dbh = get_new_db_connection($cxn);
- @{$href}{qw(dbh err_count wake_up this_sleep start_time prev_sleep)}
- = ($dbh, 0, 0, 1, 0, 0);
-
- # Derive and store the server's start time in hi-res
- my $uptime = $dbh->selectrow_hashref("show status like 'Uptime'")->{value};
- $href->{start_time} = time() - $uptime;
-
- # Set timeouts so an unused connection stays alive.
- # For example, a connection might be used in Q mode but idle in T mode.
- if ( version_ge($dbh, '4.0.3')) {
- my $timeout = $config{cxn_timeout}->{val};
- $dbh->do("set session wait_timeout=$timeout, interactive_timeout=$timeout");
- }
- }
- return $href->{dbh};
-}
-
-# Compares versions like 5.0.27 and 4.1.15-standard-log
-sub version_ge {
- my ( $dbh, $target ) = @_;
- my $version = sprintf('%03d%03d%03d', $dbh->{mysql_serverinfo} =~ m/(\d+)/g);
- return $version ge sprintf('%03d%03d%03d', $target =~ m/(\d+)/g);
-}
-
-# Extracts status values that can be gleaned from the DBD driver without doing a whole query.
-sub get_driver_status {
- my @cxns = @_;
- if ( !$info_gotten{driver_status}++ ) {
- foreach my $cxn ( @cxns ) {
- next unless $dbhs{$cxn} && $dbhs{$cxn}->{dbh} && $dbhs{$cxn}->{dbh}->{Active};
- $vars{$cxn}->{$clock} ||= {};
- my $vars = $vars{$cxn}->{$clock};
- my %res = map { $_ =~ s/ +/_/g; $_ } $dbhs{$cxn}->{dbh}->{mysql_stat} =~ m/(\w[^:]+): ([\d\.]+)/g;
- map { $vars->{$_} ||= $res{$_} } keys %res;
- $vars->{Uptime_hires} ||= get_uptime($cxn);
- $vars->{cxn} = $cxn;
- }
- }
-}
-
-sub get_new_db_connection {
- my ( $connection, $destroy ) = @_;
- if ( $file ) {
- die "You can't connect to a MySQL server while monitoring a file. This is probably a bug.";
- }
-
- my $dsn = $connections{$connection}
- or die "No connection named '$connection' is defined in your configuration";
-
- if ( !defined $dsn->{have_user} ) {
- my $answer = prompt("Do you want to specify a username for $connection?", undef, 'n');
- $dsn->{have_user} = $answer && $answer =~ m/1|y/i;
- }
-
- if ( !defined $dsn->{have_pass} ) {
- my $answer = prompt("Do you want to specify a password for $connection?", undef, 'n');
- $dsn->{have_pass} = $answer && $answer =~ m/1|y/i;
- }
-
- if ( !$dsn->{user} && $dsn->{have_user} ) {
- my $user = $ENV{USERNAME} || $ENV{USER} || getlogin() || getpwuid($REAL_USER_ID) || undef;
- $dsn->{user} = prompt("Enter username for $connection", undef, $user);
- }
-
- if ( !defined $dsn->{user} ) {
- $dsn->{user} = '';
- }
-
- if ( !$dsn->{pass} && !$dsn->{savepass} && $dsn->{have_pass} ) {
- $dsn->{pass} = prompt_noecho("Enter password for '$dsn->{user}' on $connection");
- print "\n";
- if ( !defined($dsn->{savepass}) ) {
- my $answer = prompt("Save password in plain text in the config file?", undef, 'y');
- $dsn->{savepass} = $answer && $answer =~ m/1|y/i;
- }
- }
-
- my $dbh = DBI->connect(
- $dsn->{dsn}, $dsn->{user}, $dsn->{pass},
- { RaiseError => 1, PrintError => 0, AutoCommit => 1 });
- $dbh->{InactiveDestroy} = 1 unless $destroy; # Can't be set in $db_options
- $dbh->{FetchHashKeyName} = 'NAME_lc'; # Lowercases all column names for fetchrow_hashref
- return $dbh;
-}
-
-sub get_cxn_errors {
- my @cxns = @_;
- return () unless $config{show_cxn_errors_in_tbl}->{val};
- return
- map { [ $_ . ': ' . $dbhs{$_}->{last_err}, 'red' ] }
- grep { $dbhs{$_} && $dbhs{$_}->{err_count} && $dbhs{$_}->{mode} eq $config{mode}->{val} }
- @cxns;
-}
-
-# Setup and tear-down functions {{{2
-
-# Takes a string and turns it into a hashref you can apply to %tbl_meta tables. The string
-# can be in the form 'foo, bar, foo/bar, foo as bar' much like a SQL SELECT statement.
-sub compile_select_stmt {
- my ($str) = @_;
- my @exps = $str =~ m/\s*([^,]+(?i:\s+as\s+[^,\s]+)?)\s*(?=,|$)/g;
- my %cols;
- my @visible;
- foreach my $exp ( @exps ) {
- my ( $text, $colname );
- if ( $exp =~ m/as\s+(\w+)\s*/ ) {
- $colname = $1;
- $exp =~ s/as\s+(\w+)\s*//;
- $text = $exp;
- }
- else {
- $text = $colname = $exp;
- }
- my ($func, $err) = compile_expr($text);
- $cols{$colname} = {
- src => $text,
- hdr => $colname,
- num => 0,
- func => $func,
- };
- push @visible, $colname;
- }
- return (\%cols, \@visible);
-}
-
-# compile_filter {{{3
-sub compile_filter {
- my ( $text ) = @_;
- my ( $sub, $err );
- eval "\$sub = sub { my \$set = shift; $text }";
- if ( $EVAL_ERROR ) {
- $EVAL_ERROR =~ s/at \(eval.*$//;
- $sub = sub { return $EVAL_ERROR };
- $err = $EVAL_ERROR;
- }
- return ( $sub, $err );
-}
-
-# compile_expr {{{3
-sub compile_expr {
- my ( $expr ) = @_;
- # Leave built-in functions alone so they get called as Perl functions, unless
- # they are the only word in $expr, in which case treat them as hash keys.
- if ( $expr =~ m/\W/ ) {
- $expr =~ s/(?<!\{|\$)\b([A-Za-z]\w{2,})\b/is_func($1) ? $1 : "\$set->{$1}"/eg;
- }
- else {
- $expr = "\$set->{$expr}";
- }
- my ( $sub, $err );
- my $quoted = quotemeta($expr);
- eval qq{
- \$sub = sub {
- my (\$set, \$cur, \$pre) = \@_;
- my \$val = eval { $expr };
- if ( \$EVAL_ERROR && \$config{debug}->{val} ) {
- \$EVAL_ERROR =~ s/ at \\(eval.*//s;
- die "\$EVAL_ERROR in expression $quoted";
- }
- return \$val;
- }
- };
- if ( $EVAL_ERROR ) {
- if ( $config{debug}->{val} ) {
- die $EVAL_ERROR;
- }
- $EVAL_ERROR =~ s/ at \(eval.*$//;
- $sub = sub { return $EVAL_ERROR };
- $err = $EVAL_ERROR;
- }
- return ( $sub, $err );
-}
-
-# finish {{{3
-# This is a subroutine because it's called from a key to quit the program.
-sub finish {
- save_config();
- ReadMode('normal') unless $opts{n};
- print "\n";
- exit(0);
-}
-
-# core_dump {{{3
-sub core_dump {
- my $msg = shift;
- if ($config{debugfile}->{val} && $config{debug}->{val}) {
- eval {
- open my $file, '>>', $config{debugfile}->{val};
- if ( %vars ) {
- print $file "Current variables:\n" . Dumper(\%vars);
- }
- close $file;
- };
- }
- print $msg;
-}
-
-# load_config {{{3
-sub load_config {
-
- my $filename = $opts{c} || "$homepath/.innotop/innotop.ini";
- my $dirname = dirname($filename);
- if ( -f $dirname && !$opts{c} ) {
- # innotop got upgraded and this is the old config file.
- my $answer = pause("Innotop's default config location has moved to $filename. Move old config file $dirname there now? y/n");
- if ( lc $answer eq 'y' ) {
- rename($dirname, "$homepath/innotop.ini")
- or die "Can't rename '$dirname': $OS_ERROR";
- mkdir($dirname) or die "Can't create directory '$dirname': $OS_ERROR";
- mkdir("$dirname/plugins") or die "Can't create directory '$dirname/plugins': $OS_ERROR";
- rename("$homepath/innotop.ini", $filename)
- or die "Can't rename '$homepath/innotop.ini' to '$filename': $OS_ERROR";
- }
- else {
- print "\nInnotop will now exit so you can fix the config file.\n";
- exit(0);
- }
- }
-
- if ( ! -d $dirname ) {
- mkdir $dirname
- or die "Can't create directory '$dirname': $OS_ERROR";
- }
- if ( ! -d "$dirname/plugins" ) {
- mkdir "$dirname/plugins"
- or die "Can't create directory '$dirname/plugins': $OS_ERROR";
- }
-
- if ( -f $filename ) {
- open my $file, "<", $filename or die("Can't open '$filename': $OS_ERROR");
-
- # Check config file version. Just ignore if either innotop or the file has
- # garbage in the version number.
- if ( defined(my $line = <$file>) && $VERSION =~ m/\d/ ) {
- chomp $line;
- if ( my ($maj, $min, $rev) = $line =~ m/^version=(\d+)\.(\d+)(?:\.(\d+))?$/ ) {
- $rev ||= 0;
- my $cfg_ver = sprintf('%03d-%03d-%03d', $maj, $min, $rev);
- ( $maj, $min, $rev ) = $VERSION =~ m/^(\d+)\.(\d+)(?:\.(\d+))?$/;
- $rev ||= 0;
- my $innotop_ver = sprintf('%03d-%03d-%03d', $maj, $min, $rev);
-
- if ( $cfg_ver gt $innotop_ver ) {
- pause("The config file is for a newer version of innotop and may not be read correctly.");
- }
- else {
- my @ver_history = @config_versions;
- while ( my ($start, $end) = splice(@ver_history, 0, 2) ) {
- # If the config file is between the endpoints and innotop is greater than
- # the endpoint, innotop has a newer config file format than the file.
- if ( $cfg_ver ge $start && $cfg_ver lt $end && $innotop_ver ge $end ) {
- my $msg = "innotop's config file format has changed. Overwrite $filename? y or n";
- if ( pause($msg) eq 'n' ) {
- $config{readonly}->{val} = 1;
- print "\ninnotop will not save any configuration changes you make.";
- pause();
- print "\n";
- }
- close $file;
- return;
- }
- }
- }
- }
- }
-
- while ( my $line = <$file> ) {
- chomp $line;
- next unless $line =~ m/^\[([a-z_]+)\]$/;
- if ( exists $config_file_sections{$1} ) {
- $config_file_sections{$1}->{reader}->($file);
- }
- else {
- warn "Unknown config file section '$1'";
- }
- }
- close $file or die("Can't close $filename: $OS_ERROR");
- }
-
-}
-
-# Do some post-processing on %tbl_meta: compile src properties into func etc.
-sub post_process_tbl_meta {
- foreach my $table ( values %tbl_meta ) {
- foreach my $col_name ( keys %{$table->{cols}} ) {
- my $col_def = $table->{cols}->{$col_name};
- my ( $sub, $err ) = compile_expr($col_def->{src});
- $col_def->{func} = $sub;
- }
- }
-}
-
-# load_config_plugins {{{3
-sub load_config_plugins {
- my ( $file ) = @_;
-
- # First, find a list of all plugins that exist on disk, and get information about them.
- my $dir = $config{plugin_dir}->{val};
- foreach my $p_file ( <$dir/*.pm> ) {
- my ($package, $desc);
- eval {
- open my $p_in, "<", $p_file or die $OS_ERROR;
- while ( my $line = <$p_in> ) {
- chomp $line;
- if ( $line =~ m/^package\s+(.*?);/ ) {
- $package = $1;
- }
- elsif ( $line =~ m/^# description: (.*)/ ) {
- $desc = $1;
- }
- last if $package && $desc;
- }
- close $p_in;
- };
- if ( $package ) {
- $plugins{$package} = {
- file => $p_file,
- desc => $desc,
- class => $package,
- active => 0,
- };
- if ( $config{debug}->{val} && $EVAL_ERROR ) {
- die $EVAL_ERROR;
- }
- }
- }
-
- # Now read which ones the user has activated. Each line simply represents an active plugin.
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
- next unless $line && $plugins{$line};
-
- my $obj;
- eval {
- require $plugins{$line}->{file};
- $obj = $line->new(%pluggable_vars);
- foreach my $event ( $obj->register_for_events() ) {
- my $queue = $event_listener_for{$event};
- if ( $queue ) {
- push @$queue, $obj;
- }
- }
- };
- if ( $config{debug}->{val} && $EVAL_ERROR ) {
- die $EVAL_ERROR;
- }
- if ( $obj ) {
- $plugins{$line}->{active} = 1;
- $plugins{$line}->{object} = $obj;
- }
- }
-}
-
-# save_config_plugins {{{3
-sub save_config_plugins {
- my $file = shift;
- foreach my $class ( sort keys %plugins ) {
- next unless $plugins{$class}->{active};
- print $file "$class\n";
- }
-}
-
-# load_config_active_server_groups {{{3
-sub load_config_active_server_groups {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $mode, $group ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $mode && $group
- && exists $modes{$mode} && exists $server_groups{$group};
- $modes{$mode}->{server_group} = $group;
- }
-}
-
-# save_config_active_server_groups {{{3
-sub save_config_active_server_groups {
- my $file = shift;
- foreach my $mode ( sort keys %modes ) {
- print $file "$mode=$modes{$mode}->{server_group}\n";
- }
-}
-
-# load_config_server_groups {{{3
-sub load_config_server_groups {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $name, $rest ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $name && $rest;
- my @vars = unique(grep { $_ && exists $connections{$_} } split(/\s+/, $rest));
- next unless @vars;
- $server_groups{$name} = \@vars;
- }
-}
-
-# save_config_server_groups {{{3
-sub save_config_server_groups {
- my $file = shift;
- foreach my $set ( sort keys %server_groups ) {
- print $file "$set=", join(' ', @{$server_groups{$set}}), "\n";
- }
-}
-
-# load_config_varsets {{{3
-sub load_config_varsets {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $name, $rest ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $name && $rest;
- $var_sets{$name} = {
- text => $rest,
- user => 1,
- };
- }
-}
-
-# save_config_varsets {{{3
-sub save_config_varsets {
- my $file = shift;
- foreach my $varset ( sort keys %var_sets ) {
- next unless $var_sets{$varset}->{user};
- print $file "$varset=$var_sets{$varset}->{text}\n";
- }
-}
-
-# load_config_group_by {{{3
-sub load_config_group_by {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $tbl , $rest ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $tbl && exists $tbl_meta{$tbl};
- my @parts = unique(grep { exists($tbl_meta{$tbl}->{cols}->{$_}) } split(/\s+/, $rest));
- $tbl_meta{$tbl}->{group_by} = [ @parts ];
- $tbl_meta{$tbl}->{cust}->{group_by} = 1;
- }
-}
-
-# save_config_group_by {{{3
-sub save_config_group_by {
- my $file = shift;
- foreach my $tbl ( sort keys %tbl_meta ) {
- next if $tbl_meta{$tbl}->{temp};
- next unless $tbl_meta{$tbl}->{cust}->{group_by};
- my $aref = $tbl_meta{$tbl}->{group_by};
- print $file "$tbl=", join(' ', @$aref), "\n";
- }
-}
-
-# load_config_filters {{{3
-sub load_config_filters {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $key, $rest ) = $line =~ m/^(.+?)=(.*)$/;
- next unless $key && $rest;
-
- my %parts = $rest =~ m/(\w+)='((?:(?!(?<!\\)').)*)'/g; # Properties are single-quoted
- next unless $parts{text} && $parts{tbls};
-
- foreach my $prop ( keys %parts ) {
- # Un-escape escaping
- $parts{$prop} =~ s/\\\\/\\/g;
- $parts{$prop} =~ s/\\'/'/g;
- }
-
- my ( $sub, $err ) = compile_filter($parts{text});
- my @tbls = unique(split(/\s+/, $parts{tbls}));
- @tbls = grep { exists $tbl_meta{$_} } @tbls;
- $filters{$key} = {
- func => $sub,
- text => $parts{text},
- user => 1,
- name => $key,
- note => 'User-defined filter',
- tbls => \@tbls,
- }
- }
-}
-
-# save_config_filters {{{3
-sub save_config_filters {
- my $file = shift;
- foreach my $key ( sort keys %filters ) {
- next if !$filters{$key}->{user} || $filters{$key}->{quick};
- my $text = $filters{$key}->{text};
- $text =~ s/([\\'])/\\$1/g;
- my $tbls = join(" ", @{$filters{$key}->{tbls}});
- print $file "$key=text='$text' tbls='$tbls'\n";
- }
-}
-
-# load_config_visible_tables {{{3
-sub load_config_visible_tables {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $mode, $rest ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $mode && exists $modes{$mode};
- $modes{$mode}->{visible_tables} =
- [ unique(grep { $_ && exists $tbl_meta{$_} } split(/\s+/, $rest)) ];
- $modes{$mode}->{cust}->{visible_tables} = 1;
- }
-}
-
-# save_config_visible_tables {{{3
-sub save_config_visible_tables {
- my $file = shift;
- foreach my $mode ( sort keys %modes ) {
- next unless $modes{$mode}->{cust}->{visible_tables};
- my $tables = $modes{$mode}->{visible_tables};
- print $file "$mode=", join(' ', @$tables), "\n";
- }
-}
-
-# load_config_sort_cols {{{3
-sub load_config_sort_cols {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $key , $rest ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $key && exists $tbl_meta{$key};
- $tbl_meta{$key}->{sort_cols} = $rest;
- $tbl_meta{$key}->{cust}->{sort_cols} = 1;
- $tbl_meta{$key}->{sort_func} = make_sort_func($tbl_meta{$key});
- }
-}
-
-# save_config_sort_cols {{{3
-sub save_config_sort_cols {
- my $file = shift;
- foreach my $tbl ( sort keys %tbl_meta ) {
- next unless $tbl_meta{$tbl}->{cust}->{sort_cols};
- my $col = $tbl_meta{$tbl}->{sort_cols};
- print $file "$tbl=$col\n";
- }
-}
-
-# load_config_active_filters {{{3
-sub load_config_active_filters {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $tbl , $rest ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $tbl && exists $tbl_meta{$tbl};
- my @parts = unique(grep { exists($filters{$_}) } split(/\s+/, $rest));
- @parts = grep { grep { $tbl eq $_ } @{$filters{$_}->{tbls}} } @parts;
- $tbl_meta{$tbl}->{filters} = [ @parts ];
- $tbl_meta{$tbl}->{cust}->{filters} = 1;
- }
-}
-
-# save_config_active_filters {{{3
-sub save_config_active_filters {
- my $file = shift;
- foreach my $tbl ( sort keys %tbl_meta ) {
- next if $tbl_meta{$tbl}->{temp};
- next unless $tbl_meta{$tbl}->{cust}->{filters};
- my $aref = $tbl_meta{$tbl}->{filters};
- print $file "$tbl=", join(' ', @$aref), "\n";
- }
-}
-
-# load_config_active_columns {{{3
-sub load_config_active_columns {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $key , $rest ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $key && exists $tbl_meta{$key};
- my @parts = grep { exists($tbl_meta{$key}->{cols}->{$_}) } unique split(/ /, $rest);
- $tbl_meta{$key}->{visible} = [ @parts ];
- $tbl_meta{$key}->{cust}->{visible} = 1;
- }
-}
-
-# save_config_active_columns {{{3
-sub save_config_active_columns {
- my $file = shift;
- foreach my $tbl ( sort keys %tbl_meta ) {
- next unless $tbl_meta{$tbl}->{cust}->{visible};
- my $aref = $tbl_meta{$tbl}->{visible};
- print $file "$tbl=", join(' ', @$aref), "\n";
- }
-}
-
-# save_config_tbl_meta {{{3
-sub save_config_tbl_meta {
- my $file = shift;
- foreach my $tbl ( sort keys %tbl_meta ) {
- foreach my $col ( keys %{$tbl_meta{$tbl}->{cols}} ) {
- my $meta = $tbl_meta{$tbl}->{cols}->{$col};
- next unless $meta->{user};
- print $file "$col=", join(
- " ",
- map {
- # Some properties (trans) are arrays, others scalars
- my $val = ref($meta->{$_}) ? join(',', @{$meta->{$_}}) : $meta->{$_};
- $val =~ s/([\\'])/\\$1/g; # Escape backslashes and single quotes
- "$_='$val'"; # Enclose in single quotes
- }
- grep { $_ ne 'func' }
- keys %$meta
- ), "\n";
- }
- }
-}
-
-# save_config_config {{{3
-sub save_config_config {
- my $file = shift;
- foreach my $key ( sort keys %config ) {
- eval {
- if ( $key ne 'password' || $config{savepass}->{val} ) {
- print $file "# $config{$key}->{note}\n"
- or die "Cannot print to file: $OS_ERROR";
- my $val = $config{$key}->{val};
- $val = '' unless defined($val);
- if ( ref( $val ) eq 'ARRAY' ) {
- print $file "$key="
- . join( " ", @$val ) . "\n"
- or die "Cannot print to file: $OS_ERROR";
- }
- elsif ( ref( $val ) eq 'HASH' ) {
- print $file "$key="
- . join( " ",
- map { "$_:$val->{$_}" } keys %$val
- ) . "\n";
- }
- else {
- print $file "$key=$val\n";
- }
- }
- };
- if ( $EVAL_ERROR ) { print "$EVAL_ERROR in $key"; };
- }
-
-}
-
-# load_config_config {{{3
-sub load_config_config {
- my ( $file ) = @_;
-
- # Look in the command-line parameters for things stored in the same slot.
- my %cmdline =
- map { $_->{c} => $opts{$_->{k}} }
- grep { exists $_->{c} && exists $opts{$_->{k}} }
- @opt_spec;
-
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $name, $val ) = $line =~ m/^(.+?)=(.*)$/;
- next unless defined $name && defined $val;
-
- # Values might already have been set at the command line.
- $val = defined($cmdline{$name}) ? $cmdline{$name} : $val;
-
- # Validate the incoming values...
- if ( $name && exists( $config{$name} ) ) {
- if ( !$config{$name}->{pat} || $val =~ m/$config{$name}->{pat}/ ) {
- $config{$name}->{val} = $val;
- $config{$name}->{read} = 1;
- }
- }
- }
-}
-
-# load_config_tbl_meta {{{3
-sub load_config_tbl_meta {
- my ( $file ) = @_;
-
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- # Each tbl_meta section has all the properties defined in %col_props.
- my ( $col , $rest ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $col;
- my %parts = $rest =~ m/(\w+)='((?:(?!(?<!\\)').)*)'/g; # Properties are single-quoted
-
- # Each section read from the config file has one extra property: which table it
- # goes in.
- my $tbl = $parts{tbl} or die "There's no table for tbl_meta $col";
- my $meta = $tbl_meta{$tbl} or die "There's no table in tbl_meta named $tbl";
-
- # The section is user-defined by definition (if that makes sense).
- $parts{user} = 1;
-
- # The column may already exist in the table, in which case this is just a
- # customization.
- $meta->{cols}->{$col} ||= {};
-
- foreach my $prop ( keys %col_props ) {
- if ( !defined($parts{$prop}) ) {
- die "Undefined property $prop for column $col in table $tbl";
- }
-
- # Un-escape escaping
- $parts{$prop} =~ s/\\\\/\\/g;
- $parts{$prop} =~ s/\\'/'/g;
-
- if ( ref $col_props{$prop} ) {
- if ( $prop eq 'trans' ) {
- $meta->{cols}->{$col}->{trans}
- = [ unique(grep { exists $trans_funcs{$_} } split(',', $parts{$prop})) ];
- }
- else {
- $meta->{cols}->{$col}->{$prop} = [ split(',', $parts{$prop}) ];
- }
- }
- else {
- $meta->{cols}->{$col}->{$prop} = $parts{$prop};
- }
- }
-
- }
-}
-
-# save_config {{{3
-sub save_config {
- return if $config{readonly}->{val};
- # Save to a temp file first, so a crash doesn't destroy the main config file
- my $newname = $opts{c} || "$homepath/.innotop/innotop.ini";
- my $filename = $newname . '_tmp';
- open my $file, "+>", $filename
- or die("Can't write to $filename: $OS_ERROR");
- print $file "version=$VERSION\n";
-
- foreach my $section ( @ordered_config_file_sections ) {
- die "No such config file section $section" unless $config_file_sections{$section};
- print $file "\n[$section]\n\n";
- $config_file_sections{$section}->{writer}->($file);
- print $file "\n[/$section]\n";
- }
-
- # Now clobber the main config file with the temp.
- close $file or die("Can't close $filename: $OS_ERROR");
- rename($filename, $newname) or die("Can't rename $filename to $newname: $OS_ERROR");
-}
-
-# load_config_connections {{{3
-sub load_config_connections {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $key , $rest ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $key;
- my %parts = $rest =~ m/(\S+?)=(\S*)/g;
- my %conn = map { $_ => $parts{$_} || '' } @conn_parts;
- $connections{$key} = \%conn;
- }
-}
-
-# save_config_connections {{{3
-sub save_config_connections {
- my $file = shift;
- foreach my $conn ( sort keys %connections ) {
- my $href = $connections{$conn};
- my @keys = $href->{savepass} ? @conn_parts : grep { $_ ne 'pass' } @conn_parts;
- print $file "$conn=", join(' ', map { "$_=$href->{$_}" } grep { defined $href->{$_} } @keys), "\n";
- }
-}
-
-sub load_config_colors {
- my ( $file ) = @_;
- my %rule_set_for;
-
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $tbl, $rule ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $tbl && $rule;
- next unless exists $tbl_meta{$tbl};
- my %parts = $rule =~ m/(\w+)='((?:(?!(?<!\\)').)*)'/g; # Properties are single-quoted
- next unless $parts{col} && exists $tbl_meta{$tbl}->{cols}->{$parts{col}};
- next unless $parts{op} && exists $comp_ops{$parts{op}};
- next unless defined $parts{arg};
- next unless defined $parts{color};
- my @colors = unique(grep { exists $ansicolors{$_} } split(/\W+/, $parts{color}));
- next unless @colors;
-
- # Finally! Enough validation...
- $rule_set_for{$tbl} ||= [];
- push @{$rule_set_for{$tbl}}, \%parts;
- }
-
- foreach my $tbl ( keys %rule_set_for ) {
- $tbl_meta{$tbl}->{colors} = $rule_set_for{$tbl};
- $tbl_meta{$tbl}->{color_func} = make_color_func($tbl_meta{$tbl});
- $tbl_meta{$tbl}->{cust}->{colors} = 1;
- }
-}
-
-# save_config_colors {{{3
-sub save_config_colors {
- my $file = shift;
- foreach my $tbl ( sort keys %tbl_meta ) {
- my $meta = $tbl_meta{$tbl};
- next unless $meta->{cust}->{colors};
- foreach my $rule ( @{$meta->{colors}} ) {
- print $file "$tbl=", join(
- ' ',
- map {
- my $val = $rule->{$_};
- $val =~ s/([\\'])/\\$1/g; # Escape backslashes and single quotes
- "$_='$val'"; # Enclose in single quotes
- }
- qw(col op arg color)
- ), "\n";
- }
- }
-}
-
-# load_config_active_connections {{{3
-sub load_config_active_connections {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $key , $rest ) = $line =~ m/^(.*?)=(.*)$/;
- next unless $key && exists $modes{$key};
- my @parts = grep { exists $connections{$_} } split(/ /, $rest);
- $modes{$key}->{connections} = [ @parts ] if exists $modes{$key};
- }
-}
-
-# save_config_active_connections {{{3
-sub save_config_active_connections {
- my $file = shift;
- foreach my $mode ( sort keys %modes ) {
- my @connections = get_connections($mode);
- print $file "$mode=", join(' ', @connections), "\n";
- }
-}
-
-# load_config_stmt_sleep_times {{{3
-sub load_config_stmt_sleep_times {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $key , $val ) = split('=', $line);
- next unless $key && defined $val && $val =~ m/$num_regex/;
- $stmt_sleep_time_for{$key} = $val;
- }
-}
-
-# save_config_stmt_sleep_times {{{3
-sub save_config_stmt_sleep_times {
- my $file = shift;
- foreach my $key ( sort keys %stmt_sleep_time_for ) {
- print $file "$key=$stmt_sleep_time_for{$key}\n";
- }
-}
-
-# load_config_mvs {{{3
-sub load_config_mvs {
- my ( $file ) = @_;
- while ( my $line = <$file> ) {
- chomp $line;
- next if $line =~ m/^#/;
- last if $line =~ m/^\[/;
-
- my ( $key , $val ) = split('=', $line);
- next unless $key && defined $val && $val =~ m/$num_regex/;
- $mvs{$key} = $val;
- }
-}
-
-# save_config_mvs {{{3
-sub save_config_mvs {
- my $file = shift;
- foreach my $key ( sort keys %mvs ) {
- print $file "$key=$mvs{$key}\n";
- }
-}
-
-# edit_configuration {{{3
-sub edit_configuration {
- my $key = '';
- while ( $key ne 'q' ) {
- $clear_screen_sub->();
- my @display_lines = '';
-
- if ( $key && $cfg_editor_action{$key} ) {
- $cfg_editor_action{$key}->{func}->();
- }
-
- # Show help
- push @display_lines, create_caption('What configuration do you want to edit?',
- create_table2(
- [ sort keys %cfg_editor_action ],
- { map { $_ => $_ } keys %cfg_editor_action },
- { map { $_ => $cfg_editor_action{$_}->{note} } keys %cfg_editor_action },
- { sep => ' ' }));
-
- draw_screen(\@display_lines);
- $key = pause('');
- }
-}
-
-# edit_configuration_variables {{{3
-sub edit_configuration_variables {
- $clear_screen_sub->();
- my $mode = $config{mode}->{val};
-
- my %config_choices
- = map { $_ => $config{$_}->{note} || '' }
- # Only config values that are marked as applying to this mode.
- grep {
- my $key = $_;
- $config{$key}->{conf} &&
- ( $config{$key}->{conf} eq 'ALL'
- || grep { $mode eq $_ } @{$config{$key}->{conf}} )
- } keys %config;
-
- my $key = prompt_list(
- "Enter the name of the variable you wish to configure",
- '',
- sub{ return keys %config_choices },
- \%config_choices);
-
- if ( exists($config_choices{$key}) ) {
- get_config_interactive($key);
- }
-}
-
-# edit_color_rules {{{3
-sub edit_color_rules {
- my ( $tbl ) = @_;
- $clear_screen_sub->();
- $tbl ||= choose_visible_table();
- if ( $tbl && exists($tbl_meta{$tbl}) ) {
- my $meta = $tbl_meta{$tbl};
- my @cols = ('', qw(col op arg color));
- my $info = { map { $_ => { hdr => $_, just => '-', } } @cols };
- $info->{label}->{maxw} = 30;
- my $key;
- my $selected_rule;
-
- # This loop builds a tabular view of the rules.
- do {
-
- # Show help
- if ( $key && $key eq '?' ) {
- my @display_lines = '';
- push @display_lines, create_caption('Editor key mappings',
- create_table2(
- [ sort keys %color_editor_action ],
- { map { $_ => $_ } keys %color_editor_action },
- { map { $_ => $color_editor_action{$_}->{note} } keys %color_editor_action },
- { sep => ' ' }));
- draw_screen(\@display_lines);
- pause();
- $key = '';
- }
- else {
-
- # Do the action specified
- $selected_rule ||= 0;
- if ( $key && $color_editor_action{$key} ) {
- $selected_rule = $color_editor_action{$key}->{func}->($tbl, $selected_rule);
- $selected_rule ||= 0;
- }
-
- # Build the table of rules. If the terminal has color, the selected rule
- # will be highlighted; otherwise a > at the left will indicate.
- my $data = $meta->{colors} || [];
- foreach my $i ( 0..@$data - 1 ) {
- $data->[$i]->{''} = $i == $selected_rule ? '>' : '';
- }
- my @display_lines = create_table(\@cols, $info, $data);
-
- # Highlight selected entry
- for my $i ( 0 .. $#display_lines ) {
- if ( $display_lines[$i] =~ m/^>/ ) {
- $display_lines[$i] = [ $display_lines[$i], 'reverse' ];
- }
- }
-
- # Draw the screen and wait for a command.
- unshift @display_lines, '',
- "Editing color rules for $meta->{capt}. Press ? for help, q to "
- . "quit.", '';
- draw_screen(\@display_lines);
- print "\n\n", word_wrap('Rules are applied in order from top to '
- . 'bottom. The first matching rule wins and prevents the '
- . 'rest of the rules from being applied.');
- $key = pause('');
- }
- } while ( $key ne 'q' );
- $meta->{color_func} = make_color_func($meta);
- }
-}
-
-# add_quick_filter {{{3
-sub add_quick_filter {
- my $tbl = choose_visible_table();
- if ( $tbl && exists($tbl_meta{$tbl}) ) {
- print "\n";
- my $response = prompt_list(
- "Enter column name and filter text",
- '',
- sub { return keys %{$tbl_meta{$tbl}->{cols}} },
- ()
- );
- my ( $col, $text ) = split(/\s+/, $response, 2);
-
- # You can't filter on a nonexistent column. But if you filter on a pivoted
- # table, the columns are different, so on a pivoted table, allow filtering
- # on the 'name' column.
- # NOTE: if a table is pivoted and un-pivoted, this will likely cause crashes.
- # Currently not an issue since there's no way to toggle pivot/nopivot.
- return unless $col && $text &&
- (exists($tbl_meta{$tbl}->{cols}->{$col})
- || ($tbl_meta{$tbl}->{pivot} && $col eq 'name'));
-
- my ( $sub, $err ) = compile_filter( "defined \$set->{$col} && \$set->{$col} =~ m/$text/" );
- return if !$sub || $err;
- my $name = "quick_$tbl.$col";
- $filters{$name} = {
- func => $sub,
- text => $text,
- user => 1,
- quick => 1,
- name => $name,
- note => 'Quick-filter',
- tbls => [$tbl],
- };
- push @{$tbl_meta{$tbl}->{filters}}, $name;
- }
-}
-
-# clear_quick_filters {{{3
-sub clear_quick_filters {
- my $tbl = choose_visible_table(
- # Only tables that have quick-filters
- sub {
- my ( $tbl ) = @_;
- return scalar grep { $filters{$_}->{quick} } @{ $tbl_meta{$tbl}->{filters} };
- }
- );
- if ( $tbl && exists($tbl_meta{$tbl}) ) {
- my @current = @{$tbl_meta{$tbl}->{filters}};
- @current = grep { !$filters{$_}->{quick} } @current;
- $tbl_meta{$tbl}->{filters} = \@current;
- }
-}
-
-sub edit_plugins {
- $clear_screen_sub->();
-
- my @cols = ('', qw(class desc active));
- my $info = { map { $_ => { hdr => $_, just => '-', } } @cols };
- my @rows = map { $plugins{$_} } sort keys %plugins;
- my $key;
- my $selected;
-
- # This loop builds a tabular view of the plugins.
- do {
-
- # Show help
- if ( $key && $key eq '?' ) {
- my @display_lines = '';
- push @display_lines, create_caption('Editor key mappings',
- create_table2(
- [ sort keys %plugin_editor_action ],
- { map { $_ => $_ } keys %plugin_editor_action },
- { map { $_ => $plugin_editor_action{$_}->{note} } keys %plugin_editor_action },
- { sep => ' ' }));
- draw_screen(\@display_lines);
- pause();
- $key = '';
- }
-
- # Do the action specified
- else {
- $selected ||= 0;
- if ( $key && $plugin_editor_action{$key} ) {
- $selected = $plugin_editor_action{$key}->{func}->(\@rows, $selected);
- $selected ||= 0;
- }
-
- # Build the table of plugins.
- foreach my $row ( 0.. $#rows ) {
- $rows[$row]->{''} = $row eq $selected ? '>' : ' ';
- }
- my @display_lines = create_table(\@cols, $info, \@rows);
-
- # Highlight selected entry
- for my $i ( 0 .. $#display_lines ) {
- if ( $display_lines[$i] =~ m/^>/ ) {
- $display_lines[$i] = [ $display_lines[$i], 'reverse' ];
- }
- }
-
- # Draw the screen and wait for a command.
- unshift @display_lines, '',
- "Plugin Management. Press ? for help, q to quit.", '';
- draw_screen(\@display_lines);
- $key = pause('');
- }
- } while ( $key ne 'q' );
-}
-
-# edit_table {{{3
-sub edit_table {
- $clear_screen_sub->();
- my ( $tbl ) = @_;
- $tbl ||= choose_visible_table();
- if ( $tbl && exists($tbl_meta{$tbl}) ) {
- my $meta = $tbl_meta{$tbl};
- my @cols = ('', qw(name hdr label src));
- my $info = { map { $_ => { hdr => $_, just => '-', } } @cols };
- $info->{label}->{maxw} = 30;
- my $key;
- my $selected_column;
-
- # This loop builds a tabular view of the tbl_meta's structure, showing each column
- # in the entry as a row.
- do {
-
- # Show help
- if ( $key && $key eq '?' ) {
- my @display_lines = '';
- push @display_lines, create_caption('Editor key mappings',
- create_table2(
- [ sort keys %tbl_editor_action ],
- { map { $_ => $_ } keys %tbl_editor_action },
- { map { $_ => $tbl_editor_action{$_}->{note} } keys %tbl_editor_action },
- { sep => ' ' }));
- draw_screen(\@display_lines);
- pause();
- $key = '';
- }
- else {
-
- # Do the action specified
- $selected_column ||= $meta->{visible}->[0];
- if ( $key && $tbl_editor_action{$key} ) {
- $selected_column = $tbl_editor_action{$key}->{func}->($tbl, $selected_column);
- $selected_column ||= $meta->{visible}->[0];
- }
-
- # Build the pivoted view of the table's meta-data. If the terminal has color,
- # The selected row will be highlighted; otherwise a > at the left will indicate.
- my $data = [];
- foreach my $row ( @{$meta->{visible}} ) {
- my %hash;
- @hash{ @cols } = @{$meta->{cols}->{$row}}{@cols};
- $hash{src} = '' if ref $hash{src};
- $hash{name} = $row;
- $hash{''} = $row eq $selected_column ? '>' : ' ';
- push @$data, \%hash;
- }
- my @display_lines = create_table(\@cols, $info, $data);
-
- # Highlight selected entry
- for my $i ( 0 .. $#display_lines ) {
- if ( $display_lines[$i] =~ m/^>/ ) {
- $display_lines[$i] = [ $display_lines[$i], 'reverse' ];
- }
- }
-
- # Draw the screen and wait for a command.
- unshift @display_lines, '',
- "Editing table definition for $meta->{capt}. Press ? for help, q to quit.", '';
- draw_screen(\@display_lines, { clear => 1 });
- $key = pause('');
- }
- } while ( $key ne 'q' );
- }
-}
-
-# choose_mode_tables {{{3
-# Choose which table(s), and in what order, to display in a given mode.
-sub choose_mode_tables {
- my $mode = $config{mode}->{val};
- my @tbls = @{$modes{$mode}->{visible_tables}};
- my $new = prompt_list(
- "Choose tables to display",
- join(' ', @tbls),
- sub { return @{$modes{$mode}->{tables}} },
- { map { $_ => $tbl_meta{$_}->{capt} } @{$modes{$mode}->{tables}} }
- );
- $modes{$mode}->{visible_tables} =
- [ unique(grep { $_ && exists $tbl_meta{$_} } split(/\s+/, $new)) ];
- $modes{$mode}->{cust}->{visible_tables} = 1;
-}
-
-# choose_visible_table {{{3
-sub choose_visible_table {
- my ( $grep_cond ) = @_;
- my $mode = $config{mode}->{val};
- my @tbls
- = grep { $grep_cond ? $grep_cond->($_) : 1 }
- @{$modes{$mode}->{visible_tables}};
- my $tbl = $tbls[0];
- if ( @tbls > 1 ) {
- $tbl = prompt_list(
- "Choose a table",
- '',
- sub { return @tbls },
- { map { $_ => $tbl_meta{$_}->{capt} } @tbls }
- );
- }
- return $tbl;
-}
-
-sub toggle_aggregate {
- my ( $tbl ) = @_;
- $tbl ||= choose_visible_table();
- return unless $tbl && exists $tbl_meta{$tbl};
- my $meta = $tbl_meta{$tbl};
- $meta->{aggregate} ^= 1;
-}
-
-sub choose_filters {
- my ( $tbl ) = @_;
- $tbl ||= choose_visible_table();
- return unless $tbl && exists $tbl_meta{$tbl};
- my $meta = $tbl_meta{$tbl};
- $clear_screen_sub->();
-
- print "Choose filters for $meta->{capt}:\n";
-
- my $ini = join(' ', @{$meta->{filters}});
- my $val = prompt_list(
- 'Choose filters',
- $ini,
- sub { return keys %filters },
- {
- map { $_ => $filters{$_}->{note} }
- grep { grep { $tbl eq $_ } @{$filters{$_}->{tbls}} }
- keys %filters
- }
- );
-
- my @choices = unique(split(/\s+/, $val));
- foreach my $new ( grep { !exists($filters{$_}) } @choices ) {
- my $answer = prompt("There is no filter called '$new'. Create it?", undef, 'y');
- if ( $answer eq 'y' ) {
- create_new_filter($new, $tbl);
- }
- }
- @choices = grep { exists $filters{$_} } @choices;
- @choices = grep { grep { $tbl eq $_ } @{$filters{$_}->{tbls}} } @choices;
- $meta->{filters} = [ @choices ];
- $meta->{cust}->{filters} = 1;
-}
-
-sub choose_group_cols {
- my ( $tbl ) = @_;
- $tbl ||= choose_visible_table();
- return unless $tbl && exists $tbl_meta{$tbl};
- $clear_screen_sub->();
- my $meta = $tbl_meta{$tbl};
- my $curr = join(', ', @{$meta->{group_by}});
- my $val = prompt_list(
- 'Group-by columns',
- $curr,
- sub { return keys %{$meta->{cols}} },
- { map { $_ => $meta->{cols}->{$_}->{label} } keys %{$meta->{cols}} });
- if ( $curr ne $val ) {
- $meta->{group_by} = [ grep { exists $meta->{cols}->{$_} } $val =~ m/(\w+)/g ];
- $meta->{cust}->{group_by} = 1;
- }
-}
-
-sub choose_sort_cols {
- my ( $tbl ) = @_;
- $tbl ||= choose_visible_table();
- return unless $tbl && exists $tbl_meta{$tbl};
- $clear_screen_sub->();
- my $meta = $tbl_meta{$tbl};
-
- my ( $cols, $hints );
- if ( $meta->{pivot} ) {
- $cols = sub { qw(name set_0) };
- $hints = { name => 'name', set_0 => 'set_0' };
- }
- else {
- $cols = sub { return keys %{$meta->{cols}} };
- $hints = { map { $_ => $meta->{cols}->{$_}->{label} } keys %{$meta->{cols}} };
- }
-
- my $val = prompt_list(
- 'Sort columns (reverse sort with -col)',
- $meta->{sort_cols},
- $cols,
- $hints );
- if ( $meta->{sort_cols} ne $val ) {
- $meta->{sort_cols} = $val;
- $meta->{cust}->{sort_cols} = 1;
- $tbl_meta{$tbl}->{sort_func} = make_sort_func($tbl_meta{$tbl});
- }
-}
-
-# create_new_filter {{{3
-sub create_new_filter {
- my ( $filter, $tbl ) = @_;
- $clear_screen_sub->();
-
- if ( !$filter || $filter =~ m/\W/ ) {
- print word_wrap("Choose a name for the filter. This name is not displayed, and is only used "
- . "for internal reference. It can only contain lowercase letters, numbers, and underscores.");
- print "\n\n";
- do {
- $filter = prompt("Enter filter name");
- } while ( !$filter || $filter =~ m/\W/ );
- }
-
- my $completion = sub { keys %{$tbl_meta{$tbl}->{cols}} };
- my ( $err, $sub, $body );
- do {
- $clear_screen_sub->();
- print word_wrap("A filter is a Perl subroutine that accepts a hashref of columns "
- . "called \$set, and returns a true value if the filter accepts the row. Example:\n"
- . " \$set->{active_secs} > 5\n"
- . "will only allow rows if their active_secs column is greater than 5.");
- print "\n\n";
- if ( $err ) {
- print "There's an error in your filter expression: $err\n\n";
- }
- $body = prompt("Enter subroutine body", undef, undef, $completion);
- ( $sub, $err ) = compile_filter($body);
- } while ( $err );
-
- $filters{$filter} = {
- func => $sub,
- text => $body,
- user => 1,
- name => $filter,
- note => 'User-defined filter',
- tbls => [$tbl],
- };
-}
-
-# get_config_interactive {{{3
-sub get_config_interactive {
- my $key = shift;
- $clear_screen_sub->();
-
- # Print help first.
- print "Enter a new value for '$key' ($config{$key}->{note}).\n";
-
- my $current = ref($config{$key}->{val}) ? join(" ", @{$config{$key}->{val}}) : $config{$key}->{val};
-
- my $new_value = prompt('Enter a value', $config{$key}->{pat}, $current);
- $config{$key}->{val} = $new_value;
-}
-
-sub edit_current_var_set {
- my $mode = $config{mode}->{val};
- my $name = $config{"${mode}_set"}->{val};
- my $variables = $var_sets{$name}->{text};
-
- my $new = $variables;
- do {
- $clear_screen_sub->();
- $new = prompt("Enter variables for $name", undef, $variables);
- } until ( $new );
-
- if ( $new ne $variables ) {
- @{$var_sets{$name}}{qw(text user)} = ( $new, 1);
- }
-}
-
-
-sub choose_var_set {
- my ( $key ) = @_;
- $clear_screen_sub->();
-
- my $new_value = prompt_list(
- 'Choose a set of values to display, or enter the name of a new one',
- $config{$key}->{val},
- sub { return keys %var_sets },
- { map { $_ => $var_sets{$_}->{text} } keys %var_sets });
-
- if ( !exists $var_sets{$new_value} ) {
- add_new_var_set($new_value);
- }
-
- $config{$key}->{val} = $new_value if exists $var_sets{$new_value};
-}
-
-sub switch_var_set {
- my ( $cfg_var, $dir ) = @_;
- my @var_sets = sort keys %var_sets;
- my $cur = $config{$cfg_var}->{val};
- my $pos = grep { $_ lt $cur } @var_sets;
- my $newpos = ($pos + $dir) % @var_sets;
- $config{$cfg_var}->{val} = $var_sets[$newpos];
- $clear_screen_sub->();
-}
-
-# Online configuration and prompting functions {{{2
-
-# edit_stmt_sleep_times {{{3
-sub edit_stmt_sleep_times {
- $clear_screen_sub->();
- my $stmt = prompt_list('Specify a statement', '', sub { return sort keys %stmt_maker_for });
- return unless $stmt && exists $stmt_maker_for{$stmt};
- $clear_screen_sub->();
- my $curr_val = $stmt_sleep_time_for{$stmt} || 0;
- my $new_val = prompt('Specify a sleep delay after calling this SQL', $num_regex, $curr_val);
- if ( $new_val ) {
- $stmt_sleep_time_for{$stmt} = $new_val;
- }
- else {
- delete $stmt_sleep_time_for{$stmt};
- }
-}
-
-# edit_server_groups {{{3
-# Choose which server connections are in a server group. First choose a group,
-# then choose which connections are in it.
-sub edit_server_groups {
- $clear_screen_sub->();
- my $mode = $config{mode}->{val};
- my $group = $modes{$mode}->{server_group};
- my %curr = %server_groups;
- my $new = choose_or_create_server_group($group, 'to edit');
- $clear_screen_sub->();
- if ( exists $curr{$new} ) {
- # Don't do this step if the user just created a new server group,
- # because part of that process was to choose connections.
- my $cxns = join(' ', @{$server_groups{$new}});
- my @conns = choose_or_create_connection($cxns, 'for this group');
- $server_groups{$new} = \@conns;
- }
-}
-
-# choose_server_groups {{{3
-sub choose_server_groups {
- $clear_screen_sub->();
- my $mode = $config{mode}->{val};
- my $group = $modes{$mode}->{server_group};
- my $new = choose_or_create_server_group($group, 'for this mode');
- $modes{$mode}->{server_group} = $new if exists $server_groups{$new};
-}
-
-sub choose_or_create_server_group {
- my ( $group, $prompt ) = @_;
- my $new = '';
-
- my @available = sort keys %server_groups;
-
- if ( @available ) {
- print "You can enter the name of a new group to create it.\n";
-
- $new = prompt_list(
- "Choose a server group $prompt",
- $group,
- sub { return @available },
- { map { $_ => join(' ', @{$server_groups{$_}}) } @available });
-
- $new =~ s/\s.*//;
-
- if ( !exists $server_groups{$new} ) {
- my $answer = prompt("There is no server group called '$new'. Create it?", undef, "y");
- if ( $answer eq 'y' ) {
- add_new_server_group($new);
- }
- }
- }
- else {
- $new = add_new_server_group();
- }
- return $new;
-}
-
-sub choose_or_create_connection {
- my ( $cxns, $prompt ) = @_;
- print "You can enter the name of a new connection to create it.\n";
-
- my @available = sort keys %connections;
- my $new_cxns = prompt_list(
- "Choose connections $prompt",
- $cxns,
- sub { return @available },
- { map { $_ => $connections{$_}->{dsn} } @available });
-
- my @new = unique(grep { !exists $connections{$_} } split(/\s+/, $new_cxns));
- foreach my $new ( @new ) {
- my $answer = prompt("There is no connection called '$new'. Create it?", undef, "y");
- if ( $answer eq 'y' ) {
- add_new_dsn($new);
- }
- }
-
- return unique(grep { exists $connections{$_} } split(/\s+/, $new_cxns));
-}
-
-# choose_servers {{{3
-sub choose_servers {
- $clear_screen_sub->();
- my $mode = $config{mode}->{val};
- my $cxns = join(' ', get_connections());
- my @chosen = choose_or_create_connection($cxns, 'for this mode');
- $modes{$mode}->{connections} = \@chosen;
- $modes{$mode}->{server_group} = ''; # Clear this because it overrides {connections}
-}
-
-# display_license {{{3
-sub display_license {
- $clear_screen_sub->();
-
- print $innotop_license;
-
- pause();
-}
-
-# Data-retrieval functions {{{2
-# get_status_info {{{3
-# Get SHOW STATUS and SHOW VARIABLES together.
-sub get_status_info {
- my @cxns = @_;
- if ( !$info_gotten{status}++ ) {
- foreach my $cxn ( @cxns ) {
- $vars{$cxn}->{$clock} ||= {};
- my $vars = $vars{$cxn}->{$clock};
-
- my $sth = do_stmt($cxn, 'SHOW_STATUS') or next;
- my $res = $sth->fetchall_arrayref();
- map { $vars->{$_->[0]} = $_->[1] || 0 } @$res;
-
- # Calculate hi-res uptime and add cxn to the hash. This duplicates get_driver_status,
- # but it's most important to have consistency.
- $vars->{Uptime_hires} ||= get_uptime($cxn);
- $vars->{cxn} = $cxn;
-
- # Add SHOW VARIABLES to the hash
- $sth = do_stmt($cxn, 'SHOW_VARIABLES') or next;
- $res = $sth->fetchall_arrayref();
- map { $vars->{$_->[0]} = $_->[1] || 0 } @$res;
- }
- }
-}
-
-# Chooses a thread for explaining, killing, etc...
-# First arg is a func that can be called in grep.
-sub choose_thread {
- my ( $grep_cond, $prompt ) = @_;
-
- # Narrow the list to queries that can be explained.
- my %thread_for = map {
- # Eliminate innotop's own threads.
- $_ => $dbhs{$_}->{dbh} ? $dbhs{$_}->{dbh}->{mysql_thread_id} : 0
- } keys %connections;
-
- my @candidates = grep {
- $_->{id} != $thread_for{$_->{cxn}} && $grep_cond->($_)
- } @current_queries;
- return unless @candidates;
-
- # Find out which server.
- my @cxns = unique map { $_->{cxn} } @candidates;
- my ( $cxn ) = select_cxn('On which server', @cxns);
- return unless $cxn && exists($connections{$cxn});
-
- # Re-filter the list of candidates to only those on this server
- @candidates = grep { $_->{cxn} eq $cxn } @candidates;
-
- # Find out which thread to do.
- my $info;
- if ( @candidates > 1 ) {
-
- # Sort longest-active first, then longest-idle.
- my $sort_func = sub {
- my ( $a, $b ) = @_;
- return $a->{query} && !$b->{query} ? 1
- : $b->{query} && !$a->{query} ? -1
- : ($a->{time} || 0) <=> ($b->{time} || 0);
- };
- my @threads = map { $_->{id} } reverse sort { $sort_func->($a, $b) } @candidates;
-
- print "\n";
- my $thread = prompt_list($prompt,
- $threads[0],
- sub { return @threads });
- return unless $thread && $thread =~ m/$int_regex/;
-
- # Find the info hash of that query on that server.
- ( $info ) = grep { $thread == $_->{id} } @candidates;
- }
- else {
- $info = $candidates[0];
- }
- return $info;
-}
-
-# analyze_query {{{3
-# Allows the user to show fulltext, explain, show optimized...
-sub analyze_query {
- my ( $action ) = @_;
-
- my $info = choose_thread(
- sub { $_[0]->{query} },
- 'Select a thread to analyze',
- );
- return unless $info;
-
- my %actions = (
- e => \&display_explain,
- f => \&show_full_query,
- o => \&show_optimized_query,
- );
- do {
- $actions{$action}->($info);
- print "\n";
- $action = pause('Press e to explain, f for full query, o for optimized query');
- } while ( exists($actions{$action}) );
-}
-
-# inc {{{3
-# Returns the difference between two sets of variables/status/innodb stuff.
-sub inc {
- my ( $offset, $cxn ) = @_;
- my $vars = $vars{$cxn};
- if ( $offset < 0 ) {
- return $vars->{$clock};
- }
- elsif ( exists $vars{$clock - $offset} && !exists $vars->{$clock - $offset - 1} ) {
- return $vars->{$clock - $offset};
- }
- my $cur = $vars->{$clock - $offset};
- my $pre = $vars->{$clock - $offset - 1};
- return {
- # Numeric variables get subtracted, non-numeric get passed straight through.
- map {
- $_ =>
- ( (defined $cur->{$_} && $cur->{$_} =~ m/$num_regex/)
- ? $cur->{$_} - ($pre->{$_} || 0)
- : $cur->{$_} )
- } keys %{$cur}
- };
-}
-
-# extract_values {{{3
-# Arguments are a set of values (which may be incremental, derived from
-# current and previous), current, and previous values.
-# TODO: there are a few places that don't remember prev set so can't pass it.
-sub extract_values {
- my ( $set, $cur, $pre, $tbl ) = @_;
-
- # Hook in event listeners
- foreach my $listener ( @{$event_listener_for{extract_values}} ) {
- $listener->extract_values($set, $cur, $pre, $tbl);
- }
-
- my $result = {};
- my $meta = $tbl_meta{$tbl};
- my $cols = $meta->{cols};
- foreach my $key ( keys %$cols ) {
- my $info = $cols->{$key}
- or die "Column '$key' doesn't exist in $tbl";
- die "No func defined for '$key' in $tbl"
- unless $info->{func};
- eval {
- $result->{$key} = $info->{func}->($set, $cur, $pre)
- };
- if ( $EVAL_ERROR ) {
- if ( $config{debug}->{val} ) {
- die $EVAL_ERROR;
- }
- $result->{$key} = $info->{num} ? 0 : '';
- }
- }
- return $result;
-}
-
-# get_full_processlist {{{3
-sub get_full_processlist {
- my @cxns = @_;
- my @result;
- foreach my $cxn ( @cxns ) {
- my $stmt = do_stmt($cxn, 'PROCESSLIST') or next;
- my $arr = $stmt->fetchall_arrayref({});
- push @result, map { $_->{cxn} = $cxn; $_ } @$arr;
- }
- return @result;
-}
-
-# get_open_tables {{{3
-sub get_open_tables {
- my @cxns = @_;
- my @result;
- foreach my $cxn ( @cxns ) {
- my $stmt = do_stmt($cxn, 'OPEN_TABLES') or next;
- my $arr = $stmt->fetchall_arrayref({});
- push @result, map { $_->{cxn} = $cxn; $_ } @$arr;
- }
- return @result;
-}
-
-# get_innodb_status {{{3
-sub get_innodb_status {
- my ( $cxns, $addl_sections ) = @_;
- if ( !$config{skip_innodb}->{val} && !$info_gotten{innodb_status}++ ) {
-
- # Determine which sections need to be parsed
- my %sections_required =
- map { $tbl_meta{$_}->{innodb} => 1 }
- grep { $_ && $tbl_meta{$_}->{innodb} }
- get_visible_tables();
-
- # Add in any other sections the caller requested.
- foreach my $sec ( @$addl_sections ) {
- $sections_required{$sec} = 1;
- }
-
- foreach my $cxn ( @$cxns ) {
- my $innodb_status_text;
-
- if ( $file ) { # Try to fetch status text from the file.
- my @stat = stat($file);
-
- # Initialize the file.
- if ( !$file_mtime ) {
- # Initialize to 130k from the end of the file (because the limit
- # on the size of innodb status is 128k even with Google's patches)
- # and try to grab the last status from the file.
- sysseek($file, (-128 * 1_024), 2);
- }
-
- # Read from the file.
- my $buffer;
- if ( !$file_mtime || $file_mtime != $stat[9] ) {
- $file_data = '';
- while ( sysread($file, $buffer, 4096) ) {
- $file_data .= $buffer;
- }
- $file_mtime = $stat[9];
- }
-
- # Delete everything but the last InnoDB status text from the file.
- $file_data =~ s/\A.*(?=^=====================================\n...... ........ INNODB MONITOR OUTPUT)//ms;
- $innodb_status_text = $file_data;
- }
-
- else {
- my $stmt = do_stmt($cxn, 'INNODB_STATUS') or next;
- $innodb_status_text = $stmt->fetchrow_hashref()->{status};
- }
-
- next unless $innodb_status_text
- && substr($innodb_status_text, 0, 100) =~ m/INNODB MONITOR OUTPUT/;
-
- # Parse and merge into %vars storage
- my %innodb_status = (
- $innodb_parser->get_status_hash(
- $innodb_status_text,
- $config{debug}->{val},
- \%sections_required,
- 0, # don't parse full lock information
- )
- );
- if ( !$innodb_status{IB_got_all} && $config{auto_wipe_dl}->{val} ) {
- clear_deadlock($cxn);
- }
-
- # Merge using a hash slice, which is the fastest way
- $vars{$cxn}->{$clock} ||= {};
- my $hash = $vars{$cxn}->{$clock};
- @{$hash}{ keys %innodb_status } = values %innodb_status;
- $hash->{cxn} = $cxn;
- $hash->{Uptime_hires} ||= get_uptime($cxn);
- }
- }
-}
-
-# clear_deadlock {{{3
-sub clear_deadlock {
- my ( $cxn ) = @_;
- return if $clearing_deadlocks++;
- my $tbl = $connections{$cxn}->{dl_table};
- return unless $tbl;
-
- eval {
- # Set up the table for creating a deadlock.
- my $engine = version_ge($dbhs{$cxn}->{dbh}, '4.1.2') ? 'engine' : 'type';
- return unless do_query($cxn, "drop table if exists $tbl");
- return unless do_query($cxn, "create table $tbl(a int) $engine=innodb");
- return unless do_query($cxn, "delete from $tbl");
- return unless do_query($cxn, "insert into $tbl(a) values(0), (1)");
- return unless do_query($cxn, "commit"); # Or the children will block against the parent
-
- # Fork off two children to deadlock against each other.
- my %children;
- foreach my $child ( 0..1 ) {
- my $pid = fork();
- if ( defined($pid) && $pid == 0 ) { # I am a child
- deadlock_thread( $child, $tbl, $cxn );
- }
- elsif ( !defined($pid) ) {
- die("Unable to fork for clearing deadlocks!\n");
- }
- # I already exited if I'm a child, so I'm the parent.
- $children{$child} = $pid;
- }
-
- # Wait for the children to exit.
- foreach my $child ( keys %children ) {
- my $pid = waitpid($children{$child}, 0);
- }
-
- # Clean up.
- do_query($cxn, "drop table $tbl");
- };
- if ( $EVAL_ERROR ) {
- print $EVAL_ERROR;
- pause();
- }
-
- $clearing_deadlocks = 0;
-}
-
-sub get_master_logs {
- my @cxns = @_;
- my @result;
- if ( !$info_gotten{master_logs}++ ) {
- foreach my $cxn ( @cxns ) {
- my $stmt = do_stmt($cxn, 'SHOW_MASTER_LOGS') or next;
- push @result, @{$stmt->fetchall_arrayref({})};
- }
- }
- return @result;
-}
-
-# get_master_slave_status {{{3
-sub get_master_slave_status {
- my @cxns = @_;
- if ( !$info_gotten{replication_status}++ ) {
- foreach my $cxn ( @cxns ) {
- $vars{$cxn}->{$clock} ||= {};
- my $vars = $vars{$cxn}->{$clock};
- $vars->{cxn} = $cxn;
-
- my $stmt = do_stmt($cxn, 'SHOW_MASTER_STATUS') or next;
- my $res = $stmt->fetchall_arrayref({})->[0];
- @{$vars}{ keys %$res } = values %$res;
- $stmt = do_stmt($cxn, 'SHOW_SLAVE_STATUS') or next;
- $res = $stmt->fetchall_arrayref({})->[0];
- @{$vars}{ keys %$res } = values %$res;
- $vars->{Uptime_hires} ||= get_uptime($cxn);
- }
- }
-}
-
-sub is_func {
- my ( $word ) = @_;
- return defined(&$word)
- || eval "my \$x= sub { $word }; 1"
- || $EVAL_ERROR !~ m/^Bareword/;
-}
-
-# Documentation {{{1
-# ############################################################################
-# I put this last as per the Dog book.
-# ############################################################################
-=pod
-
-=head1 NAME
-
-innotop - MySQL and InnoDB transaction/status monitor.
-
-=head1 SYNOPSIS
-
-To monitor servers normally:
-
- innotop
-
-To monitor InnoDB status information from a file:
-
- innotop /var/log/mysql/mysqld.err
-
-To run innotop non-interactively in a pipe-and-filter configuration:
-
- innotop --count 5 -d 1 -n
-
-=head1 DESCRIPTION
-
-innotop monitors MySQL servers. Each of its modes shows you a different aspect
-of what's happening in the server. For example, there's a mode for monitoring
-replication, one for queries, and one for transactions. innotop refreshes its
-data periodically, so you see an updating view.
-
-innotop has lots of features for power users, but you can start and run it with
-virtually no configuration. If you're just getting started, see
-L<"QUICK-START">. Press '?' at any time while running innotop for
-context-sensitive help.
-
-=head1 QUICK-START
-
-To start innotop, open a terminal or command prompt. If you have installed
-innotop on your system, you should be able to just type "innotop" and press
-Enter; otherwise, you will need to change to innotop's directory and type "perl
-innotop".
-
-The first thing innotop needs to know is how to connect to a MySQL server. You
-can just enter the hostname of the server, for example "localhost" or
-"127.0.0.1" if the server is on the same machine as innotop. After this innotop
-will prompt you for a DSN (data source name). You should be able to just accept
-the defaults by pressing Enter.
-
-When innotop asks you about a table to use when resetting InnoDB deadlock
-information, just accept the default for now. This is an advanced feature you
-can configure later (see L<"D: InnoDB Deadlocks"> for more).
-
-If you have a .my.cnf file with your MySQL connection defaults, innotop can read
-it, and you won't need to specify a username and password if it's in that file.
-Otherwise, you should answer 'y' to the next couple of prompts.
-
-After this, you should be connected, and innotop should show you something like
-the following:
-
- InnoDB Txns (? for help) localhost, 01:11:19, InnoDB 10s :-), 50 QPS,
-
- CXN History Versions Undo Dirty Buf Used Bufs Txns MaxTxn
- localhost 7 2035 0 0 0.00% 92.19% 1 07:34
-
- CXN ID User Host Txn Status Time Undo Query Tex
- localhost 98379 user1 webserver ACTIVE 07:34 0 SELECT `c
- localhost 98450 user1 webserver ACTIVE 01:06 0 INSERT IN
- localhost 97750 user1 webserver not starte 00:00 0
- localhost 98375 user1 appserver not starte 00:00 0
-
-(This sample is truncated at the right so it will fit on a terminal when running
-'man innotop')
-
-This sample comes from a quiet server with few transactions active. If your
-server is busy, you'll see more output. Notice the first line on the screen,
-which tells you what mode you're in and what server you're connected to. You
-can change to other modes with keystrokes; press 'Q' to switch to a list of
-currently running queries.
-
-Press the '?' key to see what keys are active in the current mode. You can
-press any of these keys and innotop will either take the requested action or
-prompt you for more input. If your system has Term::ReadLine support, you can
-use TAB and other keys to auto-complete and edit input.
-
-To quit innotop, press the 'q' key.
-
-=head1 OPTIONS
-
-innotop is mostly configured via its configuration file, but some of the
-configuration options can come from the command line. You can also specify a
-file to monitor for InnoDB status output; see L<"MONITORING A FILE"> for more
-details.
-
-You can negate some options by prefixing the option name with --no. For
-example, --noinc (or --no-inc) negates L<"--inc">.
-
-=over
-
-=item --help
-
-Print a summary of command-line usage and exit.
-
-=item --color
-
-Enable or disable terminal coloring. Corresponds to the L<"color"> config file
-setting.
-
-=item --config
-
-Specifies a configuration file to read. This option is non-sticky, that is to
-say it does not persist to the configuration file itself.
-
-=item --nonint
-
-Enable non-interactive operation. See L<"NON-INTERACTIVE OPERATION"> for more.
-
-=item --count
-
-Refresh only the specified number of times (ticks) before exiting. Each refresh
-is a pause for L<"interval"> seconds, followed by requesting data from MySQL
-connections and printing it to the terminal.
-
-=item --delay
-
-Specifies the amount of time to pause between ticks (refreshes). Corresponds to
-the configuration option L<"interval">.
-
-=item --mode
-
-Specifies the mode in which innotop should start. Corresponds to the
-configuration option L<"mode">.
-
-=item --inc
-
-Specifies whether innotop should display absolute numbers or relative numbers
-(offsets from their previous values). Corresponds to the configuration option
-L<"status_inc">.
-
-=item --version
-
-Output version information and exit.
-
-=back
-
-=head1 HOTKEYS
-
-innotop is interactive, and you control it with key-presses.
-
-=over
-
-=item *
-
-Uppercase keys switch between modes.
-
-=item *
-
-Lowercase keys initiate some action within the current mode.
-
-=item *
-
-Other keys do something special like change configuration or show the
-innotop license.
-
-=back
-
-Press '?' at any time to see the currently active keys and what they do.
-
-=head1 MODES
-
-Each of innotop's modes retrieves and displays a particular type of data from
-the servers you're monitoring. You switch between modes with uppercase keys.
-The following is a brief description of each mode, in alphabetical order. To
-switch to the mode, press the key listed in front of its heading in the
-following list:
-
-=over
-
-=item B: InnoDB Buffers
-
-This mode displays information about the InnoDB buffer pool, page statistics,
-insert buffer, and adaptive hash index. The data comes from SHOW INNODB STATUS.
-
-This mode contains the L<"buffer_pool">, L<"page_statistics">,
-L<"insert_buffers">, and L<"adaptive_hash_index"> tables by default.
-
-=item C: Command Summary
-
-This mode is similar to mytop's Command Summary mode. It shows the
-L<"cmd_summary"> table, which looks something like the following:
-
- Command Summary (? for help) localhost, 25+07:16:43, 2.45 QPS, 3 thd, 5.0.40
- _____________________ Command Summary _____________________
- Name Value Pct Last Incr Pct
- Select_scan 3244858 69.89% 2 100.00%
- Select_range 1354177 29.17% 0 0.00%
- Select_full_join 39479 0.85% 0 0.00%
- Select_full_range_join 4097 0.09% 0 0.00%
- Select_range_check 0 0.00% 0 0.00%
-
-The command summary table is built by extracting variables from
-L<"STATUS_VARIABLES">. The variables must be numeric and must match the prefix
-given by the L<"cmd_filter"> configuration variable. The variables are then
-sorted by value descending and compared to the last variable, as shown above.
-The percentage columns are percentage of the total of all variables in the
-table, so you can see the relative weight of the variables.
-
-The example shows what you see if the prefix is "Select_". The default
-prefix is "Com_". You can choose a prefix with the 's' key.
-
-It's rather like running SHOW VARIABLES LIKE "prefix%" with memory and
-nice formatting.
-
-Values are aggregated across all servers. The Pct columns are not correctly
-aggregated across multiple servers. This is a known limitation of the grouping
-algorithm that may be fixed in the future.
-
-=item D: InnoDB Deadlocks
-
-This mode shows the transactions involved in the last InnoDB deadlock. A second
-table shows the locks each transaction held and waited for. A deadlock is
-caused by a cycle in the waits-for graph, so there should be two locks held and
-one waited for unless the deadlock information is truncated.
-
-InnoDB puts deadlock information before some other information in the SHOW
-INNODB STATUS output. If there are a lot of locks, the deadlock information can
-grow very large, and there is a limit on the size of the SHOW INNODB
-STATUS output. A large deadlock can fill the entire output, or even be
-truncated, and prevent you from seeing other information at all. If you are
-running innotop in another mode, for example T mode, and suddenly you don't see
-anything, you might want to check and see if a deadlock has wiped out the data
-you need.
-
-If it has, you can create a small deadlock to replace the large one. Use the
-'w' key to 'wipe' the large deadlock with a small one. This will not work
-unless you have defined a deadlock table for the connection (see L<"SERVER
-CONNECTIONS">).
-
-You can also configure innotop to automatically detect when a large deadlock
-needs to be replaced with a small one (see L<"auto_wipe_dl">).
-
-This mode displays the L<"deadlock_transactions"> and L<"deadlock_locks"> tables
-by default.
-
-=item F: InnoDB Foreign Key Errors
-
-This mode shows the last InnoDB foreign key error information, such as the
-table where it happened, when and who and what query caused it, and so on.
-
-InnoDB has a huge variety of foreign key error messages, and many of them are
-just hard to parse. innotop doesn't always do the best job here, but there's
-so much code devoted to parsing this messy, unparseable output that innotop is
-likely never to be perfect in this regard. If innotop doesn't show you what
-you need to see, just look at the status text directly.
-
-This mode displays the L<"fk_error"> table by default.
-
-=item I: InnoDB I/O Info
-
-This mode shows InnoDB's I/O statistics, including the I/O threads, pending I/O,
-file I/O miscellaneous, and log statistics. It displays the L<"io_threads">,
-L<"pending_io">, L<"file_io_misc">, and L<"log_statistics"> tables by default.
-
-=item L: Locks
-
-This mode shows information about current locks. At the moment only InnoDB
-locks are supported, and by default you'll only see locks for which transactions
-are waiting. This information comes from the TRANSACTIONS section of the InnoDB
-status text. If you have a very busy server, you may have frequent lock waits;
-it helps to be able to see which tables and indexes are the "hot spot" for
-locks. If your server is running pretty well, this mode should show nothing.
-
-You can configure MySQL and innotop to monitor not only locks for which a
-transaction is waiting, but those currently held, too. You can do this with the
-InnoDB Lock Monitor (L<http://dev.mysql.com/doc/en/innodb-monitor.html>). It's
-not documented in the MySQL manual, but creating the lock monitor with the
-following statement also affects the output of SHOW INNODB STATUS, which innotop
-uses:
-
- CREATE TABLE innodb_lock_monitor(a int) ENGINE=INNODB;
-
-This causes InnoDB to print its output to the MySQL file every 16 seconds or so,
-as stated in the manual, but it also makes the normal SHOW INNODB STATUS output
-include lock information, which innotop can parse and display (that's the
-undocumented feature).
-
-This means you can do what may have seemed impossible: to a limited extent
-(InnoDB truncates some information in the output), you can see which transaction
-holds the locks something else is waiting for. You can also enable and disable
-the InnoDB Lock Monitor with the key mappings in this mode.
-
-This mode displays the L<"innodb_locks"> table by default. Here's a sample of
-the screen when one connection is waiting for locks another connection holds:
-
- _________________________________ InnoDB Locks __________________________
- CXN ID Type Waiting Wait Active Mode DB Table Index
- localhost 12 RECORD 1 00:10 00:10 X test t1 PRIMARY
- localhost 12 TABLE 0 00:10 00:10 IX test t1
- localhost 12 RECORD 1 00:10 00:10 X test t1 PRIMARY
- localhost 11 TABLE 0 00:00 00:25 IX test t1
- localhost 11 RECORD 0 00:00 00:25 X test t1 PRIMARY
-
-You can see the first connection, ID 12, is waiting for a lock on the PRIMARY
-key on test.t1, and has been waiting for 10 seconds. The second connection
-isn't waiting, because the Waiting column is 0, but it holds locks on the same
-index. That tells you connection 11 is blocking connection 12.
-
-=item M: Master/Slave Replication Status
-
-This mode shows the output of SHOW SLAVE STATUS and SHOW MASTER STATUS in three
-tables. The first two divide the slave's status into SQL and I/O thread status,
-and the last shows master status. Filters are applied to eliminate non-slave
-servers from the slave tables, and non-master servers from the master table.
-
-This mode displays the L<"slave_sql_status">, L<"slave_io_status">, and
-L<"master_status"> tables by default.
-
-=item O: Open Tables
-
-This section comes from MySQL's SHOW OPEN TABLES command. By default it is
-filtered to show tables which are in use by one or more queries, so you can
-get a quick look at which tables are 'hot'. You can use this to guess which
-tables might be locked implicitly.
-
-This mode displays the L<"open_tables"> mode by default.
-
-=item Q: Query List
-
-This mode displays the output from SHOW FULL PROCESSLIST, much like B<mytop>'s
-query list mode. This mode does B<not> show InnoDB-related information. This
-is probably one of the most useful modes for general usage.
-
-There is an informative header that shows general status information about
-your server. You can toggle it on and off with the 'h' key. By default,
-innotop hides inactive processes and its own process. You can toggle these on
-and off with the 'i' and 'a' keys.
-
-You can EXPLAIN a query from this mode with the 'e' key. This displays the
-query's full text, the results of EXPLAIN, and in newer MySQL versions, even
-the optimized query resulting from EXPLAIN EXTENDED. innotop also tries to
-rewrite certain queries to make them EXPLAIN-able. For example, INSERT/SELECT
-statements are rewritable.
-
-This mode displays the L<"q_header"> and L<"processlist"> tables by default.
-
-=item R: InnoDB Row Operations and Semaphores
-
-This mode shows InnoDB row operations, row operation miscellaneous, semaphores,
-and information from the wait array. It displays the L<"row_operations">,
-L<"row_operation_misc">, L<"semaphores">, and L<"wait_array"> tables by default.
-
-=item S: Variables & Status
-
-This mode calculates statistics, such as queries per second, and prints them out
-in several different styles. You can show absolute values, or incremental values
-between ticks.
-
-You can switch between the views by pressing a key. The 's' key prints a
-single line each time the screen updates, in the style of B<vmstat>. The 'g'
-key changes the view to a graph of the same numbers, sort of like B<tload>.
-The 'v' key changes the view to a pivoted table of variable names on the left,
-with successive updates scrolling across the screen from left to right. You can
-choose how many updates to put on the screen with the L<"num_status_sets">
-configuration variable.
-
-Headers may be abbreviated to fit on the screen in interactive operation. You
-choose which variables to display with the 'c' key, which selects from
-predefined sets, or lets you create your own sets. You can edit the current set
-with the 'e' key.
-
-This mode doesn't really display any tables like other modes. Instead, it uses
-a table definition to extract and format the data, but it then transforms the
-result in special ways before outputting it. It uses the L<"var_status"> table
-definition for this.
-
-=item T: InnoDB Transactions
-
-This mode shows transactions from the InnoDB monitor's output, in B<top>-like
-format. This mode is the reason I wrote innotop.
-
-You can kill queries or processes with the 'k' and 'x' keys, and EXPLAIN a query
-with the 'e' or 'f' keys. InnoDB doesn't print the full query in transactions,
-so explaining may not work right if the query is truncated.
-
-The informational header can be toggled on and off with the 'h' key. By
-default, innotop hides inactive transactions and its own transaction. You can
-toggle this on and off with the 'i' and 'a' keys.
-
-This mode displays the L<"t_header"> and L<"innodb_transactions"> tables by
-default.
-
-=back
-
-=head1 INNOTOP STATUS
-
-The first line innotop displays is a "status bar" of sorts. What it contains
-depends on the mode you're in, and what servers you're monitoring. The first
-few words are always the innotop mode, such as "InnoDB Txns" for T mode,
-followed by a reminder to press '?' for help at any time.
-
-=head2 ONE SERVER
-
-The simplest case is when you're monitoring a single server. In this case, the
-name of the connection is next on the status line. This is the name you gave
-when you created the connection -- most likely the MySQL server's hostname.
-This is followed by the server's uptime.
-
-If you're in an InnoDB mode, such as T or B, the next word is "InnoDB" followed
-by some information about the SHOW INNODB STATUS output used to render the
-screen. The first word is the number of seconds since the last SHOW INNODB
-STATUS, which InnoDB uses to calculate some per-second statistics. The next is
-a smiley face indicating whether the InnoDB output is truncated. If the smiley
-face is a :-), all is well; there is no truncation. A :^| means the transaction
-list is so long, InnoDB has only printed out some of the transactions. Finally,
-a frown :-( means the output is incomplete, which is probably due to a deadlock
-printing too much lock information (see L<"D: InnoDB Deadlocks">).
-
-The next two words indicate the server's queries per second (QPS) and how many
-threads (connections) exist. Finally, the server's version number is the last
-thing on the line.
-
-=head2 MULTIPLE SERVERS
-
-If you are monitoring multiple servers (see L<"SERVER CONNECTIONS">), the status
-line does not show any details about individual servers. Instead, it shows the
-names of the connections that are active. Again, these are connection names you
-specified, which are likely to be the server's hostname. A connection that has
-an error is prefixed with an exclamation point.
-
-If you are monitoring a group of servers (see L<"SERVER GROUPS">), the status
-line shows the name of the group. If any connection in the group has an
-error, the group's name is followed by the fraction of the connections that
-don't have errors.
-
-See L<"ERROR HANDLING"> for more details about innotop's error handling.
-
-=head2 MONITORING A FILE
-
-If you give a filename on the command line, innotop will not connect to ANY
-servers at all. It will watch the specified file for InnoDB status output and
-use that as its data source. It will always show a single connection called
-'file'. And since it can't connect to a server, it can't determine how long the
-server it's monitoring has been up; so it calculates the server's uptime as time
-since innotop started running.
-
-=head1 SERVER ADMINISTRATION
-
-While innotop is primarily a monitor that lets you watch and analyze your
-servers, it can also send commands to servers. The most frequently useful
-commands are killing queries and stopping or starting slaves.
-
-You can kill a connection, or in newer versions of MySQL kill a query but not a
-connection, from L<"Q: Query List"> and L<"T: InnoDB Transactions"> modes.
-Press 'k' to issue a KILL command, or 'x' to issue a KILL QUERY command.
-innotop will prompt you for the server and/or connection ID to kill (innotop
-does not prompt you if there is only one possible choice for any input).
-innotop pre-selects the longest-running query, or the oldest connection.
-Confirm the command with 'y'.
-
-In L<"M: Master/Slave Replication Status"> mode, you can start and stop slaves
-with the 'a' and 'o' keys, respectively. You can send these commands to many
-slaves at once. innotop fills in a default command of START SLAVE or STOP SLAVE
-for you, but you can actually edit the command and send anything you wish, such
-as SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1 to make the slave skip one binlog event
-when it starts.
-
-You can also ask innotop to calculate the earliest binlog in use by any slave
-and issue a PURGE MASTER LOGS on the master. Use the 'b' key for this. innotop
-will prompt you for a master to run the command on, then prompt you for the
-connection names of that master's slaves (there is no way for innotop to
-determine this reliably itself). innotop will find the minimum binlog in use by
-these slave connections and suggest it as the argument to PURGE MASTER LOGS.
-
-=head1 SERVER CONNECTIONS
-
-When you create a server connection, innotop asks you for a series of inputs, as
-follows:
-
-=over
-
-=item DSN
-
-A DSN is a Data Source Name, which is the initial argument passed to the DBI
-module for connecting to a server. It is usually of the form
-
- DBI:mysql:;mysql_read_default_group=mysql;host=HOSTNAME
-
-Since this DSN is passed to the DBD::mysql driver, you should read the driver's
-documentation at L<"http://search.cpan.org/dist/DBD-mysql/lib/DBD/mysql.pm"> for
-the exact details on all the options you can pass the driver in the DSN. You
-can read more about DBI at L<http://dbi.perl.org/docs/>, and especially at
-L<http://search.cpan.org/~timb/DBI/DBI.pm>.
-
-The mysql_read_default_group=mysql option lets the DBD driver read your MySQL
-options files, such as ~/.my.cnf on UNIX-ish systems. You can use this to avoid
-specifying a username or password for the connection.
-
-=item InnoDB Deadlock Table
-
-This optional item tells innotop a table name it can use to deliberately create
-a small deadlock (see L<"D: InnoDB Deadlocks">). If you specify this option,
-you just need to be sure the table doesn't exist, and that innotop can create
-and drop the table with the InnoDB storage engine. You can safely omit or just
-accept the default if you don't intend to use this.
-
-=item Username
-
-innotop will ask you if you want to specify a username. If you say 'y', it will
-then prompt you for a user name. If you have a MySQL option file that specifies
-your username, you don't have to specify a username.
-
-The username defaults to your login name on the system you're running innotop on.
-
-=item Password
-
-innotop will ask you if you want to specify a password. Like the username, the
-password is optional, but there's an additional prompt that asks if you want to
-save the password in the innotop configuration file. If you don't save it in
-the configuration file, innotop will prompt you for a password each time it
-starts. Passwords in the innotop configuration file are saved in plain text,
-not encrypted in any way.
-
-=back
-
-Once you finish answering these questions, you should be connected to a server.
-But innotop isn't limited to monitoring a single server; you can define many
-server connections and switch between them by pressing the '@' key. See
-L<"SWITCHING BETWEEN CONNECTIONS">.
-
-To create a new connection, press the '@' key and type the name of the new
-connection, then follow the steps given above.
-
-=head1 SERVER GROUPS
-
-If you have multiple MySQL instances, you can put them into named groups, such
-as 'all', 'masters', and 'slaves', which innotop can monitor all together.
-
-You can choose which group to monitor with the '#' key, and you can press the
-TAB key to switch to the next group. If you're not currently monitoring a
-group, pressing TAB selects the first group.
-
-To create a group, press the '#' key and type the name of your new group, then
-type the names of the connections you want the group to contain.
-
-=head1 SWITCHING BETWEEN CONNECTIONS
-
-innotop lets you quickly switch which servers you're monitoring. The most basic
-way is by pressing the '@' key and typing the name(s) of the connection(s) you
-want to use. This setting is per-mode, so you can monitor different connections
-in each mode, and innotop remembers which connections you choose.
-
-You can quickly switch to the 'next' connection in alphabetical order with the
-'n' key. If you're monitoring a server group (see L<"SERVER GROUPS">) this will
-switch to the first connection.
-
-You can also type many connection names, and innotop will fetch and display data
-from them all. Just separate the connection names with spaces, for example
-"server1 server2." Again, if you type the name of a connection that doesn't
-exist, innotop will prompt you for connection information and create the
-connection.
-
-Another way to monitor multiple connections at once is with server groups. You
-can use the TAB key to switch to the 'next' group in alphabetical order, or if
-you're not monitoring any groups, TAB will switch to the first group.
-
-innotop does not fetch data in parallel from connections, so if you are
-monitoring a large group or many connections, you may notice increased delay
-between ticks.
-
-When you monitor more than one connection, innotop's status bar changes. See
-L<"INNOTOP STATUS">.
-
-=head1 ERROR HANDLING
-
-Error handling is not that important when monitoring a single connection, but is
-crucial when you have many active connections. A crashed server or lost
-connection should not crash innotop. As a result, innotop will continue to run
-even when there is an error; it just won't display any information from the
-connection that had an error. Because of this, innotop's behavior might confuse
-you. It's a feature, not a bug!
-
-innotop does not continue to query connections that have errors, because they
-may slow innotop and make it hard to use, especially if the error is a problem
-connecting and causes a long time-out. Instead, innotop retries the connection
-occasionally to see if the error still exists. If so, it will wait until some
-point in the future. The wait time increases in ticks as the Fibonacci series,
-so it tries less frequently as time passes.
-
-Since errors might only happen in certain modes because of the SQL commands
-issued in those modes, innotop keeps track of which mode caused the error. If
-you switch to a different mode, innotop will retry the connection instead of
-waiting.
-
-By default innotop will display the problem in red text at the bottom of the
-first table on the screen. You can disable this behavior with the
-L<"show_cxn_errors_in_tbl"> configuration option, which is enabled by default.
-If the L<"debug"> option is enabled, innotop will display the error at the
-bottom of every table, not just the first. And if L<"show_cxn_errors"> is
-enabled, innotop will print the error text to STDOUT as well. Error messages
-might only display in the mode that caused the error, depending on the mode and
-whether innotop is avoiding querying that connection.
-
-=head1 NON-INTERACTIVE OPERATION
-
-You can run innotop in non-interactive mode, in which case it is entirely
-controlled from the configuration file and command-line options. To start
-innotop in non-interactive mode, give the L"<--nonint"> command-line option.
-This changes innotop's behavior in the following ways:
-
-=over
-
-=item *
-
-Certain Perl modules are not loaded. Term::Readline is not loaded, since
-innotop doesn't prompt interactively. Term::ANSIColor and Win32::Console::ANSI
-modules are not loaded. Term::ReadKey is still used, since innotop may have to
-prompt for connection passwords when starting up.
-
-=item *
-
-innotop does not clear the screen after each tick.
-
-=item *
-
-innotop does not persist any changes to the configuration file.
-
-=item *
-
-If L<"--count"> is given and innotop is in incremental mode (see L<"status_inc">
-and L<"--inc">), innotop actually refreshes one more time than specified so it
-can print incremental statistics. This suppresses output during the first
-tick, so innotop may appear to hang.
-
-=item *
-
-innotop only displays the first table in each mode. This is so the output can
-be easily processed with other command-line utilities such as awk and sed. To
-change which tables display in each mode, see L<"TABLES">. Since L<"Q: Query
-List"> mode is so important, innotop automatically disables the L<"q_header">
-table. This ensures you'll see the L<"processlist"> table, even if you have
-innotop configured to show the q_header table during interactive operation.
-Similarly, in L<"T: InnoDB Transactions"> mode, the L<"t_header"> table is
-suppressed so you see only the L<"innodb_transactions"> table.
-
-=item *
-
-All output is tab-separated instead of being column-aligned with whitespace, and
-innotop prints the full contents of each table instead of only printing one
-screenful at a time.
-
-=item *
-
-innotop only prints column headers once instead of every tick (see
-L<"hide_hdr">). innotop does not print table captions (see
-L<"display_table_captions">). innotop ensures there are no empty lines in the
-output.
-
-=item *
-
-innotop does not honor the L<"shorten"> transformation, which normally shortens
-some numbers to human-readable formats.
-
-=item *
-
-innotop does not print a status line (see L<"INNOTOP STATUS">).
-
-=back
-
-=head1 CONFIGURING
-
-Nearly everything about innotop is configurable. Most things are possible to
-change with built-in commands, but you can also edit the configuration file.
-
-While running innotop, press the '$' key to bring up the configuration editing
-dialog. Press another key to select the type of data you want to edit:
-
-=over
-
-=item S: Statement Sleep Times
-
-Edits SQL statement sleep delays, which make innotop pause for the specified
-amount of time after executing a statement. See L<"SQL STATEMENTS"> for a
-definition of each statement and what it does. By default innotop does not
-delay after any statements.
-
-This feature is included so you can customize the side-effects caused by
-monitoring your server. You may not see any effects, but some innotop users
-have noticed that certain MySQL versions under very high load with InnoDB
-enabled take longer than usual to execute SHOW GLOBAL STATUS. If innotop calls
-SHOW FULL PROCESSLIST immediately afterward, the processlist contains more
-queries than the machine actually averages at any given moment. Configuring
-innotop to pause briefly after calling SHOW GLOBAL STATUS alleviates this
-effect.
-
-Sleep times are stored in the L<"stmt_sleep_times"> section of the configuration
-file. Fractional-second sleeps are supported, subject to your hardware's
-limitations.
-
-=item c: Edit Columns
-
-Starts the table editor on one of the displayed tables. See L<"TABLE EDITOR">.
-An alternative way to start the table editor without entering the configuration
-dialog is with the '^' key.
-
-=item g: General Configuration
-
-Starts the configuration editor to edit global and mode-specific configuration
-variables (see L<"MODES">). innotop prompts you to choose a variable from among
-the global and mode-specific ones depending on the current mode.
-
-=item k: Row-Coloring Rules
-
-Starts the row-coloring rules editor on one of the displayed table(s). See
-L<"COLORS"> for details.
-
-=item p: Manage Plugins
-
-Starts the plugin configuration editor. See L<"PLUGINS"> for details.
-
-=item s: Server Groups
-
-Lets you create and edit server groups. See L<"SERVER GROUPS">.
-
-=item t: Choose Displayed Tables
-
-Lets you choose which tables to display in this mode. See L<"MODES"> and
-L<"TABLES">.
-
-=back
-
-=head1 CONFIGURATION FILE
-
-innotop's default configuration file location is in $HOME/.innotop, but can be
-overridden with the L<"--config"> command-line option. You can edit it by hand
-safely. innotop reads the configuration file when it starts, and writes it out
-again when it exits, so any changes you make while innotop is running will be
-lost.
-
-innotop doesn't store its entire configuration in the configuration file. It
-has a huge set of default configuration that it holds only in memory, and the
-configuration file only overrides these defaults. When you customize a default
-setting, innotop notices, and then stores the customizations into the file.
-This keeps the file size down, makes it easier to edit, and makes upgrades
-easier.
-
-A configuration file can be made read-only. See L<"readonly">.
-
-The configuration file is arranged into sections like an INI file. Each
-section begins with [section-name] and ends with [/section-name]. Each
-section's entries have a different syntax depending on the data they need to
-store. You can put comments in the file; any line that begins with a #
-character is a comment. innotop will not read the comments, so it won't write
-them back out to the file when it exits. Comments in read-only configuration
-files are still useful, though.
-
-The first line in the file is innotop's version number. This lets innotop
-notice when the file format is not backwards-compatible, and upgrade smoothly
-without destroying your customized configuration.
-
-The following list describes each section of the configuration file and the data
-it contains:
-
-=over
-
-=item general
-
-The 'general' section contains global configuration variables and variables that
-may be mode-specific, but don't belong in any other section. The syntax is a
-simple key=value list. innotop writes a comment above each value to help you
-edit the file by hand.
-
-=over
-
-=item S_func
-
-Controls S mode presentation (see L<"S: Variables & Status">). If g, values are
-graphed; if s, values are like vmstat; if p, values are in a pivoted table.
-
-=item S_set
-
-Specifies which set of variables to display in L<"S: Variables & Status"> mode.
-See L<"VARIABLE SETS">.
-
-=item auto_wipe_dl
-
-Instructs innotop to automatically wipe large deadlocks when it notices them.
-When this happens you may notice a slight delay. At the next tick, you will
-usually see the information that was being truncated by the large deadlock.
-
-=item charset
-
-Specifies what kind of characters to allow through the L<"no_ctrl_char">
-transformation. This keeps non-printable characters from confusing a
-terminal when you monitor queries that contain binary data, such as images.
-
-The default is 'ascii', which considers anything outside normal ASCII to be a
-control character. The other allowable values are 'unicode' and 'none'. 'none'
-considers every character a control character, which can be useful for
-collapsing ALL text fields in queries.
-
-=item cmd_filter
-
-This is the prefix that filters variables in L<"C: Command Summary"> mode.
-
-=item color
-
-Whether terminal coloring is permitted.
-
-=item cxn_timeout
-
-On MySQL versions 4.0.3 and newer, this variable is used to set the connection's
-timeout, so MySQL doesn't close the connection if it is not used for a while.
-This might happen because a connection isn't monitored in a particular mode, for
-example.
-
-=item debug
-
-This option enables more verbose errors and makes innotop more strict in some
-places. It can help in debugging filters and other user-defined code. It also
-makes innotop write a lot of information to L<"debugfile"> when there is a
-crash.
-
-=item debugfile
-
-A file to which innotop will write information when there is a crash. See
-L<"FILES">.
-
-=item display_table_captions
-
-innotop displays a table caption above most tables. This variable suppresses or
-shows captions on all tables globally. Some tables are configured with the
-hide_caption property, which overrides this.
-
-=item global
-
-Whether to show GLOBAL variables and status. innotop only tries to do this on
-servers which support the GLOBAL option to SHOW VARIABLES and SHOW STATUS. In
-some MySQL versions, you need certain privileges to do this; if you don't have
-them, innotop will not be able to fetch any variable and status data. This
-configuration variable lets you run innotop and fetch what data you can even
-without the elevated privileges.
-
-I can no longer find or reproduce the situation where GLOBAL wasn't allowed, but
-I know there was one.
-
-=item graph_char
-
-Defines the character to use when drawing graphs in L<"S: Variables & Status">
-mode.
-
-=item header_highlight
-
-Defines how to highlight column headers. This only works if Term::ANSIColor is
-available. Valid values are 'bold' and 'underline'.
-
-=item hide_hdr
-
-Hides column headers globally.
-
-=item interval
-
-The interval at which innotop will refresh its data (ticks). The interval is
-implemented as a sleep time between ticks, so the true interval will vary
-depending on how long it takes innotop to fetch and render data.
-
-This variable accepts fractions of a second.
-
-=item mode
-
-The mode in which innotop should start. Allowable arguments are the same as the
-key presses that select a mode interactively. See L<"MODES">.
-
-=item num_digits
-
-How many digits to show in fractional numbers and percents. This variable's
-range is between 0 and 9 and can be set directly from L<"S: Variables & Status">
-mode with the '+' and '-' keys. It is used in the L<"set_precision">,
-L<"shorten">, and L<"percent"> transformations.
-
-=item num_status_sets
-
-Controls how many sets of status variables to display in pivoted L<"S: Variables
-& Status"> mode. It also controls the number of old sets of variables innotop
-keeps in its memory, so the larger this variable is, the more memory innotop
-uses.
-
-=item plugin_dir
-
-Specifies where plugins can be found. By default, innotop stores plugins in the
-'plugins' subdirectory of your innotop configuration directory.
-
-=item readonly
-
-Whether the configuration file is readonly. This cannot be set interactively,
-because it would prevent itself from being written to the configuration file.
-
-=item show_cxn_errors
-
-Makes innotop print connection errors to STDOUT. See L<"ERROR HANDLING">.
-
-=item show_cxn_errors_in_tbl
-
-Makes innotop display connection errors as rows in the first table on screen.
-See L<"ERROR HANDLING">.
-
-=item show_percent
-
-Adds a '%' character after the value returned by the L<"percent">
-transformation.
-
-=item show_statusbar
-
-Controls whether to show the status bar in the display. See L<"INNOTOP
-STATUS">.
-
-=item skip_innodb
-
-Disables fetching SHOW INNODB STATUS, in case your server(s) do not have InnoDB
-enabled and you don't want innotop to try to fetch it. This can also be useful
-when you don't have the SUPER privilege, required to run SHOW INNODB STATUS.
-
-=item status_inc
-
-Whether to show absolute or incremental values for status variables.
-Incremental values are calculated as an offset from the last value innotop saw
-for that variable. This is a global setting, but will probably become
-mode-specific at some point. Right now it is honored a bit inconsistently; some
-modes don't pay attention to it.
-
-=back
-
-=item plugins
-
-This section holds a list of package names of active plugins. If the plugin
-exists, innotop will activate it. See L<"PLUGINS"> for more information.
-
-=item filters
-
-This section holds user-defined filters (see L<"FILTERS">). Each line is in the
-format filter_name=text='filter text' tbls='table list'.
-
-The filter text is the text of the subroutine's code. The table list is a list
-of tables to which the filter can apply. By default, user-defined filters apply
-to the table for which they were created, but you can manually override that by
-editing the definition in the configuration file.
-
-=item active_filters
-
-This section stores which filters are active on each table. Each line is in the
-format table_name=filter_list.
-
-=item tbl_meta
-
-This section stores user-defined or user-customized columns (see L<"COLUMNS">).
-Each line is in the format col_name=properties, where the properties are a
-name=quoted-value list.
-
-=item connections
-
-This section holds the server connections you have defined. Each line is in the
-format name=properties, where the properties are a name=value list. The
-properties are self-explanatory, and the only one that is treated specially is
-'pass' which is only present if 'savepass' is set. See L<"SERVER CONNECTIONS">.
-
-=item active_connections
-
-This section holds a list of which connections are active in each mode. Each
-line is in the format mode_name=connection_list.
-
-=item server_groups
-
-This section holds server groups. Each line is in the format
-name=connection_list. See L<"SERVER GROUPS">.
-
-=item active_server_groups
-
-This section holds a list of which server group is active in each mode. Each
-line is in the format mode_name=server_group.
-
-=item max_values_seen
-
-This section holds the maximum values seen for variables. This is used to scale
-the graphs in L<"S: Variables & Status"> mode. Each line is in the format
-name=value.
-
-=item active_columns
-
-This section holds table column lists. Each line is in the format
-tbl_name=column_list. See L<"COLUMNS">.
-
-=item sort_cols
-
-This section holds the sort definition. Each line is in the format
-tbl_name=column_list. If a column is prefixed with '-', that column sorts
-descending. See L<"SORTING">.
-
-=item visible_tables
-
-This section defines which tables are visible in each mode. Each line is in the
-format mode_name=table_list. See L<"TABLES">.
-
-=item varsets
-
-This section defines variable sets for use in L<"S: Status & Variables"> mode.
-Each line is in the format name=variable_list. See L<"VARIABLE SETS">.
-
-=item colors
-
-This section defines colorization rules. Each line is in the format
-tbl_name=property_list. See L<"COLORS">.
-
-=item stmt_sleep_times
-
-This section contains statement sleep times. Each line is in the format
-statement_name=sleep_time. See L<"S: Statement Sleep Times">.
-
-=item group_by
-
-This section contains column lists for table group_by expressions. Each line is
-in the format tbl_name=column_list. See L<"GROUPING">.
-
-=back
-
-=head1 CUSTOMIZING
-
-You can customize innotop a great deal. For example, you can:
-
-=over
-
-=item *
-
-Choose which tables to display, and in what order.
-
-=item *
-
-Choose which columns are in those tables, and create new columns.
-
-=item *
-
-Filter which rows display with built-in filters, user-defined filters, and
-quick-filters.
-
-=item *
-
-Sort the rows to put important data first or group together related rows.
-
-=item *
-
-Highlight rows with color.
-
-=item *
-
-Customize the alignment, width, and formatting of columns, and apply
-transformations to columns to extract parts of their values or format the values
-as you wish (for example, shortening large numbers to familiar units).
-
-=item *
-
-Design your own expressions to extract and combine data as you need. This gives
-you unlimited flexibility.
-
-=back
-
-All these and more are explained in the following sections.
-
-=head2 TABLES
-
-A table is what you'd expect: a collection of columns. It also has some other
-properties, such as a caption. Filters, sorting rules, and colorization rules
-belong to tables and are covered in later sections.
-
-Internally, table meta-data is defined in a data structure called %tbl_meta.
-This hash holds all built-in table definitions, which contain a lot of default
-instructions to innotop. The meta-data includes the caption, a list of columns
-the user has customized, a list of columns, a list of visible columns, a list of
-filters, color rules, a sort-column list, sort direction, and some information
-about the table's data sources. Most of this is customizable via the table
-editor (see L<"TABLE EDITOR">).
-
-You can choose which tables to show by pressing the '$' key. See L<"MODES"> and
-L<"TABLES">.
-
-The table life-cycle is as follows:
-
-=over
-
-=item *
-
-Each table begins with a data source, which is an array of hashes. See below
-for details on data sources.
-
-=item *
-
-Each element of the data source becomes a row in the final table.
-
-=item *
-
-For each element in the data source, innotop extracts values from the source and
-creates a row. This row is another hash, which later steps will refer to as
-$set. The values innotop extracts are determined by the table's columns. Each
-column has an extraction subroutine, compiled from an expression (see
-L<"EXPRESSIONS">). The resulting row is a hash whose keys are named the same as
-the column name.
-
-=item *
-
-innotop filters the rows, removing those that don't need to be displayed. See
-L<"FILTERS">.
-
-=item *
-
-innotop sorts the rows. See L<"SORTING">.
-
-=item *
-
-innotop groups the rows together, if specified. See L<"GROUPING">.
-
-=item *
-
-innotop colorizes the rows. See L<"COLORS">.
-
-=item *
-
-innotop transforms the column values in each row. See L<"TRANSFORMATIONS">.
-
-=item *
-
-innotop optionally pivots the rows (see L<"PIVOTING">), then filters and sorts
-them.
-
-=item *
-
-innotop formats and justifies the rows as a table. During this step, innotop
-applies further formatting to the column values, including alignment, maximum
-and minimum widths. innotop also does final error checking to ensure there are
-no crashes due to undefined values. innotop then adds a caption if specified,
-and the table is ready to print.
-
-=back
-
-The lifecycle is slightly different if the table is pivoted, as noted above. To
-clarify, if the table is pivoted, the process is extract, group, transform,
-pivot, filter, sort, create. If it's not pivoted, the process is extract,
-filter, sort, group, color, transform, create. This slightly convoluted process
-doesn't map all that well to SQL, but pivoting complicates things pretty
-thoroughly. Roughly speaking, filtering and sorting happen as late as needed to
-effect the final result as you might expect, but as early as possible for
-efficiency.
-
-Each built-in table is described below:
-
-=over
-
-=item adaptive_hash_index
-
-Displays data about InnoDB's adaptive hash index. Data source:
-L<"STATUS_VARIABLES">.
-
-=item buffer_pool
-
-Displays data about InnoDB's buffer pool. Data source: L<"STATUS_VARIABLES">.
-
-=item cmd_summary
-
-Displays weighted status variables. Data source: L<"STATUS_VARIABLES">.
-
-=item deadlock_locks
-
-Shows which locks were held and waited for by the last detected deadlock. Data
-source: L<"DEADLOCK_LOCKS">.
-
-=item deadlock_transactions
-
-Shows transactions involved in the last detected deadlock. Data source:
-L<"DEADLOCK_TRANSACTIONS">.
-
-=item explain
-
-Shows the output of EXPLAIN. Data source: L<"EXPLAIN">.
-
-=item file_io_misc
-
-Displays data about InnoDB's file and I/O operations. Data source:
-L<"STATUS_VARIABLES">.
-
-=item fk_error
-
-Displays various data about InnoDB's last foreign key error. Data source:
-L<"STATUS_VARIABLES">.
-
-=item innodb_locks
-
-Displays InnoDB locks. Data source: L<"INNODB_LOCKS">.
-
-=item innodb_transactions
-
-Displays data about InnoDB's current transactions. Data source:
-L<"INNODB_TRANSACTIONS">.
-
-=item insert_buffers
-
-Displays data about InnoDB's insert buffer. Data source: L<"STATUS_VARIABLES">.
-
-=item io_threads
-
-Displays data about InnoDB's I/O threads. Data source: L<"IO_THREADS">.
-
-=item log_statistics
-
-Displays data about InnoDB's logging system. Data source: L<"STATUS_VARIABLES">.
-
-=item master_status
-
-Displays replication master status. Data source: L<"STATUS_VARIABLES">.
-
-=item open_tables
-
-Displays open tables. Data source: L<"OPEN_TABLES">.
-
-=item page_statistics
-
-Displays InnoDB page statistics. Data source: L<"STATUS_VARIABLES">.
-
-=item pending_io
-
-Displays InnoDB pending I/O operations. Data source: L<"STATUS_VARIABLES">.
-
-=item processlist
-
-Displays current MySQL processes (threads/connections). Data source:
-L<"PROCESSLIST">.
-
-=item q_header
-
-Displays various status values. Data source: L<"STATUS_VARIABLES">.
-
-=item row_operation_misc
-
-Displays data about InnoDB's row operations. Data source:
-L<"STATUS_VARIABLES">.
-
-=item row_operations
-
-Displays data about InnoDB's row operations. Data source:
-L<"STATUS_VARIABLES">.
-
-=item semaphores
-
-Displays data about InnoDB's semaphores and mutexes. Data source:
-L<"STATUS_VARIABLES">.
-
-=item slave_io_status
-
-Displays data about the slave I/O thread. Data source:
-L<"STATUS_VARIABLES">.
-
-=item slave_sql_status
-
-Displays data about the slave SQL thread. Data source: L<"STATUS_VARIABLES">.
-
-=item t_header
-
-Displays various InnoDB status values. Data source: L<"STATUS_VARIABLES">.
-
-=item var_status
-
-Displays user-configurable data. Data source: L<"STATUS_VARIABLES">.
-
-=item wait_array
-
-Displays data about InnoDB's OS wait array. Data source: L<"OS_WAIT_ARRAY">.
-
-=back
-
-=head2 COLUMNS
-
-Columns belong to tables. You can choose a table's columns by pressing the '^'
-key, which starts the L<"TABLE EDITOR"> and lets you choose and edit columns.
-Pressing 'e' from within the table editor lets you edit the column's properties:
-
-=over
-
-=item *
-
-hdr: a column header. This appears in the first row of the table.
-
-=item *
-
-just: justification. '-' means left-justified and '' means right-justified,
-just as with printf formatting codes (not a coincidence).
-
-=item *
-
-dec: whether to further align the column on the decimal point.
-
-=item *
-
-num: whether the column is numeric. This affects how values are sorted
-(lexically or numerically).
-
-=item *
-
-label: a small note about the column, which appears in dialogs that help the
-user choose columns.
-
-=item *
-
-src: an expression that innotop uses to extract the column's data from its
-source (see L<"DATA SOURCES">). See L<"EXPRESSIONS"> for more on expressions.
-
-=item *
-
-minw: specifies a minimum display width. This helps stabilize the display,
-which makes it easier to read if the data is changing frequently.
-
-=item *
-
-maxw: similar to minw.
-
-=item *
-
-trans: a list of column transformations. See L<"TRANSFORMATIONS">.
-
-=item *
-
-agg: an aggregate function. See L<"GROUPING">. The default is L<"first">.
-
-=item *
-
-aggonly: controls whether the column only shows when grouping is enabled on the
-table (see L<"GROUPING">). By default, this is disabled. This means columns
-will always be shown by default, whether grouping is enabled or not. If a
-column's aggonly is set true, the column will appear when you toggle grouping on
-the table. Several columns are set this way, such as the count column on
-L<"processlist"> and L<"innodb_transactions">, so you don't see a count when the
-grouping isn't enabled, but you do when it is.
-
-=back
-
-=head2 FILTERS
-
-Filters remove rows from the display. They behave much like a WHERE clause in
-SQL. innotop has several built-in filters, which remove irrelevant information
-like inactive queries, but you can define your own as well. innotop also lets
-you create quick-filters, which do not get saved to the configuration file, and
-are just an easy way to quickly view only some rows.
-
-You can enable or disable a filter on any table. Press the '%' key (mnemonic: %
-looks kind of like a line being filtered between two circles) and choose which
-table you want to filter, if asked. You'll then see a list of possible filters
-and a list of filters currently enabled for that table. Type the names of
-filters you want to apply and press Enter.
-
-=head3 USER-DEFINED FILTERS
-
-If you type a name that doesn't exist, innotop will prompt you to create the
-filter. Filters are easy to create if you know Perl, and not hard if you don't.
-What you're doing is creating a subroutine that returns true if the row should
-be displayed. The row is a hash reference passed to your subroutine as $set.
-
-For example, imagine you want to filter the processlist table so you only see
-queries that have been running more than five minutes. Type a new name for your
-filter, and when prompted for the subroutine body, press TAB to initiate your
-terminal's auto-completion. You'll see the names of the columns in the
-L<"processlist"> table (innotop generally tries to help you with auto-completion
-lists). You want to filter on the 'time' column. Type the text "$set->{time} >
-300" to return true when the query is more than five minutes old. That's all
-you need to do.
-
-In other words, the code you're typing is surrounded by an implicit context,
-which looks like this:
-
- sub filter {
- my ( $set ) = @_;
- # YOUR CODE HERE
- }
-
-If your filter doesn't work, or if something else suddenly behaves differently,
-you might have made an error in your filter, and innotop is silently catching
-the error. Try enabling L<"debug"> to make innotop throw an error instead.
-
-=head3 QUICK-FILTERS
-
-innotop's quick-filters are a shortcut to create a temporary filter that doesn't
-persist when you restart innotop. To create a quick-filter, press the '/' key.
-innotop will prompt you for the column name and filter text. Again, you can use
-auto-completion on column names. The filter text can be just the text you want
-to "search for." For example, to filter the L<"processlist"> table on queries
-that refer to the products table, type '/' and then 'info product'.
-
-The filter text can actually be any Perl regular expression, but of course a
-literal string like 'product' works fine as a regular expression.
-
-Behind the scenes innotop compiles the quick-filter into a specially tagged
-filter that is otherwise like any other filter. It just isn't saved to the
-configuration file.
-
-To clear quick-filters, press the '\' key and innotop will clear them all at
-once.
-
-=head2 SORTING
-
-innotop has sensible built-in defaults to sort the most important rows to the
-top of the table. Like anything else in innotop, you can customize how any
-table is sorted.
-
-To start the sort dialog, start the L<"TABLE EDITOR"> with the '^' key, choose a
-table if necessary, and press the 's' key. You'll see a list of columns you can
-use in the sort expression and the current sort expression, if any. Enter a
-list of columns by which you want to sort and press Enter. If you want to
-reverse sort, prefix the column name with a minus sign. For example, if you
-want to sort by column a ascending, then column b descending, type 'a -b'. You
-can also explicitly add a + in front of columns you want to sort ascending, but
-it's not required.
-
-Some modes have keys mapped to open this dialog directly, and to quickly reverse
-sort direction. Press '?' as usual to see which keys are mapped in any mode.
-
-=head2 GROUPING
-
-innotop can group, or aggregate, rows together (I use the terms
-interchangeably). This is quite similar to an SQL GROUP BY clause. You can
-specify to group on certain columns, or if you don't specify any, the entire set
-of rows is treated as one group. This is quite like SQL so far, but unlike SQL,
-you can also select un-grouped columns. innotop actually aggregates every
-column. If you don't explicitly specify a grouping function, the default is
-'first'. This is basically a convenience so you don't have to specify an
-aggregate function for every column you want in the result.
-
-You can quickly toggle grouping on a table with the '=' key, which toggles its
-aggregate property. This property doesn't persist to the config file.
-
-The columns by which the table is grouped are specified in its group_by
-property. When you turn grouping on, innotop places the group_by columns at the
-far left of the table, even if they're not supposed to be visible. The rest of
-the visible columns appear in order after them.
-
-Two tables have default group_by lists and a count column built in:
-L<"processlist"> and L<"innodb_transactions">. The grouping is by connection
-and status, so you can quickly see how many queries or transactions are in a
-given status on each server you're monitoring. The time columns are aggregated
-as a sum; other columns are left at the default 'first' aggregation.
-
-By default, the table shown in L<"S: Variables & Status"> mode also uses
-grouping so you can monitor variables and status across many servers. The
-default aggregation function in this mode is 'avg'.
-
-Valid grouping functions are defined in the %agg_funcs hash. They include
-
-=over
-
-=item first
-
-Returns the first element in the group.
-
-=item count
-
-Returns the number of elements in the group, including undefined elements, much
-like SQL's COUNT(*).
-
-=item avg
-
-Returns the average of defined elements in the group.
-
-=item sum
-
-Returns the sum of elements in the group.
-
-=back
-
-Here's an example of grouping at work. Suppose you have a very busy server with
-hundreds of open connections, and you want to see how many connections are in
-what status. Using the built-in grouping rules, you can press 'Q' to enter
-L<"Q: Query List"> mode. Press '=' to toggle grouping (if necessary, select the
-L<"processlist"> table when prompted).
-
-Your display might now look like the following:
-
- Query List (? for help) localhost, 32:33, 0.11 QPS, 1 thd, 5.0.38-log
-
- CXN Cmd Cnt ID User Host Time Query
- localhost Query 49 12933 webusr localhost 19:38 SELECT * FROM
- localhost Sending Da 23 2383 webusr localhost 12:43 SELECT col1,
- localhost Sleep 120 140 webusr localhost 5:18:12
- localhost Statistics 12 19213 webusr localhost 01:19 SELECT * FROM
-
-That's actually quite a worrisome picture. You've got a lot of idle connections
-(Sleep), and some connections executing queries (Query and Sending Data).
-That's okay, but you also have a lot in Statistics status, collectively spending
-over a minute. That means the query optimizer is having a really hard time
-optimizing your statements. Something is wrong; it should normally take
-milliseconds to optimize queries. You might not have seen this pattern if you
-didn't look at your connections in aggregate. (This is a made-up example, but
-it can happen in real life).
-
-=head2 PIVOTING
-
-innotop can pivot a table for more compact display, similar to a Pivot Table in
-a spreadsheet (also known as a crosstab). Pivoting a table makes columns into
-rows. Assume you start with this table:
-
- foo bar
- === ===
- 1 3
- 2 4
-
-After pivoting, the table will look like this:
-
- name set0 set1
- ==== ==== ====
- foo 1 2
- bar 3 4
-
-To get reasonable results, you might need to group as well as pivoting.
-innotop currently does this for L<"S: Variables & Status"> mode.
-
-=head2 COLORS
-
-By default, innotop highlights rows with color so you can see at a glance which
-rows are more important. You can customize the colorization rules and add your
-own to any table. Open the table editor with the '^' key, choose a table if
-needed, and press 'o' to open the color editor dialog.
-
-The color editor dialog displays the rules applied to the table, in the order
-they are evaluated. Each row is evaluated against each rule to see if the rule
-matches the row; if it does, the row gets the specified color, and no further
-rules are evaluated. The rules look like the following:
-
- state eq Locked black on_red
- cmd eq Sleep white
- user eq system user white
- cmd eq Connect white
- cmd eq Binlog Dump white
- time > 600 red
- time > 120 yellow
- time > 60 green
- time > 30 cyan
-
-This is the default rule set for the L<"processlist"> table. In order of
-priority, these rules make locked queries black on a red background, "gray out"
-connections from replication and sleeping queries, and make queries turn from
-cyan to red as they run longer.
-
-(For some reason, the ANSI color code "white" is actually a light gray. Your
-terminal's display may vary; experiment to find colors you like).
-
-You can use keystrokes to move the rules up and down, which re-orders their
-priority. You can also delete rules and add new ones. If you add a new rule,
-innotop prompts you for the column, an operator for the comparison, a value
-against which to compare the column, and a color to assign if the rule matches.
-There is auto-completion and prompting at each step.
-
-The value in the third step needs to be correctly quoted. innotop does not try
-to quote the value because it doesn't know whether it should treat the value as
-a string or a number. If you want to compare the column against a string, as
-for example in the first rule above, you should enter 'Locked' surrounded by
-quotes. If you get an error message about a bareword, you probably should have
-quoted something.
-
-=head2 EXPRESSIONS
-
-Expressions are at the core of how innotop works, and are what enables you to
-extend innotop as you wish. Recall the table lifecycle explained in
-L<"TABLES">. Expressions are used in the earliest step, where it extracts
-values from a data source to form rows.
-
-It does this by calling a subroutine for each column, passing it the source data
-set, a set of current values, and a set of previous values. These are all
-needed so the subroutine can calculate things like the difference between this
-tick and the previous tick.
-
-The subroutines that extract the data from the set are compiled from
-expressions. This gives significantly more power than just naming the values to
-fill the columns, because it allows the column's value to be calculated from
-whatever data is necessary, but avoids the need to write complicated and lengthy
-Perl code.
-
-innotop begins with a string of text that can look as simple as a value's name
-or as complicated as a full-fledged Perl expression. It looks at each
-'bareword' token in the string and decides whether it's supposed to be a key
-into the $set hash. A bareword is an unquoted value that isn't already
-surrounded by code-ish things like dollar signs or curly brackets. If innotop
-decides that the bareword isn't a function or other valid Perl code, it converts
-it into a hash access. After the whole string is processed, innotop compiles a
-subroutine, like this:
-
- sub compute_column_value {
- my ( $set, $cur, $pre ) = @_;
- my $val = # EXPANDED STRING GOES HERE
- return $val;
- }
-
-Here's a concrete example, taken from the header table L<"q_header"> in L<"Q:
-Query List"> mode. This expression calculates the qps, or Queries Per Second,
-column's values, from the values returned by SHOW STATUS:
-
- Questions/Uptime_hires
-
-innotop decides both words are barewords, and transforms this expression into
-the following Perl code:
-
- $set->{Questions}/$set->{Uptime_hires}
-
-When surrounded by the rest of the subroutine's code, this is executable Perl
-that calculates a high-resolution queries-per-second value.
-
-The arguments to the subroutine are named $set, $cur, and $pre. In most cases,
-$set and $cur will be the same values. However, if L<"status_inc"> is set, $cur
-will not be the same as $set, because $set will already contain values that are
-the incremental difference between $cur and $pre.
-
-Every column in innotop is computed by subroutines compiled in the same fashion.
-There is no difference between innotop's built-in columns and user-defined
-columns. This keeps things consistent and predictable.
-
-=head2 TRANSFORMATIONS
-
-Transformations change how a value is rendered. For example, they can take a
-number of seconds and display it in H:M:S format. The following transformations
-are defined:
-
-=over
-
-=item commify
-
-Adds commas to large numbers every three decimal places.
-
-=item dulint_to_int
-
-Accepts two unsigned integers and converts them into a single longlong. This is
-useful for certain operations with InnoDB, which uses two integers as
-transaction identifiers, for example.
-
-=item no_ctrl_char
-
-Removes quoted control characters from the value. This is affected by the
-L<"charset"> configuration variable.
-
-This transformation only operates within quoted strings, for example, values to
-a SET clause in an UPDATE statement. It will not alter the UPDATE statement,
-but will collapse the quoted string to [BINARY] or [TEXT], depending on the
-charset.
-
-=item percent
-
-Converts a number to a percentage by multiplying it by two, formatting it with
-L<"num_digits"> digits after the decimal point, and optionally adding a percent
-sign (see L<"show_percent">).
-
-=item secs_to_time
-
-Formats a number of seconds as time in days+hours:minutes:seconds format.
-
-=item set_precision
-
-Formats numbers with L<"num_digits"> number of digits after the decimal point.
-
-=item shorten
-
-Formats a number as a unit of 1024 (k/M/G/T) and with L<"num_digits"> number of
-digits after the decimal point.
-
-=back
-
-=head2 TABLE EDITOR
-
-The innotop table editor lets you customize tables with keystrokes. You start
-the table editor with the '^' key. If there's more than one table on the
-screen, it will prompt you to choose one of them. Once you do, innotop will
-show you something like this:
-
- Editing table definition for Buffer Pool. Press ? for help, q to quit.
-
- name hdr label src
- cxn CXN Connection from which cxn
- buf_pool_size Size Buffer pool size IB_bp_buf_poo
- buf_free Free Bufs Buffers free in the b IB_bp_buf_fre
- pages_total Pages Pages total IB_bp_pages_t
- pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m
- buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo
- total_mem_alloc Memory Total memory allocate IB_bp_total_m
- add_pool_alloc Add'l Pool Additonal pool alloca IB_bp_add_poo
-
-The first line shows which table you're editing, and reminds you again to press
-'?' for a list of key mappings. The rest is a tabular representation of the
-table's columns, because that's likely what you're trying to edit. However, you
-can edit more than just the table's columns; this screen can start the filter
-editor, color rule editor, and more.
-
-Each row in the display shows a single column in the table you're editing, along
-with a couple of its properties such as its header and source expression (see
-L<"EXPRESSIONS">).
-
-The key mappings are Vim-style, as in many other places. Pressing 'j' and 'k'
-moves the highlight up or down. You can then (d)elete or (e)dit the highlighted
-column. You can also (a)dd a column to the table. This actually just activates
-one of the columns already defined for the table; it prompts you to choose from
-among the columns available but not currently displayed. Finally, you can
-re-order the columns with the '+' and '-' keys.
-
-You can do more than just edit the columns with the table editor, you can also
-edit other properties, such as the table's sort expression and group-by
-expression. Press '?' to see the full list, of course.
-
-If you want to really customize and create your own column, as opposed to just
-activating a built-in one that's not currently displayed, press the (n)ew key,
-and innotop will prompt you for the information it needs:
-
-=over
-
-=item *
-
-The column name: this needs to be a word without any funny characters, e.g. just
-letters, numbers and underscores.
-
-=item *
-
-The column header: this is the label that appears at the top of the column, in
-the table header. This can have spaces and funny characters, but be careful not
-to make it too wide and waste space on-screen.
-
-=item *
-
-The column's data source: this is an expression that determines what data from
-the source (see L<"TABLES">) innotop will put into the column. This can just be
-the name of an item in the source, or it can be a more complex expression, as
-described in L<"EXPRESSIONS">.
-
-=back
-
-Once you've entered the required data, your table has a new column. There is no
-difference between this column and the built-in ones; it can have all the same
-properties and behaviors. innotop will write the column's definition to the
-configuration file, so it will persist across sessions.
-
-Here's an example: suppose you want to track how many times your slaves have
-retried transactions. According to the MySQL manual, the
-Slave_retried_transactions status variable gives you that data: "The total
-number of times since startup that the replication slave SQL thread has retried
-transactions. This variable was added in version 5.0.4." This is appropriate to
-add to the L<"slave_sql_status"> table.
-
-To add the column, switch to the replication-monitoring mode with the 'M' key,
-and press the '^' key to start the table editor. When prompted, choose
-slave_sql_status as the table, then press 'n' to create the column. Type
-'retries' as the column name, 'Retries' as the column header, and
-'Slave_retried_transactions' as the source. Now the column is created, and you
-see the table editor screen again. Press 'q' to exit the table editor, and
-you'll see your column at the end of the table.
-
-=head1 VARIABLE SETS
-
-Variable sets are used in L<"S: Variables & Status"> mode to define more easily
-what variables you want to monitor. Behind the scenes they are compiled to a
-list of expressions, and then into a column list so they can be treated just
-like columns in any other table, in terms of data extraction and
-transformations. However, you're protected from the tedious details by a syntax
-that ought to feel very natural to you: a SQL SELECT list.
-
-The data source for variable sets, and indeed the entire S mode, is the
-combination of SHOW STATUS, SHOW VARIABLES, and SHOW INNODB STATUS. Imagine
-that you had a huge table with one column per variable returned from those
-statements. That's the data source for variable sets. You can now query this
-data source just like you'd expect. For example:
-
- Questions, Uptime, Questions/Uptime as QPS
-
-Behind the scenes innotop will split that variable set into three expressions,
-compile them and turn them into a table definition, then extract as usual. This
-becomes a "variable set," or a "list of variables you want to monitor."
-
-innotop lets you name and save your variable sets, and writes them to the
-configuration file. You can choose which variable set you want to see with the
-'c' key, or activate the next and previous sets with the '>' and '<' keys.
-There are many built-in variable sets as well, which should give you a good
-start for creating your own. Press 'e' to edit the current variable set, or
-just to see how it's defined. To create a new one, just press 'c' and type its
-name.
-
-You may want to use some of the functions listed in L<"TRANSFORMATIONS"> to help
-format the results. In particular, L<"set_precision"> is often useful to limit
-the number of digits you see. Extending the above example, here's how:
-
- Questions, Uptime, set_precision(Questions/Uptime) as QPS
-
-Actually, this still needs a little more work. If your L<"interval"> is less
-than one second, you might be dividing by zero because Uptime is incremental in
-this mode by default. Instead, use Uptime_hires:
-
- Questions, Uptime, set_precision(Questions/Uptime_hires) as QPS
-
-This example is simple, but it shows how easy it is to choose which variables
-you want to monitor.
-
-=head1 PLUGINS
-
-innotop has a simple but powerful plugin mechanism by which you can extend
-or modify its existing functionality, and add new functionality. innotop's
-plugin functionality is event-based: plugins register themselves to be called
-when events happen. They then have a chance to influence the event.
-
-An innotop plugin is a Perl module placed in innotop's L<"plugin_dir">
-directory. On UNIX systems, you can place a symbolic link to the module instead
-of putting the actual file there. innotop automatically discovers the file. If
-there is a corresponding entry in the L<"plugins"> configuration file section,
-innotop loads and activates the plugin.
-
-The module must conform to innotop's plugin interface. Additionally, the source
-code of the module must be written in such a way that innotop can inspect the
-file and determine the package name and description.
-
-=head2 Package Source Convention
-
-innotop inspects the plugin module's source to determine the Perl package name.
-It looks for a line of the form "package Foo;" and if found, considers the
-plugin's package name to be Foo. Of course the package name can be a valid Perl
-package name, with double semicolons and so on.
-
-It also looks for a description in the source code, to make the plugin editor
-more human-friendly. The description is a comment line of the form "#
-description: Foo", where "Foo" is the text innotop will consider to be the
-plugin's description.
-
-=head2 Plugin Interface
-
-The innotop plugin interface is quite simple: innotop expects the plugin to be
-an object-oriented module it can call certain methods on. The methods are
-
-=over
-
-=item new(%variables)
-
-This is the plugin's constructor. It is passed a hash of innotop's variables,
-which it can manipulate (see L<"Plugin Variables">). It must return a reference
-to the newly created plugin object.
-
-At construction time, innotop has only loaded the general configuration and
-created the default built-in variables with their default contents (which is
-quite a lot). Therefore, the state of the program is exactly as in the innotop
-source code, plus the configuration variables from the L<"general"> section in
-the config file.
-
-If your plugin manipulates the variables, it is changing global data, which is
-shared by innotop and all plugins. Plugins are loaded in the order they're
-listed in the config file. Your plugin may load before or after another plugin,
-so there is a potential for conflict or interaction between plugins if they
-modify data other plugins use or modify.
-
-=item register_for_events()
-
-This method must return a list of events in which the plugin is interested, if
-any. See L<"Plugin Events"> for the defined events. If the plugin returns an
-event that's not defined, the event is ignored.
-
-=item event handlers
-
-The plugin must implement a method named the same as each event for which it has
-registered. In other words, if the plugin returns qw(foo bar) from
-register_for_events(), it must have foo() and bar() methods. These methods are
-callbacks for the events. See L<"Plugin Events"> for more details about each
-event.
-
-=back
-
-=head2 Plugin Variables
-
-The plugin's constructor is passed a hash of innotop's variables, which it can
-manipulate. It is probably a good idea if the plugin object saves a copy of it
-for later use. The variables are defined in the innotop variable
-%pluggable_vars, and are as follows:
-
-=over
-
-=item action_for
-
-A hashref of key mappings. These are innotop's global hot-keys.
-
-=item agg_funcs
-
-A hashref of functions that can be used for grouping. See L<"GROUPING">.
-
-=item config
-
-The global configuration hash.
-
-=item connections
-
-A hashref of connection specifications. These are just specifications of how to
-connect to a server.
-
-=item dbhs
-
-A hashref of innotop's database connections. These are actual DBI connection
-objects.
-
-=item filters
-
-A hashref of filters applied to table rows. See L<"FILTERS"> for more.
-
-=item modes
-
-A hashref of modes. See L<"MODES"> for more.
-
-=item server_groups
-
-A hashref of server groups. See L<"SERVER GROUPS">.
-
-=item tbl_meta
-
-A hashref of innotop's table meta-data, with one entry per table (see
-L<"TABLES"> for more information).
-
-=item trans_funcs
-
-A hashref of transformation functions. See L<"TRANSFORMATIONS">.
-
-=item var_sets
-
-A hashref of variable sets. See L<"VARIABLE SETS">.
-
-=back
-
-=head2 Plugin Events
-
-Each event is defined somewhere in the innotop source code. When innotop runs
-that code, it executes the callback function for each plugin that expressed its
-interest in the event. innotop passes some data for each event. The events are
-defined in the %event_listener_for variable, and are as follows:
-
-=over
-
-=item extract_values($set, $cur, $pre, $tbl)
-
-This event occurs inside the function that extracts values from a data source.
-The arguments are the set of values, the current values, the previous values,
-and the table name.
-
-=item set_to_tbl
-
-Events are defined at many places in this subroutine, which is responsible for
-turning an arrayref of hashrefs into an arrayref of lines that can be printed to
-the screen. The events all pass the same data: an arrayref of rows and the name
-of the table being created. The events are set_to_tbl_pre_filter,
-set_to_tbl_pre_sort,set_to_tbl_pre_group, set_to_tbl_pre_colorize,
-set_to_tbl_pre_transform, set_to_tbl_pre_pivot, set_to_tbl_pre_create,
-set_to_tbl_post_create.
-
-=item draw_screen($lines)
-
-This event occurs inside the subroutine that prints the lines to the screen.
-$lines is an arrayref of strings.
-
-=back
-
-=head2 Simple Plugin Example
-
-The easiest way to explain the plugin functionality is probably with a simple
-example. The following module adds a column to the beginning of every table and
-sets its value to 1.
-
- use strict;
- use warnings FATAL => 'all';
-
- package Innotop::Plugin::Example;
- # description: Adds an 'example' column to every table
-
- sub new {
- my ( $class, %vars ) = @_;
- # Store reference to innotop's variables in $self
- my $self = bless { %vars }, $class;
-
- # Design the example column
- my $col = {
- hdr => 'Example',
- just => '',
- dec => 0,
- num => 1,
- label => 'Example',
- src => 'example', # Get data from this column in the data source
- tbl => '',
- trans => [],
- };
-
- # Add the column to every table.
- my $tbl_meta = $vars{tbl_meta};
- foreach my $tbl ( values %$tbl_meta ) {
- # Add the column to the list of defined columns
- $tbl->{cols}->{example} = $col;
- # Add the column to the list of visible columns
- unshift @{$tbl->{visible}}, 'example';
- }
-
- # Be sure to return a reference to the object.
- return $self;
- }
-
- # I'd like to be called when a data set is being rendered into a table, please.
- sub register_for_events {
- my ( $self ) = @_;
- return qw(set_to_tbl_pre_filter);
- }
-
- # This method will be called when the event fires.
- sub set_to_tbl_pre_filter {
- my ( $self, $rows, $tbl ) = @_;
- # Set the example column's data source to the value 1.
- foreach my $row ( @$rows ) {
- $row->{example} = 1;
- }
- }
-
- 1;
-
-=head2 Plugin Editor
-
-The plugin editor lets you view the plugins innotop discovered and activate or
-deactivate them. Start the editor by pressing $ to start the configuration
-editor from any mode. Press the 'p' key to start the plugin editor. You'll see
-a list of plugins innotop discovered. You can use the 'j' and 'k' keys to move
-the highlight to the desired one, then press the * key to toggle it active or
-inactive. Exit the editor and restart innotop for the changes to take effect.
-
-=head1 SQL STATEMENTS
-
-innotop uses a limited set of SQL statements to retrieve data from MySQL for
-display. The statements are customized depending on the server version against
-which they are executed; for example, on MySQL 5 and newer, INNODB_STATUS
-executes "SHOW ENGINE INNODB STATUS", while on earlier versions it executes
-"SHOW INNODB STATUS". The statements are as follows:
-
- Statement SQL executed
- =================== ===============================
- INNODB_STATUS SHOW [ENGINE] INNODB STATUS
- KILL_CONNECTION KILL
- KILL_QUERY KILL QUERY
- OPEN_TABLES SHOW OPEN TABLES
- PROCESSLIST SHOW FULL PROCESSLIST
- SHOW_MASTER_LOGS SHOW MASTER LOGS
- SHOW_MASTER_STATUS SHOW MASTER STATUS
- SHOW_SLAVE_STATUS SHOW SLAVE STATUS
- SHOW_STATUS SHOW [GLOBAL] STATUS
- SHOW_VARIABLES SHOW [GLOBAL] VARIABLES
-
-=head1 DATA SOURCES
-
-Each time innotop extracts values to create a table (see L<"EXPRESSIONS"> and
-L<"TABLES">), it does so from a particular data source. Largely because of the
-complex data extracted from SHOW INNODB STATUS, this is slightly messy. SHOW
-INNODB STATUS contains a mixture of single values and repeated values that form
-nested data sets.
-
-Whenever innotop fetches data from MySQL, it adds two extra bits to each set:
-cxn and Uptime_hires. cxn is the name of the connection from which the data
-came. Uptime_hires is a high-resolution version of the server's Uptime status
-variable, which is important if your L<"interval"> setting is sub-second.
-
-Here are the kinds of data sources from which data is extracted:
-
-=over
-
-=item STATUS_VARIABLES
-
-This is the broadest category, into which the most kinds of data fall. It
-begins with the combination of SHOW STATUS and SHOW VARIABLES, but other sources
-may be included as needed, for example, SHOW MASTER STATUS and SHOW SLAVE
-STATUS, as well as many of the non-repeated values from SHOW INNODB STATUS.
-
-=item DEADLOCK_LOCKS
-
-This data is extracted from the transaction list in the LATEST DETECTED DEADLOCK
-section of SHOW INNODB STATUS. It is nested two levels deep: transactions, then
-locks.
-
-=item DEADLOCK_TRANSACTIONS
-
-This data is from the transaction list in the LATEST DETECTED DEADLOCK
-section of SHOW INNODB STATUS. It is nested one level deep.
-
-=item EXPLAIN
-
-This data is from the result set returned by EXPLAIN.
-
-=item INNODB_TRANSACTIONS
-
-This data is from the TRANSACTIONS section of SHOW INNODB STATUS.
-
-=item IO_THREADS
-
-This data is from the list of threads in the the FILE I/O section of SHOW INNODB
-STATUS.
-
-=item INNODB_LOCKS
-
-This data is from the TRANSACTIONS section of SHOW INNODB STATUS and is nested
-two levels deep.
-
-=item OPEN_TABLES
-
-This data is from SHOW OPEN TABLES.
-
-=item PROCESSLIST
-
-This data is from SHOW FULL PROCESSLIST.
-
-=item OS_WAIT_ARRAY
-
-This data is from the SEMAPHORES section of SHOW INNODB STATUS and is nested one
-level deep. It comes from the lines that look like this:
-
- --Thread 1568861104 has waited at btr0cur.c line 424 ....
-
-=back
-
-=head1 MYSQL PRIVILEGES
-
-=over
-
-=item *
-
-You must connect to MySQL as a user who has the SUPER privilege for many of the
-functions.
-
-=item *
-
-If you don't have the SUPER privilege, you can still run some functions, but you
-won't necessarily see all the same data.
-
-=item *
-
-You need the PROCESS privilege to see the list of currently running queries in Q
-mode.
-
-=item *
-
-You need special privileges to start and stop slave servers.
-
-=item *
-
-You need appropriate privileges to create and drop the deadlock tables if needed
-(see L<"SERVER CONNECTIONS">).
-
-=back
-
-=head1 SYSTEM REQUIREMENTS
-
-You need Perl to run innotop, of course. You also need a few Perl modules: DBI,
-DBD::mysql, Term::ReadKey, and Time::HiRes. These should be included with most
-Perl distributions, but in case they are not, I recommend using versions
-distributed with your operating system or Perl distribution, not from CPAN.
-Term::ReadKey in particular has been known to cause problems if installed from
-CPAN.
-
-If you have Term::ANSIColor, innotop will use it to format headers more readably
-and compactly. (Under Microsoft Windows, you also need Win32::Console::ANSI for
-terminal formatting codes to be honored). If you install Term::ReadLine,
-preferably Term::ReadLine::Gnu, you'll get nice auto-completion support.
-
-I run innotop on Gentoo GNU/Linux, Debian and Ubuntu, and I've had feedback from
-people successfully running it on Red Hat, CentOS, Solaris, and Mac OSX. I
-don't see any reason why it won't work on other UNIX-ish operating systems, but
-I don't know for sure. It also runs on Windows under ActivePerl without
-problem.
-
-I use innotop on MySQL versions 3.23.58, 4.0.27, 4.1.0, 4.1.22, 5.0.26, 5.1.15,
-and 5.2.3. If it doesn't run correctly for you, that is a bug and I hope you
-report it.
-
-=head1 FILES
-
-$HOMEDIR/.innotop is used to store configuration information. Files include the
-configuration file innotop.ini, the core_dump file which contains verbose error
-messages if L<"debug"> is enabled, and the plugins/ subdirectory.
-
-=head1 GLOSSARY OF TERMS
-
-=over
-
-=item tick
-
-A tick is a refresh event, when innotop re-fetches data from connections and
-displays it.
-
-=back
-
-=head1 ACKNOWLEDGEMENTS
-
-I'm grateful to the following people for various reasons, and hope I haven't
-forgotten to include anyone:
-
-Allen K. Smith,
-Aurimas Mikalauskas,
-Bartosz Fenski,
-Brian Miezejewski,
-Christian Hammers,
-Cyril Scetbon,
-Dane Miller,
-David Multer,
-Dr. Frank Ullrich,
-Giuseppe Maxia,
-Google.com Site Reliability Engineers,
-Jan Pieter Kunst,
-Jari Aalto,
-Jay Pipes,
-Jeremy Zawodny,
-Johan Idren,
-Kristian Kohntopp,
-Lenz Grimmer,
-Maciej Dobrzanski,
-Michiel Betel,
-MySQL AB,
-Paul McCullagh,
-Sebastien Estienne,
-Sourceforge.net,
-Steven Kreuzer,
-The Gentoo MySQL Team,
-Trevor Price,
-Yaar Schnitman,
-and probably more people I've neglected to include.
-
-(If I misspelled your name, it's probably because I'm afraid of putting
-international characters into this documentation; earlier versions of Perl might
-not be able to compile it then).
-
-=head1 COPYRIGHT, LICENSE AND WARRANTY
-
-This program is copyright (c) 2006 Baron Schwartz.
-Feedback and improvements are welcome.
-
-THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-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; OR the Perl Artistic License. On UNIX and similar
-systems, you can issue `man perlgpl' or `man perlartistic' to read these
-licenses.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA.
-
-Execute innotop and press '!' to see this information at any time.
-
-=head1 AUTHOR
-
-Baron Schwartz.
-
-=head1 BUGS
-
-You can report bugs, ask for improvements, and get other help and support at
-L<http://sourceforge.net/projects/innotop>. There are mailing lists, forums,
-a bug tracker, etc. Please use these instead of contacting me directly, as it
-makes my job easier and benefits others if the discussions are permanent and
-public. Of course, if you need to contact me in private, please do.
-
-=cut
diff --git a/storage/xtradb/build/debian/additions/innotop/innotop.1 b/storage/xtradb/build/debian/additions/innotop/innotop.1
deleted file mode 100644
index ef708c3974c..00000000000
--- a/storage/xtradb/build/debian/additions/innotop/innotop.1
+++ /dev/null
@@ -1,2086 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "INNOTOP 1p"
-.TH INNOTOP 1p "2007-11-09" "perl v5.8.8" "User Contributed Perl Documentation"
-.SH "NAME"
-innotop \- MySQL and InnoDB transaction/status monitor.
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-To monitor servers normally:
-.PP
-.Vb 1
-\& innotop
-.Ve
-.PP
-To monitor InnoDB status information from a file:
-.PP
-.Vb 1
-\& innotop /var/log/mysql/mysqld.err
-.Ve
-.PP
-To run innotop non-interactively in a pipe-and-filter configuration:
-.PP
-.Vb 1
-\& innotop \-\-count 5 \-d 1 \-n
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-innotop monitors MySQL servers. Each of its modes shows you a different aspect
-of what's happening in the server. For example, there's a mode for monitoring
-replication, one for queries, and one for transactions. innotop refreshes its
-data periodically, so you see an updating view.
-.PP
-innotop has lots of features for power users, but you can start and run it with
-virtually no configuration. If you're just getting started, see
-\&\*(L"\s-1QUICK\-START\s0\*(R". Press '?' at any time while running innotop for
-context-sensitive help.
-.SH "QUICK-START"
-.IX Header "QUICK-START"
-To start innotop, open a terminal or command prompt. If you have installed
-innotop on your system, you should be able to just type \*(L"innotop\*(R" and press
-Enter; otherwise, you will need to change to innotop's directory and type \*(L"perl
-innotop\*(R".
-.PP
-The first thing innotop needs to know is how to connect to a MySQL server. You
-can just enter the hostname of the server, for example \*(L"localhost\*(R" or
-\&\*(L"127.0.0.1\*(R" if the server is on the same machine as innotop. After this innotop
-will prompt you for a \s-1DSN\s0 (data source name). You should be able to just accept
-the defaults by pressing Enter.
-.PP
-When innotop asks you about a table to use when resetting InnoDB deadlock
-information, just accept the default for now. This is an advanced feature you
-can configure later (see \*(L"D: InnoDB Deadlocks\*(R" for more).
-.PP
-If you have a .my.cnf file with your MySQL connection defaults, innotop can read
-it, and you won't need to specify a username and password if it's in that file.
-Otherwise, you should answer 'y' to the next couple of prompts.
-.PP
-After this, you should be connected, and innotop should show you something like
-the following:
-.PP
-.Vb 1
-\& InnoDB Txns (? for help) localhost, 01:11:19, InnoDB 10s :\-), 50 QPS,
-.Ve
-.PP
-.Vb 2
-\& CXN History Versions Undo Dirty Buf Used Bufs Txns MaxTxn
-\& localhost 7 2035 0 0 0.00% 92.19% 1 07:34
-.Ve
-.PP
-.Vb 5
-\& CXN ID User Host Txn Status Time Undo Query Tex
-\& localhost 98379 user1 webserver ACTIVE 07:34 0 SELECT `c
-\& localhost 98450 user1 webserver ACTIVE 01:06 0 INSERT IN
-\& localhost 97750 user1 webserver not starte 00:00 0
-\& localhost 98375 user1 appserver not starte 00:00 0
-.Ve
-.PP
-(This sample is truncated at the right so it will fit on a terminal when running
-\&'man innotop')
-.PP
-This sample comes from a quiet server with few transactions active. If your
-server is busy, you'll see more output. Notice the first line on the screen,
-which tells you what mode you're in and what server you're connected to. You
-can change to other modes with keystrokes; press 'Q' to switch to a list of
-currently running queries.
-.PP
-Press the '?' key to see what keys are active in the current mode. You can
-press any of these keys and innotop will either take the requested action or
-prompt you for more input. If your system has Term::ReadLine support, you can
-use \s-1TAB\s0 and other keys to auto-complete and edit input.
-.PP
-To quit innotop, press the 'q' key.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-innotop is mostly configured via its configuration file, but some of the
-configuration options can come from the command line. You can also specify a
-file to monitor for InnoDB status output; see \*(L"\s-1MONITORING\s0 A \s-1FILE\s0\*(R" for more
-details.
-.PP
-You can negate some options by prefixing the option name with \-\-no. For
-example, \-\-noinc (or \-\-no\-inc) negates \*(L"\-\-inc\*(R".
-.IP "\-\-help" 4
-.IX Item "--help"
-Print a summary of command-line usage and exit.
-.IP "\-\-color" 4
-.IX Item "--color"
-Enable or disable terminal coloring. Corresponds to the \*(L"color\*(R" config file
-setting.
-.IP "\-\-config" 4
-.IX Item "--config"
-Specifies a configuration file to read. This option is non\-sticky, that is to
-say it does not persist to the configuration file itself.
-.IP "\-\-nonint" 4
-.IX Item "--nonint"
-Enable non-interactive operation. See \*(L"\s-1NON\-INTERACTIVE\s0 \s-1OPERATION\s0\*(R" for more.
-.IP "\-\-count" 4
-.IX Item "--count"
-Refresh only the specified number of times (ticks) before exiting. Each refresh
-is a pause for \*(L"interval\*(R" seconds, followed by requesting data from MySQL
-connections and printing it to the terminal.
-.IP "\-\-delay" 4
-.IX Item "--delay"
-Specifies the amount of time to pause between ticks (refreshes). Corresponds to
-the configuration option \*(L"interval\*(R".
-.IP "\-\-mode" 4
-.IX Item "--mode"
-Specifies the mode in which innotop should start. Corresponds to the
-configuration option \*(L"mode\*(R".
-.IP "\-\-inc" 4
-.IX Item "--inc"
-Specifies whether innotop should display absolute numbers or relative numbers
-(offsets from their previous values). Corresponds to the configuration option
-\&\*(L"status_inc\*(R".
-.IP "\-\-version" 4
-.IX Item "--version"
-Output version information and exit.
-.SH "HOTKEYS"
-.IX Header "HOTKEYS"
-innotop is interactive, and you control it with key\-presses.
-.IP "\(bu" 4
-Uppercase keys switch between modes.
-.IP "\(bu" 4
-Lowercase keys initiate some action within the current mode.
-.IP "\(bu" 4
-Other keys do something special like change configuration or show the
-innotop license.
-.PP
-Press '?' at any time to see the currently active keys and what they do.
-.SH "MODES"
-.IX Header "MODES"
-Each of innotop's modes retrieves and displays a particular type of data from
-the servers you're monitoring. You switch between modes with uppercase keys.
-The following is a brief description of each mode, in alphabetical order. To
-switch to the mode, press the key listed in front of its heading in the
-following list:
-.IP "B: InnoDB Buffers" 4
-.IX Item "B: InnoDB Buffers"
-This mode displays information about the InnoDB buffer pool, page statistics,
-insert buffer, and adaptive hash index. The data comes from \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0.
-.Sp
-This mode contains the \*(L"buffer_pool\*(R", \*(L"page_statistics\*(R",
-\&\*(L"insert_buffers\*(R", and \*(L"adaptive_hash_index\*(R" tables by default.
-.IP "C: Command Summary" 4
-.IX Item "C: Command Summary"
-This mode is similar to mytop's Command Summary mode. It shows the
-\&\*(L"cmd_summary\*(R" table, which looks something like the following:
-.Sp
-.Vb 8
-\& Command Summary (? for help) localhost, 25+07:16:43, 2.45 QPS, 3 thd, 5.0.40
-\& _____________________ Command Summary _____________________
-\& Name Value Pct Last Incr Pct
-\& Select_scan 3244858 69.89% 2 100.00%
-\& Select_range 1354177 29.17% 0 0.00%
-\& Select_full_join 39479 0.85% 0 0.00%
-\& Select_full_range_join 4097 0.09% 0 0.00%
-\& Select_range_check 0 0.00% 0 0.00%
-.Ve
-.Sp
-The command summary table is built by extracting variables from
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R". The variables must be numeric and must match the prefix
-given by the \*(L"cmd_filter\*(R" configuration variable. The variables are then
-sorted by value descending and compared to the last variable, as shown above.
-The percentage columns are percentage of the total of all variables in the
-table, so you can see the relative weight of the variables.
-.Sp
-The example shows what you see if the prefix is \*(L"Select_\*(R". The default
-prefix is \*(L"Com_\*(R". You can choose a prefix with the 's' key.
-.Sp
-It's rather like running \s-1SHOW\s0 \s-1VARIABLES\s0 \s-1LIKE\s0 \*(L"prefix%\*(R" with memory and
-nice formatting.
-.Sp
-Values are aggregated across all servers. The Pct columns are not correctly
-aggregated across multiple servers. This is a known limitation of the grouping
-algorithm that may be fixed in the future.
-.IP "D: InnoDB Deadlocks" 4
-.IX Item "D: InnoDB Deadlocks"
-This mode shows the transactions involved in the last InnoDB deadlock. A second
-table shows the locks each transaction held and waited for. A deadlock is
-caused by a cycle in the waits-for graph, so there should be two locks held and
-one waited for unless the deadlock information is truncated.
-.Sp
-InnoDB puts deadlock information before some other information in the \s-1SHOW\s0
-\&\s-1INNODB\s0 \s-1STATUS\s0 output. If there are a lot of locks, the deadlock information can
-grow very large, and there is a limit on the size of the \s-1SHOW\s0 \s-1INNODB\s0
-\&\s-1STATUS\s0 output. A large deadlock can fill the entire output, or even be
-truncated, and prevent you from seeing other information at all. If you are
-running innotop in another mode, for example T mode, and suddenly you don't see
-anything, you might want to check and see if a deadlock has wiped out the data
-you need.
-.Sp
-If it has, you can create a small deadlock to replace the large one. Use the
-\&'w' key to 'wipe' the large deadlock with a small one. This will not work
-unless you have defined a deadlock table for the connection (see \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R").
-.Sp
-You can also configure innotop to automatically detect when a large deadlock
-needs to be replaced with a small one (see \*(L"auto_wipe_dl\*(R").
-.Sp
-This mode displays the \*(L"deadlock_transactions\*(R" and \*(L"deadlock_locks\*(R" tables
-by default.
-.IP "F: InnoDB Foreign Key Errors" 4
-.IX Item "F: InnoDB Foreign Key Errors"
-This mode shows the last InnoDB foreign key error information, such as the
-table where it happened, when and who and what query caused it, and so on.
-.Sp
-InnoDB has a huge variety of foreign key error messages, and many of them are
-just hard to parse. innotop doesn't always do the best job here, but there's
-so much code devoted to parsing this messy, unparseable output that innotop is
-likely never to be perfect in this regard. If innotop doesn't show you what
-you need to see, just look at the status text directly.
-.Sp
-This mode displays the \*(L"fk_error\*(R" table by default.
-.IP "I: InnoDB I/O Info" 4
-.IX Item "I: InnoDB I/O Info"
-This mode shows InnoDB's I/O statistics, including the I/O threads, pending I/O,
-file I/O miscellaneous, and log statistics. It displays the \*(L"io_threads\*(R",
-\&\*(L"pending_io\*(R", \*(L"file_io_misc\*(R", and \*(L"log_statistics\*(R" tables by default.
-.IP "L: Locks" 4
-.IX Item "L: Locks"
-This mode shows information about current locks. At the moment only InnoDB
-locks are supported, and by default you'll only see locks for which transactions
-are waiting. This information comes from the \s-1TRANSACTIONS\s0 section of the InnoDB
-status text. If you have a very busy server, you may have frequent lock waits;
-it helps to be able to see which tables and indexes are the \*(L"hot spot\*(R" for
-locks. If your server is running pretty well, this mode should show nothing.
-.Sp
-You can configure MySQL and innotop to monitor not only locks for which a
-transaction is waiting, but those currently held, too. You can do this with the
-InnoDB Lock Monitor (<http://dev.mysql.com/doc/en/innodb\-monitor.html>). It's
-not documented in the MySQL manual, but creating the lock monitor with the
-following statement also affects the output of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0, which innotop
-uses:
-.Sp
-.Vb 1
-\& CREATE TABLE innodb_lock_monitor(a int) ENGINE=INNODB;
-.Ve
-.Sp
-This causes InnoDB to print its output to the MySQL file every 16 seconds or so,
-as stated in the manual, but it also makes the normal \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 output
-include lock information, which innotop can parse and display (that's the
-undocumented feature).
-.Sp
-This means you can do what may have seemed impossible: to a limited extent
-(InnoDB truncates some information in the output), you can see which transaction
-holds the locks something else is waiting for. You can also enable and disable
-the InnoDB Lock Monitor with the key mappings in this mode.
-.Sp
-This mode displays the \*(L"innodb_locks\*(R" table by default. Here's a sample of
-the screen when one connection is waiting for locks another connection holds:
-.Sp
-.Vb 7
-\& _________________________________ InnoDB Locks __________________________
-\& CXN ID Type Waiting Wait Active Mode DB Table Index
-\& localhost 12 RECORD 1 00:10 00:10 X test t1 PRIMARY
-\& localhost 12 TABLE 0 00:10 00:10 IX test t1
-\& localhost 12 RECORD 1 00:10 00:10 X test t1 PRIMARY
-\& localhost 11 TABLE 0 00:00 00:25 IX test t1
-\& localhost 11 RECORD 0 00:00 00:25 X test t1 PRIMARY
-.Ve
-.Sp
-You can see the first connection, \s-1ID\s0 12, is waiting for a lock on the \s-1PRIMARY\s0
-key on test.t1, and has been waiting for 10 seconds. The second connection
-isn't waiting, because the Waiting column is 0, but it holds locks on the same
-index. That tells you connection 11 is blocking connection 12.
-.IP "M: Master/Slave Replication Status" 4
-.IX Item "M: Master/Slave Replication Status"
-This mode shows the output of \s-1SHOW\s0 \s-1SLAVE\s0 \s-1STATUS\s0 and \s-1SHOW\s0 \s-1MASTER\s0 \s-1STATUS\s0 in three
-tables. The first two divide the slave's status into \s-1SQL\s0 and I/O thread status,
-and the last shows master status. Filters are applied to eliminate non-slave
-servers from the slave tables, and non-master servers from the master table.
-.Sp
-This mode displays the \*(L"slave_sql_status\*(R", \*(L"slave_io_status\*(R", and
-\&\*(L"master_status\*(R" tables by default.
-.IP "O: Open Tables" 4
-.IX Item "O: Open Tables"
-This section comes from MySQL's \s-1SHOW\s0 \s-1OPEN\s0 \s-1TABLES\s0 command. By default it is
-filtered to show tables which are in use by one or more queries, so you can
-get a quick look at which tables are 'hot'. You can use this to guess which
-tables might be locked implicitly.
-.Sp
-This mode displays the \*(L"open_tables\*(R" mode by default.
-.IP "Q: Query List" 4
-.IX Item "Q: Query List"
-This mode displays the output from \s-1SHOW\s0 \s-1FULL\s0 \s-1PROCESSLIST\s0, much like \fBmytop\fR's
-query list mode. This mode does \fBnot\fR show InnoDB-related information. This
-is probably one of the most useful modes for general usage.
-.Sp
-There is an informative header that shows general status information about
-your server. You can toggle it on and off with the 'h' key. By default,
-innotop hides inactive processes and its own process. You can toggle these on
-and off with the 'i' and 'a' keys.
-.Sp
-You can \s-1EXPLAIN\s0 a query from this mode with the 'e' key. This displays the
-query's full text, the results of \s-1EXPLAIN\s0, and in newer MySQL versions, even
-the optimized query resulting from \s-1EXPLAIN\s0 \s-1EXTENDED\s0. innotop also tries to
-rewrite certain queries to make them EXPLAIN\-able. For example, \s-1INSERT/SELECT\s0
-statements are rewritable.
-.Sp
-This mode displays the \*(L"q_header\*(R" and \*(L"processlist\*(R" tables by default.
-.IP "R: InnoDB Row Operations and Semaphores" 4
-.IX Item "R: InnoDB Row Operations and Semaphores"
-This mode shows InnoDB row operations, row operation miscellaneous, semaphores,
-and information from the wait array. It displays the \*(L"row_operations\*(R",
-\&\*(L"row_operation_misc\*(R", \*(L"semaphores\*(R", and \*(L"wait_array\*(R" tables by default.
-.IP "S: Variables & Status" 4
-.IX Item "S: Variables & Status"
-This mode calculates statistics, such as queries per second, and prints them out
-in several different styles. You can show absolute values, or incremental values
-between ticks.
-.Sp
-You can switch between the views by pressing a key. The 's' key prints a
-single line each time the screen updates, in the style of \fBvmstat\fR. The 'g'
-key changes the view to a graph of the same numbers, sort of like \fBtload\fR.
-The 'v' key changes the view to a pivoted table of variable names on the left,
-with successive updates scrolling across the screen from left to right. You can
-choose how many updates to put on the screen with the \*(L"num_status_sets\*(R"
-configuration variable.
-.Sp
-Headers may be abbreviated to fit on the screen in interactive operation. You
-choose which variables to display with the 'c' key, which selects from
-predefined sets, or lets you create your own sets. You can edit the current set
-with the 'e' key.
-.Sp
-This mode doesn't really display any tables like other modes. Instead, it uses
-a table definition to extract and format the data, but it then transforms the
-result in special ways before outputting it. It uses the \*(L"var_status\*(R" table
-definition for this.
-.IP "T: InnoDB Transactions" 4
-.IX Item "T: InnoDB Transactions"
-This mode shows transactions from the InnoDB monitor's output, in \fBtop\fR\-like
-format. This mode is the reason I wrote innotop.
-.Sp
-You can kill queries or processes with the 'k' and 'x' keys, and \s-1EXPLAIN\s0 a query
-with the 'e' or 'f' keys. InnoDB doesn't print the full query in transactions,
-so explaining may not work right if the query is truncated.
-.Sp
-The informational header can be toggled on and off with the 'h' key. By
-default, innotop hides inactive transactions and its own transaction. You can
-toggle this on and off with the 'i' and 'a' keys.
-.Sp
-This mode displays the \*(L"t_header\*(R" and \*(L"innodb_transactions\*(R" tables by
-default.
-.SH "INNOTOP STATUS"
-.IX Header "INNOTOP STATUS"
-The first line innotop displays is a \*(L"status bar\*(R" of sorts. What it contains
-depends on the mode you're in, and what servers you're monitoring. The first
-few words are always the innotop mode, such as \*(L"InnoDB Txns\*(R" for T mode,
-followed by a reminder to press '?' for help at any time.
-.Sh "\s-1ONE\s0 \s-1SERVER\s0"
-.IX Subsection "ONE SERVER"
-The simplest case is when you're monitoring a single server. In this case, the
-name of the connection is next on the status line. This is the name you gave
-when you created the connection \*(-- most likely the MySQL server's hostname.
-This is followed by the server's uptime.
-.PP
-If you're in an InnoDB mode, such as T or B, the next word is \*(L"InnoDB\*(R" followed
-by some information about the \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 output used to render the
-screen. The first word is the number of seconds since the last \s-1SHOW\s0 \s-1INNODB\s0
-\&\s-1STATUS\s0, which InnoDB uses to calculate some per-second statistics. The next is
-a smiley face indicating whether the InnoDB output is truncated. If the smiley
-face is a :\-), all is well; there is no truncation. A :^| means the transaction
-list is so long, InnoDB has only printed out some of the transactions. Finally,
-a frown :\-( means the output is incomplete, which is probably due to a deadlock
-printing too much lock information (see \*(L"D: InnoDB Deadlocks\*(R").
-.PP
-The next two words indicate the server's queries per second (\s-1QPS\s0) and how many
-threads (connections) exist. Finally, the server's version number is the last
-thing on the line.
-.Sh "\s-1MULTIPLE\s0 \s-1SERVERS\s0"
-.IX Subsection "MULTIPLE SERVERS"
-If you are monitoring multiple servers (see \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R"), the status
-line does not show any details about individual servers. Instead, it shows the
-names of the connections that are active. Again, these are connection names you
-specified, which are likely to be the server's hostname. A connection that has
-an error is prefixed with an exclamation point.
-.PP
-If you are monitoring a group of servers (see \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R"), the status
-line shows the name of the group. If any connection in the group has an
-error, the group's name is followed by the fraction of the connections that
-don't have errors.
-.PP
-See \*(L"\s-1ERROR\s0 \s-1HANDLING\s0\*(R" for more details about innotop's error handling.
-.Sh "\s-1MONITORING\s0 A \s-1FILE\s0"
-.IX Subsection "MONITORING A FILE"
-If you give a filename on the command line, innotop will not connect to \s-1ANY\s0
-servers at all. It will watch the specified file for InnoDB status output and
-use that as its data source. It will always show a single connection called
-\&'file'. And since it can't connect to a server, it can't determine how long the
-server it's monitoring has been up; so it calculates the server's uptime as time
-since innotop started running.
-.SH "SERVER ADMINISTRATION"
-.IX Header "SERVER ADMINISTRATION"
-While innotop is primarily a monitor that lets you watch and analyze your
-servers, it can also send commands to servers. The most frequently useful
-commands are killing queries and stopping or starting slaves.
-.PP
-You can kill a connection, or in newer versions of MySQL kill a query but not a
-connection, from \*(L"Q: Query List\*(R" and \*(L"T: InnoDB Transactions\*(R" modes.
-Press 'k' to issue a \s-1KILL\s0 command, or 'x' to issue a \s-1KILL\s0 \s-1QUERY\s0 command.
-innotop will prompt you for the server and/or connection \s-1ID\s0 to kill (innotop
-does not prompt you if there is only one possible choice for any input).
-innotop pre-selects the longest-running query, or the oldest connection.
-Confirm the command with 'y'.
-.PP
-In \*(L"M: Master/Slave Replication Status\*(R" mode, you can start and stop slaves
-with the 'a' and 'o' keys, respectively. You can send these commands to many
-slaves at once. innotop fills in a default command of \s-1START\s0 \s-1SLAVE\s0 or \s-1STOP\s0 \s-1SLAVE\s0
-for you, but you can actually edit the command and send anything you wish, such
-as \s-1SET\s0 \s-1GLOBAL\s0 SQL_SLAVE_SKIP_COUNTER=1 to make the slave skip one binlog event
-when it starts.
-.PP
-You can also ask innotop to calculate the earliest binlog in use by any slave
-and issue a \s-1PURGE\s0 \s-1MASTER\s0 \s-1LOGS\s0 on the master. Use the 'b' key for this. innotop
-will prompt you for a master to run the command on, then prompt you for the
-connection names of that master's slaves (there is no way for innotop to
-determine this reliably itself). innotop will find the minimum binlog in use by
-these slave connections and suggest it as the argument to \s-1PURGE\s0 \s-1MASTER\s0 \s-1LOGS\s0.
-.SH "SERVER CONNECTIONS"
-.IX Header "SERVER CONNECTIONS"
-When you create a server connection, innotop asks you for a series of inputs, as
-follows:
-.IP "\s-1DSN\s0" 4
-.IX Item "DSN"
-A \s-1DSN\s0 is a Data Source Name, which is the initial argument passed to the \s-1DBI\s0
-module for connecting to a server. It is usually of the form
-.Sp
-.Vb 1
-\& DBI:mysql:;mysql_read_default_group=mysql;host=HOSTNAME
-.Ve
-.Sp
-Since this \s-1DSN\s0 is passed to the DBD::mysql driver, you should read the driver's
-documentation at \*(L"http://search.cpan.org/dist/DBD\-mysql/lib/DBD/mysql.pm\*(R" for
-the exact details on all the options you can pass the driver in the \s-1DSN\s0. You
-can read more about \s-1DBI\s0 at <http://dbi.perl.org/docs/>, and especially at
-<http://search.cpan.org/~timb/DBI/DBI.pm>.
-.Sp
-The mysql_read_default_group=mysql option lets the \s-1DBD\s0 driver read your MySQL
-options files, such as ~/.my.cnf on UNIX-ish systems. You can use this to avoid
-specifying a username or password for the connection.
-.IP "InnoDB Deadlock Table" 4
-.IX Item "InnoDB Deadlock Table"
-This optional item tells innotop a table name it can use to deliberately create
-a small deadlock (see \*(L"D: InnoDB Deadlocks\*(R"). If you specify this option,
-you just need to be sure the table doesn't exist, and that innotop can create
-and drop the table with the InnoDB storage engine. You can safely omit or just
-accept the default if you don't intend to use this.
-.IP "Username" 4
-.IX Item "Username"
-innotop will ask you if you want to specify a username. If you say 'y', it will
-then prompt you for a user name. If you have a MySQL option file that specifies
-your username, you don't have to specify a username.
-.Sp
-The username defaults to your login name on the system you're running innotop on.
-.IP "Password" 4
-.IX Item "Password"
-innotop will ask you if you want to specify a password. Like the username, the
-password is optional, but there's an additional prompt that asks if you want to
-save the password in the innotop configuration file. If you don't save it in
-the configuration file, innotop will prompt you for a password each time it
-starts. Passwords in the innotop configuration file are saved in plain text,
-not encrypted in any way.
-.PP
-Once you finish answering these questions, you should be connected to a server.
-But innotop isn't limited to monitoring a single server; you can define many
-server connections and switch between them by pressing the '@' key. See
-\&\*(L"\s-1SWITCHING\s0 \s-1BETWEEN\s0 \s-1CONNECTIONS\s0\*(R".
-.PP
-To create a new connection, press the '@' key and type the name of the new
-connection, then follow the steps given above.
-.SH "SERVER GROUPS"
-.IX Header "SERVER GROUPS"
-If you have multiple MySQL instances, you can put them into named groups, such
-as 'all', 'masters', and 'slaves', which innotop can monitor all together.
-.PP
-You can choose which group to monitor with the '#' key, and you can press the
-\&\s-1TAB\s0 key to switch to the next group. If you're not currently monitoring a
-group, pressing \s-1TAB\s0 selects the first group.
-.PP
-To create a group, press the '#' key and type the name of your new group, then
-type the names of the connections you want the group to contain.
-.SH "SWITCHING BETWEEN CONNECTIONS"
-.IX Header "SWITCHING BETWEEN CONNECTIONS"
-innotop lets you quickly switch which servers you're monitoring. The most basic
-way is by pressing the '@' key and typing the name(s) of the connection(s) you
-want to use. This setting is per\-mode, so you can monitor different connections
-in each mode, and innotop remembers which connections you choose.
-.PP
-You can quickly switch to the 'next' connection in alphabetical order with the
-\&'n' key. If you're monitoring a server group (see \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R") this will
-switch to the first connection.
-.PP
-You can also type many connection names, and innotop will fetch and display data
-from them all. Just separate the connection names with spaces, for example
-\&\*(L"server1 server2.\*(R" Again, if you type the name of a connection that doesn't
-exist, innotop will prompt you for connection information and create the
-connection.
-.PP
-Another way to monitor multiple connections at once is with server groups. You
-can use the \s-1TAB\s0 key to switch to the 'next' group in alphabetical order, or if
-you're not monitoring any groups, \s-1TAB\s0 will switch to the first group.
-.PP
-innotop does not fetch data in parallel from connections, so if you are
-monitoring a large group or many connections, you may notice increased delay
-between ticks.
-.PP
-When you monitor more than one connection, innotop's status bar changes. See
-\&\*(L"\s-1INNOTOP\s0 \s-1STATUS\s0\*(R".
-.SH "ERROR HANDLING"
-.IX Header "ERROR HANDLING"
-Error handling is not that important when monitoring a single connection, but is
-crucial when you have many active connections. A crashed server or lost
-connection should not crash innotop. As a result, innotop will continue to run
-even when there is an error; it just won't display any information from the
-connection that had an error. Because of this, innotop's behavior might confuse
-you. It's a feature, not a bug!
-.PP
-innotop does not continue to query connections that have errors, because they
-may slow innotop and make it hard to use, especially if the error is a problem
-connecting and causes a long time\-out. Instead, innotop retries the connection
-occasionally to see if the error still exists. If so, it will wait until some
-point in the future. The wait time increases in ticks as the Fibonacci series,
-so it tries less frequently as time passes.
-.PP
-Since errors might only happen in certain modes because of the \s-1SQL\s0 commands
-issued in those modes, innotop keeps track of which mode caused the error. If
-you switch to a different mode, innotop will retry the connection instead of
-waiting.
-.PP
-By default innotop will display the problem in red text at the bottom of the
-first table on the screen. You can disable this behavior with the
-\&\*(L"show_cxn_errors_in_tbl\*(R" configuration option, which is enabled by default.
-If the \*(L"debug\*(R" option is enabled, innotop will display the error at the
-bottom of every table, not just the first. And if \*(L"show_cxn_errors\*(R" is
-enabled, innotop will print the error text to \s-1STDOUT\s0 as well. Error messages
-might only display in the mode that caused the error, depending on the mode and
-whether innotop is avoiding querying that connection.
-.SH "NON-INTERACTIVE OPERATION"
-.IX Header "NON-INTERACTIVE OPERATION"
-You can run innotop in non-interactive mode, in which case it is entirely
-controlled from the configuration file and command-line options. To start
-innotop in non-interactive mode, give the L\*(L"<\-\-nonint\*(R"> command-line option.
-This changes innotop's behavior in the following ways:
-.IP "\(bu" 4
-Certain Perl modules are not loaded. Term::Readline is not loaded, since
-innotop doesn't prompt interactively. Term::ANSIColor and Win32::Console::ANSI
-modules are not loaded. Term::ReadKey is still used, since innotop may have to
-prompt for connection passwords when starting up.
-.IP "\(bu" 4
-innotop does not clear the screen after each tick.
-.IP "\(bu" 4
-innotop does not persist any changes to the configuration file.
-.IP "\(bu" 4
-If \*(L"\-\-count\*(R" is given and innotop is in incremental mode (see \*(L"status_inc\*(R"
-and \*(L"\-\-inc\*(R"), innotop actually refreshes one more time than specified so it
-can print incremental statistics. This suppresses output during the first
-tick, so innotop may appear to hang.
-.IP "\(bu" 4
-innotop only displays the first table in each mode. This is so the output can
-be easily processed with other command-line utilities such as awk and sed. To
-change which tables display in each mode, see \*(L"\s-1TABLES\s0\*(R". Since \*(L"Q: Query List\*(R" mode is so important, innotop automatically disables the \*(L"q_header\*(R"
-table. This ensures you'll see the \*(L"processlist\*(R" table, even if you have
-innotop configured to show the q_header table during interactive operation.
-Similarly, in \*(L"T: InnoDB Transactions\*(R" mode, the \*(L"t_header\*(R" table is
-suppressed so you see only the \*(L"innodb_transactions\*(R" table.
-.IP "\(bu" 4
-All output is tab-separated instead of being column-aligned with whitespace, and
-innotop prints the full contents of each table instead of only printing one
-screenful at a time.
-.IP "\(bu" 4
-innotop only prints column headers once instead of every tick (see
-\&\*(L"hide_hdr\*(R"). innotop does not print table captions (see
-\&\*(L"display_table_captions\*(R"). innotop ensures there are no empty lines in the
-output.
-.IP "\(bu" 4
-innotop does not honor the \*(L"shorten\*(R" transformation, which normally shortens
-some numbers to human-readable formats.
-.IP "\(bu" 4
-innotop does not print a status line (see \*(L"\s-1INNOTOP\s0 \s-1STATUS\s0\*(R").
-.SH "CONFIGURING"
-.IX Header "CONFIGURING"
-Nearly everything about innotop is configurable. Most things are possible to
-change with built-in commands, but you can also edit the configuration file.
-.PP
-While running innotop, press the '$' key to bring up the configuration editing
-dialog. Press another key to select the type of data you want to edit:
-.IP "S: Statement Sleep Times" 4
-.IX Item "S: Statement Sleep Times"
-Edits \s-1SQL\s0 statement sleep delays, which make innotop pause for the specified
-amount of time after executing a statement. See \*(L"\s-1SQL\s0 \s-1STATEMENTS\s0\*(R" for a
-definition of each statement and what it does. By default innotop does not
-delay after any statements.
-.Sp
-This feature is included so you can customize the side-effects caused by
-monitoring your server. You may not see any effects, but some innotop users
-have noticed that certain MySQL versions under very high load with InnoDB
-enabled take longer than usual to execute \s-1SHOW\s0 \s-1GLOBAL\s0 \s-1STATUS\s0. If innotop calls
-\&\s-1SHOW\s0 \s-1FULL\s0 \s-1PROCESSLIST\s0 immediately afterward, the processlist contains more
-queries than the machine actually averages at any given moment. Configuring
-innotop to pause briefly after calling \s-1SHOW\s0 \s-1GLOBAL\s0 \s-1STATUS\s0 alleviates this
-effect.
-.Sp
-Sleep times are stored in the \*(L"stmt_sleep_times\*(R" section of the configuration
-file. Fractional-second sleeps are supported, subject to your hardware's
-limitations.
-.IP "c: Edit Columns" 4
-.IX Item "c: Edit Columns"
-Starts the table editor on one of the displayed tables. See \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R".
-An alternative way to start the table editor without entering the configuration
-dialog is with the '^' key.
-.IP "g: General Configuration" 4
-.IX Item "g: General Configuration"
-Starts the configuration editor to edit global and mode-specific configuration
-variables (see \*(L"\s-1MODES\s0\*(R"). innotop prompts you to choose a variable from among
-the global and mode-specific ones depending on the current mode.
-.IP "k: Row-Coloring Rules" 4
-.IX Item "k: Row-Coloring Rules"
-Starts the row-coloring rules editor on one of the displayed table(s). See
-\&\*(L"\s-1COLORS\s0\*(R" for details.
-.IP "p: Manage Plugins" 4
-.IX Item "p: Manage Plugins"
-Starts the plugin configuration editor. See \*(L"\s-1PLUGINS\s0\*(R" for details.
-.IP "s: Server Groups" 4
-.IX Item "s: Server Groups"
-Lets you create and edit server groups. See \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R".
-.IP "t: Choose Displayed Tables" 4
-.IX Item "t: Choose Displayed Tables"
-Lets you choose which tables to display in this mode. See \*(L"\s-1MODES\s0\*(R" and
-\&\*(L"\s-1TABLES\s0\*(R".
-.SH "CONFIGURATION FILE"
-.IX Header "CONFIGURATION FILE"
-innotop's default configuration file location is in \f(CW$HOME\fR/.innotop, but can be
-overridden with the \*(L"\-\-config\*(R" command-line option. You can edit it by hand
-safely. innotop reads the configuration file when it starts, and writes it out
-again when it exits, so any changes you make while innotop is running will be
-lost.
-.PP
-innotop doesn't store its entire configuration in the configuration file. It
-has a huge set of default configuration that it holds only in memory, and the
-configuration file only overrides these defaults. When you customize a default
-setting, innotop notices, and then stores the customizations into the file.
-This keeps the file size down, makes it easier to edit, and makes upgrades
-easier.
-.PP
-A configuration file can be made read\-only. See \*(L"readonly\*(R".
-.PP
-The configuration file is arranged into sections like an \s-1INI\s0 file. Each
-section begins with [section\-name] and ends with [/section\-name]. Each
-section's entries have a different syntax depending on the data they need to
-store. You can put comments in the file; any line that begins with a #
-character is a comment. innotop will not read the comments, so it won't write
-them back out to the file when it exits. Comments in read-only configuration
-files are still useful, though.
-.PP
-The first line in the file is innotop's version number. This lets innotop
-notice when the file format is not backwards\-compatible, and upgrade smoothly
-without destroying your customized configuration.
-.PP
-The following list describes each section of the configuration file and the data
-it contains:
-.IP "general" 4
-.IX Item "general"
-The 'general' section contains global configuration variables and variables that
-may be mode\-specific, but don't belong in any other section. The syntax is a
-simple key=value list. innotop writes a comment above each value to help you
-edit the file by hand.
-.RS 4
-.IP "S_func" 4
-.IX Item "S_func"
-Controls S mode presentation (see \*(L"S: Variables & Status\*(R"). If g, values are
-graphed; if s, values are like vmstat; if p, values are in a pivoted table.
-.IP "S_set" 4
-.IX Item "S_set"
-Specifies which set of variables to display in \*(L"S: Variables & Status\*(R" mode.
-See \*(L"\s-1VARIABLE\s0 \s-1SETS\s0\*(R".
-.IP "auto_wipe_dl" 4
-.IX Item "auto_wipe_dl"
-Instructs innotop to automatically wipe large deadlocks when it notices them.
-When this happens you may notice a slight delay. At the next tick, you will
-usually see the information that was being truncated by the large deadlock.
-.IP "charset" 4
-.IX Item "charset"
-Specifies what kind of characters to allow through the \*(L"no_ctrl_char\*(R"
-transformation. This keeps non-printable characters from confusing a
-terminal when you monitor queries that contain binary data, such as images.
-.Sp
-The default is 'ascii', which considers anything outside normal \s-1ASCII\s0 to be a
-control character. The other allowable values are 'unicode' and 'none'. 'none'
-considers every character a control character, which can be useful for
-collapsing \s-1ALL\s0 text fields in queries.
-.IP "cmd_filter" 4
-.IX Item "cmd_filter"
-This is the prefix that filters variables in \*(L"C: Command Summary\*(R" mode.
-.IP "color" 4
-.IX Item "color"
-Whether terminal coloring is permitted.
-.IP "cxn_timeout" 4
-.IX Item "cxn_timeout"
-On MySQL versions 4.0.3 and newer, this variable is used to set the connection's
-timeout, so MySQL doesn't close the connection if it is not used for a while.
-This might happen because a connection isn't monitored in a particular mode, for
-example.
-.IP "debug" 4
-.IX Item "debug"
-This option enables more verbose errors and makes innotop more strict in some
-places. It can help in debugging filters and other user-defined code. It also
-makes innotop write a lot of information to \*(L"debugfile\*(R" when there is a
-crash.
-.IP "debugfile" 4
-.IX Item "debugfile"
-A file to which innotop will write information when there is a crash. See
-\&\*(L"\s-1FILES\s0\*(R".
-.IP "display_table_captions" 4
-.IX Item "display_table_captions"
-innotop displays a table caption above most tables. This variable suppresses or
-shows captions on all tables globally. Some tables are configured with the
-hide_caption property, which overrides this.
-.IP "global" 4
-.IX Item "global"
-Whether to show \s-1GLOBAL\s0 variables and status. innotop only tries to do this on
-servers which support the \s-1GLOBAL\s0 option to \s-1SHOW\s0 \s-1VARIABLES\s0 and \s-1SHOW\s0 \s-1STATUS\s0. In
-some MySQL versions, you need certain privileges to do this; if you don't have
-them, innotop will not be able to fetch any variable and status data. This
-configuration variable lets you run innotop and fetch what data you can even
-without the elevated privileges.
-.Sp
-I can no longer find or reproduce the situation where \s-1GLOBAL\s0 wasn't allowed, but
-I know there was one.
-.IP "graph_char" 4
-.IX Item "graph_char"
-Defines the character to use when drawing graphs in \*(L"S: Variables & Status\*(R"
-mode.
-.IP "header_highlight" 4
-.IX Item "header_highlight"
-Defines how to highlight column headers. This only works if Term::ANSIColor is
-available. Valid values are 'bold' and 'underline'.
-.IP "hide_hdr" 4
-.IX Item "hide_hdr"
-Hides column headers globally.
-.IP "interval" 4
-.IX Item "interval"
-The interval at which innotop will refresh its data (ticks). The interval is
-implemented as a sleep time between ticks, so the true interval will vary
-depending on how long it takes innotop to fetch and render data.
-.Sp
-This variable accepts fractions of a second.
-.IP "mode" 4
-.IX Item "mode"
-The mode in which innotop should start. Allowable arguments are the same as the
-key presses that select a mode interactively. See \*(L"\s-1MODES\s0\*(R".
-.IP "num_digits" 4
-.IX Item "num_digits"
-How many digits to show in fractional numbers and percents. This variable's
-range is between 0 and 9 and can be set directly from \*(L"S: Variables & Status\*(R"
-mode with the '+' and '\-' keys. It is used in the \*(L"set_precision\*(R",
-\&\*(L"shorten\*(R", and \*(L"percent\*(R" transformations.
-.IP "num_status_sets" 4
-.IX Item "num_status_sets"
-Controls how many sets of status variables to display in pivoted \*(L"S: Variables & Status\*(R" mode. It also controls the number of old sets of variables innotop
-keeps in its memory, so the larger this variable is, the more memory innotop
-uses.
-.IP "plugin_dir" 4
-.IX Item "plugin_dir"
-Specifies where plugins can be found. By default, innotop stores plugins in the
-\&'plugins' subdirectory of your innotop configuration directory.
-.IP "readonly" 4
-.IX Item "readonly"
-Whether the configuration file is readonly. This cannot be set interactively,
-because it would prevent itself from being written to the configuration file.
-.IP "show_cxn_errors" 4
-.IX Item "show_cxn_errors"
-Makes innotop print connection errors to \s-1STDOUT\s0. See \*(L"\s-1ERROR\s0 \s-1HANDLING\s0\*(R".
-.IP "show_cxn_errors_in_tbl" 4
-.IX Item "show_cxn_errors_in_tbl"
-Makes innotop display connection errors as rows in the first table on screen.
-See \*(L"\s-1ERROR\s0 \s-1HANDLING\s0\*(R".
-.IP "show_percent" 4
-.IX Item "show_percent"
-Adds a '%' character after the value returned by the \*(L"percent\*(R"
-transformation.
-.IP "show_statusbar" 4
-.IX Item "show_statusbar"
-Controls whether to show the status bar in the display. See \*(L"\s-1INNOTOP\s0 \s-1STATUS\s0\*(R".
-.IP "skip_innodb" 4
-.IX Item "skip_innodb"
-Disables fetching \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0, in case your server(s) do not have InnoDB
-enabled and you don't want innotop to try to fetch it. This can also be useful
-when you don't have the \s-1SUPER\s0 privilege, required to run \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0.
-.IP "status_inc" 4
-.IX Item "status_inc"
-Whether to show absolute or incremental values for status variables.
-Incremental values are calculated as an offset from the last value innotop saw
-for that variable. This is a global setting, but will probably become
-mode-specific at some point. Right now it is honored a bit inconsistently; some
-modes don't pay attention to it.
-.RE
-.RS 4
-.RE
-.IP "plugins" 4
-.IX Item "plugins"
-This section holds a list of package names of active plugins. If the plugin
-exists, innotop will activate it. See \*(L"\s-1PLUGINS\s0\*(R" for more information.
-.IP "filters" 4
-.IX Item "filters"
-This section holds user-defined filters (see \*(L"\s-1FILTERS\s0\*(R"). Each line is in the
-format filter_name=text='filter text' tbls='table list'.
-.Sp
-The filter text is the text of the subroutine's code. The table list is a list
-of tables to which the filter can apply. By default, user-defined filters apply
-to the table for which they were created, but you can manually override that by
-editing the definition in the configuration file.
-.IP "active_filters" 4
-.IX Item "active_filters"
-This section stores which filters are active on each table. Each line is in the
-format table_name=filter_list.
-.IP "tbl_meta" 4
-.IX Item "tbl_meta"
-This section stores user-defined or user-customized columns (see \*(L"\s-1COLUMNS\s0\*(R").
-Each line is in the format col_name=properties, where the properties are a
-name=quoted\-value list.
-.IP "connections" 4
-.IX Item "connections"
-This section holds the server connections you have defined. Each line is in the
-format name=properties, where the properties are a name=value list. The
-properties are self\-explanatory, and the only one that is treated specially is
-\&'pass' which is only present if 'savepass' is set. See \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R".
-.IP "active_connections" 4
-.IX Item "active_connections"
-This section holds a list of which connections are active in each mode. Each
-line is in the format mode_name=connection_list.
-.IP "server_groups" 4
-.IX Item "server_groups"
-This section holds server groups. Each line is in the format
-name=connection_list. See \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R".
-.IP "active_server_groups" 4
-.IX Item "active_server_groups"
-This section holds a list of which server group is active in each mode. Each
-line is in the format mode_name=server_group.
-.IP "max_values_seen" 4
-.IX Item "max_values_seen"
-This section holds the maximum values seen for variables. This is used to scale
-the graphs in \*(L"S: Variables & Status\*(R" mode. Each line is in the format
-name=value.
-.IP "active_columns" 4
-.IX Item "active_columns"
-This section holds table column lists. Each line is in the format
-tbl_name=column_list. See \*(L"\s-1COLUMNS\s0\*(R".
-.IP "sort_cols" 4
-.IX Item "sort_cols"
-This section holds the sort definition. Each line is in the format
-tbl_name=column_list. If a column is prefixed with '\-', that column sorts
-descending. See \*(L"\s-1SORTING\s0\*(R".
-.IP "visible_tables" 4
-.IX Item "visible_tables"
-This section defines which tables are visible in each mode. Each line is in the
-format mode_name=table_list. See \*(L"\s-1TABLES\s0\*(R".
-.IP "varsets" 4
-.IX Item "varsets"
-This section defines variable sets for use in \*(L"S: Status & Variables\*(R" mode.
-Each line is in the format name=variable_list. See \*(L"\s-1VARIABLE\s0 \s-1SETS\s0\*(R".
-.IP "colors" 4
-.IX Item "colors"
-This section defines colorization rules. Each line is in the format
-tbl_name=property_list. See \*(L"\s-1COLORS\s0\*(R".
-.IP "stmt_sleep_times" 4
-.IX Item "stmt_sleep_times"
-This section contains statement sleep times. Each line is in the format
-statement_name=sleep_time. See \*(L"S: Statement Sleep Times\*(R".
-.IP "group_by" 4
-.IX Item "group_by"
-This section contains column lists for table group_by expressions. Each line is
-in the format tbl_name=column_list. See \*(L"\s-1GROUPING\s0\*(R".
-.SH "CUSTOMIZING"
-.IX Header "CUSTOMIZING"
-You can customize innotop a great deal. For example, you can:
-.IP "\(bu" 4
-Choose which tables to display, and in what order.
-.IP "\(bu" 4
-Choose which columns are in those tables, and create new columns.
-.IP "\(bu" 4
-Filter which rows display with built-in filters, user-defined filters, and
-quick\-filters.
-.IP "\(bu" 4
-Sort the rows to put important data first or group together related rows.
-.IP "\(bu" 4
-Highlight rows with color.
-.IP "\(bu" 4
-Customize the alignment, width, and formatting of columns, and apply
-transformations to columns to extract parts of their values or format the values
-as you wish (for example, shortening large numbers to familiar units).
-.IP "\(bu" 4
-Design your own expressions to extract and combine data as you need. This gives
-you unlimited flexibility.
-.PP
-All these and more are explained in the following sections.
-.Sh "\s-1TABLES\s0"
-.IX Subsection "TABLES"
-A table is what you'd expect: a collection of columns. It also has some other
-properties, such as a caption. Filters, sorting rules, and colorization rules
-belong to tables and are covered in later sections.
-.PP
-Internally, table meta-data is defined in a data structure called \f(CW%tbl_meta\fR.
-This hash holds all built-in table definitions, which contain a lot of default
-instructions to innotop. The meta-data includes the caption, a list of columns
-the user has customized, a list of columns, a list of visible columns, a list of
-filters, color rules, a sort-column list, sort direction, and some information
-about the table's data sources. Most of this is customizable via the table
-editor (see \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R").
-.PP
-You can choose which tables to show by pressing the '$' key. See \*(L"\s-1MODES\s0\*(R" and
-\&\*(L"\s-1TABLES\s0\*(R".
-.PP
-The table life-cycle is as follows:
-.IP "\(bu" 4
-Each table begins with a data source, which is an array of hashes. See below
-for details on data sources.
-.IP "\(bu" 4
-Each element of the data source becomes a row in the final table.
-.IP "\(bu" 4
-For each element in the data source, innotop extracts values from the source and
-creates a row. This row is another hash, which later steps will refer to as
-\&\f(CW$set\fR. The values innotop extracts are determined by the table's columns. Each
-column has an extraction subroutine, compiled from an expression (see
-\&\*(L"\s-1EXPRESSIONS\s0\*(R"). The resulting row is a hash whose keys are named the same as
-the column name.
-.IP "\(bu" 4
-innotop filters the rows, removing those that don't need to be displayed. See
-\&\*(L"\s-1FILTERS\s0\*(R".
-.IP "\(bu" 4
-innotop sorts the rows. See \*(L"\s-1SORTING\s0\*(R".
-.IP "\(bu" 4
-innotop groups the rows together, if specified. See \*(L"\s-1GROUPING\s0\*(R".
-.IP "\(bu" 4
-innotop colorizes the rows. See \*(L"\s-1COLORS\s0\*(R".
-.IP "\(bu" 4
-innotop transforms the column values in each row. See \*(L"\s-1TRANSFORMATIONS\s0\*(R".
-.IP "\(bu" 4
-innotop optionally pivots the rows (see \*(L"\s-1PIVOTING\s0\*(R"), then filters and sorts
-them.
-.IP "\(bu" 4
-innotop formats and justifies the rows as a table. During this step, innotop
-applies further formatting to the column values, including alignment, maximum
-and minimum widths. innotop also does final error checking to ensure there are
-no crashes due to undefined values. innotop then adds a caption if specified,
-and the table is ready to print.
-.PP
-The lifecycle is slightly different if the table is pivoted, as noted above. To
-clarify, if the table is pivoted, the process is extract, group, transform,
-pivot, filter, sort, create. If it's not pivoted, the process is extract,
-filter, sort, group, color, transform, create. This slightly convoluted process
-doesn't map all that well to \s-1SQL\s0, but pivoting complicates things pretty
-thoroughly. Roughly speaking, filtering and sorting happen as late as needed to
-effect the final result as you might expect, but as early as possible for
-efficiency.
-.PP
-Each built-in table is described below:
-.IP "adaptive_hash_index" 4
-.IX Item "adaptive_hash_index"
-Displays data about InnoDB's adaptive hash index. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "buffer_pool" 4
-.IX Item "buffer_pool"
-Displays data about InnoDB's buffer pool. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "cmd_summary" 4
-.IX Item "cmd_summary"
-Displays weighted status variables. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "deadlock_locks" 4
-.IX Item "deadlock_locks"
-Shows which locks were held and waited for by the last detected deadlock. Data
-source: \*(L"\s-1DEADLOCK_LOCKS\s0\*(R".
-.IP "deadlock_transactions" 4
-.IX Item "deadlock_transactions"
-Shows transactions involved in the last detected deadlock. Data source:
-\&\*(L"\s-1DEADLOCK_TRANSACTIONS\s0\*(R".
-.IP "explain" 4
-.IX Item "explain"
-Shows the output of \s-1EXPLAIN\s0. Data source: \*(L"\s-1EXPLAIN\s0\*(R".
-.IP "file_io_misc" 4
-.IX Item "file_io_misc"
-Displays data about InnoDB's file and I/O operations. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "fk_error" 4
-.IX Item "fk_error"
-Displays various data about InnoDB's last foreign key error. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "innodb_locks" 4
-.IX Item "innodb_locks"
-Displays InnoDB locks. Data source: \*(L"\s-1INNODB_LOCKS\s0\*(R".
-.IP "innodb_transactions" 4
-.IX Item "innodb_transactions"
-Displays data about InnoDB's current transactions. Data source:
-\&\*(L"\s-1INNODB_TRANSACTIONS\s0\*(R".
-.IP "insert_buffers" 4
-.IX Item "insert_buffers"
-Displays data about InnoDB's insert buffer. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "io_threads" 4
-.IX Item "io_threads"
-Displays data about InnoDB's I/O threads. Data source: \*(L"\s-1IO_THREADS\s0\*(R".
-.IP "log_statistics" 4
-.IX Item "log_statistics"
-Displays data about InnoDB's logging system. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "master_status" 4
-.IX Item "master_status"
-Displays replication master status. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "open_tables" 4
-.IX Item "open_tables"
-Displays open tables. Data source: \*(L"\s-1OPEN_TABLES\s0\*(R".
-.IP "page_statistics" 4
-.IX Item "page_statistics"
-Displays InnoDB page statistics. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "pending_io" 4
-.IX Item "pending_io"
-Displays InnoDB pending I/O operations. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "processlist" 4
-.IX Item "processlist"
-Displays current MySQL processes (threads/connections). Data source:
-\&\*(L"\s-1PROCESSLIST\s0\*(R".
-.IP "q_header" 4
-.IX Item "q_header"
-Displays various status values. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "row_operation_misc" 4
-.IX Item "row_operation_misc"
-Displays data about InnoDB's row operations. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "row_operations" 4
-.IX Item "row_operations"
-Displays data about InnoDB's row operations. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "semaphores" 4
-.IX Item "semaphores"
-Displays data about InnoDB's semaphores and mutexes. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "slave_io_status" 4
-.IX Item "slave_io_status"
-Displays data about the slave I/O thread. Data source:
-\&\*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "slave_sql_status" 4
-.IX Item "slave_sql_status"
-Displays data about the slave \s-1SQL\s0 thread. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "t_header" 4
-.IX Item "t_header"
-Displays various InnoDB status values. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "var_status" 4
-.IX Item "var_status"
-Displays user-configurable data. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R".
-.IP "wait_array" 4
-.IX Item "wait_array"
-Displays data about InnoDB's \s-1OS\s0 wait array. Data source: \*(L"\s-1OS_WAIT_ARRAY\s0\*(R".
-.Sh "\s-1COLUMNS\s0"
-.IX Subsection "COLUMNS"
-Columns belong to tables. You can choose a table's columns by pressing the '^'
-key, which starts the \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R" and lets you choose and edit columns.
-Pressing 'e' from within the table editor lets you edit the column's properties:
-.IP "\(bu" 4
-hdr: a column header. This appears in the first row of the table.
-.IP "\(bu" 4
-just: justification. '\-' means left-justified and '' means right\-justified,
-just as with printf formatting codes (not a coincidence).
-.IP "\(bu" 4
-dec: whether to further align the column on the decimal point.
-.IP "\(bu" 4
-num: whether the column is numeric. This affects how values are sorted
-(lexically or numerically).
-.IP "\(bu" 4
-label: a small note about the column, which appears in dialogs that help the
-user choose columns.
-.IP "\(bu" 4
-src: an expression that innotop uses to extract the column's data from its
-source (see \*(L"\s-1DATA\s0 \s-1SOURCES\s0\*(R"). See \*(L"\s-1EXPRESSIONS\s0\*(R" for more on expressions.
-.IP "\(bu" 4
-minw: specifies a minimum display width. This helps stabilize the display,
-which makes it easier to read if the data is changing frequently.
-.IP "\(bu" 4
-maxw: similar to minw.
-.IP "\(bu" 4
-trans: a list of column transformations. See \*(L"\s-1TRANSFORMATIONS\s0\*(R".
-.IP "\(bu" 4
-agg: an aggregate function. See \*(L"\s-1GROUPING\s0\*(R". The default is \*(L"first\*(R".
-.IP "\(bu" 4
-aggonly: controls whether the column only shows when grouping is enabled on the
-table (see \*(L"\s-1GROUPING\s0\*(R"). By default, this is disabled. This means columns
-will always be shown by default, whether grouping is enabled or not. If a
-column's aggonly is set true, the column will appear when you toggle grouping on
-the table. Several columns are set this way, such as the count column on
-\&\*(L"processlist\*(R" and \*(L"innodb_transactions\*(R", so you don't see a count when the
-grouping isn't enabled, but you do when it is.
-.Sh "\s-1FILTERS\s0"
-.IX Subsection "FILTERS"
-Filters remove rows from the display. They behave much like a \s-1WHERE\s0 clause in
-\&\s-1SQL\s0. innotop has several built-in filters, which remove irrelevant information
-like inactive queries, but you can define your own as well. innotop also lets
-you create quick\-filters, which do not get saved to the configuration file, and
-are just an easy way to quickly view only some rows.
-.PP
-You can enable or disable a filter on any table. Press the '%' key (mnemonic: %
-looks kind of like a line being filtered between two circles) and choose which
-table you want to filter, if asked. You'll then see a list of possible filters
-and a list of filters currently enabled for that table. Type the names of
-filters you want to apply and press Enter.
-.PP
-\fIUSER-DEFINED \s-1FILTERS\s0\fR
-.IX Subsection "USER-DEFINED FILTERS"
-.PP
-If you type a name that doesn't exist, innotop will prompt you to create the
-filter. Filters are easy to create if you know Perl, and not hard if you don't.
-What you're doing is creating a subroutine that returns true if the row should
-be displayed. The row is a hash reference passed to your subroutine as \f(CW$set\fR.
-.PP
-For example, imagine you want to filter the processlist table so you only see
-queries that have been running more than five minutes. Type a new name for your
-filter, and when prompted for the subroutine body, press \s-1TAB\s0 to initiate your
-terminal's auto\-completion. You'll see the names of the columns in the
-\&\*(L"processlist\*(R" table (innotop generally tries to help you with auto-completion
-lists). You want to filter on the 'time' column. Type the text \*(L"$set\->{time} >
-300\*(R" to return true when the query is more than five minutes old. That's all
-you need to do.
-.PP
-In other words, the code you're typing is surrounded by an implicit context,
-which looks like this:
-.PP
-.Vb 4
-\& sub filter {
-\& my ( $set ) = @_;
-\& # YOUR CODE HERE
-\& }
-.Ve
-.PP
-If your filter doesn't work, or if something else suddenly behaves differently,
-you might have made an error in your filter, and innotop is silently catching
-the error. Try enabling \*(L"debug\*(R" to make innotop throw an error instead.
-.PP
-\fIQUICK-FILTERS\fR
-.IX Subsection "QUICK-FILTERS"
-.PP
-innotop's quick-filters are a shortcut to create a temporary filter that doesn't
-persist when you restart innotop. To create a quick\-filter, press the '/' key.
-innotop will prompt you for the column name and filter text. Again, you can use
-auto-completion on column names. The filter text can be just the text you want
-to \*(L"search for.\*(R" For example, to filter the \*(L"processlist\*(R" table on queries
-that refer to the products table, type '/' and then 'info product'.
-.PP
-The filter text can actually be any Perl regular expression, but of course a
-literal string like 'product' works fine as a regular expression.
-.PP
-Behind the scenes innotop compiles the quick-filter into a specially tagged
-filter that is otherwise like any other filter. It just isn't saved to the
-configuration file.
-.PP
-To clear quick\-filters, press the '\e' key and innotop will clear them all at
-once.
-.Sh "\s-1SORTING\s0"
-.IX Subsection "SORTING"
-innotop has sensible built-in defaults to sort the most important rows to the
-top of the table. Like anything else in innotop, you can customize how any
-table is sorted.
-.PP
-To start the sort dialog, start the \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R" with the '^' key, choose a
-table if necessary, and press the 's' key. You'll see a list of columns you can
-use in the sort expression and the current sort expression, if any. Enter a
-list of columns by which you want to sort and press Enter. If you want to
-reverse sort, prefix the column name with a minus sign. For example, if you
-want to sort by column a ascending, then column b descending, type 'a \-b'. You
-can also explicitly add a + in front of columns you want to sort ascending, but
-it's not required.
-.PP
-Some modes have keys mapped to open this dialog directly, and to quickly reverse
-sort direction. Press '?' as usual to see which keys are mapped in any mode.
-.Sh "\s-1GROUPING\s0"
-.IX Subsection "GROUPING"
-innotop can group, or aggregate, rows together (I use the terms
-interchangeably). This is quite similar to an \s-1SQL\s0 \s-1GROUP\s0 \s-1BY\s0 clause. You can
-specify to group on certain columns, or if you don't specify any, the entire set
-of rows is treated as one group. This is quite like \s-1SQL\s0 so far, but unlike \s-1SQL\s0,
-you can also select un-grouped columns. innotop actually aggregates every
-column. If you don't explicitly specify a grouping function, the default is
-\&'first'. This is basically a convenience so you don't have to specify an
-aggregate function for every column you want in the result.
-.PP
-You can quickly toggle grouping on a table with the '=' key, which toggles its
-aggregate property. This property doesn't persist to the config file.
-.PP
-The columns by which the table is grouped are specified in its group_by
-property. When you turn grouping on, innotop places the group_by columns at the
-far left of the table, even if they're not supposed to be visible. The rest of
-the visible columns appear in order after them.
-.PP
-Two tables have default group_by lists and a count column built in:
-\&\*(L"processlist\*(R" and \*(L"innodb_transactions\*(R". The grouping is by connection
-and status, so you can quickly see how many queries or transactions are in a
-given status on each server you're monitoring. The time columns are aggregated
-as a sum; other columns are left at the default 'first' aggregation.
-.PP
-By default, the table shown in \*(L"S: Variables & Status\*(R" mode also uses
-grouping so you can monitor variables and status across many servers. The
-default aggregation function in this mode is 'avg'.
-.PP
-Valid grouping functions are defined in the \f(CW%agg_funcs\fR hash. They include
-.IP "first" 4
-.IX Item "first"
-Returns the first element in the group.
-.IP "count" 4
-.IX Item "count"
-Returns the number of elements in the group, including undefined elements, much
-like \s-1SQL\s0's \s-1COUNT\s0(*).
-.IP "avg" 4
-.IX Item "avg"
-Returns the average of defined elements in the group.
-.IP "sum" 4
-.IX Item "sum"
-Returns the sum of elements in the group.
-.PP
-Here's an example of grouping at work. Suppose you have a very busy server with
-hundreds of open connections, and you want to see how many connections are in
-what status. Using the built-in grouping rules, you can press 'Q' to enter
-\&\*(L"Q: Query List\*(R" mode. Press '=' to toggle grouping (if necessary, select the
-\&\*(L"processlist\*(R" table when prompted).
-.PP
-Your display might now look like the following:
-.PP
-.Vb 1
-\& Query List (? for help) localhost, 32:33, 0.11 QPS, 1 thd, 5.0.38\-log
-.Ve
-.PP
-.Vb 5
-\& CXN Cmd Cnt ID User Host Time Query
-\& localhost Query 49 12933 webusr localhost 19:38 SELECT * FROM
-\& localhost Sending Da 23 2383 webusr localhost 12:43 SELECT col1,
-\& localhost Sleep 120 140 webusr localhost 5:18:12
-\& localhost Statistics 12 19213 webusr localhost 01:19 SELECT * FROM
-.Ve
-.PP
-That's actually quite a worrisome picture. You've got a lot of idle connections
-(Sleep), and some connections executing queries (Query and Sending Data).
-That's okay, but you also have a lot in Statistics status, collectively spending
-over a minute. That means the query optimizer is having a really hard time
-optimizing your statements. Something is wrong; it should normally take
-milliseconds to optimize queries. You might not have seen this pattern if you
-didn't look at your connections in aggregate. (This is a made-up example, but
-it can happen in real life).
-.Sh "\s-1PIVOTING\s0"
-.IX Subsection "PIVOTING"
-innotop can pivot a table for more compact display, similar to a Pivot Table in
-a spreadsheet (also known as a crosstab). Pivoting a table makes columns into
-rows. Assume you start with this table:
-.PP
-.Vb 4
-\& foo bar
-\& === ===
-\& 1 3
-\& 2 4
-.Ve
-.PP
-After pivoting, the table will look like this:
-.PP
-.Vb 4
-\& name set0 set1
-\& ==== ==== ====
-\& foo 1 2
-\& bar 3 4
-.Ve
-.PP
-To get reasonable results, you might need to group as well as pivoting.
-innotop currently does this for \*(L"S: Variables & Status\*(R" mode.
-.Sh "\s-1COLORS\s0"
-.IX Subsection "COLORS"
-By default, innotop highlights rows with color so you can see at a glance which
-rows are more important. You can customize the colorization rules and add your
-own to any table. Open the table editor with the '^' key, choose a table if
-needed, and press 'o' to open the color editor dialog.
-.PP
-The color editor dialog displays the rules applied to the table, in the order
-they are evaluated. Each row is evaluated against each rule to see if the rule
-matches the row; if it does, the row gets the specified color, and no further
-rules are evaluated. The rules look like the following:
-.PP
-.Vb 9
-\& state eq Locked black on_red
-\& cmd eq Sleep white
-\& user eq system user white
-\& cmd eq Connect white
-\& cmd eq Binlog Dump white
-\& time > 600 red
-\& time > 120 yellow
-\& time > 60 green
-\& time > 30 cyan
-.Ve
-.PP
-This is the default rule set for the \*(L"processlist\*(R" table. In order of
-priority, these rules make locked queries black on a red background, \*(L"gray out\*(R"
-connections from replication and sleeping queries, and make queries turn from
-cyan to red as they run longer.
-.PP
-(For some reason, the \s-1ANSI\s0 color code \*(L"white\*(R" is actually a light gray. Your
-terminal's display may vary; experiment to find colors you like).
-.PP
-You can use keystrokes to move the rules up and down, which re-orders their
-priority. You can also delete rules and add new ones. If you add a new rule,
-innotop prompts you for the column, an operator for the comparison, a value
-against which to compare the column, and a color to assign if the rule matches.
-There is auto-completion and prompting at each step.
-.PP
-The value in the third step needs to be correctly quoted. innotop does not try
-to quote the value because it doesn't know whether it should treat the value as
-a string or a number. If you want to compare the column against a string, as
-for example in the first rule above, you should enter 'Locked' surrounded by
-quotes. If you get an error message about a bareword, you probably should have
-quoted something.
-.Sh "\s-1EXPRESSIONS\s0"
-.IX Subsection "EXPRESSIONS"
-Expressions are at the core of how innotop works, and are what enables you to
-extend innotop as you wish. Recall the table lifecycle explained in
-\&\*(L"\s-1TABLES\s0\*(R". Expressions are used in the earliest step, where it extracts
-values from a data source to form rows.
-.PP
-It does this by calling a subroutine for each column, passing it the source data
-set, a set of current values, and a set of previous values. These are all
-needed so the subroutine can calculate things like the difference between this
-tick and the previous tick.
-.PP
-The subroutines that extract the data from the set are compiled from
-expressions. This gives significantly more power than just naming the values to
-fill the columns, because it allows the column's value to be calculated from
-whatever data is necessary, but avoids the need to write complicated and lengthy
-Perl code.
-.PP
-innotop begins with a string of text that can look as simple as a value's name
-or as complicated as a full-fledged Perl expression. It looks at each
-\&'bareword' token in the string and decides whether it's supposed to be a key
-into the \f(CW$set\fR hash. A bareword is an unquoted value that isn't already
-surrounded by code-ish things like dollar signs or curly brackets. If innotop
-decides that the bareword isn't a function or other valid Perl code, it converts
-it into a hash access. After the whole string is processed, innotop compiles a
-subroutine, like this:
-.PP
-.Vb 5
-\& sub compute_column_value {
-\& my ( $set, $cur, $pre ) = @_;
-\& my $val = # EXPANDED STRING GOES HERE
-\& return $val;
-\& }
-.Ve
-.PP
-Here's a concrete example, taken from the header table \*(L"q_header\*(R" in \*(L"Q: Query List\*(R" mode. This expression calculates the qps, or Queries Per Second,
-column's values, from the values returned by \s-1SHOW\s0 \s-1STATUS:\s0
-.PP
-.Vb 1
-\& Questions/Uptime_hires
-.Ve
-.PP
-innotop decides both words are barewords, and transforms this expression into
-the following Perl code:
-.PP
-.Vb 1
-\& $set\->{Questions}/$set\->{Uptime_hires}
-.Ve
-.PP
-When surrounded by the rest of the subroutine's code, this is executable Perl
-that calculates a high-resolution queries-per-second value.
-.PP
-The arguments to the subroutine are named \f(CW$set\fR, \f(CW$cur\fR, and \f(CW$pre\fR. In most cases,
-\&\f(CW$set\fR and \f(CW$cur\fR will be the same values. However, if \*(L"status_inc\*(R" is set, \f(CW$cur\fR
-will not be the same as \f(CW$set\fR, because \f(CW$set\fR will already contain values that are
-the incremental difference between \f(CW$cur\fR and \f(CW$pre\fR.
-.PP
-Every column in innotop is computed by subroutines compiled in the same fashion.
-There is no difference between innotop's built-in columns and user-defined
-columns. This keeps things consistent and predictable.
-.Sh "\s-1TRANSFORMATIONS\s0"
-.IX Subsection "TRANSFORMATIONS"
-Transformations change how a value is rendered. For example, they can take a
-number of seconds and display it in H:M:S format. The following transformations
-are defined:
-.IP "commify" 4
-.IX Item "commify"
-Adds commas to large numbers every three decimal places.
-.IP "dulint_to_int" 4
-.IX Item "dulint_to_int"
-Accepts two unsigned integers and converts them into a single longlong. This is
-useful for certain operations with InnoDB, which uses two integers as
-transaction identifiers, for example.
-.IP "no_ctrl_char" 4
-.IX Item "no_ctrl_char"
-Removes quoted control characters from the value. This is affected by the
-\&\*(L"charset\*(R" configuration variable.
-.Sp
-This transformation only operates within quoted strings, for example, values to
-a \s-1SET\s0 clause in an \s-1UPDATE\s0 statement. It will not alter the \s-1UPDATE\s0 statement,
-but will collapse the quoted string to [\s-1BINARY\s0] or [\s-1TEXT\s0], depending on the
-charset.
-.IP "percent" 4
-.IX Item "percent"
-Converts a number to a percentage by multiplying it by two, formatting it with
-\&\*(L"num_digits\*(R" digits after the decimal point, and optionally adding a percent
-sign (see \*(L"show_percent\*(R").
-.IP "secs_to_time" 4
-.IX Item "secs_to_time"
-Formats a number of seconds as time in days+hours:minutes:seconds format.
-.IP "set_precision" 4
-.IX Item "set_precision"
-Formats numbers with \*(L"num_digits\*(R" number of digits after the decimal point.
-.IP "shorten" 4
-.IX Item "shorten"
-Formats a number as a unit of 1024 (k/M/G/T) and with \*(L"num_digits\*(R" number of
-digits after the decimal point.
-.Sh "\s-1TABLE\s0 \s-1EDITOR\s0"
-.IX Subsection "TABLE EDITOR"
-The innotop table editor lets you customize tables with keystrokes. You start
-the table editor with the '^' key. If there's more than one table on the
-screen, it will prompt you to choose one of them. Once you do, innotop will
-show you something like this:
-.PP
-.Vb 1
-\& Editing table definition for Buffer Pool. Press ? for help, q to quit.
-.Ve
-.PP
-.Vb 9
-\& name hdr label src
-\& cxn CXN Connection from which cxn
-\& buf_pool_size Size Buffer pool size IB_bp_buf_poo
-\& buf_free Free Bufs Buffers free in the b IB_bp_buf_fre
-\& pages_total Pages Pages total IB_bp_pages_t
-\& pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m
-\& buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo
-\& total_mem_alloc Memory Total memory allocate IB_bp_total_m
-\& add_pool_alloc Add\(aql Pool Additonal pool alloca IB_bp_add_poo
-.Ve
-.PP
-The first line shows which table you're editing, and reminds you again to press
-\&'?' for a list of key mappings. The rest is a tabular representation of the
-table's columns, because that's likely what you're trying to edit. However, you
-can edit more than just the table's columns; this screen can start the filter
-editor, color rule editor, and more.
-.PP
-Each row in the display shows a single column in the table you're editing, along
-with a couple of its properties such as its header and source expression (see
-\&\*(L"\s-1EXPRESSIONS\s0\*(R").
-.PP
-The key mappings are Vim\-style, as in many other places. Pressing 'j' and 'k'
-moves the highlight up or down. You can then (d)elete or (e)dit the highlighted
-column. You can also (a)dd a column to the table. This actually just activates
-one of the columns already defined for the table; it prompts you to choose from
-among the columns available but not currently displayed. Finally, you can
-re-order the columns with the '+' and '\-' keys.
-.PP
-You can do more than just edit the columns with the table editor, you can also
-edit other properties, such as the table's sort expression and group-by
-expression. Press '?' to see the full list, of course.
-.PP
-If you want to really customize and create your own column, as opposed to just
-activating a built-in one that's not currently displayed, press the (n)ew key,
-and innotop will prompt you for the information it needs:
-.IP "\(bu" 4
-The column name: this needs to be a word without any funny characters, e.g. just
-letters, numbers and underscores.
-.IP "\(bu" 4
-The column header: this is the label that appears at the top of the column, in
-the table header. This can have spaces and funny characters, but be careful not
-to make it too wide and waste space on\-screen.
-.IP "\(bu" 4
-The column's data source: this is an expression that determines what data from
-the source (see \*(L"\s-1TABLES\s0\*(R") innotop will put into the column. This can just be
-the name of an item in the source, or it can be a more complex expression, as
-described in \*(L"\s-1EXPRESSIONS\s0\*(R".
-.PP
-Once you've entered the required data, your table has a new column. There is no
-difference between this column and the built-in ones; it can have all the same
-properties and behaviors. innotop will write the column's definition to the
-configuration file, so it will persist across sessions.
-.PP
-Here's an example: suppose you want to track how many times your slaves have
-retried transactions. According to the MySQL manual, the
-Slave_retried_transactions status variable gives you that data: \*(L"The total
-number of times since startup that the replication slave \s-1SQL\s0 thread has retried
-transactions. This variable was added in version 5.0.4.\*(R" This is appropriate to
-add to the \*(L"slave_sql_status\*(R" table.
-.PP
-To add the column, switch to the replication-monitoring mode with the 'M' key,
-and press the '^' key to start the table editor. When prompted, choose
-slave_sql_status as the table, then press 'n' to create the column. Type
-\&'retries' as the column name, 'Retries' as the column header, and
-\&'Slave_retried_transactions' as the source. Now the column is created, and you
-see the table editor screen again. Press 'q' to exit the table editor, and
-you'll see your column at the end of the table.
-.SH "VARIABLE SETS"
-.IX Header "VARIABLE SETS"
-Variable sets are used in \*(L"S: Variables & Status\*(R" mode to define more easily
-what variables you want to monitor. Behind the scenes they are compiled to a
-list of expressions, and then into a column list so they can be treated just
-like columns in any other table, in terms of data extraction and
-transformations. However, you're protected from the tedious details by a syntax
-that ought to feel very natural to you: a \s-1SQL\s0 \s-1SELECT\s0 list.
-.PP
-The data source for variable sets, and indeed the entire S mode, is the
-combination of \s-1SHOW\s0 \s-1STATUS\s0, \s-1SHOW\s0 \s-1VARIABLES\s0, and \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. Imagine
-that you had a huge table with one column per variable returned from those
-statements. That's the data source for variable sets. You can now query this
-data source just like you'd expect. For example:
-.PP
-.Vb 1
-\& Questions, Uptime, Questions/Uptime as QPS
-.Ve
-.PP
-Behind the scenes innotop will split that variable set into three expressions,
-compile them and turn them into a table definition, then extract as usual. This
-becomes a \*(L"variable set,\*(R" or a \*(L"list of variables you want to monitor.\*(R"
-.PP
-innotop lets you name and save your variable sets, and writes them to the
-configuration file. You can choose which variable set you want to see with the
-\&'c' key, or activate the next and previous sets with the '>' and '<' keys.
-There are many built-in variable sets as well, which should give you a good
-start for creating your own. Press 'e' to edit the current variable set, or
-just to see how it's defined. To create a new one, just press 'c' and type its
-name.
-.PP
-You may want to use some of the functions listed in \*(L"\s-1TRANSFORMATIONS\s0\*(R" to help
-format the results. In particular, \*(L"set_precision\*(R" is often useful to limit
-the number of digits you see. Extending the above example, here's how:
-.PP
-.Vb 1
-\& Questions, Uptime, set_precision(Questions/Uptime) as QPS
-.Ve
-.PP
-Actually, this still needs a little more work. If your \*(L"interval\*(R" is less
-than one second, you might be dividing by zero because Uptime is incremental in
-this mode by default. Instead, use Uptime_hires:
-.PP
-.Vb 1
-\& Questions, Uptime, set_precision(Questions/Uptime_hires) as QPS
-.Ve
-.PP
-This example is simple, but it shows how easy it is to choose which variables
-you want to monitor.
-.SH "PLUGINS"
-.IX Header "PLUGINS"
-innotop has a simple but powerful plugin mechanism by which you can extend
-or modify its existing functionality, and add new functionality. innotop's
-plugin functionality is event\-based: plugins register themselves to be called
-when events happen. They then have a chance to influence the event.
-.PP
-An innotop plugin is a Perl module placed in innotop's \*(L"plugin_dir\*(R"
-directory. On \s-1UNIX\s0 systems, you can place a symbolic link to the module instead
-of putting the actual file there. innotop automatically discovers the file. If
-there is a corresponding entry in the \*(L"plugins\*(R" configuration file section,
-innotop loads and activates the plugin.
-.PP
-The module must conform to innotop's plugin interface. Additionally, the source
-code of the module must be written in such a way that innotop can inspect the
-file and determine the package name and description.
-.Sh "Package Source Convention"
-.IX Subsection "Package Source Convention"
-innotop inspects the plugin module's source to determine the Perl package name.
-It looks for a line of the form \*(L"package Foo;\*(R" and if found, considers the
-plugin's package name to be Foo. Of course the package name can be a valid Perl
-package name, with double semicolons and so on.
-.PP
-It also looks for a description in the source code, to make the plugin editor
-more human\-friendly. The description is a comment line of the form \*(L"#
-description: Foo\*(R", where \*(L"Foo\*(R" is the text innotop will consider to be the
-plugin's description.
-.Sh "Plugin Interface"
-.IX Subsection "Plugin Interface"
-The innotop plugin interface is quite simple: innotop expects the plugin to be
-an object-oriented module it can call certain methods on. The methods are
-.IP "new(%variables)" 4
-.IX Item "new(%variables)"
-This is the plugin's constructor. It is passed a hash of innotop's variables,
-which it can manipulate (see \*(L"Plugin Variables\*(R"). It must return a reference
-to the newly created plugin object.
-.Sp
-At construction time, innotop has only loaded the general configuration and
-created the default built-in variables with their default contents (which is
-quite a lot). Therefore, the state of the program is exactly as in the innotop
-source code, plus the configuration variables from the \*(L"general\*(R" section in
-the config file.
-.Sp
-If your plugin manipulates the variables, it is changing global data, which is
-shared by innotop and all plugins. Plugins are loaded in the order they're
-listed in the config file. Your plugin may load before or after another plugin,
-so there is a potential for conflict or interaction between plugins if they
-modify data other plugins use or modify.
-.IP "\fIregister_for_events()\fR" 4
-.IX Item "register_for_events()"
-This method must return a list of events in which the plugin is interested, if
-any. See \*(L"Plugin Events\*(R" for the defined events. If the plugin returns an
-event that's not defined, the event is ignored.
-.IP "event handlers" 4
-.IX Item "event handlers"
-The plugin must implement a method named the same as each event for which it has
-registered. In other words, if the plugin returns qw(foo bar) from
-\&\fIregister_for_events()\fR, it must have \fIfoo()\fR and \fIbar()\fR methods. These methods are
-callbacks for the events. See \*(L"Plugin Events\*(R" for more details about each
-event.
-.Sh "Plugin Variables"
-.IX Subsection "Plugin Variables"
-The plugin's constructor is passed a hash of innotop's variables, which it can
-manipulate. It is probably a good idea if the plugin object saves a copy of it
-for later use. The variables are defined in the innotop variable
-\&\f(CW%pluggable_vars\fR, and are as follows:
-.IP "action_for" 4
-.IX Item "action_for"
-A hashref of key mappings. These are innotop's global hot\-keys.
-.IP "agg_funcs" 4
-.IX Item "agg_funcs"
-A hashref of functions that can be used for grouping. See \*(L"\s-1GROUPING\s0\*(R".
-.IP "config" 4
-.IX Item "config"
-The global configuration hash.
-.IP "connections" 4
-.IX Item "connections"
-A hashref of connection specifications. These are just specifications of how to
-connect to a server.
-.IP "dbhs" 4
-.IX Item "dbhs"
-A hashref of innotop's database connections. These are actual \s-1DBI\s0 connection
-objects.
-.IP "filters" 4
-.IX Item "filters"
-A hashref of filters applied to table rows. See \*(L"\s-1FILTERS\s0\*(R" for more.
-.IP "modes" 4
-.IX Item "modes"
-A hashref of modes. See \*(L"\s-1MODES\s0\*(R" for more.
-.IP "server_groups" 4
-.IX Item "server_groups"
-A hashref of server groups. See \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R".
-.IP "tbl_meta" 4
-.IX Item "tbl_meta"
-A hashref of innotop's table meta\-data, with one entry per table (see
-\&\*(L"\s-1TABLES\s0\*(R" for more information).
-.IP "trans_funcs" 4
-.IX Item "trans_funcs"
-A hashref of transformation functions. See \*(L"\s-1TRANSFORMATIONS\s0\*(R".
-.IP "var_sets" 4
-.IX Item "var_sets"
-A hashref of variable sets. See \*(L"\s-1VARIABLE\s0 \s-1SETS\s0\*(R".
-.Sh "Plugin Events"
-.IX Subsection "Plugin Events"
-Each event is defined somewhere in the innotop source code. When innotop runs
-that code, it executes the callback function for each plugin that expressed its
-interest in the event. innotop passes some data for each event. The events are
-defined in the \f(CW%event_listener_for\fR variable, and are as follows:
-.ie n .IP "extract_values($set, $cur\fR, \f(CW$pre\fR, \f(CW$tbl)" 4
-.el .IP "extract_values($set, \f(CW$cur\fR, \f(CW$pre\fR, \f(CW$tbl\fR)" 4
-.IX Item "extract_values($set, $cur, $pre, $tbl)"
-This event occurs inside the function that extracts values from a data source.
-The arguments are the set of values, the current values, the previous values,
-and the table name.
-.IP "set_to_tbl" 4
-.IX Item "set_to_tbl"
-Events are defined at many places in this subroutine, which is responsible for
-turning an arrayref of hashrefs into an arrayref of lines that can be printed to
-the screen. The events all pass the same data: an arrayref of rows and the name
-of the table being created. The events are set_to_tbl_pre_filter,
-set_to_tbl_pre_sort,set_to_tbl_pre_group, set_to_tbl_pre_colorize,
-set_to_tbl_pre_transform, set_to_tbl_pre_pivot, set_to_tbl_pre_create,
-set_to_tbl_post_create.
-.IP "draw_screen($lines)" 4
-.IX Item "draw_screen($lines)"
-This event occurs inside the subroutine that prints the lines to the screen.
-\&\f(CW$lines\fR is an arrayref of strings.
-.Sh "Simple Plugin Example"
-.IX Subsection "Simple Plugin Example"
-The easiest way to explain the plugin functionality is probably with a simple
-example. The following module adds a column to the beginning of every table and
-sets its value to 1.
-.PP
-.Vb 2
-\& use strict;
-\& use warnings FATAL => \(aqall\(aq;
-.Ve
-.PP
-.Vb 2
-\& package Innotop::Plugin::Example;
-\& # description: Adds an \(aqexample\(aq column to every table
-.Ve
-.PP
-.Vb 4
-\& sub new {
-\& my ( $class, %vars ) = @_;
-\& # Store reference to innotop\(aqs variables in $self
-\& my $self = bless { %vars }, $class;
-.Ve
-.PP
-.Vb 11
-\& # Design the example column
-\& my $col = {
-\& hdr => \(aqExample\(aq,
-\& just => \(aq\(aq,
-\& dec => 0,
-\& num => 1,
-\& label => \(aqExample\(aq,
-\& src => \(aqexample\(aq, # Get data from this column in the data source
-\& tbl => \(aq\(aq,
-\& trans => [],
-\& };
-.Ve
-.PP
-.Vb 8
-\& # Add the column to every table.
-\& my $tbl_meta = $vars{tbl_meta};
-\& foreach my $tbl ( values %$tbl_meta ) {
-\& # Add the column to the list of defined columns
-\& $tbl\->{cols}\->{example} = $col;
-\& # Add the column to the list of visible columns
-\& unshift @{$tbl\->{visible}}, \(aqexample\(aq;
-\& }
-.Ve
-.PP
-.Vb 3
-\& # Be sure to return a reference to the object.
-\& return $self;
-\& }
-.Ve
-.PP
-.Vb 5
-\& # I\(aqd like to be called when a data set is being rendered into a table, please.
-\& sub register_for_events {
-\& my ( $self ) = @_;
-\& return qw(set_to_tbl_pre_filter);
-\& }
-.Ve
-.PP
-.Vb 8
-\& # This method will be called when the event fires.
-\& sub set_to_tbl_pre_filter {
-\& my ( $self, $rows, $tbl ) = @_;
-\& # Set the example column\(aqs data source to the value 1.
-\& foreach my $row ( @$rows ) {
-\& $row\->{example} = 1;
-\& }
-\& }
-.Ve
-.PP
-.Vb 1
-\& 1;
-.Ve
-.Sh "Plugin Editor"
-.IX Subsection "Plugin Editor"
-The plugin editor lets you view the plugins innotop discovered and activate or
-deactivate them. Start the editor by pressing $ to start the configuration
-editor from any mode. Press the 'p' key to start the plugin editor. You'll see
-a list of plugins innotop discovered. You can use the 'j' and 'k' keys to move
-the highlight to the desired one, then press the * key to toggle it active or
-inactive. Exit the editor and restart innotop for the changes to take effect.
-.SH "SQL STATEMENTS"
-.IX Header "SQL STATEMENTS"
-innotop uses a limited set of \s-1SQL\s0 statements to retrieve data from MySQL for
-display. The statements are customized depending on the server version against
-which they are executed; for example, on MySQL 5 and newer, \s-1INNODB_STATUS\s0
-executes \*(L"\s-1SHOW\s0 \s-1ENGINE\s0 \s-1INNODB\s0 \s-1STATUS\s0\*(R", while on earlier versions it executes
-\&\*(L"\s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0\*(R". The statements are as follows:
-.PP
-.Vb 12
-\& Statement SQL executed
-\& =================== ===============================
-\& INNODB_STATUS SHOW [ENGINE] INNODB STATUS
-\& KILL_CONNECTION KILL
-\& KILL_QUERY KILL QUERY
-\& OPEN_TABLES SHOW OPEN TABLES
-\& PROCESSLIST SHOW FULL PROCESSLIST
-\& SHOW_MASTER_LOGS SHOW MASTER LOGS
-\& SHOW_MASTER_STATUS SHOW MASTER STATUS
-\& SHOW_SLAVE_STATUS SHOW SLAVE STATUS
-\& SHOW_STATUS SHOW [GLOBAL] STATUS
-\& SHOW_VARIABLES SHOW [GLOBAL] VARIABLES
-.Ve
-.SH "DATA SOURCES"
-.IX Header "DATA SOURCES"
-Each time innotop extracts values to create a table (see \*(L"\s-1EXPRESSIONS\s0\*(R" and
-\&\*(L"\s-1TABLES\s0\*(R"), it does so from a particular data source. Largely because of the
-complex data extracted from \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0, this is slightly messy. \s-1SHOW\s0
-\&\s-1INNODB\s0 \s-1STATUS\s0 contains a mixture of single values and repeated values that form
-nested data sets.
-.PP
-Whenever innotop fetches data from MySQL, it adds two extra bits to each set:
-cxn and Uptime_hires. cxn is the name of the connection from which the data
-came. Uptime_hires is a high-resolution version of the server's Uptime status
-variable, which is important if your \*(L"interval\*(R" setting is sub\-second.
-.PP
-Here are the kinds of data sources from which data is extracted:
-.IP "\s-1STATUS_VARIABLES\s0" 4
-.IX Item "STATUS_VARIABLES"
-This is the broadest category, into which the most kinds of data fall. It
-begins with the combination of \s-1SHOW\s0 \s-1STATUS\s0 and \s-1SHOW\s0 \s-1VARIABLES\s0, but other sources
-may be included as needed, for example, \s-1SHOW\s0 \s-1MASTER\s0 \s-1STATUS\s0 and \s-1SHOW\s0 \s-1SLAVE\s0
-\&\s-1STATUS\s0, as well as many of the non-repeated values from \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0.
-.IP "\s-1DEADLOCK_LOCKS\s0" 4
-.IX Item "DEADLOCK_LOCKS"
-This data is extracted from the transaction list in the \s-1LATEST\s0 \s-1DETECTED\s0 \s-1DEADLOCK\s0
-section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. It is nested two levels deep: transactions, then
-locks.
-.IP "\s-1DEADLOCK_TRANSACTIONS\s0" 4
-.IX Item "DEADLOCK_TRANSACTIONS"
-This data is from the transaction list in the \s-1LATEST\s0 \s-1DETECTED\s0 \s-1DEADLOCK\s0
-section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. It is nested one level deep.
-.IP "\s-1EXPLAIN\s0" 4
-.IX Item "EXPLAIN"
-This data is from the result set returned by \s-1EXPLAIN\s0.
-.IP "\s-1INNODB_TRANSACTIONS\s0" 4
-.IX Item "INNODB_TRANSACTIONS"
-This data is from the \s-1TRANSACTIONS\s0 section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0.
-.IP "\s-1IO_THREADS\s0" 4
-.IX Item "IO_THREADS"
-This data is from the list of threads in the the \s-1FILE\s0 I/O section of \s-1SHOW\s0 \s-1INNODB\s0
-\&\s-1STATUS\s0.
-.IP "\s-1INNODB_LOCKS\s0" 4
-.IX Item "INNODB_LOCKS"
-This data is from the \s-1TRANSACTIONS\s0 section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 and is nested
-two levels deep.
-.IP "\s-1OPEN_TABLES\s0" 4
-.IX Item "OPEN_TABLES"
-This data is from \s-1SHOW\s0 \s-1OPEN\s0 \s-1TABLES\s0.
-.IP "\s-1PROCESSLIST\s0" 4
-.IX Item "PROCESSLIST"
-This data is from \s-1SHOW\s0 \s-1FULL\s0 \s-1PROCESSLIST\s0.
-.IP "\s-1OS_WAIT_ARRAY\s0" 4
-.IX Item "OS_WAIT_ARRAY"
-This data is from the \s-1SEMAPHORES\s0 section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 and is nested one
-level deep. It comes from the lines that look like this:
-.Sp
-.Vb 1
-\& \-\-Thread 1568861104 has waited at btr0cur.c line 424 ....
-.Ve
-.SH "MYSQL PRIVILEGES"
-.IX Header "MYSQL PRIVILEGES"
-.IP "\(bu" 4
-You must connect to MySQL as a user who has the \s-1SUPER\s0 privilege for many of the
-functions.
-.IP "\(bu" 4
-If you don't have the \s-1SUPER\s0 privilege, you can still run some functions, but you
-won't necessarily see all the same data.
-.IP "\(bu" 4
-You need the \s-1PROCESS\s0 privilege to see the list of currently running queries in Q
-mode.
-.IP "\(bu" 4
-You need special privileges to start and stop slave servers.
-.IP "\(bu" 4
-You need appropriate privileges to create and drop the deadlock tables if needed
-(see \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R").
-.SH "SYSTEM REQUIREMENTS"
-.IX Header "SYSTEM REQUIREMENTS"
-You need Perl to run innotop, of course. You also need a few Perl modules: \s-1DBI\s0,
-DBD::mysql, Term::ReadKey, and Time::HiRes. These should be included with most
-Perl distributions, but in case they are not, I recommend using versions
-distributed with your operating system or Perl distribution, not from \s-1CPAN\s0.
-Term::ReadKey in particular has been known to cause problems if installed from
-\&\s-1CPAN\s0.
-.PP
-If you have Term::ANSIColor, innotop will use it to format headers more readably
-and compactly. (Under Microsoft Windows, you also need Win32::Console::ANSI for
-terminal formatting codes to be honored). If you install Term::ReadLine,
-preferably Term::ReadLine::Gnu, you'll get nice auto-completion support.
-.PP
-I run innotop on Gentoo GNU/Linux, Debian and Ubuntu, and I've had feedback from
-people successfully running it on Red Hat, CentOS, Solaris, and Mac \s-1OSX\s0. I
-don't see any reason why it won't work on other UNIX-ish operating systems, but
-I don't know for sure. It also runs on Windows under ActivePerl without
-problem.
-.PP
-I use innotop on MySQL versions 3.23.58, 4.0.27, 4.1.0, 4.1.22, 5.0.26, 5.1.15,
-and 5.2.3. If it doesn't run correctly for you, that is a bug and I hope you
-report it.
-.SH "FILES"
-.IX Header "FILES"
-$HOMEDIR/.innotop is used to store configuration information. Files include the
-configuration file innotop.ini, the core_dump file which contains verbose error
-messages if \*(L"debug\*(R" is enabled, and the plugins/ subdirectory.
-.SH "GLOSSARY OF TERMS"
-.IX Header "GLOSSARY OF TERMS"
-.IP "tick" 4
-.IX Item "tick"
-A tick is a refresh event, when innotop re-fetches data from connections and
-displays it.
-.SH "ACKNOWLEDGEMENTS"
-.IX Header "ACKNOWLEDGEMENTS"
-I'm grateful to the following people for various reasons, and hope I haven't
-forgotten to include anyone:
-.PP
-Allen K. Smith,
-Aurimas Mikalauskas,
-Bartosz Fenski,
-Brian Miezejewski,
-Christian Hammers,
-Cyril Scetbon,
-Dane Miller,
-David Multer,
-Dr. Frank Ullrich,
-Giuseppe Maxia,
-Google.com Site Reliability Engineers,
-Jan Pieter Kunst,
-Jari Aalto,
-Jay Pipes,
-Jeremy Zawodny,
-Johan Idren,
-Kristian Kohntopp,
-Lenz Grimmer,
-Maciej Dobrzanski,
-Michiel Betel,
-MySQL \s-1AB\s0,
-Paul McCullagh,
-Sebastien Estienne,
-Sourceforge.net,
-Steven Kreuzer,
-The Gentoo MySQL Team,
-Trevor Price,
-Yaar Schnitman,
-and probably more people I've neglected to include.
-.PP
-(If I misspelled your name, it's probably because I'm afraid of putting
-international characters into this documentation; earlier versions of Perl might
-not be able to compile it then).
-.SH "COPYRIGHT, LICENSE AND WARRANTY"
-.IX Header "COPYRIGHT, LICENSE AND WARRANTY"
-This program is copyright (c) 2006 Baron Schwartz.
-Feedback and improvements are welcome.
-.PP
-\&\s-1THIS\s0 \s-1PROGRAM\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1AND\s0 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1EXPRESS\s0 \s-1OR\s0 \s-1IMPLIED\s0
-\&\s-1WARRANTIES\s0, \s-1INCLUDING\s0, \s-1WITHOUT\s0 \s-1LIMITATION\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0
-\&\s-1MERCHANTIBILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0.
-.PP
-This program is free software; you can redistribute it and/or modify it under
-the terms of the \s-1GNU\s0 General Public License as published by the Free Software
-Foundation, version 2; \s-1OR\s0 the Perl Artistic License. On \s-1UNIX\s0 and similar
-systems, you can issue `man perlgpl' or `man perlartistic' to read these
-licenses.
-.PP
-You should have received a copy of the \s-1GNU\s0 General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, \s-1MA\s0 02111\-1307 \s-1USA\s0.
-.PP
-Execute innotop and press '!' to see this information at any time.
-.SH "AUTHOR"
-.IX Header "AUTHOR"
-Baron Schwartz.
-.SH "BUGS"
-.IX Header "BUGS"
-You can report bugs, ask for improvements, and get other help and support at
-<http://sourceforge.net/projects/innotop>. There are mailing lists, forums,
-a bug tracker, etc. Please use these instead of contacting me directly, as it
-makes my job easier and benefits others if the discussions are permanent and
-public. Of course, if you need to contact me in private, please do.
diff --git a/storage/xtradb/build/debian/additions/msql2mysql.1 b/storage/xtradb/build/debian/additions/msql2mysql.1
deleted file mode 100644
index 8fe05e7415d..00000000000
--- a/storage/xtradb/build/debian/additions/msql2mysql.1
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-msql2mysql \- MySQL importer for msql style data.
-.SH SYNOPSIS
-msql2mysql [options]
-.SH DESCRIPTION
-This program imports old msql database files.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/my.cnf b/storage/xtradb/build/debian/additions/my.cnf
deleted file mode 100644
index 997523b9c2f..00000000000
--- a/storage/xtradb/build/debian/additions/my.cnf
+++ /dev/null
@@ -1,129 +0,0 @@
-#
-# The MySQL database server configuration file.
-#
-# You can copy this to one of:
-# - "/etc/mysql/my.cnf" to set global options,
-# - "~/.my.cnf" to set user-specific options.
-#
-# One can use all long options that the program supports.
-# Run program with --help to get a list of available options and with
-# --print-defaults to see which it would actually understand and use.
-#
-# For explanations see
-# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
-
-# This will be passed to all mysql clients
-# It has been reported that passwords should be enclosed with ticks/quotes
-# escpecially if they contain "#" chars...
-# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
-[client]
-port = 3306
-socket = /var/run/mysqld/mysqld.sock
-
-# Here is entries for some specific programs
-# The following values assume you have at least 32M ram
-
-# This was formally known as [safe_mysqld]. Both versions are currently parsed.
-[mysqld_safe]
-socket = /var/run/mysqld/mysqld.sock
-nice = 0
-
-[mysqld]
-#
-# * Basic Settings
-#
-user = mysql
-pid-file = /var/run/mysqld/mysqld.pid
-socket = /var/run/mysqld/mysqld.sock
-port = 3306
-basedir = /usr
-datadir = /var/lib/mysql
-tmpdir = /tmp
-language = /usr/share/mysql/english
-skip-external-locking
-#
-# For compatibility to other Debian packages that still use
-# libmysqlclient10 and libmysqlclient12.
-old_passwords = 1
-#
-# Instead of skip-networking the default is now to listen only on
-# localhost which is more compatible and is not less secure.
-bind-address = 127.0.0.1
-#
-# * Fine Tuning
-#
-key_buffer = 16M
-max_allowed_packet = 16M
-thread_stack = 128K
-thread_cache_size = 8
-# This replaces the startup script and checks MyISAM tables if needed
-# the first time they are touched
-myisam-recover = BACKUP
-#max_connections = 100
-#table_cache = 64
-#thread_concurrency = 10
-#
-# * Query Cache Configuration
-#
-query_cache_limit = 1M
-query_cache_size = 16M
-#
-# * Logging and Replication
-#
-# Both location gets rotated by the cronjob.
-# Be aware that this log type is a performance killer.
-# As of 5.1 you can enable the at runtime!
-#log_type = FILE
-#general_log = /var/log/mysql/mysql.log
-#
-# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
-#
-# Here you can see queries with especially long duration
-#log_slow_queries = /var/log/mysql/mysql-slow.log
-#long_query_time = 2
-#log-queries-not-using-indexes
-#
-# The following can be used as easy to replay backup logs or for replication.
-# note: if you are setting up a replication slave, see README.Debian about
-# other settings you may need to change.
-#server-id = 1
-#log_bin = /var/log/mysql/mysql-bin.log
-expire_logs_days = 10
-max_binlog_size = 100M
-#binlog_do_db = include_database_name
-#binlog_ignore_db = include_database_name
-#
-# * InnoDB
-#
-# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
-# Read the manual for more InnoDB related options. There are many!
-#
-# * Security Features
-#
-# Read the manual, too, if you want chroot!
-# chroot = /var/lib/mysql/
-#
-# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
-#
-# ssl-ca=/etc/mysql/cacert.pem
-# ssl-cert=/etc/mysql/server-cert.pem
-# ssl-key=/etc/mysql/server-key.pem
-
-
-
-[mysqldump]
-quick
-quote-names
-max_allowed_packet = 16M
-
-[mysql]
-#no-auto-rehash # faster start of mysql but no tab completition
-
-[isamchk]
-key_buffer = 16M
-
-#
-# * IMPORTANT: Additional settings that can override those from this file!
-# The files must end with '.cnf', otherwise they'll be ignored.
-#
-!includedir /etc/mysql/conf.d/
diff --git a/storage/xtradb/build/debian/additions/my_print_defaults.1 b/storage/xtradb/build/debian/additions/my_print_defaults.1
deleted file mode 100644
index ebef4157016..00000000000
--- a/storage/xtradb/build/debian/additions/my_print_defaults.1
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-my_print_defaults \- MySQL helper script that prints defaults.
-.SH SYNOPSIS
-my_print_defaults [options]
-.SH DESCRIPTION
-Prints all arguments that is give to some program using the default files.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/myisam_ftdump.1 b/storage/xtradb/build/debian/additions/myisam_ftdump.1
deleted file mode 100644
index e2de358efcc..00000000000
--- a/storage/xtradb/build/debian/additions/myisam_ftdump.1
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-myisam_ftdump \- Dumps full text tables.
-.SH SYNOPSIS
-myisam_ftdump [options]
-.SH DESCRIPTION
-Dumps information and contents of full text tables.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/myisamchk.1 b/storage/xtradb/build/debian/additions/myisamchk.1
deleted file mode 100644
index fe7f34961e0..00000000000
--- a/storage/xtradb/build/debian/additions/myisamchk.1
+++ /dev/null
@@ -1,17 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-myisamchk \- Checks MySQL myisam type databases.
-.SH SYNOPSIS
-myisamchk [options]
-.SH DESCRIPTION
-Description, check and repair of ISAM tables.
-Used without options all tables on the command will be checked for errors
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/myisamlog.1 b/storage/xtradb/build/debian/additions/myisamlog.1
deleted file mode 100644
index 959d547df94..00000000000
--- a/storage/xtradb/build/debian/additions/myisamlog.1
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-myisamlog \- MySQL helper script.
-.SH SYNOPSIS
-myisamlog [options]
-.SH DESCRIPTION
-Function unknown. Mail to ch@debian.org.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/myisampack.1 b/storage/xtradb/build/debian/additions/myisampack.1
deleted file mode 100644
index 93168304a17..00000000000
--- a/storage/xtradb/build/debian/additions/myisampack.1
+++ /dev/null
@@ -1,19 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-myisampack \- Compresses MySQL database files.
-.SH SYNOPSIS
-myisampack [options]
-.SH DESCRIPTION
-Pack a MyISAM-table to take much less space.
-Keys are not updated, you must run myisamchk -rq on the datafile
-afterwards to update the keys.
-You should give the .MYI file as the filename argument.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysql-server.lintian-overrides b/storage/xtradb/build/debian/additions/mysql-server.lintian-overrides
deleted file mode 100644
index ae589c2472e..00000000000
--- a/storage/xtradb/build/debian/additions/mysql-server.lintian-overrides
+++ /dev/null
@@ -1,2 +0,0 @@
-W: mysql-dfsg source: maintainer-script-lacks-debhelper-token debian/percona-xtradb-server.postinst
-W: percona-xtradb-server: possible-bashism-in-maintainer-script postinst:68 'p{("a".."z","A".."Z",0..9)[int(rand(62))]}'
diff --git a/storage/xtradb/build/debian/additions/mysql_config.1 b/storage/xtradb/build/debian/additions/mysql_config.1
deleted file mode 100644
index 88095e22b9e..00000000000
--- a/storage/xtradb/build/debian/additions/mysql_config.1
+++ /dev/null
@@ -1,17 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysqlconfig \- MySQL compile settings.
-.SH SYNOPSIS
-mysqlconfig [options]
-.SH DESCRIPTION
-This program is only useful for people who want to compile agains
-libmysqlclient.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysql_convert_table_format.1 b/storage/xtradb/build/debian/additions/mysql_convert_table_format.1
deleted file mode 100644
index 3c23581df43..00000000000
--- a/storage/xtradb/build/debian/additions/mysql_convert_table_format.1
+++ /dev/null
@@ -1,17 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysql_convert_table_format \- MySQL table converter.
-.SH SYNOPSIS
-mysql_convert_table_format [options]
-.SH DESCRIPTION
-Conversion of a MySQL tables to other table types.
-If no tables has been specifed, all tables in the database will be converted.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysql_find_rows.1 b/storage/xtradb/build/debian/additions/mysql_find_rows.1
deleted file mode 100644
index 35a70b1f960..00000000000
--- a/storage/xtradb/build/debian/additions/mysql_find_rows.1
+++ /dev/null
@@ -1,18 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysql_find_rows \- MySQL shell skript for searching in update logs.
-.SH SYNOPSIS
-mysql_find_rows [options]
-.SH DESCRIPTION
-Prints all SQL queries that matches a regexp or contains a 'use
-database' or 'set ..' command to stdout. A SQL query may contain
-newlines. This is useful to find things in a MySQL update log.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysql_fix_extensions.1 b/storage/xtradb/build/debian/additions/mysql_fix_extensions.1
deleted file mode 100644
index 3f0a028ca3f..00000000000
--- a/storage/xtradb/build/debian/additions/mysql_fix_extensions.1
+++ /dev/null
@@ -1,18 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysql_fix_extensions \- Corrects MySQL database file names.
-.SH SYNOPSIS
-mysql_fix_extensions <datadir>
-.SH DESCRIPTION
-Makes .frm lowercase and .MYI/MYD/ISM/ISD uppercase
-useful when datafiles are copied from windows.
-Does not work with RAID, with InnoDB or BDB tables.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (8)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysql_install_db.1 b/storage/xtradb/build/debian/additions/mysql_install_db.1
deleted file mode 100644
index 11f1f2967a2..00000000000
--- a/storage/xtradb/build/debian/additions/mysql_install_db.1
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysql_install_db \- MySQL helper program.
-.SH SYNOPSIS
-mysql_install_db [options]
-.SH DESCRIPTION
-This program is normally not needed by any user.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysql_secure_installation.1 b/storage/xtradb/build/debian/additions/mysql_secure_installation.1
deleted file mode 100644
index d65b7f5d09d..00000000000
--- a/storage/xtradb/build/debian/additions/mysql_secure_installation.1
+++ /dev/null
@@ -1,17 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysql_secure_installation \- Secures the MySQL access control lists.
-.SH SYNOPSIS
-mysql_secure_installation [options]
-.SH DESCRIPTION
-This interactive programm suggests changes like removing anonymous users that
-are supposed to make your installation more secure.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (8)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysql_setpermission.1 b/storage/xtradb/build/debian/additions/mysql_setpermission.1
deleted file mode 100644
index 77167e0d58f..00000000000
--- a/storage/xtradb/build/debian/additions/mysql_setpermission.1
+++ /dev/null
@@ -1,23 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysql_setpermission \- Adds MySQL users or changes passwords.
-.SH SYNOPSIS
-mysql_setpermission [options]
-.SH DESCRIPTION
-The permission setter is a little program which can help you add users
-or databases or change passwords in MySQL. Keep in mind that we don't
-check permissions which already been set in MySQL. So if you can't
-connect to MySQL using the permission you just added, take a look at
-the permissions which have already been set in MySQL.
-
-The permission setter first reads your .my.cnf file in your Home
-directory if it exists.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysql_tableinfo.1 b/storage/xtradb/build/debian/additions/mysql_tableinfo.1
deleted file mode 100644
index 1de4f5d5943..00000000000
--- a/storage/xtradb/build/debian/additions/mysql_tableinfo.1
+++ /dev/null
@@ -1,322 +0,0 @@
-.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "MYSQL_TABLEINFO 1"
-.TH MYSQL_TABLEINFO 1 "2003-04-05" "perl v5.8.0" "User Contributed Perl Documentation"
-.SH "NAME"
-mysql_tableinfo \- creates and populates information tables with
-the output of SHOW DATABASES, SHOW TABLES (or SHOW TABLE STATUS),
-SHOW COLUMNS and SHOW INDEX.
-.PP
-This is version 1.1.
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& mysql_tableinfo [OPTIONS] database_to_write [database_like_wild] [table_like_wild]
-.Ve
-.PP
-.Vb 2
-\& Do not backquote (``) database_to_write,
-\& and do not quote ('') database_like_wild or table_like_wild
-.Ve
-.PP
-.Vb 1
-\& Examples:
-.Ve
-.PP
-.Vb 1
-\& mysql_tableinfo info
-.Ve
-.PP
-.Vb 1
-\& mysql_tableinfo info this_db
-.Ve
-.PP
-.Vb 1
-\& mysql_tableinfo info %a% b%
-.Ve
-.PP
-.Vb 1
-\& mysql_tableinfo info --clear-only
-.Ve
-.PP
-.Vb 1
-\& mysql_tableinfo info --col --idx --table-status
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-mysql_tableinfo asks a MySQL server information about its
-databases, tables, table columns and index, and stores this
-in tables called `db`, `tbl` (or `tbl_status`), `col`, `idx`
-(with an optional prefix specified with \-\-prefix).
-After that, you can query these information tables, for example
-to build your admin scripts with \s-1SQL\s0 queries, like
-.PP
-\&\s-1SELECT\s0 \s-1CONCAT\s0(\*(L"\s-1CHECK\s0 \s-1TABLE\s0 \*(R",`database`,\*(L".\*(R",`table`,\*(L" \s-1EXTENDED\s0;\*(R")
-\&\s-1FROM\s0 info.tbl \s-1WHERE\s0 ... ;
-.PP
-as people usually do with some other \s-1RDBMS\s0
-(note: to increase the speed of your queries on the info tables,
-you may add some index on them).
-.PP
-The database_like_wild and table_like_wild instructs the program
-to gather information only about databases and tables
-whose names match these patterns. If the info
-tables already exist, their rows matching the patterns are simply
-deleted and replaced by the new ones. That is,
-old rows not matching the patterns are not touched.
-If the database_like_wild and table_like_wild arguments
-are not specified on the command-line they default to \*(L"%\*(R".
-.PP
-The program :
-.PP
-\&\- does \s-1CREATE\s0 \s-1DATABASE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write
-where database_to_write is the database name specified on the command\-line.
-.PP
-\&\- does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`db`
-.PP
-\&\- fills database_to_write.`db` with the output of
-\&\s-1SHOW\s0 \s-1DATABASES\s0 \s-1LIKE\s0 database_like_wild
-.PP
-\&\- does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`tbl`
-(respectively database_to_write.`tbl_status`
-if the \-\-tbl\-status option is on)
-.PP
-\&\- for every found database,
-fills database_to_write.`tbl` (respectively database_to_write.`tbl_status`)
-with the output of
-\&\s-1SHOW\s0 \s-1TABLES\s0 \s-1FROM\s0 found_db \s-1LIKE\s0 table_like_wild
-(respectively \s-1SHOW\s0 \s-1TABLE\s0 \s-1STATUS\s0 \s-1FROM\s0 found_db \s-1LIKE\s0 table_like_wild)
-.PP
-\&\- if the \-\-col option is on,
- * does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`col`
- * for every found table,
- fills database_to_write.`col` with the output of
- \s-1SHOW\s0 \s-1COLUMNS\s0 \s-1FROM\s0 found_tbl \s-1FROM\s0 found_db
-.PP
-\&\- if the \-\-idx option is on,
- * does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`idx`
- * for every found table,
- fills database_to_write.`idx` with the output of
- \s-1SHOW\s0 \s-1INDEX\s0 \s-1FROM\s0 found_tbl \s-1FROM\s0 found_db
-.PP
-Some options may modify this general scheme (see below).
-.PP
-As mentioned, the contents of the info tables are the output of
-\&\s-1SHOW\s0 commands. In fact the contents are slightly more complete :
-.PP
-\&\- the `tbl` (or `tbl_status`) info table
- has an extra column which contains the database name,
-.PP
-\&\- the `col` info table
- has an extra column which contains the table name,
- and an extra column which contains, for each described column,
- the number of this column in the table owning it (this extra column
- is called `Seq_in_table`). `Seq_in_table` makes it possible for you
- to retrieve your columns in sorted order, when you are querying
- the `col` table.
-.PP
-\&\- the `index` info table
- has an extra column which contains the database name.
-.PP
-Caution: info tables contain certain columns (e.g.
-Database, Table, Null...) whose names, as they are MySQL reserved words,
-need to be backquoted (`...`) when used in \s-1SQL\s0 statements.
-.PP
-Caution: as information fetching and info tables filling happen at the
-same time, info tables may contain inaccurate information about
-themselves.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\-\-clear" 4
-.IX Item "--clear"
-Does \s-1DROP\s0 \s-1TABLE\s0 on the info tables (only those that the program is
-going to fill, for example if you do not use \-\-col it won't drop
-the `col` table) and processes normally. Does not drop database_to_write.
-.IP "\-\-clear\-only" 4
-.IX Item "--clear-only"
-Same as \-\-clear but exits after the DROPs.
-.IP "\-\-col" 4
-.IX Item "--col"
-Adds columns information (into table `col`).
-.IP "\-\-idx" 4
-.IX Item "--idx"
-Adds index information (into table `idx`).
-.IP "\-\-prefix prefix" 4
-.IX Item "--prefix prefix"
-The info tables are named from the concatenation of prefix and,
-respectively, db, tbl (or tbl_status), col, idx. Do not quote ('')
-or backquote (``) prefix.
-.IP "\-q, \-\-quiet" 4
-.IX Item "-q, --quiet"
-Does not warn you about what the script is going to do (\s-1DROP\s0 \s-1TABLE\s0 etc)
-and does not ask for a confirmation before starting.
-.IP "\-\-tbl\-status" 4
-.IX Item "--tbl-status"
-Instead of using \s-1SHOW\s0 \s-1TABLES\s0, uses \s-1SHOW\s0 \s-1TABLE\s0 \s-1STATUS\s0
-(much more complete information, but slower).
-.IP "\-\-help" 4
-.IX Item "--help"
-Display helpscreen and exit
-.IP "\-u, \-\-user=#" 4
-.IX Item "-u, --user=#"
-user for database login if not current user. Give a user
-who has sufficient privileges (\s-1CREATE\s0, ...).
-.IP "\-p, \-\-password=# (INSECURE)" 4
-.IX Item "-p, --password=# (INSECURE)"
-password to use when connecting to server.
-WARNING: Providing a password on command line is insecure as it is visible through /proc to anyone for a short time.
-.IP "\-h, \-\-host=#" 4
-.IX Item "-h, --host=#"
-host to connect to
-.IP "\-P, \-\-port=#" 4
-.IX Item "-P, --port=#"
-port to use when connecting to server
-.IP "\-S, \-\-socket=#" 4
-.IX Item "-S, --socket=#"
-\&\s-1UNIX\s0 domain socket to use when connecting to server
-.SH "WARRANTY"
-.IX Header "WARRANTY"
-This software is free and comes without warranty of any kind. You
-should never trust backup software without studying the code yourself.
-Study the code inside this script and only rely on it if \fIyou\fR believe
-that it does the right thing for you.
-.Sp
-Patches adding bug fixes, documentation and new features are welcome.
-.SH "TO DO"
-.IX Header "TO DO"
-Use extended inserts to be faster (for servers with many databases
-or tables). But to do that, must care about net\-buffer\-length.
-.SH "AUTHOR"
-.IX Header "AUTHOR"
-2002\-06\-18 Guilhem Bichot (guilhem.bichot@mines\-paris.org)
-.Sp
-And all the authors of mysqlhotcopy, which served as a model for
-the structure of the program.
diff --git a/storage/xtradb/build/debian/additions/mysql_waitpid.1 b/storage/xtradb/build/debian/additions/mysql_waitpid.1
deleted file mode 100644
index f6877865ba8..00000000000
--- a/storage/xtradb/build/debian/additions/mysql_waitpid.1
+++ /dev/null
@@ -1,20 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysql_waitpid \- Waits a specified amount of seconds for a PID to terminate.
-.SH SYNOPSIS
-mysql_waitpid [options] <pid> <seconds>
-.SH DESCRIPTION
-Description: Waits for a program, which program id is #pid, to
-terminate within #time seconds. If the program terminates within
-this time, or if the #pid no longer exists, value 0 is returned.
-Otherwise 1 is returned. Both #pid and #time must be positive
-integer arguments.
-
-See mysql_waitpid for options.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysqlbinlog.1 b/storage/xtradb/build/debian/additions/mysqlbinlog.1
deleted file mode 100644
index fcdf2a083f4..00000000000
--- a/storage/xtradb/build/debian/additions/mysqlbinlog.1
+++ /dev/null
@@ -1,17 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysqlbinlog \- Dumps MySQL binary logs.
-.SH SYNOPSIS
-mysqlbinlog [options]
-.SH DESCRIPTION
-Dumps a MySQL binary log in a format usable for viewing or for pipeing to
-the mysql command line client
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysqlbug.1 b/storage/xtradb/build/debian/additions/mysqlbug.1
deleted file mode 100644
index 133330dd897..00000000000
--- a/storage/xtradb/build/debian/additions/mysqlbug.1
+++ /dev/null
@@ -1,14 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysqlbug \- MySQL bug reporting tool.
-.SH SYNOPSIS
-mysqlbug [options]
-.SH DESCRIPTION
-Interactive bug reporting tool. Use reportbug on Debian systems.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysqlcheck.1 b/storage/xtradb/build/debian/additions/mysqlcheck.1
deleted file mode 100644
index b36ba2d1eb1..00000000000
--- a/storage/xtradb/build/debian/additions/mysqlcheck.1
+++ /dev/null
@@ -1,28 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysqlcheck \- MySQL program for repairing, checking and optimizing tables.
-.SH SYNOPSIS
-mysqlcheck | mysqlanalyze | mysqloptimize [options]
-.SH DESCRIPTION
-This program can be used to CHECK (-c,-m,-C), REPAIR (-r), ANALYZE (-a)
-or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be
-used same time. It works on MyISAM and in some cases on BDB tables.
-Please consult the MySQL manual for latest information about the
-above. The options -c,-r,-a and -o are exclusive to each other, which
-means that the last option will be used, if several was specified.
-
-The option -c will be used by default, if none was specified. You
-can change the default behavior by making a symbolic link, or
-copying this file somewhere with another name, the alternatives are:
-mysqlrepair: The default option will be -r
-mysqlanalyze: The default option will be -a
-mysqloptimize: The default option will be -o
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (8)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysqld_safe_syslog.cnf b/storage/xtradb/build/debian/additions/mysqld_safe_syslog.cnf
deleted file mode 100644
index 3b0445d6bd8..00000000000
--- a/storage/xtradb/build/debian/additions/mysqld_safe_syslog.cnf
+++ /dev/null
@@ -1,2 +0,0 @@
-[mysqld_safe]
-syslog
diff --git a/storage/xtradb/build/debian/additions/mysqldumpslow.1 b/storage/xtradb/build/debian/additions/mysqldumpslow.1
deleted file mode 100644
index 0431ef04cbb..00000000000
--- a/storage/xtradb/build/debian/additions/mysqldumpslow.1
+++ /dev/null
@@ -1,50 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysqldumpslow \- Parse and summarize the MySQL slow query log.
-.SH SYNOPSIS
-mysqldumpslow [options]
-.SH DESCRIPTION
-This program parses and summarizes a 'slow query log'.
-
-.TP
-\fB\-v\fR
-verbose
-.TP
-\fB\-d\fR
-debug
-.TP
-\fB\-s=WORD\fR
-what to sort by (t, at, l, al, r, ar etc)
-.TP
-\fB\-r\fR
-reverse the sort order (largest last instead of first)
-.TP
-\fB\-t=NUMBER\fR
-just show the top n queries
-.TP
-\fB\-a\fR
-don't abstract all numbers to N and strings to 'S'
-.TP
-\fB\-n=NUMBER\fR
-abstract numbers with at least n digits within names
-.TP
-\fB\-g=WORD\fR
-grep: only consider stmts that include this string
-.TP
-\fB\-h=WORD\fR
-hostname of db server for *-slow.log filename (can be wildcard)
-.TP
-\fB\-i=WORD\fR
-name of server instance (if using mysql.server startup script)
-.TP
-\fB\-l\fR
-don't subtract lock time from total time
-
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org> based on
-the commends in the code.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysqlimport.1 b/storage/xtradb/build/debian/additions/mysqlimport.1
deleted file mode 100644
index 9007307a328..00000000000
--- a/storage/xtradb/build/debian/additions/mysqlimport.1
+++ /dev/null
@@ -1,20 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysqlimport \- Imports text files with MySQL database queries.
-.SH SYNOPSIS
-mysqlimport [options]
-.SH DESCRIPTION
-Loads tables from text files in various formats. The base name of the
-text file must be the name of the table that should be used.
-If one uses sockets to connect to the MySQL server, the server will open and
-read the text file directly. In other cases the client will open the text
-file. The SQL command 'LOAD DATA INFILE' is used to import the rows.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/mysqlmanager.1 b/storage/xtradb/build/debian/additions/mysqlmanager.1
deleted file mode 100644
index ebb69adbd09..00000000000
--- a/storage/xtradb/build/debian/additions/mysqlmanager.1
+++ /dev/null
@@ -1,49 +0,0 @@
-.TH mysql 1 "March 2005" "MySQL 4.1" "MySQL database"
-.SH NAME
-mysqlmanager \- Manages instances of MySQL server.
-.SH SYNOPSIS
-.B mysqlmanager
-[\fIOPTIONS\fR]
-.SH DESCRIPTION
-Manages instances of MySQL server.
-.TP
-\-?, \fB\-\-help\fR
-Display this help and exit.
-.TP
-\fB\-P\fR, \fB\-\-port=\fR#
-Port number to listen on.
-.TP
-\fB\-l\fR, \fB\-\-log\fR=\fIname\fR
-Path to log file.
-.TP
-\fB\-b\fR, \fB\-\-bind\-address=\fR#
-Address to listen on.
-.HP
-\fB\-B\fR, \fB\-\-tcp\-backlog=\fR# Size of TCP/IP listen queue.
-.HP
-\fB\-g\fR, \fB\-\-greeting\fR=\fIname\fR Set greeting on connect.
-.TP
-\fB\-m\fR, \fB\-\-max\-command\-len=\fR#
-Maximum command length.
-.TP
-\fB\-d\fR, \fB\-\-one\-thread\fR
-Use one thread ( for debugging).
-.TP
-\fB\-C\fR, \fB\-\-connect\-retries=\fR#
-Number of attempts to establish MySQL connection.
-.TP
-\fB\-p\fR, \fB\-\-password\-file\fR=\fIname\fR
-Password file for manager.
-.HP
-\fB\-f\fR, \fB\-\-pid\-file\fR=\fIname\fR Pid file to use.
-.TP
-\fB\-V\fR, \fB\-\-version\fR
-Output version information and exit.
-.SH "SEE ALSO"
-The full documentation for
-.B mysqlmanager
-is available in the package mysql-doc-4.1 or on the MySQL
-homepage www.mysql.com.
-.SH AUTHOR
-This manpage was created by Christian Hammers <ch@debian.org>
-using help2man.
diff --git a/storage/xtradb/build/debian/additions/mysqlreport b/storage/xtradb/build/debian/additions/mysqlreport
deleted file mode 100644
index 402a5be835d..00000000000
--- a/storage/xtradb/build/debian/additions/mysqlreport
+++ /dev/null
@@ -1,1298 +0,0 @@
-#!/usr/bin/perl -w
-
-# mysqlreport v3.5 Apr 16 2008
-# http://hackmysql.com/mysqlreport
-
-# mysqlreport makes an easy-to-read report of important MySQL status values.
-# Copyright 2006-2008 Daniel Nichter
-#
-# 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; either version 2
-# of the License, or (at your option) any later version.
-#
-# 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.
-#
-# The GNU General Public License is available at:
-# http://www.gnu.org/copyleft/gpl.html
-
-use strict;
-use File::Temp qw(tempfile);
-use DBI;
-use Getopt::Long;
-eval { require Term::ReadKey; };
-my $RK = ($@ ? 0 : 1);
-
-sub have_op;
-
-my $WIN = ($^O eq 'MSWin32' ? 1 : 0);
-my %op;
-my %mycnf; # ~/.my.cnf
-my ($tmpfile_fh, $tmpfile);
-my ($stat_name, $stat_val, $stat_label);
-my $MySQL_version;
-my (%stats, %vars); # SHOW STATUS, SHOW VARIABLES
-my (%DMS_vals, %Com_vals, %ib_vals);
-my ($dbh, $query);
-my ($questions, $key_read_ratio, $key_write_ratio, $dms, $slow_query_t);
-my ($key_cache_block_size, $key_buffer_used, $key_buffer_usage);
-my ($qc_mem_used, $qc_hi_r, $qc_ip_r); # Query Cache
-my $have_innodb_vals;
-my ($ib_bp_used, $ib_bp_total, $ib_bp_read_ratio);
-my ($relative_live, $relative_infiles);
-my $real_uptime;
-my (%stats_present, %stats_past); # For relative reports
-
-GetOptions (
- \%op,
- "user=s",
- "password:s",
- "host=s",
- "port=s",
- "socket=s",
- "no-mycnf",
- "infile|in=s",
- "outfile=s",
- "flush-status",
- "email=s",
- "r|relative:i",
- "c|report-count=i",
- "detach",
- "help|?",
- "debug"
-);
-
-show_help_and_exit() if $op{'help'};
-
-get_user_mycnf() unless $op{'no-mycnf'};
-
-# Command line options override ~/.my.cnf
-$mycnf{'host'} = $op{'host'} if have_op 'host';
-$mycnf{'port'} = $op{'port'} if have_op 'port';
-$mycnf{'socket'} = $op{'socket'} if have_op 'socket';
-$mycnf{'user'} = $op{'user'} if have_op 'user';
-
-$mycnf{'user'} ||= $ENV{'USER'};
-
-if(exists $op{'password'})
-{
- if($op{'password'} eq '') # Prompt for password
- {
- Term::ReadKey::ReadMode(2) if $RK;
- print "Password for database user $mycnf{'user'}: ";
- chomp($mycnf{'pass'} = <STDIN>);
- Term::ReadKey::ReadMode(0), print "\n" if $RK;
- }
- else { $mycnf{'pass'} = $op{'password'}; } # Use password given on command line
-}
-
-$op{'com'} ||= 3;
-$op{'c'} ||= 1; # Used in collect_reports() if --r given integer value
-
-$relative_live = 0;
-$relative_infiles = 0;
-
-if(defined $op{'r'})
-{
- if($op{r}) { $relative_live = 1; } # if -r was given an integer value
- else { $relative_infiles = 1; }
-}
-
-# The report is written to a tmp file first.
-# Later it will be moved to $op{'outfile'} or emailed $op{'email'} if needed.
-($tmpfile_fh, $tmpfile) = tempfile() or die "Cannot open temporary file for writing: $!\n";
-
-if($op{'detach'})
-{
- $SIG{'TERM'} = 'sig_handler';
-
- if(fork())
- {
- print "mysqlreport has forked and detached.\n";
- print "While running detached, mysqlreport writes reports to '$tmpfile'.\n";
-
- exit;
- }
-
- open(STDIN, "</dev/null");
- open(STDOUT, "> $tmpfile") or die "Cannot dup STDOUT: $!\n";
- open(STDERR, "> $tmpfile") or die "Cannot dup STDERR: $!\n";
-}
-
-select $tmpfile_fh;
-$| = 1 if ($op{'detach'} || $relative_live);
-
-print "tmp file: $tmpfile\n" if $op{debug};
-
-# Connect to MySQL
-if(!$op{'infile'} && !$relative_infiles)
-{
- connect_to_MySQL();
-}
-
-$have_innodb_vals = 1; # This might be set to 0 later in get_MySQL_version()
-
-if(defined $op{'r'})
-{
- if($relative_live)
- {
- print STDERR "mysqlreport is writing relative reports to '$tmpfile'.\n" unless $op{'detach'};
- get_MySQL_version();
- collect_reports();
- }
-
- if($relative_infiles) { read_relative_infiles(); }
-}
-else
-{
- if(!$op{'infile'})
- {
- get_MySQL_version();
- get_vals();
- get_vars();
- }
- else
- {
- read_infile($op{'infile'});
- }
-
- get_Com_values();
-
- set_myisam_vals();
- set_ib_vals() if $have_innodb_vals;
-
- write_report();
-}
-
-exit_tasks_and_cleanup();
-
-exit;
-
-#
-# Subroutines
-#
-sub show_help_and_exit
-{
- print <<"HELP";
-mysqlreport v3.5 Apr 16 2008
-mysqlreport makes an easy-to-read report of important MySQL status values.
-
-Command line options (abbreviations work):
- --user USER Connect to MySQL as USER
- --password PASS Use PASS or prompt for MySQL user's password
- --host ADDRESS Connect to MySQL at ADDRESS
- --port PORT Connect to MySQL at PORT
- --socket SOCKET Connect to MySQL at SOCKET
- --no-mycnf Don't read ~/.my.cnf
- --infile FILE Read status values from FILE instead of MySQL
- --outfile FILE Write report to FILE
- --email ADDRESS Email report to ADDRESS (doesn't work on Windows)
- --flush-status Issue FLUSH STATUS; after getting current values
- --relative X Generate relative reports. If X is an integer,
- reports are live from the MySQL server X seconds apart.
- If X is a list of infiles (file1 file2 etc.),
- reports are generated from the infiles in the order
- that they are given.
- --report-count N Collect N number of live relative reports (default 1)
- --detach Fork and detach from terminal (run in background)
- --help Prints this
- --debug Print debugging information
-
-Visit http://hackmysql.com/mysqlreport for more information.
-HELP
-
- exit;
-}
-
-sub get_user_mycnf
-{
- print "get_user_mycnf\n" if $op{debug};
-
- return if $WIN;
- open MYCNF, "$ENV{HOME}/.my.cnf" or return;
- while(<MYCNF>)
- {
- if(/^(.+?)\s*=\s*"?(.+?)"?\s*$/)
- {
- $mycnf{$1} = $2;
- print "get_user_mycnf: read '$1 = $2'\n" if $op{debug};
- }
- }
- $mycnf{'pass'} ||= $mycnf{'password'} if exists $mycnf{'password'};
- close MYCNF;
-}
-
-sub connect_to_MySQL
-{
- print "connect_to_MySQL\n" if $op{debug};
-
- my $dsn;
-
- if($mycnf{'socket'} && -S $mycnf{'socket'})
- {
- $dsn = "DBI:mysql:mysql_socket=$mycnf{socket}";
- }
- elsif($mycnf{'host'})
- {
- $dsn = "DBI:mysql:host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : "");
- }
- else
- {
- $dsn = "DBI:mysql:host=localhost";
- }
-
- print "connect_to_MySQL: DBI DSN: $dsn\n" if $op{debug};
-
- $dbh = DBI->connect($dsn, $mycnf{'user'}, $mycnf{'pass'}) or die;
-}
-
-sub collect_reports
-{
- print "collect_reports\n" if $op{debug};
-
- my $i;
-
- get_vals();
- get_vars();
-
- get_Com_values();
-
- %stats_past = %stats;
-
- set_myisam_vals();
- set_ib_vals() if $have_innodb_vals;
-
- print "#\n# Beginning report, 0 0:0:0\n#\n";
-
- write_report();
-
- for($i = 0; $i < $op{'c'}; $i++)
- {
- $dbh->disconnect();
-
- sleep($op{'r'});
-
- connect_to_MySQL();
-
- print "\n#\n# Interval report " , $i + 1 , ", +", sec_to_dhms(($i + 1) * $op{'r'}), "\n#\n";
-
- get_vals();
-
- write_relative_report();
- }
-}
-
-sub read_relative_infiles
-{
- print "read_relative_infiles\n" if $op{debug};
-
- my $slurp; # Used to check infiles for multiple sets of status values
- my $n_stats; # Number of multiple sets of status values in an infile
- my $infile;
- my $report_n; # Report number
-
- $report_n = 1;
-
- foreach $infile (@ARGV)
- {
- # Read all of infile into $slurp
- open INFILE, "< $infile" or warn and next;
- $slurp = do { local $/; <INFILE> };
- close INFILE;
-
- $n_stats = 0;
-
- # Count number of status value sets
- $n_stats++ while $slurp =~ /Aborted_clients/g;
-
- print "read_relative_infiles: found $n_stats sets of status values in file '$infile'\n"
- if $op{debug};
-
- if($n_stats == 1)
- {
- read_infile($infile);
- relative_infile_report($report_n++);
- }
-
- if($n_stats > 1)
- {
- my @tmpfile_fh;
- my @tmpfile_name;
- my $i;
- my $stat_n; # Status value set number
-
- # Create a tmp file for each set of status values
- for($i = 0; $i < $n_stats; $i++)
- {
- my ($fh, $name) = tempfile()
- or die "read_relative_infiles: cannot open temporary file for writing: $!\n";
-
- push(@tmpfile_fh, $fh);
- push(@tmpfile_name, $name);
-
- print "read_relative_infiles: created tmp file '$name' for set $i\n" if $op{debug};
- }
-
- $i = 0;
- $stat_n = 0;
-
- select $tmpfile_fh[$i];
-
- # Read infile again and copy each set of status values to seperate tmp files
- open INFILE, "< $infile" or warn and next;
- while(<INFILE>)
- {
- next if /^\+/;
- next if /^$/;
-
- # The infile must begin with the system variable values.
- # Therefore, the first occurance of Aborted_clients indicates the beginning
- # of the first set of status values if no sets have occured yet ($stat_n == 0).
- # In this case, the following status values are printed to the current fh,
- # along with the system variable values read thus far, until Aborted_clients
- # occurs again. Then begins the second and subsequent sets of status values.
-
- if(/Aborted_clients/)
- {
- print and next if $stat_n++ == 0;
- select $tmpfile_fh[++$i];
- }
-
- print;
- }
- close INFILE;
-
- # Re-select the main tmp file into which the reports are being written.
- select $tmpfile_fh;
-
- for($i = 0; $i < $n_stats; $i++)
- {
- close $tmpfile_fh[$i];
-
- print "read_relative_infiles: reading set $i tmp file '$tmpfile_name[$i]'\n"
- if $op{debug};
-
- read_infile($tmpfile_name[$i]);
- relative_infile_report($report_n++);
-
- if($WIN) { `del $tmpfile_name[$i]`; }
- else { `rm -f $tmpfile_name[$i]`; }
-
- print "read_relative_infiles: deleted set $i tmp file '$tmpfile_name[$i]'\n"
- if $op{debug};
- }
-
- } # if($n_stats > 1)
- } # foreach $infile (@files)
-}
-
-sub relative_infile_report
-{
- print "relative_infile_report\n" if $op{debug};
-
- my $report_n = shift;
-
- if($report_n == 1)
- {
- get_Com_values();
-
- %stats_past = %stats;
-
- set_myisam_vals();
- set_ib_vals() if $have_innodb_vals;
-
- print "#\n# Beginning report, 0 0:0:0\n#\n";
-
- write_report();
- }
- else
- {
- print "\n#\n# Interval report ", $report_n - 1, ", +",
- sec_to_dhms($stats{Uptime} - $stats_past{Uptime}),
- "\n#\n";
-
- write_relative_report();
- }
-}
-
-sub get_vals
-{
- print "get_vals\n" if $op{debug};
-
- my @row;
-
- # Get status values
- if($MySQL_version >= 50002)
- {
- $query = $dbh->prepare("SHOW GLOBAL STATUS;");
- }
- else
- {
- $query = $dbh->prepare("SHOW STATUS;");
- }
- $query->execute();
- while(@row = $query->fetchrow_array()) { $stats{$row[0]} = $row[1]; }
-
- $real_uptime = $stats{'Uptime'};
-}
-
-sub get_vars
-{
- print "get_vars\n" if $op{debug};
-
- my @row;
-
- # Get server system variables
- $query = $dbh->prepare("SHOW VARIABLES;");
- $query->execute();
- while(@row = $query->fetchrow_array()) { $vars{$row[0]} = $row[1]; }
-
- # table_cache was renamed to table_open_cache in MySQL 5.1.3
- if($MySQL_version >= 50103)
- {
- $vars{'table_cache'} = $vars{'table_open_cache'};
- }
-}
-
-sub read_infile
-{
- print "read_infile\n" if $op{debug};
-
- my $infile = shift;
-
- # Default required system variable values if not set in INFILE.
- # As of mysqlreport v3.5 the direct output from SHOW VARIABLES;
- # can be put into INFILE instead. See http://hackmysql.com/mysqlreportdoc
- # for details.
- $vars{'version'} = "0.0.0" if !exists $vars{'version'};
- $vars{'table_cache'} = 64 if !exists $vars{'table_cache'};
- $vars{'max_connections'} = 100 if !exists $vars{'max_connections'};
- $vars{'key_buffer_size'} = 8388600 if !exists $vars{'key_buffer_size'}; # 8M
- $vars{'thread_cache_size'} = 0 if !exists $vars{'thread_cache_size'};
- $vars{'tmp_table_size'} = 0 if !exists $vars{'tmp_table_size'};
- $vars{'long_query_time'} = '?' if !exists $vars{'long_query_time'};
- $vars{'log_slow_queries'} = '?' if !exists $vars{'log_slow_queries'};
-
- # One should also add:
- # key_cache_block_size
- # query_cache_size
- # to INFILE if needed.
-
- open INFILE, "< $infile" or die "Cannot open INFILE '$infile': $!\n";
-
- while(<INFILE>)
- {
- last if !defined $_;
-
- next if /^\+/; # skip divider lines
- next if /^$/; # skip blank lines
-
- next until /(Aborted_clients|back_log|=)/;
-
- if($1 eq 'Aborted_clients') # status values
- {
- print "read_infile: start stats\n" if $op{debug};
-
- while($_)
- {
- chomp;
- if(/([A-Za-z_]+)[\s\t|]+(\d+)/)
- {
- $stats{$1} = $2;
- print "read_infile: save $1 = $2\n" if $op{debug};
- }
- else { print "read_infile: ignore '$_'\n" if $op{debug}; }
-
- last if $1 eq 'Uptime'; # exit while() if end of status values
- $_ = <INFILE>; # otherwise, read next line of status values
- }
- }
- elsif($1 eq 'back_log') # system variable values
- {
- print "read_infile: start vars\n" if $op{debug};
-
- while($_)
- {
- chomp;
- if(/([A-Za-z_]+)[\s\t|]+([\w\.\-]+)/) # This will exclude some vars
- { # like pid_file which we don't need
- $vars{$1} = $2;
- print "read_infile: save $1 = $2\n" if $op{debug};
- }
- else { print "read_infile: ignore '$_'\n" if $op{debug}; }
-
- last if $1 eq 'wait_timeout'; # exit while() if end of vars
- $_ = <INFILE>; # otherwise, read next line of vars
- }
- }
- elsif($1 eq '=') # old style, manually added system variable values
- {
- print "read_infile: start old vars\n" if $op{debug};
-
- while($_ && $_ =~ /=/)
- {
- chomp;
- if(/^\s*(\w+)\s*=\s*([0-9.]+)(M*)\s*$/) # e.g.: key_buffer_size = 128M
- {
- $vars{$1} = ($3 ? $2 * 1024 * 1024 : $2);
- print "read_infile: read '$_' as $1 = $vars{$1}\n" if $op{debug};
- }
- else { print "read_infile: ignore '$_'\n" if $op{debug}; }
-
- $_ = <INFILE>; # otherwise, read next line of old vars
- }
-
- redo;
- }
- else
- {
- print "read_infile: unrecognized line: '$_'\n" if $op{debug};
- }
- }
-
- close INFILE;
-
- $real_uptime = $stats{'Uptime'};
-
- $vars{'table_cache'} = $vars{'table_open_cache'} if exists $vars{'table_open_cache'};
-
- get_MySQL_version();
-}
-
-sub get_MySQL_version
-{
- print "get_MySQL_version\n" if $op{debug};
-
- return if $MySQL_version;
-
- my ($major, $minor, $patch);
-
- if($op{'infile'} || $relative_infiles)
- {
- ($major, $minor, $patch) = ($vars{'version'} =~ /(\d{1,2})\.(\d{1,2})\.(\d{1,2})/);
- }
- else
- {
- my @row;
-
- $query = $dbh->prepare("SHOW VARIABLES LIKE 'version';");
- $query->execute();
- @row = $query->fetchrow_array();
- ($major, $minor, $patch) = ($row[1] =~ /(\d{1,2})\.(\d{1,2})\.(\d{1,2})/);
- }
-
- $MySQL_version = sprintf("%d%02d%02d", $major, $minor, $patch);
-
- # Innodb_ status values were added in 5.0.2
- if($MySQL_version < 50002)
- {
- $have_innodb_vals = 0;
- print "get_MySQL_version: no InnoDB reports because MySQL version is older than 5.0.2\n" if $op{debug};
- }
-}
-
-sub set_myisam_vals
-{
- print "set_myisam_vals\n" if $op{debug};
-
- $questions = $stats{'Questions'};
-
- $key_read_ratio = sprintf "%.2f",
- ($stats{'Key_read_requests'} ?
- 100 - ($stats{'Key_reads'} / $stats{'Key_read_requests'}) * 100 :
- 0);
-
- $key_write_ratio = sprintf "%.2f",
- ($stats{'Key_write_requests'} ?
- 100 - ($stats{'Key_writes'} / $stats{'Key_write_requests'}) * 100 :
- 0);
-
- $key_cache_block_size = (defined $vars{'key_cache_block_size'} ?
- $vars{'key_cache_block_size'} :
- 1024);
-
- $key_buffer_used = $stats{'Key_blocks_used'} * $key_cache_block_size;
-
- if(defined $stats{'Key_blocks_unused'}) # MySQL 4.1.2+
- {
- $key_buffer_usage = $vars{'key_buffer_size'} -
- ($stats{'Key_blocks_unused'} * $key_cache_block_size);
- }
- else { $key_buffer_usage = -1; }
-
- # Data Manipulation Statements: http://dev.mysql.com/doc/refman/5.0/en/data-manipulation.html
- %DMS_vals =
- (
- SELECT => $stats{'Com_select'},
- INSERT => $stats{'Com_insert'} + $stats{'Com_insert_select'},
- REPLACE => $stats{'Com_replace'} + $stats{'Com_replace_select'},
- UPDATE => $stats{'Com_update'} +
- (exists $stats{'Com_update_multi'} ? $stats{'Com_update_multi'} : 0),
- DELETE => $stats{'Com_delete'} +
- (exists $stats{'Com_delete_multi'} ? $stats{'Com_delete_multi'} : 0)
- );
-
- $dms = $DMS_vals{SELECT} + $DMS_vals{INSERT} + $DMS_vals{REPLACE} + $DMS_vals{UPDATE} + $DMS_vals{DELETE};
-
- $slow_query_t = format_u_time($vars{long_query_time});
-
-}
-
-sub set_ib_vals
-{
- print "set_ib_vals\n" if $op{debug};
-
- $ib_bp_used = ($stats{'Innodb_buffer_pool_pages_total'} -
- $stats{'Innodb_buffer_pool_pages_free'}) *
- $stats{'Innodb_page_size'};
-
- $ib_bp_total = $stats{'Innodb_buffer_pool_pages_total'} * $stats{'Innodb_page_size'};
-
- $ib_bp_read_ratio = sprintf "%.2f",
- ($stats{'Innodb_buffer_pool_read_requests'} ?
- 100 - ($stats{'Innodb_buffer_pool_reads'} /
- $stats{'Innodb_buffer_pool_read_requests'}) * 100 :
- 0);
-}
-
-sub write_relative_report
-{
- print "write_relative_report\n" if $op{debug};
-
- %stats_present = %stats;
-
- for(keys %stats)
- {
- if($stats_past{$_} =~ /\d+/)
- {
- if($stats_present{$_} >= $stats_past{$_}) # Avoid negative values
- {
- $stats{$_} = $stats_present{$_} - $stats_past{$_};
- }
- }
- }
-
- # These values are either "at present" or "high water marks".
- # Therefore, it is more logical to not relativize these values.
- # Doing otherwise causes strange and misleading values.
- $stats{'Key_blocks_used'} = $stats_present{'Key_blocks_used'};
- $stats{'Open_tables'} = $stats_present{'Open_tables'};
- $stats{'Max_used_connections'} = $stats_present{'Max_used_connections'};
- $stats{'Threads_running'} = $stats_present{'Threads_running'};
- $stats{'Threads_connected'} = $stats_present{'Threads_connected'};
- $stats{'Threads_cached'} = $stats_present{'Threads_cached'};
- $stats{'Qcache_free_blocks'} = $stats_present{'Qcache_free_blocks'};
- $stats{'Qcache_total_blocks'} = $stats_present{'Qcache_total_blocks'};
- $stats{'Qcache_free_memory'} = $stats_present{'Qcache_free_memory'};
- if($have_innodb_vals)
- {
- $stats{'Innodb_page_size'} = $stats_present{'Innodb_page_size'};
- $stats{'Innodb_buffer_pool_pages_data'} = $stats_present{'Innodb_buffer_pool_pages_data'};
- $stats{'Innodb_buffer_pool_pages_dirty'} = $stats_present{'Innodb_buffer_pool_pages_dirty'};
- $stats{'Innodb_buffer_pool_pages_free'} = $stats_present{'Innodb_buffer_pool_pages_free'};
- $stats{'Innodb_buffer_pool_pages_latched'} = $stats_present{'Innodb_buffer_pool_pages_latched'};
- $stats{'Innodb_buffer_pool_pages_misc'} = $stats_present{'Innodb_buffer_pool_pages_misc'};
- $stats{'Innodb_buffer_pool_pages_total'} = $stats_present{'Innodb_buffer_pool_pages_total'};
- $stats{'Innodb_data_pending_fsyncs'} = $stats_present{'Innodb_data_pending_fsyncs'};
- $stats{'Innodb_data_pending_reads'} = $stats_present{'Innodb_data_pending_reads'};
- $stats{'Innodb_data_pending_writes'} = $stats_present{'Innodb_data_pending_writes'};
-
- # Innodb_row_lock_ values were added in MySQL 5.0.3
- if($MySQL_version >= 50003)
- {
- $stats{'Innodb_row_lock_current_waits'} = $stats_present{'Innodb_row_lock_current_waits'};
- $stats{'Innodb_row_lock_time_avg'} = $stats_present{'Innodb_row_lock_time_avg'};
- $stats{'Innodb_row_lock_time_max'} = $stats_present{'Innodb_row_lock_time_max'};
- }
- }
-
- get_Com_values();
-
- %stats_past = %stats_present;
-
- set_myisam_vals();
- set_ib_vals() if $have_innodb_vals;
-
- write_report();
-}
-
-sub write_report
-{
- print "write_report\n" if $op{debug};
-
- $~ = 'MYSQL_TIME', write;
- $~ = 'KEY_BUFF_MAX', write;
- if($key_buffer_usage != -1) { $~ = 'KEY_BUFF_USAGE', write }
- $~ = 'KEY_RATIOS', write;
- write_DTQ();
- $~ = 'SLOW_DMS', write;
- write_DMS();
- write_Com();
- $~ = 'SAS', write;
- write_qcache();
- $~ = 'REPORT_END', write;
- $~ = 'TAB', write;
-
- write_InnoDB() if $have_innodb_vals;
-}
-
-sub sec_to_dhms # Seconds to days hours:minutes:seconds
-{
- my $s = shift;
- my ($d, $h, $m) = (0, 0, 0);
-
- return '0 0:0:0' if $s <= 0;
-
- if($s >= 86400)
- {
- $d = int $s / 86400;
- $s -= $d * 86400;
- }
-
- if($s >= 3600)
- {
- $h = int $s / 3600;
- $s -= $h * 3600;
- }
-
- $m = int $s / 60;
- $s -= $m * 60;
-
- return "$d $h:$m:$s";
-}
-
-sub make_short
-{
- my ($number, $kb, $d) = @_;
- my $n = 0;
- my $short;
-
- $d ||= 2;
-
- if($kb) { while ($number > 1023) { $number /= 1024; $n++; }; }
- else { while ($number > 999) { $number /= 1000; $n++; }; }
-
- $short = sprintf "%.${d}f%s", $number, ('','k','M','G','T')[$n];
- if($short =~ /^(.+)\.(00)$/) { return $1; } # 12.00 -> 12 but not 12.00k -> 12k
-
- return $short;
-}
-
-# What began as a simple but great idea has become the new standard:
-# long_query_time in microseconds. For MySQL 5.1.21+ and 6.0.4+ this
-# is now standard. For 4.1 and 5.0 patches, the architects of this
-# idea provide: http://www.mysqlperformanceblog.com/mysql-patches/
-# Relevant notes in MySQL manual:
-# http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html
-# http://dev.mysql.com/doc/refman/6.0/en/slow-query-log.html
-#
-# The format_u_time sub simply beautifies long_query_time.
-
-sub format_u_time # format microsecond (µ) time value
-{
- # 0.000000 - 0.000999 = 0 - 999 µ
- # 0.001000 - 0.999999 = 1 ms - 999.999 ms
- # 1.000000 - n.nnnnnn = 1 s - n.nnnnn s
-
- my $t = shift;
- my $f; # formatted µ time
- my $u = chr(($WIN ? 230 : 181));
-
- $t = 0 if $t < 0;
-
- if($t > 0 && $t <= 0.000999)
- {
- $f = ($t * 1000000) . " $u";
- }
- elsif($t >= 0.001000 && $t <= 0.999999)
- {
- $f = ($t * 1000) . ' ms';
- }
- elsif($t >= 1)
- {
- $f = ($t * 1) . ' s'; # * 1 to remove insignificant zeros
- }
- else
- {
- $f = 0; # $t should = 0 at this point
- }
-
- return $f;
-}
-
-sub perc # Percentage
-{
- my($is, $of) = @_;
- $is = 0 if (not defined $is);
- return sprintf "%.2f", ($is * 100) / ($of ||= 1);
-}
-
-sub t # Time average per second
-{
- my $val = shift;
- return 0 if !$val;
- return(make_short($val / $stats{'Uptime'}, 0, 1));
-}
-
-sub email_report # Email given report to $op{'email'}
-{
- print "email_report\n" if $op{debug};
-
- return if $WIN;
-
- my $report = shift;
-
- open SENDMAIL, "|/usr/sbin/sendmail -t";
- print SENDMAIL "From: mysqlreport\n";
- print SENDMAIL "To: $op{email}\n";
- print SENDMAIL "Subject: MySQL status report on " . ($mycnf{'host'} || 'localhost') . "\n\n";
- print SENDMAIL `cat $report`;
- close SENDMAIL;
-}
-
-sub cat_report # Print given report to screen
-{
- print "cat_report\n" if $op{debug};
-
- my $report = shift;
- my @report;
-
- open REPORT, "< $report";
- @report = <REPORT>;
- close REPORT;
- print @report;
-}
-
-sub get_Com_values
-{
- print "get_Com_values\n" if $op{debug};
-
- %Com_vals = ();
-
- # Make copy of just the Com_ values
- for(keys %stats)
- {
- if(grep /^Com_/, $_ and $stats{$_} > 0)
- {
- /^Com_(.*)/;
- $Com_vals{$1} = $stats{$_};
- }
- }
-
- # Remove DMS values
- delete $Com_vals{'select'};
- delete $Com_vals{'insert'};
- delete $Com_vals{'insert_select'};
- delete $Com_vals{'replace'};
- delete $Com_vals{'replace_select'};
- delete $Com_vals{'update'};
- delete $Com_vals{'update_multi'} if exists $Com_vals{'update_multi'};
- delete $Com_vals{'delete'};
- delete $Com_vals{'delete_multi'} if exists $Com_vals{'delete_multi'};
-}
-
-sub write_DTQ # Write DTQ report in descending order by values
-{
- print "write_DTQ\n" if $op{debug};
-
- $~ = 'DTQ';
-
- my %DTQ;
- my $first = 1;
-
- # Total Com values
- $stat_val = 0;
- for(values %Com_vals) { $stat_val += $_; }
- $DTQ{'Com_'} = $stat_val;
-
- $DTQ{'DMS'} = $dms;
- $DTQ{'QC Hits'} = $stats{'Qcache_hits'} if $stats{'Qcache_hits'} != 0;
- $DTQ{'COM_QUIT'} = int (($stats{'Connections'} - 2) - ($stats{'Aborted_clients'} / 2));
-
- $stat_val = 0;
- for(values %DTQ) { $stat_val += $_; }
- if($questions != $stat_val)
- {
- $DTQ{($questions > $stat_val ? '+Unknown' : '-Unknown')} = abs $questions - $stat_val;
- }
-
- for(sort { $DTQ{$b} <=> $DTQ{$a} } keys(%DTQ))
- {
- if($first) { $stat_label = '%Total:'; $first = 0; }
- else { $stat_label = ''; }
-
- $stat_name = $_;
- $stat_val = $DTQ{$_};
- write;
- }
-}
-
-sub write_DMS # Write DMS report in descending order by values
-{
- print "write_DMS\n" if $op{debug};
-
- $~ = 'DMS';
-
- for(sort { $DMS_vals{$b} <=> $DMS_vals{$a} } keys(%DMS_vals))
- {
- $stat_name = $_;
- $stat_val = $DMS_vals{$_};
- write;
- }
-}
-
-sub write_Com # Write COM report in descending order by values
-{
- print "write_Com\n" if $op{debug};
-
- my $i = $op{'com'};
-
- $~ = 'COM_1';
-
- # Total Com values and write first line of COM report
- $stat_label = '%Total:' unless $op{'dtq'};
- $stat_val = 0;
- for(values %Com_vals) { $stat_val += $_; }
- write;
-
- $~ = 'COM_2';
-
- # Sort remaining Com values, print only the top $op{'com'} number of values
- for(sort { $Com_vals{$b} <=> $Com_vals{$a} } keys(%Com_vals))
- {
- $stat_name = $_;
- $stat_val = $Com_vals{$_};
- write;
-
- last if !(--$i);
- }
-}
-
-sub write_qcache
-{
- print "write_qcache\n" if $op{debug};
-
- # Query cache was added in 4.0.1, but have_query_cache was added in 4.0.2,
- # ergo this method is slightly more reliable
- return if not exists $vars{'query_cache_size'};
- return if $vars{'query_cache_size'} == 0;
-
- $qc_mem_used = $vars{'query_cache_size'} - $stats{'Qcache_free_memory'};
- $qc_hi_r = sprintf "%.2f", $stats{'Qcache_hits'} / ($stats{'Qcache_inserts'} ||= 1);
- $qc_ip_r = sprintf "%.2f", $stats{'Qcache_inserts'} / ($stats{'Qcache_lowmem_prunes'} ||= 1);
-
- $~ = 'QCACHE';
- write;
-}
-
-sub write_InnoDB
-{
- print "write_InnoDB\n" if $op{debug};
-
- return if not defined $stats{'Innodb_page_size'};
-
- $stats{'Innodb_buffer_pool_pages_latched'} = 0 if not defined $stats{'Innodb_buffer_pool_pages_latched'};
-
- $~ = 'IB';
- write;
-
- # Innodb_row_lock_ values were added in MySQL 5.0.3
- if($MySQL_version >= 50003)
- {
- $~ = 'IB_LOCK';
- write;
- }
-
- # Data, Pages, Rows
- $~ = 'IB_DPR';
- write;
-}
-
-sub have_op
-{
- my $key = shift;
- return 1 if (exists $op{$key} && $op{$key} ne '');
- return 0;
-}
-
-sub sig_handler
-{
- print "\nReceived signal at " , scalar localtime , "\n";
- exit_tasks_and_cleanup();
- exit;
-}
-
-sub exit_tasks_and_cleanup
-{
- print "exit_tasks_and_cleanup\n" if $op{debug};
-
- close $tmpfile_fh;
- select STDOUT unless $op{'detach'};
-
- email_report($tmpfile) if $op{'email'};
-
- cat_report($tmpfile) unless $op{'detach'};
-
- if($op{'outfile'})
- {
- if($WIN) { `move $tmpfile $op{outfile}`; }
- else { `mv $tmpfile $op{outfile}`; }
- }
- else
- {
- if($WIN) { `del $tmpfile`; }
- else { `rm -f $tmpfile`; }
- }
-
- if(!$op{'infile'} && !$relative_infiles)
- {
- if($op{'flush-status'})
- {
- $query = $dbh->prepare("FLUSH STATUS;");
- $query->execute();
- }
-
- $query->finish();
- $dbh->disconnect();
- }
-}
-
-#
-# Formats
-#
-
-format MYSQL_TIME =
-MySQL @<<<<<<<<<<<<<<<< uptime @<<<<<<<<<<< @>>>>>>>>>>>>>>>>>>>>>>>>
-$vars{'version'}, sec_to_dhms($real_uptime), (($op{infile} || $relative_infiles) ? '' : scalar localtime)
-.
-
-format KEY_BUFF_MAX =
-
-__ Key _________________________________________________________________
-Buffer used @>>>>>> of @>>>>>> %Used: @>>>>>
-make_short($key_buffer_used, 1), make_short($vars{'key_buffer_size'}, 1), perc($key_buffer_used, $vars{'key_buffer_size'})
-.
-
-format KEY_BUFF_USAGE =
- Current @>>>>>> %Usage: @>>>>>
-make_short($key_buffer_usage, 1), perc($key_buffer_usage, $vars{'key_buffer_size'})
-.
-
-format KEY_RATIOS =
-Write hit @>>>>>%
-$key_write_ratio
-Read hit @>>>>>%
-$key_read_ratio
-
-__ Questions ___________________________________________________________
-Total @>>>>>>>> @>>>>>/s
-make_short($questions), t($questions)
-.
-
-format DTQ =
- @<<<<<<< @>>>>>>>> @>>>>>/s @>>>>>> @>>>>>
-$stat_name, make_short($stat_val), t($stat_val), $stat_label, perc($stat_val, $questions)
-.
-
-format SLOW_DMS =
-Slow @<<<<<<< @>>>>>> @>>>>>/s @>>>>> %DMS: @>>>>> Log: @>>
-$slow_query_t, make_short($stats{'Slow_queries'}), t($stats{'Slow_queries'}), perc($stats{'Slow_queries'}, $questions), perc($stats{'Slow_queries'}, $dms), $vars{'log_slow_queries'}
-DMS @>>>>>>>> @>>>>>/s @>>>>>
-make_short($dms), t($dms), perc($dms, $questions)
-.
-
-format DMS =
- @<<<<<<< @>>>>>>>> @>>>>>/s @>>>>> @>>>>>
-$stat_name, make_short($stat_val), t($stat_val), perc($stat_val, $questions), perc($stat_val, $dms)
-.
-
-format COM_1 =
-Com_ @>>>>>>>> @>>>>>/s @>>>>>
-make_short($stat_val), t($stat_val), perc($stat_val, $questions)
-.
-
-format COM_2 =
- @<<<<<<<<<< @>>>>>> @>>>>>/s @>>>>>
-$stat_name, make_short($stat_val), t($stat_val), perc($stat_val, $questions)
-.
-
-format SAS =
-
-__ SELECT and Sort _____________________________________________________
-Scan @>>>>>> @>>>>/s %SELECT: @>>>>>
-make_short($stats{'Select_scan'}), t($stats{'Select_scan'}), perc($stats{'Select_scan'}, $stats{'Com_select'})
-Range @>>>>>> @>>>>/s @>>>>>
-make_short($stats{'Select_range'}), t($stats{'Select_range'}), perc($stats{'Select_range'}, $stats{'Com_select'})
-Full join @>>>>>> @>>>>/s @>>>>>
-make_short($stats{'Select_full_join'}), t($stats{'Select_full_join'}), perc($stats{'Select_full_join'}, $stats{'Com_select'})
-Range check @>>>>>> @>>>>/s @>>>>>
-make_short($stats{'Select_range_check'}), t($stats{'Select_range_check'}), perc($stats{'Select_range_check'}, $stats{'Com_select'})
-Full rng join @>>>>>> @>>>>/s @>>>>>
-make_short($stats{'Select_full_range_join'}), t($stats{'Select_full_range_join'}), perc($stats{'Select_full_range_join'}, $stats{'Com_select'})
-Sort scan @>>>>>> @>>>>/s
-make_short($stats{'Sort_scan'}), t($stats{'Sort_scan'})
-Sort range @>>>>>> @>>>>/s
-make_short($stats{'Sort_range'}), t($stats{'Sort_range'})
-Sort mrg pass @>>>>>> @>>>>/s
-make_short($stats{'Sort_merge_passes'}), t($stats{'Sort_merge_passes'})
-.
-
-format QCACHE =
-
-__ Query Cache _________________________________________________________
-Memory usage @>>>>>> of @>>>>>> %Used: @>>>>>
-make_short($qc_mem_used, 1), make_short($vars{'query_cache_size'}, 1), perc($qc_mem_used, $vars{'query_cache_size'})
-Block Fragmnt @>>>>>%
-perc($stats{'Qcache_free_blocks'}, $stats{'Qcache_total_blocks'})
-Hits @>>>>>> @>>>>/s
-make_short($stats{'Qcache_hits'}), t($stats{'Qcache_hits'})
-Inserts @>>>>>> @>>>>/s
-make_short($stats{'Qcache_inserts'}), t($stats{'Qcache_inserts'})
-Insrt:Prune @>>>>>>:1 @>>>>/s
-make_short($qc_ip_r), t($stats{'Qcache_inserts'} - $stats{'Qcache_lowmem_prunes'})
-Hit:Insert @>>>>>>:1
-$qc_hi_r, t($qc_hi_r)
-.
-
-# Not really the end...
-format REPORT_END =
-
-__ Table Locks _________________________________________________________
-Waited @>>>>>>>> @>>>>>/s %Total: @>>>>>
-make_short($stats{'Table_locks_waited'}), t($stats{'Table_locks_waited'}), perc($stats{'Table_locks_waited'}, $stats{'Table_locks_waited'} + $stats{'Table_locks_immediate'});
-Immediate @>>>>>>>> @>>>>>/s
-make_short($stats{'Table_locks_immediate'}), t($stats{'Table_locks_immediate'})
-
-__ Tables ______________________________________________________________
-Open @>>>>>>>> of @>>> %Cache: @>>>>>
-$stats{'Open_tables'}, $vars{'table_cache'}, perc($stats{'Open_tables'}, $vars{'table_cache'})
-Opened @>>>>>>>> @>>>>>/s
-make_short($stats{'Opened_tables'}), t($stats{'Opened_tables'})
-
-__ Connections _________________________________________________________
-Max used @>>>>>>>> of @>>> %Max: @>>>>>
-$stats{'Max_used_connections'}, $vars{'max_connections'}, perc($stats{'Max_used_connections'}, $vars{'max_connections'})
-Total @>>>>>>>> @>>>>>/s
-make_short($stats{'Connections'}), t($stats{'Connections'})
-
-__ Created Temp ________________________________________________________
-Disk table @>>>>>>>> @>>>>>/s
-make_short($stats{'Created_tmp_disk_tables'}), t($stats{'Created_tmp_disk_tables'})
-Table @>>>>>>>> @>>>>>/s Size: @>>>>>
-make_short($stats{'Created_tmp_tables'}), t($stats{'Created_tmp_tables'}), make_short($vars{'tmp_table_size'}, 1, 1)
-File @>>>>>>>> @>>>>>/s
-make_short($stats{'Created_tmp_files'}), t($stats{'Created_tmp_files'})
-.
-
-format TAB =
-
-__ Threads _____________________________________________________________
-Running @>>>>>>>> of @>>>
-$stats{'Threads_running'}, $stats{'Threads_connected'}
-Cached @>>>>>>>> of @>>> %Hit: @>>>>>
-$stats{'Threads_cached'}, $vars{'thread_cache_size'}, make_short(100 - perc($stats{'Threads_created'}, $stats{'Connections'}))
-Created @>>>>>>>> @>>>>>/s
-make_short($stats{'Threads_created'}), t($stats{'Threads_created'})
-Slow @>>>>>>>> @>>>>>/s
-$stats{'Slow_launch_threads'}, t($stats{'Slow_launch_threads'})
-
-__ Aborted _____________________________________________________________
-Clients @>>>>>>>> @>>>>>/s
-make_short($stats{'Aborted_clients'}), t($stats{'Aborted_clients'})
-Connects @>>>>>>>> @>>>>>/s
-make_short($stats{'Aborted_connects'}), t($stats{'Aborted_connects'})
-
-__ Bytes _______________________________________________________________
-Sent @>>>>>>>> @>>>>>/s
-make_short($stats{'Bytes_sent'}), t($stats{'Bytes_sent'})
-Received @>>>>>>>> @>>>>>/s
-make_short($stats{'Bytes_received'}), t($stats{'Bytes_received'})
-.
-
-format IB =
-
-__ InnoDB Buffer Pool __________________________________________________
-Usage @>>>>>> of @>>>>>> %Used: @>>>>>
-make_short($ib_bp_used, 1), make_short($ib_bp_total, 1), perc($ib_bp_used, $ib_bp_total)
-Read hit @>>>>>%
-$ib_bp_read_ratio;
-Pages
- Free @>>>>>>>> %Total: @>>>>>
-make_short($stats{'Innodb_buffer_pool_pages_free'}), perc($stats{'Innodb_buffer_pool_pages_free'}, $stats{'Innodb_buffer_pool_pages_total'})
- Data @>>>>>>>> @>>>>> %Drty: @>>>>>
-make_short($stats{'Innodb_buffer_pool_pages_data'}), perc($stats{'Innodb_buffer_pool_pages_data'}, $stats{'Innodb_buffer_pool_pages_total'}), perc($stats{'Innodb_buffer_pool_pages_dirty'}, $stats{'Innodb_buffer_pool_pages_data'})
- Misc @>>>>>>>> @>>>>>
- $stats{'Innodb_buffer_pool_pages_misc'}, perc($stats{'Innodb_buffer_pool_pages_misc'}, $stats{'Innodb_buffer_pool_pages_total'})
- Latched @>>>>>>>> @>>>>>
-$stats{'Innodb_buffer_pool_pages_latched'}, perc($stats{'Innodb_buffer_pool_pages_latched'}, $stats{'Innodb_buffer_pool_pages_total'})
-Reads @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_buffer_pool_read_requests'}), t($stats{'Innodb_buffer_pool_read_requests'})
- From file @>>>>>>>> @>>>>>/s @>>>>>
-make_short($stats{'Innodb_buffer_pool_reads'}), t($stats{'Innodb_buffer_pool_reads'}), perc($stats{'Innodb_buffer_pool_reads'}, $stats{'Innodb_buffer_pool_read_requests'})
- Ahead Rnd @>>>>>>>> @>>>>>/s
-$stats{'Innodb_buffer_pool_read_ahead_rnd'}, t($stats{'Innodb_buffer_pool_read_ahead_rnd'})
- Ahead Sql @>>>>>>>> @>>>>>/s
-$stats{'Innodb_buffer_pool_read_ahead_seq'}, t($stats{'Innodb_buffer_pool_read_ahead_seq'})
-Writes @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_buffer_pool_write_requests'}), t($stats{'Innodb_buffer_pool_write_requests'})
-Flushes @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_buffer_pool_pages_flushed'}), t($stats{'Innodb_buffer_pool_pages_flushed'})
-Wait Free @>>>>>>>> @>>>>>/s
-$stats{'Innodb_buffer_pool_wait_free'}, t($stats{'Innodb_buffer_pool_wait_free'})
-.
-
-format IB_LOCK =
-
-__ InnoDB Lock _________________________________________________________
-Waits @>>>>>>>> @>>>>>/s
-$stats{'Innodb_row_lock_waits'}, t($stats{'Innodb_row_lock_waits'})
-Current @>>>>>>>>
-$stats{'Innodb_row_lock_current_waits'}
-Time acquiring
- Total @>>>>>>>> ms
-$stats{'Innodb_row_lock_time'}
- Average @>>>>>>>> ms
-$stats{'Innodb_row_lock_time_avg'}
- Max @>>>>>>>> ms
-$stats{'Innodb_row_lock_time_max'}
-.
-
-format IB_DPR =
-
-__ InnoDB Data, Pages, Rows ____________________________________________
-Data
- Reads @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_data_reads'}), t($stats{'Innodb_data_reads'})
- Writes @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_data_writes'}), t($stats{'Innodb_data_writes'})
- fsync @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_data_fsyncs'}), t($stats{'Innodb_data_fsyncs'})
- Pending
- Reads @>>>>>>>>
-$stats{'Innodb_data_pending_reads'}, t($stats{'Innodb_data_pending_reads'})
- Writes @>>>>>>>>
-$stats{'Innodb_data_pending_writes'}, t($stats{'Innodb_data_pending_writes'})
- fsync @>>>>>>>>
-$stats{'Innodb_data_pending_fsyncs'}, t($stats{'Innodb_data_pending_fsyncs'})
-
-Pages
- Created @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_pages_created'}), t($stats{'Innodb_pages_created'})
- Read @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_pages_read'}), t($stats{'Innodb_pages_read'})
- Written @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_pages_written'}), t($stats{'Innodb_pages_written'})
-
-Rows
- Deleted @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_rows_deleted'}), t($stats{'Innodb_rows_deleted'})
- Inserted @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_rows_inserted'}), t($stats{'Innodb_rows_inserted'})
- Read @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_rows_read'}), t($stats{'Innodb_rows_read'})
- Updated @>>>>>>>> @>>>>>/s
-make_short($stats{'Innodb_rows_updated'}), t($stats{'Innodb_rows_updated'})
-.
diff --git a/storage/xtradb/build/debian/additions/mysqlreport.1 b/storage/xtradb/build/debian/additions/mysqlreport.1
deleted file mode 100644
index 5ae6b9e3b92..00000000000
--- a/storage/xtradb/build/debian/additions/mysqlreport.1
+++ /dev/null
@@ -1,180 +0,0 @@
-.TH "mysqlreport" "1" "2.5 2006-09-01 (docrev 2006-05-19)" "Daniel Nichter" "MYSQL"
-.SH "NAME"
-.LP
-mysqlreport \- Makes a friendly report of important MySQL status values
-.SH "SYNTAX"
-.LP
-mysqlreport [\fIoptions\fP]
-.SH "DESCRIPTION"
-.LP
-mysqlreport makes a friendly report of important MySQL status values. Actually,
-it makes a friendly report of nearly every status value from SHOW STATUS.
-Unlike SHOW STATUS which simply dumps over 100 values to screen in one long
-list, mysqlreport interprets and formats the values and presents the basic
-values and many more inferred values in a human\-readable format. Numerous
-example reports are available at the mysqlreport web page at
-http://hackmysql.com/mysqlreport.
-
-The benefit of mysqlreport is that it allows you to very quickly see a wide
-array of performance indicators for your MySQL server which would otherwise
-need to be calculated by hand from all the various SHOW STATUS values. For
-example, the Index Read Ratio is an important value but it's not present in
-SHOW STATUS; it's an inferred value (the ratio of Key_reads to
-Key_read_requests).
-
-This documentation outlines all the command line options in mysqlreport, most
-of which control which reports are printed. This document does not address
-how to interpret these reports; that topic is covered in the document Guide
-To Understanding mysqlreport at http://hackmysql.com/mysqlreportguide.
-
-.SH "OPTIONS"
-Technically, command line options are in the form \-\-option, but \-option works
-too. All options can be abbreviated if the abbreviation is unique. For example,
-option \-\-host can be abbreviated \-\-ho but not \-\-h because \-\-h is ambiguous: it
-could mean \-\-host or \-\-help.
-
-.LP
-
-.TP
-\fB\-\-help\fR
-Output help information and exit.
-
-.TP
-\fB\-\-user USER\fR
-
-.TP
-\fB\-\-password\fR
-As of version 2.3 \-\-password can take the password on the
-command line like "\-\-password FOO". Using \-\-password
-alone without giving a password on the command line
-causes mysqlreport to prompt for a password.
-
-.TP
-\fB\-\-host ADDRESS\fR
-
-.TP
-\fB\-\-port PORT\fR
-
-.TP
-\fB\-\-socket SOCKET\fR
-
-.TP
-\fB\-\-no\-mycnf\fR
-\-\-no\-mycnf makes mysqlreport not read ~/.my.cnf which it does by default
-otherwise. \-\-user and \-\-password always override values from ~/.my.cnf.
-
-.TP
-\fB\-\-dtq\fR
-Print Distribution of Total Queries (DTQ) report (under
-Total in Questions report). Queries (or Questions) can
-be divided into four main areas: DMS (see \-\-dms below),
-Com_ (see \-\-com below), COM_QUIT (see COM_QUIT and
-Questions at http://hackmysql.com/com_quit), and
-Unknown. \-\-dtq lists the number of queries in each of
-these areas in descending order.
-
-.TP
-\fB\-\-dms\fR
-Print Data Manipulation Statements (DMS) report (under
-DMS in Questions report). DMS are those from the MySQL
-manual section 13.2. Data Manipulation Statements.
-(Currently, mysqlreport considers only SELECT, INSERT,
-REPLACE, UPDATE, and DELETE.) Each DMS is listed in
-descending order by count.
-
-.TP
-\fB\-\-com N\fR
-Print top N number of non\-DMS Com_ status values in
-descending order (after DMS in Questions report). If N
-is not given, default is 3. Such non\-DMS Com_ values
-include Com_change_db, Com_show_tables, Com_rollback,
-etc.
-
-.TP
-\fB\-\-sas\fR
-Print report for Select_ and Sort_ status values (after
-Questions report). See MySQL Select and Sort Status
-Variables at http://hackmysql.com/selectandsort.
-
-.TP
-\fB\-\-tab\fR
-Print Threads, Aborted, and Bytes status reports (after
-Created temp report). As of mysqlreport v2.3 the
-Threads report reports on all Threads_ status values.
-
-.TP
-\fB\-\-qcache\fR
-Print Query Cache report.
-.TP
-\fB\-\-all\fR
-Equivalent to "\-\-dtq \-\-dms \-\-com 3 \-\-sas \-\-qcache".
-(Notice \-\-tab is not invoked by \-\-all.)
-
-.TP
-\fB\-\-infile FILE\fR
-Instead of getting SHOW STATUS values from MySQL, read
-values from FILE. FILE is often a copy of the output of
-SHOW STATUS including formatting characters (|, +, \-).
-mysqlreport expects FILE to have the format
-" value number " where value is only alpha and
-underscore characters (A\-Z and _) and number is a
-positive integer. Anything before, between, or after
-value and number is ignored. mysqlreport also needs
-the following MySQL server variables: version,
-table_cache, max_connections, key_buffer_size,
-query_cache_size. These values can be specified in
-INFILE in the format "name = value" where name is one
-of the aforementioned server variables and value is a
-positive integer with or without a trailing M and
-possible periods (for version). For example, to specify
-an 18M key_buffer_size: key_buffer_size = 18M. Or, a
-256 table_cache: table_cache = 256. The M implies
-Megabytes not million, so 18M means 18,874,368 not
-18,000,000. If these server variables are not specified
-the following defaults are used (respectively) which
-may cause strange values to be reported: 0.0.0, 64,
-100, 8M, 0.
-
-.TP
-\fB\-\-outfile FILE\fR
-After printing the report to screen, print the report
-to FILE too. Internally, mysqlreport always writes the
-report to a temp file first: /tmp/mysqlreport.PID on
-*nix, c:\mysqlreport.PID on Windows (PID is the
-script's process ID). Then it prints the temp file to
-screen. Then if \-\-outfile is specified, the temp file
-is copied to OUTFILE. After \-\-email (below), the temp
-file is deleted.
-
-.TP
-\fB\-\-email ADDRESS\fR
-After printing the report to screen, email the report
-to ADDRESS. This option requires sendmail in
-/usr/sbin/, therefore it does not work on Windows.
-/usr/sbin/sendmail can be a sym link to qmail, for
-example, or any MTA that emulates sendmail's \-t
-command line option and operation. The FROM: field is
-"mysqlreport", SUBJECT: is "MySQL status report".
-
-.TP
-\fB\-\-flush\-status\fR
-Execute a "FLUSH STATUS;" after generating the reports.
-If you do not have permissions in MySQL to do this an
-error from DBD::mysql::st will be printed after the
-reports.
-
-.SH "AUTHORS"
-.LP
-Daniel Nichter
-
-If mysqlreport breaks, send me a message from
-http://hackmysql.com/feedback
-with the error.
-
-.SH "SEE ALSO"
-.LP
-mytop(1)
-.LP
-The comprehensive Guide To Understanding mysqlreport at
-http://hackmysql.com/mysqlreportguide.
-
diff --git a/storage/xtradb/build/debian/additions/mysqltest.1 b/storage/xtradb/build/debian/additions/mysqltest.1
deleted file mode 100644
index 3469765fe3b..00000000000
--- a/storage/xtradb/build/debian/additions/mysqltest.1
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-mysqltest \- Regressiontest program for MySQL.
-.SH SYNOPSIS
-mysqltest [options]
-.SH DESCRIPTION
-Runs a test against the mysql server and compares output with a results file.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/pack_isam.1 b/storage/xtradb/build/debian/additions/pack_isam.1
deleted file mode 100644
index cad153eedee..00000000000
--- a/storage/xtradb/build/debian/additions/pack_isam.1
+++ /dev/null
@@ -1,19 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-myisampack \- Compresses MySQL database files.
-.SH SYNOPSIS
-myisampack [options]
-.SH DESCRIPTION
-Pack a ISAM-table to take much smaller space
-Keys are not updated, so you must run isamchk -rq on any table
-that has keys after you have compressed it
-You should give the .ISM file as the filename argument
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/resolve_stack_dump.1 b/storage/xtradb/build/debian/additions/resolve_stack_dump.1
deleted file mode 100644
index 2a1e2770275..00000000000
--- a/storage/xtradb/build/debian/additions/resolve_stack_dump.1
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-resolve_stack_dump \- MySQL helper program for reporting bugs.
-.SH SYNOPSIS
-resolve_stack_dump [options]
-.SH DESCRIPTION
-Resolve numeric stack strace dump into symbols.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/additions/resolveip.1 b/storage/xtradb/build/debian/additions/resolveip.1
deleted file mode 100644
index 7aa9439394d..00000000000
--- a/storage/xtradb/build/debian/additions/resolveip.1
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
-.SH NAME
-resolveip \- MySQL helper program to retrive IP addresses.
-.SH SYNOPSIS
-resolveip [options]
-.SH DESCRIPTION
-Get hostname based on IP-address or IP-address based on hostname.
-
-For more information start the program with '--help'.
-.SH "SEE ALSO"
-mysql (1), mysqld (1)
-.SH AUTHOR
-This manpage was written by Christian Hammers <ch@debian.org>.
-
-MySQL is available at http://www.mysql.com/.
-.\" end of man page
diff --git a/storage/xtradb/build/debian/changelog b/storage/xtradb/build/debian/changelog
deleted file mode 100644
index 6dc9b561634..00000000000
--- a/storage/xtradb/build/debian/changelog
+++ /dev/null
@@ -1,4186 +0,0 @@
-percona-xtradb-dfsg-5.1 (5.1.36-1) experimental; urgency=low
-
- [TODO]
- * Link libmysqlclient.so to libmysqlclient_r.so to help applications
- like Apache where some modules, like libaprutil, want to use the thread
- safe library and some, like PHP, do not. As the client library just copies
- data between client and server, we do not expect significant performance
- losses. (thanks to Stefan Fritsch). Closes: #450535
-
- Add the following to libmysqlclient16.links:
- usr/lib/libmysqlclient_r.so.16.0.0 usr/lib/libmysqlclient.so.16.0.0
-
- * Ex-maintainer upload :)
- * New upstream release.
- * SECURITY: Upstream fix for "mysql client does not escape strings in
- --html mode." (CVE-2008-4456) Closes: #526254
- * Upstream fixes REPEAT() function. Closes: #447028
- * Upstream fixes problems when mixing ORDER and GROUP BY. Closes: #470854
- * There were many innodb fixes in the last two years, probably
- also for this unreproducible crash. CLoses: #447713
- * Removed amd64 specific -fPIC compiler option that was introduced
- especially for building the NDB cluster module which is no longer
- part of this package (thanks to Modestas Vainius). Closes: #508406
- * Put /etc/mysql/conf.d to mysql-server-5.1.dirs (thanks to Alexander
- Gerasiov). Closes: #515145
- * Fixed mysql-test suite by adding 50_mysql-test__db_test.dpatch.
- It now passes 100% of the tests again. Also Closes: #533999
- * Preinst now prevents Installation if NDB configuration is detected.
- * Applied Ubuntu patch that fixes privilege bootstrapping in postinst
- (thanks to Mathias Gug). Closes: #535492
- * Applied Ubuntu patch that sets the debconf prio for the root password
- question to high and prevents it from being asked on 5.0 -> 5.1 upgrades
- (thanks to Mathias Gug). Closes: #535500
- * Removed the check for ISAM tables as the only supported upgrade path is
- from lenny's MySQL-5.0.
- * Added /etc/mysql/conf.d/mysqld_safe_syslog.cnf which enables mysqld_safe
- to pipe all mysqld output into the syslog. The reason for not letting dpkg
- handle it via a normal config file change was that my.cnf is usually
- heavily tuned by the admin so the setting would go lost too easily.
- * Updated mysqlreport to version 3.5 (including two minor patches by me).
-
- -- Christian Hammers <ch@debian.org> Wed, 01 Jul 2009 20:54:58 +0200
-
-mysql-dfsg-5.1 (5.1.34-1) experimental; urgency=low
-
- * New upstream release.
-
- -- Norbert Tretkowski <nobse@debian.org> Mon, 20 Apr 2009 20:23:10 +0200
-
-mysql-dfsg-5.1 (5.1.33-2) experimental; urgency=low
-
- * Remove no longer active developers from uploaders field.
- * Drop workaround for upgrades from MySQL 3.23, not necessary any more.
-
- -- Norbert Tretkowski <nobse@debian.org> Tue, 07 Apr 2009 11:23:25 +0200
-
-mysql-dfsg-5.1 (5.1.33-1) experimental; urgency=low
-
- * New upstream release.
-
- -- Norbert Tretkowski <nobse@debian.org> Thu, 02 Apr 2009 21:12:23 +0200
-
-mysql-dfsg-5.1 (5.1.32-1) experimental; urgency=low
-
- * New upstream release.
-
- -- Norbert Tretkowski <nobse@debian.org> Fri, 06 Mar 2009 18:48:23 +0100
-
-mysql-dfsg-5.1 (5.1.31-2) experimental; urgency=low
-
- * Update SSL certificates, and re-enable SSL related tests when running
- the testsuite.
-
- -- Norbert Tretkowski <nobse@debian.org> Tue, 10 Feb 2009 16:08:42 +0100
-
-mysql-dfsg-5.1 (5.1.31-1) experimental; urgency=low
-
- * New upstream release.
-
- -- Norbert Tretkowski <nobse@debian.org> Sun, 08 Feb 2009 17:07:11 +0100
-
-mysql-dfsg-5.1 (5.1.30-2) experimental; urgency=low
-
- * Drop MySQL Cluster support, it's deprecated since 5.1.24-RC.
- * Fix FTBFS if build twice in a row. (closes: #487091)
-
- -- Norbert Tretkowski <nobse@debian.org> Fri, 05 Dec 2008 21:04:55 +0100
-
-mysql-dfsg-5.1 (5.1.30-1) experimental; urgency=low
-
- * New upstream release.
-
- -- Norbert Tretkowski <nobse@debian.org> Thu, 27 Nov 2008 09:09:55 +0100
-
-mysql-dfsg-5.1 (5.1.29rc-1) experimental; urgency=low
-
- * New upstream release.
-
- -- Norbert Tretkowski <nobse@debian.org> Mon, 27 Oct 2008 20:00:43 +0100
-
-mysql-dfsg-5.1 (5.1.26rc-1) experimental; urgency=low
-
- * New upstream release.
-
- -- Norbert Tretkowski <nobse@debian.org> Mon, 14 Jul 2008 21:46:59 +0200
-
-mysql-dfsg-5.1 (5.1.25rc-1) experimental; urgency=low
-
- * New upstream release.
-
- -- Norbert Tretkowski <nobse@debian.org> Sat, 21 Jun 2008 13:55:02 +0200
-
-mysql-dfsg-5.1 (5.1.24rc-1) experimental; urgency=low
-
- * New upstream release.
- * Ignore errors in testsuite on ia64 and s390.
-
- -- Norbert Tretkowski <nobse@debian.org> Wed, 16 Apr 2008 22:03:44 +0200
-
-mysql-dfsg-5.1 (5.1.23rc-1) experimental; urgency=low
-
- * New upstream release.
-
- [ Christian Hammers ]
- * Add PIC support for NDB libraries on amd64 (thanks to Monty Taylor).
- * Add extra information when aborting due to a detected downgrade (thanks to
- Raphael Pinson).
- * Move libndbclient.so.3 to its own package as it now has a version != 0
- (thanks to Raphael Pinson for reminding me).
-
- [ Monty Taylor ]
- * Remove 85_ndb__staticlib.dpatch since we have a libndbclient package now.
- * Add myself to the uploaders so that I don't get complaints about package
- signing.
- * Add libndbclient-dev package to go with libndbclient3.
-
- [ Norbert Tretkowski ]
- * Update patches:
- + 41_scripts__mysql_install_db.sh__no_test.dpatch
- * Drop patches:
- + 70_upstream_debian__configure.dpatch
- + 71_upstream_debian__Makefile.in.dpatch
- + 99_TEMP_minmax.dpatch
- * Remove Adam Conrad from uploaders on his request. Thanks for your work in
- the past!
- * Ignore errors in testsuite on amd64 and i386.
-
- -- Norbert Tretkowski <nobse@debian.org> Fri, 29 Feb 2008 10:38:27 +0100
-
-mysql-dfsg-5.1 (5.1.22rc-1) experimental; urgency=low
-
- * New upstream version.
- * Let mysql-server-5.1 pre-depend on debconf as it uses it in the preinst.
- * Fixed mysql-client-5.1 menu entry for upcoming menu policy 1.4.
-
- -- Christian Hammers <ch@debian.org> Tue, 02 Oct 2007 22:45:37 +0200
-
-mysql-dfsg-5.1 (5.1.21beta-1) experimental; urgency=low
-
- * My "Greetings from FrOSCon!" release.
- * New upstream version.
- * libmysqlclient.so.15 has been superseded by libmysqlclient.so.16.
- * Renamed libmysqlclient15-dev to libmysqlclient-dev but added an empty
- package libmysqlclient15-dev to ease the transition for packages with
- a versioned build-dep to libmysqlclient15-dev which is something that
- currently does not work with "Provides:".
- * Synced with 5.0 branch up to subversion release r909.
- * Commented out most of the compile conditionals in the hope that
- all architectures can be build the same way.
- * Added a lot of new binaries and manpages.
- * Switched to plugin based engines.
-
- -- Christian Hammers <ch@debian.org> Sat, 25 Aug 2007 14:24:40 +0200
-
-mysql-dfsg-5.1 (5.1.19beta-1) experimental; urgency=low
-
- * New upstream release.
-
- -- Christian Hammers <ch@debian.org> Mon, 11 Jun 2007 23:18:35 +0200
-
-mysql-dfsg-5.1 (5.1.16beta-4) experimental; urgency=high
-
- * Merged with 5.0 r850:
- * SECURITY:
- In some previous versions mysql_install_db was not idempotent and did
- always create passwordless root accounts although it should only on
- initial installs (thanks to Olaf van der Spek). Closes: #418672
- * Added check for passwordless root accounts to debian-start.
- * As MySQL-5.0 is, at least currently, incompatible with Kernel 2.4 the
- installation is aborted for such old kernels. Debian Etch does not
- support them anyway according to the release notes but this might be
- unexpected and many production servers still have self build ones
- installed (thanks to Marc-Christian Petersen). See: #416841
- * Adjusted TeX build-deps to texlive.
- * Added innotop.
- * Changed maintainer email address to
- pkg-mysql-commits@lists.alioth.debian.org
-
- -- Christian Hammers <ch@debian.org> Thu, 19 Apr 2007 19:29:29 +0200
-
-mysql-dfsg-5.1 (5.1.16beta-3) experimental; urgency=low
-
- * Merged with 5.0 r837:
- * Activated the blackhole engine as it's needed for replicating partition
- designs (thanks to Cyril SCETBON).
- * Fixed segfault on i486 systems without cpuid instruction (thanks to
- Lennart Sorensen). Closes: #410474
- * Only use of the non-essential debconf package in postrm if it is
- still installed (thanks to Michael Ablassmeier). Closes: #416838
-
- -- Christian Hammers <ch@debian.org> Sun, 18 Mar 2007 21:48:11 +0100
-
-mysql-dfsg-5.1 (5.1.16beta-2) experimental; urgency=low
-
- * Merged with 5.0 r818:
- * Fixed FTBFS on Sparc introduced with the "make -j" trick in
- 5.0.32-8 (thanks to Frank Lichtenheld). Closes: #415026
-
- -- Christian Hammers <ch@debian.org> Sun, 18 Mar 2007 21:20:11 +0100
-
-mysql-dfsg-5.1 (5.1.16beta-1) experimental; urgency=low
-
- * New upstream release.
- * SECURITY: Using an INFORMATION_SCHEMA table with ORDER BY in a subquery
- could cause a server crash (CVE-2007-1420).
- * Added temporary patch 90_TEMP_sqlparse-ifdef to avoid build problems.
- * Merged with 5.0 r809:
- * Updated mysqlreport to latest upstream (and patched --help usage
- message and "return if qcache_size==0").
- * Merged with 5.0 r798:
- * Adapt MAKE_J to use the -j option with the number of available
- processors. (thanks to Raphael Pinson).
- * Merged with 5.0 r758:
- * Changed minimum required version in dh_makeshlibs to 5.0.27-1 as
- 5.0.26 had an ABI breakage in it!
- This is the cause for Perl programs crashing with the following error:
- Transactions not supported by database at /usr/lib/perl5/DBI.pm line 672
- * Added some more comments to the default my.cnf.
- * Added support for /etc/mysql/conf.d/.
- * The debian-start script that runs on every server start now first upgrades
- the system tables (if neccessary) and then check them as it sometimes did
- not work the other way around (e.g. for MediaWiki). The script now uses
- mysql_update instead of mysql_update_script as recommended. See: 409780
-
- -- Christian Hammers <ch@debian.org> Fri, 2 Mar 2007 01:00:55 +0100
-
-mysql-dfsg-5.1 (5.1.15beta-1) experimental; urgency=low
-
- * New upstream release.
- [Monty Taylor]
- * Removed patches/25_mysys__default.c - fixed upstream.
- * Removed patches/26_client__mysql_upgrade.c - fixed upstream.
- * Removed patches/29_scripts__mysqlbug.sh - fixed upstream.
- * Removed patches/39_scripts__mysqld_safe.sh__port_dir - fixed upstream.
- * Removed patches/42_scripts__mysqldumpslow__slowdir - fixed upstream.
- * Removed patches/45_warn-CLI-passwords - fixed upstream.
- * Removed patches/89_ndb__records.dpatch - fixed upstream.
- * Removed patches/86_ndbapi_tc_selection.dpatch - fixed upstream.
- [Christian Hammers]
- * Synced with 5.0.32-4.
- * mysql-server-5.0 pre-depends on adduser now and has --disabled-login
- explicitly added to be on the safe side (thanks to the puiparts team).
- Closes: #408362
- * Corrections the terminology regarding NDB in the comments of all config
- files and init scripts (thanks to Geert Vanderkelen of MySQL).
-
- -- Christian Hammers <ch@debian.org> Wed, 7 Feb 2007 11:34:52 -0200
-
-mysql-dfsg-5.1 (5.1.14beta-2) experimental; urgency=low
-
- [Christian Hammers]
- * Readded 85_ndb__staticlib.dpatch with slight modifications.
- * Backported debian-start scripts from 5.0.
- [Monty Taylor]
- * Now build-depends on bison.
- * Updated to standards 3.7.2.
- * Removed references to comp_err.
- * build-depend on automake1.9 to match upstream
- * Merged runlevel changes from 5.0.
- * Added 26_client__mysql_upgrade.c.dpatch to fix a segfault in mysql_upgrade
- when using a password. It's been fixed upstream in 5.1.15.
- * Moved BDB check to sanity_checks() and added a note about deprecation.
- * Use my_print_defaults instead of mysqld --print-defaults
- * Changed NDB Data and Management node startup seqence. Prevented both
- from restarting on upgrade to address rolling upgrade issues.
- * Added a "start-initial" option to the Data Node init script to support
- initial node starts.
- * Added 86_ndbapi_tc_selection.dpatch to fix a bug that causes a segfault
- when using the NdbApi. http://bugs.mysql.com/bug.php?id=24914
- Fixed in 5.1.15
- * Added 89_ndb__records.dpatch to fix
- http://bugs.mysql.com/bug.php?id=25567, which causes a table scan per
- table per query.
-
- -- Christian Hammers <ch@debian.org> Wed, 31 Jan 2007 01:17:35 +0100
-
-mysql-dfsg-5.1 (5.1.14beta-1) experimental; urgency=low
-
- * New upstream.
- * Removed references to mysql_explain_log
- * Changed context for patch to mysqld_multi.1
- * Removed 70_kfreebsd.dpatch - applied to upstream
- * Removed 87_ps_Hurd - applied to upstream
- * Replaced --without-readline to --with-libedit to configure options, as
- --without-readline doesn't seem to do the right thing anymore.
-
- -- Monty Taylor <mordred@inaugust.com> Wed, 10 Jan 2007 12:59:55 -0800
-
-mysql-dfsg-5.1 (5.1.11beta-1) experimental; urgency=low
-
- * Starting new 5.1 branch!
- * FIXME: Following patch couldn't be applied:
- ## 85_ndb__staticlib.dpatch by <ch@debian.org>
- * FIXME: Following patch couldn't be applied:
- ## 86_PATH_MAX.dpatch
-
- -- Christian Hammers <ch@debian.org> Sat, 29 Jul 2006 11:35:42 +0200
-
-mysql-dfsg-5.0 (5.0.51a-19) UNRELEASED; urgency=low
-
- * New patch 50_fix_mysqldump2.dpatch from 5.0.60 to fix dumping databases
- from mysql 4.0 server. (closes: #507789)
- * Don't create a guest account during bootstrap. (closes: #463704)
-
- -- Norbert Tretkowski <nobse@debian.org> Thu, 04 Dec 2008 23:07:19 +0100
-
-mysql-dfsg-5.0 (5.0.51a-18) testing-proposed-updates; urgency=high
-
- * SECURITY:
- Fix for CVE-2008-4098: Inadequate validation of paths used in DATA
- DIRECTORY and INDEX DIRECTORY clauses of CREATE TABLE statements enabled
- attackers to write to tables in other databases to which they could not
- ordinarily have access.
-
- -- Devin Carraway <devin@debian.org> Tue, 25 Nov 2008 05:38:45 +0000
-
-mysql-dfsg-5.0 (5.0.51a-17) testing-proposed-updates; urgency=low
-
- * Don't use commented out passwords from debian.cnf. (closes: #453820)
- * Update watch file to recognize releases > 5.0.45.
-
- -- Norbert Tretkowski <nobse@debian.org> Sun, 02 Nov 2008 13:31:32 +0100
-
-mysql-dfsg-5.0 (5.0.51a-16) unstable; urgency=low
-
- * New patch 60_rpl_test_failure.dpatch from 5.0.54 to fix a race condition
- with the rpl_packet test in some cases. (closes: #501413)
-
- -- Norbert Tretkowski <nobse@debian.org> Thu, 09 Oct 2008 08:50:43 +0200
-
-mysql-dfsg-5.0 (5.0.51a-15) unstable; urgency=high
-
- * SECURITY:
- Fix for CVE-2008-3963: An empty bit-string literal (b'') caused a server
- crash. Now the value is parsed as an empty bit value (which is treated as
- an empty string in string context or 0 in numeric context).
- (closes: #498362)
-
- -- Norbert Tretkowski <nobse@debian.org> Sun, 14 Sep 2008 18:27:46 +0200
-
-mysql-dfsg-5.0 (5.0.51a-14) unstable; urgency=low
-
- * Update debconf translations:
- - Swedish, from Martin Bagge. (closes: #491688)
- - Netherlands, from Thijs Kinkhorst. (closes: #492723)
-
- -- Norbert Tretkowski <nobse@debian.org> Sun, 07 Sep 2008 20:18:31 +0200
-
-mysql-dfsg-5.0 (5.0.51a-13) unstable; urgency=medium
-
- * New patch 59_fix_relay_logs_corruption.dpatch from 5.0.56 to fix
- corruption in relay logs. (closes: #463515)
-
- -- Norbert Tretkowski <nobse@debian.org> Wed, 03 Sep 2008 09:13:46 +0200
-
-mysql-dfsg-5.0 (5.0.51a-12) unstable; urgency=low
-
- * Disable rpl_ndb_innodb_trans test when running the testsuite, fails
- randomly on i386. (closes: #494238)
-
- -- Norbert Tretkowski <nobse@debian.org> Sat, 09 Aug 2008 15:56:45 +0200
-
-mysql-dfsg-5.0 (5.0.51a-11) unstable; urgency=low
-
- * Disable innodb_handler test when running the testsuite, fails randomly
- on s390. (closes: #491363)
-
- -- Norbert Tretkowski <nobse@debian.org> Wed, 23 Jul 2008 08:34:51 +0200
-
-mysql-dfsg-5.0 (5.0.51a-10) unstable; urgency=high
-
- * Merge testing-security upload to finally fix CVE-2008-2079, thanks to
- Devin Carraway and Steffen Joeris. (closes: #480292)
- * New patch 58_disable-ndb-backup-print.dpatch from 5.0.54 to disable
- ndb_backup_print, ndb_alter_table and ndb_replace tests when running the
- testsuite. (closes: #474893)
- * Reenable error handling in testsuite on i386, disabling it was just a
- workaround for the problem which is now fixed with the above patch.
- * Update debconf translations:
- - Vietnamese, from Clytie Siddall. (closes: #486443)
- - Spanish, from Javier Fernández-Sanguino Peña. (closes: #488740)
- - Slovak, from helix84. (closes: #489266)
- * Make lintian happy:
- - Fix build-dependency on -1 revision.
- - Fix deprecated chown usage.
- - Fix spelling error in description.
-
- -- Norbert Tretkowski <nobse@debian.org> Tue, 15 Jul 2008 19:37:35 +0200
-
-mysql-dfsg-5.0 (5.0.51a-9+lenny2) testing-security; urgency=high
-
- * Non-maintainer upload by the security team.
- * Correct error number in symlink.test to avoid FTBFS on some archs.
-
- -- Steffen Joeris <white@debian.org> Sun, 13 Jul 2008 11:44:57 +0000
-
-mysql-dfsg-5.0 (5.0.51a-9+lenny1) testing-security; urgency=high
-
- * Non-maintainer upload by the security team.
- * Correct and expand 92_SECURITY_CVE-2008-2079.dpatch to cover all symlinks
- and check the output of fn_format(). (closes: #480292)
- Fixes: CVE-2008-2079
-
- -- Steffen Joeris <white@debian.org> Sat, 12 Jul 2008 05:30:39 +0000
-
-mysql-dfsg-5.0 (5.0.51a-9) unstable; urgency=low
-
- * Ignore errors in testsuite on i386. (workaround for #474893)
-
- -- Norbert Tretkowski <nobse@debian.org> Wed, 25 Jun 2008 15:07:03 +0200
-
-mysql-dfsg-5.0 (5.0.51a-8) unstable; urgency=low
-
- * New patch 80_fix_user_setup_on_localhost.dpatch from Daniel Hahler to fix
- a duplicate key error when install MySQL server on a host with hostname
- localhost. (closes: #478319)
- * Really fix build on non-linux systems, this time without producing a build
- error on some architectures. (closes: #485971)
- * Update debconf translations:
- - French, from Christian Perrier. (closes: #478553)
- - German, from Alwin Meschede. (closes: #478672)
- - Italian, from Luca Monducci. (closes: #479363)
- - Czech, from Miroslav Kure. (closes: #480924)
- - Galician, from Jacobo Tarrio. (closes: #480965)
- - Basque, from Piarres Beobide. (closes: #481840)
- - Swedish, from Martin Bagge. (closes: #482466, #486307)
- - Turkish, from Mert Dirik. (closes: #484704)
- - Russian, from Yuri Kozlov. (closes: #486149)
- - Finnish, from Esko Arajärvi. (closes: #486554)
- - Portuguese, from Miguel Figueiredo. (closes: #486709)
- - Romanian, from Eddy Petrișor. (closes: #486944)
- - Japanese, from Hideki Yamane. (closes: #487270)
-
- -- Norbert Tretkowski <nobse@debian.org> Sat, 21 Jun 2008 19:20:48 +0200
-
-mysql-dfsg-5.0 (5.0.51a-7) unstable; urgency=high
-
- [ Norbert Tretkowski ]
- * SECURITY:
- Fix for CVE-2008-2079: It was possible to circumvent privileges through
- the creation of MyISAM tables employing the DATA DIRECTORY and INDEX
- DIRECTORY options to overwrite existing table files in the MySQL data
- directory. Use of the MySQL data directory in DATA DIRECTORY and INDEX
- DIRECTORY is now disallowed. Patch from openSUSE 11.0, thanks to Michal
- Marek. (closes: #480292)
- * Fix build on non-linux systems, like hurd-i386. (closes: #480362)
- * Include symlinks for mysqlcheck. (closes: #480647)
-
- [ Monty Taylor ]
- * Remove ndb_cpcd, as it is only for the NDB test suite and not useful as a
- public program.
- * Fix debian-start.inc.sh for table names with characters needing quotes.
- Thanks Felix Rublack! (closes: #480525, #481154, #481303, #484012)
- * Delete mysql-common.README.Debian. Nothing in it was relevant, and the
- useful information is in mysql-server anyway. (closes: #480940)
- * Remove a spurious HOME= in logrotate script.
-
- -- Norbert Tretkowski <nobse@debian.org> Thu, 05 Jun 2008 11:49:45 +0200
-
-mysql-dfsg-5.0 (5.0.51a-6) unstable; urgency=low
-
- * Fix debian-start.inc.sh to not print the row counts of the tables
- queried. (closes: #478256, #479697)
-
- -- Monty Taylor <mordred@inaugust.com> Wed, 14 May 2008 00:47:46 -0700
-
-mysql-dfsg-5.0 (5.0.51a-5) unstable; urgency=medium
-
- * New patch 57_fix_mysql_replication.dpatch from 5.0.54 to fix directory for
- relay logs when using replication.
-
- -- Norbert Tretkowski <nobse@debian.org> Sun, 27 Apr 2008 13:55:04 +0200
-
-mysql-dfsg-5.0 (5.0.51a-4) unstable; urgency=low
-
- [ Monty Taylor ]
- * Remove build of ndb docs, since they are not installed. Removed build deps
- on TeX and doxygen since that's all they were there for.
- * Replace script in check_for_crashed_tables with a myisam-recover option
- and a script to trigger a check of those tables. (thanks HarrisonF and
- kolbe)
- * Replace direct calls to test suite with calls to the make targets used by
- the MySQL build and qa teams for releases.
- * Add --skip-ndbcluster to the postinst bootstrap command. It's really a
- workaround for a bug in 5.1, but it's probably a good idea anyway since we
- certainly don't need cluster to spin up, and if people have enabled
- cluster in their my.cnf file, there could be postinst issues if cluster
- isn't running.
- * Remove reference to configure options that no longer exist.
- * Add myself to uploaders.
-
- [ Norbert Tretkowski ]
- * New patch 56_fix_order_by.dpatch from Ubuntu to fix ORDER BY not working
- with GROUP BY. (closes: #471737)
- * Add note about filename extensions in the /etc/mysql/conf.d/ directory in
- my.cnf. (closes: #461759)
- * Confirm password on install, patch from Nicolas Valcárcel.
- (closes: #471887)
- * Remove Adam Conrad from uploaders on his request. Thanks for your work in
- the past!
- * Use lsb_release to detect distribution.
-
- -- Norbert Tretkowski <nobse@debian.org> Sat, 05 Apr 2008 21:51:43 +0200
-
-mysql-dfsg-5.0 (5.0.51a-3) unstable; urgency=low
-
- * Disable patch 60_raise-max-keylength.dpatch in default build, but still
- ship it in the source package.
-
- -- Norbert Tretkowski <nobse@debian.org> Sun, 17 Feb 2008 18:54:42 +0100
-
-mysql-dfsg-5.0 (5.0.51a-2) unstable; urgency=low
-
- * Replace 54_ssl-client-support.dpatch added in 5.0.51-2 with patch from
- upstream.
- * Ignore errors in testsuite on powerpc.
-
- -- Norbert Tretkowski <nobse@debian.org> Sun, 17 Feb 2008 12:42:58 +0100
-
-mysql-dfsg-5.0 (5.0.51a-1) unstable; urgency=low
-
- [ Norbert Tretkowski ]
- * New upstream security hotfix release. Low priority upload anyway because
- 5.0.51-3 already contained all security fixes.
- * Remove patches:
- + debian/patches/51_mysqlcheck-result.dpatch
- + debian/patches/92_SECURITY_CVE-2007-6303.dpatch
- + debian/patches/93_SECURITY_CVE-2007-6304.dpatch
- + debian/patches/94_SECURITY_CVE-2008-0226+0227.dpatch
- * Add recommendation on libhtml-template-perl to -server package, used by
- ndb_size. (closes: #462265)
- * New patch 60_raise-max-keylength.dpatch to raise the maximum key length to
- 4005 bytes or 1335 UTF-8 characters. (closes: #463137)
- * New patch 51_sort-order.dpatch from 5.0.52 to fix incorrect order when
- using range conditions on 2 tables or more.
- * Support DEB_BUILD_OPTIONS option 'nocheck' to skip tests.
- * Update mysqlreport to 3.4a release.
-
- [ Luk Claes ]
- * Updated Japanese debconf translation. (closes: #462158)
-
- -- Norbert Tretkowski <nobse@debian.org> Wed, 06 Feb 2008 11:57:45 +0100
-
-mysql-dfsg-5.0 (5.0.51-3) unstable; urgency=high
-
- * SECURITY:
- Fix for CVE-2008-0226 and CVE-2008-0227: Three vulnerabilities in yaSSL
- versions 1.7.5 and earlier were discovered that could lead to a server
- crash or execution of unauthorized code. The exploit requires a server
- with yaSSL enabled and TCP/IP connections enabled, but does not require
- valid MySQL account credentials. The exploit does not apply to OpenSSL.
- (closes: #460873)
- * Fix LSB header in init scripts (patch from Petter Reinholdtsen).
- (closes: #458798)
- * Run testsuite on all archs, but ignore errors on alpha, arm, armel, hppa,
- mipsel and sparc. (closes: #460402)
-
- -- Norbert Tretkowski <nobse@debian.org> Wed, 23 Jan 2008 11:37:11 +0100
-
-mysql-dfsg-5.0 (5.0.51-2) unstable; urgency=low
-
- [ Monty Taylor ]
- * Added --with-system-type to set the version_compile_os field.
- * Cleaned up some lintian warnings.
- * Removed 43_scripts__mysql_update__password.dpatch since we don't use
- mysql_upgrade_shell anymore and use mysql_upgrade instead.
- * Removed 88_mctype_attrib.dpatch, http://bugs.mysql.com/bug.php?id=25118 is
- closed with http://lists.mysql.com/commits/24337
- * Added mysql-community/mysql-enterprise virtual packages in provides and
- conflicts to ease transitions between versions.
-
- [ Norbert Tretkowski ]
- * Add -fPIC to CFLAGS to allow other packages to be built against
- libmysqld.a on amd64. (closes: #457915)
- * New patch 55_testsuite-2008.dpatch to fix FTBFS in testsuite.
- (closes: #458695)
- * New patch 54_ssl-client-support.dpatch to fix SSL client support.
- * Don't run testsuite on alpha, arm, hppa, mipsel and sparc.
-
- -- Norbert Tretkowski <nobse@debian.org> Wed, 02 Jan 2008 18:40:04 +0100
-
-mysql-dfsg-5.0 (5.0.51-1) unstable; urgency=low
-
- * New upstream release.
- + Fix a crash in mysql_client_test due to gcc 4.x optimizations.
- (closes: #452558)
- * Update patches:
- + debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch
- + debian/patches/89_ndb__staticlib.dpatch
- * Run testsuite after build.
- * Re-add manpages, they are licensed under GPL now and redistribution is
- permitted.
- * Drop linux-libc-dev build-dependency, it's now being pulled by libc-dev
- which is build-essential. (closes: #431018)
- * Remove old optimizations for MySQL 3.23.x, they are no longer required.
- (closes: #436552)
- * Don't fail when upgrading mysql-common if $datadir is empty or not defined
- (patch from Edward Allcutt). (closes: #453127)
- * New patch from 5.0.52 to fix mysqldump because 'null' is shown as type of
- fields for view with bad definer. (closes: #454227)
- * New patch from 5.0.52 to fix mysqlcheck test result.
- * New patch from 5.0.52 to fix wrong optimization in ndb code when building
- with gcc 4.2.x.
- * New patch from 5.0.54 to fix wrong number output due to integer overflow
- when building with gcc 4.2.x.
- * New Finnish debconf translation from Esko Arajärvi. (closes: #448776)
- * Update Basque debconf translation from Aitor Ibañez. (closes: #456193)
- * Add Vcs-* and Homepage fields to source stanza in control file.
- * Update mysqlreport to 3.2 release.
- * Let mysql-server-5.0 pre-depend on debconf, because it's preinst is using
- it.
- * Drop menu item for innotop.
-
- -- Norbert Tretkowski <nobse@debian.org> Fri, 14 Dec 2007 09:59:36 +0100
-
-mysql-dfsg-5.0 (5.0.45-5) unstable; urgency=high
-
- * SECURITY:
- Fix for CVE-2007-6303: ALTER VIEW retained the original DEFINER value,
- even when altered by another user, which could allow that user to gain the
- access rights of the view. Now ALTER VIEW is allowed only to the original
- definer or users with the SUPER privilege. (closes: #455737)
- * SECURITY:
- Fix for CVE-2007-6304: When using a FEDERATED table, the local server can
- be forced to crash if the remote server returns a result with fewer columns
- than expected.
-
- -- Norbert Tretkowski <nobse@debian.org> Wed, 12 Dec 2007 20:23:43 +0100
-
-mysql-dfsg-5.0 (5.0.45-4) unstable; urgency=high
-
- * SECURITY:
- Fix for CVE-2007-5969: Using RENAME TABLE against a table with explicit
- DATA DIRECTORY and INDEX DIRECTORY options can be used to overwrite system
- table information by replacing the file to which the symlink points.
- (closes: #455010)
-
- -- Norbert Tretkowski <nobse@debian.org> Sun, 09 Dec 2007 12:29:54 +0100
-
-mysql-dfsg-5.0 (5.0.45-3) unstable; urgency=high
-
- * SECURITY:
- Fix for CVE-2007-5925: The convert_search_mode_to_innobase function in
- ha_innodb.cc in the InnoDB engine in MySQL 5.1.23-BK and earlier allows
- remote authenticated users to cause a denial of service (database crash)
- via a certain CONTAINS operation on an indexed column, which triggers an
- assertion error. (closes: #451235)
-
- -- Norbert Tretkowski <nobse@debian.org> Thu, 15 Nov 2007 18:40:11 +0100
-
-mysql-dfsg-5.0 (5.0.45-2) unstable; urgency=low
-
- * Package is now team-maintained. (closes: #421026)
-
- [ Sean Finney ]
- * New/updated debconf translations:
- - Spanish, from Javier Fernández-Sanguino Peña (closes: #426442).
- - German, from Alwin Meschede (closes: #426545).
- - Danish, from Claus Hindsgaul (closes: #426783).
- - French, from Christian Perrier (closes: #430944).
- * Add Recommends on libterm-readkey-perl for mysql-client-5.0 package, used
- by mysqlreport add-on to mask password entry (closes: #438375).
-
- [ Norbert Tretkowski ]
- * Add myself to uploaders.
- * Suggest usage of an update statement on the user table to change the mysql
- root user password instead using mysqladmin, to catch all root users from
- all hosts. (closes: #435744)
- * Remove informations about a crash in the server during flush-logs when
- having expire_logs_days enabled but log-bin not, this bug was fixed in
- 5.0.32 already. (closes: #368547)
- * Disable log_bin option in default config file and add a note to the NEWS
- file. (closes: #349661)
- * Fix FTBFS if build twice in a row. (closes: #442684)
- * Remove check for buggy options from init script.
- * Update innotop to 1.6.0 release.
- * Add mysqlreport and innotop to mysql-client description.
- * Use shorter server version string.
-
- -- Norbert Tretkowski <nobse@debian.org> Wed, 14 Nov 2007 20:00:06 +0100
-
-mysql-dfsg-5.0 (5.0.45-1) unstable; urgency=low
-
- * New upstream release.
-
- [sean finney]
- * removed patches that are incorporated into the latest release:
- - 70_cpuid_on_i486.dpatch
- - 91_SECURITY_CVE-2007-2691_alter-drop
- * new patch 90_upstreamdebiandir.dpatch to keep a few lingering references
- to the upstream ./debian dir out of the build, at least until we find
- a nice way to collaborate on sharing the directory.
- * updated CRUFT list to fix double-build breakage (closes: #424590).
- * add conditional build-deps for linux-libc-dev to fix FTBFS for
- non-linux arch's (closes: #431018).
- * added notes to my.cnf and README.Debian about setting tmpdir when
- configuring a replication slave. thanks to Rudy Gevaert for pointing
- this out (closes: #431825).
-
- -- sean finney <seanius@debian.org> Tue, 17 Jul 2007 23:50:33 +0200
-
-mysql-dfsg-5.0 (5.0.41a-1) unstable; urgency=high
-
- [sean finney]
- * SECURITY:
- Fix for CVE-2007-2691: DROP/RENAME TABLE statements (closes: #424778).
- [Christian Hammers]
- * Removed all manpages from the source (therefore the "41a") as they
- are not licensed under the GPL and redistribution is not permitted
- (thanks to Mathias Gug). Closes: #430018
- * Added linux-libc-dev to the build-depends as else an illegal dependency to
- asm/atomic.h is generated in /usr/include/mysql/my_global.h. Closes: 424276
- [Christian Perrier]
- * Debconf templates and debian/control reviewed by the debian-l10n-
- english team as part of the Smith review project. Closes: #419974
- * Debconf translation updates:
- - French. Closes: #422187
- - Galician. Closes: #420118
- - Italian. Closes: #421349
- - Brazilian Portuguese. Closes: #421516
- - Arabic. Closes: #421751
- - Czech. Closes: #421766
- - Portuguese. Closes: #422428
-
- -- Christian Hammers <ch@debian.org> Sun, 24 Jun 2007 21:12:42 +0200
-
-mysql-dfsg-5.0 (5.0.41-2) unstable; urgency=low
-
- * the previous "translation changes" inadvertently introduced unrelated
- changes in the package control file.
-
- -- sean finney <seanius@debian.org> Sun, 13 May 2007 12:32:45 +0200
-
-mysql-dfsg-5.0 (5.0.41-1) unstable; urgency=low
-
- * New upstream release
- [sean finney]
- * Bump the priority of the debconf prompt for the root password to high, to
- ensure the question shows up in a default installation (closes: #418672).
- * Debconf templates and debian/control reviewed by the debian-l10n-
- english team as part of the Smith review project. Closes: #419974
- * Debconf translation updates:
- - French. Closes: #422187
- - Galician. Closes: #420118
- - Italian. Closes: #421349
- - Brazilian Portuguese. Closes: #421516
- - Arabic. Closes: #421751
- - Czech. Closes: #421766
- - Portuguese. Closes: #422428
- * massaged the local PATH_MAX patch.
- * removed temp sql parsing patch which has been incorporated upstream
- * upstream no longer includes the mysql_create_system_tables command,
- so removed our local patches for it.
- * the following issues may have been fixed in a previous version of
- mysql-server-5.0, but the exact version is not clear so they will be
- marked as fixed in this version.
- * lots of NDB-related fixes, including those related to problems with
- AUTO_INCREMENT (closes: #310878).
- * fix for "connections remaining in sleep state" (closes: #318011).
- * fix for "denies queries randomly" (closes: #399602).
- * problems indexing on char() binary fields were ISAM specific, which is
- no longer supported (closes: #326698).
- * fix for problems with "complicated joins" (closes: 348682).
- * fix for problems with "flushing logs, server crash" (closes: #348682).
- * fix for AUTO_INCREMENT and duplicate keys (closes: #416145).
- * fix for "DROP FUNCTIONS doesn't work" (closes: #290670).
-
- -- sean finney <seanius@debian.org> Sat, 12 May 2007 12:10:20 +0200
-
-mysql-dfsg-5.0 (5.0.38-3) unstable; urgency=low
-
- * Added innotop.
- * Changed maintainer email address to
- pkg-mysql-commits@lists.alioth.debian.org
-
- -- Christian Hammers <ch@debian.org> Thu, 19 Apr 2007 19:21:15 +0200
-
-mysql-dfsg-5.0 (5.0.38-2) unstable; urgency=high
-
- * SECURITY:
- In some previous versions mysql_install_db was not idempotent and did
- always create passwordless root accounts although it should only on
- initial installs (thanks to Olaf van der Spek). Closes: #418672
- * Added check for passwordless root accounts to debian-start.
- * As MySQL-5.0 is, at least currently, incompatible with Kernel 2.4 the
- installation is aborted for such old kernels. Debian Etch does not support
- them anyway according to the release notes but this might be unexpected
- and many production servers still have self build ones installed (thanks
- to Marc-Christian Petersen). See: #416841
- * Adjusted TeX build-deps to texlive.
-
- -- Christian Hammers <ch@debian.org> Tue, 17 Apr 2007 01:00:41 +0200
-
-mysql-dfsg-5.0 (5.0.38-1) unstable; urgency=low
-
- * New upstream release.
- * Activated the blackhole engine as it's needed for replicating partition
- designs (thanks to Cyril SCETBON).
- * Fixed segfault on i486 systems without cpuid instruction (thanks to
- Lennart Sorensen). Closes: #410474
- * Only use of the non-essential debconf package in postrm if it is still
- installed (thanks to Michael Ablassmeier). Closes: #416838
-
- -- Christian Hammers <ch@debian.org> Thu, 5 Apr 2007 22:43:41 +0200
-
-mysql-dfsg-5.0 (5.0.36-1) unstable; urgency=low
-
- * New upstream release.
- Closes: #400460, #408159, #408533
-
- -- Christian Hammers <ch@debian.org> Thu, 22 Mar 2007 22:16:31 +0100
-
-mysql-dfsg-5.0 (5.0.32-10) unstable; urgency=high
-
- * Really fixed FTBFS on Sparc introduced with the "make -j" trick in
- 5.0.32-8 (thanks to Frank Lichtenheld). Closes: #415026
-
- -- Christian Hammers <ch@debian.org> Sun, 18 Mar 2007 20:52:33 +0100
-
-mysql-dfsg-5.0 (5.0.32-9) unstable; urgency=high
-
- * Fixed FTBFS on Sparc introduced with the "make -j" trick in 5.0.32-8
- (thanks to Frank Lichtenheld). Closes: #415026
-
- -- Christian Hammers <ch@debian.org> Tue, 15 Mar 2007 18:55:42 +0100
-
-mysql-dfsg-5.0 (5.0.32-8) unstable; urgency=high
-
- [Sean Finney]
- * SECURITY:
- - CVE-2007-1420: Single Row Subselect DoS. Specially crafted subselect
- queries could crash the mysql server. Patch backported from upstream
- changeset 19685 (46_CVE-2007-1420_subselect_dos.dpatch)
- closes: #414790.
- [Christian Hammers]
- * Adapt MAKE_J to use the -j option with the number of available processors.
- (thanks to Raphael Pinson).
- * Updated mysqlreport to latest upstream (and patched --help usage message
- and "return if qcache_size==0").
-
- -- sean finney <seanius@debian.org> Wed, 14 Mar 2007 20:19:08 +0100
-
-mysql-dfsg-5.0 (5.0.32-7) unstable; urgency=low
-
- * Updated French Debconf translation (thanks to Christian Perrier).
- Closes: #411330
- * Updated Danish Debconf translation (thanks to Claus Hindsgaul).
- Closes: #411328
- * Updated Portuguese Debconf translation (thanks to "Traduz").
- Closes: #411339
- * Updated Czech Debconf translation (thanks to Miroslav Kure).
- Closes: #411341
- * Added Norwegian Debconf translation (thanks to Bjorn Steensrud).
- Closes: #411345
- * Updated Spanish Debconf translation (thanks to Javier Fernandez-Sanguino
- Pena). Closes: #411347
- * Updated Japanese Debconf translation (thanks to Hideki Yamane).
- Closes: #411368
- * Updated Swedish Debconf translation (thanks to Andreas Henriksson).
- Closes: #411370
- * Updated Italian Debconf translation (thanks to Luca Monducci).
- Closes: #411377
- * Updated Galician Debconf translation (thanks to Jacobo Tarrio).
- Closes: #411379
- * Updated Russian Debconf translation (thanks to Yuriy Talakan).
- Closes: #411442
- * Updated Basque Debconf translation (thanks to Piarres Beobide).
- Closes: #411457
- * Updated German Debconf translation (thanks to Alwin Meschede).
- Closes: #411480
- * Updated Dutch Debconf translation (thanks to Thijs Kinkhorst).
- * Updated Brazilian Portuguese translation (thanks to Andre Luis Lopes).
- Closes: #411536
- * Updated Romanian Debconf translation (thanks to Stan Ioan-Eugen).
- Closes: #411764
-
- -- Christian Hammers <ch@debian.org> Fri, 16 Feb 2007 23:20:42 +0100
-
-mysql-dfsg-5.0 (5.0.32-6) unstable; urgency=low
-
- * Changed wording in Debconf templates to better fit to the graphical
- interface (thanks to Frank Kuester). Closes: #411165
- * Lintian suggested style changes to some other Debconf questions.
- * Removed accidently stdout output from init script.
-
- -- Christian Hammers <ch@debian.org> Fri, 16 Feb 2007 20:29:18 +0100
-
-mysql-dfsg-5.0 (5.0.32-5) unstable; urgency=medium
-
- * Backported upstream patch for a bug that crashed the server when using
- certain join/group/limit combinations.
- Users of the Joomla CMS seemed to be affected by this. Closes: #403721
- * The debian-start script that runs on every server start now first upgrades
- the system tables (if neccessary) and then check them as it sometimes did
- not work the other way around (e.g. for MediaWiki). The script now uses
- mysql_update instead of mysql_update_script as recommended. Closes: 409780
- * Remove the Debconf generated config file in postrm.
-
- -- Christian Hammers <ch@debian.org> Thu, 15 Feb 2007 04:47:04 +0100
-
-mysql-dfsg-5.0 (5.0.32-4) unstable; urgency=high
-
- [Christian Hammers]
- * Changed minimum required version in dh_makeshlibs to 5.0.27-1 as
- 5.0.26 had an ABI breakage in it!
- This is the cause for Perl programs crashing with the following error:
- "Transactions not supported by database at /usr/lib/perl5/DBI.pm line 672"
- * The old_passwords setting that is set according to a Debconf question is
- now written to /etc/mysql/conf.d/old_passwords.cnf instead directly to the
- conffile /etc/mysql/my.cnf which would be fobidden by policy (thanks to
- Robert Bihlmeyer). Closes: #409750
- * Added some more comments to the default my.cnf.
- [Monty Taylor]
- * Added bison to build dependencies.
- * Added a "start-initial" option to the Data Node init script to support
- initial node starts.
- * Changed NDB Data and Management node startup seqence. Prevented both from
- restarting on upgrade to address rolling upgrade issues.
- * Updated build-depends to depend on automake1.9 instead of automake1.8
- to match what upstream uses.
-
- -- Christian Hammers <ch@debian.org> Wed, 31 Jan 2007 01:14:09 +0100
-
-mysql-dfsg-5.0 (5.0.32-3) unstable; urgency=high
-
- * mysql-server-5.0 pre-depends on adduser now and has --disabled-login
- explicitly added to be on the safe side (thanks to the puiparts team).
- Closes: #408362
- * Corrections the terminology regarding NDB in the comments of all config
- files and init scripts (thanks to Geert Vanderkelen of MySQL).
- * Updated Swedish Debconf translation (thanks to Andreas Henriksson).
- Closes: #407859
- * Updated Czech Debconf translation (thanks to Miroslav Kure).
- Closes: #407809
-
- -- Christian Hammers <ch@debian.org> Thu, 11 Jan 2007 11:18:47 +0100
-
-mysql-dfsg-5.0 (5.0.32-2) unstable; urgency=high
-
- * The last upload suffered from a regression that made NDB totally
- unusable and caused a dependency to libmysqlclient15-dev in the
- mysql-server-5.0 package. The relevant 85_* patch was re-added again.
- Closes: #406435
- * Added lintian-overrides for an error that does not affect our packages.
- There are now only warnings and not errors left.
-
- -- Christian Hammers <ch@debian.org> Tue, 9 Jan 2007 23:55:10 +0100
-
-mysql-dfsg-5.0 (5.0.32-1) unstable; urgency=high
-
- * New upstream version.
- * SECURITY: mysql_fix_privilege_tables.sql altered the
- table_privs.table_priv column to contain too few privileges, causing
- loss of the CREATE VIEW and SHOW VIEW privileges. (MySQL Bug#20589)
- * SECURITY (DoS): ALTER TABLE statements that performed both RENAME TO
- and {ENABLE|DISABLE} KEYS operations caused a server crash. (MySQL
- Bug#24089)
- * SECURITY (DoS): LAST_DAY('0000-00-00') could cause a server crash.
- (MySQL Bug#23653)
- * SECURITY (DoS): Using EXPLAIN caused a server crash for queries that
- selected from INFORMATION_SCHEMA in a subquery in the FROM clause.
- (MySQL Bug#22413)
- * SECURITY (DoS): Invalidating the query cache (e.g. when using stored procedures)
- caused a server crash for INSERT INTO ... SELECT statements that
- selected from a view. (MySQL Bug#20045)
- * Using mysql_upgrade with a password crashed the server. Closes: #406229
- * yaSSL crashed on pre-Pentium Intel and Cyrix CPUs. (MySQL Bug#21765)
- Closes: #383759
- * Lots of small fixes to the NDB cluster storage engine.
- * Updated Japanese Debconf template (thanks to Hideki Yamane).
- Closes: #405793
- * Fixed comment regarding "mycheck" in debian-start (thanks to
- Enrico Zini). Closes: #405787
-
- -- Christian Hammers <ch@debian.org> Sat, 6 Jan 2007 14:26:20 +0100
-
-mysql-dfsg-5.0 (5.0.30-3) unstable; urgency=low
-
- * Updated Brazilian Debconf translation (thanks to Andre Luis Lopes).
- Closes: #403821
- * Added Romanian Debconf translation (thanks to Stan Ioan-Eugen).
- Closes: #403943
- * Updated Spanish Debconf translation (thanks to Javier Fernandez-Sanguino
- Pena). Closes: #404084
- * Updated Galician Debconf translation (thanks to Jacobo Tarrio).
- Closes: #404318
- * Updated Dutch Debconf translation (thanks to Vincent Zweije).
- Closes: #404566
- * Updated Danish Debconf translation (thanks to Claus Hindsgaul).
- Closes: #405018
-
- -- Christian Hammers <ch@debian.org> Thu, 21 Dec 2006 21:35:09 +0100
-
-mysql-dfsg-5.0 (5.0.30-2) unstable; urgency=high
-
- * Fixed upstream regression in header files that lead to FTBFS for
- mysql-admin, mysql-query-browser and probably other pacakges.
- (thanks to Andreas Henriksson). Closes: #403081, #403082
- * Fixed some upstream scripts by replacing /etc by /etc/mysql (thanks to
- Julien Antony). Closes: #401083
- * Updated French Debconf translation (thanks to Christian Perrier).
- Closes: #401434
- * Added Spanish Debconf translation (thanks to Javier Fernandez-Sanguino
- Pena). Closes: #401953
- * Marked a Debconf question that is just a dummy and only internally
- used as not-needing-translation. Closes: #403163
- * Fixed mysqlslowdump patch to not remove the usage() function (thanks
- to Monty Tailor).
-
- -- Christian Hammers <ch@debian.org> Sun, 3 Dec 2006 19:20:10 +0100
-
-mysql-dfsg-5.0 (5.0.30-1) unstable; urgency=low
-
- * New upstream version (switch to the MySQL Enterprise branch).
- * Upstream bugfix for the Innodb performance bug:
- "Very poor performance with multiple queries running
- concurrently (Bug#15815)".
- * Upstream bugfix for a possible server crash:
- "Selecting from a MERGE table could result in a server crash if the
- underlying tables had fewer indexes than the MERGE table itself
- (Bug#22937)"
- * Upstream bugfies for *lot* of NDB problems.
- * Upstream bugfix for Innodb optimizer bug. Closes: #397597
- * Updated Italian Debconf translation (thanks to Luca Monducci).
- Closes: #401305
- * Updated debian/watch file to MySQL Enterprise branch.
-
- -- Christian Hammers <ch@debian.org> Sat, 2 Dec 2006 16:36:38 +0100
-
-mysql-dfsg-5.0 (5.0.27-2) unstable; urgency=medium
-
- * Disabled YaSSL x86 assembler as it was reported to crash applications
- like pam-mysql or proftpd-mysql which are linked against libmysqlclient
- on i486 and Cyrix (i586) CPUs. Closes: #385147
- * Adjusted mysql-server-4.1 priority to extra and section to oldlibs
- according to the ftp masters overrides.
- * Updated German Debconf translation (thanks to Alwin Meschede).
- Closes: #400809
-
- -- Christian Hammers <ch@debian.org> Wed, 22 Nov 2006 13:36:31 +0100
-
-mysql-dfsg-5.0 (5.0.27-1) unstable; urgency=medium
-
- * New upstream version (but no codechange, the only difference to 5.0.26
- was a patch to the ABI change which Debian already included.
- * When dist-upgrading from mysql-server-4.1/sarge dpkg does not longer
- ask unnecessary "config file has changed" questions regarding
- /etc/init.d/mysql, /etc/logrotate.d/mysql-server and
- /etc/mysql/debian-start just because these files previously belonged
- to mysql-server-4.1 and not to mysql-server-5.0.
- To archive this mysql-server-5.0 now pre-depends on mysql-common which
- provides current versions of those files.
- * The automatic run mysql_upgrade now works with non-standard datadir
- settings, too (thanks to Benjami Villoslada). Closes: #394607
- * Debconf now asks if the old_passwords option is really needed.
- * Improved explanations of the old_passwords variable in my.cnf.
- * Removed possibly leftover cron script from MySQL-4.1 (thanks to
- Mario Oyorzabal Salgado). Closes: #390889
- * Postrm ignores failed "userdel mysql".
- * Updated Danish Debconf translation (thanks to Claus Hindsgaul).
- Closes: #398784
- * Added Euskarian Debconf translation (thanks to Piarres Beobide).
- Closes: #399045
- * Updated Japanese Debconf translation (thanks to Hideki Yamane).
- Closes: #399074
- * Updated German Debconf translation (thanks to Alwin Meschede).
- Closes: #399087
- * New Portuguese debconf translations from Miguel Figueiredo.
- Closes: #398186
-
- -- Christian Hammers <ch@debian.org> Tue, 7 Nov 2006 21:26:25 +0100
-
-mysql-dfsg-5.0 (5.0.26-3) unstable; urgency=high
-
- [sean finney]
- * Fix for the deadly ISAM trap. Now during upgrades we will do our
- very best to convert pre-existing ISAM format tables using the
- binaries from the previous package. Success is not guaranteed, but
- this is probably as good as it gets. Note that this also necessitates
- re-introducing an (empty transitional) mysql-server-4.1 package.
- Closes: #354544, #354850
- * Remove a couple spurious and wrongly placed WARNING statements from
- 45_warn-CLI-passwords.dpatch. thanks to Dan Jacobsen for pointing these
- out. Closes: #394262
-
- -- sean finney <seanius@debian.org> Fri, 03 Nov 2006 18:34:46 +0100
-
-mysql-dfsg-5.0 (5.0.26-2) unstable; urgency=high
-
- * Fixed FTBFS for Alpha by applying an upstream patch (thanks to Falk
- Hueffner). Closes: #395921
-
- -- Christian Hammers <ch@debian.org> Sat, 28 Oct 2006 20:13:46 +0200
-
-mysql-dfsg-5.0 (5.0.26-1) unstable; urgency=high
-
- * SECURITY:
- This combined release of 5.0.25 and 5.0.26 fixes lot of possible server
- crashs so it should get into Etch. Quoting the changelog (bug numbers are
- bugs.mysql.com ones):
- - character_set_results can be NULL to signify no conversion, but some
- code did not check for NULL, resulting in a server crash. (Bug#21913)
- - Using cursors with READ COMMITTED isolation level could cause InnoDB to
- crash. (Bug#19834)
- - Some prepared statements caused a server crash when executed a second
- time. (Bug#21166)
- - When DROP DATABASE or SHOW OPEN TABLES was issued while concurrently
- issuing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE or any other
- statement that required a name lock) in another connection, the server
- crashed. (Bug#21216)
- - Use of zero-length variable names caused a server crash. (Bug#20908)
- - For InnoDB tables, the server could crash when executing NOT IN ()
- subqueries. (Bug#21077)
- - Repeated DROP TABLE statements in a stored procedure could sometimes
- cause the server to crash. (Bug#19399)
- - Performing an INSERT on a view that was defined using a SELECT that
- specified a collation and a column alias caused the server to crash
- (Bug#21086).
- - A query of the form shown here caused the server to crash. (Bug#21007)
- - NDB Cluster: Some queries involving joins on very large NDB tables could
- crash the MySQL server. (Bug#21059)
- - The character set was not being properly initialized for CAST() with a
- type like CHAR(2) BINARY, which resulted in incorrect results or even a
- server crash. (Bug#17903)
- - For certain queries, the server incorrectly resolved a reference to an
- aggregate function and crashed. (Bug#20868)
- - The server crashed when using the range access method to execut a
- subquery with a ORDER BY DESC clause. (Bug#20869)
- - Triggers on tables in the mysql database caused a server crash. Triggers
- for tables in this database now are disallowed. (Bug#18361)
- - Using SELECT on a corrupt MyISAM table using the dynamic record format
- could cause a server crash. (Bug#19835)
- - Use of MIN() or MAX() with GROUP BY on a ucs2 column could cause a
- server crash. (Bug#20076)
- - Selecting from a MERGE table could result in a server crash if the
- underlying tables had fewer indexes than the MERGE table itself.
- (Bug#21617, Bug#22937)
-
- * New upstream release.
- - This bug would cause trouble for Sarge->Etch upgrades, it was supposed to
- have been fixed in 5.0.16 but that apparently did not fix the whole
- problem:
- Using tables from MySQL 4.x in MySQL 5.x, in particular those with VARCHAR
- fields and using INSERT DELAYED to update data in the table would result in
- either data corruption or a server crash. (Bug#16611, Bug#16218, Bug#17294)
- Closes: #386337
- - Fixes data corruption as an automatic client reconnect used to set
- the wrong character set. Closes: #365050
- - Fixes an undefined ulong type in an include file. Closes: #389102
- - Fixes wrong output format when using Unicode characters. Closes: #355302
- - Fixes mysql_upgrade when using a password. Closes: #371841
-
- [Christian Hammers]
- * Removed --sysconfdir from debian/rules as it puts /etc/mysql/ at the
- end of the my.cnf search patch thus overriding $HOME/my.cnf
- (thanks to Christoph Biedl). Closes: #394992
- * The provided patch from bug #385947 was wrong, the variable is called
- BLOCKSIZE not BLOCK_SIZE according to "strings `which df`" (thanks to
- Bruno Muller). Closes: #385947
-
- [sean finney]
- * new dutch debconf translations from Vincent Zweije (closes: #392809).
- * new japanese debconf translations from Hideki Yamane (closes: #391625).
- * new italian debconf translations from Luca Monducci (closes: #391741).
- * new french debconf translations from Christian Perrier (closes: #393334).
- * ran debconf-updatepo to merge the fuzzies into svn.
- * massage the following patches so they continue to apply cleanly:
- - 44_scripts__mysql_config__libs.dpatch to cleanly apply.
- - 45_warn-CLI-passwords.dpatch
- - 96_TEMP__libmysqlclient_ssl_symbols.dpatch (note, this patch might
- no longer be needed, but is retained "just in case" after massaging it)
- * the following patches have been incorporated upstream:
- - 70_kfreebsd.dpatch
- - 80_hurd_mach.dpatch
- - 87_ps_Hurd.dpatch
- - 90_TEMP__client__mysql_upgrade__O_EXEC.dpatch
- - 91_TEMP__client__mysql_upgrade__password.dpatch
- - 92_TEMP__client__mysql_upgrade__defaultgroups.dpatch
- - 94_TEMP__CVE-2006-4227.dpatch
- - 95_TEMP__CVE-2006-4226.dpatch
- * the udf_example.cc has disappeared from the source code, but there's
- a udf_example.c which seems to be a good example to use instead :)
- * update documentation in the configuration to no longer reference
- using my.cnf in the DATADIR, as it's never been the recommended
- method for debian systems and hasn't worked since 5.0 was released
- anyway (closes: #393868).
-
- -- Christian Hammers <ch@debian.org> Wed, 25 Oct 2006 19:54:04 +0200
-
-mysql-dfsg-5.0 (5.0.24a-9) unstable; urgency=medium
-
- * Having expire_logs_days enabled but log-bin not crashes the server. Using
- both or none of those options is safe. To prevent this happening during the
- nightly log rotation via /etc/logrotate.d/mysql the initscript checks for
- malicious combination of options. See: #368547
- * The Sarge package "mysql-server" which used to include the mysqld daemon
- may still be in unselected-configured state (i.e. after a remove but not
- purge) in which case its now obsolete cronscript has to be moved away
- (thanks to Charles Lepple). Closes: #385669
- * Updated Danish Debconf translation (thanks to Claus Hindsgaul).
- Closes: #390315
- * Updated Frensh Debconf translation (thanks to Christian Perrier).
- Closes: #390980
-
- -- Christian Hammers <ch@debian.org> Tue, 3 Oct 2006 14:55:31 +0200
-
-mysql-dfsg-5.0 (5.0.24a-8) unstable; urgency=low
-
- * (broken upload)
-
- -- Christian Hammers <ch@debian.org> Tue, 3 Oct 2006 14:55:31 +0200
-
-mysql-dfsg-5.0 (5.0.24a-7) unstable; urgency=low
-
- * Stopped mysql_config from announcing unnecessary library dependencies
- which until now cause "NEEDED" dependencies in the "readelf -d" output
- of libraries who only depend on libmysqlclient.so (thanks to Michal
- Cihar). Closes: #390692
-
- -- Christian Hammers <ch@debian.org> Sun, 1 Oct 2006 23:59:43 +0200
-
-mysql-dfsg-5.0 (5.0.24a-6) unstable; urgency=low
-
- [sean finney]
- * finally add support for setting a root password at install.
- while this is not a random password as requested in one bug
- report, we believe it is the best solution and provides a
- means to set a random password via preseeding if it's really
- desired (Closes: #316127, #298295).
-
- -- sean finney <seanius@debian.org> Sun, 01 Oct 2006 23:34:30 +0200
-
-mysql-dfsg-5.0 (5.0.24a-5) unstable; urgency=low
-
- * Added ${shlibs:Depends} to debian/control section libmysqlclient-dev as it
- contains the experimental /usr/lib/mysql/libndbclient.so.0.0.0.
- * Bumped standards version to 3.7.2.
- * Added LSB info section to init scripts.
- * Rephrased Debconf templates as suggested by lintian.
- * Added benchmark suite in /usr/share/mysql/sql-bench/.
- * The mysql.timezone* tables are now filled by the postinst script (thanks
- to Mark Sheppard). Closes: #388491
- * Moved Debconf install notes to README.Debian. Displaying them with
- medium priority was a bug anyway. Closes: #388941
- * Replaced /usr/bin/mysql_upgrade by /usr/bin/mysql_upgrade_shell in
- /etc/mysql/debian-start.sh as it works without errors (thanks to Javier
- Kohen). Closes: #389443
-
- -- Christian Hammers <ch@debian.org> Wed, 20 Sep 2006 15:01:42 +0200
-
-mysql-dfsg-5.0 (5.0.24a-4) unstable; urgency=high
-
- * libmysqlclient.so.15 from 5.0.24 accidentaly exports some symbols that are
- historically exported by OpenSSL's libcrypto.so. This bug was supposed to
- be fixed in 5.0.24a bug according to the mysql bug tracking system will
- only be fixed in 5.0.25 so I backported the patch. People already reported
- crashing apps due to this (thanks to Duncan Simpson). See also: #385348
- Closes: #388262
- * Fixed BLOCKSIZE to BLOCK_SIZE in initscript (thanks to Bruno Muller).
- Closes: #385947
- * Added hint to "--extended-insert=0" to mysqldump manpage (thanks to Martin
- Schulze).
- * Documented the meaning of "NDB" in README.Debian (thanks to Dan Jacobson).
- Closes: #386274
- * Added patch to build on hurd-i386 (thanks to Cyril Brulebois). Closes: #387369
- * Fixed debian-start script to work together with the recend LSB modifications in
- the initscript (thanks to wens). Closes: #387481
- * Reverted tmpdir change in my.cnf back to /tmp to comply with FHS (thanks
- to Alessandro Valente). Closes: #382778
- * Added logcheck filter rule (thanks to Paul Wise). Closes: #381043
- * I will definetly not disable InnoDB but added a note to the default my.cnf
- that disabling it saves about 100MB virtual memory (thanks to Olivier
- Berger). Closes: #384399
- * Added thread_cache_size=8 to default my.cnf as this variable seems to have
- a negligible memory footprint but can improve performance when lots of
- threads connect simultaneously as often seen on web servers.
-
- -- Christian Hammers <ch@debian.org> Mon, 4 Sep 2006 00:21:50 +0200
-
-mysql-dfsg-5.0 (5.0.24a-3) unstable; urgency=low
-
- * Fixed potential tempfile problem in the newly added mysqlreport script.
-
- -- Christian Hammers <ch@debian.org> Sun, 3 Sep 2006 23:17:24 +0200
-
-mysql-dfsg-5.0 (5.0.24a-2) unstable; urgency=low
-
- * Added "mysqlreport" (GPL'ed) from hackmysql.com.
- * Temporarily disabled expire_days option as it causes the server
- to crash. See #368547
- * Made output of init scripts LSB compliant (thanks to David Haerdeman).
- Closes: #385874
-
- -- Christian Hammers <ch@debian.org> Sun, 3 Sep 2006 19:06:53 +0200
-
-mysql-dfsg-5.0 (5.0.24a-1) unstable; urgency=high
-
- * New upstream version.
- * The shared library in the 5.0.24 upstream release accidently exported
- some symbols that are also exported by the OpenSSL libraries (notably
- BN_bin2bn) causing unexpected behaviour in applications using these
- functions (thanks to Peter Cernak). Closes: #385348
- * Added note about possible crash on certain i486 clone CPUs.
- * Made recipient address of startup mysqlcheck output configurable
- (thanks to Mattias Guns). Closes: #385119
-
- -- Christian Hammers <ch@debian.org> Mon, 28 Aug 2006 01:22:12 +0200
-
-mysql-dfsg-5.0 (5.0.24-3) unstable; urgency=high
-
- * SECURITY:
- CVE-2006-4226:
- When run on case-sensitive filesystems, MySQL allows remote
- authenticated users to create or access a database when the database
- name differs only in case from a database for which they have
- permissions.
- CVE-2006-4227:
- MySQL evaluates arguments of suid routines in the security context of
- the routine's definer instead of the routine's caller, which allows
- remote authenticated users to gain privileges through a routine that
- has been made available using GRANT EXECUTE.
- Thanks to Stefan Fritsch for reporting. Closes: #384798
-
- -- Christian Hammers <ch@debian.org> Sat, 26 Aug 2006 04:55:17 +0200
-
-mysql-dfsg-5.0 (5.0.24-2) unstable; urgency=high
-
- * 5.0.24-1 introduced an ABI incompatibility, which this patch reverts.
- Programs compiled against 5.0.24-1 are not compatible with any other
- version and needs a rebuild.
- This bug already caused a lot of segfaults and crashes in various
- programs. Thanks to Chad MILLER from MySQL for quickly providing a patch.
- The shlibdeps version has been increased to 5.0.24-2.
- Closes: #384047, #384221, #383700
-
- -- Christian Hammers <ch@debian.org> Fri, 25 Aug 2006 21:47:35 +0200
-
-mysql-dfsg-5.0 (5.0.24-1) unstable; urgency=high
-
- * SECURITY: Upstream fixes a security bug which allows a user to continue
- accessing a table using a MERGE TABLE after the right to direct access to
- the database has been revoked (CVE-2006-4031, MySQL bug #15195).
- (Well they did not exactly fixed it, they documented the behaviour and
- allow the admin to disable merge table alltogether...). Closes: #380271
- * SECURITY: Applied patch that fixes a possibly insecure filehandling
- in the recently added mysql_upgrade binary file (MySQL bug #10320).
- * New upstream version.
- - Fixes nasty MySQL bug #19618 that leads to crashes when using
- "SELECT ... WHERE ... not in (1, -1)" (e.g. vbulletin was affected).
- - Fixes upstream bug #16803 so that linking ~/.mysql_history to /dev/null
- now has the desired effect of having no history.
- * Really fixed the runlevels. Closes: #377651
- * Added patch for broken upstream handling of "host=" to mysql_upgrade.c.
- * Adjusted /etc/mysql/debian-start to new mysql_upgrade.c
-
- -- Christian Hammers <ch@debian.org> Tue, 8 Aug 2006 00:44:13 +0200
-
-mysql-dfsg-5.0 (5.0.22-5) unstable; urgency=low
-
- * Added further line to the logcheck ignore files (thanks to Paul Wise).
- Closes: #381038
-
- -- Christian Hammers <ch@debian.org> Wed, 2 Aug 2006 00:28:50 +0200
-
-mysql-dfsg-5.0 (5.0.22-4) unstable; urgency=low
-
- * Upstream fixes a bug in the (never released) version 5.0.23 which could
- maybe used to crash the server if the mysqlmanager daemon is in use
- which is not yet the default in Debian. (CVE-2006-3486 *DISPUTED*)
- * Changed runlevel priority of mysqld from 20 to 19 so that it gets started
- before apache and proftpd etc. which might depend on an already running
- database server (thanks to Martin Gruner). Closes: #377651
- * Added patch which sets PATH_MAX in ndb (thanks to Cyril Brulebois).
- Closes: #378949
- * Activated YaSSL as licence issues are settled according to:
- http://bugs.mysql.com/?id=16755. This also closes the FTBFS bug
- regarding OpenSSL as it is discouraged to use now. Closes: #368639
- * Removed SSL-MINI-HOWTO as the official documentation is good enough now.
- * mysql_upgrade no longer gives --password on the commandline which would
- be insecure (thanks to Dean Gaudet). Closes: #379199
- * Adjusted debian/patches/45* to make consecutive builds in the same source
- tree possible (thanks to Bob Tanner). Closes: #368661
- * mysql-server-5.0 is now suggesting tinyca as yaSSL is enabled and tinyca
- was found to be really cool :)
- * Moved tempdir from /tmp to /var/tmp as it will more likely have enough
- free space as /tmp is often on the root partition and /var or at least
- /var/tmp is on a bigger one.
-
- -- Christian Hammers <ch@debian.org> Mon, 10 Jul 2006 23:30:26 +0200
-
-mysql-dfsg-5.0 (5.0.22-3) unstable; urgency=low
-
- * Added patch for MySQL bug #19618: "select x from x
- where x not in(1,-1)" may crash the server" (thanks to
- Ruben Puettmann).
-
- -- Christian Hammers <ch@debian.org> Fri, 9 Jun 2006 01:41:44 +0200
-
-mysql-dfsg-5.0 (5.0.22-2) unstable; urgency=high
-
- * Fixed debian-sys-maint related bug in postinst (thanks to
- Jean-Christophe Dubacq). Closes: #369970
- * The last upload was a security patch (which I did not know as I
- uploaded before the announcement came). I now added the CVE id for
- reference and set urgency to high as the last entry did not.
-
- -- Christian Hammers <ch@debian.org> Wed, 31 May 2006 01:04:11 +0200
-
-mysql-dfsg-5.0 (5.0.22-1) unstable; urgency=low
-
- * SECURITY: This upstream release fixes an SQL-injection with multibyte
- encoding problem. (CVE-2006-2753)
- * New upstream release.
- * Upstream fixes REPAIR TABLE problem. Closes: #354300
- * Upstream fixes problem that empty strings in varchar and text columns
- are displayed as NULL. Closes: #368663
-
- -- Christian Hammers <ch@debian.org> Tue, 30 May 2006 23:43:24 +0200
-
-mysql-dfsg-5.0 (5.0.21-4) unstable; urgency=low
-
- * Added "BLOCKSIZE=" to the diskfree check (thanks to Farzad FARID).
- Closes: #367027, #367083
- * Further fixed mysql_upgrade upstream script (thanks to Andreas Pakulat)
- Closes: #366155
- * Adjusted the /proc test in debian/rules from /proc/1 to /proc/self
- to make building on grsec systems possible (thanks to K. Rosenegger).
- Closes: #366824
- * Updated Russion Debconf translation (thanks to Yuriy Talakan).
- Closes: #367141
- * Updated Czech Debconf translation (thanks to Kiroslav Kure).
- Closes: #367160
- * Updated Galician Debconf translation (thanks to Jacobo Tarrio).
- Closes: #367384
- * Updated Swedish Debconf translation (thanks to Daniel Nylander).
- Closes: #368186
-
- -- Christian Hammers <ch@debian.org> Wed, 10 May 2006 08:45:42 +0200
-
-mysql-dfsg-5.0 (5.0.21-3) unstable; urgency=low
-
- * Fixed FTBFS problem which was caused by a patch that modifies Makefile.am
- as well as Makefile.in and was not deteced because my desktop was fast
- enough to patch both files within the same second and so fooled automake.
- (thanks to Blars Blarson for notifying me). Closes: #366534
-
- -- Christian Hammers <ch@debian.org> Sat, 6 May 2006 19:03:58 +0200
-
-mysql-dfsg-5.0 (5.0.21-2) unstable; urgency=low
-
- * Fixed bug in postinst that did not correctly rewrite
- /etc/mysql/debian.cnf (thanks to Daniel Leidert).
- Closes: #365433, #366155
-
- -- Christian Hammers <ch@debian.org> Thu, 4 May 2006 02:37:03 +0200
-
-mysql-dfsg-5.0 (5.0.21-1) unstable; urgency=high
-
- * SECURITY: New upstream release with some security relevant bugfixes:
- * "Buffer over-read in check_connection with usernames lacking a
- trailing null byte" (CVE-2006-1516)
- * "Anonymous Login Handshake - Information Leakage" (CVE-2006-1517)
- * "COM_TABLE_DUMP Information Leakage and Arbitrary command execution"
- (CVE-2006-1518)
- Closes: #365938, #365939
- * Added diskfree check to the init script (thanks to Tim Baverstock).
- Closes: #365460
- * First amd64 upload!
-
- -- Christian Hammers <ch@debian.org> Sat, 29 Apr 2006 04:31:27 +0200
-
-mysql-dfsg-5.0 (5.0.20a-2) unstable; urgency=low
-
- * The new mysql-upgrade which is started from /etc/mysql/debian-start
- does now use the debian-sys-maint user for authentication (thanks to
- Philipp). Closes: #364991
- * Wrote patch debian/patches/43* which adds a password option to
- mysql_update. See MySQL bug #19400.
- * Added "Provides: libmysqlclient-dev" to libmysqlclient15-dev as I saw no
- obvious reasons against it (problems should be documented in
- debian/README.Maintainer!) (thanks to Olaf van der Spek). Closes: #364899
- * Updated Netherlands debconf translation (thanks to Vincent Zweije)
- Closes: #364464
- * Updated French debconf translation (thanks to Christian Perrier)
- Closes: #364401
- * Updated Danish debconf translation (thanks to Claus Hindsgaul)
- Closes: #365135
-
- -- Christian Hammers <ch@debian.org> Wed, 26 Apr 2006 01:14:53 +0200
-
-mysql-dfsg-5.0 (5.0.20a-1) unstable; urgency=low
-
- * New upstream release.
- * Added the new mysql_upgrade script and added it to
- /etc/mysql/debian-start (thanks to Alessandro Polverini).
- The script is currently very noise that is a known bug and will be
- fixed in the next release!
- Closes: #363458
- * No longer creates the "test" database. This actuallay had been tried
- to archive before (at least patches) exists but apparently was not the
- case in the last versions (thanks to Olaf van der Spek). Closes: #362126
- * Reformatted libmysqlclient15off.NEWS.Debian to changelog format
- (thanks to Peter Palfrader). Closes: #363062
-
- -- Christian Hammers <ch@debian.org> Sat, 15 Apr 2006 13:05:22 +0200
-
-mysql-dfsg-5.0 (5.0.20-1) unstable; urgency=high
-
- * Upstream contains a fix for a nasty bug (MySQL#18153) that users
- already experienced and that caused corrupted triggers after
- REPAIR/OPTIMIZE/ALTER TABLE statements.
- (thanks to Jerome Despatis for pointing out)
- * Added patch for the "updates on multiple tables is buggy after
- upgrading from 4.1 to 5.0" problem which MySQL has been committed
- for the upcoming 5.0.21 release. Closes #352704
- * Added Netherlands debconf translation (thanks to Vincent Zweije).
- Closes: #360443
- * Added Galician debconf translation (thanks to Jacobo Tarrio).
- Closes: #361257
-
- -- Christian Hammers <ch@debian.org> Fri, 7 Apr 2006 00:00:43 +0200
-
-mysql-dfsg-5.0 (5.0.19-3) unstable; urgency=high
-
- [ Christian Hammers ]
- * Fixed libmysqlclient15.README.Debian regarding package name changes
- (thanks to Leppo).
- * Moved libheap.a etc. back to /usr/lib/mysql/ as their names are just
- too generic. Closes: #353924
- [ Sean Finney ]
- * updated danish debconf translation, thanks to Claus Hindsgaul
- (closes: #357424).
- [ Adam Conrad ]
- * Send stderr from 'find' in preinst to /dev/null to tidy up chatter.
- * Backport patch for CVE-2006-0903 from the upcoming release to resolve
- a log bypass vulnerability when using non-binary logs (closes: #359701)
-
- -- Adam Conrad <adconrad@0c3.net> Tue, 4 Apr 2006 15:23:18 +1000
-
-mysql-dfsg-5.0 (5.0.19-2) unstable; urgency=medium
-
- * New upstream release.
- * Renamed package libmysqlclient15 to libmysqlclient15off due to
- binary incompatible changes.
- See /usr/share/doc/libmysqlclient15off/README.Debian
- * Updated Czech debconf translation (thanks to Miroslav Kure).
- Closes: #356503
- * Updated French debconf translation (thanks to Christian Perrier).
- Closes: #356332
- * Improved README.Debian (thanks to Olaf van der Spek). Closes: #355702
- * Fixed 5.0.18-8 changelog by saying in which package the NEWS.Debian
- file is (thanks to Ross Boylan). Closes: #355978
-
- -- Christian Hammers <ch@debian.org> Fri, 17 Mar 2006 02:32:19 +0100
-
-mysql-dfsg-5.0 (5.0.19-1) experimental; urgency=medium
-
- * New upstream release.
- * SECURITY: CVE-2006-3081: A bug where str_to_date(1,NULL) lead to a
- server crash has been fixed.
- (this note has been added subsequently for reference)
- * Renamed package libmysqlclient15 to libmysqlclient15off.
- See /usr/share/doc/libmysqlclient15off/NEWS.Debian
- * Updated Czech debconf translation (thanks to Miroslav Kure).
- Closes: #356503
- * Updated French debconf translation (thanks to Christian Perrier).
- Closes: #356332
- * Improved README.Debian (thanks to Olaf van der Spek). Closes: #355702
- * Fixed 5.0.18-8 changelog by saying in which package the NEWS.Debian
- file is (thanks to Ross Boylan). Closes: #355978
-
- -- Christian Hammers <ch@debian.org> Tue, 14 Mar 2006 22:56:13 +0100
-
-mysql-dfsg-5.0 (5.0.18-9) unstable; urgency=medium
-
- [ Christian Hammers ]
- * When using apt-get the check for left-over ISAM tables can abort the
- installation of mysql-server-5.0 but not prevent the mysql-server-4.1
- package from getting removed. The only thing I can do is reflect this
- in the Debconf notice that is shown and suggest to reinstall
- mysql-server-4.1 for converting. See: #354850
- * Suggests removing of /etc/cron.daily/mysql-server in last NEWS message
- (thanks to Mourad De Clerck). Closes: #354111
- * Added versioned symbols for kfreebsd and Hurd, too (thanks to Aurelien
- Jarno and Michael Bank). Closes: #353971
- * Added versioned symbols for kfreebsd, too (thanks to Aurelien Jarno).
- Closes: #353971
- [ Adam Conrad ]
- * Add 39_scripts__mysqld_safe.sh__port_dir.dpatch to ensure that the
- permissions on /var/run/mysqld are always correct, even on a tmpfs.
-
- -- Christian Hammers <ch@debian.org> Mon, 6 Mar 2006 21:42:13 +0100
-
-mysql-dfsg-5.0 (5.0.18-8) unstable; urgency=low
-
- * The rotation of the binary logs is now configured via
- expire-logs-days in /etc/mysql/my.cnf and handled completely
- by the server and no longer in configured in debian-log-rotate.conf
- and handled by a cron job. Thanks to David Johnson.
- See /usr/share/doc/mysql-server-5.0/NEWS.Debian
- * Ran aspell over some files in debian/ and learned a lot :)
- * debian/rules: Added check if versioned symbols are really there.
- * Updated SSL-MINI-HOWTO.
- * Updated copyright (removed the parts regarding the now removed
- BerkeleyDB table handler and mysql-doc package).
- * Relocated a variable in preinst (thanks to Michael Heldebrant).
- Closes: #349258, #352587, #351216
- * Updated Danish debconf translation (thanks to Claus Hindsgaul).
- Closes: #349013
- * Updated Swedish debconf translation (thanks to Daniel Nylander).
- Closes: #349522
- * Updated French debconf translation (thanks to Christian Perrier).
- Closes: #349592
- * Fixed typo in README.Debian (thanks to Vincent Ricard).
- * Prolonged waiting time for mysqld in the init script. Closes: #352070
-
- -- Christian Hammers <ch@debian.org> Mon, 23 Jan 2006 23:13:46 +0100
-
-mysql-dfsg-5.0 (5.0.18-7) unstable; urgency=low
-
- * Made mailx in debian-start.inc.sh optional and changed the dependency on it
- on it to a mere recommendation. Closes: #316297
- * the previous FTBFS patches for GNU/Hurd inadvertently led to configure
- being regenerating, losing a couple trivial things like our versioned
- symbols patch, causing many nasty problems (closes: #348854).
-
- -- sean finney <seanius@debian.org> Fri, 20 Jan 2006 20:59:27 +0100
-
-mysql-dfsg-5.0 (5.0.18-6) unstable; urgency=low
-
- * Added version comment (thanks to Daniel van Eeden).
- * Added two patches to build on GNU/Hurd (thanks to Michael Bank).
- Closes: #348182
- * Abort upgrade if old and now unsupported ISAM tables are present
- (thanks to David Coe). Closes: #345895
-
- -- Christian Hammers <ch@debian.org> Tue, 17 Jan 2006 19:25:59 +0100
-
-mysql-dfsg-5.0 (5.0.18-5) unstable; urgency=low
-
- * Bump shlibdeps for libmysqlclient15 to (>= 5.0.15-1), which was
- the first non-beta release from upstream, as well as being shortly
- after we broke the ABI in Debian by introducing versioned symbols.
-
- -- Adam Conrad <adconrad@0c3.net> Fri, 13 Jan 2006 13:18:03 +1100
-
-mysql-dfsg-5.0 (5.0.18-4) unstable; urgency=low
-
- * Munge our dependencies further to smooth upgrades even more, noting
- that we really need 5.0 to conflict with 4.1, and stealing a page from
- the book of mysql-common, it doesn't hurt to hint package managers in
- the direction of "hey, this stuff is a complete replacement for 4.1"
- * Change the description of mysql-server and mysql-client to remove the
- references to it being "transition", and instead point out that it's
- the way to get the "current best version" of each package installed.
-
- -- Adam Conrad <adconrad@0c3.net> Wed, 11 Jan 2006 11:39:45 +1100
-
-mysql-dfsg-5.0 (5.0.18-3) unstable; urgency=low
-
- * Make the mysql-{client,server}-5.0 conflict against mysql-{client,server}
- versioned, so they can be installed side-by-side and upgrade properly.
- * Add myself to Uploaders; since I have access to the alioth repository.
-
- -- Adam Conrad <adconrad@0c3.net> Tue, 10 Jan 2006 19:15:48 +1100
-
-mysql-dfsg-5.0 (5.0.18-2) unstable; urgency=low
-
- * Removed the transitional package that forced an upgrade from
- mysql-server-4.1 to mysql-server-5.0 as I was convinced that
- having a general "mysql-server" package with adjusted dependencies
- is enough (thanks to Adam Conrad).
- * Updated logcheck.ignore files (thanks to Jamie McCarthy). Closes: #340193
-
- -- Christian Hammers <ch@debian.org> Mon, 9 Jan 2006 21:54:53 +0100
-
-mysql-dfsg-5.0 (5.0.18-1) unstable; urgency=low
-
- * New upstream version.
- * Added empty transitional packages that force an upgrade from the
- server and client packages that have been present in Sarge.
- * Fixed SSL-MINI-HOWTO (thanks to Jonas Smedegaard). Closes: #340589
-
- -- Christian Hammers <ch@debian.org> Mon, 2 Jan 2006 21:17:51 +0100
-
-mysql-dfsg-5.0 (5.0.17-1) unstable; urgency=low
-
- * Never released as Debian package.
-
- -- Christian Hammers <ch@debian.org> Thu, 22 Dec 2005 07:49:52 +0100
-
-mysql-dfsg-5.0 (5.0.16-1) unstable; urgency=low
-
- * New upstream version.
- * Removed the error logs from the logrotate script as Debian does
- not use them anymore. Closes: #339628
-
- -- Christian Hammers <ch@debian.org> Tue, 22 Nov 2005 01:19:11 +0100
-
-mysql-dfsg-5.0 (5.0.15-2) unstable; urgency=medium
-
- * Added 14_configure__gcc-atomic.h.diff to fix FTBFS on m68k
- (thanks to Stephen R Marenka). Closes: #337082
- * Removed dynamic linking against libstdc++ as it was not really
- needed (thanks to Adam Conrad). Closes: #328613
- * Fixed the "/var/lib/mysql is a symlink" workaround that accidently
- left a stalled symlink (thanks to Thomas Lamy). Closes: #336759
- * As the init script cannot distinguish between a broken startup and
- one that just takes very long the "failed" message now says
- "or took more than 6s" (thanks to Olaf van der Spek). Closes: #335547
-
- -- Christian Hammers <ch@debian.org> Thu, 3 Nov 2005 22:00:15 +0100
-
-mysql-dfsg-5.0 (5.0.15-1) unstable; urgency=low
-
- * New upstream version. 5.0 has finally been declared STABLE!
- * Added small patch to debian/rules that fixed sporadic build errors
- where stdout and stderr were piped together, got mixed up and broke
- * Added --with-big-tables to ./configure (thanks to tj.trevelyan).
- Closes: #333090
- * Added capability to parse "-rc" to debian/watch.
- * Fixed cronscript (thanks to Andrew Deason). Closes: #335244
- * Added Swedish debconf translation (thanks to Daniel Nylander).
- Closes: #333670
- * Added comment to README.Debian regarding applications that manually
- set new-style passwords... Closes: #334444
- * Sean Finney:
- - Fix duplicate reference to [-e|--extended-insert]. Closes: #334957
- - Fix default behavior for mysqldumpslow. Closes: #334517
- - Reference documentation issue in mysql manpage. Closes: #335219
-
- -- Christian Hammers <ch@debian.org> Fri, 30 Sep 2005 00:10:39 +0200
-
-mysql-dfsg-5.0 (5.0.13rc-1) unstable; urgency=low
-
- * New upstream release. Now "release-candidate"!
- * Removed any dynamic link dependencies to libndbclient.so.0 which
- is due to its version only distributed as a static library.
- * Sean Finney:
- - FTBFS fix related to stripping rpath in debian/rules
-
- -- Christian Hammers <ch@debian.org> Mon, 26 Sep 2005 22:09:26 +0200
-
-mysql-dfsg-5.0 (5.0.12beta-5) unstable; urgency=low
-
- * The recent FTBFS were probably result of a timing bug in the
- debian/patches/75_*.dpatch file where Makefile.in got patched just
- before the Makefile.shared which it depended on. For that reason
- only some of the autobuilders failed. Closes: #330149
- * Fixed chrpath removal (option -k had to be added).
- * Corrected debconf dependency as requested by Joey Hess.
-
- -- Christian Hammers <ch@debian.org> Mon, 26 Sep 2005 18:37:07 +0200
-
-mysql-dfsg-5.0 (5.0.12beta-4) unstable; urgency=low
-
- * Removed experimental shared library libndbclient.so.0.0.0 as it
- is doomed to cause trouble as long as it is present in both MySQL 4.1
- and 5.0 without real soname and its own package. We still have
- libndbclient.a for developers. (thanks to Adam Conrad and
- mediaforest.net). Closes: #329772
-
- -- Christian Hammers <ch@debian.org> Fri, 23 Sep 2005 12:36:48 +0200
-
-mysql-dfsg-5.0 (5.0.12beta-3) unstable; urgency=medium
-
- * Symbol versioning support! wooooohoooooo!
- (thanks to Steve Langasek) Closes: #236288
- * Moved libndbcclient.so.0 to the -dev package as it is provided by
- libmysqlclient14 and -15 which must be installable simultaneously.
- * Removed mysql-*-doc suggestions.
-
- -- Christian Hammers <ch@debian.org> Tue, 20 Sep 2005 00:07:03 +0200
-
-mysql-dfsg-5.0 (5.0.12beta-2) unstable; urgency=low
-
- * Added patch to build on GNU/kFreeBSD (thanks to Aurelien Jarno).
- Closes: #327702
- * Added patch that was already been present on the 4.1 branch which
- makes the "status" command of the init script more sensible
- (thanks to Stephen Gildea). Closes: #311836
- * Added Vietnamese Debconf translation (thanks to Clytie Siddal).
- Closes: #313006
- * Updated German Debconf translation (thanks to Jens Seidel).
- Closes: #313957
- * Corrected commends in example debian-log-rotate.conf. The default is
- unlike the mysql-sever-4.1 package which needed to stay backwards
- compatible now 2 to avoid filling up the disk endlessly.
- * Fixed watch file to be "-beta" aware.
-
- -- Christian Hammers <ch@debian.org> Thu, 15 Sep 2005 20:50:19 +0200
-
-mysql-dfsg-5.0 (5.0.12beta-1) unstable; urgency=medium
-
- * Christian Hammers:
- - New upstream release.
- - Changed build-dep to libreadline5-dev as requested by Matthias Klose.
- Closes: #326316
- - Applied fix for changed output format of SHOW MASTER LOGS for
- binary log rotation (thanks to Martin Krueger). Closes: #326427, #326427
- - Removed explicit setting of $PATH as I saw no sense in it and
- it introduced a bug (thanks to Quim Calpe). Closes: #326769
- - Removed PID file creation from /etc/init.d/mysql-ndb as it does
- not work with this daemon (thanks to Quim Calpe).
- - Updated French Debconf translation (thanks to Christian Perrier).
- Closes: #324805
- - Moved conflicts line in debian/control from libmysqlclient15 to
- libmysqlclient15-dev and removed some pre-sarge conflicts as
- suggested by Adam Majer. Closes: #324623
- * Sean Finney:
- - For posterity, CAN-2005-2558 has been fixed since 5.0.7beta.
-
- -- Christian Hammers <ch@debian.org> Thu, 15 Sep 2005 19:58:22 +0200
-
-mysql-dfsg-5.0 (5.0.11beta-3) unstable; urgency=low
-
- * Temporarily build only with -O2 to circumvent gcc internal errors
- (thanks to Matthias Klose). Related to: #321165
-
- -- Christian Hammers <ch@debian.org> Thu, 18 Aug 2005 15:44:04 +0200
-
-mysql-dfsg-5.0 (5.0.11beta-2) unstable; urgency=low
-
- * Fixed README.Debian regarding the status of mysql-doc.
- * Added "set +e" around chgrp in mysql-server-5.0.preinst to
- not fail on .journal files (thanks to Christophe Nowicki).
- Closes: #318435
-
- -- Christian Hammers <ch@debian.org> Sun, 14 Aug 2005 18:02:08 +0200
-
-mysql-dfsg-5.0 (5.0.11beta-1) unstable; urgency=low
-
- * New upstream version.
- * Added Danish Debconf translations (thanks to Claus Hindsgaul).
- Closes: #322384
- * Updated Czech Debconf translations (thanks to Miroslav Kure).
- Closes: #321765
-
- -- Christian Hammers <ch@debian.org> Sat, 13 Aug 2005 11:56:15 +0000
-
-mysql-dfsg-5.0 (5.0.10beta-1) unstable; urgency=low
-
- * New upstream release.
- * Christian Hammers:
- - Added check for mounted /proc to debian/rules.
- * Sean Finney:
- - fix for fix_mysql_privilege_tables/mysql_fix_privilege_tables typo
- in mysql-server-5.0's README.Debian (see #319838).
-
- -- Christian Hammers <ch@debian.org> Sun, 31 Jul 2005 00:30:45 +0200
-
-mysql-dfsg-5.0 (5.0.7beta-1) unstable; urgency=low
-
- * Second try for new upstream release.
- * Renamed mysql-common-5.0 to mysql-common as future libmysqlclient16
- from e.g. MySQL-5.1 would else introduce mysql-common-5.1 which makes
- a simultanous installation of libmysqlclient14 impossible as that
- depends on either mysql-common or mysql-common-5.0 but not on future
- versions. Thus we decided to always let the newest MySQL version
- provide mysql-common.
- * Added ${misc:Depends} as suggested by debhelper manpage.
- * Raised standard in control file to 3.6.2.
- * Removed DH_COMPAT from rules in faviour of debian/compat.
- * Checkes for presence of init script before executing it in preinst.
- Referres: 315959
- * Added 60_includes_mysys.h__gcc40.dpatch for GCC-4.0 compatibility.
-
- -- Christian Hammers <ch@debian.org> Wed, 29 Jun 2005 00:39:05 +0200
-
-mysql-dfsg-5.0 (5.0.5beta-1) unstable; urgency=low
-
- * New major release! Still beta so be carefull...
- * Added federated storage engine.
-
- -- Christian Hammers <ch@debian.org> Wed, 8 Jun 2005 19:29:45 +0200
-
-mysql-dfsg-4.1 (4.1.12-1) unstable; urgency=low
-
- * Christian Hammers:
- - New upstream release.
- - Disabled BerkeleyDB finally. It has been obsoleted by InnoDB.
- * Sean Finney:
- - Updated French translation from Christian Perrier (Closes: #310526).
- - Updated Japanese translation from Hideki Yamane (Closes: #310263).
- - Updated Russian translation from Yuriy Talakan (Closes: #310197).
-
- -- Christian Hammers <ch@debian.org> Sat, 4 Jun 2005 05:49:11 +0200
-
-mysql-dfsg-4.1 (4.1.11a-4) unstable; urgency=high
-
- * Fixed FTBFS problem which was caused due to the fact that last uploads
- BerkeleyDB patch was tried to applied on all architectures and not only
- on those where BerkeleyDB is actually beeing built. Closes: #310296
-
- -- Christian Hammers <ch@debian.org> Mon, 23 May 2005 00:54:51 +0200
-
-mysql-dfsg-4.1 (4.1.11a-3) unstable; urgency=high
-
- * Added patch from Piotr Roszatycki to compile the bundled db3 library
- that is needed for the BerkeleyDB support with versioned symbols so
- that mysqld no longer crashes when it gets linked together with the
- Debian db3 version which happens when e.g. using libnss-db.
- Closes: #308966
-
- -- Christian Hammers <ch@debian.org> Thu, 19 May 2005 01:41:14 +0200
-
-mysql-dfsg-4.1 (4.1.11a-2) unstable; urgency=high
-
- * Okay, the hackery with /var/lib/dpkg/info/mysql-server.list will not
- stand and is removed from the preinst of mysql-server.
- * New workaround for the symlink problem that does not involve mucking
- with dpkg's file lists is storing the symlinks in a temporary location
- across upgrades.
- As this sometimes fails since apt-get does not always call new.preinst
- before old.postrm, some remarks were added to README.Debian and the
- Debconf installation notes to minimize the inconvinience this causes.
-
- -- sean finney <seanius@debian.org> Sun, 15 May 2005 10:25:31 -0400
-
-mysql-dfsg-4.1 (4.1.11a-1) unstable; urgency=high
-
- * Added the "a" to the version number to be able to upload a new
- .orig.tar.gz file which now has the non-free Docs/ directory removed
- as this has been forgotten in the 4.1.11 release (thanks to Goeran
- Weinholt). Closes: #308691
- * The Woody package listed /var/lib/mysql and /var/log/mysql in its
- /var/lib/dpkg/info/mysql-server.list. These directories are often
- replaced by symlinks to data partitions which triggers a dpkg bug
- that causes these symlinks to be removed on upgrades. The new preinst
- prevents this by removing the two lines from the .list file
- (thanks to Andreas Barth and Jamin W. Collins). See dpkg bug #287978.
- * Updated French Debconf translation (thanks to Christian Perrier).
- Closes: #308353
-
- -- Christian Hammers <ch@debian.org> Thu, 12 May 2005 21:52:46 +0200
-
-mysql-dfsg-4.1 (4.1.11-3) unstable; urgency=high
-
- * The "do you want to remove /var/lib/mysql when purging the package" flag
- from old versions is removed once this package is beeing installed so
- that purging an old Woody mysql-server package while having a
- mysql-server-4.1 package installed can no longer lead to the removal of
- all databases. Additionaly clarified the wording of this versions Debconf
- template and added a check that skips this purge in the postrm script
- if another mysql-server* package has /usr/sbin/mysqld installed.
- (thanks to Adrian Bunk for spotting that problem) Closes: #307473
- * Cronfile was not beeing installed as the filename was not in the
- correct format for "dh_installcron --name" (thanks to Tomislav
- Gountchev). Closes: #302712
-
- -- Christian Hammers <ch@debian.org> Sat, 23 Apr 2005 22:55:15 +0200
-
-mysql-dfsg-4.1 (4.1.11-2) unstable; urgency=low
-
- * Sean Finney:
- - don't freak out if we can't remove /etc/mysql during purge.
- - debian/rules clean works again.
- * Christian Hammers:
- - Fixed typo in README.Debian (thanks to Joerg Rieger). Closes: #304897
- - Completely removed the passwordless test user as it was not only
- insecure but also lead to irritations as MySQL checks first the
- permissions of this user and then those of a password having one.
- See bug report from Hilko Bengen for details. Closes: #301741
-
- -- Christian Hammers <ch@debian.org> Sat, 16 Apr 2005 15:55:00 +0200
-
-mysql-dfsg-4.1 (4.1.11-1) unstable; urgency=low
-
- * New upstream version.
- * Upstream fix for charset/collation problem. Closes: #282256
- * Upstream fix for subselect crash. Closes: #297687
- * Corrected minor issue in Debconf template regarding skip-networking
- (thanks to Isaac Clerencia). Closes: #303417
- * Made dependency to gawk unnecessary (thanks to Zoran Dzelajlija).
- Closes: #302284
- * Removed obsolete 50_innodb_mixlen.dpatch.
- * Removed obsolete 51_CAN-2004-0957_db_grant_underscore.dpatch.
-
- -- Christian Hammers <ch@debian.org> Fri, 8 Apr 2005 00:23:53 +0200
-
-mysql-dfsg-4.1 (4.1.10a-7) unstable; urgency=low
-
- * Sean Finney:
- - fix for the mysteriously disappeared cronjob. thanks to
- Peter Palfrader <weasel@debian.org> for pointing out this omission.
- (closes: #302712).
-
- -- sean finney <seanius@debian.org> Sat, 02 Apr 2005 16:54:13 -0500
-
-mysql-dfsg-4.1 (4.1.10a-6) unstable; urgency=high
-
- * Sean Finney:
- - the previous upload did not completely address the issue. this one
- should do so. d'oh.
-
- -- sean finney <seanius@debian.org> Thu, 31 Mar 2005 03:35:50 +0000
-
-mysql-dfsg-4.1 (4.1.10a-5) unstable; urgency=high
-
- * Sean Finney:
- - the following security issue is addressed in this upload:
- CAN-2004-0957 (grant privilege escalation on tables with underscores)
- thanks to sergei at mysql for all his help with this.
-
- -- sean finney <seanius@debian.org> Wed, 30 Mar 2005 21:19:26 -0500
-
-mysql-dfsg-4.1 (4.1.10a-4) unstable; urgency=low
-
- * Sean Finney:
- - FTBFS fix for amd64/gcc-4.0. Thanks to Andreas Jochens <aj@andaco.de>
- for reporting this (closes: #301807).
- - ANSI-compatible quoting fix in daily cron job. thanks to
- Karl Hammar <karl@aspodata.se> for pointing out the problem in
- the 4.0 branch.
- - Added myself as a co-maintainer in the control file (closes: #295312).
-
- -- sean finney <seanius@debian.org> Tue, 29 Mar 2005 18:54:42 -0500
-
-mysql-dfsg-4.1 (4.1.10a-3) unstable; urgency=low
-
- * BerkeleyDB is now disabled by default as its use is discouraged by MySQL.
- * Added embedded server libraries as they finally do compile.
- They are currently in libmysqlclient-dev as they are still
- experimental and only available as .a library (thanks to Keith Packard).
- Closes: #297062
- * Fixed obsolete "tail" syntax (thanks to Sven Mueller). Closes: #301413
- * Added CAN numbers for the latest security bugfix upload.
- * Updated manpage of mysqlmanager (thanks to Justin Pryzby). Closes: #299844
- * Added comments to default configuration.
-
- -- Christian Hammers <ch@debian.org> Sun, 20 Mar 2005 17:40:18 +0100
-
-mysql-dfsg-4.1 (4.1.10a-2) unstable; urgency=low
-
- * Disabled "--with-mysqld-ldflags=-all-static" as it causes sig11 crashes
- if LDAP is used for groups in /etc/nsswitch.conf. Confirmed by Sean Finney
- and Daniel Dehennin. Closes: #299382
-
- -- Christian Hammers <ch@debian.org> Mon, 14 Mar 2005 03:01:03 +0100
-
-mysql-dfsg-4.1 (4.1.10a-1) unstable; urgency=high
-
- * SECURITY:
- - The following security related updates are addressed:
- CAN-2005-0711 (temporary file creation with "CREATE TEMPORARY TABLE")
- CAN-2005-0709 (arbitrary library injection in udf_init())
- CAN-2005-0710 (arbitrary code execution via "CREATE FUNCTION")
- Closes: #299029, #299031, #299065
- * New Upstream Release.
- - Fixes some server crash conditions.
- - Upstream includes fix for TMPDIR overriding my.cnf tmpdir setting
- Closes: #294347
- - Fixes InnoDB error message. Closes: #298875
- - Fixes resouce limiting. Closes: #285044
- * Improved checking whether or not the server is alive in the init script
- which should make it possible to run several mysqld instances in
- different chroot environments. Closes: #297772
- * Fixed cron script name as dots are not allowed (thanks to Michel
- v/d Ven). Closes: #298447
- * Added -O3 and --with-mysqld-ldflags=-all-static as MySQL recommends to
- build the server binary statically in order to gain about 13% more
- performance (thanks to Marcin Kowalski).
- * Added patch to let mysqld_safe react to signals (thanks to Erich
- Schubert). Closes: #208364
- * (Thanks to Sean Finney for doing a great share of work for this release!)
-
- -- Christian Hammers <ch@debian.org> Thu, 3 Mar 2005 02:36:39 +0100
-
-mysql-dfsg-4.1 (4.1.10-4) unstable; urgency=medium
-
- * Fixed bug that prevented MySQL from starting after upgrades.
- Closes: #297198, #296403
- * Added comment about logging to syslog to the default my.cnf
- and the logrotate script (thanks to Ryszard Lach). Closes: #295507
-
- -- Christian Hammers <ch@debian.org> Thu, 3 Mar 2005 00:28:02 +0100
-
-mysql-dfsg-4.1 (4.1.10-3) unstable; urgency=low
-
- * Sean Finney: Cronjobs now exit silently when the server package
- has been removed but not purged (thanks to Vineet Kumar).
- Closes: #297404
- * Fixed comments of /etc/mysql/debian-log-rotate.conf (thanks to
- Philip Ross). Closes: #297467
- * Made mysqld_safe reacting sane on signals (thanks to Erich Schubert).
- Closes: #208364
-
- -- Christian Hammers <ch@debian.org> Tue, 1 Mar 2005 19:44:34 +0100
-
-mysql-dfsg-4.1 (4.1.10-2) unstable; urgency=low
-
- * Converted to dpatch.
- * debian/ is now maintained via Subversion on svn.debian.org.
-
- -- Christian Hammers <ch@debian.org> Tue, 1 Mar 2005 02:16:36 +0100
-
-mysql-dfsg-4.1 (4.1.10-1) unstable; urgency=low
-
- * New upstream version.
- * Upstream fixed memleak bug. Closes: #205587
- * Added debian/copyright.more for personal reference.
- * Lowered default query cache size as suggested by Arjen from MySQL.
- * Switched from log to log-bin as suggested by Arjen from MySQL.
- * Fixed typo in my.cnf (thanks to Sebastian Feltel). Closes: #295247
- * Replaced --defaults-extra-file by --defaults-file in Debian scripts
- as former lets password/host etc be overwriteable by /root/.my.cnf.
- Added socket to /etc/mysql/debian.cnf to let it work. (thanks to
- SATOH Fumiyasu). Closes: #295170
-
- -- Christian Hammers <ch@debian.org> Tue, 15 Feb 2005 23:47:02 +0100
-
-mysql-dfsg-4.1 (4.1.9-4) unstable; urgency=low
-
- * Improved the way mysqld is started and registered with update-rc.d
- in cases where the admin modifies the runlevel configuration.
- Most notably removed the debconf question whether or not mysql should
- start on when booting. Closes: #274264
- * Renamed configuration option old-passwords to the more preferred
- naming convention old_passwords. Same for some others (thanks to
- Patrice Pawlak). Closes: #293983
-
- -- Christian Hammers <ch@debian.org> Tue, 8 Feb 2005 02:21:18 +0100
-
-mysql-dfsg-4.1 (4.1.9-3) unstable; urgency=low
-
- * Renamed ca_ES.po to ca.po to reach a broader audience (thanks to
- Christian Perrier). Closes: #293786
- * Expicitly disabled mysqlfs support as it has never been enabled by
- configure during the autodetection but fails due to broken upstream
- code when users try to build the package theirselves while having
- liborbit-dev installed which triggers the mysqlfs autodetection
- (thanks to Max Kellermann). Closes: #293431
- * Added dependencies to gawk as one script does not work with original-awk
- (thanks to Petr Ferschmann). Closes: #291634
-
- -- Christian Hammers <ch@debian.org> Sun, 6 Feb 2005 23:33:11 +0100
-
-mysql-dfsg-4.1 (4.1.9-2) unstable; urgency=high
-
- * SECURITY:
- For historical reasons /usr/share/mysql/ was owned and writable by
- the user "mysql". This is a security problem as some scripts that
- are run by root are in this directory and could be modified and used
- by a malicious user who already has mysql privileges to gain full root
- rights (thanks to Matt Brubeck). Closes: #293345
- * Changed "skip-networking" to "bind-address 127.0.0.1" which is more
- compatible and not less secure but maybe even more, as less people enable
- networking for all interfaces (thanks to Arjen Lentz).
- * Enabled InnoDB by default as recommended by Arjen Lentz from MySQL.
- * Added remarks about hosts.allow to README.Debian (thanks to David
- Chappell). Closes: #291300
- * mysql-server-4.1 now provides mysql-server (thanks to Paul van den Berg).
- Closes: #287735
-
- -- Christian Hammers <ch@debian.org> Wed, 2 Feb 2005 23:31:55 +0100
-
-mysql-dfsg-4.1 (4.1.9-1) unstable; urgency=low
-
- * New upstream version.
- * mysql-client-4.1 now provides "mysql-client" so that packages depending
- on mysql-client (ca. 40) can now be used with MySQL-4.1, too.
-
- -- Christian Hammers <ch@debian.org> Sun, 23 Jan 2005 22:52:48 +0100
-
-mysql-dfsg-4.1 (4.1.8a-6) unstable; urgency=high
-
- * SECURITY:
- Javier Fernandez-Sanguino Pena from the Debian Security Audit Project
- discovered a temporary file vulnerability in the mysqlaccess script of
- MySQL that could allow an unprivileged user to let root overwrite
- arbitrary files via a symlink attack and could also could unveil the
- contents of a temporary file which might contain sensitive information.
- (CAN-2005-0004, http://lists.mysql.com/internals/20600) Closes: #291122
-
- -- Christian Hammers <ch@debian.org> Tue, 18 Jan 2005 23:11:48 +0100
-
-mysql-dfsg-4.1 (4.1.8a-5) unstable; urgency=medium
-
- * Fixed important upstream bug that causes from_unixtime(0) to return
- NULL instead of "1970-01-01 00:00:00" which fails on NOT NULL columns.
- Closes: #287792
- * Fixes upstream bug in mysql_list_fields() . Closes: #282486
- * Fixes bug that lead to double rotated logfiles when mysql-server 4.0
- was previously installed (thanks to Olaf van der Spek). Closes: #289851
- * Fixed typo in README.Debian (thanks to Mark Nipper). Closes: #289131
- * Changed max_allowed_packet in my.cnf to 16M as in 4.0.x (thanks to
- Olaf van der Spek). Closes: #289840
- * Updated French debconf translation (thanks to Christian Perrier).
- Closes: #287955
-
- -- Christian Hammers <ch@debian.org> Thu, 13 Jan 2005 01:29:05 +0100
-
-mysql-dfsg-4.1 (4.1.8a-4) unstable; urgency=low
-
- * Broken patch again :-(
-
- -- Christian Hammers <ch@debian.org> Sun, 9 Jan 2005 23:47:55 +0100
-
-mysql-dfsg-4.1 (4.1.8a-3) unstable; urgency=low
-
- * The mutex patch was a bit too x86 centric. This broke the alpha build.
-
- -- Christian Hammers <ch@debian.org> Sun, 9 Jan 2005 14:18:49 +0100
-
-mysql-dfsg-4.1 (4.1.8a-2) unstable; urgency=medium
-
- * Some Makefiles that were patched by me got overwritten by the GNU
- autotools, probably because I also patched ./configure. Fixed now,
- the critical mutex patch is now back in again. Closes: #286961
- * Added patch to make MySQL compile on ARM (thanks to Adam Majer).
- Closes: #285071
-
- -- Christian Hammers <ch@debian.org> Thu, 6 Jan 2005 09:30:13 +0100
-
-mysql-dfsg-4.1 (4.1.8a-1) unstable; urgency=medium
-
- * Upstream 4.1.8 had some problems in their GNU Autotools files so they
- released 4.1.8a. Debian's 4.1.8 was fixed by running autoreconf but this
- again overwrote MySQL changes to ltmain.sh which are supposed to fix some
- problems on uncommon architectures (maybe the FTBFS on alpha, arm, m68k
- and sparc?).
- * libmysqlclient_r.so.14 from 4.1.8-3 also missed a link dependency to
- libz which lead to unresolved symbols visible with "ldd -r" (thanks
- to Laurent Bonnaud). Closes: #287573
-
- -- Christian Hammers <ch@debian.org> Wed, 29 Dec 2004 14:26:33 +0100
-
-mysql-dfsg-4.1 (4.1.8-3) unstable; urgency=low
-
- * Fixed checking for error messages by forcing english language
- output by adding LC_ALL=C to debian-start (thanks to Rene
- Konasz) Closes: #285709
- * Fixed bashisms in Debian scripts. Closes: #286863
- * Updated Japanese Debconf translation (thanks to Hideki Yamane).
- Closes: #287003
- * Improved 4.0 to 4.1 upgrade if /var/lib/mysql is a symlink
- (thanks to Thomas Lamy). Closes: #286560
- * Added patch for FTBFS problem where no LinuxThreads can be found.
- I don't know if this still applies but it should not hurt.
- The patch is debian/patches/configure__AMD64-LinuxThreads-vs-NPTL.diff
-
- -- Christian Hammers <ch@debian.org> Sun, 26 Dec 2004 14:04:20 +0100
-
-mysql-dfsg-4.1 (4.1.8-2) unstable; urgency=low
-
- * If /var/lib/mysql is a symlink then it is kept as such.
- * Added the old-passwords option to the default my.cnf to stay
- compatible to clients that are still compiled to libmysqlclient10
- and libmysqlclient12 for licence reasons.
- * Adjusted tetex build-deps to ease backporting (thanks to Norbert
- Tretkowski from backports.org).
-
- -- Christian Hammers <ch@debian.org> Tue, 21 Dec 2004 01:00:27 +0100
-
-mysql-dfsg-4.1 (4.1.8-1) unstable; urgency=medium
-
- * New upstream version. Closes: #286175
- * Added conflict to libmysqlclient-dev (thanks to Adam Majer).
- Closes: #286538
- * Added debconf-updatepo to debian/rules:clean.
- * Updated Japanese Debconf translation (thanks to Hideki Yamane).
- Closes: #285107
- * Updated French Debconf translation (thanks to Christian Perrier).
- Closes: #285977
- * Renamed cz.po to cs.po (thanks to Miroslav Kure). Closes: #285438
- * Aplied patch for changed server notice to debian-start (thanks to
- Adam Majer). Closes: #286035
- * Changed nice value in default my.cnf as nohup changed its behaviour
- (thanks to Dariush Pietrzak). Closes: #285446
- * Increased verbosity of preinst script in cases where it cannot stop
- a running server (thanks to Jan Minar). Closes: #285982
- * Splitted the code parts of /etc/mysql/debian-start to
- /usr/share/mysql/debian-start.inc.sh (thanks to Jan Minar).
- Closes: #285988
-
- -- Christian Hammers <ch@debian.org> Mon, 20 Dec 2004 00:33:21 +0100
-
-mysql-dfsg-4.1 (4.1.7-4) unstable; urgency=medium
-
- * Removed OpenSSL support.
- After a short discussion with MySQL, I decided to drop OpenSSL support as
- 1. MySQL started shipping their binaries without it, too and do not
- seem to support it in favour of using a different library somewhen.
- 2. MySQL did not adjust their licence to grant permission to link
- against OpenSSL.
- 3. Even if they did, third parties who use libmysqlclient.so often
- do not realise licencing problems or even do not want OpenSSL.
- (thanks to Jordi Mallach and the responders to MySQL bug #6924)
- Closes: #283786
- * debian/control: Improved depends and conflicts to mysql-4.0.
-
- -- Christian Hammers <ch@debian.org> Thu, 2 Dec 2004 22:02:28 +0100
-
-mysql-dfsg-4.1 (4.1.7-3) unstable; urgency=low
-
- * Raised version to make it higher as the one in experimental.
-
- -- Christian Hammers <ch@debian.org> Wed, 1 Dec 2004 21:09:20 +0100
-
-mysql-dfsg-4.1 (4.1.7-2) unstable; urgency=low
-
- * Patched scripts/mysql_install_db so that it no longer creates a
- passwordless test database during installation (thanks to Patrick
- Schnorbus). Closes: #281158
- * Added Czech debconf translation (thanks to Miroslav Kure).
- Closes: #283222
-
- -- Christian Hammers <ch@debian.org> Wed, 1 Dec 2004 01:29:31 +0100
-
-mysql-dfsg-4.1 (4.1.7-1) unstable; urgency=low
-
- * New upstream branch!
- * Adjusted debian/control to make this package suitable to get parallel
- to version 4.0.x into unstable and sarge. The package names are
- different so that "mysql-server" still defaults to the rock-stable
- 4.0 instead to this announced-to-be-stable 4.1.
- * Added --with-mutex=i86/gcc-assemler to the Berkeley-DB configure
- to prevent the use of NPLT threads when compiling under kernel 2.6
- because the binaries are else not runable on kernel 2.4 hosts.
- Closes: #278638, #274598
-
- -- Christian Hammers <ch@debian.org> Sun, 31 Oct 2004 20:15:03 +0100
-
-mysql-dfsg (4.1.6-1) experimental; urgency=low
-
- * New upstream version.
- * Fixed symlinks in libmysqlclient-dev package. Closes: #277028
- * This time I did not update the libtool files as they were pretty
- up to date and I want to have a shorter diff file.
-
- -- Christian Hammers <ch@debian.org> Wed, 20 Oct 2004 00:07:58 +0200
-
-mysql-dfsg (4.1.5-3) experimental; urgency=low
-
- * debian/postinst: mysql_install_db changed parameter from --IN-RPM
- to --rpm which caused problems during installs. Closes: #276320
-
- -- Christian Hammers <ch@debian.org> Sat, 16 Oct 2004 20:36:46 +0200
-
-mysql-dfsg (4.1.5-2) experimental; urgency=low
-
- * Activated support for ndb clustering (thanks to Kevin M. Rosenberg).
- Closes: #275109
-
- -- Christian Hammers <ch@debian.org> Wed, 6 Oct 2004 01:58:00 +0200
-
-mysql-dfsg (4.1.5-1) experimental; urgency=low
-
- * WARNING:
- The upstream branch 4.1 is still considered BETA.
- The Debian packages for 4.1 were done without big testing. If you miss
- a new functionality or binary, contact me and I check add the relevant
- configure option or include the program.
- * New MAJOR upstream version.
- Thanks to the great demand here's now the first MySQL 4.1 experimental
- release. FEEDBACK IS WELCOME.
- * 4.0->4.1 notes:
- - debian/patches/alpha.diff could not be applied, I fix that later
- - debian/patches/scripts__mysql_install_db.sh.diff was obsolete
- - debian/patches/scripts__Makefile.in was neccessary due to a dependency
- to the removed non-free Docs/ directory. Upstream has been contacted.
- - Build-Deps: += automake1.7
- - debian/rules: embedded servers examples did not compile, removed
-
- -- Christian Hammers <ch@debian.org> Sun, 26 Sep 2004 19:46:47 +0200
-
-mysql-dfsg (4.0.21-3) unstable; urgency=low
-
- * Upstream tried to fix a security bug in mysqlhotcopy and broke it :-)
- Applied a patch (see debian/patches) from Martin Pitt. Closes: #271632
- * Between 4.0.20 and 4.0.21 the Debian specific changes in
- /usr/bin/mysqld_safe that piped the error log to syslog got lost
- and are now back again.
- * Fixed capitalization in debconf headings.
- * Changed wording of the initscript status message to make heartbeat
- happier. Closes: #271591
-
- -- Christian Hammers <ch@debian.org> Fri, 17 Sep 2004 18:42:25 +0200
-
-mysql-dfsg (4.0.21-2) unstable; urgency=medium
-
- * The dependencies between mysql-client and libmysqlclient12 were
- too loose, when upgrading only the client this can lead to non working
- binaries due to relocation errors (thanks to Dominic Cleal).
- Closes: #271803
- * Fixed typo in mysqldump.1 manpage (thanks to Nicolas Francois).
- Closes: #271334
-
- -- Christian Hammers <ch@debian.org> Wed, 15 Sep 2004 15:38:11 +0200
-
-mysql-dfsg (4.0.21-1) unstable; urgency=high
-
- * SECURITY:
- This upstream version fixes some security problems that might at least
- allow a DoS attack on the server.
- * Fixed an old bug in concurrent accesses to `MERGE' tables (even
- one `MERGE' table and `MyISAM' tables), that could've resulted in
- a crash or hang of the server. (Bug #2408)
- * Fixed bug in privilege checking where, under some conditions, one
- was able to grant privileges on the database, he has no privileges
- on. (Bug #3933)
- * Fixed crash in `MATCH ... AGAINST()' on a phrase search operator
- with a missing closing double quote. (Bug #3870)
- * Fixed potential memory overrun in `mysql_real_connect()' (which
- required a compromised DNS server and certain operating systems).
- (Bug #4017)
- * New upstream version.
- * Fixes bug that made x="foo" in WHERE sometimes the same as x="foo ".
- Closes: #211618
- * Updated Japanese Debconf translation (thanks to Hideki Yamane).
- Closes: #271097
-
- -- Christian Hammers <ch@debian.org> Sat, 11 Sep 2004 23:15:44 +0200
-
-mysql-dfsg (4.0.20-14) unstable; urgency=low
-
- * Dave Rolsky spottet that -DBIG_JOINS was not properly enabled.
- It allowes joining 64 instead of an 32 tables to join.
-
- -- Christian Hammers <ch@debian.org> Thu, 9 Sep 2004 20:24:02 +0200
-
-mysql-dfsg (4.0.20-13) unstable; urgency=medium
-
- * Fixed a bug in the initscript which caused the check for not properly
- closed i.e. corrupt tables that is executed when the server starts
- not to run in background as supposed.
- Although the check does not repair anything on servers with several
- thousand tables the script was reported to take some minutes which
- is quite annoying. (Thanks to Jakob Goldbach). Closes: #270800
-
- -- Christian Hammers <ch@debian.org> Thu, 9 Sep 2004 17:11:05 +0200
-
-mysql-dfsg (4.0.20-12) unstable; urgency=medium
-
- * Filter messages regarding table handles that do not support CHECK TABLE
- in the script that checks for corrupted tables on every start which lead
- to unnecessary mails (thanks to David Everly). Closes: #269811
- * Added a note to the corrupt-table-check mail which notes that a
- false-positive is reported in the case that immediately after starting
- the server a client starts using a table (thanks to Uwe Kappe).
- Closes: #269985
- * Added "quote-names" as default to the [mysqldump] section in
- /etc/mysql/my.cnf as too many users stumble over dump files that
- could not be read in again due to the valid use of reserved words
- as table names. This has also be done by upstream in 4.1.1 and has
- no known drawbacks. Closes: #269865
- * Binary logs can now be rotated as well. Defaults to off, though, for
- compatibilty reasons (thanks to Mark Ferlatte). Closes: #94230, #269110
- * The mysql user "debian-sys-maint" now gets all possible rights which
- makes binary logging possible and helps other package maintainer who
- wants to use it to create package specific databases and users.
- * Added example how to change daemon nice level via /etc/mysql/my.cnf
- * Updated French debconf translations (thanks to Christian Perrier).
- Closes: #265811
- * Renamed options in the default config file that still had old names
- (thanks to Yves Kreis). Closes: #266445
- * Fixed spelling in debconf note.
- * Added -l and -L to dh_shlibdeps.
-
- -- Christian Hammers <ch@debian.org> Fri, 3 Sep 2004 20:10:46 +0200
-
-mysql-dfsg (4.0.20-11) unstable; urgency=high
-
- * SECURITY
- This version fixes a security flaw in mysqlhotcopy which created
- temporary files in /tmp which had predictable filenames and such
- could be used for a tempfile run attack.
- The issue has been recorded as CAN-2004-0457.
-
- -- Christian Hammers <ch@debian.org> Sat, 14 Aug 2004 18:27:19 +0200
-
-mysql-dfsg (4.0.20-10) unstable; urgency=low
-
- * MySQL finally updated their copyright page and installed v1.5 of
- the "Free/Libre and Open Source Software License (FLOSS) - Exception"
- which will hopefully end the license hell they created by putting the
- client libraries under GPL instead of LGPL which conflicts with PHP and
- other software that used to link against MySQL.
- The license text is not yet in any release MySQL version but visible
- on their web site and copied into the debian/copyright file.
- Special thanks to Zak Greant <zak@mysql.com> and the debian-legal list
- for helping to solve this release critical problem.
- Closes: #242449
- * Updated Brazil debconf translation (thanks to Andre Luis Lopes).
- Closes: #264233
- * Updated Japanese debconf translation (thanks to Hideki Yamane).
- Closes: #264620
- * Fixed minor typo in debconf description (thanks to TROJETTE Mohammed
- Adnene). Closes: #264840
- * Improved init and preinst script which now detects stalled servers which
- do no longer communicate but are present in the process list (thanks to
- Henrik Johansson). Closes: #263215
-
- -- Christian Hammers <ch@debian.org> Mon, 9 Aug 2004 19:44:28 +0200
-
-mysql-dfsg (4.0.20-9) unstable; urgency=medium
-
- * Partly reverted the last patch which gave the mysql-user
- "debian-sys-maint" more rights as there are old versions of MySQL which
- have fewer privlige columns. Now only those are set (thanks to Alan Tam).
- Closes: #263111
-
- -- Christian Hammers <ch@debian.org> Tue, 3 Aug 2004 13:03:02 +0200
-
-mysql-dfsg (4.0.20-8) unstable; urgency=low
-
- * The mysqlcheck that is started from the initscript will now be
- backgrounded because it might else prevent the boot process to continue.
- It also now notifies root by mail and syslog if a table is corrupt.
- * The "debian-sys-maint" MySQL user now has almost full rights so that other
- packages might use this account to create databases and user (thanks to
- Andreas Barth). Closes: #262541
- * Added paranoid rules for logcheck.
-
- -- Christian Hammers <ch@debian.org> Sun, 1 Aug 2004 21:00:55 +0200
-
-mysql-dfsg (4.0.20-8) unstable; urgency=low
-
- * Upload stalled. Not released.
-
- -- Christian Hammers <ch@debian.org> Sun, 1 Aug 2004 20:27:55 +0200
-
-mysql-dfsg (4.0.20-7) unstable; urgency=medium
-
- * Solved the upstream bug that error messages of the server are written
- in a file that is then rotated away leaving mysqld logging effectively
- to /dev/null. It now logs to a /usr/bin/logger process which puts the
- messages into the syslog.
- Modified files: /etc/init.d/mysql, /usr/bin/mysqld_safe and the
- logchecker files. Closes: #254070
- * The initscript does no longer call mysqlcheck directly but via
- /etc/mysql/debian-start which is a user customizable config script.
- * Splitted the debconf "install and update notes" and only show them
- when it is appropriate (thanks to Steve Langasek). Closes: #240515
- * Added NEWS.Debian.
- * Added hint to -DBIG_ROWS, which is currently not used, to README.Debian.
- * Corrected typo in myisampack manpage (thanks to Marc Lehmann).
- Closes: #207090
- * Added Catalan debconf translation (thanks to Aleix Badia i Bosch).
- Closes: #236651
-
- -- Christian Hammers <ch@debian.org> Wed, 28 Jul 2004 01:41:51 +0200
-
-mysql-dfsg (4.0.20-6) unstable; urgency=low
-
- * The build arch detected by configure was "pc-linux-gnu (i686)"
- instead of "pc-linux-gnu (i386)". Was no problem AFAIK but
- Adam Majer asked me to explicitly change it to i386. Closes: #261382
- * Removed some unused shell scripts from /usr/share/mysql.
- * Added lintian overrides.
- * Removed rpath by using chrpath.
-
- -- Christian Hammers <ch@debian.org> Mon, 26 Jul 2004 00:17:12 +0200
-
-mysql-dfsg (4.0.20-5) unstable; urgency=medium
-
- * The mysqlcheck in the init script is only called when the server
- is really alive. Also, the mysql-user 'debian-sys-maint' now has
- global select rights (thanks to Nathan Poznick). Closes: #261130
- * Moved the debconf question whether to remove the databases or not
- from mysql-server.config to mysql-server.postrm so that it shows
- up on purge time and not months earlier (thanks to Wouter Verhelst).
- Closes: #251838
-
- -- Christian Hammers <ch@debian.org> Fri, 23 Jul 2004 22:41:13 +0200
-
-mysql-dfsg (4.0.20-4) unstable; urgency=low
-
- * Added a "mysqlcheck -A --fast" to the 'start' section of the
- init script to help admins detect corrupt tables after a server crash.
- Currently it exists with an error message but leaves the server
- running. Feedback appreciated!
- * Made postinst script more robust by calling db_stop earlier and
- so prevent pipe-deadlocks.
- * Fixed minor typos in initscript (thanks to "C.Y.M."). Closes: 259518
- * Added the undocumented "-DBIG_JOINS" that MySQL apparently uses in
- their MAX binaries. It enables 62 instead of 30 tables in a "join".
- (thanks to Dave Rolsky). Closes: #260843
- * Added a "df --portability /var/lib/mysql/." check to the preinst
- script as users experienced hard to kill hanging mysqlds in such
- a situation (thanks to Vaidas Pilkauskas). Closes: #260306
-
- -- Christian Hammers <ch@debian.org> Fri, 23 Jul 2004 00:51:32 +0200
-
-mysql-dfsg (4.0.20-3) unstable; urgency=low
-
- * Improved tolerance if the init script has been deleted (thanks to
- Leonid Shulov for spotting the problem).
- * Minor wording changes to README.Debian generalizing /root/ by $HOME
- (thanks to Santiago Vila). Closes: #257725
- * Added Japanese debconf translation (thanks to Hideki Yamane).
- Closes: #256485
- * Fixed commend in my.cnf regarding logfile directory (thanks to Jayen
- Ashar). Closes: #253434
- * Correted "ease to" by "ease of" in package description (thanks to
- Johannes Berg). Closes: #253510
-
- -- Christian Hammers <ch@debian.org> Fri, 9 Jul 2004 00:57:42 +0200
-
-mysql-dfsg (4.0.20-2) unstable; urgency=low
-
- * Removed RPM .spec file from the included documentation as it is pretty
- useless (thanks to Loic Minier).
- * Added turkish debconf translation (thanks to Recai Oktas). Closes: #252802
-
- -- Christian Hammers <ch@debian.org> Sun, 6 Jun 2004 14:48:26 +0200
-
-mysql-dfsg (4.0.20-1) unstable; urgency=low
-
- * New upstream version.
-
- -- Christian Hammers <ch@debian.org> Mon, 31 May 2004 23:36:39 +0200
-
-mysql-dfsg (4.0.18-8) unstable; urgency=low
-
- * Updated french translation (thanks to Christian Perrier). Closes: #246789
-
- -- Christian Hammers <ch@debian.org> Tue, 4 May 2004 23:26:54 +0200
-
-mysql-dfsg (4.0.18-7) unstable; urgency=low
-
- * Added CVE ids for the recent security fixes.
- 4.0.18-4 is CAN-2004-0381 (mysqlbug) and
- 4.0.18-6 is CAN-2004-0388 (mysql_multi)
-
- -- Christian Hammers <ch@debian.org> Mon, 19 Apr 2004 18:32:03 +0200
-
-mysql-dfsg (4.0.18-6) unstable; urgency=medium
-
- * SECURITY:
- Fixed minor tempfile-run security problem in mysqld_multi.
- Unprivileged users could create symlinks to files which were then
- unknowingly overwritten by run when this script gets executed.
- Upstream informed. Thanks to Martin Schulze for finding this.
-
- -- Christian Hammers <ch@debian.org> Wed, 7 Apr 2004 01:28:22 +0200
-
-mysql-dfsg (4.0.18-5) unstable; urgency=low
-
- * Little improvements in debian scripts for last upload.
- * Added check to logrotate script for the case that a mysql
- server is running but not be accessible with the username and
- password from /etc/mysql/debian.conf (thanks to Jeffrey W. Baker).
- Closes: 239421
-
- -- Christian Hammers <ch@debian.org> Sun, 4 Apr 2004 15:27:40 +0200
-
-mysql-dfsg (4.0.18-4) unstable; urgency=medium
-
- * SECURITY:
- Aplied fix for unprobable tempfile-symlink security problem in
- mysqlbug reported by Shaun Colley on bugtraq on 2004-03-24.
- * Updated french debconf translation (thanks to Christian Perrier).
- Closes: #236878
- * Updated portugesian debconf translation (thanks to Nuno Senica).
- Closes: #239168
- * Updated german debconf translation (thanks to Alwin Meschede).
- Closes: #241749
- * Improved debconf template regarding fix_privileges_tables (thanks
- to Matt Zimmermann for suggestions). Closes: #219400
- * Improved README.Debian regarding to password settings (thanks to
- Yann Dirson). Closes: #241328
-
- -- Christian Hammers <ch@debian.org> Sat, 3 Apr 2004 19:52:15 +0200
-
-mysql-dfsg (4.0.18-3) unstable; urgency=medium
-
- * Added Build-Depend to po-debconf to let it build everywhere.
-
- -- Christian Hammers <ch@debian.org> Wed, 31 Mar 2004 23:43:33 +0200
-
-mysql-dfsg (4.0.18-2) unstable; urgency=low
-
- * Added a "2>/dev/null" to a "which" command as there are two
- "which" versions in Debian of which one needs it. Closes: #235363
-
- -- Christian Hammers <ch@debian.org> Tue, 2 Mar 2004 23:31:28 +0100
-
-mysql-dfsg (4.0.18-1) unstable; urgency=low
-
- * New upstream version.
- * Should now compile and run on ia64 (thanks to Thorsten Werner and
- David Mosberger-Tang). Closes: #226863 #228834
- * Converted init scripts to invoce-rc.d (thanks to Erich Schubert).
- Closes: 232118
- * Secondlast upload changed logfile location. Closes: #182655
- * Updated Brasilian translation (thanks to Andre Luis Lopes). Closes:
- #219847
-
- -- Christian Hammers <ch@debian.org> Tue, 17 Feb 2004 23:44:58 +0100
-
-mysql-dfsg (4.0.17-2) unstable; urgency=low
-
- * Improved manpage for mysqldumpslow.1 (thanks to Anthony DeRobertis).
- Closes: #231039
- * Improved stopping of crashed daemons in init script (thanks to
- Matthias Urlichs). Closes: #230327
-
- -- Christian Hammers <ch@debian.org> Mon, 9 Feb 2004 21:54:29 +0100
-
-mysql-dfsg (4.0.17-1) unstable; urgency=low
-
- * Made logging into /var/log/mysql/ the default. Closes: #225206
-
- * New upstream version. Closes: #225028
- * Turned on a 25MB query cache by default (thanks to Cyril Bouthors).
- Closes: #226789
- * Updated russian translation (thanks to Ilgiz Kalmetev). Closes: #219263
- * Upstream fixes the problem that AND was not commutative (thanks for
- Iain D Broadfoot for mentioning). Closes: #227927
- * Fixed minor typo in my.cnf comments (thanks to James Renken).
- Closes: #221496
- * Better documents regex. Closes: #214952
- * Fixed minor germanism in debconf template (thanks to Marc Haber).
- Closes: #224148
- * Added explaining comment to my.cnf regarding quoted passwords
- (Thanks to Patrick von der Hagen). Closes: #224906
- * Changed "find -exec" to "find -print0 | xargs -0" in preinst to
- speed it up. Thanks to Cyril Bouthors. Closes: #220229
-
- -- Christian Hammers <ch@debian.org> Sun, 18 Jan 2004 16:16:25 +0100
-
-mysql-dfsg (4.0.16-2) unstable; urgency=low
-
- * Tried to repair undefined weak symbols by adding a little Makefile
- patch. Closes: #215973
-
- -- Christian Hammers <ch@debian.org> Mon, 27 Oct 2003 22:52:10 +0100
-
-mysql-dfsg (4.0.16-1) unstable; urgency=low
-
- * New upstream release.
- (Mostly little memory problems and other bugfixes it seems)
- * Replaced "." by ":" in chown calls to comply with the env setting
- "_POSIX2_VERSION=2000112" (thanks to Robert Luberda). Closes: #217399
- * Adjusted syntax in my.cnf to 4.x standard (thanks to Guillaume Plessis).
- Closes: #217273
- * Improved README.Debian password instructions (thanks to Levi Waldron).
- Closes: #215046
- * Improved NIS warning debconf-template (thanks to Jeff Breidenbach).
- Closes: #215791
- * Explicitly added libssl-dev to the libmysqlclient-dev package as it
- is needed for mysql_config and the libmysqlclient package only depends
- on libssl which has no unnumbered .so version (thanks to Simon Peter
- and Davor Ocelic). Closes: #214436, #216162
- * Added "-lwrap" to "mysql_config --libmysqld-libs" and filed it as
- upstream bug #1650 (thanks to Noah Levitt). Closes: #214636
-
- -- Christian Hammers <ch@debian.org> Sat, 25 Oct 2003 01:09:27 +0200
-
-mysql-dfsg (4.0.15a-1) unstable; urgency=low
-
- * Same package as 4.0.15-2 but I could not convince the Debian
- installer to move the packages out of incoming.
-
- -- Christian Hammers <ch@debian.org> Tue, 7 Oct 2003 15:10:26 +0200
-
-mysql-dfsg (4.0.15-2) unstable; urgency=low
-
- * Updated package description (thanks to Adrian Bunk). Closes: #210988
- * Fixed small typos in manpages (thanks to Nicolas Francois).
- Closes: #211983
- * More updates to package description (thanks to Matthias Lutz/ddtp).
- Closes: #213456
- * Updated standards to 3.6.1.
- * Closes "new 4.0.15 available" bug. Closes: #213349
- * Updated README.Debian with notes regarding the MySQL manual section
- "2.4 Post-installation Setup and Testing" (thanks to Daniel B.).
- Closes: #210841
-
- -- Christian Hammers <ch@debian.org> Fri, 3 Oct 2003 15:59:39 +0200
-
-mysql-dfsg (4.0.15-1) unstable; urgency=high
-
- * SECURITY:
- Users who are able to use the "ALTER TABLE" command on the "mysql"
- database may be able to exploit this vulnerability to gain a shell with
- the privileges of the mysql server (usually running as the 'mysql' user).
- Closes: #210403
- * Fixes small description typos (thanks to Oscar Jarkvik).
- * Updated Brazilian Portuguese debconf translation. (thanks to Andre Luis
- Lopes). Closes: 208030
- * Replaced depricated '.' by ':' in chown (thanks to Matt Zimmerman).
- * Fixed manpage typo (thanks to Marc Lehmann). Closes: #207090
-
- -- Christian Hammers <ch@debian.org> Fri, 3 Oct 2003 15:59:35 +0200
-
-mysql-dfsg (4.0.14-1) unstable; urgency=low
-
- * New upstream version.
-
- -- Christian Hammers <ch@debian.org> Sun, 24 Aug 2003 16:40:36 +0200
-
-mysql-dfsg (4.0.13-3) unstable; urgency=low
-
- * Now start mysqld as default unless you choose not when configurig
- with debconf priority low. So packages depending on the server when
- installing can access it. Thanks Matt Zimmermann (Closes: #200277)
- * Made mysql-server de-installable if the config and database files were
- removed by hand before. Thanks to Ard van Breemen (Closes: #200304)
-
- -- Christian Hammers <ch@debian.org> Tue, 8 Jul 2003 22:30:40 +0200
-
-mysql-dfsg (4.0.13-2) unstable; urgency=low
-
- * Added "nice" option for mysqld_safe to give mysqld a different priority.
- Submitted to upstream as MySQL Bug #627. Closes: #192087
- * Fixed possible unbound variable in init script. Closes: #194621
- * Fixed french debconf translation (thx Christian Perrier) Closes: #194739
- * Get rid of automake1.5 (for Eric Dorland).
-
- -- Christian Hammers <ch@debian.org> Wed, 11 Jun 2003 18:58:32 +0200
-
-mysql-dfsg (4.0.13-1) unstable; urgency=medium
-
- * New upstream version.
- !!! Fixes a very bad natural join bug which justifies the urgency=medium.
- !!! http://bugs.mysql.com/bug.php?id=291
- * Fixed mysql_fix_privileges manpage (Frederic Briere) Closes: #191776
- * preinst: "which" is more chatty normal executable than as builtin.
- (Thanks to David B Harris). Closes: #188659
-
- -- Christian Hammers <ch@debian.org> Tue, 6 May 2003 22:03:45 +0200
-
-mysql-dfsg (4.0.12-3) unstable; urgency=medium
-
- * Reincluded new way of creating my debian-sys-maint user from
- an old release from experimental. Now works again with old
- and new privilege table format. (Thanks to Vincent Danjean
- for spotting the problem) Closes: #188201
- * Reincluded hurd build dependency fix from 3.23 branch.
- (Thanks to Robert Millan). Closes: #185929
- * Fixed soname in libmysqlclient-dev. Closes: #188160
- * Remove /var/log/mysql/ when purging the package. Closes: #188064
- * Removed /usr/share/doc/mysql/ from mysql-server. Closes: #188066
- * Let group "adm" be able to read logfiles. Closes: #188067
- * Do not call usermod on every upgrade. Closes: #188248
- (Thanks to Philippe Troin for the last three)
- * Fixed mysql-server.preinst so that it works on shells where
- which is a builtin, too. (Thanks to Erich Schubert) Closes: #181525
-
- -- Christian Hammers <ch@debian.org> Fri, 11 Apr 2003 11:32:45 +0200
-
-mysql-dfsg (4.0.12-2) unstable; urgency=low
-
- *
- * NEW MAJOR UPSTREAM RELEASE:
- *
- MySQL 4 has finally been declared as 'stable'. Hurray! Read changelogs.
- Thanks to all testers, esp. Jose Luis Tallon, of the versions
- that were in the "experimental" section before.
- * Modified postinst script to run mysql_fix_privileges on every update.
- IMPORTANT: Please report if this breaks anything, it is not supposed to.
- * Wrote a SSL-MINI-HOWTO.txt!
- * Added zlib1g-dev to libmysqlclient12-dev. Closes: 186656
- * Changed section of libmysqlclient12-dev to libdevel.
- * Added even more selfwritten manpages.
- * Fixed typos.
-
- -- Christian Hammers <ch@debian.org> Sun, 6 Apr 2003 13:47:32 +0200
-
-mysql-dfsg (4.0.10.gamma-1) experimental; urgency=low
-
- * New upstream version.
- * They merged some of my patches from debian/patches. Whoa!
- * This release should fix the error-logfile problem where mysqld
- keeps the error.log open while logrotate removes it.
-
- -- Christian Hammers <ch@debian.org> Wed, 12 Feb 2003 22:39:48 +0100
-
-mysql-dfsg (4.0.9.gamma-1) experimental; urgency=low
-
- * New upstream version.
- * Updated the GNU autoconf files to make building on MIPS work.
- See bug #176829.
-
- -- Christian Hammers <ch@debian.org> Wed, 29 Jan 2003 22:07:44 +0100
-
-mysql-dfsg (4.0.8.gamma-1) experimental; urgency=low
-
- * New upstream release.
- * Improved logging of init script. Closes: #174790
- * We have now libmysqlclient.so.12 instead of .11.
-
- -- Christian Hammers <ch@debian.org> Thu, 9 Jan 2003 20:14:11 +0100
-
-mysql-dfsg (4.0.7.gamma-1) experimental; urgency=high
-
- * SECURITY: This version fixes an upstream security release that is only
- present in the 4.x branch which is currently only in the
- experimental distribution and therefore will not get a DSA.
- * New upstream release.
-
- -- Christian Hammers <ch@debian.org> Sat, 28 Dec 2002 15:51:39 +0100
-
-mysql-dfsg (4.0.6.gamma-2) experimental; urgency=low
-
- * Added --system to addgroup. Closes: #173866
-
- -- Christian Hammers <ch@debian.org> Sat, 21 Dec 2002 15:28:26 +0100
-
-mysql-dfsg (4.0.6.gamma-1) experimental; urgency=low
-
- * New upstream version. Now Gamma!
- * There are no longer changes to the .orig.tar.gz neccessary to make diff
- happy. docs/ has still to be deleted, although, as it is non-free.
- * Incorporated patches from unstable.
- * Added mysqlmanager and a couple of other new scripts.
- * Enabled libmysqld embedded server library.
- * Enabled SSL and Virtual-IO support.
- (CORBA based MySQL-FS seems to be not existing..)
-
- -- Christian Hammers <ch@debian.org> Fri, 20 Dec 2002 22:30:51 +0100
-
-mysql-dfsg (4.0.5a.beta-3) experimental; urgency=low
-
- * Modified postinst to work with old and new mysql.user table format
- and fixed spelling typo in postinst. Thanks to Roger Aich.
- * Updated config.{guess,sub} to make the mipsel porters happy.
- Thanks to Ryan Murray. Closes: #173553
-
- -- Christian Hammers <ch@debian.org> Wed, 18 Dec 2002 15:56:34 +0100
-
-mysql-dfsg (4.0.5a.beta-2) experimental; urgency=low
-
- * Upstream removed option "--skip-gemini". So did I. Closes: 173142
-
- -- Christian Hammers <ch@debian.org> Tue, 17 Dec 2002 10:35:49 +0100
-
-mysql-dfsg (4.0.5a.beta-1) experimental; urgency=low
-
- * First 4.x experimental package due to continuous user requests :-)
- Please test and report!
- * upstream: safe_mysqld has been renamed to mysqld_safe
- * upstream: new library soname version libmysqlclient.so.11
- * Renamed libmysqlclientXX-dev to libmysqlclient-dev as I don't plan to
- support more than one development environment and this makes the
- dependencies easier.
- * FIXME: Skipped parts of the debian/patches/alpha patch as the global.h
- is not existing.
- * FIXME: How to get rid this? Old ltconfig patch already applied.
- "lintian: binary-or-shlib-defines-rpath ./usr/bin/mysql /usr/lib/mysql"
-
- -- Christian Hammers <ch@debian.org> Sun, 1 Dec 2002 18:32:32 +0100
-
-mysql-dfsg (3.23.53-4) unstable; urgency=medium
-
- * Fixed errno.h problem. Closes: #168533, #168535
-
- -- Christian Hammers <ch@debian.org> Sun, 10 Nov 2002 18:32:08 +0100
-
-mysql-dfsg (3.23.53-3) unstable; urgency=medium
-
- * Changed automake build-dep to unversioned automake1.4. Closes: #166391
- * Fixed description. Closes: #167270
- (Thanks to Soren Boll Overgaard)
-
- -- Christian Hammers <ch@debian.org> Tue, 5 Nov 2002 01:25:01 +0100
-
-mysql-dfsg (3.23.53-2) unstable; urgency=low
-
- * Reverted user creation in init scripts. Closes: #166432
- (Thanks to Birzan George Cristian)
-
- -- Christian Hammers <ch@debian.org> Thu, 31 Oct 2002 15:36:25 +0100
-
-mysql-dfsg (3.23.53-1) unstable; urgency=low
-
- * New upstream release.
-
- -- Christian Hammers <ch@debian.org> Thu, 24 Oct 2002 23:04:16 +0200
-
-mysql-dfsg (3.23.52-3) unstable; urgency=low
-
- * Substituted the first-install 'debian-sys-maint' user creation by
- something ANSI SQL compliant. Closes: #163497
- (Thanks to Karl Hammar)
- * Tightend dependency to debhelper (>= 4.0.12) to be sure that
- debconf-utils gets installed, too, as I use dh_installdebconf.
- * Fixed upstream manpage bug in mysqldump.1. Closes: #159779
- (Thanks to Colin Watson)
- * Added comment about MIN_WORD_LEN to mysql-server.README.Debian
- (Thanks to Philipp Dreimann)
- * Added a dependency for zlib1g-dev to libmysqlclient10-dev.
- (Thanks to Jordi Mallach)
-
- -- Christian Hammers <ch@debian.org> Sun, 15 Sep 2002 17:14:44 +0200
-
-mysql-dfsg (3.23.52-2) unstable; urgency=low
-
- * Fixed typo in preinst scripts.
- * Removed bashism in init script.
- * Fixed ambiguous debconf example. Closes: #158884
-
- -- Christian Hammers <ch@debian.org> Fri, 30 Aug 2002 00:51:29 +0200
-
-mysql-dfsg (3.23.52-1) unstable; urgency=low
-
- * New upstream version. Closes: #157731
- * Clearified the meaning of the debian-sys-maint special user in the
- README.Debian file. Closes: #153702
- * Wrote some words regarding the skip-networking in README.Debian.
- Closes: #157038
- * Added dependency to passwd.
- * Fixes typo and unnecessarily complication in is_mysql_alive().
- * Added check for /etc/mysql/my.cnf in init script.
-
- -- Christian Hammers <ch@debian.org> Tue, 27 Aug 2002 01:53:32 +0200
-
-mysql-dfsg (3.23.51-4) unstable; urgency=low
-
- * Added a compressed "nm mysqld" output to allow people to trace
- core dumps with /usr/bin/resolve_stack_dump as suggested in the
- INSTALL-SOURCE file. Thanks to atudor@labs.agilent.com for the hint.
-
- -- Christian Hammers <ch@debian.org> Wed, 24 Jul 2002 20:44:55 +0200
-
-mysql-dfsg (3.23.51-3) unstable; urgency=low
-
- * Corrected copyright file: the MySQL client library is licenced under
- the LGPL-2 not the GPL. From version 4.x it actually will be GPL this
- is why parts of http://www.mysql.com/ already say so. Closes: #153591
- * Corrected german translation.
- Thanks to Roland Rosenfeld <roland@spinnaker.de>. Closes: #151903
-
- -- Christian Hammers <ch@debian.org> Thu, 11 Jul 2002 20:32:28 +0200
-
-mysql-dfsg (3.23.51-2) unstable; urgency=low
-
- * Improved NIS tolerance in preinst script.
-
- -- Christian Hammers <ch@debian.org> Sun, 7 Jul 2002 04:43:28 +0200
-
-mysql-dfsg (3.23.51-1) unstable; urgency=medium
-
- * New upstream version.
- * I applied a patch that fixes a binary imcompatibility in
- the shared libary libmysqlclient.so.10 between 3.23.50 and
- some versions earlier. Upstream has been contacted and asked
- for clarification. Closes: #149952
- * Added support for NIS i.e. it shows a warning and fails if the
- needed 'mysql' user does not exists but works if it does.
- Closes: #143282, #147869
- * Substituted $0 in init scripts by something really weird so that
- "./S20mysql restart" works now, too. (BTW: S20? install file-rc!!!)
- Closes: #148658
- * Now postinst works even if /etc/init.d/mysql is removed. Closes: #151021
- * Decided to leave "set +x" in postinst but wrote comment. Closes: #151022
-
- -- Christian Hammers <ch@debian.org> Sun, 7 Jul 2002 04:43:25 +0200
-
-mysql-dfsg (3.23.50-1) unstable; urgency=medium
-
- * New upstream version.
- Fixes a very annoying and important bug that lets all mysql programs
- including perl scripts etc. segfault when using the read_default_group()
- function. 3.23.50 is currently a pre-release and expected to be released
- next week. I plan to propose it for woody as soon as its stability has
- been proven. The following bug reports are all regarding this issue.
- Closes: #144960, #145322, #136798, #138143,
-
- -- Christian Hammers <ch@debian.org> Sat, 18 May 2002 21:14:01 +0200
-
-mysql-dfsg (3.23.49x-1) unstable; urgency=low
-
- * I had to split the package to seperate the manual as it is not GPL
- like the rest of the software and docs but under a license that
- e.g. forbids selling printed versions.
- .
- The upstream authors were contacted a while ago but did not like to
- change the situation.
- .
- The names of the resulting packages have not changed as the manual
- already was in a seperate mysql-doc package due to it's size.
- The source packages are now splitted from one "mysql" to
- "mysql-dfsg" in main and "mysql-nonfree" in non-free.
- * No code change!
- The "x" at the end of the version number ist just to be able to
- upload a new source package. ("a" was already taken by upstream
- for their binary upload correction)
-
- -- Christian Hammers <ch@debian.org> Wed, 8 May 2002 02:01:41 +0200
-
-mysql (3.23.49-8) unstable; urgency=low
-
- * Substituted $0 in init script to let e.g. "/etc# ./init.d/mysql restart"
- works, too. Closes: #141555
-
- -- Christian Hammers <ch@debian.org> Sun, 7 Apr 2002 15:00:44 +0200
-
-mysql (3.23.49-7) unstable; urgency=low
-
- * The Makefiles are totally broken for the --enable-local-infile
- option. I now patched libmysql/libmysql.c#mysql_init() manually.
- Closes: #138347
-
- -- Christian Hammers <ch@debian.org> Fri, 29 Mar 2002 23:55:15 +0100
-
-mysql (3.23.49-6) unstable; urgency=low
-
- * Moved mysqlcheck from server to client package. Closes: #139799
- * Added manpage for mysqlhotcopy. Regarding: #87097
- * Added 'sharedscripts' directive to the logrotate script.
- * Replaced grep by /usr/bin/getent to let the group/user checking work
- on NIS/LDAP systems, too. Closes: #115677, #101529
-
- -- Christian Hammers <ch@debian.org> Fri, 22 Mar 2002 22:40:51 +0100
-
-mysql (3.23.49-5) unstable; urgency=low
-
- * Added skip-innodb to default my.cnf.
- * Enabled --enable-local-infile, it seems to be a new option that
- defaults to disable a formerly enabled feaure. Closes: #137115
-
- -- Christian Hammers <ch@debian.org> Sat, 16 Mar 2002 00:29:10 +0100
-
-mysql (3.23.49-4) unstable; urgency=medium
-
- * Recompiled against fixed libz.
-
- * Enabled --enable-local-infile, it seems to be a new option that
- defaults to disable a formerly enabled feaure. Closes: #137115
- * Fixed README.compile_on_potato. Closes: #136529
- * Now a ext3 .jounal file in /var/lib/mysql does not prevent the
- installation (happens when creating a jounal on an already mounted
- partition). Closes: #137146
-
- -- Christian Hammers <ch@debian.org> Wed, 13 Mar 2002 13:34:24 +0100
-
-mysql (3.23.49-3) unstable; urgency=low
-
- * Added Russian translation. Closes: #135846
- * Fixed installation of .info documents. Closes: #135030
-
- -- Christian Hammers <ch@debian.org> Wed, 27 Feb 2002 23:36:35 +0100
-
-mysql (3.23.49-2) unstable; urgency=low
-
- * Updated french translation and split template files. Closes: #134754
- * Fixed a small debian.cnf related bug in mysql-server.postinst.
-
- -- Christian Hammers <ch@debian.org> Tue, 19 Feb 2002 23:13:58 +0100
-
-mysql (3.23.49-1) unstable; urgency=low
-
- * New upstream release.
- (Mainly InnoDB related fixes)
- * Exported a $HOME variable in the scripts so that /root/.my.cnf
- is not read anymore. This will avoid problems when admins put
- only passwords but no usernames in this file. Closes: #132048
- * New debian-sys-maint password algorithm (now ~96bit :-)) Closes: #133863
- * Recreating debian-sys-main pwd on every install to help people who
- accidently delete user or password files...
- * Added /var/log/mysql so that user can put the binary logs in there as
- mysql cannot write the .001 etc files itself in /var/log which is
- owned by root.
-
- -- Christian Hammers <ch@debian.org> Thu, 14 Feb 2002 22:17:45 +0100
-
-mysql (3.23.47-6) unstable; urgency=low
-
- * Dropped a sentence about the new debian-sys-maint user in the
- debconf note and updated the README.Debian. Related: #132048
- * Added more french translation. Closes: #132390
-
- -- Christian Hammers <ch@debian.org> Wed, 6 Feb 2002 09:41:29 +0100
-
-mysql (3.23.47-5) unstable; urgency=low
-
- * Fixed grammar error in template. Closes: #132238
- * Really fixed typo in logrotate script. Closes: #131711
-
- -- Christian Hammers <ch@debian.org> Tue, 5 Feb 2002 14:20:08 +0100
-
-mysql (3.23.47-4) unstable; urgency=medium
-
- * Fixes typo in postinst that let init script fail. Closes: #131743
- * Fixed bashism bug that failed on ash. Closes: #131697
- * Fixed typo in logrotate script. Closes: #131711
-
- -- Christian Hammers <ch@debian.org> Thu, 31 Jan 2002 23:58:46 +0100
-
-mysql (3.23.47-3) unstable; urgency=low
-
- * Added new Debian specific mysql user called 'debian-sys-maint' which
- is used for pinging the server status, flushing the logs or shutting
- down the server in maintenance scripts. The credentials of this user
- are stored in the UID0-only readable file /etc/mysql/debian.cnf.
- Closes: #129887, #130326, #99274
- * Fixed unintended server startup at boottime. Closes: #122676, #130105
- * New upstream fixes command line parsing bug: Closes: #128473
- * Fixed manpage headers to let apropos work: Closes: #119122
- * Added "status" options for /etc/init.d/mysql. Closes: #129020
-
- -- Christian Hammers <ch@debian.org> Sun, 27 Jan 2002 19:46:11 +0100
-
-mysql (3.23.47-2) unstable; urgency=low
-
- * Enhanced init scripts by using mysqladmin instead of kill $pid.
- Thanks to Aaron Brick.
-
- -- Christian Hammers <ch@debian.org> Fri, 18 Jan 2002 01:42:23 +0100
-
-mysql (3.23.47-1) unstable; urgency=low
-
- * New upstream release.
- * Updated brazilian translation of debconf descriptions. Closes: #123332
-
- -- Christian Hammers <ch@debian.org> Sun, 6 Jan 2002 21:11:17 +0100
-
-mysql (3.23.46-3) unstable; urgency=low
-
- * Fixed bug in postinst where a script was accidently called with
- "bash -c <script> -IN_RPM" prevting the first argument to take effect
- and then leading to failures on hosts with unresolvable hostnames.
- Closes: #126147
- * Small changes and comments in postinst.
-
- -- Christian Hammers <ch@debian.org> Sat, 22 Dec 2001 14:03:02 +0100
-
-mysql (3.23.46-2) unstable; urgency=low
-
- * Start/stop behaviour now configurable via debconf. Closes: #112174
-
- -- Christian Hammers <ch@debian.org> Sun, 9 Dec 2001 21:38:54 +0100
-
-mysql (3.23.46-1) unstable; urgency=low
-
- * New upstream release.
- Only few fixes, mainly innodb related.
-
- -- Christian Hammers <ch@debian.org> Sun, 2 Dec 2001 03:08:48 +0100
-
-mysql (3.23.45-1) unstable; urgency=low
-
- * New upstream version.
- Only few fixes, mainly innodb related.
- * Added debconf note regarding the skip-networking option.
-
- -- Christian Hammers <ch@debian.org> Sun, 25 Nov 2001 16:50:37 +0100
-
-mysql (3.23.44-2) unstable; urgency=low
-
- * Finally removed debconf toggled "skip-networking" line add/remove
- code for /etc/mysql/my.cnf. I don't like editing a file that's tagged
- as configuration file.
- I disabled networking by default for security reasons. Better ideas?
-
- -- Christian Hammers <ch@debian.org> Fri, 16 Nov 2001 02:11:02 +0100
-
-mysql (3.23.44-1) unstable; urgency=low
-
- * New upstream release.
- - fixes replication bug (core dump)
- * Made description better english :) Thanks to D. Welton.
-
- -- Christian Hammers <ch@debian.org> Sun, 11 Nov 2001 15:44:07 +0100
-
-mysql (3.23.43-4) unstable; urgency=low
-
- * Disabled statically linking.
-
- -- Christian Hammers <ch@debian.org> Sat, 10 Nov 2001 03:15:56 +0100
-
-mysql (3.23.43-3) unstable; urgency=low
-
- * Changed compiler settings after one user reported instabilities.
- See #116631 for more information.
-
- -- Christian Hammers <ch@debian.org> Tue, 30 Oct 2001 21:39:17 +0100
-
-mysql (3.23.43-2) unstable; urgency=low
-
- * Patched sparc mutexes again. Closes: #113430
-
- -- Christian Hammers <ch@debian.org> Sun, 7 Oct 2001 15:09:00 +0200
-
-mysql (3.23.43-1) unstable; urgency=low
-
- * New upstream version.
- - Fixed some unlikely(sic!) bugs and core dumps.
- - Fixed a bug with BDB tables and UNIQUE columns that are NULL.
- - [more minor bugs were fixed; see changelog]
- * Adjusted build depends on libwrap0 for IA-64. Closes: #114582
- * Added the mysqlcheck binary. Closes: #114490
- * Fixed rules for arm architecture. Closes: #88186
- * Renamed mysql_print_defaults to the original name my_print_defaults.
- Isn't as descriptive but else I'd have to patch too much. Closes: #114492
-
- -- Christian Hammers <ch@debian.org> Fri, 5 Oct 2001 22:24:40 +0200
-
-mysql (3.23.42-2) unstable; urgency=low
-
- * Applied patch for m68k compile. Closes: #112904
-
- -- Christian Hammers <ch@debian.org> Sun, 23 Sep 2001 21:32:57 +0200
-
-mysql (3.23.42-1) unstable; urgency=low
-
- * New upstream releae.
- Fixes critical bug with InnoDB and large BLOBs.
-
- -- Christian Hammers <ch@debian.org> Tue, 18 Sep 2001 22:25:47 +0200
-
-mysql (3.23.41-2) unstable; urgency=low
-
- * Fixed shlibs.local problem. Closes: #111573
- * Replaced emacs by sensible-editor in mysqlbug.sh. Thanks Hans Ginzel.
-
- -- Christian Hammers <ch@debian.org> Sun, 9 Sep 2001 17:16:42 +0200
-
-mysql (3.23.41-1) unstable; urgency=low
-
- * New upstream release
- * Fixed build problem on ia64. Closes: #110624
-
- -- Christian Hammers <ch@debian.org> Tue, 14 Aug 2001 23:20:35 +0200
-
-mysql (3.23.40-1) unstable; urgency=low
-
- * New upstream release
-
- -- Christian Hammers <ch@debian.org> Sun, 5 Aug 2001 19:46:18 +0200
-
-mysql (3.23.39-5) unstable; urgency=low
-
- * Added debconf template for brazil. Closes: #106934, #106752
- * Tightened dependencies on debconf.
- * Adjusted mysql.err permissions in logrotate script to 0600. Closes: #105672
-
- -- Christian Hammers <ch@debian.org> Mon, 30 Jul 2001 00:10:12 +0200
-
-mysql (3.23.39-4.1) unstable; urgency=low
-
- * Maintainer-requested NMU.
- * Fixing thread mutexes on Sparc and Alpha
- (closes: Bug#101783)
- * Added --enable-assembler for sparc. This should
- allow mysql on sparc to use assembler versions of
- some string functions (read: should speed up a bit).
-
- -- Christopher C. Chimelis <chris@debian.org> Fri, 13 Jul 2001 15:09:30 -0400
-
-mysql (3.23.39-4) unstable; urgency=low
-
- * Porting fixes.
-
- -- Christian Hammers <ch@debian.org> Mon, 9 Jul 2001 17:56:54 +0200
-
-mysql (3.23.39-3.1) unstable; urgency=low
-
- * NMU (for porting)
- * Update config.sub and config.guess for hppa, sh & s390.
- * Add --with-client-ldflags=-lstdc++ to configure line. Closes: #100884
-
- -- Matthew Wilcox <willy@debian.org> Sun, 8 Jul 2001 19:26:59 -0600
-
-mysql (3.23.39-3) unstable; urgency=low
-
- * Disabled berkeley-db on sparc again. Mutexes aren't working again :-(
-
- -- Christian Hammers <ch@debian.org> Sat, 7 Jul 2001 18:30:08 +0200
-
-mysql (3.23.39-2) unstable; urgency=low
-
- * Bugfixed the m68k mutex patch. Thanks to Michael Fedrowitz. Closes: #103145
- * Removed config.cache files in bdb/ and innobase/. Closes: #103143
-
- -- Christian Hammers <ch@debian.org> Wed, 4 Jul 2001 22:06:58 +0200
-
-mysql (3.23.39-1) unstable; urgency=low
-
- * New upstream release. Minor bugfixes only.
-
- -- Christian Hammers <ch@debian.org> Thu, 14 Jun 2001 13:53:03 +0200
-
-mysql (3.23.38-4) unstable; urgency=low
-
- * Added logcheck files. Closes: #99131
- (I can't let the usermod away since I don't know of an easy way to
- retrive "passwd" information in a shell script considering that
- people use different storage methods like LDAP/NIS instead of passwd.)
-
- -- Christian Hammers <ch@debian.org> Fri, 8 Jun 2001 21:04:25 +0200
-
-mysql (3.23.38-3) unstable; urgency=low
-
- * Explicit pointet to /root/.my.cnf to let /etc/init.d/mysql stop
- work in sudo environments with $HOME!=/root work, too. Closes: #98324
- * Removes empty /etc/mysql on purge. Closes: #98164
-
- -- Christian Hammers <ch@debian.org> Tue, 22 May 2001 10:13:06 +0200
-
-mysql (3.23.38-2) unstable; urgency=low
-
- * Added depends to libdbd-mysql-perl for mysql-server. Closes: #94306
-
- -- Christian Hammers <ch@debian.org> Sat, 19 May 2001 19:43:26 +0200
-
-mysql (3.23.38-1) unstable; urgency=low
-
- * New upstream release.
- * Added Build-Depends to procps. Closes: #96768
-
- -- Christian Hammers <ch@debian.org> Sun, 13 May 2001 17:30:15 +0200
-
-mysql (3.23.37-5) unstable; urgency=low
-
- * Applied mutex patch for bdb support on m68k.
- Thanks to Michael Fedrowitz for the patch.
-
- -- Christian Hammers <ch@debian.org> Mon, 7 May 2001 12:30:40 +0200
-
-mysql (3.23.37-4) unstable; urgency=low
-
- * Enable bdb support for m68k architecture.
-
- -- Christian Hammers <ch@debian.org> Sat, 5 May 2001 16:47:36 +0200
-
-mysql (3.23.37-3) unstable; urgency=low
-
- * Added thread-safe client library. Thanks to Shane Wegner. Closes: #95441
-
- -- Christian Hammers <ch@debian.org> Sat, 28 Apr 2001 09:45:00 -0400
-
-mysql (3.23.37-2) unstable; urgency=low
-
- * Added sparc to the list of BDB supporting architectures after some
- tests on vore.debian.org and mails with Ben Collons.
-
- -- Christian Hammers <ch@debian.org> Fri, 27 Apr 2001 09:30:09 -0400
-
-mysql (3.23.37-1) unstable; urgency=low
-
- * New upstream version.
- * Added gemini table support.
- * Does anybody know how to enable SSL?
- * Fixed ARM compilation problem. Closes: #88186
-
- -- Christian Hammers <ch@debian.org> Sat, 21 Apr 2001 11:48:46 -0400
-
-mysql (3.23.36-2) unstable; urgency=low
-
- * Added patch by Christopher C. Chimelis <chris@debian.org> to make
- Berkeley db3 work again on Alpha architecture. Closes: #92787
-
- -- Christian Hammers <ch@debian.org> Tue, 3 Apr 2001 23:41:46 +0200
-
-mysql (3.23.36-1) unstable; urgency=high
-
- * New upstream version.
- * SECURITY FIX: One could place database tables outside the database
- directory by using '..' in one of the mysql helper programs where the
- table name was not checked correctly. This could lead to root compromise
- if the server would be running as root else you could at least do bad
- things as user mysql.
- * upstream: Fixed bug when thread creation failed.
- * upstream: Fixed problem in Innobase with non-latin1 charsets
- * upstream: Fixed a core-dump bug when using very complex query with DISTINGT
- * upstream: many others so called minor bugs...
- * fixes bug in init script. Closes: #90257
- (this report was agains some older problem that has been fixed too in .33)
-
- -- Christian Hammers <ch@debian.org> Fri, 30 Mar 2001 02:55:12 +0200
-
-mysql (3.23.35-1) unstable; urgency=medium
-
- * New upstream relase.
- * Fixes problem in ORDER BY clause. People using 3.33.34 should upgrade!
- * Includes innobase support.
- (Hope this is not such a catastrophe like berkeley db...)
-
- -- Christian Hammers <ch@debian.org> Fri, 16 Mar 2001 23:30:30 +0100
-
-mysql (3.23.33-3) unstable; urgency=low
-
- * Forgot #!/bin/sh at top of mysql-doc.postinst. Closes: #89801
-
- -- Christian Hammers <ch@vore.debian.org> Thu, 15 Mar 2001 20:38:35 -0500
-
-mysql (3.23.33-2) unstable; urgency=low
-
- * Added some missing scripts and manpages. Closes: #84068
- * Added dependency to perl-5.6. Closes: #81942
- * Added french templates somewhen ago. Closes: #83790
- * Added patch to get db3 working on Alpha. Closes: #86033
- Thanks to Christopher C. Chimelis <chris@debian.org>. The patch
- itself is included as debian/patch.alpha, too.
-
- -- Christian Hammers <ch@debian.org> Sun, 18 Feb 2001 06:40:40 +0100
-
-mysql (3.23.33-1) unstable; urgency=high
-
- * Fixes two security bugs that allowes crashing the server and maybe
- gaining the UID of the process that is linked against libmysqlclient!
-
- -- Christian Hammers <ch@debian.org> Tue, 13 Feb 2001 23:01:18 +0100
-
-mysql (3.23.32-1) unstable; urgency=low
-
- * New upstream releaes.
- (just minor fixes)
- * Added french and german debconf templates.
-
- -- Christian Hammers <ch@debian.org> Sun, 4 Feb 2001 17:27:07 +0100
-
-mysql (3.23.31-1) unstable; urgency=high
-
- * New upstream release.
- * Fixes security bug that was announced at BUGTRAQ mailing list.
- (Disappointingly not by mysql.com!). And allows a buffer overflow
- and therefore access to the mysql UID and all databases when already
- having a valid account. Closes: #82881
-
- -- Christian Hammers <ch@debian.org> Sat, 20 Jan 2001 11:14:36 +0100
-
-mysql (3.23.30-2) unstable; urgency=low
-
- * Recompiled with new dpkg-dev.
-
- -- Christian Hammers <ch@debian.org> Sun, 14 Jan 2001 22:20:55 +0100
-
-mysql (3.23.30-1) unstable; urgency=low
-
- * New upstream release.
-
- -- Christian Hammers <ch@debian.org> Sun, 7 Jan 2001 22:10:18 +0100
-
-mysql (3.23.28-10) testing unstable; urgency=low
-
- * I must upload to "testing" to get it into woody, right?!
-
- -- Christian Hammers <ch@debian.org> Fri, 29 Dec 2000 14:43:57 +0100
-
-mysql (3.23.28-9) unstable; urgency=low
-
- * Made it a replacement for libmysqlclient9.
-
- -- Christian Hammers <ch@westend.com> Mon, 25 Dec 2000 19:15:04 +0100
-
-mysql (3.23.28-8) unstable; urgency=low
-
- * Applied patch from a user to get the skip-networking option working!
- Approved from a mysql employee but please test anyways.
- This finally: Closes: #79672, #78634, #79660, #79658
-
- -- Christian Hammers <ch@debian.org> Sat, 16 Dec 2000 14:01:36 +0100
-
-mysql (3.23.28-6) unstable; urgency=medium
-
- * Fixed error in postinst. Closes: #79392, #79400, #79451, #79550
- * Added .info files again on user request. Closes: #78988, #75737
-
- -- Christian Hammers <ch@debian.org> Wed, 13 Dec 2000 21:18:24 +0100
-
-mysql (3.23.28-5) unstable; urgency=low
-
- * Fixed a stupid bug in mysql-server.postinst regarding the
- configuration of skip-networking. Closes: #78639, 78634
- * Used patched bdb which hopefully enables mutexes on Alpha. Closes: #78197
- * Added dependency to adduser. Closes: #76798
-
- -- Christian Hammers <ch@debian.org> Sun, 10 Dec 2000 16:55:48 +0100
-
-mysql (3.23.28-4) unstable; urgency=low
-
- [never uploaded]
- * Fixed a stupid bug in mysql-server.postinst regarding the
- configuration of skip-networking. Closes: #78639, 78634
- * Used patched bdb which hopefully enables mutexes on Alpha. Closes: #78197
-
- -- Christian Hammers <ch@debian.org> Sun, 3 Dec 2000 17:49:44 +0100
-
-mysql (3.23.28-3) unstable; urgency=low
-
- * This time really fixed m68k build error. Closes: #78235
-
- -- Christian Hammers <ch@debian.org> Sun, 3 Dec 2000 15:02:55 +0100
-
-mysql (3.23.28-2) unstable; urgency=low
-
- * Adjusted rules file to make it buildable on m86k. Closes: #78235
-
- -- Christian Hammers <ch@debian.org> Fri, 1 Dec 2000 20:07:26 +0100
-
-mysql (3.23.28-1) unstable; urgency=low
-
- * New upstream vesrion. Now gamma!
- * Changed umask of mysql.log making it o-rw
- * Disabled listening on network reachable TCP ports by default due to
- security considerations.
-
- -- Christian Hammers <ch@debian.org> Thu, 23 Nov 2000 20:12:50 +0100
-
-mysql (3.23.27-1) unstable; urgency=low
-
- * New upstream version.
- * Closes: #75711
-
- -- Christian Hammers <ch@debian.org> Sun, 29 Oct 2000 14:29:51 +0100
-
-mysql (3.23.25-4) unstable; urgency=low
-
- * Recompiled to get rid of the dependency for zlib1 (libc5).
- Closes: #74952, #74939
-
- -- Christian Hammers <ch@debian.org> Tue, 17 Oct 2000 14:34:52 +0200
-
-mysql (3.23.25-3.1) unstable; urgency=low
-
- * Maintainer-approved NMU.
- * Includes patch to fix and enable db3 support on Alpha.
- * Enable support for thread mutexes in db3 on sparc
- (it works after all, according to Ben Collins)
- * Removed atomic_ functions for Alpha since they are no
- longer supported in the current glibc in woody.
- * Cleaned up rules file a bit.
-
- -- Christopher C. Chimelis <chris@debian.org> Sat, 14 Oct 2000 04:22:02 -0400
-
-mysql (3.23.25-3) unstable; urgency=low
-
- * Upstream decided not to include my_config.h,my_dir.h into the installed
- header files. As this file contains at least informative material
- and more important is checked by several autoconf scripts I
- included it by hand again.
- * Made building of berkeley db conditional to architecture until
- I get response whether it works on sparc/alpha now.
-
- -- Christian Hammers <ch@debian.org> Wed, 11 Oct 2000 23:58:38 +0200
-
-mysql (3.23.25-2) unstable; urgency=medium
-
- * Last build went terrible wrong.. Here's the changelog again:
- * New upstream release.
- * Shared library version was raised from 9 to 10.
- Maintainers of packets using libmysqlclient9 must recompile!
-
- -- Christian Hammers <ch@debian.org> Wed, 11 Oct 2000 01:16:34 +0200
-
-mysql (3.23.25-1) unstable; urgency=low
-
- * New upstream release.
- * Shared library version was raised from 9 to 10.
- Maintainers of packets using libmysqlclient9 must recompile!
-
- -- Christian Hammers <ch@debian.org> Sat, 7 Oct 2000 18:21:51 +0200
-
-mysql (3.23.24-2) unstable; urgency=low
-
- * Applied upstream patch regarding quoting of mysqldump.
- * Updated to db-3.1.17-patched (from www.mysql.com)
-
- -- Christian Hammers <ch@debian.org> Fri, 15 Sep 2000 18:58:14 +0200
-
-mysql (3.23.24-1) unstable; urgency=medium
-
- * New upstream version with some important fixes.
- * upstream: Last version corrupted CHAR/VARCHAR/BLOB columns with
- chararacters above ASCII 128! Check and repair all these tables.
- * upstream: fixed small memory leak
- * upstream: fixed problem with BDB tables and reading on unique
- (not primary) key.
- * Disabled BDB tables on all architectures except i386 due to many
- bug reports (see #71206). -> HELP APPRECIATED <-
-
- -- Christian Hammers <ch@debian.org> Tue, 12 Sep 2000 06:18:54 +0200
-
-mysql (3.23.23-2) unstable; urgency=low
-
- * Strange... "nohup nice" gives differnet results and let therefore
- crash safe_mysqld when starting up. Apparently it seems to be
- kernel dependand. Now fixed by another conditional. This
- more or less Closes: #71057
- * This bug was reported (accidently) in the following identical reports:
- Closes: #71253, #71254, #71257, #71258, #71259, #71262, #71266, #71267
- Closes: #71268, #71271, #71275, #71277, #71278, #71283, #71291
-
- -- Christian Hammers <ch@debian.org> Sat, 9 Sep 2000 20:13:50 +0200
-
-mysql (3.23.23-1) unstable; urgency=low
-
- * New upstream version. Feature freeze!
- * Fixed source build problem. Closes: #70707
-
- -- Christian Hammers <ch@debian.org> Thu, 31 Aug 2000 10:03:35 +0200
-
-mysql (3.23.22b-1) unstable; urgency=low
-
- * Reorganised docs. Now we have several small html files instead of
- one with almost 2M. Closes: 70431
- * Removed pdf,ps and html from source package shrinked it about 3M
- (therefore the .orig.tar.gz is called 3.23.22b!)
- * -> Last upload failed due to problems at the FTP site so here the
- -> changelog again:
- * Fixes memory leak, commit/rollback, reserved word "MASTER" ...
- * Added Berkeley DB3 source code to the Debian diff to be able to
- compile with bdb transaction support! (Great feature!!!)
- * Upstream correction of error message. Closes: #68939
- * Upstream correction of reserved word "source".
-
- -- Christian Hammers <ch@debian.org> Fri, 25 Aug 2000 19:21:24 +0200
-
-mysql (3.23.22-1) unstable; urgency=low
-
- * New upstream version.
- * Fixes memory leak, commit/rollback, reserved word "MASTER" ...
- * Added Berkeley DB3 source code to the Debian diff to be able to
- compile with bdb transaction support! (Great feature!!!)
- * Upstream correction of error message. Closes: #68939
- * Upstream correction of reserved word "source".
-
- -- Christian Hammers <ch@debian.org> Sun, 20 Aug 2000 09:05:48 +0200
-
-mysql (3.23.21-4) unstable; urgency=low
-
- * Added libmysqlclient9.shlibs and shlibs.local file. Closes: #68669
-
- -- Christian Hammers <ch@debian.org> Wed, 9 Aug 2000 14:22:49 +0200
-
-mysql (3.23.21-3) unstable; urgency=low
-
- * Let "/etc/init.d/mysql restart" wait until the pid has been
- removed before (but max 6 seconds) before restarting. Closes: 65070
- * Added build dependencies.
-
- -- Christian Hammers <ch@debian.org> Sun, 30 Jul 2000 16:16:48 +0200
-
-mysql (3.23.21-2) unstable; urgency=low
-
- * Typo in safe_mysqld prevents start.
-
- -- Christian Hammers <ch@debian.org> Sat, 29 Jul 2000 13:40:50 +0200
-
-mysql (3.23.21-1) unstable; urgency=low
-
- * New upstream version.
-
- -- Christian Hammers <ch@debian.org> Mon, 10 Jul 2000 22:54:17 +0200
-
-mysql (3.23.20-1) unstable; urgency=low
-
- * MySQL finally got fully GPL'ed! This means that there is only one
- souce package and only main/* binary packages from now on.
- * Fixed symlink in libmysqlclient9-dev. Closes: 66452
- * Apart from that the usual bug fixes for BETA software.
-
- -- Christian Hammers <ch@debian.org> Mon, 3 Jul 2000 20:05:38 +0200
-
-mysql-pd (3.23.16-1) unstable; urgency=low
-
- * New upstream release. (Actually a brand new upstream branch!)
- * Added mysql-common package as the configuration file can be used
- by all versions of the mysql client library.
- Did some more package reorganisations, too. See README.Debian file!
- * libmysqlclient.so raised major version from 6 to 9.
- * Minor beautifications in the debian/ directory.
-
- -- Christian Hammers <ch@debian.org> Sat, 27 May 2000 20:30:01 +0200
-
-mysql-gpl (3.22.30-2) frozen unstable; urgency=low
-
- * Fixed path in libmysqlclient.la. Closes: #58875
-
- -- Christian Hammers <ch@debian.org> Sat, 25 Jan 2000 20:27:29 -0700
-
-mysql-gpl (3.22.30-1) frozen unstable; urgency=low
-
- * A small change in the libmysqlclient6 causes mysqladmin to print an
- shared library error when displaying the defaults. Everything else
- works fine so this error wasn't detected untill now. Closes: #58033
- * TcX released a new MySQL version that includes another security patch,
- this time against mysqlaccess. The author told me that it would be
- fine if I just included the new .c in this source since I don't want
- go to 3.22.32 in frozen.
- * ->Release Manager: Although the version number increased there is
- no new coded except for the shared library. The rest is the same
- as in mysql-server and mysql-client.
-
- -- Christian Hammers <ch@debian.org> Tue, 15 Feb 2000 23:26:54 +0100
-
-mysql-gpl (3.22.29-1) unstable; urgency=low
-
- * New upstream version.
-
- -- Christian Hammers <ch@debian.org> Thu, 6 Jan 2000 20:37:23 +0100
-
-mysql-gpl (3.22.27a-3) unstable; urgency=low
-
- * Use system readline instead of bundled version. Closes: #50069
- Any objections ?
-
- -- Christian Hammers <ch@debian.org> Sun, 14 Nov 1999 18:09:48 +0100
-
-mysql-gpl (3.22.27a-2) unstable; urgency=low
-
- * Now building mysql-gpl-doc in binary-indep.
-
- -- Christian Hammers <ch@debian.org> Sat, 23 Oct 1999 04:22:36 +0200
-
-mysql-gpl (3.22.27a-1) unstable; urgency=low
-
- * Adjusted version number to allow new orig.tar.gz.
- The old seems broken :-( People reported compilation problems.
- * Changed mysql-gpl-doc to "Architecture: all".
-
- -- Christian Hammers <ch@debian.org> Sun, 17 Oct 1999 13:01:35 +0200
-
-mysql-gpl (3.22.27-1) unstable; urgency=low
-
- * New upstream release. Fixes charset problem.
-
- -- Christian Hammers <ch@debian.org> Mon, 11 Oct 1999 18:01:40 +0200
-
-mysql-gpl (3.22.26a-1) unstable; urgency=low
-
- * New upstream version. Just some small bug fixes.
- * FHS compliance.
-
- -- Christian Hammers <ch@debian.org> Sun, 3 Oct 1999 10:16:14 +0200
-
-mysql-gpl (3.22.25-2) unstable; urgency=low
-
- * Added conflict to all old mysql-dev packages. (fixes: #42966)
-
- -- Christian Hammers <ch@debian.org> Sun, 15 Aug 1999 11:35:46 +0200
-
-mysql-gpl (3.22.25-1) unstable; urgency=low
-
- * New upstream version. (We are waiting for 3.23.x !)
- * Fixes some upstream small bugs.
-
- -- Christian Hammers <ch@debian.org> Sun, 18 Jul 1999 22:02:06 +0200
-
-mysql-gpl (3.22.23b-4) unstable; urgency=low
-
- * Rebuild for new perl.
-
- -- Christian Hammers <ch@debian.org> Thu, 8 Jul 1999 01:09:57 +0200
-
-mysql-gpl (3.22.23b-3) unstable; urgency=low
-
- * libmysqlclient had the wrong socket path.
-
- -- Christian Hammers <ch@debian.org> Sun, 03 Jul 1999 23:13:30 +0200
-
-mysql-gpl (3.22.23b-2) unstable; urgency=low
-
- * Missed one replace tag to an very old version of mysql-devel.
-
- -- Christian Hammers <ch@debian.org> Sun, 27 Jun 1999 19:13:30 +0200
-
-mysql-gpl (3.22.23b-1) unstable; urgency=low
-
- * New upstream minor version.
- * Cleaned up the dependencies a bit.
-
- -- Christian Hammers <ch@debian.org> Sun, 27 Jun 1999 19:13:30 +0200
-
-mysql-gpl (3.22.22-1) unstable; urgency=low
-
- * New upstream version. (closes Bug#36493,37340)
- * New maintainer upload.
- * Package reorganisation: We prepare for the GPL'ed server which will
- * be released soon and make the structure more clear to the user.
-
- -- Christian Hammers <ch@debian.org> Mon, 3 May 1999 20:43:41 +0200
-
-mysql (3.22.21-1) unstable; urgency=low
-
- * Never released. TcX was too fast :-)
-
- -- Christian Hammers <ch@debian.org> Tue, 20 Apr 1999 17:22:04 +0200
-
-mysql-freebits (3.21.33b-3) unstable; urgency=low
-
- * Recompile with libncurses
-
- -- Scott Hanson <shanson@debian.org> Sat, 31 Oct 1998 15:04:39 +0100
-
-mysql-freebits (3.21.33b-2) unstable; urgency=low
-
- * Recompile with libstdc++2.9 (fixes #27792)
-
- -- Scott Hanson <shanson@debian.org> Mon, 12 Oct 1998 18:47:25 +0200
-
-mysql-freebits (3.21.33b-1) unstable; urgency=low
-
- * New upstream version (probably the last for 3.21)
-
- -- Scott Hanson <shanson@debian.org> Tue, 8 Sep 1998 18:59:37 +0200
-
-mysql-freebits (3.21.33-4) unstable; urgency=low
-
- * Separate out non-free source files, move mysql-base, mysql-dev, and
- * mysql-doc to main distribution
- * Locale files /usr/share/mysql/ now in server, not base; therefore...
- * Add conflict to mysql-server <=3.21.33-3
-
- -- Scott Hanson <shanson@debian.org> Fri, 31 Jul 1998 19:16:08 +0200
-
-mysql (3.21.33-3) unstable; urgency=low
-
- * Release to unstable with moved socket (fixes #24574)
- * Add conflict to old libdbd-mysql-perl package
-
- -- Scott Hanson <shanson@debian.org> Wed, 22 Jul 1998 22:17:43 +0200
-
-mysql (3.21.33-2) experimental; urgency=low
-
- * Move socket from /tmp to /var/run (see #24574)
- * Release to experimental, since this breaks everything statically
- * linked to libmysqlclient!
-
- -- Scott Hanson <shanson@debian.org> Wed, 15 Jul 1998 19:37:01 +0200
-
-mysql (3.21.33-1) unstable; urgency=low
-
- * New upstream release
-
- -- Scott Hanson <shanson@debian.org> Sun, 12 Jul 1998 08:18:18 +0200
-
-mysql (3.21.32a-1) unstable; urgency=low
-
- * New upstream release
- * Lintian bugs: ldconfig, missing manpage, call to perl5
- * Lintian bug shlib-with-non-pic-code _not_ yet fixed
-
- -- Scott Hanson <shanson@debian.org> Sat, 4 Jul 1998 07:57:13 +0200
-
-mysql (3.21.31-1) unstable frozen; urgency=low
-
- * New upstream release for hamm and slink (bug fixes only)
- * Fix unsecure use of temp file in mysqlbug (fixes #23606)
- * Added brief licensing information to control file
-
- -- Scott Hanson <shanson@debian.org> Tue, 16 Jun 1998 10:52:44 +0200
-
-mysql (3.21.30-3) unstable; urgency=low
-
- * Restore missing shared library dependencies for mysql-server
-
- -- Scott Hanson <shanson@debian.org> Mon, 15 Jun 1998 07:51:58 +0200
-
-mysql (3.21.30-2) unstable; urgency=low
-
- * Simplify debian/rules (fixes #17662)
- * Edit manual.texi to add "Debian notes" to documentation
- * Add note about passwords on command line (fixes #16471)
- * Add note about getting privleges for users (fixes #22891)
- * Correct "Possible license changes" heading (fixes #22711)
- * Add uninstalled header files to /usr/doc/mysql-dev/examples (fixes #22627)
- * Add udf_example.cc to /usr/doc/mysql-dev/examples (fixes #22710)
-
- -- Scott Hanson <shanson@debian.org> Sun, 7 Jun 1998 13:05:37 +0200
-
-mysql (3.21.30-1) unstable; urgency=low
-
- * Stable upstream release
-
- -- Scott Hanson <shanson@debian.org> Tue, 12 May 1998 22:13:25 +0200
-
-mysql (3.21.29gamma-1) unstable; urgency=low
-
- * New upstream release
- * Do not create 'mysql' subdirectory for libs and headers (fixes #19020)
- * Remove 'CXX=gcc' flag from configure (g++ now standard)
-
- -- Scott Hanson <shanson@debian.org> Sun, 12 Apr 1998 18:38:03 +0200
-
-mysql (3.21.28gamma-1) unstable; urgency=low
-
- * New upstream release
- * Unstable-only release; hamm stays at 3.21.25 for now
-
- -- Scott Hanson <shanson@debian.org> Thu, 2 Apr 1998 21:33:51 +0200
-
-mysql (3.21.25gamma-3) unstable frozen; urgency=low
-
- * Have mysql-base suggest perl >= 5.004 for mysqlaccess (fixes #19593)
- * Fix shlibs to refer to mysql-base rather than the no-longer-existant mysql
-
- -- Scott Hanson <shanson@debian.org> Thu, 26 Mar 1998 18:22:59 +0100
-
-mysql (3.21.25gamma-2) unstable; urgency=low
-
- * Restore libmysqlclient.so symlink to mysql-dev (fixes #19036)
-
- -- Scott Hanson <shanson@debian.org> Sun, 8 Mar 1998 10:46:43 +0100
-
-mysql (3.21.25gamma-1) unstable; urgency=low
-
- * Check if running as root in init.d script (fixes #18577)
- * New upstream release
-
- -- Scott Hanson <shanson@debian.org> Fri, 27 Feb 1998 20:01:30 +0100
-
-mysql (3.21.24gamma-1) unstable; urgency=low
-
- * New upstream release
-
- -- Scott Hanson <shanson@debian.org> Mon, 23 Feb 1998 08:14:17 +0100
-
-mysql (3.21.23beta-3) unstable; urgency=low
-
- * Squashed errors found by lintian
-
- -- Scott Hanson <shanson@debian.org> Tue, 17 Feb 1998 20:19:01 +0100
-
-mysql (3.21.23beta-2) unstable; urgency=low
-
- * Fixed overlaps with old mysql package (fixes #17843)
-
- -- Scott Hanson <shanson@debian.org> Thu, 5 Feb 1998 22:55:00 +0100
-
-mysql (3.21.23beta-1) unstable; urgency=low
-
- * New upstream release
- * Fix include lines in mysql.h (fixes #17827)
- * Move /usr/include/mysql to mysql-dev
-
- -- Scott Hanson <shanson@debian.org> Wed, 4 Feb 1998 19:59:14 +0100
-
-mysql (3.21.22beta-3) unstable; urgency=low
-
- * Correct descriptions in control file (fixes #17698)
- * Clean up output of shutdown script
-
- -- Scott Hanson <shanson@debian.org> Sat, 31 Jan 1998 19:04:29 +0100
-
-mysql (3.21.22beta-2) unstable; urgency=low
-
- * Split out mysql-dev and mysql-bench subpackages
-
- -- Scott Hanson <shanson@debian.org> Wed, 28 Jan 1998 19:52:27 +0100
-
-mysql (3.21.22beta-1) unstable; urgency=low
-
- * New upstream release
-
- -- Scott Hanson <shanson@debian.org> Wed, 28 Jan 1998 18:59:09 +0100
-
-mysql (3.21.21a.beta-2) unstable; urgency=low
-
- * Compile with libpthreads from libc6-dev_2.0.6-3 rather than statically
- linking to patched libpthreads (see changes to 3.20.29-2)
-
- -- Scott Hanson <shanson@debian.org> Sun, 25 Jan 1998 13:17:15 +0100
-
-mysql (3.21.21a.beta-1) unstable; urgency=low
-
- * Put initial database, mysql_install_db, safe_mysqld, isamlog and
- isamchk in mysql-server
- * Correct upstream release number so source packages are correctly built
-
- -- Scott Hanson <shanson@debian.org> Mon, 19 Jan 1998 07:52:48 +0100
-
-mysql (3.21.21.beta-1) unstable; urgency=low
-
- * Use debhelper where possible in rules
- * Split binary packages into mysql-base, mysql-client, mysql-doc
- * New upstream release
-
- -- Scott Hanson <shanson@debian.org> Thu, 15 Jan 1998 08:12:17 +0100
-
-mysql (3.21.19.beta-1) unstable; urgency=low
-
- * Offer to set root password in mysql_install_db
- * Kill `pidof mysqld` on shutdown rather than use mysqladmin
- * New upstream version
-
- -- Scott Hanson <shanson@debian.org> Fri, 9 Jan 1998 20:06:35 +0100
-
-mysql (3.21.17a.beta-2) unstable; urgency=low
-
- * Remove perl stuff (it's going back into libdbd-mysql-perl)
- * Remove conflict with libdbd-mysql-perl
- * Do not compress *html files (fixes #16314)
-
- -- Scott Hanson <shanson@debian.org> Tue, 30 Dec 1997 07:34:20 +0100
-
-mysql (3.21.17a.beta-1) unstable; urgency=low
-
- * Add conflict to libdbd-mysql-perl
- * Use --pid-file option to place pid file in /var/run rather than patching
- * Add install-info to postinst and postrm
- * Add filename to message shown by mysql_install_db (fixes #16621)
- * New upstream version
-
- -- Scott Hanson <shanson@debian.org> Sun, 21 Dec 1997 19:41:45 +0100
-
-mysql (3.20.32a-5) unstable; urgency=low
-
- * Move mysqld to /usr/lib/mysql, per policy discussion
- * Adjust makefiles so perl libs get installed
-
- -- Scott Hanson <shanson@debian.org> Wed, 3 Dec 1997 22:37:45 +0100
-
-mysql (3.20.32a-4) unstable; urgency=low
-
- * Move mysqld to /usr/sbin to comply with FSSTND
-
- -- Scott Hanson <shanson@debian.org> Mon, 3 Nov 1997 20:12:29 +0100
-
-mysql (3.20.32a-3) unstable; urgency=low
-
- * Comment out tests in mysql_install_db... for real this time!
-
- -- Scott Hanson <shanson@debian.org> Mon, 3 Nov 1997 07:32:53 +0100
-
-mysql (3.20.32a-2) unstable; urgency=low
-
- * Comment out tests in mysql_install_db (fixes #14304)
-
- -- Scott Hanson <shanson@debian.org> Sat, 1 Nov 1997 18:45:25 +0100
-
-mysql (3.20.32a-1) unstable; urgency=low
-
- * New upstream version
-
- -- Scott Hanson <shanson@debian.org> Wed, 29 Oct 1997 07:11:42 +0100
-
-mysql (3.20.29-2) unstable; urgency=low
-
- * New maintainer
- * Statically link mysqld to patched glibc-2.0.5 libpthread
- (works around #13586; see README.debian.glibc-2.0.5)
- * Conflict with libpthread0 (fixes #13448)
- * Don't link libg++, avoiding problems with glibc libpthread
-
- -- Scott Hanson <shanson@debian.org> Thu, 16 Oct 1997 19:25:23 +0200
-
-mysql (3.20.29-1) unstable; urgency=low
-
- * New upstream version
- * Recompiled with libc6
- * Include mysql-faq_toc.html (fixes #10885)
- * Reworked /etc/init.d/mysql script (thanks to Heiko)
- * Remove file /usr/lib/libmysqlclient.so.4 when package is removed.
- * Use absolute path specification for conffile
- * Use /usr/bin/perl instead of /bin/perl (fixes #10654)
- * Do not depend on mysql (fixes #12427)
- * Installed missing manpage for Mysql perl module
- * Don't use debstd anymore
- * Pristine source
- * Set section to `non-free/devel'
- * Upgraded to standards version 2.3.0.0
-
- -- Christian Schwarz <schwarz@debian.org> Fri, 12 Sep 1997 02:12:58 +0200
-
-mysql (3.20.16beta-2) unstable; urgency=low
-
- * Uses /usr/bin/perl instead of /bin/perl (fixes bug #9731)
- * Don't run mysqld with --log option
- * Don't install regex manual pages
- * Suggest package mysql-manual
- * Fixed typo in changelog
- * Upgrade to policy 2.1.3.2
-
- -- Christian Schwarz <schwarz@debian.org> Sun, 11 May 1997 14:19:26 +0200
-
-mysql (3.20.16beta-1) unstable; urgency=low
-
- * Initial Release.
-
- -- Christian Schwarz <schwarz@debian.org> Sat, 12 Apr 1997 13:51:28 +0200
diff --git a/storage/xtradb/build/debian/compat b/storage/xtradb/build/debian/compat
deleted file mode 100644
index b8626c4cff2..00000000000
--- a/storage/xtradb/build/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-4
diff --git a/storage/xtradb/build/debian/control b/storage/xtradb/build/debian/control
deleted file mode 100644
index 4d229f20a2d..00000000000
--- a/storage/xtradb/build/debian/control
+++ /dev/null
@@ -1,118 +0,0 @@
-Source: percona-xtradb-dfsg-5.1
-Section: misc
-Priority: optional
-Maintainer: Percona SQL Development Team <mysql-dev@percona.com>
-Uploaders: Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com>
-Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper (>= 4.1.16), file (>= 3.28-1), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), libreadline5-dev | libreadline-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, gs, dpatch, gawk, bison, lsb-release, fakeroot
-Standards-Version: 3.8.0
-Homepage: http://www.percona.com/
-Vcs-Browser: http://bazaar.launchpad.net/~percona-dev/percona-xtradb/release-1.0/files
-Vcs-Bzr: bzr+ssh://bazaar.launchpad.net/~percona-dev/percona-xtradb/release-1.0/
-
-Package: libpercona-xtradb-client16
-Section: libs
-Architecture: any
-Depends: percona-xtradb-common (>= ${source:Version}), ${shlibs:Depends}
-Description: Percona SQL database client library
- Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database
- server. SQL (Structured Query Language) is the most popular database query
- language in the world. The main goals of Percona SQL are speed, robustness and
- ease of use.
- .
- This package includes the client library.
-
-Package: libpercona-xtradb-client15-dev
-Architecture: all
-Section: libdevel
-Depends: libpercona-xtradb-client-dev (>= ${source:Version})
-Description: Percona SQL database development files - empty transitional package
- This is an empty package that depends on libpercona-xtradb-client-dev to ease the
- transition for packages with versioned build-deps on libpercona-xtradb-client15-dev.
-
-Package: libpercona-xtradb-client-dev
-Architecture: any
-Section: libdevel
-Depends: libpercona-xtradb-client16 (>= ${source:Version}), zlib1g-dev, , ${shlibs:Depends}
-Conflicts: libmysqlclient14-dev, libmysqlclient12-dev, libmysqlclient10-dev, libmysqlclient15-dev, libmysqlclient16-dev
-Replaces: libmysqlclient14-dev, libmysqlclient12-dev, libmysqlclient10-dev, libmysqlclient15-dev, libmysqlclient16-dev
-Description: Percona SQL database development files
- Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database
- server. SQL (Structured Query Language) is the most popular database query
- language in the world. The main goals of Percona SQL are speed, robustness and
- ease of use.
- .
- This package includes development libraries and header files.
-
-Package: percona-xtradb-common
-Section: database
-Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Conflicts: mysql-common-4.1, mysql-common-5.0, mysql-common-5.1, mysql-common
-Provides: mysql-common
-Replaces: mysql-common-4.1, mysql-common-5.0, mysql-common-5.1, mysql-common
-Description: Percona SQL database common files (e.g. /etc/mysql/my.cnf)
- Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database
- server. SQL (Structured Query Language) is the most popular database query
- language in the world. The main goals of Percona SQL are speed, robustness and
- ease of use.
- .
- This package includes files needed by all versions of the client library
- (e.g. /etc/mysql/my.cnf).
-
-Package: percona-xtradb-client-5.1
-Architecture: any
-Depends: debianutils (>=1.6), libdbi-perl, percona-xtradb-common (>= ${source:Version}), libpercona-xtradb-client16 (>= ${source:Version}), ${perl:Depends}, ${shlibs:Depends}, ${misc:Depends}
-Provides: virtual-mysql-client, mysql-client, mysql-client-4.1, percona-xtradb-client, percona-xtradb-client-5.1
-Conflicts: mysql-client (<< ${source:Version}), mysql-client-5.0, mysql-client-5.1, percona-xtradb-client-5.0
-Replaces: mysql-client (<< ${source:Version}), mysql-client-5.0, mysql-client-5.1, percona-xtradb-client-5.0
-Description: Percona SQL database client binaries
- Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database
- server. SQL (Structured Query Language) is the most popular database query
- language in the world. The main goals of Percona SQL are speed, robustness and
- ease of use.
- .
- This package includes the client binaries and the additional tools
- innotop and mysqlreport.
-
-Package: percona-xtradb-server-5.1
-Architecture: any
-Suggests: tinyca
-Recommends: mailx, libhtml-template-perl
-Pre-Depends: percona-xtradb-common (>= ${source:Version}), adduser (>= 3.40), debconf
-Depends: percona-xtradb-client-5.1 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10)
-Conflicts: mysql-server (<< ${source:Version}), mysql-server-4.1, percona-xtradb-server-5.0
-Provides: mysql-server, virtual-mysql-server, mysql-server-5.0, percona-xtradb-server-5.1
-Replaces: mysql-server (<< ${source:Version}), mysql-server-5.0, percona-xtradb-server-5.0
-Description: Percona SQL database server binaries
- Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database
- server. SQL (Structured Query Language) is the most popular database query
- language in the world. The main goals of Percona SQL are speed, robustness and
- ease of use.
- .
- This package includes the server binaries.
-
-Package: percona-xtradb-server
-Section: database
-Architecture: all
-Depends: percona-xtradb-server-5.1
-Description: Percona SQL database server (metapackage depending on the latest version)
- This is an empty package that depends on the current "best" version of
- percona-xtradb-server (currently percona-xtradb-server-5.1), as determined by the Percona SQL
- maintainers. Install this package if in doubt about which Percona SQL
- version you need. That will install the version recommended by the
- package maintainers.
- .
- Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database
- server. SQL (Structured Query Language) is the most popular database query
- language in the world. The main goals of Percona SQL are speed, robustness and
- ease of use.
-
-Package: percona-xtradb-client
-Section: database
-Architecture: all
-Depends: percona-xtradb-client-5.1
-Description: Percona SQL database client (metapackage depending on the latest version)
- This is an empty package that depends on the current "best" version of
- percona-xtradb-client (currently percona-xtradb-client-5.1), as determined by the Percona SQL
- maintainers. Install this package if in doubt about which Percona SQL version
- you want, as this is the one we consider to be in the best shape.
diff --git a/storage/xtradb/build/debian/copyright b/storage/xtradb/build/debian/copyright
deleted file mode 100644
index 47fab54fc59..00000000000
--- a/storage/xtradb/build/debian/copyright
+++ /dev/null
@@ -1,169 +0,0 @@
-
-== MySQL ==
-
-The Debian package of MySQL was first debianzed on 1997-04-12 by Christian
-Schwarz <schwarz@debian.org> and ist maintained since 1999-04-20 by
-Christian Hammers <ch@debian.org>.
-
-It can be downloaded from http://www.mysql.com/
-
-Copyright:
-
-According to the file "COPYING" all parts of this package are licenced
-under the terms of the GNU GPL Version 2 of which a copy is available
-in /usr/share/common-licenses.
-
-To allow free software with other licences than the GPL to link against the
-shared library, special terms for "derived works" are defined in the file
-"EXCEPTIONS-CLIENT" which is quoted below.
-
-More information can be found on http://www.mysql.com/company/legal/licensing/
-
-The manual had to be removed as it is not free in the sense of the
-Debian Free Software Guidelines (DFSG).
-
-> Appendix I MySQL FLOSS License Exception
-> ****************************************
->
-> Version 0.3, 10 February 2005
->
-> The MySQL AB Exception for Free/Libre and Open Source Software-only
-> Applications Using MySQL Client Libraries (the "FLOSS Exception").
->
-> Exception Intent
-> ================
->
-> We want specified Free/Libre and Open Source Software ("FLOSS")
-> applications to be able to use specified GPL-licensed MySQL client
-> libraries (the "Program") despite the fact that not all FLOSS licenses
-> are compatible with version 2 of the GNU General Public License (the
-> "GPL").
->
-> Legal Terms and Conditions
-> ==========================
->
-> As a special exception to the terms and conditions of version 2.0 of the
-> GPL:
->
-> 1. You are free to distribute a Derivative Work that is formed
-> entirely from the Program and one or more works (each, a "FLOSS
-> Work") licensed under one or more of the licenses listed below in
-> section 1, as long as:
->
-> a. You obey the GPL in all respects for the Program and the
-> Derivative Work, except for identifiable sections of the
-> Derivative Work which are not derived from the Program, and
-> which can reasonably be considered independent and separate
-> works in themselves,
->
-> b. all identifiable sections of the Derivative Work which are not
-> derived from the Program, and which can reasonably be
-> considered independent and separate works in themselves,
->
-> i
-> are distributed subject to one of the FLOSS licenses
-> listed below, and
->
-> ii
-> the object code or executable form of those sections are
-> accompanied by the complete corresponding
-> machine-readable source code for those sections on the
-> same medium and under the same FLOSS license as the
-> corresponding object code or executable forms of those
-> sections, and
->
-> c. any works which are aggregated with the Program or with a
-> Derivative Work on a volume of a storage or distribution
-> medium in accordance with the GPL, can reasonably be
-> considered independent and separate works in themselves which
-> are not derivatives of either the Program, a Derivative Work
-> or a FLOSS Work.
->
-> If the above conditions are not met, then the Program may only be
-> copied, modified, distributed or used under the terms and
-> conditions of the GPL or another valid licensing option from MySQL
-> AB.
->
-> 2. FLOSS License List
->
-> *License name* *Version(s)/Copyright Date*
-> Academic Free License 2.0
-> Apache Software License 1.0/1.1/2.0
-> Apple Public Source License 2.0
-> Artistic license From Perl 5.8.0
-> BSD license "July 22 1999"
-> Common Public License 1.0
-> GNU Library or "Lesser" General Public 2.0/2.1
-> License (LGPL)
-> Jabber Open Source License 1.0
-> MIT license -
-> Mozilla Public License (MPL) 1.0/1.1
-> Open Software License 2.0
-> OpenSSL license (with original SSLeay "2003" ("1998")
-> license)
-> PHP License 3.0
-> Python license (CNRI Python License) -
-> Python Software Foundation License 2.1.1
-> Sleepycat License "1999"
-> W3C License "2001"
-> X11 License "2001"
-> Zlib/libpng License -
-> Zope Public License 2.0
->
-> Due to the many variants of some of the above licenses, we require
-> that any version follow the 2003 version of the Free Software
-> Foundation's Free Software Definition
-> (`http://www.gnu.org/philosophy/free-sw.html') or version 1.9 of
-> the Open Source Definition by the Open Source Initiative
-> (`http://www.opensource.org/docs/definition.php').
->
-> 3. Definitions
->
-> a. Terms used, but not defined, herein shall have the meaning
-> provided in the GPL.
->
-> b. Derivative Work means a derivative work under copyright law.
->
-> 4. Applicability This FLOSS Exception applies to all Programs that
-> contain a notice placed by MySQL AB saying that the Program may be
-> distributed under the terms of this FLOSS Exception. If you
-> create or distribute a work which is a Derivative Work of both the
-> Program and any other work licensed under the GPL, then this FLOSS
-> Exception is not available for that work; thus, you must remove
-> the FLOSS Exception notice from that work and comply with the GPL
-> in all respects, including by retaining all GPL notices. You may
-> choose to redistribute a copy of the Program exclusively under the
-> terms of the GPL by removing the FLOSS Exception notice from that
-> copy of the Program, provided that the copy has never been
-> modified by you or any third party.
-
-
-== innotop ==
-
-Author: Baron Schwartz <baron@xaprb.com>
-URL: http://innotop.sourceforge.net
-
-License:
-> This software is dual licensed, either GPL version 2 or Artistic License.
->
-> This package 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; either version 2 of the License, or
-> (at your option) any later version.
->
-> This package 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 package; if not, write to the Free Software
-> Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-On Debian systems, the complete text of the GNU General Public License and the
-Artistic License can be found in `/usr/share/common-licenses/'.
-
-The upstream author explained here: http://bugs.gentoo.org/show_bug.cgi?id=14760
-that these licenses also apply to the following files:
-- innotop.html
-- InnoDBParser.pm
diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.README.Maintainer b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.README.Maintainer
deleted file mode 100644
index f24cdcd519d..00000000000
--- a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.README.Maintainer
+++ /dev/null
@@ -1,4 +0,0 @@
-The examples directory includes files that might be needed by some
-developers:
-- header files not installed by default
-- the example file udf_example.c
diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.dirs b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.dirs
deleted file mode 100644
index f6ad2870431..00000000000
--- a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.dirs
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/include/
-usr/lib/
diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.docs b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.docs
deleted file mode 100644
index eccf2c9c565..00000000000
--- a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.docs
+++ /dev/null
@@ -1 +0,0 @@
-EXCEPTIONS-CLIENT
diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.examples b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.examples
deleted file mode 100644
index f1649c311c4..00000000000
--- a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.examples
+++ /dev/null
@@ -1 +0,0 @@
-sql/udf_example.c
diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.files b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.files
deleted file mode 100644
index 6803365b5ea..00000000000
--- a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.files
+++ /dev/null
@@ -1,7 +0,0 @@
-usr/bin/mysql_config
-usr/include/mysql/*.h
-usr/lib/libmysqlclient.a
-usr/lib/libmysqlclient.la
-usr/lib/mysql/*.a
-usr/lib/mysql/*.la
-usr/share/man/man1/mysql_config.1
diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.links b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.links
deleted file mode 100644
index 0481d1a0020..00000000000
--- a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.links
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/lib/libmysqlclient.so.16 usr/lib/libmysqlclient.so
-usr/lib/libmysqlclient_r.so.16 usr/lib/libmysqlclient_r.so
diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client16.dirs b/storage/xtradb/build/debian/libpercona-xtradb-client16.dirs
deleted file mode 100644
index 2964de6141b..00000000000
--- a/storage/xtradb/build/debian/libpercona-xtradb-client16.dirs
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/
diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client16.docs b/storage/xtradb/build/debian/libpercona-xtradb-client16.docs
deleted file mode 100644
index eccf2c9c565..00000000000
--- a/storage/xtradb/build/debian/libpercona-xtradb-client16.docs
+++ /dev/null
@@ -1 +0,0 @@
-EXCEPTIONS-CLIENT
diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client16.files b/storage/xtradb/build/debian/libpercona-xtradb-client16.files
deleted file mode 100644
index 5162b7b9639..00000000000
--- a/storage/xtradb/build/debian/libpercona-xtradb-client16.files
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/libmysqlclient*.so.*
diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client16.postinst b/storage/xtradb/build/debian/libpercona-xtradb-client16.postinst
deleted file mode 100644
index 29d3b86f978..00000000000
--- a/storage/xtradb/build/debian/libpercona-xtradb-client16.postinst
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash -e
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-# vim: ts=4
-
-
diff --git a/storage/xtradb/build/debian/patches/00list b/storage/xtradb/build/debian/patches/00list
deleted file mode 100644
index 5c50ab1ba53..00000000000
--- a/storage/xtradb/build/debian/patches/00list
+++ /dev/null
@@ -1,6 +0,0 @@
-33_scripts__mysql_create_system_tables__no_test.dpatch
-38_scripts__mysqld_safe.sh__signals.dpatch
-41_scripts__mysql_install_db.sh__no_test.dpatch
-44_scripts__mysql_config__libs.dpatch
-50_mysql-test__db_test.dpatch
-60_percona_support.dpatch
diff --git a/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Images_Makefile.in.dpatch b/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Images_Makefile.in.dpatch
deleted file mode 100644
index ca138afa746..00000000000
--- a/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Images_Makefile.in.dpatch
+++ /dev/null
@@ -1,776 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 01_MAKEFILES__Docs_Makefile.in.dpatch by <ch@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Creates Docs/Makefile.in
-
-@DPATCH@
-
---- old/Docs/Images/Makefile.in 2005-03-01 02:08:01.877429040 +0100
-+++ new/Docs/Images/Makefile.in 2005-02-28 21:21:24.000000000 +0100
-@@ -0,0 +1,765 @@
-+# Makefile.in generated by automake 1.7.9 from Makefile.am.
-+# @configure_input@
-+
-+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-+# Free Software Foundation, Inc.
-+# This Makefile.in is free software; the Free Software Foundation
-+# gives unlimited permission to copy and/or distribute it,
-+# with or without modifications, as long as this notice is preserved.
-+
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-+# PARTICULAR PURPOSE.
-+
-+@SET_MAKE@
-+
-+# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
-+#
-+# 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; either version 2 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+
-+# Process this file with automake to create Makefile.in
-+
-+srcdir = @srcdir@
-+top_srcdir = @top_srcdir@
-+VPATH = @srcdir@
-+pkgdatadir = $(datadir)/@PACKAGE@
-+pkglibdir = $(libdir)/@PACKAGE@
-+pkgincludedir = $(includedir)/@PACKAGE@
-+top_builddir = .
-+
-+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-+INSTALL = @INSTALL@
-+install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_PROGRAM = $(install_sh) -c
-+install_sh_SCRIPT = $(install_sh) -c
-+INSTALL_HEADER = $(INSTALL_DATA)
-+transform = $(program_transform_name)
-+NORMAL_INSTALL = :
-+PRE_INSTALL = :
-+POST_INSTALL = :
-+NORMAL_UNINSTALL = :
-+PRE_UNINSTALL = :
-+POST_UNINSTALL = :
-+build_triplet = @build@
-+host_triplet = @host@
-+target_triplet = @target@
-+ACLOCAL = @ACLOCAL@
-+ALLOCA = @ALLOCA@
-+AMDEP_FALSE = @AMDEP_FALSE@
-+AMDEP_TRUE = @AMDEP_TRUE@
-+AMTAR = @AMTAR@
-+AR = @AR@
-+AS = @AS@
-+ASSEMBLER_FALSE = @ASSEMBLER_FALSE@
-+ASSEMBLER_TRUE = @ASSEMBLER_TRUE@
-+ASSEMBLER_sparc32_FALSE = @ASSEMBLER_sparc32_FALSE@
-+ASSEMBLER_sparc32_TRUE = @ASSEMBLER_sparc32_TRUE@
-+ASSEMBLER_sparc64_FALSE = @ASSEMBLER_sparc64_FALSE@
-+ASSEMBLER_sparc64_TRUE = @ASSEMBLER_sparc64_TRUE@
-+ASSEMBLER_x86_FALSE = @ASSEMBLER_x86_FALSE@
-+ASSEMBLER_x86_TRUE = @ASSEMBLER_x86_TRUE@
-+AUTOCONF = @AUTOCONF@
-+AUTOHEADER = @AUTOHEADER@
-+AUTOMAKE = @AUTOMAKE@
-+AVAILABLE_LANGUAGES = @AVAILABLE_LANGUAGES@
-+AVAILABLE_LANGUAGES_ERRORS = @AVAILABLE_LANGUAGES_ERRORS@
-+AWK = @AWK@
-+CC = @CC@
-+CCAS = @CCAS@
-+CCASFLAGS = @CCASFLAGS@
-+CCDEPMODE = @CCDEPMODE@
-+CC_VERSION = @CC_VERSION@
-+CFLAGS = @CFLAGS@
-+CHARSETS_NEED_SOURCE = @CHARSETS_NEED_SOURCE@
-+CHARSET_OBJS = @CHARSET_OBJS@
-+CHARSET_SRCS = @CHARSET_SRCS@
-+CHECK_PID = @CHECK_PID@
-+CHMOD = @CHMOD@
-+CLIENT_EXTRA_LDFLAGS = @CLIENT_EXTRA_LDFLAGS@
-+CLIENT_LIBS = @CLIENT_LIBS@
-+CMP = @CMP@
-+COMPILATION_COMMENT = @COMPILATION_COMMENT@
-+COMPILE_PSTACK_FALSE = @COMPILE_PSTACK_FALSE@
-+COMPILE_PSTACK_TRUE = @COMPILE_PSTACK_TRUE@
-+CONF_COMMAND = @CONF_COMMAND@
-+CP = @CP@
-+CPP = @CPP@
-+CPPFLAGS = @CPPFLAGS@
-+CXX = @CXX@
-+CXXCPP = @CXXCPP@
-+CXXDEPMODE = @CXXDEPMODE@
-+CXXFLAGS = @CXXFLAGS@
-+CXXLDFLAGS = @CXXLDFLAGS@
-+CXX_VERSION = @CXX_VERSION@
-+CYGPATH_W = @CYGPATH_W@
-+DEFS = @DEFS@
-+DEPDIR = @DEPDIR@
-+DOT_FRM_VERSION = @DOT_FRM_VERSION@
-+DVIS = @DVIS@
-+ECHO = @ECHO@
-+ECHO_C = @ECHO_C@
-+ECHO_N = @ECHO_N@
-+ECHO_T = @ECHO_T@
-+EGREP = @EGREP@
-+EXEEXT = @EXEEXT@
-+F77 = @F77@
-+FFLAGS = @FFLAGS@
-+FIND_PROC = @FIND_PROC@
-+GETCONF = @GETCONF@
-+GXX = @GXX@
-+HAVE_NETWARE_FALSE = @HAVE_NETWARE_FALSE@
-+HAVE_NETWARE_TRUE = @HAVE_NETWARE_TRUE@
-+HOSTNAME = @HOSTNAME@
-+INSTALL_DATA = @INSTALL_DATA@
-+INSTALL_PROGRAM = @INSTALL_PROGRAM@
-+INSTALL_SCRIPT = @INSTALL_SCRIPT@
-+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-+IS_LINUX = @IS_LINUX@
-+KILL = @KILL@
-+LD = @LD@
-+LDFLAGS = @LDFLAGS@
-+LIBDL = @LIBDL@
-+LIBOBJS = @LIBOBJS@
-+LIBS = @LIBS@
-+LIBTOOL = @LIBTOOL@
-+LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
-+LM_CFLAGS = @LM_CFLAGS@
-+LN = @LN@
-+LN_CP_F = @LN_CP_F@
-+LN_S = @LN_S@
-+LOCAL_FALSE = @LOCAL_FALSE@
-+LOCAL_TRUE = @LOCAL_TRUE@
-+LTLIBOBJS = @LTLIBOBJS@
-+MACHINE_TYPE = @MACHINE_TYPE@
-+MAINT = @MAINT@
-+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
-+MAKEINFO = @MAKEINFO@
-+MAKE_BINARY_DISTRIBUTION_OPTIONS = @MAKE_BINARY_DISTRIBUTION_OPTIONS@
-+MAKE_SHELL = @MAKE_SHELL@
-+MT_INCLUDES = @MT_INCLUDES@
-+MT_LD_ADD = @MT_LD_ADD@
-+MV = @MV@
-+MYSQLD_DEFAULT_SWITCHES = @MYSQLD_DEFAULT_SWITCHES@
-+MYSQLD_EXTRA_LDFLAGS = @MYSQLD_EXTRA_LDFLAGS@
-+MYSQLD_USER = @MYSQLD_USER@
-+MYSQL_BASE_VERSION = @MYSQL_BASE_VERSION@
-+MYSQL_NO_DASH_VERSION = @MYSQL_NO_DASH_VERSION@
-+MYSQL_SERVER_SUFFIX = @MYSQL_SERVER_SUFFIX@
-+MYSQL_TCP_PORT = @MYSQL_TCP_PORT@
-+MYSQL_TCP_PORT_DEFAULT = @MYSQL_TCP_PORT_DEFAULT@
-+MYSQL_UNIX_ADDR = @MYSQL_UNIX_ADDR@
-+MYSQL_VERSION_ID = @MYSQL_VERSION_ID@
-+NOINST_LDFLAGS = @NOINST_LDFLAGS@
-+OBJEXT = @OBJEXT@
-+PACKAGE = @PACKAGE@
-+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-+PACKAGE_NAME = @PACKAGE_NAME@
-+PACKAGE_STRING = @PACKAGE_STRING@
-+PACKAGE_TARNAME = @PACKAGE_TARNAME@
-+PACKAGE_VERSION = @PACKAGE_VERSION@
-+PATH_SEPARATOR = @PATH_SEPARATOR@
-+PDFMANUAL = @PDFMANUAL@
-+PERL = @PERL@
-+PERL5 = @PERL5@
-+PROTOCOL_VERSION = @PROTOCOL_VERSION@
-+PS = @PS@
-+RANLIB = @RANLIB@
-+RM = @RM@
-+SAVE_ASFLAGS = @SAVE_ASFLAGS@
-+SAVE_CFLAGS = @SAVE_CFLAGS@
-+SAVE_CXXFLAGS = @SAVE_CXXFLAGS@
-+SAVE_CXXLDFLAGS = @SAVE_CXXLDFLAGS@
-+SAVE_LDFLAGS = @SAVE_LDFLAGS@
-+SED = @SED@
-+SET_MAKE = @SET_MAKE@
-+SHARED_LIB_VERSION = @SHARED_LIB_VERSION@
-+SHELL = @SHELL@
-+STRIP = @STRIP@
-+SYSTEM_TYPE = @SYSTEM_TYPE@
-+TAR = @TAR@
-+TERMCAP_LIB = @TERMCAP_LIB@
-+THREAD_LOBJECTS = @THREAD_LOBJECTS@
-+THREAD_LPROGRAMS = @THREAD_LPROGRAMS@
-+VERSION = @VERSION@
-+WRAPLIBS = @WRAPLIBS@
-+YACC = @YACC@
-+ac_ct_AR = @ac_ct_AR@
-+ac_ct_CC = @ac_ct_CC@
-+ac_ct_CXX = @ac_ct_CXX@
-+ac_ct_F77 = @ac_ct_F77@
-+ac_ct_GETCONF = @ac_ct_GETCONF@
-+ac_ct_RANLIB = @ac_ct_RANLIB@
-+ac_ct_STRIP = @ac_ct_STRIP@
-+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
-+am__include = @am__include@
-+am__leading_dot = @am__leading_dot@
-+am__quote = @am__quote@
-+bdb_includes = @bdb_includes@
-+bdb_libs = @bdb_libs@
-+bdb_libs_with_path = @bdb_libs_with_path@
-+bench_dirs = @bench_dirs@
-+bindir = @bindir@
-+build = @build@
-+build_alias = @build_alias@
-+build_cpu = @build_cpu@
-+build_os = @build_os@
-+build_vendor = @build_vendor@
-+datadir = @datadir@
-+default_charset = @default_charset@
-+docs_dirs = @docs_dirs@
-+exec_prefix = @exec_prefix@
-+host = @host@
-+host_alias = @host_alias@
-+host_cpu = @host_cpu@
-+host_os = @host_os@
-+host_vendor = @host_vendor@
-+includedir = @includedir@
-+infodir = @infodir@
-+innodb_includes = @innodb_includes@
-+innodb_libs = @innodb_libs@
-+innodb_system_libs = @innodb_system_libs@
-+install_sh = @install_sh@
-+isam_libs = @isam_libs@
-+libdir = @libdir@
-+libexecdir = @libexecdir@
-+libmysqld_dirs = @libmysqld_dirs@
-+linked_client_targets = @linked_client_targets@
-+linked_netware_sources = @linked_netware_sources@
-+localstatedir = @localstatedir@
-+man_dirs = @man_dirs@
-+mandir = @mandir@
-+netware_dir = @netware_dir@
-+oldincludedir = @oldincludedir@
-+openssl_includes = @openssl_includes@
-+openssl_libs = @openssl_libs@
-+orbit_idl = @orbit_idl@
-+orbit_includes = @orbit_includes@
-+orbit_libs = @orbit_libs@
-+prefix = @prefix@
-+program_transform_name = @program_transform_name@
-+pstack_dirs = @pstack_dirs@
-+pstack_libs = @pstack_libs@
-+readline_dir = @readline_dir@
-+readline_link = @readline_link@
-+sbindir = @sbindir@
-+server_scripts = @server_scripts@
-+sharedstatedir = @sharedstatedir@
-+sql_client_dirs = @sql_client_dirs@
-+sql_server_dirs = @sql_server_dirs@
-+sysconfdir = @sysconfdir@
-+target = @target@
-+target_alias = @target_alias@
-+target_cpu = @target_cpu@
-+target_os = @target_os@
-+target_vendor = @target_vendor@
-+thread_dirs = @thread_dirs@
-+tools_dirs = @tools_dirs@
-+uname_prog = @uname_prog@
-+vio_dir = @vio_dir@
-+vio_libs = @vio_libs@
-+
-+AUTOMAKE_OPTIONS = foreign
-+
-+# These are built from source in the Docs directory
-+EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT
-+SUBDIRS = . include @docs_dirs@ @readline_dir@ \
-+ @thread_dirs@ pstack @sql_client_dirs@ \
-+ @sql_server_dirs@ scripts @man_dirs@ tests \
-+ BUILD netware os2 @libmysqld_dirs@ \
-+ @bench_dirs@ support-files @tools_dirs@
-+
-+
-+# Relink after clean
-+linked_sources = linked_client_sources linked_server_sources \
-+ linked_libmysql_sources linked_libmysql_r_sources \
-+ linked_libmysqld_sources linked_libmysqldex_sources \
-+ linked_include_sources @linked_netware_sources@
-+
-+
-+CLEANFILES = $(linked_sources)
-+subdir = .
-+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-+CONFIG_HEADER = config.h
-+CONFIG_CLEAN_FILES = bdb/Makefile
-+DIST_SOURCES =
-+
-+RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
-+ ps-recursive install-info-recursive uninstall-info-recursive \
-+ all-recursive install-data-recursive install-exec-recursive \
-+ installdirs-recursive install-recursive uninstall-recursive \
-+ check-recursive installcheck-recursive
-+DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure COPYING \
-+ ChangeLog Makefile.am acconfig.h acinclude.m4 aclocal.m4 \
-+ config.guess config.h.in config.sub configure configure.in \
-+ depcomp install-sh ltconfig ltmain.sh missing mkinstalldirs
-+DIST_SUBDIRS = $(SUBDIRS)
-+all: config.h
-+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
-+
-+.SUFFIXES:
-+
-+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
-+ configure.lineno
-+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
-+ cd $(top_srcdir) && \
-+ $(AUTOMAKE) --foreign Makefile
-+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
-+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
-+
-+$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-+ $(SHELL) ./config.status --recheck
-+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
-+ cd $(srcdir) && $(AUTOCONF)
-+
-+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
-+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-+
-+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
-+ @rm -f stamp-h1
-+ cd $(top_builddir) && $(SHELL) ./config.status config.h
-+
-+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h
-+ cd $(top_srcdir) && $(AUTOHEADER)
-+ touch $(srcdir)/config.h.in
-+
-+distclean-hdr:
-+ -rm -f config.h stamp-h1
-+bdb/Makefile: $(top_builddir)/config.status $(top_srcdir)/bdb/Makefile.in
-+ cd $(top_builddir) && $(SHELL) ./config.status $@
-+
-+mostlyclean-libtool:
-+ -rm -f *.lo
-+
-+clean-libtool:
-+ -rm -rf .libs _libs
-+
-+distclean-libtool:
-+ -rm -f libtool
-+uninstall-info-am:
-+
-+# This directory's subdirectories are mostly independent; you can cd
-+# into them and run `make' without going through this Makefile.
-+# To change the values of `make' variables: instead of editing Makefiles,
-+# (1) if the variable is set in `config.status', edit `config.status'
-+# (which will cause the Makefiles to be regenerated when you run `make');
-+# (2) otherwise, pass the desired values on the `make' command line.
-+$(RECURSIVE_TARGETS):
-+ @set fnord $$MAKEFLAGS; amf=$$2; \
-+ dot_seen=no; \
-+ target=`echo $@ | sed s/-recursive//`; \
-+ list='$(SUBDIRS)'; for subdir in $$list; do \
-+ echo "Making $$target in $$subdir"; \
-+ if test "$$subdir" = "."; then \
-+ dot_seen=yes; \
-+ local_target="$$target-am"; \
-+ else \
-+ local_target="$$target"; \
-+ fi; \
-+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
-+ done; \
-+ if test "$$dot_seen" = "no"; then \
-+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-+ fi; test -z "$$fail"
-+
-+mostlyclean-recursive clean-recursive distclean-recursive \
-+maintainer-clean-recursive:
-+ @set fnord $$MAKEFLAGS; amf=$$2; \
-+ dot_seen=no; \
-+ case "$@" in \
-+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-+ *) list='$(SUBDIRS)' ;; \
-+ esac; \
-+ rev=''; for subdir in $$list; do \
-+ if test "$$subdir" = "."; then :; else \
-+ rev="$$subdir $$rev"; \
-+ fi; \
-+ done; \
-+ rev="$$rev ."; \
-+ target=`echo $@ | sed s/-recursive//`; \
-+ for subdir in $$rev; do \
-+ echo "Making $$target in $$subdir"; \
-+ if test "$$subdir" = "."; then \
-+ local_target="$$target-am"; \
-+ else \
-+ local_target="$$target"; \
-+ fi; \
-+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
-+ done && test -z "$$fail"
-+tags-recursive:
-+ list='$(SUBDIRS)'; for subdir in $$list; do \
-+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-+ done
-+ctags-recursive:
-+ list='$(SUBDIRS)'; for subdir in $$list; do \
-+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-+ done
-+
-+ETAGS = etags
-+ETAGSFLAGS =
-+
-+CTAGS = ctags
-+CTAGSFLAGS =
-+
-+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-+ unique=`for i in $$list; do \
-+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-+ done | \
-+ $(AWK) ' { files[$$0] = 1; } \
-+ END { for (i in files) print i; }'`; \
-+ mkid -fID $$unique
-+
-+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-+ $(TAGS_FILES) $(LISP)
-+ tags=; \
-+ here=`pwd`; \
-+ if (etags --etags-include --version) >/dev/null 2>&1; then \
-+ include_option=--etags-include; \
-+ else \
-+ include_option=--include; \
-+ fi; \
-+ list='$(SUBDIRS)'; for subdir in $$list; do \
-+ if test "$$subdir" = .; then :; else \
-+ test -f $$subdir/TAGS && \
-+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
-+ fi; \
-+ done; \
-+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-+ unique=`for i in $$list; do \
-+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-+ done | \
-+ $(AWK) ' { files[$$0] = 1; } \
-+ END { for (i in files) print i; }'`; \
-+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
-+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-+ $$tags $$unique
-+
-+ctags: CTAGS
-+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-+ $(TAGS_FILES) $(LISP)
-+ tags=; \
-+ here=`pwd`; \
-+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-+ unique=`for i in $$list; do \
-+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-+ done | \
-+ $(AWK) ' { files[$$0] = 1; } \
-+ END { for (i in files) print i; }'`; \
-+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
-+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-+ $$tags $$unique
-+
-+GTAGS:
-+ here=`$(am__cd) $(top_builddir) && pwd` \
-+ && cd $(top_srcdir) \
-+ && gtags -i $(GTAGS_ARGS) $$here
-+
-+distclean-tags:
-+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-+
-+top_distdir = .
-+distdir = $(PACKAGE)-$(VERSION)
-+
-+am__remove_distdir = \
-+ { test ! -d $(distdir) \
-+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
-+ && rm -fr $(distdir); }; }
-+
-+GZIP_ENV = --best
-+distuninstallcheck_listfiles = find . -type f -print
-+distcleancheck_listfiles = find . -type f -print
-+
-+distdir: $(DISTFILES)
-+ $(am__remove_distdir)
-+ mkdir $(distdir)
-+ $(mkinstalldirs) $(distdir)/bdb $(distdir)/include
-+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-+ list='$(DISTFILES)'; for file in $$list; do \
-+ case $$file in \
-+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-+ esac; \
-+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-+ dir="/$$dir"; \
-+ $(mkinstalldirs) "$(distdir)$$dir"; \
-+ else \
-+ dir=''; \
-+ fi; \
-+ if test -d $$d/$$file; then \
-+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
-+ fi; \
-+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
-+ else \
-+ test -f $(distdir)/$$file \
-+ || cp -p $$d/$$file $(distdir)/$$file \
-+ || exit 1; \
-+ fi; \
-+ done
-+ list='$(SUBDIRS)'; for subdir in $$list; do \
-+ if test "$$subdir" = .; then :; else \
-+ test -d $(distdir)/$$subdir \
-+ || mkdir $(distdir)/$$subdir \
-+ || exit 1; \
-+ (cd $$subdir && \
-+ $(MAKE) $(AM_MAKEFLAGS) \
-+ top_distdir="$(top_distdir)" \
-+ distdir=../$(distdir)/$$subdir \
-+ distdir) \
-+ || exit 1; \
-+ fi; \
-+ done
-+ $(MAKE) $(AM_MAKEFLAGS) \
-+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
-+ dist-hook
-+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
-+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
-+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
-+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
-+ || chmod -R a+r $(distdir)
-+dist-gzip: distdir
-+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-+ $(am__remove_distdir)
-+
-+dist dist-all: distdir
-+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-+ $(am__remove_distdir)
-+
-+# This target untars the dist file and tries a VPATH configuration. Then
-+# it guarantees that the distribution is self-contained by making another
-+# tarfile.
-+distcheck: dist
-+ $(am__remove_distdir)
-+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
-+ chmod -R a-w $(distdir); chmod a+w $(distdir)
-+ mkdir $(distdir)/_build
-+ mkdir $(distdir)/_inst
-+ chmod a-w $(distdir)
-+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
-+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
-+ && cd $(distdir)/_build \
-+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
-+ $(DISTCHECK_CONFIGURE_FLAGS) \
-+ && $(MAKE) $(AM_MAKEFLAGS) \
-+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
-+ && $(MAKE) $(AM_MAKEFLAGS) check \
-+ && $(MAKE) $(AM_MAKEFLAGS) install \
-+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
-+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
-+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
-+ distuninstallcheck \
-+ && chmod -R a-w "$$dc_install_base" \
-+ && ({ \
-+ (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
-+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
-+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
-+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
-+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
-+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
-+ && rm -rf "$$dc_destdir" \
-+ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
-+ && rm -f $(distdir).tar.gz \
-+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
-+ $(am__remove_distdir)
-+ @echo "$(distdir).tar.gz is ready for distribution" | \
-+ sed 'h;s/./=/g;p;x;p;x'
-+distuninstallcheck:
-+ @cd $(distuninstallcheck_dir) \
-+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
-+ || { echo "ERROR: files left after uninstall:" ; \
-+ if test -n "$(DESTDIR)"; then \
-+ echo " (check DESTDIR support)"; \
-+ fi ; \
-+ $(distuninstallcheck_listfiles) ; \
-+ exit 1; } >&2
-+distcleancheck: distclean
-+ @if test '$(srcdir)' = . ; then \
-+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
-+ exit 1 ; \
-+ fi
-+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
-+ || { echo "ERROR: files left in build directory after distclean:" ; \
-+ $(distcleancheck_listfiles) ; \
-+ exit 1; } >&2
-+check-am: all-am
-+check: check-recursive
-+all-am: Makefile config.h
-+installdirs: installdirs-recursive
-+installdirs-am:
-+
-+install: install-recursive
-+install-exec: install-exec-recursive
-+install-data: install-data-recursive
-+uninstall: uninstall-recursive
-+
-+install-am: all-am
-+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-+
-+installcheck: installcheck-recursive
-+install-strip:
-+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-+ `test -z '$(STRIP)' || \
-+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-+mostlyclean-generic:
-+
-+clean-generic:
-+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-+
-+distclean-generic:
-+ -rm -f $(CONFIG_CLEAN_FILES)
-+
-+maintainer-clean-generic:
-+ @echo "This command is intended for maintainers to use"
-+ @echo "it deletes files that may require special tools to rebuild."
-+clean: clean-recursive
-+
-+clean-am: clean-generic clean-libtool mostlyclean-am
-+
-+distclean: distclean-recursive
-+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-+ -rm -f Makefile
-+distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \
-+ distclean-tags
-+
-+dvi: dvi-recursive
-+
-+dvi-am:
-+
-+info: info-recursive
-+
-+info-am:
-+
-+install-data-am:
-+
-+install-exec-am:
-+
-+install-info: install-info-recursive
-+
-+install-man:
-+
-+installcheck-am:
-+
-+maintainer-clean: maintainer-clean-recursive
-+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-+ -rm -rf $(top_srcdir)/autom4te.cache
-+ -rm -f Makefile
-+maintainer-clean-am: distclean-am maintainer-clean-generic
-+
-+mostlyclean: mostlyclean-recursive
-+
-+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-+
-+pdf: pdf-recursive
-+
-+pdf-am:
-+
-+ps: ps-recursive
-+
-+ps-am:
-+
-+uninstall-am: uninstall-info-am
-+
-+uninstall-info: uninstall-info-recursive
-+
-+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
-+ clean-generic clean-libtool clean-recursive ctags \
-+ ctags-recursive dist dist-all dist-gzip distcheck distclean \
-+ distclean-generic distclean-hdr distclean-libtool \
-+ distclean-recursive distclean-tags distcleancheck distdir \
-+ distuninstallcheck dvi dvi-am dvi-recursive info info-am \
-+ info-recursive install install-am install-data install-data-am \
-+ install-data-recursive install-exec install-exec-am \
-+ install-exec-recursive install-info install-info-am \
-+ install-info-recursive install-man install-recursive \
-+ install-strip installcheck installcheck-am installdirs \
-+ installdirs-am installdirs-recursive maintainer-clean \
-+ maintainer-clean-generic maintainer-clean-recursive mostlyclean \
-+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
-+ pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \
-+ tags-recursive uninstall uninstall-am uninstall-info-am \
-+ uninstall-info-recursive uninstall-recursive
-+
-+
-+# This is just so that the linking is done early.
-+config.h: $(linked_sources)
-+
-+linked_include_sources:
-+ cd include; $(MAKE) link_sources
-+ echo timestamp > linked_include_sources
-+
-+linked_client_sources: @linked_client_targets@
-+ cd client; $(MAKE) link_sources
-+ echo timestamp > linked_client_sources
-+
-+linked_libmysql_sources:
-+ cd libmysql; $(MAKE) link_sources
-+ echo timestamp > linked_libmysql_sources
-+
-+linked_libmysql_r_sources: linked_libmysql_sources
-+ cd libmysql_r; $(MAKE) link_sources
-+ echo timestamp > linked_libmysql_r_sources
-+
-+linked_libmysqld_sources:
-+ cd libmysqld; $(MAKE) link_sources
-+ echo timestamp > linked_libmysqld_sources
-+
-+linked_libmysqldex_sources:
-+ cd libmysqld/examples; $(MAKE) link_sources
-+ echo timestamp > linked_libmysqldex_sources
-+
-+linked_netware_sources:
-+ cd @netware_dir@; $(MAKE) link_sources
-+ echo timestamp > linked_netware_sources
-+
-+#avoid recursive make calls in sql directory
-+linked_server_sources:
-+ cd sql; rm -f mini_client_errors.c;@LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c
-+ echo timestamp > linked_server_sources
-+
-+# Create permission databases
-+init-db: all
-+ $(top_builddir)/scripts/mysql_install_db
-+
-+bin-dist: all
-+ $(top_builddir)/scripts/make_binary_distribution @MAKE_BINARY_DISTRIBUTION_OPTIONS@
-+
-+# Remove BK's "SCCS" subdirectories from source distribution
-+dist-hook:
-+ rm -rf `find $(distdir) -type d -name SCCS`
-+
-+tags:
-+ support-files/build-tags
-+.PHONY: init-db bin-dist
-+
-+# Test installation
-+
-+test:
-+ cd mysql-test ; ./mysql-test-run
-+# Tell versions [3.59,3.63) of GNU make to not export all variables.
-+# Otherwise a system limit (for SysV at least) may be exceeded.
-+.NOEXPORT:
diff --git a/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Makefile.in.dpatch b/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Makefile.in.dpatch
deleted file mode 100644
index 6440697bc02..00000000000
--- a/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Makefile.in.dpatch
+++ /dev/null
@@ -1,776 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 01_MAKEFILES__Docs_Makefile.in.dpatch by <ch@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Creates Docs/Makefile.in
-
-@DPATCH@
-
---- old/Docs/Makefile.in 2005-03-01 02:08:01.877429040 +0100
-+++ new/Docs/Makefile.in 2005-02-28 21:21:24.000000000 +0100
-@@ -0,0 +1,765 @@
-+# Makefile.in generated by automake 1.7.9 from Makefile.am.
-+# @configure_input@
-+
-+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-+# Free Software Foundation, Inc.
-+# This Makefile.in is free software; the Free Software Foundation
-+# gives unlimited permission to copy and/or distribute it,
-+# with or without modifications, as long as this notice is preserved.
-+
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-+# PARTICULAR PURPOSE.
-+
-+@SET_MAKE@
-+
-+# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
-+#
-+# 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; either version 2 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+
-+# Process this file with automake to create Makefile.in
-+
-+srcdir = @srcdir@
-+top_srcdir = @top_srcdir@
-+VPATH = @srcdir@
-+pkgdatadir = $(datadir)/@PACKAGE@
-+pkglibdir = $(libdir)/@PACKAGE@
-+pkgincludedir = $(includedir)/@PACKAGE@
-+top_builddir = .
-+
-+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-+INSTALL = @INSTALL@
-+install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_PROGRAM = $(install_sh) -c
-+install_sh_SCRIPT = $(install_sh) -c
-+INSTALL_HEADER = $(INSTALL_DATA)
-+transform = $(program_transform_name)
-+NORMAL_INSTALL = :
-+PRE_INSTALL = :
-+POST_INSTALL = :
-+NORMAL_UNINSTALL = :
-+PRE_UNINSTALL = :
-+POST_UNINSTALL = :
-+build_triplet = @build@
-+host_triplet = @host@
-+target_triplet = @target@
-+ACLOCAL = @ACLOCAL@
-+ALLOCA = @ALLOCA@
-+AMDEP_FALSE = @AMDEP_FALSE@
-+AMDEP_TRUE = @AMDEP_TRUE@
-+AMTAR = @AMTAR@
-+AR = @AR@
-+AS = @AS@
-+ASSEMBLER_FALSE = @ASSEMBLER_FALSE@
-+ASSEMBLER_TRUE = @ASSEMBLER_TRUE@
-+ASSEMBLER_sparc32_FALSE = @ASSEMBLER_sparc32_FALSE@
-+ASSEMBLER_sparc32_TRUE = @ASSEMBLER_sparc32_TRUE@
-+ASSEMBLER_sparc64_FALSE = @ASSEMBLER_sparc64_FALSE@
-+ASSEMBLER_sparc64_TRUE = @ASSEMBLER_sparc64_TRUE@
-+ASSEMBLER_x86_FALSE = @ASSEMBLER_x86_FALSE@
-+ASSEMBLER_x86_TRUE = @ASSEMBLER_x86_TRUE@
-+AUTOCONF = @AUTOCONF@
-+AUTOHEADER = @AUTOHEADER@
-+AUTOMAKE = @AUTOMAKE@
-+AVAILABLE_LANGUAGES = @AVAILABLE_LANGUAGES@
-+AVAILABLE_LANGUAGES_ERRORS = @AVAILABLE_LANGUAGES_ERRORS@
-+AWK = @AWK@
-+CC = @CC@
-+CCAS = @CCAS@
-+CCASFLAGS = @CCASFLAGS@
-+CCDEPMODE = @CCDEPMODE@
-+CC_VERSION = @CC_VERSION@
-+CFLAGS = @CFLAGS@
-+CHARSETS_NEED_SOURCE = @CHARSETS_NEED_SOURCE@
-+CHARSET_OBJS = @CHARSET_OBJS@
-+CHARSET_SRCS = @CHARSET_SRCS@
-+CHECK_PID = @CHECK_PID@
-+CHMOD = @CHMOD@
-+CLIENT_EXTRA_LDFLAGS = @CLIENT_EXTRA_LDFLAGS@
-+CLIENT_LIBS = @CLIENT_LIBS@
-+CMP = @CMP@
-+COMPILATION_COMMENT = @COMPILATION_COMMENT@
-+COMPILE_PSTACK_FALSE = @COMPILE_PSTACK_FALSE@
-+COMPILE_PSTACK_TRUE = @COMPILE_PSTACK_TRUE@
-+CONF_COMMAND = @CONF_COMMAND@
-+CP = @CP@
-+CPP = @CPP@
-+CPPFLAGS = @CPPFLAGS@
-+CXX = @CXX@
-+CXXCPP = @CXXCPP@
-+CXXDEPMODE = @CXXDEPMODE@
-+CXXFLAGS = @CXXFLAGS@
-+CXXLDFLAGS = @CXXLDFLAGS@
-+CXX_VERSION = @CXX_VERSION@
-+CYGPATH_W = @CYGPATH_W@
-+DEFS = @DEFS@
-+DEPDIR = @DEPDIR@
-+DOT_FRM_VERSION = @DOT_FRM_VERSION@
-+DVIS = @DVIS@
-+ECHO = @ECHO@
-+ECHO_C = @ECHO_C@
-+ECHO_N = @ECHO_N@
-+ECHO_T = @ECHO_T@
-+EGREP = @EGREP@
-+EXEEXT = @EXEEXT@
-+F77 = @F77@
-+FFLAGS = @FFLAGS@
-+FIND_PROC = @FIND_PROC@
-+GETCONF = @GETCONF@
-+GXX = @GXX@
-+HAVE_NETWARE_FALSE = @HAVE_NETWARE_FALSE@
-+HAVE_NETWARE_TRUE = @HAVE_NETWARE_TRUE@
-+HOSTNAME = @HOSTNAME@
-+INSTALL_DATA = @INSTALL_DATA@
-+INSTALL_PROGRAM = @INSTALL_PROGRAM@
-+INSTALL_SCRIPT = @INSTALL_SCRIPT@
-+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-+IS_LINUX = @IS_LINUX@
-+KILL = @KILL@
-+LD = @LD@
-+LDFLAGS = @LDFLAGS@
-+LIBDL = @LIBDL@
-+LIBOBJS = @LIBOBJS@
-+LIBS = @LIBS@
-+LIBTOOL = @LIBTOOL@
-+LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
-+LM_CFLAGS = @LM_CFLAGS@
-+LN = @LN@
-+LN_CP_F = @LN_CP_F@
-+LN_S = @LN_S@
-+LOCAL_FALSE = @LOCAL_FALSE@
-+LOCAL_TRUE = @LOCAL_TRUE@
-+LTLIBOBJS = @LTLIBOBJS@
-+MACHINE_TYPE = @MACHINE_TYPE@
-+MAINT = @MAINT@
-+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
-+MAKEINFO = @MAKEINFO@
-+MAKE_BINARY_DISTRIBUTION_OPTIONS = @MAKE_BINARY_DISTRIBUTION_OPTIONS@
-+MAKE_SHELL = @MAKE_SHELL@
-+MT_INCLUDES = @MT_INCLUDES@
-+MT_LD_ADD = @MT_LD_ADD@
-+MV = @MV@
-+MYSQLD_DEFAULT_SWITCHES = @MYSQLD_DEFAULT_SWITCHES@
-+MYSQLD_EXTRA_LDFLAGS = @MYSQLD_EXTRA_LDFLAGS@
-+MYSQLD_USER = @MYSQLD_USER@
-+MYSQL_BASE_VERSION = @MYSQL_BASE_VERSION@
-+MYSQL_NO_DASH_VERSION = @MYSQL_NO_DASH_VERSION@
-+MYSQL_SERVER_SUFFIX = @MYSQL_SERVER_SUFFIX@
-+MYSQL_TCP_PORT = @MYSQL_TCP_PORT@
-+MYSQL_TCP_PORT_DEFAULT = @MYSQL_TCP_PORT_DEFAULT@
-+MYSQL_UNIX_ADDR = @MYSQL_UNIX_ADDR@
-+MYSQL_VERSION_ID = @MYSQL_VERSION_ID@
-+NOINST_LDFLAGS = @NOINST_LDFLAGS@
-+OBJEXT = @OBJEXT@
-+PACKAGE = @PACKAGE@
-+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-+PACKAGE_NAME = @PACKAGE_NAME@
-+PACKAGE_STRING = @PACKAGE_STRING@
-+PACKAGE_TARNAME = @PACKAGE_TARNAME@
-+PACKAGE_VERSION = @PACKAGE_VERSION@
-+PATH_SEPARATOR = @PATH_SEPARATOR@
-+PDFMANUAL = @PDFMANUAL@
-+PERL = @PERL@
-+PERL5 = @PERL5@
-+PROTOCOL_VERSION = @PROTOCOL_VERSION@
-+PS = @PS@
-+RANLIB = @RANLIB@
-+RM = @RM@
-+SAVE_ASFLAGS = @SAVE_ASFLAGS@
-+SAVE_CFLAGS = @SAVE_CFLAGS@
-+SAVE_CXXFLAGS = @SAVE_CXXFLAGS@
-+SAVE_CXXLDFLAGS = @SAVE_CXXLDFLAGS@
-+SAVE_LDFLAGS = @SAVE_LDFLAGS@
-+SED = @SED@
-+SET_MAKE = @SET_MAKE@
-+SHARED_LIB_VERSION = @SHARED_LIB_VERSION@
-+SHELL = @SHELL@
-+STRIP = @STRIP@
-+SYSTEM_TYPE = @SYSTEM_TYPE@
-+TAR = @TAR@
-+TERMCAP_LIB = @TERMCAP_LIB@
-+THREAD_LOBJECTS = @THREAD_LOBJECTS@
-+THREAD_LPROGRAMS = @THREAD_LPROGRAMS@
-+VERSION = @VERSION@
-+WRAPLIBS = @WRAPLIBS@
-+YACC = @YACC@
-+ac_ct_AR = @ac_ct_AR@
-+ac_ct_CC = @ac_ct_CC@
-+ac_ct_CXX = @ac_ct_CXX@
-+ac_ct_F77 = @ac_ct_F77@
-+ac_ct_GETCONF = @ac_ct_GETCONF@
-+ac_ct_RANLIB = @ac_ct_RANLIB@
-+ac_ct_STRIP = @ac_ct_STRIP@
-+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
-+am__include = @am__include@
-+am__leading_dot = @am__leading_dot@
-+am__quote = @am__quote@
-+bdb_includes = @bdb_includes@
-+bdb_libs = @bdb_libs@
-+bdb_libs_with_path = @bdb_libs_with_path@
-+bench_dirs = @bench_dirs@
-+bindir = @bindir@
-+build = @build@
-+build_alias = @build_alias@
-+build_cpu = @build_cpu@
-+build_os = @build_os@
-+build_vendor = @build_vendor@
-+datadir = @datadir@
-+default_charset = @default_charset@
-+docs_dirs = @docs_dirs@
-+exec_prefix = @exec_prefix@
-+host = @host@
-+host_alias = @host_alias@
-+host_cpu = @host_cpu@
-+host_os = @host_os@
-+host_vendor = @host_vendor@
-+includedir = @includedir@
-+infodir = @infodir@
-+innodb_includes = @innodb_includes@
-+innodb_libs = @innodb_libs@
-+innodb_system_libs = @innodb_system_libs@
-+install_sh = @install_sh@
-+isam_libs = @isam_libs@
-+libdir = @libdir@
-+libexecdir = @libexecdir@
-+libmysqld_dirs = @libmysqld_dirs@
-+linked_client_targets = @linked_client_targets@
-+linked_netware_sources = @linked_netware_sources@
-+localstatedir = @localstatedir@
-+man_dirs = @man_dirs@
-+mandir = @mandir@
-+netware_dir = @netware_dir@
-+oldincludedir = @oldincludedir@
-+openssl_includes = @openssl_includes@
-+openssl_libs = @openssl_libs@
-+orbit_idl = @orbit_idl@
-+orbit_includes = @orbit_includes@
-+orbit_libs = @orbit_libs@
-+prefix = @prefix@
-+program_transform_name = @program_transform_name@
-+pstack_dirs = @pstack_dirs@
-+pstack_libs = @pstack_libs@
-+readline_dir = @readline_dir@
-+readline_link = @readline_link@
-+sbindir = @sbindir@
-+server_scripts = @server_scripts@
-+sharedstatedir = @sharedstatedir@
-+sql_client_dirs = @sql_client_dirs@
-+sql_server_dirs = @sql_server_dirs@
-+sysconfdir = @sysconfdir@
-+target = @target@
-+target_alias = @target_alias@
-+target_cpu = @target_cpu@
-+target_os = @target_os@
-+target_vendor = @target_vendor@
-+thread_dirs = @thread_dirs@
-+tools_dirs = @tools_dirs@
-+uname_prog = @uname_prog@
-+vio_dir = @vio_dir@
-+vio_libs = @vio_libs@
-+
-+AUTOMAKE_OPTIONS = foreign
-+
-+# These are built from source in the Docs directory
-+EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT
-+SUBDIRS = . include @docs_dirs@ @readline_dir@ \
-+ @thread_dirs@ pstack @sql_client_dirs@ \
-+ @sql_server_dirs@ scripts @man_dirs@ tests \
-+ BUILD netware os2 @libmysqld_dirs@ \
-+ @bench_dirs@ support-files @tools_dirs@
-+
-+
-+# Relink after clean
-+linked_sources = linked_client_sources linked_server_sources \
-+ linked_libmysql_sources linked_libmysql_r_sources \
-+ linked_libmysqld_sources linked_libmysqldex_sources \
-+ linked_include_sources @linked_netware_sources@
-+
-+
-+CLEANFILES = $(linked_sources)
-+subdir = .
-+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-+CONFIG_HEADER = config.h
-+CONFIG_CLEAN_FILES = bdb/Makefile
-+DIST_SOURCES =
-+
-+RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
-+ ps-recursive install-info-recursive uninstall-info-recursive \
-+ all-recursive install-data-recursive install-exec-recursive \
-+ installdirs-recursive install-recursive uninstall-recursive \
-+ check-recursive installcheck-recursive
-+DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure COPYING \
-+ ChangeLog Makefile.am acconfig.h acinclude.m4 aclocal.m4 \
-+ config.guess config.h.in config.sub configure configure.in \
-+ depcomp install-sh ltconfig ltmain.sh missing mkinstalldirs
-+DIST_SUBDIRS = $(SUBDIRS)
-+all: config.h
-+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
-+
-+.SUFFIXES:
-+
-+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
-+ configure.lineno
-+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
-+ cd $(top_srcdir) && \
-+ $(AUTOMAKE) --foreign Makefile
-+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
-+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
-+
-+$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-+ $(SHELL) ./config.status --recheck
-+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
-+ cd $(srcdir) && $(AUTOCONF)
-+
-+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
-+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-+
-+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
-+ @rm -f stamp-h1
-+ cd $(top_builddir) && $(SHELL) ./config.status config.h
-+
-+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h
-+ cd $(top_srcdir) && $(AUTOHEADER)
-+ touch $(srcdir)/config.h.in
-+
-+distclean-hdr:
-+ -rm -f config.h stamp-h1
-+bdb/Makefile: $(top_builddir)/config.status $(top_srcdir)/bdb/Makefile.in
-+ cd $(top_builddir) && $(SHELL) ./config.status $@
-+
-+mostlyclean-libtool:
-+ -rm -f *.lo
-+
-+clean-libtool:
-+ -rm -rf .libs _libs
-+
-+distclean-libtool:
-+ -rm -f libtool
-+uninstall-info-am:
-+
-+# This directory's subdirectories are mostly independent; you can cd
-+# into them and run `make' without going through this Makefile.
-+# To change the values of `make' variables: instead of editing Makefiles,
-+# (1) if the variable is set in `config.status', edit `config.status'
-+# (which will cause the Makefiles to be regenerated when you run `make');
-+# (2) otherwise, pass the desired values on the `make' command line.
-+$(RECURSIVE_TARGETS):
-+ @set fnord $$MAKEFLAGS; amf=$$2; \
-+ dot_seen=no; \
-+ target=`echo $@ | sed s/-recursive//`; \
-+ list='$(SUBDIRS)'; for subdir in $$list; do \
-+ echo "Making $$target in $$subdir"; \
-+ if test "$$subdir" = "."; then \
-+ dot_seen=yes; \
-+ local_target="$$target-am"; \
-+ else \
-+ local_target="$$target"; \
-+ fi; \
-+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
-+ done; \
-+ if test "$$dot_seen" = "no"; then \
-+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-+ fi; test -z "$$fail"
-+
-+mostlyclean-recursive clean-recursive distclean-recursive \
-+maintainer-clean-recursive:
-+ @set fnord $$MAKEFLAGS; amf=$$2; \
-+ dot_seen=no; \
-+ case "$@" in \
-+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-+ *) list='$(SUBDIRS)' ;; \
-+ esac; \
-+ rev=''; for subdir in $$list; do \
-+ if test "$$subdir" = "."; then :; else \
-+ rev="$$subdir $$rev"; \
-+ fi; \
-+ done; \
-+ rev="$$rev ."; \
-+ target=`echo $@ | sed s/-recursive//`; \
-+ for subdir in $$rev; do \
-+ echo "Making $$target in $$subdir"; \
-+ if test "$$subdir" = "."; then \
-+ local_target="$$target-am"; \
-+ else \
-+ local_target="$$target"; \
-+ fi; \
-+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
-+ done && test -z "$$fail"
-+tags-recursive:
-+ list='$(SUBDIRS)'; for subdir in $$list; do \
-+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-+ done
-+ctags-recursive:
-+ list='$(SUBDIRS)'; for subdir in $$list; do \
-+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-+ done
-+
-+ETAGS = etags
-+ETAGSFLAGS =
-+
-+CTAGS = ctags
-+CTAGSFLAGS =
-+
-+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-+ unique=`for i in $$list; do \
-+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-+ done | \
-+ $(AWK) ' { files[$$0] = 1; } \
-+ END { for (i in files) print i; }'`; \
-+ mkid -fID $$unique
-+
-+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-+ $(TAGS_FILES) $(LISP)
-+ tags=; \
-+ here=`pwd`; \
-+ if (etags --etags-include --version) >/dev/null 2>&1; then \
-+ include_option=--etags-include; \
-+ else \
-+ include_option=--include; \
-+ fi; \
-+ list='$(SUBDIRS)'; for subdir in $$list; do \
-+ if test "$$subdir" = .; then :; else \
-+ test -f $$subdir/TAGS && \
-+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
-+ fi; \
-+ done; \
-+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-+ unique=`for i in $$list; do \
-+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-+ done | \
-+ $(AWK) ' { files[$$0] = 1; } \
-+ END { for (i in files) print i; }'`; \
-+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
-+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-+ $$tags $$unique
-+
-+ctags: CTAGS
-+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-+ $(TAGS_FILES) $(LISP)
-+ tags=; \
-+ here=`pwd`; \
-+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-+ unique=`for i in $$list; do \
-+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-+ done | \
-+ $(AWK) ' { files[$$0] = 1; } \
-+ END { for (i in files) print i; }'`; \
-+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
-+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-+ $$tags $$unique
-+
-+GTAGS:
-+ here=`$(am__cd) $(top_builddir) && pwd` \
-+ && cd $(top_srcdir) \
-+ && gtags -i $(GTAGS_ARGS) $$here
-+
-+distclean-tags:
-+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-+
-+top_distdir = .
-+distdir = $(PACKAGE)-$(VERSION)
-+
-+am__remove_distdir = \
-+ { test ! -d $(distdir) \
-+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
-+ && rm -fr $(distdir); }; }
-+
-+GZIP_ENV = --best
-+distuninstallcheck_listfiles = find . -type f -print
-+distcleancheck_listfiles = find . -type f -print
-+
-+distdir: $(DISTFILES)
-+ $(am__remove_distdir)
-+ mkdir $(distdir)
-+ $(mkinstalldirs) $(distdir)/bdb $(distdir)/include
-+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-+ list='$(DISTFILES)'; for file in $$list; do \
-+ case $$file in \
-+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-+ esac; \
-+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-+ dir="/$$dir"; \
-+ $(mkinstalldirs) "$(distdir)$$dir"; \
-+ else \
-+ dir=''; \
-+ fi; \
-+ if test -d $$d/$$file; then \
-+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
-+ fi; \
-+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
-+ else \
-+ test -f $(distdir)/$$file \
-+ || cp -p $$d/$$file $(distdir)/$$file \
-+ || exit 1; \
-+ fi; \
-+ done
-+ list='$(SUBDIRS)'; for subdir in $$list; do \
-+ if test "$$subdir" = .; then :; else \
-+ test -d $(distdir)/$$subdir \
-+ || mkdir $(distdir)/$$subdir \
-+ || exit 1; \
-+ (cd $$subdir && \
-+ $(MAKE) $(AM_MAKEFLAGS) \
-+ top_distdir="$(top_distdir)" \
-+ distdir=../$(distdir)/$$subdir \
-+ distdir) \
-+ || exit 1; \
-+ fi; \
-+ done
-+ $(MAKE) $(AM_MAKEFLAGS) \
-+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
-+ dist-hook
-+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
-+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
-+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
-+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
-+ || chmod -R a+r $(distdir)
-+dist-gzip: distdir
-+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-+ $(am__remove_distdir)
-+
-+dist dist-all: distdir
-+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-+ $(am__remove_distdir)
-+
-+# This target untars the dist file and tries a VPATH configuration. Then
-+# it guarantees that the distribution is self-contained by making another
-+# tarfile.
-+distcheck: dist
-+ $(am__remove_distdir)
-+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
-+ chmod -R a-w $(distdir); chmod a+w $(distdir)
-+ mkdir $(distdir)/_build
-+ mkdir $(distdir)/_inst
-+ chmod a-w $(distdir)
-+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
-+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
-+ && cd $(distdir)/_build \
-+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
-+ $(DISTCHECK_CONFIGURE_FLAGS) \
-+ && $(MAKE) $(AM_MAKEFLAGS) \
-+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
-+ && $(MAKE) $(AM_MAKEFLAGS) check \
-+ && $(MAKE) $(AM_MAKEFLAGS) install \
-+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
-+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
-+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
-+ distuninstallcheck \
-+ && chmod -R a-w "$$dc_install_base" \
-+ && ({ \
-+ (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
-+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
-+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
-+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
-+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
-+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
-+ && rm -rf "$$dc_destdir" \
-+ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
-+ && rm -f $(distdir).tar.gz \
-+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
-+ $(am__remove_distdir)
-+ @echo "$(distdir).tar.gz is ready for distribution" | \
-+ sed 'h;s/./=/g;p;x;p;x'
-+distuninstallcheck:
-+ @cd $(distuninstallcheck_dir) \
-+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
-+ || { echo "ERROR: files left after uninstall:" ; \
-+ if test -n "$(DESTDIR)"; then \
-+ echo " (check DESTDIR support)"; \
-+ fi ; \
-+ $(distuninstallcheck_listfiles) ; \
-+ exit 1; } >&2
-+distcleancheck: distclean
-+ @if test '$(srcdir)' = . ; then \
-+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
-+ exit 1 ; \
-+ fi
-+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
-+ || { echo "ERROR: files left in build directory after distclean:" ; \
-+ $(distcleancheck_listfiles) ; \
-+ exit 1; } >&2
-+check-am: all-am
-+check: check-recursive
-+all-am: Makefile config.h
-+installdirs: installdirs-recursive
-+installdirs-am:
-+
-+install: install-recursive
-+install-exec: install-exec-recursive
-+install-data: install-data-recursive
-+uninstall: uninstall-recursive
-+
-+install-am: all-am
-+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-+
-+installcheck: installcheck-recursive
-+install-strip:
-+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-+ `test -z '$(STRIP)' || \
-+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-+mostlyclean-generic:
-+
-+clean-generic:
-+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-+
-+distclean-generic:
-+ -rm -f $(CONFIG_CLEAN_FILES)
-+
-+maintainer-clean-generic:
-+ @echo "This command is intended for maintainers to use"
-+ @echo "it deletes files that may require special tools to rebuild."
-+clean: clean-recursive
-+
-+clean-am: clean-generic clean-libtool mostlyclean-am
-+
-+distclean: distclean-recursive
-+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-+ -rm -f Makefile
-+distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \
-+ distclean-tags
-+
-+dvi: dvi-recursive
-+
-+dvi-am:
-+
-+info: info-recursive
-+
-+info-am:
-+
-+install-data-am:
-+
-+install-exec-am:
-+
-+install-info: install-info-recursive
-+
-+install-man:
-+
-+installcheck-am:
-+
-+maintainer-clean: maintainer-clean-recursive
-+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-+ -rm -rf $(top_srcdir)/autom4te.cache
-+ -rm -f Makefile
-+maintainer-clean-am: distclean-am maintainer-clean-generic
-+
-+mostlyclean: mostlyclean-recursive
-+
-+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-+
-+pdf: pdf-recursive
-+
-+pdf-am:
-+
-+ps: ps-recursive
-+
-+ps-am:
-+
-+uninstall-am: uninstall-info-am
-+
-+uninstall-info: uninstall-info-recursive
-+
-+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
-+ clean-generic clean-libtool clean-recursive ctags \
-+ ctags-recursive dist dist-all dist-gzip distcheck distclean \
-+ distclean-generic distclean-hdr distclean-libtool \
-+ distclean-recursive distclean-tags distcleancheck distdir \
-+ distuninstallcheck dvi dvi-am dvi-recursive info info-am \
-+ info-recursive install install-am install-data install-data-am \
-+ install-data-recursive install-exec install-exec-am \
-+ install-exec-recursive install-info install-info-am \
-+ install-info-recursive install-man install-recursive \
-+ install-strip installcheck installcheck-am installdirs \
-+ installdirs-am installdirs-recursive maintainer-clean \
-+ maintainer-clean-generic maintainer-clean-recursive mostlyclean \
-+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
-+ pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \
-+ tags-recursive uninstall uninstall-am uninstall-info-am \
-+ uninstall-info-recursive uninstall-recursive
-+
-+
-+# This is just so that the linking is done early.
-+config.h: $(linked_sources)
-+
-+linked_include_sources:
-+ cd include; $(MAKE) link_sources
-+ echo timestamp > linked_include_sources
-+
-+linked_client_sources: @linked_client_targets@
-+ cd client; $(MAKE) link_sources
-+ echo timestamp > linked_client_sources
-+
-+linked_libmysql_sources:
-+ cd libmysql; $(MAKE) link_sources
-+ echo timestamp > linked_libmysql_sources
-+
-+linked_libmysql_r_sources: linked_libmysql_sources
-+ cd libmysql_r; $(MAKE) link_sources
-+ echo timestamp > linked_libmysql_r_sources
-+
-+linked_libmysqld_sources:
-+ cd libmysqld; $(MAKE) link_sources
-+ echo timestamp > linked_libmysqld_sources
-+
-+linked_libmysqldex_sources:
-+ cd libmysqld/examples; $(MAKE) link_sources
-+ echo timestamp > linked_libmysqldex_sources
-+
-+linked_netware_sources:
-+ cd @netware_dir@; $(MAKE) link_sources
-+ echo timestamp > linked_netware_sources
-+
-+#avoid recursive make calls in sql directory
-+linked_server_sources:
-+ cd sql; rm -f mini_client_errors.c;@LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c
-+ echo timestamp > linked_server_sources
-+
-+# Create permission databases
-+init-db: all
-+ $(top_builddir)/scripts/mysql_install_db
-+
-+bin-dist: all
-+ $(top_builddir)/scripts/make_binary_distribution @MAKE_BINARY_DISTRIBUTION_OPTIONS@
-+
-+# Remove BK's "SCCS" subdirectories from source distribution
-+dist-hook:
-+ rm -rf `find $(distdir) -type d -name SCCS`
-+
-+tags:
-+ support-files/build-tags
-+.PHONY: init-db bin-dist
-+
-+# Test installation
-+
-+test:
-+ cd mysql-test ; ./mysql-test-run
-+# Tell versions [3.59,3.63) of GNU make to not export all variables.
-+# Otherwise a system limit (for SysV at least) may be exceeded.
-+.NOEXPORT:
diff --git a/storage/xtradb/build/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch b/storage/xtradb/build/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch
deleted file mode 100644
index 0fd166d1fc7..00000000000
--- a/storage/xtradb/build/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch
+++ /dev/null
@@ -1,29 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 33_scripts__mysql_create_system_tables__no_test.dpatch by <ch@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: scripts__mysql_create_system_tables__no_test
-## DP: A user with no password prevents a normal user from login under certain
-## DP: circumstances as it is checked first. See #301741.
-## DP: http://bugs.mysql.com/bug.php?id=6901
-
-@DPATCH@
---- old/scripts/mysql_system_tables_data.sql 2008-12-04 22:59:44.000000000 +0100
-+++ new/scripts/mysql_system_tables_data.sql 2008-12-04 23:00:07.000000000 +0100
-@@ -11,8 +11,6 @@
- -- Fill "db" table with default grants for anyone to
- -- access database 'test' and 'test_%' if "db" table didn't exist
- CREATE TEMPORARY TABLE tmp_db LIKE db;
--INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
--INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
- INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
- DROP TABLE tmp_db;
-
-@@ -24,7 +22,5 @@
- INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
- REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @current_hostname) != 'localhost';
- REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
--INSERT INTO tmp_user (host,user) VALUES ('localhost','');
--INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost';
- INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
- DROP TABLE tmp_user;
diff --git a/storage/xtradb/build/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch b/storage/xtradb/build/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch
deleted file mode 100644
index 154bc0ad1c4..00000000000
--- a/storage/xtradb/build/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch
+++ /dev/null
@@ -1,43 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 38_scripts__mysqld_safe.sh__signals.dpatch by <ch@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Executes /etc/init.d/mysql on signals
-## DP: Reported as http://bugs.mysql.com/bug.php?id=31361
-
-@DPATCH@
-
---- old/scripts/mysqld_safe.sh 2006-07-29 13:12:34.000000000 +0200
-+++ old/scripts/mysqld_safe.sh 2006-07-29 13:14:08.000000000 +0200
-@@ -16,8 +16,6 @@
- # This command can be used as pipe to syslog. With "-s" it also logs to stderr.
- ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i"
-
--trap '' 1 2 3 15 # we shouldn't let anyone kill us
--
- umask 007
-
- defaults=
-@@ -122,7 +122,7 @@
- # sed buffers output (only GNU sed supports a -u (unbuffered) option)
- # which means that messages may not get sent to syslog until the
- # mysqld process quits.
-- cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error"
-+ cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error & wait"
- ;;
- *)
- echo "Internal program error (non-fatal):" \
-@@ -352,6 +350,13 @@
- fi
-
- #
-+# From now on, we catch signals to do a proper shutdown of mysqld
-+# when signalled to do so.
-+#
-+trap '/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf refresh' 1 # HUP
-+trap '/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf shutdown' 2 3 15 # INT QUIT and TERM
-+
-+#
- # Uncomment the following lines if you want all tables to be automatically
- # checked and repaired during startup. You should add sensible key_buffer
- # and sort_buffer values to my.cnf to improve check performance or require
diff --git a/storage/xtradb/build/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch b/storage/xtradb/build/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch
deleted file mode 100644
index e79ac71cc7b..00000000000
--- a/storage/xtradb/build/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch
+++ /dev/null
@@ -1,20 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 41_scripts__mysql_install_db.sh__no_test.dpatch by <ch@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: scripts__mysql_install_db.sh__no_test
-## DP: http://bugs.mysql.com/bug.php?id=6901
-
-@DPATCH@
-
---- mysql-dfsg-5.1-5.1.23rc.orig/scripts/mysql_install_db.sh 2008-01-29 22:41:20.000000000 +0100
-+++ mysql-dfsg-5.1-5.1.23rc/scripts/mysql_install_db.sh 2008-02-28 10:08:11.000000000 +0100
-@@ -306,7 +306,7 @@
- fi
-
- # Create database directories
--for dir in $ldata $ldata/mysql $ldata/test
-+for dir in $ldata $ldata/mysql
- do
- if test ! -d $dir
- then
diff --git a/storage/xtradb/build/debian/patches/44_scripts__mysql_config__libs.dpatch b/storage/xtradb/build/debian/patches/44_scripts__mysql_config__libs.dpatch
deleted file mode 100644
index b35ba4912f3..00000000000
--- a/storage/xtradb/build/debian/patches/44_scripts__mysql_config__libs.dpatch
+++ /dev/null
@@ -1,24 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 99-unnamed.dpatch by <ch@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Removes unnecessary library dependencies. See #390692
-
-@DPATCH@
-diff -Nur mysql-dfsg-5.1-5.1.31.orig/scripts/mysql_config.sh mysql-dfsg-5.1-5.1.31/scripts/mysql_config.sh
---- mysql-dfsg-5.1-5.1.31.orig/scripts/mysql_config.sh 2009-01-19 17:30:55.000000000 +0100
-+++ mysql-dfsg-5.1-5.1.31/scripts/mysql_config.sh 2009-02-08 17:17:48.000000000 +0100
-@@ -104,10 +104,10 @@
-
- # Create options
- # We intentionally add a space to the beginning and end of lib strings, simplifies replace later
--libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
-+libs=" $ldflags -L$pkglibdir -lmysqlclient"
- libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
--libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
--embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ "
-+libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @openssl_libs@ "
-+embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ "
-
- if [ -r "$pkglibdir/libmygcc.a" ]; then
- # When linking against the static library with a different version of GCC
diff --git a/storage/xtradb/build/debian/patches/50_mysql-test__db_test.dpatch b/storage/xtradb/build/debian/patches/50_mysql-test__db_test.dpatch
deleted file mode 100644
index 6a5cab91c39..00000000000
--- a/storage/xtradb/build/debian/patches/50_mysql-test__db_test.dpatch
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 50_mysql-test__db_test.dpatch by Christian Hammers <ch@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Patch 33_scripts__mysql_create_system_tables__no_test removes the
-## DP: rights for anybody to connect to the test database but the test
-## DP: suite depends on them.
-
-@DPATCH@
-
---- old/mysql-test/mysql-test-run.pl 2009-06-16 14:24:09.000000000 +0200
-+++ new/mysql-test/mysql-test-run.pl 2009-07-04 00:03:34.000000000 +0200
-@@ -2717,6 +2717,10 @@
- mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql",
- $bootstrap_sql_file);
-
-+ mtr_tofile($bootstrap_sql_file, "-- Debian removed the default privileges on the 'test' database\n");
-+ mtr_tofile($bootstrap_sql_file, "INSERT INTO mysql.db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');\n");
-+
-+
- # Add test data for timezone - this is just a subset, on a real
- # system these tables will be populated either by mysql_tzinfo_to_sql
- # or by downloading the timezone table package from our website
diff --git a/storage/xtradb/build/debian/patches/60_percona_support.dpatch b/storage/xtradb/build/debian/patches/60_percona_support.dpatch
deleted file mode 100644
index e69d0dd5f76..00000000000
--- a/storage/xtradb/build/debian/patches/60_percona_support.dpatch
+++ /dev/null
@@ -1,16 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-
-@DPATCH@
-
---- a/scripts/mysql_install_db.sh 2009-08-08 09:20:07.000000000 +0000
-+++ b/scripts/mysql_install_db.sh 2009-08-08 09:29:23.000000000 +0000
-@@ -469,6 +469,9 @@
- echo
- echo "Please report any problems with the $scriptdir/mysqlbug script!"
- echo
-+ echo "For commercial support please contact Percona at http://www.percona.com/contacts.html"
-+ echo
-+
- fi
-
- exit 0
diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.README.Debian b/storage/xtradb/build/debian/percona-xtradb-client-5.1.README.Debian
deleted file mode 100644
index b245638f9c9..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-client-5.1.README.Debian
+++ /dev/null
@@ -1,4 +0,0 @@
-FAQ:
-
-Q: My <tab> completition is gone, why?
-A: You have "no-auto-rehash" in the "[mysql]" section of /etc/mysql/my.cnf!
diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.dirs b/storage/xtradb/build/debian/percona-xtradb-client-5.1.dirs
deleted file mode 100644
index ceda5922c5d..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-client-5.1.dirs
+++ /dev/null
@@ -1,3 +0,0 @@
-usr/bin/
-usr/share/man/man1/
-usr/share/perl5/
diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.docs b/storage/xtradb/build/debian/percona-xtradb-client-5.1.docs
deleted file mode 100644
index 8b8692f0d90..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-client-5.1.docs
+++ /dev/null
@@ -1,3 +0,0 @@
-debian/additions/innotop/changelog.innotop
-EXCEPTIONS-CLIENT
-README
diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.files b/storage/xtradb/build/debian/percona-xtradb-client-5.1.files
deleted file mode 100644
index 9ba5fe35054..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-client-5.1.files
+++ /dev/null
@@ -1,39 +0,0 @@
-usr/bin/innotop
-usr/bin/myisam_ftdump
-usr/bin/mysql
-usr/bin/mysqlaccess
-usr/bin/mysqladmin
-usr/bin/mysqlbug
-usr/bin/mysqlcheck
-usr/bin/mysql_client_test
-usr/bin/mysqldump
-usr/bin/mysqldumpslow
-usr/bin/mysql_find_rows
-usr/bin/mysql_fix_extensions
-usr/bin/mysqlimport
-usr/bin/mysqlreport
-usr/bin/mysqlshow
-usr/bin/mysql_waitpid
-usr/sbin/mysqlmanager
-usr/share/lintian/overrides/percona-xtradb-client-5.1
-usr/share/man/man1/innotop.1
-usr/share/man/man1/myisam_ftdump.1
-usr/share/man/man1/mysql.1
-usr/share/man/man1/mysqlaccess.1
-usr/share/man/man1/mysqladmin.1
-usr/share/man/man1/mysqlbug.1
-usr/share/man/man1/mysqlcheck.1
-usr/share/man/man1/mysqldump.1
-usr/share/man/man1/mysqldumpslow.1
-usr/share/man/man1/mysql_find_rows.1
-usr/share/man/man1/mysql_fix_extensions.1
-usr/share/man/man1/mysqlimport.1
-usr/share/man/man1/mysqlmanager.1
-usr/share/man/man1/mysqlmanagerc.1
-usr/share/man/man1/mysqlmanager-pwgen.1
-usr/share/man/man1/mysqlreport.1
-usr/share/man/man1/mysqlshow.1
-usr/share/man/man1/mysql_tableinfo.1
-usr/share/man/man1/mysql_waitpid.1
-usr/share/man/man1/mysql_client_test.1
-usr/share/perl5/InnoDBParser.pm
diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.links b/storage/xtradb/build/debian/percona-xtradb-client-5.1.links
deleted file mode 100644
index 247369fa218..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-client-5.1.links
+++ /dev/null
@@ -1,3 +0,0 @@
-usr/bin/mysqlcheck usr/bin/mysqlrepair
-usr/bin/mysqlcheck usr/bin/mysqlanalyze
-usr/bin/mysqlcheck usr/bin/mysqloptimize
diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.lintian-overrides b/storage/xtradb/build/debian/percona-xtradb-client-5.1.lintian-overrides
deleted file mode 100644
index d36909f47f2..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-client-5.1.lintian-overrides
+++ /dev/null
@@ -1,3 +0,0 @@
-percona-xtradb-client-5.1: package-has-a-duplicate-relation
-percona-xtradb-client-5.1: wrong-name-for-upstream-changelog usr/share/doc/percona-xtradb-client-5.1/changelog.innotop.gz
-percona-xtradb-client-5.1: pkg-not-in-package-test innotop
diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.menu b/storage/xtradb/build/debian/percona-xtradb-client-5.1.menu
deleted file mode 100644
index 1378555c423..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-client-5.1.menu
+++ /dev/null
@@ -1,3 +0,0 @@
-# According to /usr/share/menu/ policy 1.4, not /usr/share/doc/debian-policy/
-?package(innotop):needs="text" section="Applications/Data Management"\
- title="innotop" command="/usr/bin/innotop"
diff --git a/storage/xtradb/build/debian/percona-xtradb-common.dirs b/storage/xtradb/build/debian/percona-xtradb-common.dirs
deleted file mode 100644
index a5a88ede9c1..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-common.dirs
+++ /dev/null
@@ -1 +0,0 @@
-etc/mysql/conf.d/
diff --git a/storage/xtradb/build/debian/percona-xtradb-common.files b/storage/xtradb/build/debian/percona-xtradb-common.files
deleted file mode 100644
index 931f37a0237..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-common.files
+++ /dev/null
@@ -1,2 +0,0 @@
-etc/mysql/my.cnf
-usr/share/percona-xtradb-common/internal-use-only
diff --git a/storage/xtradb/build/debian/percona-xtradb-common.lintian-overrides b/storage/xtradb/build/debian/percona-xtradb-common.lintian-overrides
deleted file mode 100644
index 7f58feb498d..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-common.lintian-overrides
+++ /dev/null
@@ -1,2 +0,0 @@
-script-not-executable ./usr/share/percona-xtradb-common/internal-use-only/_etc_init.d_mysql
-script-not-executable ./usr/share/percona-xtradb-common/internal-use-only/_etc_mysql_debian-start
diff --git a/storage/xtradb/build/debian/percona-xtradb-common.postrm b/storage/xtradb/build/debian/percona-xtradb-common.postrm
deleted file mode 100644
index 3ca45870165..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-common.postrm
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-if [ "$1" = "purge" ]; then
- rmdir /etc/mysql 2>/dev/null || true
-fi
-
-#DEBHELPER#
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.NEWS b/storage/xtradb/build/debian/percona-xtradb-server-5.1.NEWS
deleted file mode 100644
index a3042dc2918..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.NEWS
+++ /dev/null
@@ -1,34 +0,0 @@
-mysql-dfsg-5.1 (5.1.38-1) unstable; urgency=low
-
- * Please read http://dev.mysql.com/doc/refman/5.1/en/upgrading-from-5-0.html
- * Make sure to do a REPAIR TABLE on all tables that use UTF-8 and have a
- FULLTEXT index.
-
- -- Christian Hammers <ch@debian.org> Sat, 4 Jul 2009 02:31:21 +0200
-
-mysql-dfsg-5.0 (5.1.14beta-2) unstable; urgency=low
-
- * The BerkeleyDB Storage Engine is no longer supported. If the options
- have-bdb or skip-bdb are found, MySQL will not start. If you have BDB
- tables, you should change them to use another storage engine before
- upgrading to 5.1.
-
- -- Monty Taylor <mordred@inaugust.com> Thu, 18 Jan 2007 12:28:21 -0800
-
-mysql-dfsg-5.0 (5.0.45-2) unstable; urgency=low
-
- * Binary logging is now disabled by default. If you really need it (e.g. on
- a replication master), remove the comment from the log_bin line in my.cnf.
-
- -- Norbert Tretkowski <nobse@debian.org> Sat, 10 Nov 2007 16:26:35 +0100
-
-mysql-dfsg-5.0 (5.0.18-9) unstable; urgency=low
-
- * Rotation of the binary logs is now configured in /etc/mysql/my.cnf with
- "expire-logs-days" which defaults to 20 days. The old file
- /etc/mysql/debian-log-rotate.conf should be removed together with
- /etc/cron.daily/mysql-server after this value has been adjusted. Note that
- the old variable defined the number of files whereas the new one defines
- a time span in days.
-
- -- Christian Hammers <ch@debian.org> Tue, 24 Jan 2006 22:18:21 +0100
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.README.Debian b/storage/xtradb/build/debian/percona-xtradb-server-5.1.README.Debian
deleted file mode 100644
index 741243f1ec3..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.README.Debian
+++ /dev/null
@@ -1,109 +0,0 @@
-* MYSQL WON'T START OR STOP?:
-=============================
-You may never ever delete the special mysql user "debian-sys-maint". This
-user together with the credentials in /etc/mysql/debian.cnf are used by the
-init scripts to stop the server as they would require knowledge of the mysql
-root users password else.
-So in most of the times you can fix the situation by making sure that the
-debian.cnf file contains the right password, e.g. by setting a new one
-(remember to do a "flush privileges" then).
-
-* WHAT TO DO AFTER UPGRADES:
-============================
-The privilege tables are automatically updated so all there is left is read
-the changelogs on dev.mysql.com to see if any changes affect custom apps.
-
-* WHAT TO DO AFTER INSTALLATION:
-================================
-The MySQL manual describes certain steps to do at this stage in a separate
-chapter. They are not necessary as the Debian packages does them
-automatically.
-
-The only thing that is left over for the admin is
- - setting the passwords
- - creating new users and databases
- - read the rest of this text
-
-* DOWNGRADING TO 4.0 or 4.1:
-============================
-Unsupported. Period.
-But if you do and get problems or make interesting experiences, mail me, it
-might help others.
-Ok, if you really want, I would recommend to "mysqldump --opt" all tables,
-then purge 4.1, delete /var/lib/mysql, install 4.0 and insert the dumps. Be
-carefully, though, with the "mysql" table, you might not simply overwrite that
-one as the password for the mysql "debian-sys-maint" user is stored in
-/etc/mysql/debian.cnf and needed by /etc/init.d/ to start mysql and check if
-it's alive.
-
-* SOME APPLICATION CAN NO LONGER CONNECT:
-=========================================
-This application is probably linked against libmysqlclient12 or below and
-somebody has created a mysql user with new-style passwords.
-The old_passwords=1 option in /etc/mysql/my.cnf might help. If not the
-application that inserted the user has to be changed or the application that
-tries to connect updated to libmysqlclient14 or -15.
-
-* NETWORKING:
-=============
-For security reasons, the Debian package has enabled networking only on the
-loop-back device using "bind-address" in /etc/mysql/my.cnf. Check with
-"netstat -tlnp" where it is listening. If your connection is aborted
-immediately see if "mysqld: all" or similar is in /etc/hosts.allow and read
-hosts_access(5).
-
-* WHERE IS THE DOCUMENTATION?:
-==============================
-Unfortunately due to licensing restrictions, debian currently not able
-to provide the mysql-doc package in any format. For the most up to date
-documentation, please go to http://dev.mysql.com/doc.
-
-* PASSWORDS:
-============
-It is strongly recommended to set a password for the mysql root user (which
- /usr/bin/mysql -u root -D mysql -e "update user set password=password('new-password') where user='root'"
- /usr/bin/mysql -u root -e "flush privileges"
-If you already had a password set add "-p" before "-u" to the lines above.
-
-
-If you are tired to type the password in every time or want to automate your
-scripts you can store it in the file $HOME/.my.cnf. It should be chmod 0600
-(-rw------- username username .my.cnf) to ensure that nobody else can read
-it. Every other configuration parameter can be stored there, too. You will
-find an example below and more information in the MySQL manual in
-/usr/share/doc/mysql-doc or www.mysql.com.
-
-ATTENTION: It is necessary, that a .my.cnf from root always contains a "user"
-line wherever there is a "password" line, else, the Debian maintenance
-scripts, that use /etc/mysql/debian.cnf, will use the username
-"debian-sys-maint" but the password that is in root's .my.cnf. Also note,
-that every change you make in the /root/.my.cnf will affect the mysql cron
-script, too.
-
- # an example of $HOME/.my.cnf
- [client]
- user = your-mysql-username
- password = enter-your-good-new-password-here
-
-* BIG_ROWS FOR EVEN MORE ROWS IN A TABLE:
-=========================================
-If you ever run out of rows in a table there is the possibility of building
-the package with "-DBIG_ROWS" which, according to a MySQL employee on
-packagers@lists.mysql.com should lead to a 64bit row index (I guess > 2^32
-rows) but also to an approx. 5% performance loss.
-
-* BerkeleyDB Storage Engine
-===========================
-Support for BerkeleyDB has been removed in 5.1, and consequently both the
-have-bdb and skip-bdb configuration options will cause the server to fail.
-Removing the options from /etc/mysql/my.cnf will fix this problem.
-
-* FURTHER NOTES ON REPLICATION
-===============================
-If the MySQL server is acting as a replication slave, you should not
-set --tmpdir to point to a directory on a memory-based filesystem or to
-a directory that is cleared when the server host restarts. A replication
-slave needs some of its temporary files to survive a machine restart so
-that it can replicate temporary tables or LOAD DATA INFILE operations. If
-files in the temporary file directory are lost when the server restarts,
-replication fails.
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.config b/storage/xtradb/build/debian/percona-xtradb-server-5.1.config
deleted file mode 100644
index 75f81c4e4d1..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.config
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash -e
-
-. /usr/share/debconf/confmodule
-
-if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
-${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
-
-CNF=/etc/mysql/my.cnf
-
-# Beware that there are two ypwhich one of them needs the 2>/dev/null!
-if test -n "`which ypwhich 2>/dev/null`" && ypwhich >/dev/null 2>&1; then
- db_input high percona-xtradb-server-5.1/nis_warning || true
- db_go
-fi
-
-# only ask this question on fresh installs, during "reconfiguration" and when
-# not upgrading from an existing 5.0 installation.
-# there is also an additional check for empty root passwords in the
-# postinst script when the tools are available for us to use.
-if [ "$1" = "configure" ] && ([ -z "$2" ] && [ ! -e "/var/lib/mysql/debian-5.0.flag" ] ) || [ "$1" = "reconfigure" ]; then
- while :; do
- RET=""
- db_input high percona-xtradb-server/root_password || true
- db_go
- db_get percona-xtradb-server/root_password
- # if password isn't empty we ask for password verification
- if [ -z "$RET" ]; then
- db_fset percona-xtradb-server/root_password seen false
- db_fset percona-xtradb-server/root_password_again seen false
- break
- fi
- ROOT_PW="$RET"
- db_input high percona-xtradb-server/root_password_again || true
- db_go
- db_get percona-xtradb-server/root_password_again
- if [ "$RET" == "$ROOT_PW" ]; then
- ROOT_PW=''
- break
- fi
- db_fset percona-xtradb-server/password_mismatch seen false
- db_input critical percona-xtradb-server/password_mismatch
- db_set percona-xtradb-server/root_password ""
- db_set percona-xtradb-server/root_password_again ""
- db_go
- done
-fi
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.dirs b/storage/xtradb/build/debian/percona-xtradb-server-5.1.dirs
deleted file mode 100644
index 29c2e756a00..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.dirs
+++ /dev/null
@@ -1,9 +0,0 @@
-etc/init.d
-etc/logrotate.d
-etc/mysql/conf.d
-usr/bin
-usr/sbin
-usr/share/man/man8
-usr/share/mysql
-var/run/mysqld
-var/lib/mysql-upgrade
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.docs b/storage/xtradb/build/debian/percona-xtradb-server-5.1.docs
deleted file mode 100644
index eccf2c9c565..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.docs
+++ /dev/null
@@ -1 +0,0 @@
-EXCEPTIONS-CLIENT
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.files b/storage/xtradb/build/debian/percona-xtradb-server-5.1.files
deleted file mode 100644
index 4741b588136..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.files
+++ /dev/null
@@ -1,53 +0,0 @@
-usr/lib/mysql/*so*
-etc/mysql/debian-start
-etc/mysql/conf.d/mysqld_safe_syslog.cnf
-usr/bin/msql2mysql
-usr/bin/my_print_defaults
-usr/bin/myisamchk
-usr/bin/myisamlog
-usr/bin/myisampack
-usr/bin/mysql_convert_table_format
-usr/bin/mysql_fix_privilege_tables
-usr/bin/mysql_install_db
-usr/bin/mysql_secure_installation
-usr/bin/mysql_setpermission
-usr/bin/mysql_tzinfo_to_sql
-usr/bin/mysql_upgrade
-usr/bin/mysql_zap
-usr/bin/mysqlbinlog
-usr/bin/mysqld_multi
-usr/bin/mysqld_safe
-usr/bin/mysqlhotcopy
-usr/bin/mysqltest
-usr/bin/perror
-usr/bin/replace
-usr/bin/resolve_stack_dump
-usr/bin/resolveip
-usr/sbin/mysqld
-usr/share/doc/percona-xtradb-server-5.1/
-usr/share/lintian/overrides/percona-xtradb-server-5.1
-usr/share/man/man1/msql2mysql.1
-usr/share/man/man1/myisamchk.1
-usr/share/man/man1/myisamlog.1
-usr/share/man/man1/myisampack.1
-usr/share/man/man1/my_print_defaults.1
-usr/share/man/man1/mysqlbinlog.1
-usr/share/man/man1/mysql_convert_table_format.1
-usr/share/man/man1/mysqld_multi.1
-usr/share/man/man1/mysqld_safe.1
-usr/share/man/man1/mysql_fix_privilege_tables.1
-usr/share/man/man1/mysqlhotcopy.1
-usr/share/man/man1/mysql_install_db.1
-usr/share/man/man1/mysql_secure_installation.1
-usr/share/man/man1/mysql_setpermission.1
-usr/share/man/man1/mysql_upgrade.1
-usr/share/man/man1/mysqltest.1
-usr/share/man/man1/mysql_zap.1
-usr/share/man/man1/perror.1
-usr/share/man/man1/replace.1
-usr/share/man/man1/resolveip.1
-usr/share/man/man1/resolve_stack_dump.1
-usr/share/man/man1/innochecksum.1
-usr/share/man/man1/mysql_tzinfo_to_sql.1
-usr/share/man/man8/mysqld.8
-usr/share/mysql/
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.links b/storage/xtradb/build/debian/percona-xtradb-server-5.1.links
deleted file mode 100644
index 082680fe5ed..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.links
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/share/mysql/mysql-test/mysql-test-run.pl usr/share/mysql/mysql-test/mysql-test-run
-usr/share/mysql/mysql-test/mysql-test-run.pl usr/share/mysql/mysql-test/mtr
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.lintian-overrides b/storage/xtradb/build/debian/percona-xtradb-server-5.1.lintian-overrides
deleted file mode 100644
index a3ffb465fd5..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.lintian-overrides
+++ /dev/null
@@ -1,4 +0,0 @@
-percona-xtradb-server-5.1: possible-bashism-in-maintainer-script postinst:81 'p{("a".."z","A".."Z",0..9)[int(rand(62))]}'
-percona-xtradb-server-5.1: possible-bashism-in-maintainer-script preinst:33 '${cmd/ */}'
-percona-xtradb-server-5.1: statically-linked-binary ./usr/bin/mysql_tzinfo_to_sql
-percona-xtradb-server-5.1: statically-linked-binary ./usr/sbin/mysqld
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.paranoid b/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.paranoid
deleted file mode 100644
index 00cc5c3e29d..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.paranoid
+++ /dev/null
@@ -1,9 +0,0 @@
-/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$
-/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
-/etc/mysql/debian-start\[[0-9]+\]: Checking for crashed MySQL tables\.$
-mysqld\[[0-9]+\]: $
-mysqld\[[0-9]+\]: Version: .* socket: '/var/run/mysqld/mysqld.sock' port: 3306$
-mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
-mysqld_safe\[[0-9]+\]: started$
-usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$
-usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.server b/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.server
deleted file mode 100644
index 37f25cb01ea..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.server
+++ /dev/null
@@ -1,32 +0,0 @@
-/etc/init.d/mysql\[[0-9]+\]: [0-9]+ processes alive and '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
-/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$
-/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
-/etc/mysql/debian-start\[[0-9]+\]: Checking for crashed MySQL tables\.$
-mysqld\[[0-9]+\]: ?$
-mysqld\[[0-9]+\]: .*InnoDB: Shutdown completed
-mysqld\[[0-9]+\]: .*InnoDB: Started;
-mysqld\[[0-9]+\]: .*InnoDB: Starting shutdown\.\.\.$
-mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Normal shutdown$
-mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: ready for connections\.$
-mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Shutdown complete$
-mysqld\[[0-9]+\]: /usr/sbin/mysqld: ready for connections\.$
-mysqld\[[0-9]+\]: .*/usr/sbin/mysqld: Shutdown Complete$
-mysqld\[[0-9]+\]: Version: .* socket
-mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
-mysqld_safe\[[0-9]+\]: ?$
-mysqld_safe\[[0-9]+\]: able to use the new GRANT command!$
-mysqld_safe\[[0-9]+\]: ended$
-mysqld_safe\[[0-9]+\]: http://www.mysql.com$
-mysqld_safe\[[0-9]+\]: NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run$
-mysqld_safe\[[0-9]+\]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !$
-mysqld_safe\[[0-9]+\]: Please report any problems with the /usr/bin/mysqlbug script!$
-mysqld_safe\[[0-9]+\]: See the manual for more instructions.$
-mysqld_safe\[[0-9]+\]: started$
-mysqld_safe\[[0-9]+\]: Support MySQL by buying support/licenses at https://order.mysql.com$
-mysqld_safe\[[0-9]+\]: The latest information about MySQL is available on the web at$
-mysqld_safe\[[0-9]+\]: the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be$
-mysqld_safe\[[0-9]+\]: To do so, start the server, then issue the following commands:$
-mysqld_safe\[[0-9]+\]: /usr/bin/mysqladmin -u root -h app109 password 'new-password'$
-mysqld_safe\[[0-9]+\]: /usr/bin/mysqladmin -u root password 'new-password'$
-usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$
-usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.workstation b/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.workstation
deleted file mode 100644
index 37f25cb01ea..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.workstation
+++ /dev/null
@@ -1,32 +0,0 @@
-/etc/init.d/mysql\[[0-9]+\]: [0-9]+ processes alive and '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
-/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$
-/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
-/etc/mysql/debian-start\[[0-9]+\]: Checking for crashed MySQL tables\.$
-mysqld\[[0-9]+\]: ?$
-mysqld\[[0-9]+\]: .*InnoDB: Shutdown completed
-mysqld\[[0-9]+\]: .*InnoDB: Started;
-mysqld\[[0-9]+\]: .*InnoDB: Starting shutdown\.\.\.$
-mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Normal shutdown$
-mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: ready for connections\.$
-mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Shutdown complete$
-mysqld\[[0-9]+\]: /usr/sbin/mysqld: ready for connections\.$
-mysqld\[[0-9]+\]: .*/usr/sbin/mysqld: Shutdown Complete$
-mysqld\[[0-9]+\]: Version: .* socket
-mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
-mysqld_safe\[[0-9]+\]: ?$
-mysqld_safe\[[0-9]+\]: able to use the new GRANT command!$
-mysqld_safe\[[0-9]+\]: ended$
-mysqld_safe\[[0-9]+\]: http://www.mysql.com$
-mysqld_safe\[[0-9]+\]: NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run$
-mysqld_safe\[[0-9]+\]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !$
-mysqld_safe\[[0-9]+\]: Please report any problems with the /usr/bin/mysqlbug script!$
-mysqld_safe\[[0-9]+\]: See the manual for more instructions.$
-mysqld_safe\[[0-9]+\]: started$
-mysqld_safe\[[0-9]+\]: Support MySQL by buying support/licenses at https://order.mysql.com$
-mysqld_safe\[[0-9]+\]: The latest information about MySQL is available on the web at$
-mysqld_safe\[[0-9]+\]: the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be$
-mysqld_safe\[[0-9]+\]: To do so, start the server, then issue the following commands:$
-mysqld_safe\[[0-9]+\]: /usr/bin/mysqladmin -u root -h app109 password 'new-password'$
-mysqld_safe\[[0-9]+\]: /usr/bin/mysqladmin -u root password 'new-password'$
-usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$
-usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.mysql.init b/storage/xtradb/build/debian/percona-xtradb-server-5.1.mysql.init
deleted file mode 100644
index 0e0d4f9987f..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.mysql.init
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/bin/bash
-#
-### BEGIN INIT INFO
-# Provides: mysql
-# Required-Start: $remote_fs $syslog
-# Required-Stop: $remote_fs $syslog
-# Should-Start: $network $named $time
-# Should-Stop: $network $named $time
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Start and stop the mysql database server daemon
-# Description: Controls the main MySQL database server daemon "mysqld"
-# and its wrapper script "mysqld_safe".
-### END INIT INFO
-#
-set -e
-set -u
-${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
-
-test -x /usr/sbin/mysqld || exit 0
-
-. /lib/lsb/init-functions
-
-SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
-CONF=/etc/mysql/my.cnf
-MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
-
-# priority can be overriden and "-s" adds output to stderr
-ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"
-
-# Safeguard (relative paths, core dumps..)
-cd /
-umask 077
-
-# mysqladmin likes to read /root/.my.cnf. This is usually not what I want
-# as many admins e.g. only store a password without a username there and
-# so break my scripts.
-export HOME=/etc/mysql/
-
-## Fetch a particular option from mysql's invocation.
-#
-# Usage: void mysqld_get_param option
-mysqld_get_param() {
- /usr/sbin/mysqld --print-defaults \
- | tr " " "\n" \
- | grep -- "--$1" \
- | tail -n 1 \
- | cut -d= -f2
-}
-
-## Do some sanity checks before even trying to start mysqld.
-sanity_checks() {
- # check for config file
- if [ ! -r /etc/mysql/my.cnf ]; then
- log_warning_msg "$0: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz"
- echo "WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" | $ERR_LOGGER
- fi
-
- # check for diskspace shortage
- datadir=`mysqld_get_param datadir`
- if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>4096) }'; then
- log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
- echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
- exit 1
- fi
-}
-
-## Checks if there is a server running and if so if it is accessible.
-#
-# check_alive insists on a pingable server
-# check_dead also fails if there is a lost mysqld in the process list
-#
-# Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn]
-mysqld_status () {
- ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? ))
-
- ps_alive=0
- pidfile=`mysqld_get_param pid-file`
- if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi
-
- if [ "$1" = "check_alive" -a $ping_alive = 1 ] ||
- [ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]; then
- return 0 # EXIT_SUCCESS
- else
- if [ "$2" = "warn" ]; then
- echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug
- fi
- return 1 # EXIT_FAILURE
- fi
-}
-
-#
-# main()
-#
-
-case "${1:-''}" in
- 'start')
- sanity_checks;
- # Start daemon
- log_daemon_msg "Starting MySQL database server" "mysqld"
- if mysqld_status check_alive nowarn; then
- log_progress_msg "already running"
- log_end_msg 0
- else
- /usr/bin/mysqld_safe > /dev/null 2>&1 &
- # 6s was reported in #352070 to be too few when using ndbcluster
- for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
- sleep 1
- if mysqld_status check_alive nowarn ; then break; fi
- log_progress_msg "."
- done
- if mysqld_status check_alive warn; then
- log_end_msg 0
- # Now start mysqlcheck or whatever the admin wants.
- output=$(/etc/mysql/debian-start)
- [ -n "$output" ] && log_action_msg "$output"
- else
- log_end_msg 1
- log_failure_msg "Please take a look at the syslog"
- fi
- fi
- ;;
-
- 'stop')
- # * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible
- # at least for cron, we can rely on it here, too. (although we have
- # to specify it explicit as e.g. sudo environments points to the normal
- # users home and not /root)
- log_daemon_msg "Stopping MySQL database server" "mysqld"
- if ! mysqld_status check_dead nowarn; then
- set +e
- shutdown_out=`$MYADMIN shutdown 2>&1`; r=$?
- set -e
- if [ "$r" -ne 0 ]; then
- log_end_msg 1
- [ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out"
- log_daemon_msg "Killing MySQL database server by signal" "mysqld"
- killall -15 mysqld
- server_down=
- for i in 1 2 3 4 5 6 7 8 9 10; do
- sleep 1
- if mysqld_status check_dead nowarn; then server_down=1; break; fi
- done
- if test -z "$server_down"; then killall -9 mysqld; fi
- fi
- fi
-
- if ! mysqld_status check_dead warn; then
- log_end_msg 1
- log_failure_msg "Please stop MySQL manually and read /usr/share/doc/percona-xtradb-server-5.1/README.Debian.gz!"
- exit -1
- else
- log_end_msg 0
- fi
- ;;
-
- 'restart')
- set +e; $SELF stop; set -e
- $SELF start
- ;;
-
- 'reload'|'force-reload')
- log_daemon_msg "Reloading MySQL database server" "mysqld"
- $MYADMIN reload
- log_end_msg 0
- ;;
-
- 'status')
- if mysqld_status check_alive nowarn; then
- log_action_msg "$($MYADMIN version)"
- else
- log_action_msg "MySQL is stopped."
- exit 3
- fi
- ;;
-
- *)
- echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
- exit 1
- ;;
-esac
-
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.percona-xtradb-server.logrotate b/storage/xtradb/build/debian/percona-xtradb-server-5.1.percona-xtradb-server.logrotate
deleted file mode 100644
index 0f0de516b13..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.percona-xtradb-server.logrotate
+++ /dev/null
@@ -1,27 +0,0 @@
-# - I put everything in one block and added sharedscripts, so that mysql gets
-# flush-logs'd only once.
-# Else the binary logs would automatically increase by n times every day.
-# - The error log is obsolete, messages go to syslog now.
-/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log {
- daily
- rotate 7
- missingok
- create 640 mysql adm
- compress
- sharedscripts
- postrotate
- test -x /usr/bin/mysqladmin || exit 0
-
- # If this fails, check debian.conf!
- MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
- if [ -z "`$MYADMIN ping 2>/dev/null`" ]; then
- # Really no mysqld or rather a missing debian-sys-maint user?
- # If this occurs and is not a error please report a bug.
- if ps cax | grep -q mysqld; then
- exit 1
- fi
- else
- $MYADMIN flush-logs
- fi
- endscript
-}
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.postinst b/storage/xtradb/build/debian/percona-xtradb-server-5.1.postinst
deleted file mode 100644
index 24a3f37c646..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.postinst
+++ /dev/null
@@ -1,277 +0,0 @@
-#!/bin/bash -e
-
-. /usr/share/debconf/confmodule
-
-if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
-${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
-
-export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
-
-# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
-ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i"
-
-invoke() {
- if [ -x /usr/sbin/invoke-rc.d ]; then
- invoke-rc.d mysql $1
- else
- /etc/init.d/mysql $1
- fi
-}
-
-MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables"
-
-test_mysql_access() {
- mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1
-}
-
-# call with $1 = "online" to connect to the server, otherwise it bootstraps
-set_mysql_rootpw() {
- # forget we ever saw the password. don't use reset to keep the seen status
- db_set percona-xtradb-server/root_password ""
-
- tfile=`mktemp`
- if [ ! -f "$tfile" ]; then
- return 1
- fi
-
- # this avoids us having to call "test" or "[" on $rootpw
- cat << EOF > $tfile
-USE mysql;
-UPDATE user SET password=PASSWORD("$rootpw") WHERE user='root';
-FLUSH PRIVILEGES;
-EOF
- if grep -q 'PASSWORD("")' $tfile; then
- retval=0
- elif [ "$1" = "online" ]; then
- mysql --no-defaults -u root -h localhost <$tfile >/dev/null
- retval=$?
- else
- $MYSQL_BOOTSTRAP <$tfile
- retval=$?
- fi
- rm -f $tfile
- return $retval
-}
-
-# This is necessary because mysql_install_db removes the pid file in /var/run
-# and because changed configuration options should take effect immediately.
-# In case the server wasn't running at all it should be ok if the stop
-# script fails. I can't tell at this point because of the cleaned /var/run.
-set +e; invoke stop; set -e
-
-case "$1" in
- configure)
- mysql_datadir=/usr/share/mysql
- mysql_statedir=/var/lib/mysql
- mysql_rundir=/var/run/mysqld
- mysql_logdir=/var/log
- mysql_cfgdir=/etc/mysql
- mysql_newlogdir=/var/log/mysql
- mysql_upgradedir=/var/lib/mysql-upgrade
-
- # first things first, if the following symlink exists, it is a preserved
- # copy the old data dir from a mysql upgrade that would have otherwise
- # been replaced by an empty mysql dir. this should restore it.
- for dir in DATADIR LOGDIR; do
- if [ "$dir" = "DATADIR" ]; then targetdir=$mysql_statedir; else targetdir=$mysql_newlogdir; fi
- savelink="$mysql_upgradedir/$dir.link"
- if [ -L "$savelink" ]; then
- # If the targetdir was a symlink before we upgraded it is supposed
- # to be either still be present or not existing anymore now.
- if [ -L "$targetdir" ]; then
- rm "$savelink"
- elif [ ! -d "$targetdir" ]; then
- mv "$savelink" "$targetdir"
- else
- # this should never even happen, but just in case...
- mysql_tmp=`mktemp -d -t mysql-symlink-restore-XXXXXX`
- echo "this is very strange! see $mysql_tmp/README..." >&2
- mv "$targetdir" "$mysql_tmp"
- cat << EOF > "$mysql_tmp/README"
-
-if you're reading this, it's most likely because you had replaced /var/lib/mysql
-with a symlink, then upgraded to a new version of mysql, and then dpkg
-removed your symlink (see #182747 and others). the mysql packages noticed
-that this happened, and as a workaround have restored it. however, because
-/var/lib/mysql seems to have been re-created in the meantime, and because
-we don't want to rm -rf something we don't know as much about, we're going
-to leave this unexpected directory here. if your database looks normal,
-and this is not a symlink to your database, you should be able to blow
-this all away.
-
-EOF
- fi
- fi
- rmdir $mysql_upgradedir 2>/dev/null || true
- done
-
- # Ensure the existence and right permissions for the database and
- # log files.
- if [ ! -d "$mysql_statedir" -a ! -L "$mysql_statedir" ]; then mkdir "$mysql_statedir"; fi
- if [ ! -d "$mysql_statedir/mysql" -a ! -L "$mysql_statedir/mysql" ]; then mkdir "$mysql_statedir/mysql"; fi
- if [ ! -d "$mysql_newlogdir" -a ! -L "$mysql_newlogdir" ]; then mkdir "$mysql_newlogdir"; fi
- # When creating an ext3 jounal on an already mounted filesystem like e.g.
- # /var/lib/mysql, you get a .journal file that is not modifyable by chown.
- # The mysql_datadir must not be writable by the mysql user under any
- # circumstances as it contains scripts that are executed by root.
- set +e
- chown -R 0:0 $mysql_datadir
- chown -R mysql $mysql_statedir
- chown -R mysql $mysql_rundir
- chown -R mysql:adm $mysql_newlogdir; chmod 2750 $mysql_newlogdir;
- for i in log err; do
- touch $mysql_logdir/mysql.$i
- chown mysql:adm $mysql_logdir/mysql.$i
- chmod 0640 $mysql_logdir/mysql.$i
- done
- set -e
-
- # This is important to avoid dataloss when there is a removed
- # percona-xtradb-server version from Woody lying around which used the same
- # data directory and then somewhen gets purged by the admin.
- db_set percona-xtradb-server/postrm_remove_database false || true
-
- # To avoid downgrades.
- touch $mysql_statedir/debian-5.1.flag
-
- # initiate databases. Output is not allowed by debconf :-(
- # Debian: beware of the bashisms...
- # Debian: can safely run on upgrades with existing databases
- set +e
- /bin/bash /usr/bin/mysql_install_db --rpm 2>&1 | $ERR_LOGGER
- if [ "$?" != "0" ]; then
- echo "ATTENTION: An error has occured. More info is in the syslog!"
- fi
- set -e
-
- ## On every reconfiguration the maintenance user is recreated.
- #
- # - It is easier to regenerate the password every time but as people
- # use fancy rsync scripts and file alteration monitors, the existing
- # password is used and existing files not touched.
- # - The mysqld statement is like that in mysql_install_db because the
- # server is not already running. This has some implications:
- # - The amount of newlines and semicolons in the query is important!
- # - GRANT is not possible with --skip-grant-tables and "INSERT
- # (user,host..) VALUES" is not --ansi compliant
- # - The echo is just for readability. ash's buildin has no "-e" so use /bin/echo.
- # - The Super_priv, Show_db_priv, Create_tmp_table_priv and Lock_tables_priv
- # may not be present as old Woody 3.23 databases did not have it and the
- # admin might not already have run mysql_upgrade which adds them.
- # As the binlog cron scripts to need at least the Super_priv, I do first
- # the old query which always succeeds and then the new which may or may not.
-
- # recreate the credentials file if not present or without mysql_upgrade stanza
- dc=$mysql_cfgdir/debian.cnf;
- if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then
- pass="`sed -n 's/^[ ]*password *= *// p' $dc | head -n 1`"
- else
- pass=`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'`;
- if [ ! -d "$mysql_cfgdir" ]; then install -o 0 -g 0 -m 0755 -d $mysql_cfgdir; fi
- cat /dev/null > $dc
- echo "# Automatically generated for Debian scripts. DO NOT TOUCH!" >>$dc
- echo "[client]" >>$dc
- echo "host = localhost" >>$dc
- echo "user = debian-sys-maint" >>$dc
- echo "password = $pass" >>$dc
- echo "socket = $mysql_rundir/mysqld.sock" >>$dc
- echo "[mysql_upgrade]" >>$dc
- echo "host = localhost" >>$dc
- echo "user = debian-sys-maint" >>$dc
- echo "password = $pass" >>$dc
- echo "socket = $mysql_rundir/mysqld.sock" >>$dc
- echo "basedir = /usr" >>$dc
- fi
- # If this dir chmod go+w then the admin did it. But this file should not.
- chown 0:0 $dc
- chmod 0600 $dc
-
- # update privilege tables
- password_column_fix_query=`/bin/echo -e \
- "USE mysql\n" \
- "ALTER TABLE user CHANGE Password Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL"`;
- replace_query=`/bin/echo -e \
- "USE mysql\n" \
- "REPLACE INTO user SET " \
- " host='localhost', user='debian-sys-maint', password=password('$pass'), " \
- " Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \
- " Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \
- " Process_priv='Y', File_priv='Y', Grant_priv='Y', References_priv='Y', " \
- " Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', "\
- " Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', "\
- " Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', "\
- " Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', "\
- " Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y' "`;
- fix_privs=`/bin/echo -e \
- "USE mysql;\n" \
- "ALTER TABLE user ADD column Create_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
- "ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
- "ALTER TABLE user ADD column Create_routine_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
- "ALTER TABLE user ADD column Alter_routine_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
- "ALTER TABLE user ADD column Create_user_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
- "ALTER TABLE user ADD column Event_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
- "ALTER TABLE user ADD column Trigger_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " `
- # Engines supported by etch should be installed per default. The query sequence is supposed
- # to be aborted if the CREATE TABLE fails due to an already existent table in which case the
- # admin might already have chosen to remove one or more plugins. Newlines are necessary.
- install_plugins=`/bin/echo -e \
- "USE mysql;\n" \
- "CREATE TABLE plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \
- " dl char(128) COLLATE utf8_bin NOT NULL DEFAULT '', " \
- " PRIMARY KEY (name)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='MySQL plugins';\n" \
- "INSERT INTO plugin VALUES ('innodb', 'ha_innodb.so');\n" \
- "INSERT INTO plugin VALUES ('federated', 'ha_federated.so');\n" \
- "INSERT INTO plugin VALUES ('blackhole', 'ha_blackhole.so');\n" \
- "INSERT INTO plugin VALUES ('archive', 'ha_archive.so');" `
-
- # Upgrade password column format before the root password gets set.
- echo "$password_column_fix_query" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
-
- db_get percona-xtradb-server/root_password && rootpw="$RET"
- if ! set_mysql_rootpw; then
- password_error="yes"
- fi
-
- echo "$fix_privs" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
- echo "$replace_query" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
- set +e
- echo "$install_plugins" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
- set -e
- ;;
-
- abort-upgrade|abort-remove|abort-configure)
- ;;
-
- *)
- echo "postinst called with unknown argument '$1'" 1>&2
- exit 1
- ;;
-esac
-
-# here we check to see if we can connect as root without a password
-# this should catch upgrades from previous versions where the root
-# password wasn't set. if there is a password, or if the connection
-# fails for any other reason, nothing happens.
-if [ "$1" = "configure" ]; then
- if test_mysql_access; then
- db_input medium percona-xtradb-server/root_password || true
- db_go
- db_get percona-xtradb-server/root_password && rootpw="$RET"
-
- if ! set_mysql_rootpw "online"; then
- password_error="yes"
- fi
- fi
-
- if [ "$password_error" = "yes" ]; then
- db_input high percona-xtradb-server/error_setting_password || true
- db_go
- fi
-
-fi
-
-db_stop # in case invoke failes
-
-#DEBHELPER#
-
-exit 0
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.postrm b/storage/xtradb/build/debian/percona-xtradb-server-5.1.postrm
deleted file mode 100644
index 083a42bd861..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.postrm
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash -e
-
-# It is possible that Debconf has already been removed, too.
-if [ -f /usr/share/debconf/confmodule ]; then
- . /usr/share/debconf/confmodule
-fi
-
-if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
-${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
-
-MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
-
-# Try to stop the server in a sane way. If it does not success let the admin
-# do it himself. No database directories should be removed while the server
-# is running!
-stop_server() {
- set +e
- if [ -x /usr/sbin/invoke-rc.d ]; then
- invoke-rc.d mysql stop
- else
- /etc/init.d/mysql stop
- fi
- errno=$?
- set -e
-
- if [ "$?" != 0 ]; then
- echo "Trying to stop the MySQL server resulted in exitcode $?." 1>&2
- echo "Stop it yourself and try again!" 1>&2
- exit 1
- fi
-}
-
-case "$1" in
- purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
- if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then
- stop_server
- sleep 2
- fi
- ;;
- *)
- echo "postrm called with unknown argument '$1'" 1>&2
- exit 1
- ;;
-esac
-
-#
-# - Do NOT purge logs or data if another percona-xtradb-server* package is installed (#307473)
-# - Remove the mysql user only after all his owned files are purged.
-#
-if [ "$1" = "purge" -a ! \( -x /usr/sbin/mysqld -o -L /usr/sbin/mysqld \) ]; then
- # we remove the mysql user only after all his owned files are purged
- rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz}
- rm -rf /var/log/mysql
-
- db_input high percona-xtradb-server-5.1/postrm_remove_databases || true
- db_go || true
- db_get percona-xtradb-server-5.1/postrm_remove_databases || true
- if [ "$RET" = "true" ]; then
- # never remove the debian.cnf when the databases are still existing
- # else we ran into big trouble on the next install!
- rm -f /etc/mysql/debian.cnf
- rm -rf /var/lib/mysql
- rm -rf /var/run/mysqld
- userdel mysql || true
- fi
-
- # (normally) Automatically added by dh_installinit
- if [ "$1" = "purge" ] ; then
- update-rc.d mysql remove >/dev/null || exit 0
- fi
- # (normally) End automatically added section
-fi
-
-# (normally) Automatically added by dh_installdebconf
-if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
- . /usr/share/debconf/confmodule
- db_purge
-fi
-# (normally) End automatically added section
-
-# no DEBHELPER here, "update-rc.d remove" fails if percona-xtradb-server-5.1 is installed
-
-exit 0
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.preinst b/storage/xtradb/build/debian/percona-xtradb-server-5.1.preinst
deleted file mode 100644
index a338e4edd8f..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.preinst
+++ /dev/null
@@ -1,186 +0,0 @@
-#!/bin/bash -e
-#
-# summary of how this script can be called:
-# * <new-preinst> install
-# * <new-preinst> install <old-version>
-# * <new-preinst> upgrade <old-version>
-# * <old-preinst> abort-upgrade <new-version>
-#
-
-. /usr/share/debconf/confmodule
-
-if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
-${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
-
-export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
-MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
-DATADIR=/var/lib/mysql
-LOGDIR=/var/log/mysql
-UPGRADEDIR=/var/lib/mysql-upgrade
-
-# Try to stop the server in a sane way. If it does not success let the admin
-# do it himself. No database directories should be removed while the server
-# is running! Another mysqld in e.g. a different chroot is fine for us.
-stop_server() {
- if [ ! -x /etc/init.d/mysql ]; then return; fi
-
- set +e
- if [ -x /usr/sbin/invoke-rc.d ]; then
- cmd="invoke-rc.d mysql stop"
- else
- cmd="/etc/init.d/mysql stop"
- fi
- $cmd
- errno=$?
- set -e
-
- # 0=ok, 100=no init script (fresh install)
- if [ "$errno" != 0 -a "$errno" != 100 ]; then
- echo "${cmd/ */} returned $errno" 1>&2
- echo "There is a MySQL server running, but we failed in our attempts to stop it." 1>&2
- echo "Stop it yourself and try again!" 1>&2
- db_stop
- exit 1
- fi
-}
-
-################################ main() ##########################
-
-this_version=5.1
-
-# Check kernel version
-if dpkg --compare-versions `uname -r` lt 2.6; then
- /bin/echo -e "\nPROBLEM: MySQL-5.x is currently incompatible with kernel 2.4. Aborting.";
- /bin/echo -e "See http://bugs.debian.org/416841 for more information.\n"
- exit 1
-fi
-
-# Abort if an NDB cluster is in use.
-if egrep -q -r '^[^#]*ndb.connectstring' /etc/mysql/; then
- db_fset percona-xtradb-server/no_upgrade_when_using_ndb seen false || true
- db_input high percona-xtradb-server/no_upgrade_when_using_ndb || true
- db_go
- db_stop
- exit 1
-fi
-
-# Safe the user from stupidities.
-show_downgrade_warning=0
-for i in `ls $DATADIR/debian-*.flag 2>/dev/null`; do
- found_version=`echo $i | sed 's/.*debian-\([0-9\.]\+\).flag/\1/'`
- if dpkg --compare-versions "$this_version" '<<' "$found_version"; then
- show_downgrade_warning=1
- break;
- fi
-done
-if [ "$show_downgrade_warning" = 1 ]; then
- db_fset percona-xtradb-server-$this_version/really_downgrade seen false || true
- db_input medium percona-xtradb-server-$this_version/really_downgrade || true
- db_go
- db_get percona-xtradb-server-$this_version/really_downgrade || true
- if [ "$RET" = "true" ]; then
- rm -f $DATADIR/debian-*.flag
- touch $DATADIR/debian-$this_version.flag
- else
- echo "Aborting downgrade from (at least) $found_version to $this_version." 1>&2
- echo "If are sure you want to downgrade to $this_version, remove the file" 1>&2
- echo "$DATADIR/debian-*.flag and try installing again." 1>&2
- db_stop
- exit 1
- fi
-fi
-
-# to be sure
-stop_server
-
-# If we use NIS then errors should be tolerated. It's up to the
-# user to ensure that the mysql user is correctly setup.
-# Beware that there are two ypwhich one of them needs the 2>/dev/null!
-if test -n "`which ypwhich 2>/dev/null`" && ypwhich >/dev/null 2>&1; then
- set +e
-fi
-
-#
-# Now we have to ensure the following state:
-# /etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false
-# /etc/group: mysql:x:101:
-#
-# Sadly there could any state be present on the system so we have to
-# modify everything carefully i.e. not doing a chown before creating
-# the user etc...
-#
-
-# creating mysql group if he isn't already there
-if ! getent group mysql >/dev/null; then
- # Adding system group: mysql.
- addgroup --system mysql >/dev/null
-fi
-
-# creating mysql user if he isn't already there
-if ! getent passwd mysql >/dev/null; then
- # Adding system user: mysql.
- adduser \
- --system \
- --disabled-login \
- --ingroup mysql \
- --home $DATADIR \
- --gecos "MySQL Server" \
- --shell /bin/false \
- mysql >/dev/null
-fi
-
-# end of NIS tolerance zone
-set -e
-
-# if there's a symlink, let's store where it's pointing, because otherwise
-# it's going to be lost in some situations
-for dir in DATADIR LOGDIR; do
- checkdir=`eval echo "$"$dir`
- if [ -L "$checkdir" ]; then
- mkdir -p "$UPGRADEDIR"
- cp -d "$checkdir" "$UPGRADEDIR/$dir.link"
- fi
-done
-
-# creating mysql home directory
-if [ ! -d $DATADIR -a ! -L $DATADIR ]; then
- mkdir $DATADIR
-fi
-
-# checking disc space
-if LC_ALL=C BLOCKSIZE= df --portability $DATADIR/. | tail -n 1 | awk '{ exit ($4>1000) }'; then
- echo "ERROR: There's not enough space in $DATADIR/" 1>&2
- db_stop
- exit 1
-fi
-
-# Since the home directory was created before putting the user into
-# the mysql group and moreover we cannot guarantee that the
-# permissions were correctly *before* calling this script, we fix them now.
-# In case we use NIS and no mysql user is present then this script should
-# better fail now than later..
-# The "set +e" is necessary as e.g. a ".journal" of a ext3 partition is
-# not chgrp'able (#318435).
-set +e
-chown mysql:mysql $DATADIR
-find $DATADIR -follow -not -group mysql -print0 2>/dev/null \
- | xargs -0 --no-run-if-empty chgrp mysql
-set -e
-
-# Some files below /etc/ were possibly in the percona-xtradb-server-5.0/etch package
-# before. They get overwritten by current ones to avoid unnecessary dpkg questions.
-while read md5 file; do
- if [ "`md5sum $file 2>/dev/null`" = "$md5 $file" ]; then
- cp /usr/share/percona-xtradb-common/internal-use-only/`echo $file | sed 's°/°_°g'` $file
- fi
-done <<EOT
-6691f2fdc5c6d27ff0260eb79813e1bc /etc/init.d/mysql
-b53b9552d44661361d39157c3c7c51d3 /etc/logrotate.d/percona-xtradb-server
-57f3e58f72582ca55100dc1ba0f1a8ae /etc/mysql/debian-start
-EOT
-
-db_stop
-
-#DEBHELPER#
-
-exit 0
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.prerm b/storage/xtradb/build/debian/percona-xtradb-server-5.1.prerm
deleted file mode 100644
index 03e9ea37420..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.prerm
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash -e
-
-. /usr/share/debconf/confmodule
-
-if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
-${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
-
-#DEBHELPER#
diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.templates b/storage/xtradb/build/debian/percona-xtradb-server-5.1.templates
deleted file mode 100644
index efa318640db..00000000000
--- a/storage/xtradb/build/debian/percona-xtradb-server-5.1.templates
+++ /dev/null
@@ -1,90 +0,0 @@
-# These templates have been reviewed by the debian-l10n-english
-# team
-#
-# If modifications/additions/rewording are needed, please ask
-# for an advice to debian-l10n-english@lists.debian.org
-#
-# Even minor modifications require translation updates and such
-# changes should be coordinated with translators and reviewers.
-
-Template: percona-xtradb-server-5.1/really_downgrade
-Type: boolean
-Default: false
-_Description: Really proceed with downgrade?
- A file named /var/lib/mysql/debian-*.flag exists on this system.
- .
- Such file is an indication that a percona-xtradb-server package with a higher
- version has been installed earlier.
- .
- There is no guarantee that the version you're currently installing
- will be able to use the current databases.
-
-Template: percona-xtradb-server-5.1/nis_warning
-Type: note
-#flag:translate!:3,5
-_Description: Important note for NIS/YP users
- To use MySQL, the following entries for users and groups should be added
- to the system:
- .
- /etc/passwd : mysql:x:100:101:Percona SQL Server:/var/lib/mysql:/bin/false
- /etc/group : mysql:x:101:
- .
- You should also check the permissions and the owner of the
- /var/lib/mysql directory:
- .
- /var/lib/mysql: drwxr-xr-x mysql mysql
-
-Template: percona-xtradb-server-5.1/postrm_remove_databases
-Type: boolean
-Default: false
-_Description: Remove all Percona SQL databases?
- The /var/lib/mysql directory which contains the Percona SQL databases is about
- to be removed.
- .
- If you're removing the Percona SQL package in order to later install a more
- recent version or if a different percona-xtradb-server package is already
- using it, the data should be kept.
-
-Template: percona-xtradb-server-5.1/start_on_boot
-Type: boolean
-Default: true
-_Description: Start the Percona SQL server on boot?
- The Percona SQL server can be launched automatically at boot time or manually
- with the '/etc/init.d/mysql start' command.
-
-Template: percona-xtradb-server/root_password
-Type: password
-_Description: New password for the Percona SQL "root" user:
- While not mandatory, it is highly recommended that you set a password
- for the Percona SQL administrative "root" user.
- .
- If that field is left blank, the password will not be changed.
-
-Template: percona-xtradb-server/root_password_again
-Type: password
-_Description: Repeat password for the Percona SQL "root" user:
-
-Template: percona-xtradb-server/error_setting_password
-Type: error
-_Description: Unable to set password for the Percona SQL "root" user
- An error occurred while setting the password for the Percona SQL
- administrative user. This may have happened because the account
- already has a password, or because of a communication problem with
- the Percona SQL server.
- .
- You should check the account's password after the package installation.
- .
- Please read the /usr/share/doc/percona-xtradb-server-5.1/README.Debian file
- for more information.
-
-Template: percona-xtradb-server/password_mismatch
-Type: error
-_Description: Password input error
- The two passwords you entered were not the same. Please try again.
-
-Template: percona-xtradb-server/no_upgrade_when_using_ndb
-Type: error
-_Description: NDB Cluster seems to be in use
- Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new
- mysql-cluster package and remove all lines starting with "ndb" from
- all config files below /etc/mysql/.
diff --git a/storage/xtradb/build/debian/po/POTFILES.in b/storage/xtradb/build/debian/po/POTFILES.in
deleted file mode 100644
index b3a73d17bd1..00000000000
--- a/storage/xtradb/build/debian/po/POTFILES.in
+++ /dev/null
@@ -1 +0,0 @@
-[type: gettext/rfc822deb] percona-xtradb-server-5.1.templates
diff --git a/storage/xtradb/build/debian/po/ar.po b/storage/xtradb/build/debian/po/ar.po
deleted file mode 100644
index 6a51c1f8919..00000000000
--- a/storage/xtradb/build/debian/po/ar.po
+++ /dev/null
@@ -1,267 +0,0 @@
-# translation of templates.po to Arabic
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-#
-# Ossama M. Khayat <okhayat@yahoo.com>, 2007.
-msgid ""
-msgstr ""
-"Project-Id-Version: templates\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-05-01 13:04+0300\n"
-"Last-Translator: Ossama M. Khayat <okhayat@yahoo.com>\n"
-"Language-Team: Arabic <support@arabeyes.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-"Plural-Forms: nplurals=6; plural=n==1 ? 0 : n==0 ? 1 : n==2 ? 2: n%100>=3 && "
-"n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n"
-": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n"
-": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n"
-": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n"
-": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n"
-": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n"
-": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr "هل Ùعلاً تريد التثبيط؟"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr "هناك مل٠مسمى /var/lib/mysql/debian-*.flag موجود على هذا النظام."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"هذا المل٠دلالة على أن نسخة أحدث من حزمة mysql-server تم تثبيتها مسبقاً."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-"ليست هناك أية ضمانة أن النسخة التي تقوم بتثبيتها ستكون قادرة على استخدام "
-"قواعد البيانات الحالية."
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr "ملاحظة هامة لمستخدمي NIS/YP"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-"كي تستخدم MySQLØŒ يجب إضاÙØ© المÙدخلات التالية الخاصة بالمستخدمين والمجموعات "
-"إلى النظام:"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr "عليك أيضاً أن تقوم بالتأكد من صلاحيات مالك المل٠/var/lib/mysql: "
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid "Remove all MySQL databases?"
-msgid "Remove all Percona SQL databases?"
-msgstr "إزالة جميع قواعد بيانات MySQL؟"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The /var/lib/mysql directory which contains the MySQL databases is about "
-#| "to be removed."
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr "الدليل /var/lib/mysql الذي يحتوي قواعد بيانات MySQL ستتم إزالته."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "If you're removing the MySQL package in order to later install a more "
-#| "recent version or if a different mysql-server package is already using "
-#| "it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"إن كنت تقوم بإزالة حزمة MySQL كي تقوم لاحقاً بتثبيت نسخة أحدث أو إن كانت حزمة "
-"mysql-server مختلÙØ© تستخدمها، Ùيجب إبقاء البيانات."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Start the MySQL server on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "تشغيل خادم MySQL عند الإقلاع؟"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL server can be launched automatically at boot time or manually "
-#| "with the '/etc/init.d/mysql start' command."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"يمكن تشغيل خادم MySQL آلياً وقت الإقلاع أو يدوياً باستخدام الأمر '/etc/init.d/"
-"mysql start'."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "كلمة المرور الجديدة لمستخد \"root\" الخاص بـMySQL:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "While not mandatory, it is highly recommended that you set a password for "
-#| "the MySQL administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"مع أنه ليس إجبارياً، ولكن من المستحسن أن تقوم بتعيين كلمة مرور خاصة بمستخدم "
-"MySQL الإداري \"root\"."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr "إن ترك الحقل Ùارغاً، Ùلن يتم تغيير كلمة المرور."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "كلمة المرور الجديدة لمستخد \"root\" الخاص بـMySQL:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for the MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "تعذر تعيين كلمة مرور للمستخدم \"root\" الخاص بـMySQL."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "An error occurred while setting the password for the MySQL administrative "
-#| "user. This may have happened because the account already has a password, "
-#| "or because of a communication problem with the MySQL server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"حدث خطأ أثناء تعيين كلمة المرور لمستخدم MySQL الإداري. قد يكون هذا حدث بسبب "
-"أن حساب المستخدم له كلمة مرور معيّنة مسبقاً، أو بسبب مشكلة ÙÙŠ الاتصال مع خادم "
-"MySQL."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "You should check the account's password after tha package installation."
-msgid "You should check the account's password after the package installation."
-msgstr "يجب عليك التحقق من كلمة مرور الحساب عقب تثبيت الحزمة."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
-#| "more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"الرجاء قراءة المل٠/usr/share/doc/mysql-server-5.1/README.Debian للمزيد من "
-"المعلومات."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "هل تريد دعم اتصالات MySQL من الأجهزة التي تعمل على ديبيان \"sarge\" أو "
-#~ "أقدم؟"
-
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "ÙÙŠ إصدارات عملاء MySQL القديمة من ديبيان، لم تكن كلمات المرور تحÙظ بشكل "
-#~ "آمن. ولقد حل هذه المشكلة بعدها، غير أن العملاء (مثل PHP) المتصلين من "
-#~ "أجهزة تعمل على ديبيان Sarge 3.1 لن يكونوا قادرين على الاتصال باستخدام "
-#~ "الحسابات الحديثة أو الحسابات التي تم تغيير كلمة مرورها."
diff --git a/storage/xtradb/build/debian/po/ca.po b/storage/xtradb/build/debian/po/ca.po
deleted file mode 100644
index 94fadb6d5df..00000000000
--- a/storage/xtradb/build/debian/po/ca.po
+++ /dev/null
@@ -1,342 +0,0 @@
-# mysql-dfsg (debconf) translation to Catalan.
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-# Aleix Badia i Bosch <abadia@ica.es> 2004
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-4.1\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2004-01-31 19:20GMT\n"
-"Last-Translator: Aleix Badia i Bosch <abadia@ica.es>\n"
-"Language-Team: Debian L10n Catalan <debian-l10n-catalan@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=ISO-8859-1\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-#, fuzzy
-#| msgid "Important note for NIS/YP users!"
-msgid "Important note for NIS/YP users"
-msgstr "Nota important pels usuaris de NIS/YP"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid "Remove all Percona SQL databases?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Should MySQL start on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Voleu que el MySQL s'iniciï a l'arrencada ?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"El MySQL es pot executar a l'arrencada o només si executeu manualment '/etc/"
-"init.d/mysql start'. Seleccioneu 'sí' si voleu que s'inicialitzi "
-"automàticament."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#, fuzzy
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "Per utilitzar la base de dades de MySQL heu d'afegir un usuari i grup "
-#~ "equivalent al següent i assegurar-vos que el directori /var/lib/mysql "
-#~ "tingui els permisos correctes."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#, fuzzy
-#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html"
-#~ msgstr ""
-#~ "Feu una ullada al document: http://www.mysql.com/doc/en/Upgrade.html"
-
-#, fuzzy
-#~ msgid ""
-#~ "MySQL will only install if you have a non-numeric hostname that is "
-#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
-#~ "myhostname\"."
-#~ msgstr ""
-#~ "El MySQL només s'instal·la en cas de tenir un nom d'ordinador central que "
-#~ "no sigui numèric i que es pugui resoldre a través del fitxer /etc/hosts. "
-#~ "Ex. si l'ordre \"hostname\" retorna \"myhostname\", llavors hi ha d'haver "
-#~ "una línia com la següent \"10.0.0.1 myhostname\"."
-
-#, fuzzy
-#~ msgid ""
-#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
-#~ "is used in the start/stop and cron scripts. Don't delete."
-#~ msgstr ""
-#~ "Es crea un nou usuari de mysql \"debian-sys-maint\". S'utilitza per les "
-#~ "seqüències d'inicialització i aturada del cron, no el suprimiu."
-
-#, fuzzy
-#~ msgid ""
-#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /"
-#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in "
-#~ "there, never only the password!"
-#~ msgstr ""
-#~ "Recordeu posar una contrasenya al superusuari del MySQL. Si utilitzeu un "
-#~ "fitxer /root/.my.cnf, escriviu sempre allà les línies \"user\" i "
-#~ "\"password\".; mai només la contrasenya. Per a més informació feu una "
-#~ "ullada a /usr/share/doc/mysql-server/README.Debian."
-
-#, fuzzy
-#~ msgid ""
-#~ "Should I remove all databases below /var/lib/mysql as you are purging the "
-#~ "mysql-server package?"
-#~ msgstr ""
-#~ "Voleu suprimir totes les bases de dades en purgar el paquet mysql-server ?"
-
-#~ msgid ""
-#~ "Networking is disabled by default for security reasons. You can enable it "
-#~ "by commenting out the skip-networking option in /etc/mysql/my.cnf."
-#~ msgstr ""
-#~ "La xarxa està inhabilitada per defecte per a raons de seguretat. La podeu "
-#~ "habilitar descomentant l'opció de skip-networking del fitxer /etc/mysql/"
-#~ "my.cnf."
-
-#~ msgid "security and update notice"
-#~ msgstr "Avís de seguretat i actualització"
-
-#~ msgid "Please run mysql_fix_privilege_tables !"
-#~ msgstr "Executeu mysql_fix_privilege_tables"
-
-#~ msgid ""
-#~ "I will ensure secure permissions of /var/lib/mysql by replacing GIDs "
-#~ "other than root and mysql with mysql."
-#~ msgstr ""
-#~ "S'asseguren els permisos de seguretat de /var/lib/mysql canviant a mysql "
-#~ "tots els GIDs diferents a root i mysql."
-
-#~ msgid ""
-#~ "Instructions how to enable SSL support are in /usr/share/doc/mysql-server/"
-#~ msgstr ""
-#~ "Per habilitar el suport de SSL podeu seguir les instruccions de /usr/"
-#~ "share/doc/mysql-server/"
-
-#~ msgid "mysql_fix_privileges_tables will be executed"
-#~ msgstr "s'executa mysql_fix_privileges_tables"
-
-#~ msgid ""
-#~ "The latest MySQL versions have an enhanced, more fine grained, privilege "
-#~ "system. To make use of it, some new fields must be added to the tables "
-#~ "in the \"mysql\" database. This is done by the "
-#~ "mysql_fix_privilege_tables script during this upgrade regardless of if "
-#~ "the server is currently running or not!"
-#~ msgstr ""
-#~ "Les últimes versions de MySQL tenen un sistema de privilegis més "
-#~ "elaborat. Per utilitzar-lo cal afegir nous camps a les taules de la base "
-#~ "de dades \"mysql\". Aquesta tasca la realitza la seqüència "
-#~ "mysql_fix_privilege_tables durant l'actualització independentment de si "
-#~ "el servidor s'està executant o no!"
-
-#~ msgid ""
-#~ "This script is not supposed to give any user more rights that he had "
-#~ "before, if you encounter such a case, please contact me."
-#~ msgstr ""
-#~ "Aquesta seqüència no assigna privilegis d'usuari diferents als que ja "
-#~ "tenia, en cas que us trobéssiu en aquesta situació, poseu-vos en contacte "
-#~ "amb mi."
-
-#~ msgid ""
-#~ "Should I remove everything below /var/lib/mysql when you purge the mysql-"
-#~ "server package with the \"dpkg --purge mysql-server\" command (i.e. "
-#~ "remove everything including the configuration) somewhen? (default is not)"
-#~ msgstr ""
-#~ "Voleu suprimir tots els continguts de /var/lib/mysql quan es purgui el "
-#~ "paquet mysql-server amb l'ordre \"dpkg --purge mysql-server\". (ex. "
-#~ "suprimir-ho tot inclòs la configuració) ? (per defecte no)"
-
-#~ msgid "Make MySQL reachable via network?"
-#~ msgstr "Voleu fer accessible el MySQL via xarxa ?"
-
-#~ msgid ""
-#~ "Should MySQL listen on a network reachable TCP port? This is not "
-#~ "necessary for use on a single computer and could be a security problem."
-#~ msgstr ""
-#~ "Voleu que el MySQL escolti a un port TCP accessible des de la xarxa ? "
-#~ "Aquesta opció no és imprescindible en ordinadors aïllats i podria "
-#~ "provocar un problema de seguretat."
-
-#~ msgid "Enable chroot mode?"
-#~ msgstr "Permetre el mode chroot ?"
-
-#~ msgid ""
-#~ "MySQL is able to jail itself into the /var/lib/mysql_jail directory so "
-#~ "that users cannot modify any files outside this directory. This improves "
-#~ "resistence against crackers, too, as they are not able to modify system "
-#~ "files."
-#~ msgstr ""
-#~ "El MySQL es pot executar en una entorn tancat al directori /var/lib/"
-#~ "mysql_jail perquè els usuaris no puguin modificar cap fitxer fora del "
-#~ "directori.Aquesta opció també augmenta la seguretat envers els crackers, "
-#~ "jaque no poden modificar els fitxers del sistema."
diff --git a/storage/xtradb/build/debian/po/cs.po b/storage/xtradb/build/debian/po/cs.po
deleted file mode 100644
index 01d95723aa9..00000000000
--- a/storage/xtradb/build/debian/po/cs.po
+++ /dev/null
@@ -1,361 +0,0 @@
-#
-# Translators, if you are not familiar with the PO format, gettext
-# documentation is worth reading, especially sections dedicated to
-# this format, e.g. by running:
-# info -n '(gettext)PO Files'
-# info -n '(gettext)Header Entry'
-#
-# Some information specific to po-debconf are available at
-# /usr/share/doc/po-debconf/README-trans
-# or http://www.debian.org/intl/l10n/po-debconf/README-trans
-#
-# Developers do not need to manually edit POT or PO files.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-05-01 13:01+0200\n"
-"Last-Translator: Miroslav Kure <kurem@debian.cz>\n"
-"Language-Team: Czech <debian-l10n-czech@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr "Opravdu pokraÄovat v degradaci?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr "V systému existuje soubor /var/lib/mysql/debian-*.flag."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr "To znamená, že již byl nainstalován balík mysql-server s vyšší verzí."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-"Neexistuje žádná záruka, že momentálně instalovaná verze bude umět pracovat "
-"se stávajícími databázemi."
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr "Důležitá poznámka pro uživatele NIS/YP"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-"Abyste mohli MySQL používat, musíte v systému založit následující uživatele "
-"a skupiny:"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-"Také byste měli zkontrolovat vlastníka a oprávnění adresáře /var/lib/mysql:"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid "Remove all MySQL databases?"
-msgid "Remove all Percona SQL databases?"
-msgstr "Odstranit všechny MySQL databáze?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The /var/lib/mysql directory which contains the MySQL databases is about "
-#| "to be removed."
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-"Adresář /var/lib/mysql, ve kterém se nachází MySQL databáze, bude odstraněn."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "If you're removing the MySQL package in order to later install a more "
-#| "recent version or if a different mysql-server package is already using "
-#| "it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Jestliže odstraňujete balík MySQL za úÄelem instalace novÄ›jší verze MySQL, "
-"nebo pokud tato data souběžně využívá jiný balík mysql-server, měli byste "
-"data ponechat."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Start the MySQL server on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Spustit MySQL server při startu systému?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL server can be launched automatically at boot time or manually "
-#| "with the '/etc/init.d/mysql start' command."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL se může spouÅ¡tÄ›t automaticky pÅ™i startu systému, nebo ruÄnÄ› příkazem '/"
-"etc/init.d/mysql start'."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Nové heslo MySQL uživatele \"root\":"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "While not mandatory, it is highly recommended that you set a password for "
-#| "the MySQL administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"PÅ™estože to není nezbytné, je silnÄ› doporuÄeno nastavit heslo u "
-"správcovského MySQL úÄtu \"root\"."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr "Ponecháte-li pole prázdné, heslo se nezmění."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Nové heslo MySQL uživatele \"root\":"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for the MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Nelze nastavit heslo MySQL uživatele \"root\""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "An error occurred while setting the password for the MySQL administrative "
-#| "user. This may have happened because the account already has a password, "
-#| "or because of a communication problem with the MySQL server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Během nastavování hesla pro správcovského uživatele MySQL se vyskytla chyba. "
-"To se mohlo stát třeba proto, protože uživatel již měl heslo nastaveno, nebo "
-"protože nastal problém v komunikaci s MySQL serverem."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "You should check the account's password after tha package installation."
-msgid "You should check the account's password after the package installation."
-msgstr "Po instalaci balíku byste měli heslo ověřit."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
-#| "more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"Více informací naleznete v /usr/share/doc/mysql-server-5.1/README.Debian."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid "Cannot upgrade if ISAM tables are present!"
-#~ msgstr "Aktualizace nelze provést pokud jsou přítomny tabulky ISAM!"
-
-#~ msgid ""
-#~ "Recent versions of MySQL can no longer use the old ISAM table format and "
-#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by "
-#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". "
-#~ "The installation of mysql-server-5.1 will now abort. In case your old "
-#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert "
-#~ "those tables."
-#~ msgstr ""
-#~ "Poslední verze MySQL již nemohou používat starý formát tabulek ISAM a "
-#~ "před aktualizací je nutné převést tyto tabulky např. do formátu MyISAM "
-#~ "pomocí \"mysql_convert_table_format\" nebo \"ALTER TABLE x ENGINE=MyISAM"
-#~ "\". Instalace mysql-server-5.1 se nyní přeruší. V případě, že se mezitím "
-#~ "odinstaloval původní mysql-server-4.1, jednoduše jej znovu nainstalujte a "
-#~ "tabulky pÅ™eveÄte."
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Podporovat MySQL pÅ™ipojení z poÄítaÄů používajících Debian Sarge nebo "
-#~ "starší?"
-
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Způsob, jakým se dříve ukládala hesla, nebyl příliÅ¡ bezpeÄný. To se nyní "
-#~ "zlepšilo, ale nevýhodou je, že se klienti z Debianu 3.1 Sarge (např. PHP) "
-#~ "nebudou moci pÅ™ipojit na nové úÄty, nebo na úÄty, u nichž se heslo "
-#~ "změnilo."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "Abyste mohli mysql používat, musíte do následujících souborů přidat "
-#~ "ekvivalentního uživatele a skupinu a zajistit, že /var/lib/mysql má "
-#~ "správná práva (uid/gid se mohou lišit)."
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "Odstranit databáze používané všemi verzemi MySQL?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr "Nezadáte-li heslo, žádné zmÄ›ny se s úÄtem neprovedou."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "Po skonÄení instalace byste mÄ›li ověřit, že je úÄet chránÄ›n heslem (více "
-#~ "informací naleznete v souboru README.Debian)."
-
-#~ msgid "Update Hints"
-#~ msgstr "Poznámky k aktualizaci"
-
-#~ msgid ""
-#~ "You have to run \"mysql_upgrade\" after the upgrade, else tables can be "
-#~ "corrupted! This script also enhances the privilege tables but is not "
-#~ "supposed to give any user more rights that he had before,"
-#~ msgstr ""
-#~ "Po aktualizaci ještě musíte spustit \"mysql_upgrade\", protože jinak by "
-#~ "se tabulky mohly narušit! Tento skript také rozšiřuje tabulky privilegií, "
-#~ "ovšem neměl by uživatelům přidat více práv, než měli dosud."
-
-#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html"
-#~ msgstr "Také si pÅ™eÄtÄ›te http://www.mysql.com/doc/en/Upgrade.html"
-
-#~ msgid ""
-#~ "MySQL will only install if you have a non-numeric hostname that is "
-#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
-#~ "myhostname\"."
-#~ msgstr ""
-#~ "MySQL se nainstaluje pouze v případě, že používáte nenumerické jméno "
-#~ "poÄítaÄe, které se dá pÅ™eložit pÅ™es soubor /etc/hosts. NapÅ™. když příkaz "
-#~ "\"hostname\" vrátí \"diamond\", tak v /etc/hosts musí existovat obdobný "
-#~ "řádek jako \"10.0.0.1 diamond\"."
-
-#~ msgid ""
-#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
-#~ "is used in the start/stop and cron scripts. Don't delete."
-#~ msgstr ""
-#~ "Bude vytvoÅ™en nový mysql uživatel \"debian-sys-maint\". Tento mysql úÄet "
-#~ "se používá ve startovacích, ukonÄovacích a cronových skriptech. Nemažte "
-#~ "jej."
-
-#~ msgid ""
-#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /"
-#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in "
-#~ "there, never only the password!"
-#~ msgstr ""
-#~ "Nezapomeňte nastavit heslo pro úÄet administrátora MySQL! Používáte-li /"
-#~ "root/.my.cnf, vždy zde zadejte jak řádek \"user\", tak řádek \"password"
-#~ "\". Nikdy zde nezadávejte jenom heslo!"
-
-#~ msgid ""
-#~ "Should I remove the complete /var/lib/mysql directory tree which is used "
-#~ "by all MySQL versions, not necessarily only the one you are about to "
-#~ "purge?"
-#~ msgstr ""
-#~ "Mám odstranit kompletní adresářový strom /var/lib/mysql, který se používá "
-#~ "pro všechny verze MySQL, tedy ne nutně pouze pro verzi, kterou se "
-#~ "chystáte vyÄistit?"
diff --git a/storage/xtradb/build/debian/po/da.po b/storage/xtradb/build/debian/po/da.po
deleted file mode 100644
index a44088472a6..00000000000
--- a/storage/xtradb/build/debian/po/da.po
+++ /dev/null
@@ -1,397 +0,0 @@
-#
-# Translators, if you are not familiar with the PO format, gettext
-# documentation is worth reading, especially sections dedicated to
-# this format, e.g. by running:
-# info -n '(gettext)PO Files'
-# info -n '(gettext)Header Entry'
-# Some information specific to po-debconf are available at
-# /usr/share/doc/po-debconf/README-trans
-# or http://www.debian.org/intl/l10n/po-debconf/README-trans#
-# Developers do not need to manually edit POT or PO files.
-#
-# Claus Hindsgaul <claus_h@image.dk>, 2005, 2006.
-# Claus Hindsgaul <claus.hindsgaul@gmail.com>, 2006, 2007.
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-4.1\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-05-30 22:41+0200\n"
-"Last-Translator: Claus Hindsgaul <claus.hindsgaul@gmail.com>\n"
-"Language-Team: Danish\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=ISO-8859-1\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr "Ønsker du virkelig at fortsætte nedgraderingen?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-"Der er en fil med navnet /var/lib/mysql/debian-*.flag på dette system."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"Sådan en fil tyder på at der tidligere har været installeret en højere "
-"version af mysql-server-pakken."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-"Det kan ikke garanteres at den version, du er ved at installere, kan benytte "
-"data fra de eksisterende databaser."
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr "Vigtig oplysning til NIS/YP-brugere"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-"Nedenstående linjer for brugere og grupper skal tilføjes dette system for at "
-"benytte MySQL:"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-"Du bør også tjekke filrettighederne og ejerskabet af mappen /var/lib/mysql:"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid "Remove all MySQL databases?"
-msgid "Remove all Percona SQL databases?"
-msgstr "Fjern alle MySQL-databaser?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The /var/lib/mysql directory which contains the MySQL databases is about "
-#| "to be removed."
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-"Mappen /var/lib/mysql, der indeholder MySQL-databaserne, er ved at blive "
-"fjernet."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "If you're removing the MySQL package in order to later install a more "
-#| "recent version or if a different mysql-server package is already using "
-#| "it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Hvis du fjerner MySQL-pakken for senere at installere en nyere version, "
-"eller hvis en anden mysql-server-pakke allerede benytter den, bør dataene "
-"bevares."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Start the MySQL server on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Start MySQL-serveren under systemopstart?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL server can be launched automatically at boot time or manually "
-#| "with the '/etc/init.d/mysql start' command."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL-serveren kan enten startes op automatisk under systemopstarten, eller "
-"manuelt med kommandoen '/etc/init.d/mysql start'."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Ny adgangskode for MySQL's \"root\"-bruger:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "While not mandatory, it is highly recommended that you set a password for "
-#| "the MySQL administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Selvom det ikke kræves, anbefales det kraftigt, at du sætter en adgangskode "
-"for MySQL's administrationsbruger \"root\"."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr "Hvis du lader dette felt stå tomt, vil adgangskoden ikke blive ændret."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Ny adgangskode for MySQL's \"root\"-bruger:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for the MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Kunne ikke sætte adgangskoden for MySQL's \"root\"-bruger"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "An error occurred while setting the password for the MySQL administrative "
-#| "user. This may have happened because the account already has a password, "
-#| "or because of a communication problem with the MySQL server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Der opstod en fejl, da adgangskoden for MySQL's administrationsbruger blev "
-"forsøgt ændret. Dette kan være sket, fordi brugeren allerede har en "
-"adgangskode, eller fordi der var problemer med at kommunikere med MySQL-"
-"serveren."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr "Du bør tjekke kontoens adgangskode efter pakkeinstallationen."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
-#| "more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"Se filen /usr/share/doc/mysql-server-5.1/README.Debian for yderligere "
-"oplysninger."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid "Cannot upgrade if ISAM tables are present!"
-#~ msgstr "Kan ikke opgradere hvis der er ISAM-tabeller!"
-
-#~ msgid ""
-#~ "Recent versions of MySQL can no longer use the old ISAM table format and "
-#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by "
-#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". "
-#~ "The installation of mysql-server-5.1 will now abort. In case your old "
-#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert "
-#~ "those tables."
-#~ msgstr ""
-#~ "Nyere versioner af MySQL kan ikke længere benytte det gamle ISAM-"
-#~ "tabelformat, og det er derfor nødvendigt at konvertere dine tabeller til "
-#~ "f.eks. MyISAM forud for opgraderingen med \"mysql_convert_table_format\" "
-#~ "eller \"ALTER TABLE x ENGINE=MyISAM\". Installationen af mysql-server-5.1 "
-#~ "afbrydes nu. Skulle din gamle mysql-server-4.1 alligevel bliver "
-#~ "afinstalleret, så geninstallér den blot og konverter tabellerne."
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Understøt MySQL-forbindelser fra maskiner, der kører Debian \"Sarge\" "
-#~ "eller ældre?"
-
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Gamle udgaver af MySQL-klienter på Debian gemte ikke adgangskoderne "
-#~ "sikkert. Dette er blevet forbedret siden da, men klienter (f.eks. PHP) "
-#~ "fra maskiner, der kører Debian 3.1 Sarge vil ikke kunne forbinde til "
-#~ "nyere konti eller konti, hvis adgangskode er blevet ændret."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "For at kunne bruge mysql skal du installere en bruger og en gruppe, der "
-#~ "svarer til nedenstående, og sikre dig at /var/lib/mysql har de rigtige "
-#~ "adgangsrettigheder (uid/gid kan afvige)."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "Fjern de databaser, der benyttes af samtlige MySQL-versioner?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr "Hvis du ikke angiver en adgangskode, vil kontoen ikke blive ændret."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "Når installationen afsluttes, bør du tjekke at kontoen er ordentligt "
-#~ "beskyttet med en adgangskode (se README.Debian for yderligere "
-#~ "oplysninger)."
-
-#~ msgid "Update Hints"
-#~ msgstr "Opdateringstips"
-
-#~ msgid ""
-#~ "You have to run \"mysql_upgrade\" after the upgrade, else tables can be "
-#~ "corrupted! This script also enhances the privilege tables but is not "
-#~ "supposed to give any user more rights that he had before,"
-#~ msgstr ""
-#~ "Du skal køre \"mysql_upgrade\" efter opgraderingen, da tabellerne eller "
-#~ "kan blive ødelagt! Dette script forbedrer også rettighedstabellerne, men "
-#~ "burde ikke give nogen bruger flere rettigheder, end han havde tidligere,"
-
-#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html"
-#~ msgstr "Læs også http://www.mysql.com/doc/en/Upgrade.html"
-
-#~ msgid "Install Hints"
-#~ msgstr "Installationstips"
-
-#~ msgid ""
-#~ "On upgrades from MySQL 3.23, as shipped with Debian Woody, symlinks in "
-#~ "place of /var/lib/mysql or /var/log/mysql gets accidently removed and "
-#~ "have manually be restored."
-#~ msgstr ""
-#~ "Ved opgraderinger fra MySQL 3.23, der fulgte med Debian Woody, kan de "
-#~ "symbolske /var/lib/mysql or /var/log/mysql blive fjernet ved et uheld, og "
-#~ "må genskabes manuelt."
-
-#~ msgid ""
-#~ "MySQL will only install if you have a non-numeric hostname that is "
-#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
-#~ "myhostname\"."
-#~ msgstr ""
-#~ "MySQL vil kun blive installeret, hvis du har et ikke-numerisk værtsnavn, "
-#~ "som kan slås op i filen /ets/hosts. Hvis f.eks. kommandoen \"hostname\" "
-#~ "svarer med \"mitvaertsnavn\", skal du have en linje a'la \"10.0.0.1 "
-#~ "mitvaertsnavn\" i /etc/hosts."
-
-#~ msgid ""
-#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
-#~ "is used in the start/stop and cron scripts. Don't delete."
-#~ msgstr ""
-#~ "Det vil blive oprettet en ny mysql-bruger, \"debian-sys-maint\". Denne "
-#~ "mysql-konto bruges i start/stop-cron-scripterne. Slet den ikke."
-
-#~ msgid ""
-#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /"
-#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in "
-#~ "there, never only the password!"
-#~ msgstr ""
-#~ "Husk at sætte en ADGANGSKODE for MySQLs root-bruger! Hvis du bruger en /"
-#~ "etc/.my.cnf, så skriv altid \"user\"- og \"password\"-linjer ind her, "
-#~ "ikke kun adgangskoden!"
-
-#~ msgid ""
-#~ "Should I remove the complete /var/lib/mysql directory tree which is used "
-#~ "by all MySQL versions, not necessarily only the one you are about to "
-#~ "purge?"
-#~ msgstr ""
-#~ "Skal jeg fjerne hele mappetræet /var/lib/mysql, som benyttes af alle "
-#~ "MySQL-versioner, ikke kun den version, du er ved at slette?"
-
-#~ msgid ""
-#~ "Rarely, e.g. on new major versions, the privilege system is improved. To "
-#~ "make use of it mysql_fix_privilege_tables must be executed manually. The "
-#~ "script is not supposed to give any user more rights that he had before,"
-#~ msgstr ""
-#~ "En sjælden gang imellem, f.eks. ved nye hovedversioner, sker det at "
-#~ "rettighedssystemet forbedres. For at gøre brug af dette, skal "
-#~ "mysql_fix_privilege_tables køres manuelt. Scriptet vil ikke give nogen "
-#~ "bruger flere rettigheder, end vedkommende havde tidligere,"
diff --git a/storage/xtradb/build/debian/po/de.po b/storage/xtradb/build/debian/po/de.po
deleted file mode 100644
index c5dcdaff234..00000000000
--- a/storage/xtradb/build/debian/po/de.po
+++ /dev/null
@@ -1,277 +0,0 @@
-# translation of mysql-dfsg-5.1_5.0.41-2_de.po to german
-#
-# Translators, if you are not familiar with the PO format, gettext
-# documentation is worth reading, especially sections dedicated to
-# this format, e.g. by running:
-# info -n '(gettext)PO Files'
-# info -n '(gettext)Header Entry'
-# Some information specific to po-debconf are available at
-# /usr/share/doc/po-debconf/README-trans
-# or http://www.debian.org/intl/l10n/po-debconf/README-trans#
-# Developers do not need to manually edit POT or PO files.
-#
-# Alwin Meschede <ameschede@gmx.de>, 2006, 2007.
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1_5.0.41-2_de\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-05-29 16:05+0200\n"
-"Last-Translator: Alwin Meschede <ameschede@gmx.de>\n"
-"Language-Team: german <debian-l10n-german@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr "Möchten Sie wirklich eine ältere Version einspielen?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-"Auf diesem System existiert eine Datei mit dem Namen /var/lib/mysql/debian-*."
-"flag"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"Diese Datei ist ein Hinweis darauf, dass früher ein MySQL-Server-Paket mit "
-"einer höheren Version installiert war."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-"Es kann nicht garantiert werden, dass die gegenwärtig zu installierende "
-"Version dessen Daten benutzen kann."
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr "Wichtige Anmerkung für NIS/YP-Benutzer!"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-"Um MySQL benutzen zu können, sollten die folgenden Benutzer und Gruppen dem "
-"System hinzugefügt werden:"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-"Sie sollten außerdem Besitzer und Zugriffsrechte des Verzeichnisses /var/lib/"
-"mysql überprüfen:"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid "Remove all MySQL databases?"
-msgid "Remove all Percona SQL databases?"
-msgstr "Alle MySQL-Datenbanken entfernen?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The /var/lib/mysql directory which contains the MySQL databases is about "
-#| "to be removed."
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-"Das Verzeichnis /var/lib/mysql mit den MySQL-Datenbanken soll entfernt "
-"werden."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "If you're removing the MySQL package in order to later install a more "
-#| "recent version or if a different mysql-server package is already using "
-#| "it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Falls geplant ist, nur eine höhere Version von MySQL zu installieren oder "
-"ein anderes mysql-server-Paket dieses bereits benutzt, sollten die Daten "
-"behalten werden."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Start the MySQL server on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Soll MySQL automatisch beim Booten starten?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL server can be launched automatically at boot time or manually "
-#| "with the '/etc/init.d/mysql start' command."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"Der MySQL-Dienst kann entweder automatisch beim Systemstart oder manuell "
-"durch Eingabe des Befehls »/etc/init.d/mysql start« gestartet werden."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Neues Passwort für den MySQL »root«-Benutzer:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "While not mandatory, it is highly recommended that you set a password for "
-#| "the MySQL administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Obwohl es nicht zwingend erforderlich ist, wird nachdrücklich empfohlen für "
-"den administrativen MySQL »root«-Benutzer ein Passwort zu setzen."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr "Wenn dieses Feld freigelassen wird, wird das Passwort nicht geändert."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Neues Passwort für den MySQL »root«-Benutzer:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for the MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Konnte für den MySQL-»root«-Benutzer kein Passwort setzen"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "An error occurred while setting the password for the MySQL administrative "
-#| "user. This may have happened because the account already has a password, "
-#| "or because of a communication problem with the MySQL server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Beim setzen des Passworts für den administrativen MySQL-Benutzer ist ein "
-"Fehler aufgetreten. Dies könnte daran liegen, dass der Benutzer bereits ein "
-"Passwort hat oder dass es ein Problem mit der Kommunikation mit dem MySQL-"
-"Server gibt."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-"Sie sollten das Passwort des administrativen Benutzers nach der "
-"Paketinstallation prüfen."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
-#| "more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"Für weitere Informationen lesen Sie /usr/share/doc/mysql-server-5.1/README."
-"Debian"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Sollen MySQL-Verbindungen von Rechnern mit Debian »Sarge« oder älter "
-#~ "unterstützt werden?"
-
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Alte Versionen der MySQL-Clients für Debian speicherten Passwörter nicht "
-#~ "sehr sicher. Dies wurde verbessert, allerdings werden Clients (z. B. PHP) "
-#~ "von Hosts mit Debian 3.1 Sarge sich nicht mehr mit MySQL-Konten verbinden "
-#~ "können, die neu angelegt werden oder deren Passwort geändert wird. Siehe "
-#~ "auch /usr/share/doc/mysql-server-5.1/README.Debian."
diff --git a/storage/xtradb/build/debian/po/es.po b/storage/xtradb/build/debian/po/es.po
deleted file mode 100644
index a37942fd59d..00000000000
--- a/storage/xtradb/build/debian/po/es.po
+++ /dev/null
@@ -1,405 +0,0 @@
-# mysql-dfsg-5 translation to spanish
-# Copyright (C) 2005-2007 Software in the Public Interest, SPI Inc.
-# This file is distributed under the same license as the XXXX package.
-#
-# Changes:
-# - Initial translation
-# Jesus Aneiros, 2006
-# - Updated
-# Javier Fernandez-Sanguino, 2006-2007
-# - Revision
-# Nacho Barrientos Arias
-# Fernando Cerezal
-# David Martínez Moreno
-# Ricardo Mones
-# Carlos Galisteo
-# Javier Fernandez-Sanguino
-#
-#
-# Traductores, si no conoce el formato PO, merece la pena leer la
-# documentación de gettext, especialmente las secciones dedicadas a este
-# formato, por ejemplo ejecutando:
-# info -n '(gettext)PO Files'
-# info -n '(gettext)Header Entry'
-#
-# Equipo de traducción al español, por favor lean antes de traducir
-# los siguientes documentos:
-#
-# - El proyecto de traducción de Debian al español
-# http://www.debian.org/intl/spanish/
-# especialmente las notas y normas de traducción en
-# http://www.debian.org/intl/spanish/notas
-#
-# - La guía de traducción de po's de debconf:
-# /usr/share/doc/po-debconf/README-trans
-# o http://www.debian.org/intl/l10n/po-debconf/README-trans
-#
-# Si tiene dudas o consultas sobre esta traducción consulte con el último
-# traductor (campo Last-Translator) y ponga en copia a la lista de
-# traducción de Debian al español (<debian-l10n-spanish@lists.debian.org>)
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1_5.0.24-3\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-05-28 22:21+0200\n"
-"Last-Translator: Javier Fernández-Sanguino <jfs@debian.org>\n"
-"Language-Team: Debian l10 Spanish <debian-l10n-spanish@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr "¿Desea realmente continuar con la desactualización?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-"Existe un archivo con el nombre /var/lib/mysql/debian-*.flag en este sistema."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"Este fichero indica que se instaló previamente una versión superior del "
-"paquete mysql-server."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-"No se puede garantizar que la versión que está instalando pueda usar la base "
-"de datos actual."
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr "Nota importante para los usuarios de NIS/YP"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-"Deben añadirse las siguientes entradas para usuarios y grupos en el sistema "
-"para poder utilizar MySQL:"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-"También debería comprobar los permisos y el propietario del directorio /var/"
-"lib/mysql:"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid "Remove all MySQL databases?"
-msgid "Remove all Percona SQL databases?"
-msgstr "¿Desea eliminar todas las bases de datos MySQL?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The /var/lib/mysql directory which contains the MySQL databases is about "
-#| "to be removed."
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-"El directorio /var/lib/mysql contiene bases de datos MySQL que van a "
-"eliminarse."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "If you're removing the MySQL package in order to later install a more "
-#| "recent version or if a different mysql-server package is already using "
-#| "it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Debería mantener los datos si tiene planificado instalar una versión de "
-"MySQL más reciente o si hay un paquete «mysql-server» distinto que los está "
-"utilizando."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Start the MySQL server on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "¿Debería ejecutarse el servidor MySQL al iniciarse el sistema?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL server can be launched automatically at boot time or manually "
-#| "with the '/etc/init.d/mysql start' command."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"El servidor MySQL puede iniciarse en el momento de arranque del sistema o "
-"manualmente si escribe la orden «/etc/init.d/mysql start»."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Nueva contraseña para el usuario «root» de MySQL:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "While not mandatory, it is highly recommended that you set a password for "
-#| "the MySQL administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Se recomienda que configure una contraseña para el usuario "
-"«root» (administrador) de MySQL, aunque no es obligatorio."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr "No se modificará la contraseña si deja el espacio en blanco."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Nueva contraseña para el usuario «root» de MySQL:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for the MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "No se pudo fijar la contraseña para el usuario «root» de MySQL"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "An error occurred while setting the password for the MySQL administrative "
-#| "user. This may have happened because the account already has a password, "
-#| "or because of a communication problem with the MySQL server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Se produjo un error mientras intentaba fijar la contraseña para el usuario "
-"administrador de MySQL. Esto puede haber sucedido porque la cuenta ya tenía "
-"una contraseña o porque se produjo un error de comunicación con el servidor "
-"MySQL."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-"Debería comprobar la contraseña de la cuenta después de la instalación del "
-"paquete."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
-#| "more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"Consulte /usr/share/doc/mysql-server-5.1/README.Debian para más información."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid "Cannot upgrade if ISAM tables are present!"
-#~ msgstr "¡No se puede actualizar si ya hay tablas ISAM!"
-
-#~ msgid ""
-#~ "Recent versions of MySQL can no longer use the old ISAM table format and "
-#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by "
-#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". "
-#~ "The installation of mysql-server-5.1 will now abort. In case your old "
-#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert "
-#~ "those tables."
-#~ msgstr ""
-#~ "Las versiones recientes de MySQL ya no soportan el antiguo formato de "
-#~ "tabla ISAM. Antes de realizar la actualización es necesario convertir sus "
-#~ "tablas a por ejemplo, MyISAM, usando «mysql_convert_table_format» o «ALTER "
-#~ "TABLE x ENGINE=MyISAM». Se va a interrumpir ahora la instalación de mysql-"
-#~ "server-5.1. Si aún así su mysql-server-4.1 se elimina aún así, puede "
-#~ "reinstalarlo para convertir ese tipo de tablas."
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "¿Soportar las conexiones MySQL establecidadas desde sistemas que ejecutan "
-#~ "Debian Sarge o versiones anteriores?"
-
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "No era muy segura la forma en la que se almacenaban las contraseñas en "
-#~ "versiones anteriores del cliente de MySQL en Debian. Este problema se ha "
-#~ "mejorado posteriormente con el inconveniente, sin embargo, de que "
-#~ "clientes (por ejemplo, PHP) en sistemas que ejecutan Debian 3.1 «Sarge» no "
-#~ "podrán conectarse a cuentas que son nuevas o a las que se le haya "
-#~ "cambiado la contraseña."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "Para utilizar mysql debe instalar un usuario y grupo equivalente al "
-#~ "siguiente y asegurarse de que /var/lib/mysql tiene los permisos correctos "
-#~ "(los valores del «uid» y del «gid» pueden ser diferentes)."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr ""
-#~ "¿Eliminar las bases de datos utilizadas por todas las versiones de MySQL?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr ""
-#~ "No se hará ningún cambio en la cuenta si no introduce una contraseña."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "Debería confirmar que la contraseña está correctamente protegida con una "
-#~ "contraseña cuando termine la instalación (consulte el fichero README."
-#~ "Debian si desea más información)."
-
-#~ msgid "Install Hints"
-#~ msgstr "Sugerencias para la instalación"
-
-#~ msgid ""
-#~ "On upgrades from MySQL 3.23, as shipped with Debian Woody, symlinks in "
-#~ "place of /var/lib/mysql or /var/log/mysql gets accidently removed and "
-#~ "have manually be restored."
-#~ msgstr ""
-#~ "Al actualizar a la versión de MySQL 3.23, la vrsión proporcionada en "
-#~ "Debian Woody, se eliminan de manera accidental, los enlaces simbólicos a «/"
-#~ "var/lib/mysql» o «/var/log/mysql» y tienen que restaurarse manualmente."
-
-#~ msgid ""
-#~ "MySQL will only install if you have a non-numeric hostname that is "
-#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
-#~ "myhostname\"."
-#~ msgstr ""
-#~ "Sólo se instalará MySQL si tiene un nombre de equipo que no sea una "
-#~ "dirección IP y pueda resolverse a través del archivo /etc/hosts. Por "
-#~ "ejemplo, si la orden «hostname» devuelve «MiNombreEquipo» entonces deberá "
-#~ "existir una línea «10.0.0.1 MiNombreEquipo» en dicho archivo."
-
-#~ msgid ""
-#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
-#~ "is used in the start/stop and cron scripts. Don't delete."
-#~ msgstr ""
-#~ "Se creará un nuevo usuario «debian-sys-maint». Esta cuenta de mysql se "
-#~ "utilizará en los scripts de inicio y parada y en los scripts «cron». No la "
-#~ "elimine."
-
-#~ msgid ""
-#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /"
-#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in "
-#~ "there, never only the password!"
-#~ msgstr ""
-#~ "¡Por favor, recuerde crear una CONTRASEÑA para el usuario «root» de MySQL! "
-#~ "¡Si utiliza /root/.my.cnf debe escribir las líneas «user» y «password» en "
-#~ "dicho archivo, no incluya sólo la contraseña!"
-
-#~ msgid ""
-#~ "Should I remove the complete /var/lib/mysql directory tree which is used "
-#~ "by all MySQL versions, not necessarily only the one you are about to "
-#~ "purge?"
-#~ msgstr ""
-#~ "¿Debería eliminar el árbol de directorio /var/lib/mysql completo? Tenga "
-#~ "en cuenta que lo utilizan todas las versiones de MySQL y no sólo la que "
-#~ "está a punto de purgar."
diff --git a/storage/xtradb/build/debian/po/eu.po b/storage/xtradb/build/debian/po/eu.po
deleted file mode 100644
index b091e6c01cf..00000000000
--- a/storage/xtradb/build/debian/po/eu.po
+++ /dev/null
@@ -1,295 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Piarres BEobide <pi@beobide.net>, 2006.
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1_5.0.26-3-debconf_eu\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-02-19 09:33+0100\n"
-"Last-Translator: Piarres Beobide <pi@beobide.net>\n"
-"Language-Team: Euskara <Librezale@librezale.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Generator: Pootle 0.10.1\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid "Do you really want to downgrade?"
-msgid "Really proceed with downgrade?"
-msgstr "Benetan bertsio zaharragora itzuli nahi duzu?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid ""
-#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates "
-#| "that a mysql-server package with a higher version has been installed "
-#| "before. It can not be guaranteed that this version can use its data."
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"Oharra: /var/lib/mysql/debian-*.flag dago.. Honek aurretik bertsio "
-"berriagoko mysql-zerbitzari bat instalatu dela adierazten du. Ezin da "
-"ziurtatu bertsio honek datu horiek erabili ahal izango dituenik."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-#, fuzzy
-#| msgid "Important note for NIS/YP users!"
-msgid "Important note for NIS/YP users"
-msgstr "NIS/YP erabiltzaileentzat ohar garrantzitsua!"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid "Remove all Percona SQL databases?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The script is about to remove the data directory /var/lib/mysql. If it is "
-#| "planned to just install a higher MySQL version or if a different mysql-"
-#| "server package is already using it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Script-a /var/lib/mysql data direktorioa ezabatzera doa. MySQL bertsio "
-"berriago bat instalatu behar bada edo beste mysql-server pakete bat berau "
-"erabiltzen ari bada, datuak mantendu egingo dira."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Should MySQL start on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Sistema abiaraztean MySQL abiarazi behar al da?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL can start automatically on boot time or only if you manually "
-#| "type '/etc/init.d/mysql start'."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL abiaraztean automatikoki abiarazi daiteke edo eskuz /etc/init.d/mysql "
-"start' eginaz."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "MySQL \"root\" erabiltzailearen pasahitz berria:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "It is highly recommended that you set a password for the MySQL "
-#| "administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Oso gomendagarria da MySQL administratzaile \"root\" erabiltzaileari "
-"pasahitz bat ezartzea."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "MySQL \"root\" erabiltzailearen pasahitz berria:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Ezinda MySQL \"root\" erabiltzailearen pasahitza ezarri"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "It seems an error occurred while setting the password for the MySQL "
-#| "administrative user. This may have happened because the user already has "
-#| "a password, or because there was a problem communicating with the MySQL "
-#| "server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Dirudienez errore bat gertatu da MySQL administratzaile kontuaren pasahitza "
-"ezartzean. Hau erabiltzaileak dagoeneko pasahitz bat duelako edo MySQL "
-"zerbitzariarekiko konexioan erroreak daudelako gertatu daiteke."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Debian \"sarge\" edo zaharragoak erabiltzen duten ostalarietatik MySQL "
-#~ "konexioak onartu?"
-
-#, fuzzy
-#~| msgid ""
-#~| "The way passwords were stored was not very secure. This has been "
-#~| "improved with the drawback that clients (e.g. PHP) from hosts running "
-#~| "Debian 3.1 Sarge will not be able to connect to account which are new or "
-#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/"
-#~| "README.Debian."
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Pasahitzak biltegiratzeko modua ez da oso ziurra. Hau hobetua izan da "
-#~ "baina Debian 3.1 Sarge erabiltzaileak ezingo dira kontu berri edo "
-#~ "pasahitza aldatu duten kontuetara konektatu. Begiratu /usr/share/doc/"
-#~ "mysql-server-5.1/README.Debian argibide gehiagorako."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "Mysql erabili ahal izateko beharrezko erabiltzaile eta taldea sortu eta /"
-#~ "var/lib/mysql-ek beharrezko baimenak dituela ziurtatu behar duzu (uid/gid-"
-#~ "a ezberdina izan daiteke)"
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "MySQL bertsio guztiek erabilitako databaseak ezabatu?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr "Ez baduzu pasahitzik ezartzen ez da aldaketarik egingo kontuan."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "Instalazio amaitzean, kontua pasahitzez babesturik dagoela ziurtatu "
-#~ "beharko zenuke (README.Debian irakurri xehetasun gehiagotarako)"
diff --git a/storage/xtradb/build/debian/po/fr.po b/storage/xtradb/build/debian/po/fr.po
deleted file mode 100644
index b4dcce8658b..00000000000
--- a/storage/xtradb/build/debian/po/fr.po
+++ /dev/null
@@ -1,274 +0,0 @@
-# translation of fr.po to French
-# Translators, if you are not familiar with the PO format, gettext
-# documentation is worth reading, especially sections dedicated to
-# this format, e.g. by running:
-# info -n '(gettext)PO Files'
-# info -n '(gettext)Header Entry'
-#
-# Some information specific to po-debconf are available at
-# /usr/share/doc/po-debconf/README-trans
-# or http://www.debian.org/intl/l10n/po-debconf/README-trans
-#
-# Developers do not need to manually edit POT or PO files.
-#
-# Christian Perrier <bubulle@debian.org>, 2004, 2006, 2007.
-msgid ""
-msgstr ""
-"Project-Id-Version: fr\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-04-19 22:43+0200\n"
-"Last-Translator: Christian Perrier <bubulle@debian.org>\n"
-"Language-Team: French <debian-l10n-french@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"debian.org>\n"
-"X-Generator: KBabel 1.11.4\n"
-"Plural-Forms: Plural-Forms: nplurals=2; plural=n>1;\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr "Faut-il vraiment revenir à la version précédente ?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr "Un fichier /var/lib/mysql/debian-*.flag est présent sur ce système."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"Cela indique qu'une version plus récente du paquet mysql-server a été "
-"précédemment installée."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr "Il n'est pas garanti que cette version puisse en utiliser les données."
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr "Note importante pour les utilisateurs NIS/YP"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-"Pour pouvoir utiliser MySQL, les utilisateurs et les groupes suivants "
-"doivent être ajoutés au système :"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-"Vous devez également vérifier le propriétaire et les permissions du "
-"répertoire /var/lib/mysql :"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid "Remove all MySQL databases?"
-msgid "Remove all Percona SQL databases?"
-msgstr "Faut-il supprimer toutes les bases de données MySQL ?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The /var/lib/mysql directory which contains the MySQL databases is about "
-#| "to be removed."
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-"Le répertoire /var/lib/mysql qui contient les bases de données de MySQL va "
-"être supprimé."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "If you're removing the MySQL package in order to later install a more "
-#| "recent version or if a different mysql-server package is already using "
-#| "it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Si vous prévoyez d'installer une version plus récente de MySQL ou si un "
-"autre paquet mysql-server les utilise déjà, vous devriez les conserver."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Start the MySQL server on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Faut-il lancer MySQL au démarrage ?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL server can be launched automatically at boot time or manually "
-#| "with the '/etc/init.d/mysql start' command."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL peut être lancé soit au démarrage, soit en entrant la commande « /etc/"
-"init.d/mysql start »."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Nouveau mot de passe du superutilisateur de MySQL :"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "While not mandatory, it is highly recommended that you set a password for "
-#| "the MySQL administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Il est très fortement recommandé d'établir un mot de passe pour le compte "
-"d'administration de MySQL (« root »)."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr "Si ce champ est laissé vide, le mot de passe ne sera pas changé."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Nouveau mot de passe du superutilisateur de MySQL :"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for the MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr ""
-"Impossible de changer le mot de passe de l'utilisateur « root » de MySQL"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "An error occurred while setting the password for the MySQL administrative "
-#| "user. This may have happened because the account already has a password, "
-#| "or because of a communication problem with the MySQL server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Une erreur s'est produite lors du changement de mot de passe du compte "
-"d'administration. Un mot de passe existait peut-être déjà ou il n'a pas été "
-"possible de communiquer avec le serveur MySQL."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-"Vous devriez vérifier le mot de passe de ce compte après l'installation du "
-"paquet."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
-#| "more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"Veuillez consulter le fichier /usr/share/doc/mysql-server-5.1/README.Debian "
-"pour plus d'informations."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Gérer les connexions d'hôtes qui utilisent les versions Debian « sarge » "
-#~ "ou antérieures  ?"
-
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "La méthode de stockage des mots de passe n'était pas très sûre dans les "
-#~ "version précédentes de ce paquet. Cette méthode a été améliorée mais les "
-#~ "modifications empêchent la connexion avec de nouveaux comptes ou des "
-#~ "comptes dont le mot de passe a été modifié, pour les clients (p. ex. PHP) "
-#~ "depuis des hôtes qui utilisent Debian 3.1 « sarge »."
diff --git a/storage/xtradb/build/debian/po/gl.po b/storage/xtradb/build/debian/po/gl.po
deleted file mode 100644
index ef845649f18..00000000000
--- a/storage/xtradb/build/debian/po/gl.po
+++ /dev/null
@@ -1,264 +0,0 @@
-# Galician translation of mysql-dfsg-5.1's debconf templates
-# This file is distributed under the same license as the mysql-dfsg-5.1 package.
-# Jacobo Tarrio <jtarrio@debian.org>, 2007.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-04-20 09:44+0200\n"
-"Last-Translator: Jacobo Tarrio <jtarrio@debian.org>\n"
-"Language-Team: Galician <proxecto@trasno.net>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr "¿Quere pasar a unha versión anterior?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr "Neste sistema hai un ficheiro chamado /var/lib/mysql/debian-*.flag."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"Este ficheiro indica que antes se instalou un paquete mysql-server cunha "
-"versión superior."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-"Non se pode garantir que a versión que está a instalar poida empregar as "
-"bases de datos actuais."
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr "Nota importante para os usuarios de NIS/YP"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-"Para empregar MySQL deberían engadirse ao sistema as seguintes entradas de "
-"usuarios e grupos:"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-"Tamén debería comprobar os permisos e o propietario do directorio /var/lib/"
-"mysql:"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid "Remove all MySQL databases?"
-msgid "Remove all Percona SQL databases?"
-msgstr "¿Eliminar tódalas bases de datos de MySQL?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The /var/lib/mysql directory which contains the MySQL databases is about "
-#| "to be removed."
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-"Hase eliminar o directorio /var/lib/mysql, que contén as bases de datos de "
-"MySQL."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "If you're removing the MySQL package in order to later install a more "
-#| "recent version or if a different mysql-server package is already using "
-#| "it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Se está a eliminar o paquete MySQL para instalar despois unha versión máis "
-"recente ou se xa hai un paquete mysql-server diferente a empregalo, debería "
-"conservar os datos."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Start the MySQL server on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "¿Iniciar o servidor MySQL co ordenador?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL server can be launched automatically at boot time or manually "
-#| "with the '/etc/init.d/mysql start' command."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"Pódese iniciar automaticamente o servidor MySQL ao iniciar o ordenador, ou "
-"manualmente coa orde \"/etc/init.d/mysql start\"."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Novo contrasinal para o usuario \"root\" de MySQL:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "While not mandatory, it is highly recommended that you set a password for "
-#| "the MySQL administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Aínda que non é obrigatorio, recoméndase encarecidamente que estableza un "
-"contrasinal para o usuario administrativo \"root\" de MySQL."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr "Se deixa o campo en branco, non se ha cambiar o contrasinal."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Novo contrasinal para o usuario \"root\" de MySQL:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for the MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Non se puido establecer o contrasinal do usuario \"root\" de MySQL"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "An error occurred while setting the password for the MySQL administrative "
-#| "user. This may have happened because the account already has a password, "
-#| "or because of a communication problem with the MySQL server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Houbo un erro ao establecer o contrasinal do usuario administrativo de "
-"MySQL. Puido ocorrer porque o usuario xa teña un contrasinal ou debido a un "
-"problema de comunicacións co servidor MySQL."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "You should check the account's password after tha package installation."
-msgid "You should check the account's password after the package installation."
-msgstr "Debería comprobar o contrasinal da conta trala instalación do paquete."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
-#| "more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"Consulte o ficheiro /usr/share/doc/mysql-server-5.1/README.Debian para máis "
-"información."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "¿Soportar as conexións a MySQL de máquinas que empreguen Debian \"sarge\" "
-#~ "ou anterior?"
-
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Nas versións antigas dos clientes MySQL de Debian, os contrasinais non se "
-#~ "armacenaban de xeito seguro. Isto mellorouse desde aquela; nembargantes, "
-#~ "os clientes (tales coma PHP) das máquinas que executen Debian 3.1 Sarge "
-#~ "non se han poder conectar a contas recentes ou a contas nas que se "
-#~ "cambiara o contrasinal."
diff --git a/storage/xtradb/build/debian/po/it.po b/storage/xtradb/build/debian/po/it.po
deleted file mode 100644
index 405709d60c3..00000000000
--- a/storage/xtradb/build/debian/po/it.po
+++ /dev/null
@@ -1,266 +0,0 @@
-# Italian (it) translation of debconf templates for mysql-dfsg-5.1
-# Copyright (C) 2006 Software in the Public Interest
-# This file is distributed under the same license as the mysql-dfsg-5.1 package.
-# Luca Monducci <luca.mo@tiscali.it>, 2006, 2007.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1 5.0.38 italian debconf templates\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-04-22 15:43+0200\n"
-"Last-Translator: Luca Monducci <luca.mo@tiscali.it>\n"
-"Language-Team: Italian <debian-l10n-italian@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr "Procedere realmente con l'abbassamento di versione?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-"Su questo sistema esiste un file con nome /var/lib/mysql/debian-*.flag."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"Quel file indica che in precedenza è stata installata una versione superiore "
-"del pacchetto mysql-server."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-"Non è garantito che la versione che si sta installando sia in grado di usare "
-"i database presenti."
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr "Nota importante per gli utenti NIS/YP"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-"Per usare MySQL i seguenti utenti e gruppi devono essere aggiunti al sistema:"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-"Inoltre si devono verificare i permessi e il proprietario della directory /"
-"var/lib/mysql:"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid "Remove all MySQL databases?"
-msgid "Remove all Percona SQL databases?"
-msgstr "Eliminare tutti i database MySQL?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The /var/lib/mysql directory which contains the MySQL databases is about "
-#| "to be removed."
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-"La directory /var/lib/mysql contenente i database di MySQL sta per essere "
-"eliminata."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "If you're removing the MySQL package in order to later install a more "
-#| "recent version or if a different mysql-server package is already using "
-#| "it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Se si rimuove il pacchetto MySQL per poi installare una versione più recente "
-"oppure se sono già in uso da un altro pacchetto mysql-server, i dati non "
-"devono essere eliminati."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Start the MySQL server on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Lanciare il server MySQL all'avvio?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL server can be launched automatically at boot time or manually "
-#| "with the '/etc/init.d/mysql start' command."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"Il server MySQL può essere lanciato automaticamente all'avvio del sistema "
-"oppure manualmente con il comando «/etc/init.d/mysql start»."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Nuova password per l'utente «root» di MySQL:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "While not mandatory, it is highly recommended that you set a password for "
-#| "the MySQL administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Sebbene non sia obbligatoria, si raccomanda d'impostare una password per "
-"l'utente d'amministrazione «root» di MySQL."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr "Se questo campo è lasciato vuoto, la password non viene cambiata."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Nuova password per l'utente «root» di MySQL:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for the MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Impossibile impostare la password per l'utente «root» di MySQL"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "An error occurred while setting the password for the MySQL administrative "
-#| "user. This may have happened because the account already has a password, "
-#| "or because of a communication problem with the MySQL server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Si è verificato un errore durante l'impostazione della password per l'utente "
-"d'amministrazione di MySQL. Questo può essere accaduto perché l'utente ha "
-"già una password oppure a causa di un problema di connessione con il server "
-"MySQL."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "You should check the account's password after tha package installation."
-msgid "You should check the account's password after the package installation."
-msgstr ""
-"Al termine dell'installazione si deve verificare la password dell'account."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
-#| "more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"Per maggiori informazioni si consulti il file /usr/share/doc/mysql-server-"
-"5.1/README.Debian."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Supporto a connessioni MySQL da macchine con Debian «sarge» o antecedente"
-
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Nelle precedenti versioni dei client MySQL su Debian le password non "
-#~ "erano memorizzate in modo sicuro. Questo è stato migliorato ma i client "
-#~ "(per esempio PHP) presenti su una macchina con Debian 3.1 Sarge non sono "
-#~ "più in grado di connettersi a un nuovo account né ad account le cui "
-#~ "password siano state cambiate."
diff --git a/storage/xtradb/build/debian/po/ja.po b/storage/xtradb/build/debian/po/ja.po
deleted file mode 100644
index 16af16b4d9f..00000000000
--- a/storage/xtradb/build/debian/po/ja.po
+++ /dev/null
@@ -1,394 +0,0 @@
-#
-# Translators, if you are not familiar with the PO format, gettext
-# documentation is worth reading, especially sections dedicated to
-# this format, e.g. by running:
-# info -n '(gettext)PO Files'
-# info -n '(gettext)Header Entry'
-#
-# Some information specific to po-debconf are available at
-# /usr/share/doc/po-debconf/README-trans
-# or http://www.debian.org/intl/l10n/po-debconf/README-trans
-#
-# Developers do not need to manually edit POT or PO files.
-#
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1 5.0.32-6\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-02-18 22:25+0900\n"
-"Last-Translator: Hideki Yamane (Debian-JP) <henrich@debian.or.jp>\n"
-"Language-Team: Japanese <debian-japanese@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid "Do you really want to downgrade?"
-msgid "Really proceed with downgrade?"
-msgstr "本当ã«ãƒ€ã‚¦ãƒ³ã‚°ãƒ¬ãƒ¼ãƒ‰ã—ã¾ã™ã‹?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid ""
-#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates "
-#| "that a mysql-server package with a higher version has been installed "
-#| "before. It can not be guaranteed that this version can use its data."
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"警告: /var/lib/mysql/debian-*.flag ファイルãŒå­˜åœ¨ã—ã¦ã„ã¾ã™ã€‚ã“ã‚Œã¯ã€ä»¥å‰ã«ã‚ˆ"
-"ã‚Šæ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® mysql-server パッケージãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•ã‚Œã¦ã„ãŸã“ã¨ã‚’示"
-"ã—ã¾ã™ã€‚データをã“ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã§ä½¿ãˆã‚‹ã‹ã©ã†ã‹ã€ä¿è¨¼ã§ãã¾ã›ã‚“。"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-#, fuzzy
-#| msgid "Important note for NIS/YP users!"
-msgid "Important note for NIS/YP users"
-msgstr "NIS/YP ユーザã¸é‡è¦ãªæ³¨æ„!"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid "Remove all Percona SQL databases?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The script is about to remove the data directory /var/lib/mysql. If it is "
-#| "planned to just install a higher MySQL version or if a different mysql-"
-#| "server package is already using it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"ã“ã®ã‚¹ã‚¯ãƒªãƒ—トã¯ãƒ‡ãƒ¼ã‚¿ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒª /var/lib/mysql を削除ã™ã‚‹ãŸã‚ã®ã‚‚ã®ã§"
-"ã™ã€‚å˜ã«æ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® MySQL をインストールã—よã†ã¨ã—ã¦ã„ã‚‹ã€ã‚ã‚‹ã„ã¯åˆ¥"
-"ã® mysql-server パッケージを既ã«ä½¿ã£ã¦ã„ã‚‹å ´åˆã€ãƒ‡ãƒ¼ã‚¿ã¯ä¿æŒã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾"
-"ã™ã€‚"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Should MySQL start on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "MySQL をシステム起動時ã«é–‹å§‹ã—ã¾ã™ã‹?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL can start automatically on boot time or only if you manually "
-#| "type '/etc/init.d/mysql start'."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL ã®èµ·å‹•æ–¹æ³•ã«ã¤ã„ã¦ã€ã‚·ã‚¹ãƒ†ãƒ èµ·å‹•æ™‚ã«è‡ªå‹•çš„ã«é–‹å§‹ã™ã‚‹ã‹ã€ã‚ã‚‹ã„㯠'/etc/"
-"init.d/mysql start' ã¨æ‰‹ã§å…¥åŠ›ã—ãŸæ™‚ã®ã¿èµ·å‹•ã™ã‚‹ã‹ã‚’é¸ã¹ã¾ã™ã€‚"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "MySQL ã® \"root\" ユーザã«å¯¾ã™ã‚‹æ–°ã—ã„パスワード:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "It is highly recommended that you set a password for the MySQL "
-#| "administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"MySQL を管ç†ã™ã‚‹ \"root\" ユーザã®ãƒ‘スワードを設定ã™ã‚‹ã“ã¨ã‚’å¼·ããŠå‹§ã‚ã—ã¾"
-"ã™ã€‚"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "MySQL ã® \"root\" ユーザã«å¯¾ã™ã‚‹æ–°ã—ã„パスワード:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "MySQL ã® \"root\" ユーザã®ãƒ‘スワードを設定ã§ãã¾ã›ã‚“"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "It seems an error occurred while setting the password for the MySQL "
-#| "administrative user. This may have happened because the user already has "
-#| "a password, or because there was a problem communicating with the MySQL "
-#| "server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"MySQL ã®ç®¡ç†è€…ユーザã«å¯¾ã—ã¦ãƒ‘スワードを設定ã—よã†ã¨ã—ãŸéš›ã€ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ãŸ"
-"よã†ã§ã™ã€‚ã“ã‚Œã¯æ—¢ã«ç®¡ç†è€…ユーザã«ãƒ‘スワードãŒè¨­å®šã•ã‚Œã¦ã„ãŸã‹ã€MySQL サーãƒ"
-"ã¨ã®æŽ¥ç¶šã«å•é¡ŒãŒã‚ã£ãŸãŸã‚ã ã¨æ€ã‚ã‚Œã¾ã™ã€‚"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "See /usr/share/doc/mysql-server-5.1/README.Debian for more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"詳細㯠/usr/share/doc/mysql-server-5.1/README.Debian ã‚’å‚ç…§ã—ã¦ãã ã•ã„。"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid "Cannot upgrade if ISAM tables are present!"
-#~ msgstr "ISAM テーブルãŒã‚ã‚‹å ´åˆã¯ã‚¢ãƒƒãƒ—グレードã§ãã¾ã›ã‚“!"
-
-#~ msgid ""
-#~ "Recent versions of MySQL can no longer use the old ISAM table format and "
-#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by "
-#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". "
-#~ "The installation of mysql-server-5.1 will now abort. In case your old "
-#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert "
-#~ "those tables."
-#~ msgstr ""
-#~ "MySQL ã®æœ€è¿‘ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã§ã¯ä»¥å‰ã® ISAM テーブル形å¼ã¯åˆ©ç”¨ã§ããªããªã£ã¦ã„"
-#~ "ã¾ã™ã€‚ãã®ãŸã‚ã€ä¾‹ãˆã° \"mysql_convert_table_format\" ã‚ã‚‹ã„㯠\"ALTER "
-#~ "TABLE x ENGINE=MyISAM\" ã¨ã—ã¦ã‚¢ãƒƒãƒ—グレードå‰ã« MyISAM ã«ã‚³ãƒ³ãƒãƒ¼ãƒˆã™ã‚‹ã“"
-#~ "ã¨ãªã©ãŒå¿…è¦ã§ã™ã€‚mysql-server-5.1 ã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã‚’中断ã—ã¾ã™ã€‚以å‰ã® "
-#~ "mysql-server-4.1 ãŒå‰Šé™¤ã•ã‚Œã¦ã—ã¾ã£ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€ãƒ†ãƒ¼ãƒ–ルをコンãƒãƒ¼ãƒˆ"
-#~ "ã™ã‚‹ãŸã‚ã«å†ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã‚’ã—ã¦ãã ã•ã„。"
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Debian \"Sarge\" ã‚ã‚‹ã„ã¯ãれよりもå¤ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ãŒç¨¼åƒã—ã¦ã„るホストã‹ã‚‰"
-#~ "ã® MySQL 接続をサãƒãƒ¼ãƒˆã—ã¾ã™ã‹?"
-
-#, fuzzy
-#~| msgid ""
-#~| "The way passwords were stored was not very secure. This has been "
-#~| "improved with the drawback that clients (e.g. PHP) from hosts running "
-#~| "Debian 3.1 Sarge will not be able to connect to account which are new or "
-#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/"
-#~| "README.Debian."
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "パスワードã®ä¿å­˜æ–¹æ³•ã¯ã€ã‚ã¾ã‚Šå®‰å…¨ãªæ–¹æ³•ã§è¡Œã‚ã‚Œã¦ã„ã¾ã›ã‚“ã§ã—ãŸã€‚ã“ã‚Œã¯æ”¹"
-#~ "å–„ã•ã‚Œã¾ã—ãŸãŒã€Debian 3.1 Sarge ãŒç¨¼åƒã—ã¦ã„るホストã‹ã‚‰ã‚¯ãƒ©ã‚¤ã‚¢ãƒ³ãƒˆ "
-#~ "(PHP ãªã©) ãŒæ–°ã—ã„アカウントやパスワードãŒå¤‰æ›´ã•ã‚ŒãŸã‚¢ã‚«ã‚¦ãƒ³ãƒˆã«ã¯æŽ¥ç¶šã§"
-#~ "ããªããªã‚‹ã¨ã„ã†æ¬ ç‚¹ã‚‚ã§ã¦ã„ã¾ã™ã€‚詳細ã«ã¤ã„ã¦ã¯ /usr/share/doc/mysql-"
-#~ "server-5.1/README.Debian ã‚’å‚ç…§ã—ã¦ãã ã•ã„。"
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "mysql を利用ã™ã‚‹ã«ã¯ 以下ã®ãƒ¦ãƒ¼ã‚¶ã¨ã‚°ãƒ«ãƒ¼ãƒ—を作æˆã—ã€/var/lib/mysql ãŒæ­£ã—"
-#~ "ã„権é™ã«ãªã£ã¦ã„ã‚‹ã‹ã©ã†ã‹ã‚’確èªã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ (ãŠãらã uid/gid ãŒé•"
-#~ "ã„ã¾ã™)。"
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "å…¨ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® MySQL ã§åˆ©ç”¨ã•ã‚Œã¦ã„るデータベースを削除ã—ã¾ã™ã‹?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr ""
-#~ "パスワードを入力ã—ãªã„å ´åˆã€ã‚¢ã‚«ã‚¦ãƒ³ãƒˆã«å¯¾ã—ã¦å¤‰æ›´ã¯åŠ ãˆã‚‰ã‚Œã¾ã›ã‚“。"
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "インストールãŒçµ‚了ã—ãŸéš›ã€ã‚¢ã‚«ã‚¦ãƒ³ãƒˆãŒãƒ‘スワードã§ãã¡ã‚“ã¨ä¿è­·ã•ã‚Œã¦ã„ã‚‹ã‹"
-#~ "ã©ã†ã‹ã‚’確èªã—ã¦ãã ã•ã„ (詳細ã«ã¤ã„ã¦ã¯ README.Debian ã‚’å‚ç…§ã—ã¦ãã ã•"
-#~ "ã„)。"
-
-#~ msgid "Install Hints"
-#~ msgstr "インストールã®ãƒ’ント"
-
-#~ msgid ""
-#~ "On upgrades from MySQL 3.23, as shipped with Debian Woody, symlinks in "
-#~ "place of /var/lib/mysql or /var/log/mysql gets accidently removed and "
-#~ "have manually be restored."
-#~ msgstr ""
-#~ "Debian Woody ã§ãƒªãƒªãƒ¼ã‚¹ã•ã‚ŒãŸ MySQL 3.23 ã‹ã‚‰ã®ã‚¢ãƒƒãƒ—グレードã§ã¯ã€/var/"
-#~ "lib/mysql ã‚ã‚‹ã„㯠/var/log/mysql ã®ä»£ã‚ã‚Šã«ã‚·ãƒ³ãƒœãƒªãƒƒã‚¯ãƒªãƒ³ã‚¯ã¯å¶ç„¶ã«ã‚‚削"
-#~ "除ã•ã‚Œã¦ã—ã¾ã£ã¦ã„ã‚‹ã®ã§ã€æ‰‹å‹•ã§ã®ãƒªã‚¹ãƒˆã‚¢ãŒå¿…è¦ã«ãªã‚Šã¾ã™ã€‚"
-
-#~ msgid ""
-#~ "MySQL will only install if you have a non-numeric hostname that is "
-#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
-#~ "myhostname\"."
-#~ msgstr ""
-#~ "MySQL 㯠/etc/hosts ファイル経由ã§è§£æ±ºã§ãる「数字ã®ã¿ã§æ§‹æˆã•ã‚Œã¦ãªã„ã€ãƒ›"
-#~ "ストåã®å ´åˆã®ã¿ã€ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•ã‚Œã¾ã™ã€‚ã¤ã¾ã‚Šã€\"hostname\" コマンド㌠"
-#~ "\"myhostname\" ã‚’è¿”ã™ãªã‚‰ã€\"10.0.0.1 myhostname\" ã¨ã„ã†è¡ŒãŒ /etc/hosts "
-#~ "ファイルã«ã‚ã‚‹ã¯ãšã§ã™ã€‚"
-
-#~ msgid ""
-#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
-#~ "is used in the start/stop and cron scripts. Don't delete."
-#~ msgstr ""
-#~ "æ–°è¦ã« mysql ユーザã¨ã—㦠\"debian-sys-maint\" ãŒä½œæˆã•ã‚Œã¾ã™ã€‚ã“ã® mysql "
-#~ "アカウント㯠start/stop 時㨠cron スクリプトã§åˆ©ç”¨ã•ã‚Œã¾ã™ã€‚消ã•ãªã„ã§ãã "
-#~ "ã•ã„。"
-
-#~ msgid ""
-#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /"
-#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in "
-#~ "there, never only the password!"
-#~ msgstr ""
-#~ "MySQL ã® root ユーザã«å¯¾ã—ã¦ã€Œãƒ‘スワードã®è¨­å®šã€ã‚’忘れãªã„ã§ãã ã•ã„! /"
-#~ "root/.my.cnf を使ã£ã¦ã„ã‚‹å ´åˆã€ã“ã®ãƒ•ã‚¡ã‚¤ãƒ«ä¸­ã® \"user\" 行㨠\"password"
-#~ "\" 行を記述ã—ã¦ãã ã•ã„。決ã—ã¦ãƒ‘スワードã ã‘ã§ã¯ã„ã‘ã¾ã›ã‚“!"
-
-#~ msgid ""
-#~ "Should I remove the complete /var/lib/mysql directory tree which is used "
-#~ "by all MySQL versions, not necessarily only the one you are about to "
-#~ "purge?"
-#~ msgstr ""
-#~ "ã“ã‚Œã‹ã‚‰ purge ã—よã†ã¨ã—ã¦ã„ã‚‹ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã ã‘ã§ã¯ç„¡ãã€å…¨ã¦ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® "
-#~ "MySQL ㌠/var/lib/mysql ディレクトリを使用ã—ã¦ã„ã¾ã™ã€‚ã“ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’完"
-#~ "å…¨ã«å‰Šé™¤ã—ã¾ã™ã‹?"
-
-#~ msgid "Update Hints"
-#~ msgstr "æ›´æ–°ã®ãƒ’ント"
-
-#~ msgid ""
-#~ "Rarely, e.g. on new major versions, the privilege system is improved. To "
-#~ "make use of it mysql_fix_privilege_tables must be executed manually. The "
-#~ "script is not supposed to give any user more rights that he had before,"
-#~ msgstr ""
-#~ "ã¾ã‚Œã«ã€ã¤ã¾ã‚Šã¯æ–°ã—ã„メジャーãƒãƒ¼ã‚¸ãƒ§ãƒ³ã«ãŠã„ã¦ã€ç‰¹æ¨©ã‚·ã‚¹ãƒ†ãƒ ãŒæ”¹å–„ã•ã‚Œã¾"
-#~ "ã™ã€‚ã“れを行ã†ã«ã¯ã€mysql_fix_privilege_table を手動ã§å®Ÿè¡Œã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾"
-#~ "ã™ã€‚スクリプトã¯ã€ã©ã®ã‚ˆã†ãªãƒ¦ãƒ¼ã‚¶ã«å¯¾ã—ã¦ã‚‚ã€ä»¥å‰ã«ä¿æŒã—ã¦ã„ãŸä»¥ä¸Šã®æ¨©é™"
-#~ "を与ãˆã‚‹ã‚ˆã†ã«ã¯ãªã£ã¦ã„ã¾ã›ã‚“。"
-
-#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html"
-#~ msgstr "http://www.mysql.com/doc/ja/Upgrade.html ã‚‚å‚ç…§ã—ã¦ãã ã•ã„"
diff --git a/storage/xtradb/build/debian/po/nb.po b/storage/xtradb/build/debian/po/nb.po
deleted file mode 100644
index 1235cdc1b2c..00000000000
--- a/storage/xtradb/build/debian/po/nb.po
+++ /dev/null
@@ -1,297 +0,0 @@
-# translation of mysql_nb.po to Norwegian Bokmål
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-#
-# Bjørn Steensrud <bjornst@powertech.no>, 2007.
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql_nb\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-02-18 12:13+0100\n"
-"Last-Translator: Bjørn Steensrud <bjornst@powertech.no>\n"
-"Language-Team: Norwegian Bokmål <i18n-nb@lister.ping.uio.no>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.2\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid "Do you really want to downgrade?"
-msgid "Really proceed with downgrade?"
-msgstr "Er du sikker på at du vil nedgradere?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid ""
-#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates "
-#| "that a mysql-server package with a higher version has been installed "
-#| "before. It can not be guaranteed that this version can use its data."
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"ADVARSEL: Fila /var/lib/mysql/debian-*.flag finnes. Dette viser at en mysql-"
-"server-pakke med et høyere versjonsnummer har vært installert før. Det kan "
-"ikke garanteres at denne versjonen kan bruke data fra den høyere versjonen."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-#, fuzzy
-#| msgid "Important note for NIS/YP users!"
-msgid "Important note for NIS/YP users"
-msgstr "Viktig merknad for NIS/YP-brukere!"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid "Remove all Percona SQL databases?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The script is about to remove the data directory /var/lib/mysql. If it is "
-#| "planned to just install a higher MySQL version or if a different mysql-"
-#| "server package is already using it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Dette skriptet skal til å fjerne data-mappa /var/lib/mysql. Denne mappa bør "
-"beholdes hvis det bare skal installeres en høyere MySQL-versjon, eller hvis "
-"en annen mysql-server-pakke allerede bruker den."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Should MySQL start on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Skal MySQL startes ved maskinoppstart?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL can start automatically on boot time or only if you manually "
-#| "type '/etc/init.d/mysql start'."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL kan startes automatisk når maskinen starter, eller bare hvis du "
-"skriver «/etc/init.d/mysql start»."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Nytt passord for MySQLs «root»-bruker:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "It is highly recommended that you set a password for the MySQL "
-#| "administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Det anbefales sterkt at du oppgir et passord for den administrative «root»-"
-"brukeren i MySQl."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Nytt passord for MySQLs «root»-bruker:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Klarer ikke angi passord for MySQLs «root»-bruker"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "It seems an error occurred while setting the password for the MySQL "
-#| "administrative user. This may have happened because the user already has "
-#| "a password, or because there was a problem communicating with the MySQL "
-#| "server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Det ser ut til at det oppsto en feil mens det ble satt et passord for MySQLs "
-"administrative bruker. Dette kan være fordi brukeren allerede har et "
-"passord, eller fordi det var et kommunikasjonsproblem med MySQL-tjeneren."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Skal MySQL-tilkoblinger støttes fra vertsmaskiner som kjører Debian "
-#~ "«sarge» eller eldre?"
-
-#, fuzzy
-#~| msgid ""
-#~| "The way passwords were stored was not very secure. This has been "
-#~| "improved with the drawback that clients (e.g. PHP) from hosts running "
-#~| "Debian 3.1 Sarge will not be able to connect to account which are new or "
-#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/"
-#~| "README.Debian."
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Passord ble tidligere lagret på en lite sikker måte. Dette er nå "
-#~ "forbedret, med den ulempen at klienter (f.eks. PHP) fra verter som kjører "
-#~ "Debian 3.1 Sarge ikke vil kunne koble til en konto som er ny eller har "
-#~ "fått endret passordet. Se /usr/share/doc/mysql-server-5.1/README.Debian."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "For å bruke MySQL må du installere en bruker og gruppe tilsvarende den "
-#~ "nedenfor og se til at /var/lib/mysql har riktige rettigheter (uid/gid kan "
-#~ "være forskjellig)."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "Skal databasene brukt av alle MySQL-versjoner fjernes?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr ""
-#~ "Hvis du ikke oppgir et passord blir det ikke gjort noen endringer med "
-#~ "kontoen."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "Når installasjonen er ferdig bør det sjekkes at kontoen er ordentlig "
-#~ "beskyttet med et passord (mer informasjon finnes i README.Debian)."
diff --git a/storage/xtradb/build/debian/po/nl.po b/storage/xtradb/build/debian/po/nl.po
deleted file mode 100644
index bfe418117e6..00000000000
--- a/storage/xtradb/build/debian/po/nl.po
+++ /dev/null
@@ -1,302 +0,0 @@
-# Dutch mysql-dfsg-5.1 po-debconf translation,
-# Copyright (C) 2006 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the mysql-dfsg-5.1 package.
-# Vincent Zweije <zweije@xs4all.nl>, 2006.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1 5.0.30-1\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2006-02-19 10:20+0100\n"
-"Last-Translator: Thijs Kinkhorst <thijs@debian.org>\n"
-"Language-Team: Debian-Dutch <debian-l10n-dutch@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid "Do you really want to downgrade?"
-msgid "Really proceed with downgrade?"
-msgstr "Wilt u echt een oude versie herstellen?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid ""
-#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates "
-#| "that a mysql-server package with a higher version has been installed "
-#| "before. It can not be guaranteed that this version can use its data."
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"Waarschuwing: waarschijnlijk is een hogere versie van het mysql-server "
-"pakket geïnstalleerd geweest (het bestand /var/lib/mysql/debian-*.flag "
-"bestaat). Er is geen garantie dat de gegevensbestanden, bewerkt met die "
-"hogere versie, kunnen worden gebruikt met de versie van mysql die u nu "
-"installeert."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-#, fuzzy
-#| msgid "Important note for NIS/YP users!"
-msgid "Important note for NIS/YP users"
-msgstr "Belangrijke opmerking voor gebruikers van NIS/YP!"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid "Remove all Percona SQL databases?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The script is about to remove the data directory /var/lib/mysql. If it is "
-#| "planned to just install a higher MySQL version or if a different mysql-"
-#| "server package is already using it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Het script staat op het punt de datamap /var/lib/mysql te verwijderen. Als "
-"het plan alleen maar is om een hogere MySQL versie te installeren, of als "
-"een ander mysql-serverpakket de datamap al gebruikt, dan zou de data moeten "
-"worden behouden."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Should MySQL start on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Moet MySQL starten als de computer start?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL can start automatically on boot time or only if you manually "
-#| "type '/etc/init.d/mysql start'."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL kan automatisch starten bij het starten van de computer, of slechts "
-"wanneer u '/etc/init.d/mysql start' handmatig uitvoert."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Nieuw wachtwoord voor de MySQL \"root\"-gebruiker:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "It is highly recommended that you set a password for the MySQL "
-#| "administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Het wordt sterk aangeraden een wachtwoord in te stellen voor de "
-"administratieve MySQL \"root\"-gebruiker."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Nieuw wachtwoord voor de MySQL \"root\"-gebruiker:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Kan het wachtwoord voor de MySQL \"root\"-gebruiker niet instellen"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "It seems an error occurred while setting the password for the MySQL "
-#| "administrative user. This may have happened because the user already has "
-#| "a password, or because there was a problem communicating with the MySQL "
-#| "server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Er lijkt een fout te zijn opgetreden bij het instellen van het wachtwoord "
-"van de MySQL administratieve gebruiker. Dat kan komen doordat de gebruiker "
-"al een wachtwoord heeft, of omdat er een probleem was bij het communiceren "
-"met de MySQL server."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Moet u MySQL-verbindingen accepteren van computers die Debian \"sarge\" "
-#~ "of ouder draaien?"
-
-#, fuzzy
-#~| msgid ""
-#~| "The way passwords were stored was not very secure. This has been "
-#~| "improved with the drawback that clients (e.g. PHP) from hosts running "
-#~| "Debian 3.1 Sarge will not be able to connect to account which are new or "
-#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/"
-#~| "README.Debian."
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "De wijze waarop wachtwoorden werden bewaard was niet erg veilig. Dit is "
-#~ "verbeterd, maar helaas zullen programma's van computers die Debian 3.1 "
-#~ "Sarge draaien, geen verbinding meer kunnen maken met accounts die nieuw "
-#~ "zijn, of waarvan het wachtwoord is gewijzigd. Zie /usr/share/doc/mysql-"
-#~ "server-5.1/README.Debian."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "Om mysql te gebruiken dient u een gebruiker en groep aan te maken, "
-#~ "gelijkwaardig aan onderstaand voorbeeld, en u dient ervoor te zorgen dat /"
-#~ "var/lib/mysql de bijbehorende toegangsrechten heeft (uid en gid mogen "
-#~ "anders zijn)."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "Databases verwijderen die door alle MySQL versies worden gebruikt?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr ""
-#~ "Indien u geen wachtwoord opgeeft zal het account niet worden gewijzigd."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "Wanneer de installatie klaar is, dient u te verifiëren dat het account "
-#~ "netjes beschermd is met een wachtwoord (zie README.Debian voor meer "
-#~ "informatie)."
diff --git a/storage/xtradb/build/debian/po/pt.po b/storage/xtradb/build/debian/po/pt.po
deleted file mode 100644
index 3372b11b06b..00000000000
--- a/storage/xtradb/build/debian/po/pt.po
+++ /dev/null
@@ -1,322 +0,0 @@
-# Portuguese translation for mysql-dfsg-5.1's debconf messages
-# Copyright (C) 2006 Miguel Figueiredo <elmig@debianpt.org>
-# This file is distributed under the same license as the mysql-dfsg-5.1 package.
-# Miguel Figueiredo <elmig@debianpt.org>
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-05-05 21:01+0100\n"
-"Last-Translator: Miguel Figueiredo <elmig@debianpt.org>\n"
-"Language-Team: Portuguese <traduz@debianpt.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr "Deseja mesmo fazer downgrade?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr "Existe um ficheiro chamado /var/lib/mysql/debian-*.flag neste sistema."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"Tal ficheiro significa que anteriormente foi instalado um pacote mysql-"
-"server com um número de versão superior."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-"Não existe nenhuma garantia que a versão que está actualmente a instalar "
-"seja capaz de utilizar as bases de dados actuais."
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr "Nota importante para utilizadores de NIS/YP"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-"Para utilizar o MySQL, têm de ser acrescentadas as seguintes entradas para "
-"os utilizadores e grupos:"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-"Deve também verificar as permissões e o dono do directório /var/lib/mysql :"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid "Remove all MySQL databases?"
-msgid "Remove all Percona SQL databases?"
-msgstr "Remover todas as bases de dados MySQL?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The /var/lib/mysql directory which contains the MySQL databases is about "
-#| "to be removed."
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-"O directório /var/lib/mysql que contém as bases de dados MySQL está prestes "
-"a ser removido."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "If you're removing the MySQL package in order to later install a more "
-#| "recent version or if a different mysql-server package is already using "
-#| "it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Se está a remover o pacote MySQL de modo a posteriormente instalar uma "
-"versão mais recente ou se um pacote mysq-server já está os está a utilizar, "
-"os dados devem ser mantidos."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Start the MySQL server on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Iniciar o servidor MySQL no arranque?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL server can be launched automatically at boot time or manually "
-#| "with the '/etc/init.d/mysql start' command."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"O MySQL pode ser automaticamente lançado no arranque ou manualmente através "
-"do comando '/etc/init.d/mysql start'."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Nova palavra-passe para o utilizador \"root\" do MySQL:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "While not mandatory, it is highly recommended that you set a password for "
-#| "the MySQL administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Embora não seja mandatório, É fortemente recomendado que defina uma palavra-"
-"passe para o utilizador administrativo \"root\" do MySQL."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-"Se esse campo for deixado em branco, a palavra-passe não irá ser alterada."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Nova palavra-passe para o utilizador \"root\" do MySQL:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for the MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr ""
-"Não foi possível definir a palavra-passe para o utilizador \"root\" do MySQL"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "An error occurred while setting the password for the MySQL administrative "
-#| "user. This may have happened because the account already has a password, "
-#| "or because of a communication problem with the MySQL server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Ocorreu um erro enquanto era definida a palavra-passe para o utilizador "
-"administrativo do MySQL. Isto pode ter acontecido porque a cona já tem uma "
-"palavra-passe, ou porque ocorreu um problema ao comunicação com o servidor "
-"MySQL."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "You should check the account's password after tha package installation."
-msgid "You should check the account's password after the package installation."
-msgstr ""
-"Você deve verificar a palavra-passe da conta após a instalação do pacote."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
-#| "more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"Para mais informação por favor leia o ficheiro /usr/share/doc/mysql-server-"
-"5.1/README.Debian."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid "Cannot upgrade if ISAM tables are present!"
-#~ msgstr "Não é possível actualizar se estiverem presentes tabelas ISAM!"
-
-#~ msgid ""
-#~ "Recent versions of MySQL can no longer use the old ISAM table format and "
-#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by "
-#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". "
-#~ "The installation of mysql-server-5.1 will now abort. In case your old "
-#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert "
-#~ "those tables."
-#~ msgstr ""
-#~ "As versões recentes de MySQL já não podem utilizar o antigo formato de "
-#~ "tabelas ISAM e é por isso necessário converter as suas tabelas pra e.g. "
-#~ "MyISAM antes da actualização, utilizando \"mysql_convert_table_format\" "
-#~ "ou \"ALTER TABLE x ENGINE=MyISAM\". A instalação de mysql-server-5.1 irá "
-#~ "agora ser cancelada. Se o seu antigo mysql-server-4.1 for removido apenas "
-#~ "reinstale para converter essas tabelas."
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Suportar ligações MySQL de máquinas que corram Debian \"sarge\" ou mais "
-#~ "antigos?"
-
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Nas versões antigas de clientes de MySQL em Debian, as palavras-passe não "
-#~ "eram guardadas de forma segura. Isto foi melhorado desde aí, no entanto "
-#~ "os clientes (como o PHP) de máquinas que corram Debian 3.1 Sarge não irão "
-#~ "conseguir ligar-se a contas novas ou cuja palavra-passe foi alterada."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "Para utilizar mysql e instalar um utilizador e grupo equivalentes para o "
-#~ "seguinte e assegurar-se que /var/lib/mysql têm as permissões correctas (o "
-#~ "uid/gid podem ser diferentes)."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "Remover as bases de dados utilizadas por todas as versões de MySQL?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr ""
-#~ "Se não disponibilizar uma password não serão feitas alterações nesta "
-#~ "conta."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "Quando terminar a instalação, deve verificar se a conta está devidamente "
-#~ "protegida com uma password (para mais informações veja README.Debian)."
diff --git a/storage/xtradb/build/debian/po/pt_BR.po b/storage/xtradb/build/debian/po/pt_BR.po
deleted file mode 100644
index e04a5a2393d..00000000000
--- a/storage/xtradb/build/debian/po/pt_BR.po
+++ /dev/null
@@ -1,458 +0,0 @@
-# Brazilian Portuguese (pt_BR) debconf template translation for
-# Debian's mysql-dfsg source package.
-# Debian-BR Project <debian-l10n-portuguese@lists.debian.org>
-# André Luís Lopes, <andrelop@debian.org> , 2004
-# André Luís Lopes, <andrelop@debian.org> , 2006
-# André Luís Lopes, <andrelop@debian.org> , 2007
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-04-21 15:59-0300\n"
-"Last-Translator: André Luís Lopes <andrelop@debian.org>\n"
-"Language-Team: Debian-BR Project <debian-l10n-portuguese@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"pt_BR utf-8\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr "Realmente proceder com o rebaixamento de versão?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr "Um arquivo de nome /var/lib/mysql/debian-*.flag existe no sistema."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"A presença de um arquivo como este é uma indicação de que um pacote mysql-"
-"server com um número de versão mais alto já foi instalado anteriormente."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-"Não há garantias de que a versão que você está instalando no momento "
-"conseguirá utilizar as bases de dados existentes."
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr "Aviso importante para usuários NIS/YP"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-"Para utilizar o MySQL, as seguintes entradas para usuários e grupos devem "
-"ser adicionadas ao sistema:"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-"Você deverá também checar as permissões e o dono do diretório /var/lib/mysql:"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid "Remove all MySQL databases?"
-msgid "Remove all Percona SQL databases?"
-msgstr "Remover todas as bases de dados do MySQL?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The /var/lib/mysql directory which contains the MySQL databases is about "
-#| "to be removed."
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-"O diretório /var/lib/mysql, o qual contém as bases de dados do MySQL, está "
-"prestes a ser removido."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "If you're removing the MySQL package in order to later install a more "
-#| "recent version or if a different mysql-server package is already using "
-#| "it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Caso você esteja removendo o pacote MySQL para posteriormente instalar uma "
-"versão mais recente ou, caso uma versão diferente do pacote mysql-server "
-"esteja sendo utilizada, os dados deverão ser mantidos."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Start the MySQL server on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Iniciar o servidor MySQL junto a inicialização da máquina?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL server can be launched automatically at boot time or manually "
-#| "with the '/etc/init.d/mysql start' command."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"O servidor MySQL pode ser iniciado automaticamente junto a inicialização da "
-"máquina ou manualmente com o comando '/etc/init.d/mysql start'."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Nova senha para o usuário \"root\" do MySQL:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "While not mandatory, it is highly recommended that you set a password for "
-#| "the MySQL administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Apesar de não ser mandatório, é altamente recomendado que você defina uma "
-"senha para o usuário administrativo \"root\" do MySQL."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr "Caso este campo seja deixado em branco, a senha não sera mudada."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for the MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Nova senha para o usuário \"root\" do MySQL:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for the MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Impossível definir senha para o usuário \"root\" do MySQL"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "An error occurred while setting the password for the MySQL administrative "
-#| "user. This may have happened because the account already has a password, "
-#| "or because of a communication problem with the MySQL server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Um erro ocorreu durante a definição da senha para o usuário administrativo "
-"do MySQL. Isso pode ter acontecido devido a esse usuário já possuir uma "
-"senha definida ou devido a ocorrência de um problema de comunicação com o "
-"servidor MySQL."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "You should check the account's password after tha package installation."
-msgid "You should check the account's password after the package installation."
-msgstr "Você deverá checar a senha dessa conta após a instalação deste pacote."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for "
-#| "more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-"Por favor, leia o arquivo /usr/share/doc/mysql-server-5.1/README.Debian para "
-"maiores informações."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Suportar conexões MySQL originadas de hosts executando o Debian \"sarge\" "
-#~ "ou mais antigos ?"
-
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Em versões antigas dos clientes MySQL no Debian, as senhas não eram "
-#~ "armazenadas de forma segura. Isto foi corrigido desde então, porém, "
-#~ "clientes (como o PHP) em hosts executando o Debian 3.1 Sarge não serão "
-#~ "capazes de conectar em contas recentes ou contas as quais as senhas "
-#~ "tenham sido modificadas."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "Para utilizar o MySQL, você deve instalar um usuário e um grupo "
-#~ "equivalentes ao usuário e grupo a seguir para se certificar de que o "
-#~ "diretório /var/lib/mysql possua as permissões correctas (o uid/gid podem "
-#~ "ser diferentes)."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "Remover as bases de dados utilizadas por todas as versões do MySQL?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr ""
-#~ "Caso você não forneça uma senha, nenhuma mudança será feita na conta."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "Quando a instalação finalizar, você deverá verificar se a conta está "
-#~ "apropriadamente protegida com uma senha (consulte o arquivo README.Debian "
-#~ "para maiores informações)."
-
-#~ msgid "internal"
-#~ msgstr "interno"
-
-#~ msgid "Only internally used."
-#~ msgstr "Somente utilizado internamente."
-
-#, fuzzy
-#~ msgid "Update Hints"
-#~ msgstr "Dicas de atualização"
-
-#, fuzzy
-#~ msgid ""
-#~ "Rarely, e.g. on new major versions, the privilege system is improved. To "
-#~ "make use of it mysql_fix_privilege_tables must be executed manually. The "
-#~ "script is not supposed to give any user more rights that he had before,"
-#~ msgstr ""
-#~ "Raramente, por exemplo, em novas versões maiores, o sistema de "
-#~ "privilégios é melhorado. Para fazer uso disso, o script "
-#~ "mysql_fix_privilege_tables deve ser executado manualmente. O script não "
-#~ "atribuirá a nenhum usuário mais direitos do que os mesmos já possuíam "
-#~ "anteriormente."
-
-#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html"
-#~ msgstr "Por favor, leia http://www.mysql.com/doc/en/Upgrade.html"
-
-#, fuzzy
-#~ msgid "Install Hints"
-#~ msgstr "Dicas de instalação"
-
-#, fuzzy
-#~ msgid ""
-#~ "MySQL will only install if you have a non-numeric hostname that is "
-#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
-#~ "myhostname\"."
-#~ msgstr ""
-#~ "O MySQL será instalado somente caso você possua um nome de host NÃO "
-#~ "NUMÉRICO que possa ser resolvido através do arquivo /etc/hosts, ou seja, "
-#~ "caso o comando \"hostname\" retorne \"myhostname\", uma linha como "
-#~ "\"10.0.0.1 myhostname\" deverá existir no arquivo /etc/hosts."
-
-#~ msgid ""
-#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
-#~ "is used in the start/stop and cron scripts. Don't delete."
-#~ msgstr ""
-#~ "Um novo usuário MySQL de nome \"debian-sys-maint\" será criado. Essa "
-#~ "conta MySQL é utilizada pelos scripts de inicialização/parada e pelos "
-#~ "scripts cron. Não remova esse usuário."
-
-#, fuzzy
-#~ msgid ""
-#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /"
-#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in "
-#~ "there, never only the password!"
-#~ msgstr ""
-#~ "Por favor, lembre-se de definir uma SENHA para o usuário root do MySQL ! "
-#~ "Caso você utilize um arquivo /root/.my.cnf, sempre inclua as linhas \"user"
-#~ "\" e \"password\" nesse arquivo, nunca somente a senha ! Consulte o "
-#~ "arquivo /usr/share/doc/mysql-server/README.Debian para mais informações."
-
-#~ msgid ""
-#~ "Should I remove all databases below /var/lib/mysql as you are purging the "
-#~ "mysql-server package?"
-#~ msgstr ""
-#~ "Todas as base de dados sob o diretório /var/lib/mysql devem ser removidas "
-#~ "quando você remover o pacote pacote mysql-server ?"
-
-#~ msgid ""
-#~ "Networking is disabled by default for security reasons. You can enable it "
-#~ "by commenting out the skip-networking option in /etc/mysql/my.cnf."
-#~ msgstr ""
-#~ "O suporte ao funcionamento em rede está desativado por padrão por "
-#~ "questões de segurança. Você poderá ativá-lo comentando a opção 'skip-"
-#~ "networking' no arquivo /etc/mysql/my.cnf."
-
-#~ msgid "security and update notice"
-#~ msgstr "aviso de segurança e actualização"
-
-#~ msgid ""
-#~ "Should I remove everything below /var/lib/mysql when you purge the mysql-"
-#~ "server package with the \"dpkg --purge mysql-server\" command (i.e. "
-#~ "remove everything including the configuration) somewhen? (default is not)"
-#~ msgstr ""
-#~ "Devo remover tudo abaixo de /var/lib/mysql quando fizer o purge do pacote "
-#~ "mysql-server com o comando \"dpkg --purge mysql-server\" (ou seja, "
-#~ "remover tudo incluíndo a configuração)? (o padrão é não remover)"
-
-#~ msgid "Make MySQL reachable via network?"
-#~ msgstr "Fazer com que o MySQL seja acessível via rede?"
-
-#~ msgid ""
-#~ "Should MySQL listen on a network reachable TCP port? This is not "
-#~ "necessary for use on a single computer and could be a security problem."
-#~ msgstr ""
-#~ "O MySQL deve aguardar ligações numa porta TCP acessível via rede? Isto "
-#~ "não é necessário para uso num único computador e pode ser um problema de "
-#~ "segurança."
-
-#~ msgid "Enable chroot mode?"
-#~ msgstr "Activar o modo chroot?"
-
-#~ msgid ""
-#~ "MySQL is able to jail itself into the /var/lib/mysql_jail directory so "
-#~ "that users cannot modify any files outside this directory. This improves "
-#~ "resistence against crackers, too, as they are not able to modify system "
-#~ "files."
-#~ msgstr ""
-#~ "O MySQL é capaz de se prender no diretório /var/lib/mysql_jail, assim os "
-#~ "utilizadores não poderão modificar ficheiros fora deste directório. Isto "
-#~ "aumenta também a resistência contra crackers, pois eles não poderão "
-#~ "modificar arquivos de sistema."
-
-#~ msgid "Please run mysql_fix_privilege_tables !"
-#~ msgstr "Por favor execute mysql_fix_privilege_tables !"
-
-#~ msgid ""
-#~ "I will ensure secure permissions of /var/lib/mysql by replacing GIDs "
-#~ "other than root and mysql with mysql."
-#~ msgstr ""
-#~ "Permissões seguras para o diretório /var/lib/mysql serão asseguradas "
-#~ "substituíndo GIDs diferentes de root e mysql por mysql."
-
-#~ msgid ""
-#~ "Instructions how to enable SSL support are in /usr/share/doc/mysql-server/"
-#~ msgstr ""
-#~ "Instruções sobre como activar o suporte de SSL estão disponíveis no "
-#~ "directório /usr/share/doc/mysql-server/."
-
-#, fuzzy
-#~ msgid "mysql_fix_privileges_tables should be executed"
-#~ msgstr "mysql_fix_privileges_tables será executado"
-
-#, fuzzy
-#~ msgid ""
-#~ "The latest MySQL versions have an enhanced, more fine grained, privilege "
-#~ "system. To make use of it, some new fields must be added to the tables "
-#~ "in the \"mysql\" database. This will not happen automatically."
-#~ msgstr ""
-#~ "As últimas versões do MySQL possuem um sistema de privilégios melhorado e "
-#~ "mais refinado. Para utilizá-lo, alguns novos campos devem ser adicionados "
-#~ "as tabelas na base de dados \"mysql\". Isto é feito pelo script "
-#~ "mysql_fix_privileges_tables durante esta actualização independente do "
-#~ "servidor estar a correr ou não !"
-
-#~ msgid ""
-#~ "This script is not supposed to give any user more rights that he had "
-#~ "before, if you encounter such a case, please contact me."
-#~ msgstr ""
-#~ "Este script não deverá fornecer mais direitos a um utilizador além dos "
-#~ "quais ele já possua anteriormente. SE encontrar um caso desses, por favor "
-#~ "entre em contacto com o mantainer deste pacote Debian."
diff --git a/storage/xtradb/build/debian/po/ro.po b/storage/xtradb/build/debian/po/ro.po
deleted file mode 100644
index 37902bfd913..00000000000
--- a/storage/xtradb/build/debian/po/ro.po
+++ /dev/null
@@ -1,319 +0,0 @@
-# Romanian translation of mysql-dfsg.
-# Copyright (C) 2006 THE mysql-dfsg'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the mysql-dfsg package.
-#
-# Stan Ioan-Eugen <stan.ieugen@gmail.com>, 2006.
-msgid ""
-msgstr ""
-"Project-Id-Version: po-debconf://mysql-dfsg\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2006-12-20 21:27+0200\n"
-"Last-Translator: stan ioan-eugen <stan.ieugen@gmail.com>\n"
-"Language-Team: romanian <debian-l10n-romanian@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid "Do you really want to downgrade?"
-msgid "Really proceed with downgrade?"
-msgstr "Sunteţi sigur că doriţi să instalaţi o versiune mai veche?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid ""
-#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates "
-#| "that a mysql-server package with a higher version has been installed "
-#| "before. It can not be guaranteed that this version can use its data."
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"AVERTISMENT: Fişierul /var/lib/mysql/debian-*.flag există. Acest lucru "
-"indică faptul că anterior a fost instalată o versiune nouă a pachetului "
-"mysql-server. Nu se poate garanta că versiunea instalată acum poate folosi "
-"datele versiunii instalate anterior."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-#, fuzzy
-#| msgid "Important note for NIS/YP users!"
-msgid "Important note for NIS/YP users"
-msgstr "Notă importantă pentru utilizatorii NIS/YP!"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid "Remove all Percona SQL databases?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The script is about to remove the data directory /var/lib/mysql. If it is "
-#| "planned to just install a higher MySQL version or if a different mysql-"
-#| "server package is already using it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Scriptul urmează să şteargă directorul de date /var/lib/mysql. Dacă plănuiţi "
-"doar să instalaţi o versiune nouă MySQL sau datele sunt folosite de către un "
-"alt pachet mysql-server, atunci ar trebui păstraţi datele."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Should MySQL start on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Doriţi ca MySQL să pornească la initializarea sistemului?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL can start automatically on boot time or only if you manually "
-#| "type '/etc/init.d/mysql start'."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL poate porni automat la iniţializarea sistemului sau doar dacă rulaţi "
-"comanda „/etc/init.d/mysql startâ€."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Noua parolă pentru utilizatorul „root†al MySQL:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "It is highly recommended that you set a password for the MySQL "
-#| "administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Este recomandat să stabiliţi o parolă pentru utilizatorul administrativ "
-"„root†al MySQL."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Noua parolă pentru utilizatorul „root†al MySQL:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Nu s-a putut stabili parola pentru utilizatorul „root†al MySQL"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "It seems an error occurred while setting the password for the MySQL "
-#| "administrative user. This may have happened because the user already has "
-#| "a password, or because there was a problem communicating with the MySQL "
-#| "server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Se pare că a intervenit o eroare în stabilirea parolei pentru utilizatorul "
-"administrativ al MySQL. Acest lucru se poate întâmpla dacă utilizatorul are "
-"deja o parolă, sau a existat o problemă în comunicarea cu serverul MySQL."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid "Cannot upgrade if ISAM tables are present!"
-#~ msgstr "Nu se poate face actualizarea dacă sunt prezente tabele ISAM!"
-
-#~ msgid ""
-#~ "Recent versions of MySQL can no longer use the old ISAM table format and "
-#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by "
-#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". "
-#~ "The installation of mysql-server-5.1 will now abort. In case your old "
-#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert "
-#~ "those tables."
-#~ msgstr ""
-#~ "Versiunile recente MySQL nu mai pot folosi vechiul format de tabele ISAM "
-#~ "şieste necesar să convertiţi tabelele dumneavoastră de ex. la formatul "
-#~ "MyISAM înainte de a face actualizarea folosind comanda "
-#~ "„mysql_convert_table_format†sau „ALTER TABLE x ENGINE=MyISAMâ€. "
-#~ "Instalarea mysql-server-5.1 va eşua. În caz că ştergeţiversiunea "
-#~ "anterioară mysql-server-4.1 va trebui reinstalată pentru a converti "
-#~ "tabelele."
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Suportaţi conexiuni MySQL de la staţii ce rulează sistemul Debian „sarge†"
-#~ "sau mai vechi?"
-
-#, fuzzy
-#~| msgid ""
-#~| "The way passwords were stored was not very secure. This has been "
-#~| "improved with the drawback that clients (e.g. PHP) from hosts running "
-#~| "Debian 3.1 Sarge will not be able to connect to account which are new or "
-#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/"
-#~| "README.Debian."
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Modul în care erau păstrate parolele nu era foarte sigur. Acest lucru a "
-#~ "fost îmbunătăţitcu dezajantajul că clienţii (de ex. PHP) de pe staţii ce "
-#~ "rulează sistemul Debian 3.1 Sargenu se vor putea conecta la conturi noi "
-#~ "sau ale căror parole au fost schimbate. Citiţi /usr/share/doc/mysql-"
-#~ "server-5.1/README.Debian."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "Pentru a folosi mysql trebuie să adăugaţi un utilizator şi grup "
-#~ "echivalent şi să vă asiguraţi că /var/lib/mysql are permisiunile "
-#~ "stabilite corect (uid/gid pot aveavalori diferite)."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd:\tmysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group:\tmysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql:\tdrwxr-xr-x\tmysql\tmysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "Doriţi să ştergeţi bazele de date folosite de toate versiune MySQL?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr ""
-#~ "Dacă nu introduceţi nici o parolă, nici o schimbare nu va fi luată în "
-#~ "considerare."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "După finalizarea instalării, ar trebui să verificaţi dacă contul este "
-#~ "protejat cu o parolă (citiţi fişierul README.Debian pentru informaţii "
-#~ "suplimentare)."
diff --git a/storage/xtradb/build/debian/po/ru.po b/storage/xtradb/build/debian/po/ru.po
deleted file mode 100644
index 14867533070..00000000000
--- a/storage/xtradb/build/debian/po/ru.po
+++ /dev/null
@@ -1,305 +0,0 @@
-# translation of mysql-dfsg-5.1_5.0.32-6_ru.po to Russian
-# Russian messages:
-# Translators, if you are not familiar with the PO format, gettext
-# documentation is worth reading, especially sections dedicated to
-# this format, e.g. by running:
-# info -n '(gettext)PO Files'
-# info -n '(gettext)Header Entry'#
-# Some information specific to po-debconf are available at
-# /usr/share/doc/po-debconf/README-trans
-# or http://www.debian.org/intl/l10n/po-debconf/README-trans#
-# Developers do not need to manually edit POT or PO files.
-# Ilgiz Kalmetev <translator@ilgiz.pp.ru>, 2003.
-# Yuriy Talakan' <yt@amur.elektra.ru>, 2005, 2006.
-# Yuriy Talakan' <yt@drsk.ru>, 2007.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1_5.0.32-6_ru\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-02-19 11:28+0900\n"
-"Last-Translator: Yuriy Talakan' <yt@drsk.ru>\n"
-"Language-Team: Russian <debian-l10n-russian@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.9.1\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid "Do you really want to downgrade?"
-msgid "Really proceed with downgrade?"
-msgstr "Ð’Ñ‹ дейÑтвительно желаете понизить верÑию?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid ""
-#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates "
-#| "that a mysql-server package with a higher version has been installed "
-#| "before. It can not be guaranteed that this version can use its data."
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"Ð’ÐИМÐÐИЕ: Ðайден файл /var/lib/mysql/debian-*.flag. Это означает, что ранее "
-"был уÑтановлен пакет mysql-server более выÑокой верÑии. Ðевозможно "
-"гарантировать, что Ñ‚ÐµÐºÑƒÑ‰Ð°Ñ Ð²ÐµÑ€ÑÐ¸Ñ Ñможет иÑпользовать его данные."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-#, fuzzy
-#| msgid "Important note for NIS/YP users!"
-msgid "Important note for NIS/YP users"
-msgstr "Важное замечание Ð´Ð»Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»ÐµÐ¹ NIS/YP!"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid "Remove all Percona SQL databases?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The script is about to remove the data directory /var/lib/mysql. If it is "
-#| "planned to just install a higher MySQL version or if a different mysql-"
-#| "server package is already using it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Сценарий ÑобираетÑÑ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ директорию данных /var/lib/mysql. ЕÑли "
-"планируетÑÑ ÑƒÑтановить новую верÑию MySQL или еÑÑ‚ÑŒ другие пакеты mysql-"
-"server, иÑпользующие Ñту директорию, то данные надо Ñохранить."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Should MySQL start on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "ЗапуÑкать MySQL при загрузке ÑиÑтемы?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL can start automatically on boot time or only if you manually "
-#| "type '/etc/init.d/mysql start'."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL может запуÑкатьÑÑ Ð¿Ñ€Ð¸ загрузке ÑиÑтемы, либо только еÑли вы вручную "
-"введете команду '/etc/init.d/mysql start'. "
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Ðовый пароль Ð´Ð»Ñ MySQL Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ \"root\":"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "It is highly recommended that you set a password for the MySQL "
-#| "administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Крайне рекомендуетÑÑ ÑƒÑтановить пароль Ð´Ð»Ñ Ð°Ð´Ð¼Ð¸Ð½Ð¸Ñтративного MySQL "
-"Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ \"root\"."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Ðовый пароль Ð´Ð»Ñ MySQL Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ \"root\":"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Ðевозможно задать пароль MySQL пользователю \"root\""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "It seems an error occurred while setting the password for the MySQL "
-#| "administrative user. This may have happened because the user already has "
-#| "a password, or because there was a problem communicating with the MySQL "
-#| "server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Ð’ процеÑÑе Ð·Ð°Ð´Ð°Ð½Ð¸Ñ Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð°Ð´Ð¼Ð¸Ð½Ð¸Ñтративного MySQL Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ Ð¿Ñ€Ð¾Ð¸Ð·Ð¾ÑˆÐ»Ð° "
-"ошибка. Это могло произойти еÑли у Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ ÑƒÐ¶Ðµ был задан пароль, или "
-"из-за проблем ÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ Ñ Ñервером MySQL."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Ðужна поддержка подключений к MySQL Ñ Ð¼Ð°ÑˆÐ¸Ð½, работающих под Debian \"sarge"
-#~ "\" или Ñтарше?"
-
-#, fuzzy
-#~| msgid ""
-#~| "The way passwords were stored was not very secure. This has been "
-#~| "improved with the drawback that clients (e.g. PHP) from hosts running "
-#~| "Debian 3.1 Sarge will not be able to connect to account which are new or "
-#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/"
-#~| "README.Debian."
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Метод Ñ…Ñ€Ð°Ð½ÐµÐ½Ð¸Ñ Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð±Ñ‹Ð» не очень безопаÑен. Это было Ñделано из-за "
-#~ "того, клиенты (например, PHP) Ñ Ð¼Ð°ÑˆÐ¸Ð½, работающих под Debian 3.1 Sarge не "
-#~ "Ñмогут подключитьÑÑ Ðº учетной запиÑи еÑли она новаÑ, или пароль был "
-#~ "изменен. См. /usr/share/doc/mysql-server-5.1/README.Debian."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "Чтобы иÑпользовать mysql, Ð’Ñ‹ должны уÑтановить Ñквивалентные Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ "
-#~ "и группу, как указано ниже и убедитьÑÑ, что /var/lib/mysql имеет "
-#~ "правильные права (uid/gid могут отличатьÑÑ)."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "Удалить базы данных, иÑпользуемые вÑеми верÑиÑми MySQL?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr "ЕÑли вы не зададите пароль, то ÑƒÑ‡ÐµÑ‚Ð½Ð°Ñ Ð·Ð°Ð¿Ð¸ÑÑŒ не будет изменена."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "Когда уÑтановка завершитÑÑ, вы должны убедитьÑÑ, что ÑƒÑ‡ÐµÑ‚Ð½Ð°Ñ Ð·Ð°Ð¿Ð¸ÑÑŒ "
-#~ "защищена паролем (подробную информацию Ñм. в README.Debian)."
diff --git a/storage/xtradb/build/debian/po/sv.po b/storage/xtradb/build/debian/po/sv.po
deleted file mode 100644
index ea9da131e58..00000000000
--- a/storage/xtradb/build/debian/po/sv.po
+++ /dev/null
@@ -1,400 +0,0 @@
-# Translators, if you are not familiar with the PO format, gettext
-# documentation is worth reading, especially sections dedicated to
-# this format, e.g. by running:
-# info -n '(gettext)PO Files'
-# info -n '(gettext)Header Entry'
-# Some information specific to po-debconf are available at
-# /usr/share/doc/po-debconf/README-trans
-# or http://www.debian.org/intl/l10n/po-debconf/README-trans
-# Developers do not need to manually edit POT or PO files.
-# , fuzzy
-#
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-5.1 5.0.21-3\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2007-02-18 14:48+0100\n"
-"Last-Translator: Andreas Henriksson <andreas@fatal.se>\n"
-"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Language: Swedish\n"
-"X-Poedit-Country: SWEDEN\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid "Do you really want to downgrade?"
-msgid "Really proceed with downgrade?"
-msgstr "Vill du verkligen nedgradera?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-#, fuzzy
-#| msgid ""
-#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates "
-#| "that a mysql-server package with a higher version has been installed "
-#| "before. It can not be guaranteed that this version can use its data."
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-"VARNING: Filen /var/lib/mysql/debian-*.flag existerar. Detta betyder att "
-"paketet mysql-server med högre versionsnummer har installerats tidigare. Det "
-"kan inte garanteras att denna version kan använda dess data."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-#, fuzzy
-#| msgid "Important note for NIS/YP users!"
-msgid "Important note for NIS/YP users"
-msgstr "Viktig notering för NIS/YP-användare!"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid "Remove all Percona SQL databases?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-#, fuzzy
-#| msgid ""
-#| "The script is about to remove the data directory /var/lib/mysql. If it is "
-#| "planned to just install a higher MySQL version or if a different mysql-"
-#| "server package is already using it, the data should be kept."
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-"Scriptet kommer strax ta bort data-katalogen /var/lib/mysql. Om det "
-"planerade var att bara installera en högre MySQL-version eller om ett annan "
-"mysql-server paket redan använde det, skall datan sparas."
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Should MySQL start on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "Ska MySQL startas när systemet startar upp?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid ""
-#| "The MySQL can start automatically on boot time or only if you manually "
-#| "type '/etc/init.d/mysql start'."
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL kan startas när systemet startas upp eller endast om du manuellt "
-"skriver '/etc/init.d/mysql start'."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr "Nytt lösenord för MySQLs \"root\"-användare:"
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-#, fuzzy
-#| msgid ""
-#| "It is highly recommended that you set a password for the MySQL "
-#| "administrative \"root\" user."
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-"Det är starkt rekommenderat att du sätter ett lösenord för MySQLs "
-"administrativa \"root\"-användare."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-#, fuzzy
-#| msgid "New password for MySQL \"root\" user:"
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr "Nytt lösenord för MySQLs \"root\"-användare:"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid "Unable to set password for MySQL \"root\" user"
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr "Lyckades inte sätta lösenord för MySQLs \"root\"-användare"
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "It seems an error occurred while setting the password for the MySQL "
-#| "administrative user. This may have happened because the user already has "
-#| "a password, or because there was a problem communicating with the MySQL "
-#| "server."
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-"Det verkar som ett fel uppstod när det skulle sättas ett lösenord för MySQLs "
-"administrativa användare. Detta kan ha skett för att användaren redan har "
-"ett lösenord satt, eller på grund av problem med att kommunicera med MySQL-"
-"servern."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-#, fuzzy
-#| msgid ""
-#| "See /usr/share/doc/mysql-server-5.1/README.Debian for more information."
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr "Se /usr/share/doc/mysql-server-5.1/README.Debian för mer information."
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid "Cannot upgrade if ISAM tables are present!"
-#~ msgstr "Kan inte uppgradera om ISAM-tabeller finns!"
-
-#~ msgid ""
-#~ "Recent versions of MySQL can no longer use the old ISAM table format and "
-#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by "
-#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". "
-#~ "The installation of mysql-server-5.1 will now abort. In case your old "
-#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert "
-#~ "those tables."
-#~ msgstr ""
-#~ "Senaste versionerna av MySQL kan inte längre använda gamla ISAM-"
-#~ "tabellformatet och det är nödvändigt att konvertera dina tabeller till "
-#~ "exempelvis MyISAM före uppgradering med \"mysql_convert_table_format\" "
-#~ "eller \"ALTER TABLE x ENGINE=MyISAM\". Installationen av mysql-server-5.1 "
-#~ "kommer nu att avbrytas. Om ditt gamla mysql-server-4.1-paket tas bort är "
-#~ "det bara att installera om det för att konvertera de tabellerna."
-
-#~ msgid ""
-#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
-#~ msgstr ""
-#~ "Behöver du MySQL-anslutningar från system som kör Debian \"Sarge\" eller "
-#~ "äldre?"
-
-#, fuzzy
-#~| msgid ""
-#~| "The way passwords were stored was not very secure. This has been "
-#~| "improved with the drawback that clients (e.g. PHP) from hosts running "
-#~| "Debian 3.1 Sarge will not be able to connect to account which are new or "
-#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/"
-#~| "README.Debian."
-#~ msgid ""
-#~ "In old versions of MySQL clients on Debian, passwords were not stored "
-#~ "securely. This has been improved since then, however clients (such as "
-#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
-#~ "recent accounts or accounts whose password have been changed."
-#~ msgstr ""
-#~ "Sättet som lösenorden lagrades på var inte särskilt säkert. Detta har "
-#~ "förbättrats på bekostnad av att klienter (t.ex. PHP) från system som kör "
-#~ "Debian 3.1 Sarge inte kan ansluta till konton som är nya eller vars "
-#~ "lösenord har ändrats. Se /usr/share/doc/mysql-server-5.1/README.Debian."
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "För att använda MySQL måste du installera en motsvarande användare och "
-#~ "grupp till följande och se till att /var/lib/mysql har korrekta "
-#~ "rättigheter satta (uid/gid kan vara olika)."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#~ msgid "Remove the databases used by all MySQL versions?"
-#~ msgstr "Ta bort databaserna som används av alla MySQL-versioner?"
-
-#~ msgid ""
-#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr ""
-#~ "Om du inte anger ett lösenord kommer inga ändringar att göras för kontot."
-
-#~ msgid ""
-#~ "When installation finishes, you should verify that the account is "
-#~ "properly protected with a password (see README.Debian for more "
-#~ "information)."
-#~ msgstr ""
-#~ "När installationen är klar, bör du kontrollera så att kontot är riktigt "
-#~ "skyddat av ett lösenord (läs README.Debian för mer information)."
-
-#~ msgid "Update Hints"
-#~ msgstr "Uppdateringstips"
-
-#~ msgid ""
-#~ "You have to run \"mysql_upgrade\" after the upgrade, else tables can be "
-#~ "corrupted! This script also enhances the privilege tables but is not "
-#~ "supposed to give any user more rights that he had before,"
-#~ msgstr ""
-#~ "Du måste köra \"mysql_upgrade\" efter uppgraderingen, annars kan "
-#~ "tabellerna vara skadade! Detta skript utökar även privilegietabellerna "
-#~ "men är inte tänkte att ge någon användare mer befogenhet än vad han hade "
-#~ "tidigare,"
-
-#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html"
-#~ msgstr "Läs även http://www.mysql.com/doc/en/Upgrade.html"
-
-#~ msgid "Install Hints"
-#~ msgstr "Installationstips"
-
-#~ msgid ""
-#~ "On upgrades from MySQL 3.23, as shipped with Debian Woody, symlinks in "
-#~ "place of /var/lib/mysql or /var/log/mysql gets accidently removed and "
-#~ "have manually be restored."
-#~ msgstr ""
-#~ "Vid uppgraderingar från MySQL 3.23 som skickades med Debian Woody har "
-#~ "symboliska länkar i /var/lib/mysql eller /var/log/mysql av misstag tagits "
-#~ "bort och måste manuellt återskapas."
-
-#~ msgid ""
-#~ "MySQL will only install if you have a non-numeric hostname that is "
-#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
-#~ "myhostname\"."
-#~ msgstr ""
-#~ "MySQL kan endast installeras om du har ett icke-numeriskt värdnamn som "
-#~ "kan slås upp via filen /etc/hosts. Exempelvis om kommandot \"hostname\" "
-#~ "returnerar \"mittnamn\" så bör det finnas en rad som liknar \"10.0.0.1 "
-#~ "mittnamn\"."
-
-#~ msgid ""
-#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
-#~ "is used in the start/stop and cron scripts. Don't delete."
-#~ msgstr ""
-#~ "En ny MySQL-användare kallad \"debian-sys-maint\" kommer att skapas. "
-#~ "Detta MySQL-konto används för start/stopp och cron-skript. Ta inte bort "
-#~ "det."
-
-#~ msgid ""
-#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /"
-#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in "
-#~ "there, never only the password!"
-#~ msgstr ""
-#~ "Tänk på att sätta ett LÖSENORD för MySQL:s root-användare! Om du "
-#~ "använder /root/.my.cnf, skriv då alltid en \"user\"-rad och en \"password"
-#~ "\"-rad i den, aldrig med endast lösenordet!"
-
-#~ msgid ""
-#~ "Should I remove the complete /var/lib/mysql directory tree which is used "
-#~ "by all MySQL versions, not necessarily only the one you are about to "
-#~ "purge?"
-#~ msgstr ""
-#~ "Ska jag ta bort hela katalogträdet i /var/lib/mysql som används av alla "
-#~ "MySQL-versioner och inte bara för den som du nu kommer att rensa ut?"
-
-#~ msgid ""
-#~ "Rarely, e.g. on new major versions, the privilege system is improved. To "
-#~ "make use of it mysql_fix_privilege_tables must be executed manually. The "
-#~ "script is not supposed to give any user more rights that he had before,"
-#~ msgstr ""
-#~ "Sällan, exempelvis i nya större versioner, har behörighetssystemet "
-#~ "förbättrats. För att använda det måste skriptet "
-#~ "mysql_fix_privilege_tables köras manuellt. Skriptet är inte tänkt att ge "
-#~ "någon användare högre behörighet än han hade tidigare."
diff --git a/storage/xtradb/build/debian/po/templates.pot b/storage/xtradb/build/debian/po/templates.pot
deleted file mode 100644
index bbddfe37f83..00000000000
--- a/storage/xtradb/build/debian/po/templates.pot
+++ /dev/null
@@ -1,187 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid "Important note for NIS/YP users"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid "Remove all Percona SQL databases?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-msgid "Start the Percona SQL server on boot?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
diff --git a/storage/xtradb/build/debian/po/tr.po b/storage/xtradb/build/debian/po/tr.po
deleted file mode 100644
index e19ddeedcfa..00000000000
--- a/storage/xtradb/build/debian/po/tr.po
+++ /dev/null
@@ -1,342 +0,0 @@
-# Turkish translation of mysql-server.
-# This file is distributed under the same license as the mysql-server package.
-# Gürkan Aslan <gurkan@iaslan.com>, 2004
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: mysql-dfsg-4.1\n"
-"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n"
-"POT-Creation-Date: 2010-02-15 17:10-0500\n"
-"PO-Revision-Date: 2004-06-05 08:53+0300\n"
-"Last-Translator: Gürkan Aslan <gurkan@iaslan.com>\n"
-"Language-Team: Turkish <debian-l10n-turkish@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=1; plural=0;\n"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "Really proceed with downgrade?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"Such file is an indication that a mysql-server package with a higher version "
-"has been installed earlier."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:2001
-msgid ""
-"There is no guarantee that the version you're currently installing will be "
-"able to use the current databases."
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-#, fuzzy
-#| msgid "Important note for NIS/YP users!"
-msgid "Important note for NIS/YP users"
-msgstr "NIS/YP kullanıcıları için önemli not!"
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"To use MySQL, the following entries for users and groups should be added to "
-"the system:"
-msgstr ""
-
-#. Type: note
-#. Description
-#: ../percona-xtradb-server-5.1.templates:3001
-msgid ""
-"You should also check the permissions and the owner of the /var/lib/mysql "
-"directory:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid "Remove all Percona SQL databases?"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"The /var/lib/mysql directory which contains the Percona SQL databases is "
-"about to be removed."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:4001
-msgid ""
-"If you're removing the Percona SQL package in order to later install a more "
-"recent version or if a different mysql-server package is already using it, "
-"the data should be kept."
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-#| msgid "Should MySQL start on boot?"
-msgid "Start the Percona SQL server on boot?"
-msgstr "MySQL açılış sırasında başlatılsın mı?"
-
-#. Type: boolean
-#. Description
-#: ../percona-xtradb-server-5.1.templates:5001
-#, fuzzy
-msgid ""
-"The Percona SQL server can be launched automatically at boot time or "
-"manually with the '/etc/init.d/mysql start' command."
-msgstr ""
-"MySQL açılış sırasında veya '/etc/init.d/mysql start' komutunu vermeniz "
-"halinde elle başlatılabilir. Eğer açılışta otomatik olarak başlatılmasını "
-"istiyorsanız burada 'evet'i seçin."
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "New password for the Percona SQL \"root\" user:"
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid ""
-"While not mandatory, it is highly recommended that you set a password for "
-"the Percona SQL administrative \"root\" user."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:6001
-msgid "If that field is left blank, the password will not be changed."
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../percona-xtradb-server-5.1.templates:7001
-msgid "Repeat password for the Percona SQL \"root\" user:"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "Unable to set password for the Percona SQL \"root\" user"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"An error occurred while setting the password for the Percona SQL "
-"administrative user. This may have happened because the account already has "
-"a password, or because of a communication problem with the Percona SQL "
-"server."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid "You should check the account's password after the package installation."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:8001
-msgid ""
-"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more "
-"information."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "Password input error"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:9001
-msgid "The two passwords you entered were not the same. Please try again."
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid "NDB Cluster seems to be in use"
-msgstr ""
-
-#. Type: error
-#. Description
-#: ../percona-xtradb-server-5.1.templates:10001
-msgid ""
-"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new "
-"mysql-cluster package and remove all lines starting with \"ndb\" from all "
-"config files below /etc/mysql/."
-msgstr ""
-
-#~ msgid ""
-#~ "To use mysql you must install an equivalent user and group to the "
-#~ "following and ensure yourself that /var/lib/mysql has the right "
-#~ "permissions (the uid/gid may be different)."
-#~ msgstr ""
-#~ "Mysql'i kullanmak için aşağıdakiyle eşdeğer bir kullanıcı ve grup "
-#~ "tanımlamalı, ve /var/lib/mysql izinlerinin uygun şekilde ayarlandığından "
-#~ "emin olmalısınız (uid/gid farklı olabilir)."
-
-#~ msgid ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-#~ msgstr ""
-#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false"
-
-#~ msgid "/etc/group: mysql:x:101:"
-#~ msgstr "/etc/group: mysql:x:101:"
-
-#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql"
-#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql"
-
-#, fuzzy
-#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html"
-#~ msgstr "Lütfen http://www.mysql.com/doc/en/Upgrade.html belgesini okuyun"
-
-#, fuzzy
-#~ msgid ""
-#~ "MySQL will only install if you have a non-numeric hostname that is "
-#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
-#~ "myhostname\"."
-#~ msgstr ""
-#~ "MySQL sadece /etc/hosts dosyası yoluyla çözülebilir NUMERİK OLMAYAN bir "
-#~ "makine adına sahipseniz kurulacaktır. Örneğin, eğer \"hostname\" komutu "
-#~ "\"makinem\" ismini döndürüyorsa, bu dosya içinde \"10.0.0.1 makinem\" "
-#~ "gibi bir satır olmalıdır."
-
-#, fuzzy
-#~ msgid ""
-#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
-#~ "is used in the start/stop and cron scripts. Don't delete."
-#~ msgstr ""
-#~ "Yeni mysql kullanıcısı \"debian-sys-maint\" yaratılacak. Bu hesap, "
-#~ "başlangıç betiklerinde ve cron içinde kullanılıyor. Bu hesabı silmeyin."
-
-#, fuzzy
-#~ msgid ""
-#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /"
-#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in "
-#~ "there, never only the password!"
-#~ msgstr ""
-#~ "Lütfen MySQL root kullanıcısı için bir PAROLA girmeyi unutmayın! Eğer /"
-#~ "root/.my.cnf kullanıyorsanız, \"user\" ve \"password\" satırlarını her "
-#~ "zaman buraya ekleyin, sadece parolayı değil! Daha fazla bilgi için /usr/"
-#~ "share/doc/mysql-server/README.Debian dosyasını okuyun."
-
-#, fuzzy
-#~ msgid ""
-#~ "Should I remove all databases below /var/lib/mysql as you are purging the "
-#~ "mysql-server package?"
-#~ msgstr ""
-#~ "mysql-server paketi kaldırıldıktan sonra bütün veritabanları silinsin mi?"
-
-#~ msgid ""
-#~ "Networking is disabled by default for security reasons. You can enable it "
-#~ "by commenting out the skip-networking option in /etc/mysql/my.cnf."
-#~ msgstr ""
-#~ "Ağ, öntanımlı olarak güvenlik gerekçeleriyle devre dışı bırakıldı. Bu "
-#~ "özelliği /etc/mysql/my.cnf dosyası içindeki \"skip-networking\" "
-#~ "seçeneğini kaldırarak etkinleştirebilirsiniz."
-
-#~ msgid "security and update notice"
-#~ msgstr "güvenlik ve güncelleme duyurusu"
-
-#~ msgid ""
-#~ "Should I remove everything below /var/lib/mysql when you purge the mysql-"
-#~ "server package with the \"dpkg --purge mysql-server\" command (i.e. "
-#~ "remove everything including the configuration) somewhen? (default is not)"
-#~ msgstr ""
-#~ "mysql-server paketini temizlemek için \"dpkg --purge mysql-server\" "
-#~ "komutunu kullandığınızda (yani yapılandırma dahil herşeyi silmek) /var/"
-#~ "lib/mysql altındaki herşeyi sileyim mi? (öntanımlı cevap hayır'dır)."
-
-#~ msgid "Please run mysql_fix_privilege_tables !"
-#~ msgstr "Lütfen mysql_fix_privilege_tables komutunu çalıştırın!"
-
-#~ msgid ""
-#~ "I will ensure secure permissions of /var/lib/mysql by replacing GIDs "
-#~ "other than root and mysql with mysql."
-#~ msgstr ""
-#~ "/var/lib/mysql'in izinlerinin güvenli olmasını sağlamak amacıyla, buna "
-#~ "ait GID'leri root ve mysql'den farklı olacak şekilde değiştireceğim."
-
-#~ msgid ""
-#~ "Instructions how to enable SSL support are in /usr/share/doc/mysql-server/"
-#~ msgstr ""
-#~ "SSL desteğini nasıl etkinleştirebileceğinize ilişkin talimatlar /usr/"
-#~ "share/doc/mysql-server/ içinde."
-
-#~ msgid "mysql_fix_privileges_tables will be executed"
-#~ msgstr "mysql_fix_privileges_tables çalıştırılacak"
-
-#~ msgid ""
-#~ "The latest MySQL versions have an enhanced, more fine grained, privilege "
-#~ "system. To make use of it, some new fields must be added to the tables "
-#~ "in the \"mysql\" database. This is done by the "
-#~ "mysql_fix_privilege_tables script during this upgrade regardless of if "
-#~ "the server is currently running or not!"
-#~ msgstr ""
-#~ "En son MySQL sürümleri zenginleştirilmiş, daha ayrıntılandırılmış bir "
-#~ "ayrıcalık (privilege) sistemine sahiptir. Yeni sistemi kullanmak için, "
-#~ "\"mysql\" veritabanındaki tablolara bazı yeni alanlar eklenmelidir. Bu "
-#~ "işlem, sunucunun çalışıp çalışmamasına bağlı olmaksızın "
-#~ "mysql_fix_privilege_tables betiği tarafından bu yükseltme sırasında "
-#~ "yapılır."
-
-#~ msgid ""
-#~ "This script is not supposed to give any user more rights that he had "
-#~ "before, if you encounter such a case, please contact me."
-#~ msgstr ""
-#~ "Bu betiğin hiç bir kullanıcıya öncekinden daha fazla hak kazandırmadığı "
-#~ "varsayılıyor. Eğer bunun aksinde bir durumla karşılaşırsanız, lütfen "
-#~ "benimle bağlantıya geçin."
-
-#~ msgid "Make MySQL reachable via network?"
-#~ msgstr "MySQL network üzerinden ulaşılabilir olsun mu?"
-
-#~ msgid ""
-#~ "Should MySQL listen on a network reachable TCP port? This is not "
-#~ "necessary for use on a single computer and could be a security problem."
-#~ msgstr ""
-#~ "MySQL ağ üzerinde ulaşılabilen bir TCP portunu dinlesin mi? Tek olan bir "
-#~ "bilgisayar için bu ayar gerekli değildir ve bir güvenlik sorunu "
-#~ "oluÅŸturabilir."
-
-#~ msgid "Enable chroot mode?"
-#~ msgstr "chroot kipi etkinleÅŸtirilsin mi?"
-
-#~ msgid ""
-#~ "MySQL is able to jail itself into the /var/lib/mysql_jail directory so "
-#~ "that users cannot modify any files outside this directory. This improves "
-#~ "resistence against crackers, too, as they are not able to modify system "
-#~ "files."
-#~ msgstr ""
-#~ "MySQL kendini /var/lib/mysql_jail dizinine hapsederek kullanıcıların bu "
-#~ "dizin dışındaki hiç bir dosyayı değiştirmemesini sağlayabilir. Bu "
-#~ "düzenleme, sistem dosyalarını değiştirmelerini engelleyeceğinden, "
-#~ "cracker'lara karşı dayanıklılığı arttırır."
diff --git a/storage/xtradb/build/debian/rules b/storage/xtradb/build/debian/rules
deleted file mode 100755
index f166009da2c..00000000000
--- a/storage/xtradb/build/debian/rules
+++ /dev/null
@@ -1,322 +0,0 @@
-#!/usr/bin/make -f
-
-export DH_VERBOSE=1
-
-PACKAGE=percona-xtradb-dfsg-5.1
-
-include /usr/share/dpatch/dpatch.make
-
-TMP=$(CURDIR)/debian/tmp/
-
-ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
-ARCH_OS = $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
-DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEBVERSION = $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }' | sed 's/^.*-//' )
-
-DEB_SOURCE_PACKAGE ?= $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':'))
-DEB_VERSION ?= $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
-DEB_NOEPOCH_VERSION ?= $(shell echo $(DEB_VERSION) | cut -d: -f2-)
-DEB_UPSTREAM_VERSION ?= $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//')
-DEB_UPSTREAM_VERSION_MAJOR_MINOR := $(shell echo $(DEB_UPSTREAM_VERSION) | sed -r -n 's/^([0-9]+\.[0-9]+).*/\1/p')
-
-DISTRIBUTION = $(shell echo "Percona SQL Server (GPL), XtraDB 10")
-
-MAKE_J = -j$(shell if [ -f /proc/cpuinfo ] ; then grep -c processor.* /proc/cpuinfo ; else echo 1 ; fi)
-ifeq (${MAKE_J}, -j0)
- MAKE_J = -j1
-endif
-
-MAKE_TEST_TARGET=test-force
-ifneq ($(findstring $(DEB_BUILD_OPTIONS),fulltest),)
-# make test-bt is the testsuite run by the MySQL build team
-# before a release, but it is long
- MAKE_TEST_TARGET=test-bt
-endif
-
-USE_ASSEMBLER=--enable-assembler
-
-#ifneq ($(findstring $(ARCH), alpha amd64 arm armel ia64 i386 hppa mipsel powerpc s390 sparc),)
-# TESTSUITE_FAIL_CMD=true
-#else
- TESTSUITE_FAIL_CMD=exit 1
-#endif
-
-# This causes seg11 crashes if LDAP is used for groups in /etc/nsswitch.conf
-# so it is disabled by default although, according to MySQL, it brings >10%
-# performance gain if enabled. See #299382.
-ifeq ($(STATIC_MYSQLD), 1)
- USE_STATIC_MYSQLD=--with-mysqld-ldflags=-all-static
-endif
-
-configure: patch configure-stamp
-configure-stamp:
- @echo "RULES.configure-stamp"
- dh_testdir
-
-ifneq ($(ARCH_OS),hurd)
- if [ ! -d /proc/self ]; then echo "/proc IS NEEDED" 1>&2; exit 1; fi
-endif
-
- sh -c 'PATH=$${MYSQL_BUILD_PATH:-"/bin:/usr/bin"} \
- CC=$${MYSQL_BUILD_CC:-gcc} \
- CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-O3 -DBIG_JOINS=1 ${FORCE_FPIC_CFLAGS}"} \
- CXX=$${MYSQL_BUILD_CXX:-g++} \
- CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O3 -DBIG_JOINS=1 -felide-constructors -fno-exceptions -fno-rtti ${FORCE_FPIC_CFLAGS}"} \
- ./configure \
- --build=${DEB_BUILD_GNU_TYPE} \
- --host=${DEB_HOST_GNU_TYPE} \
- \
- --prefix=/usr \
- --exec-prefix=/usr \
- --libexecdir=/usr/sbin \
- --datadir=/usr/share \
- --localstatedir=/var/lib/mysql \
- --includedir=/usr/include \
- --infodir=/usr/share/info \
- --mandir=/usr/share/man \
- \
- --with-server-suffix="-$(DEBVERSION)" \
- --with-comment="($(DISTRIBUTION))" \
- --with-system-type="debian-linux-gnu" \
- \
- --enable-shared \
- --enable-static \
- --enable-thread-safe-client \
- $(USE_ASSEMBLER) \
- --enable-local-infile \
- $(FORCE_FPIC) \
- --with-fast-mutexes \
- --with-big-tables \
- --with-unix-socket-path=/var/run/mysqld/mysqld.sock \
- --with-mysqld-user=mysql \
- --with-libwrap \
- $(USE_STATIC_MYSQLD) \
- --with-ssl \
- --without-docs \
- --with-extra-charsets=all \
- --with-plugins=max-no-ndb \
- \
- --without-embedded-server \
- --with-embedded-privilege-control'
-
- # --sysconfdir=/etc/mysql -- Appends /etc/mysql after ~/ in the my.cnf search patch!
- #
- # --with-debug
-
- touch configure-stamp
-
-
-build: build-stamp
-build-stamp: configure
- dh_testdir
-
- $(MAKE) $(MAKE_J)
-
-ifeq ($(findstring $(DEB_BUILD_OPTIONS),nocheck),)
- if [ ! -f testsuite-stamp ] ; then \
- $(MAKE) $(MAKE_TEST_TARGET) || $(TESTSUITE_FAIL_CMD) ; \
- fi
-endif
-
- touch testsuite-stamp
-
- touch build-stamp
-
-
-clean: clean-patched unpatch
- rm -rf debian/patched
-clean-patched:
- @echo "RULES.clean-patched"
- dh_testdir
- dh_testroot
- rm -f configure-stamp
- rm -f build-stamp
- rm -f testsuite-stamp
-
- [ ! -f Makefile ] || $(MAKE) clean
- [ ! -d mysql-test/var ] || rm -rf mysql-test/var
-
- # We like to see how long this is neccessary
- @echo "CRUFT BEGIN"
- @find -type l -print0 | xargs --no-run-if-empty -0 rm -v
- @find -name .deps -type d -print0 | xargs --no-run-if-empty -0 rm -rfv
- @rm -vrf ndb/docs/.doxy* ndb/docs/*html ndb/docs/*pdf innobase/autom4te.cache
- @for i in \
- readline/Makefile \
- sql-bench/Makefile \
- scripts/make_win_binary_distribution \
- scripts/mysqlbug \
- sql/gen_lex_hash \
- sql/lex_hash.h \
- strings/ctype_autoconf.c \
- config.log \
- config.cache \
- ; \
- do \
- rm -vf $$i; \
- done
- @echo "CRUFT END"
-
- debconf-updatepo
- dh_clean -v
-
-
-install:
-install: build
- @echo "RULES.install"
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- # some self written manpages which hopefully
- # gets overwritten sooner or later with upstreams
- mkdir -p $(TMP)/usr/share/man/man1/
- mkdir -p $(TMP)/usr/share/man/man8/
- cp debian/additions/*.1 $(TMP)/usr/share/man/man1/
- mkdir -p $(TMP)/etc/mysql/conf.d/
- cp debian/additions/mysqld_safe_syslog.cnf $(TMP)/etc/mysql/conf.d/
- ln -s mysqlmanager.1 $(TMP)/usr/share/man/man1/mysqlmanager-pwgen.1
- ln -s mysqlmanager.1 $(TMP)/usr/share/man/man1/mysqlmanagerc.1
-
- # make install (trailing slash needed for innobase)
- $(MAKE) install DESTDIR=$(TMP)/
-
- # After installing, remove rpath to make lintian happy.
- set +e; \
- find ./debian/tmp/ -type f -print0 \
- | xargs -0 --no-run-if-empty chrpath -k 2>/dev/null \
- | fgrep RPATH= \
- | cut -d: -f 1 \
- | xargs --no-run-if-empty chrpath -d; \
- set -e
-
- # libmysqlclient: move shared libraries (but not the rest like libheap.a & co)
- mv $(TMP)/usr/lib/mysql/libmysqlclient* $(TMP)/usr/lib
- perl -pi -e 's#/usr/lib/mysql#/usr/lib#' $(TMP)/usr/lib/libmysqlclient.la
- perl -pi -e 's#/usr/lib/mysql#/usr/lib#' $(TMP)/usr/lib/libmysqlclient_r.la
- # Check if our beloved versioned symbols are really there
- if [ "`objdump -T $(TMP)/usr/lib/libmysqlclient.so.16.0.0 | grep -c libmysqlclient_16`" -lt 500 ]; then \
- echo "ERROR: versioned symbols are absent"; \
- exit 1; \
- fi
-
- # libmysqlclient-dev: forgotten header file since 3.23.25?
- cp include/my_config.h $(TMP)/usr/include/mysql/
- cp include/my_dir.h $(TMP)/usr/include/mysql/
-
- # percona-xtradb-common: We now provide our own config file.
- install -d $(TMP)/etc/mysql
- install -m 0644 debian/additions/my.cnf $(TMP)/etc/mysql/my.cnf
-
- # percona-xtradb-client
- install -m 0755 debian/additions/mysqlreport $(TMP)/usr/bin/
- install -m 0755 debian/additions/innotop/innotop $(TMP)/usr/bin/
- install -m 0644 debian/additions/innotop/innotop.1 $(TMP)/usr/share/man/man1/
- install -m 0644 -D debian/additions/innotop/InnoDBParser.pm $(TMP)/usr/share/perl5/InnoDBParser.pm
-
- # percona-xtradb-server
- install -m 0755 scripts/mysqld_safe $(TMP)/usr/bin/mysqld_safe
- mkdir -p $(TMP)/usr/share/doc/percona-xtradb-server-5.1/examples
- mv $(TMP)/usr/share/mysql/*cnf $(TMP)/usr/share/doc/percona-xtradb-server-5.1/examples/
- rm -vf $(TMP)/usr/share/mysql/mi_test_all* \
- $(TMP)/usr/share/mysql/mysql-log-rotate \
- $(TMP)/usr/share/mysql/mysql.server \
- $(TMP)/usr/share/mysql/binary-configure
- nm -n sql/mysqld |gzip -9 > $(TMP)/usr/share/doc/percona-xtradb-server-5.1/mysqld.sym.gz
- install -m 0755 debian/additions/echo_stderr $(TMP)/usr/share/mysql/
- install -m 0755 debian/additions/debian-start $(TMP)/etc/mysql/
- install -m 0755 debian/additions/debian-start.inc.sh $(TMP)/usr/share/mysql/
- # lintian overrides
- mkdir -p $(TMP)/usr/share/lintian/overrides/
- cp debian/percona-xtradb-common.lintian-overrides $(TMP)/usr/share/lintian/overrides/percona-xtradb-common
- cp debian/percona-xtradb-server-5.1.lintian-overrides $(TMP)/usr/share/lintian/overrides/percona-xtradb-server-5.1
- cp debian/percona-xtradb-client-5.1.lintian-overrides $(TMP)/usr/share/lintian/overrides/percona-xtradb-client-5.1
-
- # For 5.0 -> 5.1 transition
- d=$(TMP)/usr/share/percona-xtradb-common/internal-use-only/; \
- mkdir -p $$d; \
- cp debian/percona-xtradb-server-5.1.mysql.init $$d/_etc_init.d_mysql; \
- cp debian/percona-xtradb-server-5.1.logrotate $$d/_etc_logrotate.d_percona-xtradb-server; \
- cp debian/additions/debian-start $$d/_etc_mysql_debian-start;
-
- dh_movefiles
-
-# Build architecture-independent files here.
-binary-indep: build install
- @echo "RULES.binary-indep"
- dh_testdir -i
- dh_testroot -i
- dh_installdebconf -i
- dh_installdocs -i
- dh_installexamples -i
- dh_installmenu -i
- dh_installlogrotate -i
- dh_installinit -i
- dh_installcron -i
- dh_installman -i
- dh_installinfo -i
- dh_installlogcheck -i
- dh_installchangelogs -i
- dh_link -i
- dh_compress -i
- dh_fixperms -i
- dh_installdeb -i
- dh_perl -i
- dh_gencontrol -i
- dh_md5sums -i
- dh_builddeb -i
-
-# Build architecture-dependent files here.
-binary-arch: build install
- @echo "RULES.binary-arch"
- dh_testdir
- dh_testroot
-
- dh_installdebconf -a
- dh_installdocs -a
- dh_installexamples -a
- dh_installmenu -a
- dh_installlogrotate -a --name percona-xtradb-server
- # Start mysql in runlevel 19 before 20 where apache, proftpd etc gets
- # started which might depend on a running database server.
- dh_installinit -a --name=mysql -- defaults 19 21
- dh_installcron -a --name percona-xtradb-server
- dh_installman -a
- dh_installinfo -a
- dh_installlogcheck -a
- dh_installchangelogs -a
- dh_strip -a
- dh_link -a # .so muss nach .so.1.2.3 installier werden!
- dh_compress -a
- dh_fixperms -a
- dh_makeshlibs -a
- dh_makeshlibs -plibmysqlclient16 -V'libmysqlclient16 (>= 5.1.21-1)'
- dh_installdeb -a
- dh_perl -a
- dh_shlibdeps -a -l debian/libmysqlclient16/usr/lib -L libmysqlclient16
- dh_gencontrol -a
- dh_md5sums -a
- dh_builddeb -a
-
-source diff:
- @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-binary: binary-indep binary-arch
-
-get-orig-source:
- @wget -nv -T10 -t3 \
- -O /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz \
- http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-$(DEB_UPSTREAM_VERSION_MAJOR_MINOR)/mysql-$(DEB_UPSTREAM_VERSION).tar.gz
- @tar xfz /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz -C /tmp
- @rm -rf /tmp/mysql-$(DEB_UPSTREAM_VERSION)/Docs
- @rm -rf /tmp/mysql-$(DEB_UPSTREAM_VERSION)/debian
- @mv /tmp/mysql-$(DEB_UPSTREAM_VERSION) /tmp/$(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig
- @cd /tmp ; tar czf $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION).orig.tar.gz $(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig
- @rm -f /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz
- @rm -rf /tmp/$(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig
-
-.PHONY: clean clean-patched configure build binary binary-indep binary-arch install patch unpatch
-
-# vim: ts=8
diff --git a/storage/xtradb/build/debian/source.lintian-overrides b/storage/xtradb/build/debian/source.lintian-overrides
deleted file mode 100644
index 7a93dd28f84..00000000000
--- a/storage/xtradb/build/debian/source.lintian-overrides
+++ /dev/null
@@ -1,2 +0,0 @@
-maintainer-script-lacks-debhelper-token debian/mysql-server-5.1.postinst
-maintainer-script-lacks-debhelper-token debian/mysql-server-5.1.postrm
diff --git a/storage/xtradb/build/debian/watch b/storage/xtradb/build/debian/watch
deleted file mode 100644
index f6fdd67bd8d..00000000000
--- a/storage/xtradb/build/debian/watch
+++ /dev/null
@@ -1,3 +0,0 @@
-version=3
-opts="uversionmangle=s/-(rc|beta)/$1/" \
- ftp://sunsite.informatik.rwth-aachen.de/pub/mirror/www.mysql.com/Downloads/MySQL-5.1/mysql-([\d\.]*(?:-beta|-rc)?).tar.gz debian
diff --git a/storage/xtradb/build/percona-sql.spec b/storage/xtradb/build/percona-sql.spec
deleted file mode 100644
index d0fa6f2a41d..00000000000
--- a/storage/xtradb/build/percona-sql.spec
+++ /dev/null
@@ -1,1644 +0,0 @@
-#############################################################################
-#
-# This is the spec file for the distribution specific RPM files
-#
-##############################################################################
-
-##############################################################################
-# Some common macro definitions
-##############################################################################
-
-# Required arguments
-# mysqlversion - e.g. 5.1.37
-# pluginversion - Version of InnoDB plugin taken as the basis, e.g. 1.0.3
-# redhatversion - 5 or 4
-# xtradbversion - The XtraDB release, eg. 6
-
-%define mysql_vendor Percona, Inc
-%define redhatversion %(cat /etc/redhat-release | awk '{ print $3}' | awk -F. '{ print $1}')
-%define community 1
-%define mysqlversion 5.1.45
-%define pluginversion 1.0.6
-%define xtradbversion 10
-%define distribution rhel%{redhatversion}
-%define release %{xtradbversion}.%{distribution}
-
-%define mysqld_user mysql
-%define mysqld_group mysql
-%define mysqldatadir /var/lib/mysql
-%define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com
-
-# ------------------------------------------------------------------------------
-# Meta information, don't remove!
-# ------------------------------------------------------------------------------
-# norootforbuild
-
-# ------------------------------------------------------------------------------
-# On SuSE 9 no separate "debuginfo" package is built. To enable basic
-# debugging on that platform, we don't strip binaries on SuSE 9. We
-# disable the strip of binaries by redefining the RPM macro
-# "__os_install_post" leaving out the script calls that normally does
-# this. We do this in all cases, as on platforms where "debuginfo" is
-# created, a script "find-debuginfo.sh" will be called that will do
-# the strip anyway, part of separating the executable and debug
-# information into separate files put into separate packages.
-#
-# Some references (shows more advanced conditional usage):
-# http://www.redhat.com/archives/rpm-list/2001-November/msg00257.html
-# http://www.redhat.com/archives/rpm-list/2003-February/msg00275.html
-# http://www.redhat.com/archives/rhl-devel-list/2004-January/msg01546.html
-# http://lists.opensuse.org/archive/opensuse-commit/2006-May/1171.html
-# ------------------------------------------------------------------------------
-%define __os_install_post /usr/lib/rpm/brp-compress
-
-# ------------------------------------------------------------------------------
-# We don't package all files installed into the build root by intention -
-# See BUG#998 for details.
-# ------------------------------------------------------------------------------
-%define _unpackaged_files_terminate_build 0
-
-# ------------------------------------------------------------------------------
-# RPM build tools now automatically detects Perl module dependencies. This
-# detection gives problems as it is broken in some versions, and it also
-# give unwanted dependencies from mandatory scripts in our package.
-# Might not be possible to disable in all RPM tool versions, but here we
-# try. We keep the "AutoReqProv: no" for the "test" sub package, as disabling
-# here might fail, and that package has the most problems.
-# See http://fedoraproject.org/wiki/Packaging/Perl#Filtering_Requires:_and_Provides
-# http://www.wideopen.com/archives/rpm-list/2002-October/msg00343.html
-# ------------------------------------------------------------------------------
-%undefine __perl_provides
-%undefine __perl_requires
-
-##############################################################################
-# Command line handling
-##############################################################################
-
-# ----------------------------------------------------------------------
-# use "rpmbuild --with yassl" or "rpm --define '_with_yassl 1'" (for RPM 3.x)
-# to build with yaSSL support (off by default)
-# ----------------------------------------------------------------------
-%{?_with_yassl:%define YASSL_BUILD 1}
-%{!?_with_yassl:%define YASSL_BUILD 0}
-
-# ----------------------------------------------------------------------
-# use "rpmbuild --without libgcc" or "rpm --define '_without_libgcc 1'" (for RPM 3.x)
-# to include libgcc (as libmygcc) (on by default)
-# ----------------------------------------------------------------------
-%{!?_with_libgcc: %{!?_without_libgcc: %define WITH_LIBGCC 1}}
-%{?_with_libgcc:%define WITH_LIBGCC 1}
-%{?_without_libgcc:%define WITH_LIBGCC 0}
-
-
-# On SuSE 9 no separate "debuginfo" package is built. To enable basic
-# debugging on that platform, we don't strip binaries on SuSE 9. We
-# disable the strip of binaries by redefining the RPM macro
-# "__os_install_post" leaving out the script calls that normally does
-# this. We do this in all cases, as on platforms where "debuginfo" is
-# created, a script "find-debuginfo.sh" will be called that will do
-# the strip anyway, part of separating the executable and debug
-# information into separate files put into separate packages.
-#
-# Some references (shows more advanced conditional usage):
-# http://www.redhat.com/archives/rpm-list/2001-November/msg00257.html
-# http://www.redhat.com/archives/rpm-list/2003-February/msg00275.html
-# http://www.redhat.com/archives/rhl-devel-list/2004-January/msg01546.html
-# http://lists.opensuse.org/archive/opensuse-commit/2006-May/1171.html
-
-%define __os_install_post /usr/lib/rpm/brp-compress
-
-%define server_suffix -51
-%define package_suffix -51
-%define ndbug_comment Percona SQL Server (GPL), XtraDB %{xtradbversion}
-%define debug_comment Percona SQL Server - Debug (GPL), XtraDB %{xtradbversion}
-%define commercial 0
-%define YASSL_BUILD 1
-%define EMBEDDED_BUILD 0
-%define PARTITION_BUILD 1
-%define CLUSTER_BUILD 0
-%define COMMUNITY_BUILD 1
-%define INNODB_BUILD 1
-%define PERCONA_PLUGIN_BUILD 1
-%define MARIA_BUILD 0
-%define NORMAL_TEST_MODE test-bt
-%define DEBUG_TEST_MODE test-bt-debug
-
-%define BUILD_DEBUG 0
-
-
-%if %{COMMUNITY_BUILD}
-%define cluster_package_prefix -cluster
-%else
-%define cluster_package_prefix -
-%endif
-
-%define lic_type GNU GPL v2
-%define lic_files COPYING README
-%define src_dir mysql-%{mysqlversion}
-
-Source1: percona-xtradb-%{pluginversion}-%{xtradbversion}.tar.gz
-Patch0: percona-support.patch
-
-Patch01: show_patches.patch
-Patch02: slow_extended.patch
-Patch03: profiling_slow.patch
-Patch04: microsec_process.patch
-Patch05: userstat.patch
-Patch06: optimizer_fix.patch
-Patch07: mysql-test_for_xtradb.diff
-Patch08: show_temp_51.patch
-
-
-%define perconaxtradbplugin percona-xtradb-%{pluginversion}-%{xtradbversion}.tar.gz
-
-##############################################################################
-# Main spec file section
-##############################################################################
-
-Name: Percona-XtraDB%{package_suffix}
-Summary: Percona-XtraDB: a very fast and reliable SQL database server
-Group: Applications/Databases
-Version: %{mysqlversion}
-Release: %{release}
-Distribution: Red Hat Enterprise Linux %{redhatversion}
-License: GPL version 2 http://www.gnu.org/licenses/gpl-2.0.html
-Source: %{src_dir}.tar.gz
-URL: http://www.percona.com/
-Packager: %{mysql_vendor} MySQL Development Team <mysql-dev@percona.com>
-Vendor: %{mysql_vendor}
-Provides: msqlormysql MySQL-server Percona-XtraDB-server
-BuildRequires: gperf perl readline-devel gcc-c++ ncurses-devel zlib-devel libtool automake autoconf time ccache bison
-
-# Think about what you use here since the first step is to
-# run a rm -rf
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
-
-# From the manual
-%description
-The Percona-XtraDB software delivers a very fast, multi-threaded, multi-user,
-and robust SQL (Structured Query Language) database server. Percona-XtraDB Server
-is intended for mission-critical, heavy-load production systems as well
-as for embedding into mass-deployed software.
-
-Percona Inc. provides commercial support of Percona-XtraDB Server.
-For more information visist our web site http://www.percona.com/
-
-##############################################################################
-# Sub package definition
-##############################################################################
-
-%package -n Percona-XtraDB-server%{package_suffix}
-Summary: %{ndbug_comment} for Red Hat Enterprise Linux %{redhatversion}
-Group: Applications/Databases
-Requires: chkconfig coreutils shadow-utils grep procps
-Provides: msqlormysql mysql-server MySQL-server Percona-XtraDB-server
-Obsoletes: MySQL mysql mysql-server MySQL-server MySQL-server-community MySQL-server-percona
-
-%description -n Percona-XtraDB-server%{package_suffix}
-The Percona-XtraDB software delivers a very fast, multi-threaded, multi-user,
-and robust SQL (Structured Query Language) database server. Percona-XtraDB Server
-is intended for mission-critical, heavy-load production systems as well
-as for embedding into mass-deployed software.
-
-Percona Inc. provides commercial support of Percona-XtraDB Server.
-For more information visist our web site http://www.percona.com/
-
-This package includes the Percona-XtraDB server binary
-%if %{INNODB_BUILD}
-(configured including XtraDB)
-%endif
-as well as related utilities to run and administer a Percona-XtraDB server.
-
-If you want to access and work with the database, you have to install
-package "Percona-XtraDB-client%{package_suffix}" as well!
-
-# ------------------------------------------------------------------------------
-
-%package -n Percona-XtraDB-client%{package_suffix}
-Summary: Percona-XtraDB - Client
-Group: Applications/Databases
-Obsoletes: mysql-client MySQL-client MySQL-client-community MySQL-client-percona
-Provides: mysql-client MySQL-client Percona-XtraDB-client mysql MySQL
-
-%description -n Percona-XtraDB-client%{package_suffix}
-This package contains the standard Percona-XtraDB clients and administration tools.
-
-%{see_base}
-
-
-# ------------------------------------------------------------------------------
-
-%package -n Percona-XtraDB-test%{package_suffix}
-Requires: mysql-client perl
-Summary: Percona-XtraDB - Test suite
-Group: Applications/Databases
-Provides: mysql-test MySQL-test Percona-XtraDB-test
-Obsoletes: mysql-test MySQL-test MySQL-test-community MySQL-test-percona
-AutoReqProv: no
-
-%description -n Percona-XtraDB-test%{package_suffix}
-This package contains the Percona-XtraDB regression test suite.
-
-%{see_base}
-
-# ------------------------------------------------------------------------------
-
-%package -n Percona-XtraDB-devel%{package_suffix}
-Summary: Percona-XtraDB - Development header files and libraries
-Group: Applications/Databases
-Provides: mysql-devel MySQL-devel Percona-XtraDB-devel
-Obsoletes: mysql-devel MySQL-devel MySQL-devel-community MySQL-devel-percona
-
-%description -n Percona-XtraDB-devel%{package_suffix}
-This package contains the development header files and libraries
-necessary to develop Percona-XtraDB client applications.
-
-%{see_base}
-
-# ------------------------------------------------------------------------------
-
-%package -n Percona-XtraDB-shared%{package_suffix}
-Summary: Percona-XtraDB - Shared libraries
-Group: Applications/Databases
-Provides: mysql-shared MySQL-shared Percona-XtraDB-shared
-# Obsoletes below to correct old missing Provides:/Obsoletes
-Obsoletes: mysql-shared MySQL-shared-standard MySQL-shared-pro
-Obsoletes: MySQL-shared-pro-cert MySQL-shared-pro-gpl
-Obsoletes: MySQL-shared-pro-gpl-cert MySQL-shared MySQL-shared-community MySQL-shared-percona
-
-%description -n Percona-XtraDB-shared%{package_suffix}
-This package contains the shared libraries (*.so*) which certain
-languages and applications need to dynamically load and use MySQL.
-
-# ------------------------------------------------------------------------------
-
-%if %{PERCONA_PLUGIN_BUILD}
-
-%package -n Percona-XtraDB-%{pluginversion}-%{xtradbversion}
-Requires: Percona-XtraDB-devel
-Summary: Percona XtraDB Storage engine for MySQL
-Group: Applications/Databases
-Provides: percona-xtradb-plugin Percona-XtraDB-plugin
-Obsoletes: percona-xtradb-plugin Percona-XtraDB-plugin
-
-%description -n Percona-XtraDB-%{pluginversion}-%{xtradbversion}
-This package contains the Percona-XtraDB storage engine for MySQL server.
-
-An enhanced version of the InnoDB storage engine, including all
-of InnoDB's robust, reliable ACID-compliant design and advanced
-MVCC architecture, and builds on that solid foundation with more
-features, more tunability, more metrics, and more scalability.
-In particular, it is designed to scale better on many cores,
-to use memory more efficiently, and to be more convenient and useful.
-The new features are especially designed to reduce the need for
-awkward workarounds to many of InnoDB's limitations. We choose
-features and fixes based on customer requests and on our best
-judgment as a high-performance consulting company.
-
-%endif
-
-##############################################################################
-#
-##############################################################################
-
-%prep
-
-%setup -n %{src_dir}
-
-%patch01 -p1
-%patch02 -p1
-%patch03 -p1
-%patch04 -p1
-%patch05 -p1
-%patch06 -p1
-%patch07 -p1
-%patch08 -p1
-
-if [ "%{redhatversion}" = "5" ] ; then
-tar xfz $RPM_SOURCE_DIR/%{perconaxtradbplugin} -C storage/innobase --strip-components=1
-else
-tar xfz $RPM_SOURCE_DIR/%{perconaxtradbplugin} -C storage/innobase --strip-path=1
-fi
-%patch0 -p1
-
-cd storage/innobase && bash -x ./setup.sh
-
-##############################################################################
-# The actual build
-##############################################################################
-
-%build
-
-BuildMySQL() {
-# Get flags from environment. RPM_OPT_FLAGS seems not to be set anywhere.
-CFLAGS=${CFLAGS:-$RPM_OPT_FLAGS}
-CXXFLAGS=${CXXFLAGS:-$RPM_OPT_FLAGS}
-# Evaluate current setting of $DEBUG
-if [ $DEBUG -gt 0 ] ; then
- OPT_COMMENT='--with-comment="%{debug_comment}"'
- OPT_DEBUG='--with-debug'
- CFLAGS=`echo " $CFLAGS " | \
- sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
- -e 's/^ //' -e 's/ $//'`
- CXXFLAGS=`echo " $CXXFLAGS " | \
- sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
- -e 's/^ //' -e 's/ $//'`
-else
- OPT_COMMENT='--with-comment="%{ndbug_comment}"'
- OPT_DEBUG=''
-fi
-
-echo "BUILD =================="
-echo $*
-
-# The --enable-assembler simply does nothing on systems that does not
-# support assembler speedups.
-sh -c "CFLAGS=\"$CFLAGS\" \
- CXXFLAGS=\"$CXXFLAGS\" \
- AM_CPPFLAGS=\"$AM_CPPFLAGS\" \
- LDFLAGS=\"$LDFLAGS\" \
- ./configure \
- $* \
- --enable-assembler \
- --enable-local-infile \
- --with-mysqld-user=%{mysqld_user} \
- --with-unix-socket-path=/var/lib/mysql/mysql.sock \
- --with-pic \
- --prefix=/ \
-%if %{CLUSTER_BUILD}
- --with-extra-charsets=all \
-%else
- --with-extra-charsets=complex \
-%endif
-%if %{YASSL_BUILD}
- --with-ssl \
-%else
- --without-ssl \
-%endif
- --exec-prefix=%{_exec_prefix} \
- --libexecdir=%{_sbindir} \
- --libdir=%{_libdir} \
- --sysconfdir=%{_sysconfdir} \
- --datadir=%{_datadir} \
- --localstatedir=%{mysqldatadir} \
- --infodir=%{_infodir} \
- --includedir=%{_includedir} \
- --mandir=%{_mandir} \
- --enable-thread-safe-client \
- --enable-profiling \
-%if %{?ndbug_comment:1}0
- $OPT_COMMENT \
-%endif
- $OPT_DEBUG \
-%if %{commercial}
- --with-libedit \
-%else
- --with-readline \
-%endif
- ; make "
-}
-# end of function definition "BuildMySQL"
-
-
-BuildServer() {
-BuildMySQL "--enable-shared \
-%if %{?server_suffix:1}0
- --with-server-suffix='%{server_suffix}' \
-%endif
-%if %{CLUSTER_BUILD}
- --with-plugin-ndbcluster \
-%else
- --without-plugin-ndbcluster \
-%endif
-%if %{MARIA_BUILD}
- --with-plugin-maria \
- --with-maria-tmp-tables \
-%else
- --without-plugin-maria \
-%endif
-%if %{INNODB_BUILD}
- --with-plugin-innobase \
- --without-plugin-innodb_plugin \
-%else
- --without-plugin-innobase \
- --without-plugin-innodb_plugin \
-%endif
-%if %{PARTITION_BUILD}
- --with-plugin-partition \
-%else
- --without-plugin-partition \
-%endif
- --with-plugin-csv \
- --with-plugin-archive \
- --with-plugin-blackhole \
- --with-plugin-federated \
-%if %{EMBEDDED_BUILD}
- --with-embedded-server \
-%else
- --without-embedded-server \
-%endif
- --without-bench \
- --with-zlib-dir=bundled \
- --with-big-tables"
-
-if [ -n "$MYSQL_CONFLOG_DEST" ] ; then
- cp -fp config.log "$MYSQL_CONFLOG_DEST"
-fi
-
-#if [ -f sql/.libs/mysqld ] ; then
-# nm --numeric-sort sql/.libs/mysqld > sql/mysqld.sym
-#else
-# nm --numeric-sort sql/mysqld > sql/mysqld.sym
-#fi
-}
-# end of function definition "BuildServer"
-
-
-RBR=$RPM_BUILD_ROOT
-MBD=$RPM_BUILD_DIR/%{src_dir}
-
-# Clean up the BuildRoot first
-[ "$RBR" != "/" ] && [ -d $RBR ] && rm -rf $RBR;
-mkdir -p $RBR%{_libdir}/mysql $RBR%{_sbindir}
-
-# Use gcc for C and C++ code (to avoid a dependency on libstdc++ and
-# including exceptions into the code
-if [ -z "$CXX" -a -z "$CC" ] ; then
- export CC="gcc" CXX="gcc"
-fi
-
-if [ "%{redhatversion}" = "5" ] ; then
-export CFLAGS="-static-libgcc -O2 -fno-omit-frame-pointer -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic"
-export CXXFLAGS="-static-libgcc -O2 -fno-omit-frame-pointer -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic"
-fi
-
-if [ "%{redhatversion}" != "5" ] ; then
-export CFLAGS="-static-libgcc -O2 -g -fno-omit-frame-pointer -pipe "
-export CXXFLAGS="-static-libgcc -O2 -g -fno-omit-frame-pointer -pipe "
-fi
-
-
-# Create the shared libs seperately to avoid a dependency for the client utilities
-DEBUG=0
-BuildMySQL "--enable-shared"
-
-# Install shared libraries
-cp -av libmysql/.libs/*.so* $RBR/%{_libdir}
-cp -av libmysql_r/.libs/*.so* $RBR/%{_libdir}
-mkdir -p $RBR%{_libdir}/mysql/plugin
-cp -av storage/innobase/.libs/*.so* $RBR%{_libdir}/mysql/plugin
-cp -av storage/innobase/scripts/install_innodb_plugins.sql $RBR%{_libdir}/mysql/plugin
-
-pushd $RBR%{_libdir}/mysql
-tar cfz percona-xtradb-%{pluginversion}-%{xtradbversion}-%{mysqlversion}.$RPM_ARCH.tar.gz plugin
-mv percona-xtradb-%{pluginversion}-%{xtradbversion}-%{mysqlversion}.$RPM_ARCH.tar.gz %{_topdir}
-popd
-
-##############################################################################
-
-# Include libgcc.a in the devel subpackage (BUG 4921)
-%if %{WITH_LIBGCC}
-libgcc=`$CC $CFLAGS --print-libgcc-file`
-install -m 644 "$libgcc" $RBR%{_libdir}/mysql/libmygcc.a
-%endif
-
-##############################################################################
-
-# Now create a debug server
-%if %{BUILD_DEBUG}
-DEBUG=1
-make clean
-
-( BuildServer ) # subshell, so that CFLAGS + CXXFLAGS are modified only locally
-
-if [ "$MYSQL_RPMBUILD_TEST" != "no" ] ; then
- MTR_BUILD_THREAD=auto make %{DEBUG_TEST_MODE}
-fi
-
-# Get the debug server and its .sym file from the build tree
-#if [ -f sql/.libs/mysqld ] ; then
-# cp sql/.libs/mysqld $RBR%{_sbindir}/mysqld-debug
-#else
-# cp sql/mysqld $RBR%{_sbindir}/mysqld-debug
-#fi
-#cp libmysqld/libmysqld.a $RBR%{_libdir}/mysql/libmysqld-debug.a
-#cp sql/mysqld.sym $RBR%{_libdir}/mysql/mysqld-debug.sym
-
-%endif
-
-# Now, the default server
-DEBUG=0
-make clean
-
-BuildServer
-
-if [ "$MYSQL_RPMBUILD_TEST" != "no" ] ; then
- MTR_BUILD_THREAD=auto make %{NORMAL_TEST_MODE}
-fi
-
-# Now, build plugin
-#BUILDSO=0
-#make clean
-
-#BuildServer
-
-#if [ "$MYSQL_RPMBUILD_TEST" != "no" ] ; then
-# MTR_BUILD_THREAD=auto make %{NORMAL_TEST_MODE}
-#fi
-
-%install
-RBR=$RPM_BUILD_ROOT
-MBD=$RPM_BUILD_DIR/%{src_dir}
-
-# Ensure that needed directories exists
-install -d $RBR%{_sysconfdir}/{logrotate.d,init.d}
-install -d $RBR%{mysqldatadir}/mysql
-install -d $RBR%{_datadir}/mysql-test
-install -d $RBR%{_datadir}/mysql/SELinux/RHEL4
-install -d $RBR%{_includedir}
-install -d $RBR%{_libdir}
-install -d $RBR%{_mandir}
-install -d $RBR%{_sbindir}
-install -d $RBR%{_libdir}/mysql/plugin
-
-make DESTDIR=$RBR benchdir_root=%{_datadir} install
-
-# install symbol files ( for stack trace resolution)
-#install -m644 $MBD/sql/mysqld.sym $RBR%{_libdir}/mysql/mysqld.sym
-
-# Install logrotate and autostart
-install -m644 $MBD/support-files/mysql-log-rotate \
- $RBR%{_sysconfdir}/logrotate.d/mysql
-install -m755 $MBD/support-files/mysql.server \
- $RBR%{_sysconfdir}/init.d/mysql
-
-# in RPMs, it is unlikely that anybody should use "sql-bench"
-rm -fr $RBR%{_datadir}/sql-bench
-
-# Create a symlink "rcmysql", pointing to the init.script. SuSE users
-# will appreciate that, as all services usually offer this.
-ln -s %{_sysconfdir}/init.d/mysql $RBR%{_sbindir}/rcmysql
-
-# Touch the place where the my.cnf config file and mysqlmanager.passwd
-# (MySQL Instance Manager password file) might be located
-# Just to make sure it's in the file list and marked as a config file
-touch $RBR%{_sysconfdir}/my.cnf
-touch $RBR%{_sysconfdir}/mysqlmanager.passwd
-
-# Install SELinux files in datadir
-install -m600 $MBD/support-files/RHEL4-SElinux/mysql.{fc,te} \
- $RBR%{_datadir}/mysql/SELinux/RHEL4
-
-
-##############################################################################
-# Post processing actions, i.e. when installed
-##############################################################################
-
-%pre -n Percona-XtraDB-server%{package_suffix}
-# Check if we can safely upgrade. An upgrade is only safe if it's from one
-# of our RPMs in the same version family.
-
-installed=`rpm -q --whatprovides mysql-server 2> /dev/null`
-if [ $? -eq 0 -a -n "$installed" ]; then
- vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1`
- version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1`
- myvendor='%{mysql_vendor}'
- myversion='%{mysqlversion}'
-
- old_family=`echo $version | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'`
- new_family=`echo $myversion | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'`
-
- [ -z "$vendor" ] && vendor='<unknown>'
- [ -z "$old_family" ] && old_family="<unrecognized version $version>"
- [ -z "$new_family" ] && new_family="<bad package specification: version $myversion>"
-
- error_text=
-# if [ "$vendor" != "$myvendor" ]; then
-# error_text="$error_text
-#The current MySQL server package is provided by a different
-#vendor ($vendor) than $myvendor. Some files may be installed
-#to different locations, including log files and the service
-#startup script in %{_sysconfdir}/init.d/.
-#"
-# fi
-
- if [ "$old_family" != "$new_family" ]; then
- error_text="$error_text
-Upgrading directly from MySQL $old_family to MySQL $new_family may not
-be safe in all cases. A manual dump and restore using mysqldump is
-recommended. It is important to review the MySQL manual's Upgrading
-section for version-specific incompatibilities.
-"
- fi
-
- if [ -n "$error_text" ]; then
- cat <<HERE >&2
-
-******************************************************************
-A MySQL server package ($installed) is installed.
-$error_text
-A manual upgrade is required.
-
-- Ensure that you have a complete, working backup of your data and my.cnf
- files
-- Shut down the MySQL server cleanly
-- Remove the existing MySQL packages. Usually this command will
- list the packages you should remove:
- rpm -qa | grep -i '^mysql-'
-
- You may choose to use 'rpm --nodeps -ev <package-name>' to remove
- the package which contains the mysqlclient shared library. The
- library will be reinstalled by the MySQL-shared-compat package.
-- Install the new MySQL packages supplied by $myvendor
-- Ensure that the MySQL server is started
-- Run the 'mysql_upgrade' program
-
-This is a brief description of the upgrade process. Important details
-can be found in the MySQL manual, in the Upgrading section.
-******************************************************************
-HERE
- exit 1
- fi
-fi
-
-# Shut down a previously installed server first
-if [ -x %{_sysconfdir}/init.d/mysql ] ; then
- %{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
- echo "Giving mysqld 5 seconds to exit nicely"
- sleep 5
-fi
-
-%post -n Percona-XtraDB-server%{package_suffix}
-mysql_datadir=%{mysqldatadir}
-
-# ----------------------------------------------------------------------
-# Create data directory
-# ----------------------------------------------------------------------
-mkdir -p $mysql_datadir/{mysql,test}
-
-# ----------------------------------------------------------------------
-# Make MySQL start/shutdown automatically when the machine does it.
-# ----------------------------------------------------------------------
-if [ -x /sbin/chkconfig ] ; then
- /sbin/chkconfig --add mysql
-fi
-
-# ----------------------------------------------------------------------
-# Create a MySQL user and group. Do not report any problems if it already
-# exists.
-# ----------------------------------------------------------------------
-groupadd -r %{mysqld_group} 2> /dev/null || true
-useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
-# The user may already exist, make sure it has the proper group nevertheless (BUG#12823)
-usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
-
-# ----------------------------------------------------------------------
-# Change permissions so that the user that will run the MySQL daemon
-# owns all database files.
-# ----------------------------------------------------------------------
-chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
-
-# ----------------------------------------------------------------------
-# Initiate databases
-# ----------------------------------------------------------------------
-%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
-
-# ----------------------------------------------------------------------
-# FIXME upgrade databases if needed would go here - but it cannot be
-# automated yet
-# ----------------------------------------------------------------------
-
-# ----------------------------------------------------------------------
-# Change permissions again to fix any new files.
-# ----------------------------------------------------------------------
-chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
-
-# ----------------------------------------------------------------------
-# Fix permissions for the permission database so that only the user
-# can read them.
-# ----------------------------------------------------------------------
-chmod -R og-rw $mysql_datadir/mysql
-
-# ----------------------------------------------------------------------
-# install SELinux files - but don't override existing ones
-# ----------------------------------------------------------------------
-SETARGETDIR=/etc/selinux/targeted/src/policy
-SEDOMPROG=$SETARGETDIR/domains/program
-SECONPROG=$SETARGETDIR/file_contexts/program
-if [ -f /etc/redhat-release ] && \
- (grep -q "Red Hat Enterprise Linux .. release 4" /etc/redhat-release \
- || grep -q "CentOS release 4" /etc/redhat-release) ; then
- echo
- echo
- echo 'Notes regarding SELinux on this platform:'
- echo '========================================='
- echo
- echo 'The default policy might cause server startup to fail because it is '
- echo 'not allowed to access critical files. In this case, please update '
- echo 'your installation. '
- echo
- echo 'The default policy might also cause inavailability of SSL related '
- echo 'features because the server is not allowed to access /dev/random '
- echo 'and /dev/urandom. If this is a problem, please do the following: '
- echo
- echo ' 1) install selinux-policy-targeted-sources from your OS vendor'
- echo ' 2) add the following two lines to '$SEDOMPROG/mysqld.te':'
- echo ' allow mysqld_t random_device_t:chr_file read;'
- echo ' allow mysqld_t urandom_device_t:chr_file read;'
- echo ' 3) cd to '$SETARGETDIR' and issue the following command:'
- echo ' make load'
- echo
- echo
-fi
-
-if [ -x sbin/restorecon ] ; then
- sbin/restorecon -R var/lib/mysql
-fi
-
-# Restart in the same way that mysqld will be started normally.
-if [ -x %{_sysconfdir}/init.d/mysql ] ; then
- %{_sysconfdir}/init.d/mysql start
- echo "Giving mysqld 2 seconds to start"
- sleep 2
-fi
-
-# Allow mysqld_safe to start mysqld and print a message before we exit
-sleep 2
-
-%if %{CLUSTER_BUILD}
-%post -n MySQL%{cluster_package_prefix}storage%{package_suffix}
-# Create cluster directory if needed
-mkdir -p /var/lib/mysql-cluster
-%endif
-
-%preun -n Percona-XtraDB-server%{package_suffix}
-if [ $1 = 0 ] ; then
- # Stop MySQL before uninstalling it
- if [ -x %{_sysconfdir}/init.d/mysql ] ; then
- %{_sysconfdir}/init.d/mysql stop > /dev/null
- # Don't start it automatically anymore
- if [ -x /sbin/chkconfig ] ; then
- /sbin/chkconfig --del mysql
- fi
- fi
-fi
-
-# We do not remove the mysql user since it may still own a lot of
-# database files.
-
-# ----------------------------------------------------------------------
-# Clean up the BuildRoot after build is done
-# ----------------------------------------------------------------------
-%clean
-[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
-
-##############################################################################
-# Files section
-##############################################################################
-
-%files -n Percona-XtraDB-server%{package_suffix}
-%defattr(-,root,root,0755)
-
-%doc %{lic_files}
-%doc support-files/my-*.cnf
-%if %{CLUSTER_BUILD}
-%doc support-files/ndb-*.ini
-%endif
-
-%doc %attr(644, root, root) %{_infodir}/mysql.info*
-
-%if %{INNODB_BUILD}
-%doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1*
-%endif
-%doc %attr(644, root, man) %{_mandir}/man1/my_print_defaults.1*
-%doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.1*
-%doc %attr(644, root, man) %{_mandir}/man1/myisamchk.1*
-%doc %attr(644, root, man) %{_mandir}/man1/myisamlog.1*
-%doc %attr(644, root, man) %{_mandir}/man1/myisampack.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_convert_table_format.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_extensions.1*
-%doc %attr(644, root, man) %{_mandir}/man8/mysqld.8*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_secure_installation.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_setpermission.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1*
-%doc %attr(644, root, man) %{_mandir}/man8/mysqlmanager.8*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql.server.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqltest.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_tzinfo_to_sql.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqlbug.1*
-%doc %attr(644, root, man) %{_mandir}/man1/perror.1*
-%doc %attr(644, root, man) %{_mandir}/man1/replace.1*
-%doc %attr(644, root, man) %{_mandir}/man1/resolve_stack_dump.1*
-%doc %attr(644, root, man) %{_mandir}/man1/resolveip.1*
-
-%ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf
-%ghost %config(noreplace,missingok) %{_sysconfdir}/mysqlmanager.passwd
-
-%if %{INNODB_BUILD}
-%attr(755, root, root) %{_bindir}/innochecksum
-%endif
-%attr(755, root, root) %{_bindir}/my_print_defaults
-%attr(755, root, root) %{_bindir}/myisam_ftdump
-%attr(755, root, root) %{_bindir}/myisamchk
-%attr(755, root, root) %{_bindir}/myisamlog
-%attr(755, root, root) %{_bindir}/myisampack
-%attr(755, root, root) %{_bindir}/mysql_convert_table_format
-%attr(755, root, root) %{_bindir}/mysql_fix_extensions
-%attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables
-%attr(755, root, root) %{_bindir}/mysql_install_db
-%attr(755, root, root) %{_bindir}/mysql_secure_installation
-%attr(755, root, root) %{_bindir}/mysql_setpermission
-%attr(755, root, root) %{_bindir}/mysql_tzinfo_to_sql
-%attr(755, root, root) %{_bindir}/mysql_upgrade
-%attr(755, root, root) %{_bindir}/mysql_zap
-%attr(755, root, root) %{_bindir}/mysqlbug
-%attr(755, root, root) %{_bindir}/mysqld_multi
-%attr(755, root, root) %{_bindir}/mysqld_safe
-%attr(755, root, root) %{_bindir}/mysqldumpslow
-%attr(755, root, root) %{_bindir}/mysqlhotcopy
-%attr(755, root, root) %{_bindir}/mysqltest
-%attr(755, root, root) %{_bindir}/perror
-%attr(755, root, root) %{_bindir}/replace
-%attr(755, root, root) %{_bindir}/resolve_stack_dump
-%attr(755, root, root) %{_bindir}/resolveip
-
-%attr(755, root, root) %{_sbindir}/mysqld
-%if %{BUILD_DEBUG}
-%attr(755, root, root) %{_sbindir}/mysqld-debug
-%endif
-%attr(755, root, root) %{_sbindir}/mysqlmanager
-%attr(755, root, root) %{_sbindir}/rcmysql
-#%attr(644, root, root) %{_libdir}/mysql/mysqld.sym
-%if %{BUILD_DEBUG}
-#%attr(644, root, root) %{_libdir}/mysql/mysqld-debug.sym
-%endif
-
-%attr(644, root, root) %config(noreplace,missingok) %{_sysconfdir}/logrotate.d/mysql
-%attr(755, root, root) %{_sysconfdir}/init.d/mysql
-
-%attr(755, root, root) %{_datadir}/mysql/
-
-%files -n Percona-XtraDB-client%{package_suffix}
-%defattr(-, root, root, 0755)
-%attr(755, root, root) %{_bindir}/msql2mysql
-%attr(755, root, root) %{_bindir}/mysql
-%attr(755, root, root) %{_bindir}/mysql_find_rows
-%attr(755, root, root) %{_bindir}/mysql_waitpid
-%attr(755, root, root) %{_bindir}/mysqlaccess
-%attr(755, root, root) %{_bindir}/mysqladmin
-%attr(755, root, root) %{_bindir}/mysqlbinlog
-%attr(755, root, root) %{_bindir}/mysqlcheck
-%attr(755, root, root) %{_bindir}/mysqldump
-%attr(755, root, root) %{_bindir}/mysqlimport
-%attr(755, root, root) %{_bindir}/mysqlshow
-%attr(755, root, root) %{_bindir}/mysqlslap
-
-%doc %attr(644, root, man) %{_mandir}/man1/msql2mysql.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_find_rows.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_waitpid.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqlaccess.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqladmin.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqlbinlog.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqlcheck.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqldump.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqlimport.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqlshow.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqlslap.1*
-
-%post -n Percona-XtraDB-shared%{package_suffix}
-/sbin/ldconfig
-
-%postun -n Percona-XtraDB-shared%{package_suffix}
-/sbin/ldconfig
-
-%if %{CLUSTER_BUILD}
-%files -n MySQL%{cluster_package_prefix}storage%{package_suffix}
-%defattr(-,root,root,0755)
-%attr(755, root, root) %{_sbindir}/ndbd
-%doc %attr(644, root, man) %{_mandir}/man8/ndbd.8*
-
-%files -n MySQL%{cluster_package_prefix}management%{package_suffix}
-%defattr(-,root,root,0755)
-%attr(755, root, root) %{_sbindir}/ndb_mgmd
-%doc %attr(644, root, man) %{_mandir}/man8/ndb_mgmd.8*
-
-%files -n MySQL%{cluster_package_prefix}tools%{package_suffix}
-%defattr(-,root,root,0755)
-%attr(755, root, root) %{_bindir}/ndb_config
-%attr(755, root, root) %{_bindir}/ndb_desc
-%attr(755, root, root) %{_bindir}/ndb_error_reporter
-%attr(755, root, root) %{_bindir}/ndb_mgm
-%attr(755, root, root) %{_bindir}/ndb_restore
-%attr(755, root, root) %{_bindir}/ndb_select_all
-%attr(755, root, root) %{_bindir}/ndb_select_count
-%attr(755, root, root) %{_bindir}/ndb_show_tables
-%attr(755, root, root) %{_bindir}/ndb_size.pl
-%attr(755, root, root) %{_bindir}/ndb_test_platform
-%attr(755, root, root) %{_bindir}/ndb_waiter
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_config.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_desc.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_error_reporter.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_mgm.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_restore.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_select_all.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_select_count.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_show_tables.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_size.pl.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_waiter.1*
-
-%files -n MySQL%{cluster_package_prefix}extra%{package_suffix}
-%defattr(-,root,root,0755)
-%attr(755, root, root) %{_bindir}/ndb_delete_all
-%attr(755, root, root) %{_bindir}/ndb_drop_index
-%attr(755, root, root) %{_bindir}/ndb_drop_table
-%attr(755, root, root) %{_sbindir}/ndb_cpcd
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_delete_all.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_index.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_table.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_cpcd.1*
-%endif
-
-%files -n Percona-XtraDB-devel%{package_suffix}
-%defattr(-, root, root, 0755)
-%if %{commercial}
-%else
-%doc EXCEPTIONS-CLIENT
-%endif
-%doc %attr(644, root, man) %{_mandir}/man1/comp_err.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_config.1*
-%attr(755, root, root) %{_bindir}/mysql_config
-%dir %attr(755, root, root) %{_libdir}/mysql
-%{_includedir}/mysql
-%{_datadir}/aclocal/mysql.m4
-%{_libdir}/mysql/libdbug.a
-%{_libdir}/mysql/libheap.a
-%if %{WITH_LIBGCC}
-%{_libdir}/mysql/libmygcc.a
-%endif
-%{_libdir}/mysql/libmyisam.a
-%{_libdir}/mysql/libmyisammrg.a
-%{_libdir}/mysql/libmysqlclient.a
-%{_libdir}/mysql/libmysqlclient.la
-%{_libdir}/mysql/libmysqlclient_r.a
-%{_libdir}/mysql/libmysqlclient_r.la
-%{_libdir}/mysql/libmystrings.a
-%{_libdir}/mysql/libmysys.a
-%{_libdir}/mysql/libvio.a
-%{_libdir}/mysql/libz.a
-%{_libdir}/mysql/libz.la
-%if %{CLUSTER_BUILD}
-%{_libdir}/mysql/libndbclient.a
-%{_libdir}/mysql/libndbclient.la
-%endif
-
-%files -n Percona-XtraDB-shared%{package_suffix}
-%defattr(-, root, root, 0755)
-# Shared libraries (omit for architectures that don't support them)
-%{_libdir}/*.so*
-
-%files -n Percona-XtraDB-test%{package_suffix}
-%defattr(-, root, root, 0755)
-%{_datadir}/mysql-test
-%attr(755, root, root) %{_bindir}/mysql_client_test
-%doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql-stress-test.pl.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysql-test-run.pl.1*
-
-%files -n Percona-XtraDB-%{pluginversion}-%{xtradbversion}
-%defattr(-, root, root, 0755)
-%attr(644, root, root) %{_libdir}/mysql/plugin/ha_innodb.so*
-%attr(644, root, root) %{_libdir}/mysql/plugin/install_innodb_plugins.sql
-
-##############################################################################
-# The spec file changelog only includes changes made to the spec file
-# itself - note that they must be ordered by date (important when
-# merging BK trees)
-##############################################################################
-%changelog
-* Mon Mar 22 2010 Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com>
-
-XtraDB Release 10
-
-* Thu Feb 11 2010 Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com>
-
-Package name changed to Percona-XtraDB
-
-* Tue Jan 05 2010 Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com>
-
-- Corrected emails
-- -m64 is removed from CFLAGS
-
-* Tue Apr 21 2009 Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com>
-
-- Adoption for XtraDB Storage Engine
-
-* Fri Nov 07 2008 Joerg Bruehe <joerg@mysql.com>
-
-- Modify CFLAGS and CXXFLAGS such that a debug build is not optimized.
- This should cover both gcc and icc flags. Fixes bug#40546.
-
-* Mon Aug 18 2008 Joerg Bruehe <joerg@mysql.com>
-
-- Get rid of the "warning: Installed (but unpackaged) file(s) found:"
- Some generated files aren't needed in RPMs:
- - the "sql-bench/" subdirectory
- Some files were missing:
- - /usr/share/aclocal/mysql.m4 ("devel" subpackage)
- - Manuals for embedded tests ("test" subpackage)
- - Manual "mysqlbug" ("server" subpackage)
- - Manual "mysql_find_rows" ("client" subpackage)
-
-* Wed Jun 11 2008 Kent Boortz <kent@mysql.com>
-
-- Removed the Example storage engine, it is not to be in products
-
-* Fri Apr 04 2008 Daniel Fischer <df@mysql.com>
-
-- Added Cluster+InnoDB product
-
-* Mon Mar 31 2008 Kent Boortz <kent@mysql.com>
-
-- Made the "Federated" storage engine an option
-
-* Tue Mar 11 2008 Joerg Bruehe <joerg@mysql.com>
-
-- Cleanup: Remove manual file "mysql_tableinfo.1".
-
-* Mon Feb 18 2008 Timothy Smith <tim@mysql.com>
-
-- Require a manual upgrade if the alread-installed mysql-server is
- from another vendor, or is of a different major version.
-
-* Fri Dec 14 2007 Joerg Bruehe <joerg@mysql.com>
-
-- Add the "%doc" directive for all man pages and other documentation;
- also, some re-ordering to reduce differences between spec files.
-
-* Fri Dec 14 2007 Joerg Bruehe <joerg@mysql.com>
-
-- Added "client/mysqlslap" (bug#32077)
-
-* Wed Oct 31 2007 Joerg Bruehe <joerg@mysql.com>
-
-- Explicitly handle InnoDB using its own variable and "--with"/"--without"
- options, because the "configure" default is "yes".
- Also, fix the specification of "community" to include "partitioning".
-
-* Mon Sep 03 2007 Kent Boortz <kent@mysql.com>
-
-- Let libmygcc be included unless "--without libgcc" is given.
-
-* Sun Sep 02 2007 Kent Boortz <kent@mysql.com>
-
-- Changed SSL flag given to configure to "--with-ssl"
-- Removed symbolic link "safe_mysqld"
-- Removed script and man page for "mysql_explain_log"
-- Removed scripts "mysql_tableinfo" and "mysql_upgrade_shell"
-- Removed "comp_err" from list to install
-- Removed duplicates of "libndbclient.a" and "libndbclient.la"
-
-* Tue Jul 17 2007 Joerg Bruehe <joerg@mysql.com>
-
-- Add the man page for "mysql-stress-test.pl" to the "test" RPM
- (consistency in fixing bug#21023, the script is handled by "Makefile.am")
-
-* Wed Jul 11 2007 Daniel Fischer <df@mysql.com>
-
-- Change the way broken SELinux policies on RHEL4 and CentOS 4
- are handled to be more likely to actually work
-
-* Thu Jun 05 2007 kent Boortz <kent@mysql.com>
-
-- Enabled the CSV engine in all builds
-
-* Thu May 3 2007 Mads Martin Joergensen <mmj@mysql.com>
-
-- Spring cleanup
-
-* Thu Apr 19 2007 Mads Martin Joergensen <mmj@mysql.com>
-
-- If sbin/restorecon exists then run it
-
-* Wed Apr 18 2007 Kent Boortz <kent@mysql.com>
-
-- Packed unpacked files
-
- /usr/sbin/ndb_cpcd
- /usr/bin/mysql_upgrade_shell
- /usr/bin/innochecksum
- /usr/share/man/man1/ndb_cpcd.1.gz
- /usr/share/man/man1/innochecksum.1.gz
- /usr/share/man/man1/mysql_fix_extensions.1.gz
- /usr/share/man/man1/mysql_secure_installation.1.gz
- /usr/share/man/man1/mysql_tableinfo.1.gz
- /usr/share/man/man1/mysql_waitpid.1.gz
-
-- Commands currently not installed but that has man pages
-
- /usr/share/man/man1/make_win_bin_dist.1.gz
- /usr/share/man/man1/make_win_src_distribution.1.gz
- /usr/share/man/man1/mysql-stress-test.pl.1.gz
- /usr/share/man/man1/ndb_print_backup_file.1.gz
- /usr/share/man/man1/ndb_print_schema_file.1.gz
- /usr/share/man/man1/ndb_print_sys_file.1.gz
-
-* Thu Mar 22 2007 Joerg Bruehe <joerg@mysql.com>
-
-- Add "comment" options to the test runs, for better log analysis.
-
-* Wed Mar 21 2007 Joerg Bruehe <joerg@mysql.com>
-
-- Add even more man pages.
-
-* Fri Mar 16 2007 Joerg Bruehe <joerg@mysql.com>
-
-- Build the server twice, once as "mysqld-debug" and once as "mysqld";
- test them both, and include them in the resulting file.
-- Consequences of the fix for bug#20166:
- Remove "mysql_create_system_tables",
- new "mysql_fix_privilege_tables.sql" is included implicitly.
-
-* Wed Mar 14 2007 Daniel Fischer <df@mysql.com>
-
-- Adjust compile options some more and change naming of community
- cluster RPMs to explicitly say 'cluster'.
-
-* Mon Mar 12 2007 Daniel Fischer <df@mysql.com>
-
-- Adjust compile options and other settings for 5.0 community builds.
-
-* Fri Mar 02 2007 Joerg Bruehe <joerg@mysql.com>
-
-- Add several man pages which are now created.
-
-* Mon Jan 29 2007 Mads Martin Joergensen <mmj@mysql.com>
-
-- Make sure SELinux works correctly. Files from Colin Charles.
-
-* Fri Jan 05 2007 Kent Boortz <kent@mysql.com>
-
-- Add CFLAGS to gcc call with --print-libgcc-file, to make sure the
- correct "libgcc.a" path is returned for the 32/64 bit architecture.
-
-* Tue Dec 19 2006 Joerg Bruehe <joerg@mysql.com>
-
-- The man page for "mysqld" is now in section 8.
-
-* Thu Dec 14 2006 Joerg Bruehe <joerg@mysql.com>
-
-- Include the new man pages for "my_print_defaults" and "mysql_tzinfo_to_sql"
- in the server RPM.
-- The "mysqlmanager" man page was relocated to section 8, reflect that.
-
-* Fri Nov 17 2006 Mads Martin Joergensen <mmj@mysql.com>
-
-- Really fix obsoletes/provides for community -> this
-- Make it possible to not run test by setting
- MYSQL_RPMBUILD_TEST to "no"
-
-* Wed Nov 15 2006 Joerg Bruehe <joerg@mysql.com>
-
-- Switch from "make test*" to explicit calls of the test suite,
- so that "report features" can be used.
-
-* Wed Nov 15 2006 Kent Boortz <kent@mysql.com>
-
-- Added "--with cluster" and "--define cluster{_gpl}"
-
-* Tue Oct 24 2006 Mads Martin Joergensen <mmj@mysql.com>
-
-- Shared need to Provide/Obsolete mysql-shared
-
-* Mon Oct 23 2006 Mads Martin Joergensen <mmj@mysql.com>
-
-- Run sbin/restorecon after db init (Bug#12676)
-
-* Thu Jul 06 2006 Joerg Bruehe <joerg@mysql.com>
-
-- Correct a typing error in my previous change.
-
-* Tue Jul 04 2006 Joerg Bruehe <joerg@mysql.com>
-
-- Use the Perl script to run the tests, because it will automatically check
- whether the server is configured with SSL.
-
-* Wed Jun 28 2006 Joerg Bruehe <joerg@mysql.com>
-
-- Revert all previous attempts to call "mysql_upgrade" during RPM upgrade,
- there are some more aspects which need to be solved before this is possible.
- For now, just ensure the binary "mysql_upgrade" is delivered and installed.
-
-* Wed Jun 28 2006 Joerg Bruehe <joerg@mysql.com>
-
-- Move "mysqldumpslow" from the client RPM to the server RPM (bug#20216).
-
-* Wed Jun 21 2006 Joerg Bruehe <joerg@mysql.com>
-
-- To run "mysql_upgrade", we need a running server;
- start it in isolation and skip password checks.
-
-* Sat May 23 2006 Kent Boortz <kent@mysql.com>
-
-- Always compile for PIC, position independent code.
-
-* Fri Apr 28 2006 Kent Boortz <kent@mysql.com>
-
-- Install and run "mysql_upgrade"
-
-* Sat Apr 01 2006 Kent Boortz <kent@mysql.com>
-
-- Allow to override $LDFLAGS
-
-* Fri Jan 06 2006 Lenz Grimmer <lenz@mysql.com>
-
-- added a MySQL-test subpackage (BUG#16070)
-
-* Tue Dec 27 2005 Joerg Bruehe <joerg@mysql.com>
-
-- Some minor alignment with the 4.1 version
-
-* Wed Dec 14 2005 Rodrigo Novo <rodrigo@mysql.com>
-
-- Cosmetic changes: source code location & rpm packager
-- Protect "nm -D" against libtool weirdness
-- Add libz.a & libz.la to the list of files for subpackage -devel
-- moved --with-zlib-dir=bundled out of BuildMySQL, as it doesn't makes
- sense for the shared package
-
-* Tue Nov 22 2005 Joerg Bruehe <joerg@mysql.com>
-
-- Extend the file existence check for "init.d/mysql" on un-install
- to also guard the call to "insserv"/"chkconfig".
-
-* Wed Nov 16 2005 Lenz Grimmer <lenz@mysql.com>
-
-- added mysql_client_test to the "client" subpackage (BUG#14546)
-
-* Tue Nov 15 2005 Lenz Grimmer <lenz@mysql.com>
-
-- changed default definitions to build a standard GPL release when not
- defining anything else
-- install the shared libs more elegantly by using "make install"
-
-* Wed Oct 19 2005 Kent Boortz <kent@mysql.com>
-
-- Made yaSSL support an option (off by default)
-
-* Wed Oct 19 2005 Kent Boortz <kent@mysql.com>
-
-- Enabled yaSSL support
-
-* Thu Oct 13 2005 Lenz Grimmer <lenz@mysql.com>
-
-- added a usermod call to assign a potential existing mysql user to the
- correct user group (BUG#12823)
-- added a separate macro "mysqld_group" to be able to define the
- user group of the mysql user seperately, if desired.
-
-* Fri Oct 1 2005 Kent Boortz <kent@mysql.com>
-
-- Copy the config.log file to location outside
- the build tree
-
-* Fri Sep 30 2005 Lenz Grimmer <lenz@mysql.com>
-
-- don't use install-strip to install the binaries (strip segfaults on
- icc-compiled binaries on IA64)
-
-* Thu Sep 22 2005 Lenz Grimmer <lenz@mysql.com>
-
-- allow overriding the CFLAGS (needed for Intel icc compiles)
-- replace the CPPFLAGS=-DBIG_TABLES with "--with-big-tables" configure option
-
-* Fri Aug 19 2005 Joerg Bruehe <joerg@mysql.com>
-
-- Protect against failing tests.
-
-* Thu Aug 04 2005 Lenz Grimmer <lenz@mysql.com>
-
-- Fixed the creation of the mysql user group account in the postinstall
- section (BUG 12348)
-
-* Fri Jul 29 2005 Lenz Grimmer <lenz@mysql.com>
-
-- Fixed external RPM Requirements to better suit the target distribution
- (BUG 12233)
-
-* Fri Jul 15 2005 Lenz Grimmer <lenz@mysql.com>
-
-- create a "mysql" user group and assign the mysql user account to that group
- in the server postinstall section. (BUG 10984)
-
-* Wed Jun 01 2005 Lenz Grimmer <lenz@mysql.com>
-
-- use "mysqldatadir" variable instead of hard-coding the path multiple times
-- use the "mysqld_user" variable on all occasions a user name is referenced
-- removed (incomplete) Brazilian translations
-- removed redundant release tags from the subpackage descriptions
-
-* Fri May 27 2005 Lenz Grimmer <lenz@mysql.com>
-
-- fixed file list (removed libnisam.a and libmerge.a from the devel subpackage)
-- force running the test suite
-
-* Wed Apr 20 2005 Lenz Grimmer <lenz@mysql.com>
-
-- Enabled the "blackhole" storage engine for the Max RPM
-
-* Wed Apr 13 2005 Lenz Grimmer <lenz@mysql.com>
-
-- removed the MySQL manual files (html/ps/texi) - they have been removed
- from the MySQL sources and are now available seperately.
-
-* Mon Apr 4 2005 Petr Chardin <petr@mysql.com>
-
-- old mysqlmanager, mysqlmanagerc and mysqlmanager-pwger renamed into
- mysqltestmanager, mysqltestmanager and mysqltestmanager-pwgen respectively
-
-* Fri Mar 18 2005 Lenz Grimmer <lenz@mysql.com>
-
-- Disabled RAID in the Max binaries once and for all (it has finally been
- removed from the source tree)
-
-* Sun Feb 20 2005 Petr Chardin <petr@mysql.com>
-
-- Install MySQL Instance Manager together with mysqld, touch mysqlmanager
- password file
-
-* Mon Feb 14 2005 Lenz Grimmer <lenz@mysql.com>
-
-- Fixed the compilation comments and moved them into the separate build sections
- for Max and Standard
-
-* Mon Feb 7 2005 Tomas Ulin <tomas@mysql.com>
-
-- enabled the "Ndbcluster" storage engine for the max binary
-- added extra make install in ndb subdir after Max build to get ndb binaries
-- added packages for ndbcluster storage engine
-
-* Fri Jan 14 2005 Lenz Grimmer <lenz@mysql.com>
-
-- replaced obsoleted "BuildPrereq" with "BuildRequires" instead
-
-* Thu Jan 13 2005 Lenz Grimmer <lenz@mysql.com>
-
-- enabled the "Federated" storage engine for the max binary
-
-* Tue Jan 04 2005 Petr Chardin <petr@mysql.com>
-
-- ISAM and merge storage engines were purged. As well as appropriate
- tools and manpages (isamchk and isamlog)
-
-* Thu Dec 31 2004 Lenz Grimmer <lenz@mysql.com>
-
-- enabled the "Archive" storage engine for the max binary
-- enabled the "CSV" storage engine for the max binary
-- enabled the "Example" storage engine for the max binary
-
-* Thu Aug 26 2004 Lenz Grimmer <lenz@mysql.com>
-
-- MySQL-Max now requires MySQL-server instead of MySQL (BUG 3860)
-
-* Fri Aug 20 2004 Lenz Grimmer <lenz@mysql.com>
-
-- do not link statically on IA64/AMD64 as these systems do not have
- a patched glibc installed
-
-* Tue Aug 10 2004 Lenz Grimmer <lenz@mysql.com>
-
-- Added libmygcc.a to the devel subpackage (required to link applications
- against the the embedded server libmysqld.a) (BUG 4921)
-
-* Mon Aug 09 2004 Lenz Grimmer <lenz@mysql.com>
-
-- Added EXCEPTIONS-CLIENT to the "devel" package
-
-* Thu Jul 29 2004 Lenz Grimmer <lenz@mysql.com>
-
-- disabled OpenSSL in the Max binaries again (the RPM packages were the
- only exception to this anyway) (BUG 1043)
-
-* Wed Jun 30 2004 Lenz Grimmer <lenz@mysql.com>
-
-- fixed server postinstall (mysql_install_db was called with the wrong
- parameter)
-
-* Thu Jun 24 2004 Lenz Grimmer <lenz@mysql.com>
-
-- added mysql_tzinfo_to_sql to the server subpackage
-- run "make clean" instead of "make distclean"
-
-* Mon Apr 05 2004 Lenz Grimmer <lenz@mysql.com>
-
-- added ncurses-devel to the build prerequisites (BUG 3377)
-
-* Thu Feb 12 2004 Lenz Grimmer <lenz@mysql.com>
-
-- when using gcc, _always_ use CXX=gcc
-- replaced Copyright with License field (Copyright is obsolete)
-
-* Tue Feb 03 2004 Lenz Grimmer <lenz@mysql.com>
-
-- added myisam_ftdump to the Server package
-
-* Tue Jan 13 2004 Lenz Grimmer <lenz@mysql.com>
-
-- link the mysql client against libreadline instead of libedit (BUG 2289)
-
-* Mon Dec 22 2003 Lenz Grimmer <lenz@mysql.com>
-
-- marked /etc/logrotate.d/mysql as a config file (BUG 2156)
-
-* Fri Dec 13 2003 Lenz Grimmer <lenz@mysql.com>
-
-- fixed file permissions (BUG 1672)
-
-* Thu Dec 11 2003 Lenz Grimmer <lenz@mysql.com>
-
-- made testing for gcc3 a bit more robust
-
-* Fri Dec 05 2003 Lenz Grimmer <lenz@mysql.com>
-
-- added missing file mysql_create_system_tables to the server subpackage
-
-* Fri Nov 21 2003 Lenz Grimmer <lenz@mysql.com>
-
-- removed dependency on MySQL-client from the MySQL-devel subpackage
- as it is not really required. (BUG 1610)
-
-* Fri Aug 29 2003 Lenz Grimmer <lenz@mysql.com>
-
-- Fixed BUG 1162 (removed macro names from the changelog)
-- Really fixed BUG 998 (disable the checking for installed but
- unpackaged files)
-
-* Tue Aug 05 2003 Lenz Grimmer <lenz@mysql.com>
-
-- Fixed BUG 959 (libmysqld not being compiled properly)
-- Fixed BUG 998 (RPM build errors): added missing files to the
- distribution (mysql_fix_extensions, mysql_tableinfo, mysqldumpslow,
- mysql_fix_privilege_tables.1), removed "-n" from install section.
-
-* Wed Jul 09 2003 Lenz Grimmer <lenz@mysql.com>
-
-- removed the GIF Icon (file was not included in the sources anyway)
-- removed unused variable shared_lib_version
-- do not run automake before building the standard binary
- (should not be necessary)
-- add server suffix '-standard' to standard binary (to be in line
- with the binary tarball distributions)
-- Use more RPM macros (_exec_prefix, _sbindir, _libdir, _sysconfdir,
- _datadir, _includedir) throughout the spec file.
-- allow overriding CC and CXX (required when building with other compilers)
-
-* Fri May 16 2003 Lenz Grimmer <lenz@mysql.com>
-
-- re-enabled RAID again
-
-* Wed Apr 30 2003 Lenz Grimmer <lenz@mysql.com>
-
-- disabled MyISAM RAID (--with-raid) - it throws an assertion which
- needs to be investigated first.
-
-* Mon Mar 10 2003 Lenz Grimmer <lenz@mysql.com>
-
-- added missing file mysql_secure_installation to server subpackage
- (BUG 141)
-
-* Tue Feb 11 2003 Lenz Grimmer <lenz@mysql.com>
-
-- re-added missing pre- and post(un)install scripts to server subpackage
-- added config file /etc/my.cnf to the file list (just for completeness)
-- make sure to create the datadir with 755 permissions
-
-* Mon Jan 27 2003 Lenz Grimmer <lenz@mysql.com>
-
-- removed unused CC and CXX variables
-- CFLAGS and CXXFLAGS should honor RPM_OPT_FLAGS
-
-* Fri Jan 24 2003 Lenz Grimmer <lenz@mysql.com>
-
-- renamed package "MySQL" to "MySQL-server"
-- fixed Copyright tag
-- added mysql_waitpid to client subpackage (required for mysql-test-run)
-
-* Wed Nov 27 2002 Lenz Grimmer <lenz@mysql.com>
-
-- moved init script from /etc/rc.d/init.d to /etc/init.d (the majority of
- Linux distributions now support this scheme as proposed by the LSB either
- directly or via a compatibility symlink)
-- Use new "restart" init script action instead of starting and stopping
- separately
-- Be more flexible in activating the automatic bootup - use insserv (on
- older SuSE versions) or chkconfig (Red Hat, newer SuSE versions and
- others) to create the respective symlinks
-
-* Wed Sep 25 2002 Lenz Grimmer <lenz@mysql.com>
-
-- MySQL-Max now requires MySQL >= 4.0 to avoid version mismatches
- (mixing 3.23 and 4.0 packages)
-
-* Fri Aug 09 2002 Lenz Grimmer <lenz@mysql.com>
-
-- Turn off OpenSSL in MySQL-Max for now until it works properly again
-- enable RAID for the Max binary instead
-- added compatibility link: safe_mysqld -> mysqld_safe to ease the
- transition from 3.23
-
-* Thu Jul 18 2002 Lenz Grimmer <lenz@mysql.com>
-
-- Reworked the build steps a little bit: the Max binary is supposed
- to include OpenSSL, which cannot be linked statically, thus trying
- to statically link against a special glibc is futile anyway
-- because of this, it is not required to make yet another build run
- just to compile the shared libs (saves a lot of time)
-- updated package description of the Max subpackage
-- clean up the BuildRoot directory afterwards
-
-* Mon Jul 15 2002 Lenz Grimmer <lenz@mysql.com>
-
-- Updated Packager information
-- Fixed the build options: the regular package is supposed to
- include InnoDB and linked statically, while the Max package
- should include BDB and SSL support
-
-* Fri May 03 2002 Lenz Grimmer <lenz@mysql.com>
-
-- Use more RPM macros (e.g. infodir, mandir) to make the spec
- file more portable
-- reorganized the installation of documentation files: let RPM
- take care of this
-- reorganized the file list: actually install man pages along
- with the binaries of the respective subpackage
-- do not include libmysqld.a in the devel subpackage as well, if we
- have a special "embedded" subpackage
-- reworked the package descriptions
-
-* Mon Oct 8 2001 Monty
-
-- Added embedded server as a separate RPM
-
-* Fri Apr 13 2001 Monty
-
-- Added mysqld-max to the distribution
-
-* Tue Jan 2 2001 Monty
-
-- Added mysql-test to the bench package
-
-* Fri Aug 18 2000 Tim Smith <tim@mysql.com>
-
-- Added separate libmysql_r directory; now both a threaded
- and non-threaded library is shipped.
-
-* Wed Sep 28 1999 David Axmark <davida@mysql.com>
-
-- Added the support-files/my-example.cnf to the docs directory.
-
-- Removed devel dependency on base since it is about client
- development.
-
-* Wed Sep 8 1999 David Axmark <davida@mysql.com>
-
-- Cleaned up some for 3.23.
-
-* Thu Jul 1 1999 David Axmark <davida@mysql.com>
-
-- Added support for shared libraries in a separate sub
- package. Original fix by David Fox (dsfox@cogsci.ucsd.edu)
-
-- The --enable-assembler switch is now automatically disables on
- platforms there assembler code is unavailable. This should allow
- building this RPM on non i386 systems.
-
-* Mon Feb 22 1999 David Axmark <david@detron.se>
-
-- Removed unportable cc switches from the spec file. The defaults can
- now be overridden with environment variables. This feature is used
- to compile the official RPM with optimal (but compiler version
- specific) switches.
-
-- Removed the repetitive description parts for the sub rpms. Maybe add
- again if RPM gets a multiline macro capability.
-
-- Added support for a pt_BR translation. Translation contributed by
- Jorge Godoy <jorge@bestway.com.br>.
-
-* Wed Nov 4 1998 David Axmark <david@detron.se>
-
-- A lot of changes in all the rpm and install scripts. This may even
- be a working RPM :-)
-
-* Sun Aug 16 1998 David Axmark <david@detron.se>
-
-- A developers changelog for MySQL is available in the source RPM. And
- there is a history of major user visible changed in the Reference
- Manual. Only RPM specific changes will be documented here.
diff --git a/storage/xtradb/data/data0data.c b/storage/xtradb/data/data0data.c
index 0715b49bf9c..6d07fc249fa 100644
--- a/storage/xtradb/data/data0data.c
+++ b/storage/xtradb/data/data0data.c
@@ -367,7 +367,7 @@ dfield_print_also_hex(
prtype = dtype_get_prtype(dfield_get_type(dfield));
switch (dtype_get_mtype(dfield_get_type(dfield))) {
- dulint id;
+ ib_id_t id;
case DATA_INT:
switch (len) {
ulint val;
@@ -417,22 +417,16 @@ dfield_print_also_hex(
case 6:
id = mach_read_from_6(data);
- fprintf(stderr, "{%lu %lu}",
- ut_dulint_get_high(id),
- ut_dulint_get_low(id));
+ fprintf(stderr, "%llu", (ullint) id);
break;
case 7:
id = mach_read_from_7(data);
- fprintf(stderr, "{%lu %lu}",
- ut_dulint_get_high(id),
- ut_dulint_get_low(id));
+ fprintf(stderr, "%llu", (ullint) id);
break;
case 8:
id = mach_read_from_8(data);
- fprintf(stderr, "{%lu %lu}",
- ut_dulint_get_high(id),
- ut_dulint_get_low(id));
+ fprintf(stderr, "%llu", (ullint) id);
break;
default:
goto print_hex;
@@ -444,29 +438,25 @@ dfield_print_also_hex(
case DATA_TRX_ID:
id = mach_read_from_6(data);
- fprintf(stderr, "trx_id " TRX_ID_FMT,
- TRX_ID_PREP_PRINTF(id));
+ fprintf(stderr, "trx_id " TRX_ID_FMT, (ullint) id);
break;
case DATA_ROLL_PTR:
id = mach_read_from_7(data);
- fprintf(stderr, "roll_ptr {%lu %lu}",
- ut_dulint_get_high(id), ut_dulint_get_low(id));
+ fprintf(stderr, "roll_ptr " TRX_ID_FMT, (ullint) id);
break;
case DATA_ROW_ID:
id = mach_read_from_6(data);
- fprintf(stderr, "row_id {%lu %lu}",
- ut_dulint_get_high(id), ut_dulint_get_low(id));
+ fprintf(stderr, "row_id " TRX_ID_FMT, (ullint) id);
break;
default:
- id = mach_dulint_read_compressed(data);
+ id = mach_ull_read_compressed(data);
- fprintf(stderr, "mix_id {%lu %lu}",
- ut_dulint_get_high(id), ut_dulint_get_low(id));
+ fprintf(stderr, "mix_id " TRX_ID_FMT, (ullint) id);
}
break;
@@ -595,7 +585,8 @@ dtuple_convert_big_rec(
if (dict_table_get_format(index->table) < DICT_TF_FORMAT_ZIP) {
/* up to MySQL 5.1: store a 768-byte prefix locally */
- local_len = BTR_EXTERN_FIELD_REF_SIZE + DICT_MAX_INDEX_COL_LEN;
+ local_len = BTR_EXTERN_FIELD_REF_SIZE
+ + DICT_ANTELOPE_MAX_INDEX_COL_LEN;
} else {
/* new-format table: do not store any BLOB prefix locally */
local_len = BTR_EXTERN_FIELD_REF_SIZE;
@@ -767,7 +758,10 @@ dtuple_convert_back_big_rec(
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
- ut_ad(local_len <= DICT_MAX_INDEX_COL_LEN);
+ /* Only in REDUNDANT and COMPACT format, we store
+ up to DICT_ANTELOPE_MAX_INDEX_COL_LEN (768) bytes
+ locally */
+ ut_ad(local_len <= DICT_ANTELOPE_MAX_INDEX_COL_LEN);
dfield_set_data(dfield,
(char*) b->data - local_len,
diff --git a/storage/xtradb/data/data0type.c b/storage/xtradb/data/data0type.c
index e834fd2ec55..20d1f5db8d3 100644
--- a/storage/xtradb/data/data0type.c
+++ b/storage/xtradb/data/data0type.c
@@ -49,10 +49,8 @@ ulint
dtype_get_at_most_n_mbchars(
/*========================*/
ulint prtype, /*!< in: precise type */
- ulint mbminlen, /*!< in: minimum length of a
- multi-byte character */
- ulint mbmaxlen, /*!< in: maximum length of a
- multi-byte character */
+ ulint mbminmaxlen, /*!< in: minimum and maximum length of
+ a multi-byte character */
ulint prefix_len, /*!< in: length of the requested
prefix, in characters, multiplied by
dtype_get_mbmaxlen(dtype) */
@@ -60,6 +58,9 @@ dtype_get_at_most_n_mbchars(
const char* str) /*!< in: the string whose prefix
length is being determined */
{
+ ulint mbminlen = DATA_MBMINLEN(mbminmaxlen);
+ ulint mbmaxlen = DATA_MBMAXLEN(mbminmaxlen);
+
ut_a(data_len != UNIV_SQL_NULL);
ut_ad(!mbmaxlen || !(prefix_len % mbmaxlen));
@@ -180,7 +181,7 @@ dtype_validate(
}
#ifndef UNIV_HOTBACKUP
- ut_a(type->mbminlen <= type->mbmaxlen);
+ ut_a(dtype_get_mbminlen(type) <= dtype_get_mbmaxlen(type));
#endif /* !UNIV_HOTBACKUP */
return(TRUE);
diff --git a/storage/xtradb/dict/dict0boot.c b/storage/xtradb/dict/dict0boot.c
index 43cfced65a0..fd08fa759ee 100644
--- a/storage/xtradb/dict/dict0boot.c
+++ b/storage/xtradb/dict/dict0boot.c
@@ -67,12 +67,15 @@ UNIV_INTERN
void
dict_hdr_get_new_id(
/*================*/
- dulint* table_id, /*!< out: table id (not assigned if NULL) */
- dulint* index_id, /*!< out: index id (not assigned if NULL) */
- ulint* space_id) /*!< out: space id (not assigned if NULL) */
+ table_id_t* table_id, /*!< out: table id
+ (not assigned if NULL) */
+ index_id_t* index_id, /*!< out: index id
+ (not assigned if NULL) */
+ ulint* space_id) /*!< out: space id
+ (not assigned if NULL) */
{
dict_hdr_t* dict_hdr;
- dulint id;
+ ib_id_t id;
mtr_t mtr;
mtr_start(&mtr);
@@ -80,16 +83,16 @@ dict_hdr_get_new_id(
dict_hdr = dict_hdr_get(&mtr);
if (table_id) {
- id = mtr_read_dulint(dict_hdr + DICT_HDR_TABLE_ID, &mtr);
- id = ut_dulint_add(id, 1);
- mlog_write_dulint(dict_hdr + DICT_HDR_TABLE_ID, id, &mtr);
+ id = mach_read_from_8(dict_hdr + DICT_HDR_TABLE_ID);
+ id++;
+ mlog_write_ull(dict_hdr + DICT_HDR_TABLE_ID, id, &mtr);
*table_id = id;
}
if (index_id) {
- id = mtr_read_dulint(dict_hdr + DICT_HDR_INDEX_ID, &mtr);
- id = ut_dulint_add(id, 1);
- mlog_write_dulint(dict_hdr + DICT_HDR_INDEX_ID, id, &mtr);
+ id = mach_read_from_8(dict_hdr + DICT_HDR_INDEX_ID);
+ id++;
+ mlog_write_ull(dict_hdr + DICT_HDR_INDEX_ID, id, &mtr);
*index_id = id;
}
@@ -114,7 +117,7 @@ dict_hdr_flush_row_id(void)
/*=======================*/
{
dict_hdr_t* dict_hdr;
- dulint id;
+ row_id_t id;
mtr_t mtr;
ut_ad(mutex_own(&(dict_sys->mutex)));
@@ -125,7 +128,7 @@ dict_hdr_flush_row_id(void)
dict_hdr = dict_hdr_get(&mtr);
- mlog_write_dulint(dict_hdr + DICT_HDR_ROW_ID, id, &mtr);
+ mlog_write_ull(dict_hdr + DICT_HDR_ROW_ID, id, &mtr);
mtr_commit(&mtr);
}
@@ -157,14 +160,14 @@ dict_hdr_create(
/* Start counting row, table, index, and tree ids from
DICT_HDR_FIRST_ID */
- mlog_write_dulint(dict_header + DICT_HDR_ROW_ID,
- ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
+ mlog_write_ull(dict_header + DICT_HDR_ROW_ID,
+ DICT_HDR_FIRST_ID, mtr);
- mlog_write_dulint(dict_header + DICT_HDR_TABLE_ID,
- ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
+ mlog_write_ull(dict_header + DICT_HDR_TABLE_ID,
+ DICT_HDR_FIRST_ID, mtr);
- mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
- ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
+ mlog_write_ull(dict_header + DICT_HDR_INDEX_ID,
+ DICT_HDR_FIRST_ID, mtr);
mlog_write_ulint(dict_header + DICT_HDR_MAX_SPACE_ID,
0, MLOG_4BYTES, mtr);
@@ -263,8 +266,8 @@ dict_boot(void)
/* Get the dictionary header */
dict_hdr = dict_hdr_get(&mtr);
- if (ut_dulint_cmp(mtr_read_dulint(dict_hdr + DICT_HDR_XTRADB_MARK, &mtr),
- DICT_HDR_XTRADB_FLAG) != 0) {
+ if (mach_read_from_8(dict_hdr + DICT_HDR_XTRADB_MARK)
+ != DICT_HDR_XTRADB_FLAG) {
/* not extended yet by XtraDB, need to be extended */
ulint root_page_no;
@@ -277,7 +280,7 @@ dict_boot(void)
} else {
mlog_write_ulint(dict_hdr + DICT_HDR_STATS, root_page_no,
MLOG_4BYTES, &mtr);
- mlog_write_dulint(dict_hdr + DICT_HDR_XTRADB_MARK,
+ mlog_write_ull(dict_hdr + DICT_HDR_XTRADB_MARK,
DICT_HDR_XTRADB_FLAG, &mtr);
}
mtr_commit(&mtr);
@@ -296,11 +299,9 @@ dict_boot(void)
..._MARGIN, it will immediately be updated to the disk-based
header. */
- dict_sys->row_id = ut_dulint_add(
- ut_dulint_align_up(mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
- &mtr),
- DICT_HDR_ROW_ID_WRITE_MARGIN),
- DICT_HDR_ROW_ID_WRITE_MARGIN);
+ dict_sys->row_id = DICT_HDR_ROW_ID_WRITE_MARGIN
+ + ut_uint64_align_up(mach_read_from_8(dict_hdr + DICT_HDR_ROW_ID),
+ DICT_HDR_ROW_ID_WRITE_MARGIN);
/* Insert into the dictionary cache the descriptions of the basic
system tables */
@@ -465,17 +466,21 @@ dict_boot(void)
ut_a(error == DB_SUCCESS);
/*-------------------------*/
- table = dict_mem_table_create("SYS_STATS", DICT_HDR_SPACE, 3, 0);
+ table = dict_mem_table_create("SYS_STATS", DICT_HDR_SPACE, 4, 0);
table->n_mysql_handles_opened = 1; /* for pin */
dict_mem_table_add_col(table, heap, "INDEX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "KEY_COLS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, heap, "DIFF_VALS", DATA_BINARY, 0, 0);
+ dict_mem_table_add_col(table, heap, "NON_NULL_VALS", DATA_BINARY, 0, 0);
/* The '+ 2' below comes from the fields DB_TRX_ID, DB_ROLL_PTR */
#if DICT_SYS_STATS_DIFF_VALS_FIELD != 2 + 2
#error "DICT_SYS_STATS_DIFF_VALS_FIELD != 2 + 2"
#endif
+#if DICT_SYS_STATS_NON_NULL_VALS_FIELD != 3 + 2
+#error "DICT_SYS_STATS_NON_NULL_VALS_FIELD != 3 + 2"
+#endif
table->id = DICT_STATS_ID;
dict_table_add_to_cache(table, heap);
diff --git a/storage/xtradb/dict/dict0crea.c b/storage/xtradb/dict/dict0crea.c
index a6d0e11740a..1d1a8714de0 100644
--- a/storage/xtradb/dict/dict0crea.c
+++ b/storage/xtradb/dict/dict0crea.c
@@ -529,7 +529,7 @@ dict_create_sys_stats_tuple(
sys_stats = dict_sys->sys_stats;
- entry = dtuple_create(heap, 3 + DATA_N_SYS_COLS);
+ entry = dtuple_create(heap, 4 + DATA_N_SYS_COLS);
dict_table_copy_types(entry, sys_stats);
@@ -546,7 +546,12 @@ dict_create_sys_stats_tuple(
/* 4: DIFF_VALS ----------------------*/
dfield = dtuple_get_nth_field(entry, 2/*DIFF_VALS*/);
ptr = mem_heap_alloc(heap, 8);
- mach_write_to_8(ptr, ut_dulint_zero); /* initial value is 0 */
+ mach_write_to_8(ptr, 0); /* initial value is 0 */
+ dfield_set_data(dfield, ptr, 8);
+ /* 5: NON_NULL_VALS ------------------*/
+ dfield = dtuple_get_nth_field(entry, 3/*NON_NULL_VALS*/);
+ ptr = mem_heap_alloc(heap, 8);
+ mach_write_to_8(ptr, 0); /* initial value is 0 */
dfield_set_data(dfield, ptr, 8);
return(entry);
@@ -635,7 +640,7 @@ dict_build_index_def_step(
ins_node_set_new_row(node->ind_def, row);
/* Note that the index was created by this transaction. */
- index->trx_id = (ib_uint64_t) ut_conv_dulint_to_longlong(trx->id);
+ index->trx_id = trx->id;
return(DB_SUCCESS);
}
@@ -693,7 +698,6 @@ dict_create_index_tree_step(
{
dict_index_t* index;
dict_table_t* sys_indexes;
- dict_table_t* table;
dtuple_t* search_tuple;
ulint zip_size;
btr_pcur_t pcur;
@@ -702,7 +706,6 @@ dict_create_index_tree_step(
ut_ad(mutex_own(&(dict_sys->mutex)));
index = node->index;
- table = node->table;
sys_indexes = dict_sys->sys_indexes;
@@ -727,9 +730,9 @@ dict_create_index_tree_step(
/* printf("Created a new index tree in space %lu root page %lu\n",
index->space, index->page_no); */
- page_rec_write_index_page_no(btr_pcur_get_rec(&pcur),
- DICT_SYS_INDEXES_PAGE_NO_FIELD,
- node->page_no, &mtr);
+ page_rec_write_field(btr_pcur_get_rec(&pcur),
+ DICT_SYS_INDEXES_PAGE_NO_FIELD,
+ node->page_no, &mtr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -799,9 +802,8 @@ dict_drop_index_tree(
root_page_no); */
btr_free_root(space, zip_size, root_page_no, mtr);
- page_rec_write_index_page_no(rec,
- DICT_SYS_INDEXES_PAGE_NO_FIELD,
- FIL_NULL, mtr);
+ page_rec_write_field(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
+ FIL_NULL, mtr);
}
/*******************************************************************//**
@@ -827,7 +829,7 @@ dict_truncate_index_tree(
ibool drop = !space;
ulint zip_size;
ulint type;
- dulint index_id;
+ index_id_t index_id;
rec_t* rec;
const byte* ptr;
ulint len;
@@ -896,7 +898,7 @@ dict_truncate_index_tree(
appropriate field in the SYS_INDEXES record: this mini-transaction
marks the B-tree totally truncated */
- btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, mtr);
+ btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr);
btr_free_root(space, zip_size, root_page_no, mtr);
create:
@@ -904,8 +906,8 @@ create:
in SYS_INDEXES, so that the database will not get into an
inconsistent state in case it crashes between the mtr_commit()
below and the following mtr_commit() call. */
- page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
- FIL_NULL, mtr);
+ page_rec_write_field(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
+ FIL_NULL, mtr);
/* We will need to commit the mini-transaction in order to avoid
deadlocks in the btr_create() call, because otherwise we would
@@ -920,7 +922,7 @@ create:
for (index = UT_LIST_GET_FIRST(table->indexes);
index;
index = UT_LIST_GET_NEXT(indexes, index)) {
- if (!ut_dulint_cmp(index->id, index_id)) {
+ if (index->id == index_id) {
root_page_no = btr_create(type, space, zip_size,
index_id, index, mtr);
index->page = (unsigned int) root_page_no;
@@ -930,10 +932,9 @@ create:
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Index %lu %lu of table %s is missing\n"
+ " InnoDB: Index %llu of table %s is missing\n"
"InnoDB: from the data dictionary during TRUNCATE!\n",
- ut_dulint_get_high(index_id),
- ut_dulint_get_low(index_id),
+ (ullint) index_id,
table->name);
return(FIL_NULL);
@@ -1229,7 +1230,7 @@ dict_create_index_step(
if (node->state == INDEX_ADD_TO_CACHE) {
- dulint index_id = node->index->id;
+ index_id_t index_id = node->index->id;
err = dict_index_add_to_cache(
node->table, node->index, FIL_NULL,
diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c
index 1d0517f5cc7..1ad540f47ab 100644
--- a/storage/xtradb/dict/dict0dict.c
+++ b/storage/xtradb/dict/dict0dict.c
@@ -53,7 +53,7 @@ UNIV_INTERN dict_index_t* dict_ind_compact;
#include "rem0cmp.h"
#include "row0merge.h"
#include "m_ctype.h" /* my_isspace() */
-#include "ha_prototypes.h" /* innobase_strcasecmp() */
+#include "ha_prototypes.h" /* innobase_strcasecmp(), innobase_casedn_str()*/
#include "srv0start.h" /* SRV_LOG_SPACE_FIRST_ID */
#include <ctype.h>
@@ -71,6 +71,18 @@ we need this; NOTE: a transaction which reserves this must keep book
on the mode in trx_struct::dict_operation_lock_mode */
UNIV_INTERN rw_lock_t dict_operation_lock;
+/* Keys to register rwlocks and mutexes with performance schema */
+#ifdef UNIV_PFS_RWLOCK
+UNIV_INTERN mysql_pfs_key_t dict_operation_lock_key;
+UNIV_INTERN mysql_pfs_key_t index_tree_rw_lock_key;
+UNIV_INTERN mysql_pfs_key_t dict_table_stats_latch_key;
+#endif /* UNIV_PFS_RWLOCK */
+
+#ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t dict_sys_mutex_key;
+UNIV_INTERN mysql_pfs_key_t dict_foreign_err_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
#define DICT_HEAP_SIZE 100 /*!< initial memory heap size when
creating a table or index object */
#define DICT_POOL_PER_TABLE_HASH 512 /*!< buffer pool max size per table
@@ -81,9 +93,18 @@ UNIV_INTERN rw_lock_t dict_operation_lock;
/** Identifies generated InnoDB foreign key names */
static char dict_ibfk[] = "_ibfk_";
-/** array of mutexes protecting dict_index_t::stat_n_diff_key_vals[] */
-#define DICT_INDEX_STAT_MUTEX_SIZE 32
-static mutex_t dict_index_stat_mutex[DICT_INDEX_STAT_MUTEX_SIZE];
+/** array of rw locks protecting
+dict_table_t::stat_initialized
+dict_table_t::stat_n_rows (*)
+dict_table_t::stat_clustered_index_size
+dict_table_t::stat_sum_of_other_index_sizes
+dict_table_t::stat_modified_counter (*)
+dict_table_t::indexes*::stat_n_diff_key_vals[]
+dict_table_t::indexes*::stat_index_size
+dict_table_t::indexes*::stat_n_leaf_pages
+(*) those are not always protected for performance reasons */
+#define DICT_TABLE_STATS_LATCHES_SIZE 64
+static rw_lock_t dict_table_stats_latches[DICT_TABLE_STATS_LATCHES_SIZE];
/*******************************************************************//**
Tries to find column names for the index and sets the col field of the
@@ -244,43 +265,65 @@ dict_mutex_exit_for_mysql(void)
mutex_exit(&(dict_sys->mutex));
}
-/** Get the mutex that protects index->stat_n_diff_key_vals[] */
-#define GET_INDEX_STAT_MUTEX(index) \
- (&dict_index_stat_mutex[ut_fold_dulint(index->id) \
- % DICT_INDEX_STAT_MUTEX_SIZE])
+/** Get the latch that protects the stats of a given table */
+#define GET_TABLE_STATS_LATCH(table) \
+ (&dict_table_stats_latches[ut_fold_ull(table->id) \
+ % DICT_TABLE_STATS_LATCHES_SIZE])
/**********************************************************************//**
-Lock the appropriate mutex to protect index->stat_n_diff_key_vals[].
-index->id is used to pick the right mutex and it should not change
-before dict_index_stat_mutex_exit() is called on this index. */
+Lock the appropriate latch to protect a given table's statistics.
+table->id is used to pick the corresponding latch from a global array of
+latches. */
UNIV_INTERN
void
-dict_index_stat_mutex_enter(
-/*========================*/
- const dict_index_t* index) /*!< in: index */
+dict_table_stats_lock(
+/*==================*/
+ const dict_table_t* table, /*!< in: table */
+ ulint latch_mode) /*!< in: RW_S_LATCH or
+ RW_X_LATCH */
{
- ut_ad(index != NULL);
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- ut_ad(index->cached);
- ut_ad(!index->to_be_dropped);
+ ut_ad(table != NULL);
+ ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
- mutex_enter(GET_INDEX_STAT_MUTEX(index));
+ switch (latch_mode) {
+ case RW_S_LATCH:
+ rw_lock_s_lock(GET_TABLE_STATS_LATCH(table));
+ break;
+ case RW_X_LATCH:
+ rw_lock_x_lock(GET_TABLE_STATS_LATCH(table));
+ break;
+ case RW_NO_LATCH:
+ /* fall through */
+ default:
+ ut_error;
+ }
}
/**********************************************************************//**
-Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */
+Unlock the latch that has been locked by dict_table_stats_lock() */
UNIV_INTERN
void
-dict_index_stat_mutex_exit(
-/*=======================*/
- const dict_index_t* index) /*!< in: index */
+dict_table_stats_unlock(
+/*====================*/
+ const dict_table_t* table, /*!< in: table */
+ ulint latch_mode) /*!< in: RW_S_LATCH or
+ RW_X_LATCH */
{
- ut_ad(index != NULL);
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- ut_ad(index->cached);
- ut_ad(!index->to_be_dropped);
+ ut_ad(table != NULL);
+ ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
- mutex_exit(GET_INDEX_STAT_MUTEX(index));
+ switch (latch_mode) {
+ case RW_S_LATCH:
+ rw_lock_s_unlock(GET_TABLE_STATS_LATCH(table));
+ break;
+ case RW_X_LATCH:
+ rw_lock_x_unlock(GET_TABLE_STATS_LATCH(table));
+ break;
+ case RW_NO_LATCH:
+ /* fall through */
+ default:
+ ut_error;
+ }
}
/********************************************************************//**
@@ -415,14 +458,14 @@ dict_index_t*
dict_index_get_on_id_low(
/*=====================*/
dict_table_t* table, /*!< in: table */
- dulint id) /*!< in: index id */
+ index_id_t id) /*!< in: index id */
{
dict_index_t* index;
index = dict_table_get_first_index(table);
while (index) {
- if (0 == ut_dulint_cmp(id, index->id)) {
+ if (id == index->id) {
/* Found */
return(index);
@@ -564,12 +607,13 @@ UNIV_INTERN
dict_table_t*
dict_table_get_on_id(
/*=================*/
- dulint table_id, /*!< in: table id */
- trx_t* trx) /*!< in: transaction handle */
+ table_id_t table_id, /*!< in: table id */
+ trx_t* trx) /*!< in: transaction handle */
{
dict_table_t* table;
- if (trx->dict_operation_lock_mode == RW_X_LATCH) {
+ if (table_id <= DICT_FIELDS_ID
+ || trx->dict_operation_lock_mode == RW_X_LATCH) {
/* Note: An X latch implies that the transaction
already owns the dictionary mutex. */
@@ -652,7 +696,7 @@ dict_init(void)
dict_sys = mem_alloc(sizeof(dict_sys_t));
- mutex_create(&dict_sys->mutex, SYNC_DICT);
+ mutex_create(dict_sys_mutex_key, &dict_sys->mutex, SYNC_DICT);
dict_sys->table_hash = hash_create(buf_pool_get_curr_size()
/ (DICT_POOL_PER_TABLE_HASH
@@ -664,15 +708,18 @@ dict_init(void)
UT_LIST_INIT(dict_sys->table_LRU);
- rw_lock_create(&dict_operation_lock, SYNC_DICT_OPERATION);
+ rw_lock_create(dict_operation_lock_key,
+ &dict_operation_lock, SYNC_DICT_OPERATION);
dict_foreign_err_file = os_file_create_tmpfile();
ut_a(dict_foreign_err_file);
- mutex_create(&dict_foreign_err_mutex, SYNC_ANY_LATCH);
+ mutex_create(dict_foreign_err_mutex_key,
+ &dict_foreign_err_mutex, SYNC_ANY_LATCH);
- for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) {
- mutex_create(&dict_index_stat_mutex[i], SYNC_INDEX_TREE);
+ for (i = 0; i < DICT_TABLE_STATS_LATCHES_SIZE; i++) {
+ rw_lock_create(dict_table_stats_latch_key,
+ &dict_table_stats_latches[i], SYNC_INDEX_TREE);
}
}
@@ -704,13 +751,12 @@ dict_table_get(
mutex_exit(&(dict_sys->mutex));
- if (table != NULL) {
- if (!table->stat_initialized && !table->is_corrupt) {
- /* If table->ibd_file_missing == TRUE, this will
- print an error message and return without doing
- anything. */
- dict_update_statistics(table, FALSE);
- }
+ if (table != NULL && !table->is_corrupt) {
+ /* If table->ibd_file_missing == TRUE, this will
+ print an error message and return without doing
+ anything. */
+ dict_update_statistics(table, TRUE /* only update stats
+ if they have not been initialized */, FALSE);
}
return(table);
@@ -788,7 +834,7 @@ dict_table_add_to_cache(
table->cached = TRUE;
fold = ut_fold_string(table->name);
- id_fold = ut_fold_dulint(table->id);
+ id_fold = ut_fold_ull(table->id);
row_len = 0;
for (i = 0; i < table->n_def; i++) {
@@ -830,7 +876,7 @@ dict_table_add_to_cache(
dict_table_t* table2;
HASH_SEARCH(id_hash, dict_sys->table_id_hash, id_fold,
dict_table_t*, table2, ut_ad(table2->cached),
- ut_dulint_cmp(table2->id, table->id) == 0);
+ table2->id == table->id);
ut_a(table2 == NULL);
#ifdef UNIV_DEBUG
@@ -865,7 +911,7 @@ UNIV_INTERN
dict_index_t*
dict_index_find_on_id_low(
/*======================*/
- dulint id) /*!< in: index id */
+ index_id_t id) /*!< in: index id */
{
dict_table_t* table;
dict_index_t* index;
@@ -876,7 +922,7 @@ dict_index_find_on_id_low(
index = dict_table_get_first_index(table);
while (index) {
- if (0 == ut_dulint_cmp(id, index->id)) {
+ if (id == index->id) {
/* Found */
return(index);
@@ -907,7 +953,7 @@ dict_table_rename_in_cache(
dict_foreign_t* foreign;
dict_index_t* index;
ulint fold;
- char old_name[MAX_TABLE_NAME_LEN + 1];
+ char old_name[MAX_FULL_NAME_LEN + 1];
ut_ad(table);
ut_ad(mutex_own(&(dict_sys->mutex)));
@@ -919,7 +965,7 @@ dict_table_rename_in_cache(
ut_print_timestamp(stderr);
fprintf(stderr, "InnoDB: too long table name: '%s', "
"max length is %d\n", table->name,
- MAX_TABLE_NAME_LEN);
+ MAX_FULL_NAME_LEN);
ut_error;
}
@@ -969,11 +1015,11 @@ dict_table_rename_in_cache(
ut_fold_string(old_name), table);
if (strlen(new_name) > strlen(table->name)) {
- /* We allocate MAX_TABLE_NAME_LEN+1 bytes here to avoid
+ /* We allocate MAX_FULL_NAME_LEN + 1 bytes here to avoid
memory fragmentation, we assume a repeated calls of
ut_realloc() with the same size do not cause fragmentation */
- ut_a(strlen(new_name) <= MAX_TABLE_NAME_LEN);
- table->name = ut_realloc(table->name, MAX_TABLE_NAME_LEN + 1);
+ ut_a(strlen(new_name) <= MAX_FULL_NAME_LEN);
+ table->name = ut_realloc(table->name, MAX_FULL_NAME_LEN + 1);
}
memcpy(table->name, new_name, strlen(new_name) + 1);
@@ -1040,13 +1086,13 @@ dict_table_rename_in_cache(
/* Allocate a longer name buffer;
TODO: store buf len to save memory */
- foreign->foreign_table_name
- = mem_heap_alloc(foreign->heap,
- ut_strlen(table->name) + 1);
+ foreign->foreign_table_name = mem_heap_strdup(
+ foreign->heap, table->name);
+ dict_mem_foreign_table_name_lookup_set(foreign, TRUE);
+ } else {
+ strcpy(foreign->foreign_table_name, table->name);
+ dict_mem_foreign_table_name_lookup_set(foreign, FALSE);
}
-
- strcpy(foreign->foreign_table_name, table->name);
-
if (strchr(foreign->id, '/')) {
ulint db_len;
char* old_id;
@@ -1112,12 +1158,14 @@ dict_table_rename_in_cache(
/* Allocate a longer name buffer;
TODO: store buf len to save memory */
- foreign->referenced_table_name = mem_heap_alloc(
- foreign->heap, strlen(table->name) + 1);
+ foreign->referenced_table_name = mem_heap_strdup(
+ foreign->heap, table->name);
+ dict_mem_referenced_table_name_lookup_set(foreign, TRUE);
+ } else {
+ /* Use the same buffer */
+ strcpy(foreign->referenced_table_name, table->name);
+ dict_mem_referenced_table_name_lookup_set(foreign, FALSE);
}
-
- strcpy(foreign->referenced_table_name, table->name);
-
foreign = UT_LIST_GET_NEXT(referenced_list, foreign);
}
@@ -1132,7 +1180,7 @@ void
dict_table_change_id_in_cache(
/*==========================*/
dict_table_t* table, /*!< in/out: table object already in cache */
- dulint new_id) /*!< in: new id to set */
+ table_id_t new_id) /*!< in: new id to set */
{
ut_ad(table);
ut_ad(mutex_own(&(dict_sys->mutex)));
@@ -1141,12 +1189,12 @@ dict_table_change_id_in_cache(
/* Remove the table from the hash table of id's */
HASH_DELETE(dict_table_t, id_hash, dict_sys->table_id_hash,
- ut_fold_dulint(table->id), table);
+ ut_fold_ull(table->id), table);
table->id = new_id;
/* Add the table back to the hash table */
HASH_INSERT(dict_table_t, id_hash, dict_sys->table_id_hash,
- ut_fold_dulint(table->id), table);
+ ut_fold_ull(table->id), table);
}
/**********************************************************************//**
@@ -1202,7 +1250,7 @@ dict_table_remove_from_cache(
HASH_DELETE(dict_table_t, name_hash, dict_sys->table_hash,
ut_fold_string(table->name), table);
HASH_DELETE(dict_table_t, id_hash, dict_sys->table_id_hash,
- ut_fold_dulint(table->id), table);
+ ut_fold_ull(table->id), table);
/* Remove table from LRU list of tables */
UT_LIST_REMOVE(table_LRU, dict_sys->table_LRU, table);
@@ -1367,36 +1415,63 @@ dict_index_too_big_for_undo(
ulint fixed_size
= dict_col_get_fixed_size(col,
dict_table_is_comp(table));
+ ulint max_prefix
+ = col->max_prefix;
if (fixed_size) {
/* Fixed-size columns are stored locally. */
max_size = fixed_size;
} else if (max_size <= BTR_EXTERN_FIELD_REF_SIZE * 2) {
/* Short columns are stored locally. */
- } else if (!col->ord_part) {
+ } else if (!col->ord_part
+ || (col->max_prefix
+ < (ulint) DICT_MAX_FIELD_LEN_BY_FORMAT(table))) {
/* See if col->ord_part would be set
- because of new_index. */
+ because of new_index. Also check if the new
+ index could have longer prefix on columns
+ that already had ord_part set */
ulint j;
for (j = 0; j < new_index->n_uniq; j++) {
if (dict_index_get_nth_col(
new_index, j) == col) {
+ const dict_field_t* field
+ = dict_index_get_nth_field(
+ new_index, j);
+
+ if (field->prefix_len
+ > col->max_prefix) {
+ max_prefix =
+ field->prefix_len;
+ }
goto is_ord_part;
}
}
+ if (col->ord_part) {
+ goto is_ord_part;
+ }
+
/* This is not an ordering column in any index.
Thus, it can be stored completely externally. */
max_size = BTR_EXTERN_FIELD_REF_SIZE;
} else {
+ ulint max_field_len;
is_ord_part:
+ max_field_len = DICT_MAX_FIELD_LEN_BY_FORMAT(table);
+
/* This is an ordering column in some index.
A long enough prefix must be written to the
undo log. See trx_undo_page_fetch_ext(). */
+ max_size = ut_min(max_size, max_field_len);
+
+ /* We only store the needed prefix length in undo log */
+ if (max_prefix) {
+ ut_ad(dict_table_get_format(table)
+ >= DICT_TF_FORMAT_ZIP);
- if (max_size > REC_MAX_INDEX_COL_LEN) {
- max_size = REC_MAX_INDEX_COL_LEN;
+ max_size = ut_min(max_prefix, max_size);
}
max_size += BTR_EXTERN_FIELD_REF_SIZE;
@@ -1650,15 +1725,16 @@ too_big:
/* In dtuple_convert_big_rec(), variable-length columns
that are longer than BTR_EXTERN_FIELD_REF_SIZE * 2
may be chosen for external storage. If the column appears
- in an ordering column of an index, a longer prefix of
- REC_MAX_INDEX_COL_LEN will be copied to the undo log
- by trx_undo_page_report_modify() and
+ in an ordering column of an index, a longer prefix determined
+ by dict_max_field_len_store_undo() will be copied to the undo
+ log by trx_undo_page_report_modify() and
trx_undo_page_fetch_ext(). It suffices to check the
capacity of the undo log whenever new_index includes
a column prefix on a column that may be stored externally. */
if (field->prefix_len /* prefix index */
- && !col->ord_part /* not yet ordering column */
+ && (!col->ord_part /* not yet ordering column */
+ || field->prefix_len > col->max_prefix)
&& !dict_col_get_fixed_size(col, TRUE) /* variable-length */
&& dict_col_get_max_size(col)
> BTR_EXTERN_FIELD_REF_SIZE * 2 /* long enough */) {
@@ -1675,11 +1751,17 @@ too_big:
}
undo_size_ok:
- /* Flag the ordering columns */
+ /* Flag the ordering columns and also set column max_prefix */
for (i = 0; i < n_ord; i++) {
+ const dict_field_t* field
+ = dict_index_get_nth_field(new_index, i);
+
+ field->col->ord_part = 1;
- dict_index_get_nth_field(new_index, i)->col->ord_part = 1;
+ if (field->prefix_len > field->col->max_prefix) {
+ field->col->max_prefix = field->prefix_len;
+ }
}
/* Add the new index as the last index for the table */
@@ -1694,7 +1776,8 @@ undo_size_ok:
new_index->stat_n_leaf_pages = 1;
new_index->page = page_no;
- rw_lock_create(&new_index->lock, SYNC_INDEX_TREE);
+ rw_lock_create(index_tree_rw_lock_key, &new_index->lock,
+ SYNC_INDEX_TREE);
if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) {
@@ -1702,6 +1785,12 @@ undo_size_ok:
new_index->heap,
(1 + dict_index_get_n_unique(new_index))
* sizeof(ib_int64_t));
+
+ new_index->stat_n_non_null_key_vals = mem_heap_zalloc(
+ new_index->heap,
+ (1 + dict_index_get_n_unique(new_index))
+ * sizeof(*new_index->stat_n_non_null_key_vals));
+
/* Give some sensible values to stat_n_... in case we do
not calculate statistics quickly enough */
@@ -1756,7 +1845,7 @@ dict_index_remove_from_cache(
zero. */
for (;;) {
- ulint ref_count = btr_search_info_get_ref_count(info);
+ ulint ref_count = btr_search_info_get_ref_count(info, index->id);
if (ref_count == 0) {
break;
}
@@ -1880,14 +1969,14 @@ dict_index_add_col(
variable-length fields, so that the extern flag can be embedded in
the length word. */
- if (field->fixed_len > DICT_MAX_INDEX_COL_LEN) {
+ if (field->fixed_len > DICT_MAX_FIXED_COL_LEN) {
field->fixed_len = 0;
}
-#if DICT_MAX_INDEX_COL_LEN != 768
+#if DICT_MAX_FIXED_COL_LEN != 768
/* The comparison limit above must be constant. If it were
changed, the disk format of some fixed-length columns would
change, which would be a disaster. */
-# error "DICT_MAX_INDEX_COL_LEN != 768"
+# error "DICT_MAX_FIXED_COL_LEN != 768"
#endif
if (!(col->prtype & DATA_NOT_NULL)) {
@@ -2526,8 +2615,7 @@ dict_table_get_index_by_max_id(
/* We found a matching index, select
the index with the higher id*/
- if (!found
- || ut_dulint_cmp(index->id, found->id) > 0) {
+ if (!found || index->id > found->id) {
found = index;
}
@@ -2606,10 +2694,10 @@ dict_foreign_add_to_cache(
ut_ad(mutex_own(&(dict_sys->mutex)));
for_table = dict_table_check_if_in_cache_low(
- foreign->foreign_table_name);
+ foreign->foreign_table_name_lookup);
ref_table = dict_table_check_if_in_cache_low(
- foreign->referenced_table_name);
+ foreign->referenced_table_name_lookup);
ut_a(for_table || ref_table);
if (for_table) {
@@ -2726,7 +2814,7 @@ dict_scan_to(
quote = '\0';
} else if (quote) {
/* Within quotes: do nothing. */
- } else if (*ptr == '`' || *ptr == '"') {
+ } else if (*ptr == '`' || *ptr == '"' || *ptr == '\'') {
/* Starting quote: remember the quote character. */
quote = *ptr;
} else {
@@ -3038,19 +3126,25 @@ dict_scan_table_name(
memcpy(ref, database_name, database_name_len);
ref[database_name_len] = '/';
memcpy(ref + database_name_len + 1, table_name, table_name_len + 1);
-#ifndef __WIN__
- if (srv_lower_case_table_names) {
-#endif /* !__WIN__ */
- /* The table name is always put to lower case on Windows. */
+
+ /* Values; 0 = Store and compare as given; case sensitive
+ 1 = Store and compare in lower; case insensitive
+ 2 = Store as given, compare in lower; case semi-sensitive */
+ if (innobase_get_lower_case_table_names() == 2) {
innobase_casedn_str(ref);
-#ifndef __WIN__
+ *table = dict_table_get_low(ref);
+ memcpy(ref, database_name, database_name_len);
+ ref[database_name_len] = '/';
+ memcpy(ref + database_name_len + 1, table_name, table_name_len + 1);
+ } else {
+ if (innobase_get_lower_case_table_names() == 1) {
+ innobase_casedn_str(ref);
+ }
+ *table = dict_table_get_low(ref);
}
-#endif /* !__WIN__ */
*success = TRUE;
*ref_name = ref;
- *table = dict_table_get_low(ref);
-
return(ptr);
}
@@ -3506,7 +3600,7 @@ col_loop1:
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
- return(DB_CANNOT_ADD_CONSTRAINT);
+ return(DB_CHILD_NO_INDEX);
}
ptr = dict_accept(cs, ptr, "REFERENCES", &success);
@@ -3539,8 +3633,10 @@ col_loop1:
}
foreign->foreign_table = table;
- foreign->foreign_table_name = mem_heap_strdup(foreign->heap,
- table->name);
+ foreign->foreign_table_name = mem_heap_strdup(
+ foreign->heap, table->name);
+ dict_mem_foreign_table_name_lookup_set(foreign, TRUE);
+
foreign->foreign_index = index;
foreign->n_fields = (unsigned int) i;
foreign->foreign_col_names = mem_heap_alloc(foreign->heap,
@@ -3787,7 +3883,7 @@ try_find_index:
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
- return(DB_CANNOT_ADD_CONSTRAINT);
+ return(DB_PARENT_NO_INDEX);
}
} else {
ut_a(trx->check_foreigns == FALSE);
@@ -3797,8 +3893,9 @@ try_find_index:
foreign->referenced_index = index;
foreign->referenced_table = referenced_table;
- foreign->referenced_table_name
- = mem_heap_strdup(foreign->heap, referenced_table_name);
+ foreign->referenced_table_name = mem_heap_strdup(
+ foreign->heap, referenced_table_name);
+ dict_mem_referenced_table_name_lookup_set(foreign, TRUE);
foreign->referenced_col_names = mem_heap_alloc(foreign->heap,
i * sizeof(void*));
@@ -4015,7 +4112,7 @@ UNIV_INTERN
dict_index_t*
dict_index_get_if_in_cache_low(
/*===========================*/
- dulint index_id) /*!< in: index id */
+ index_id_t index_id) /*!< in: index id */
{
ut_ad(mutex_own(&(dict_sys->mutex)));
@@ -4030,7 +4127,7 @@ UNIV_INTERN
dict_index_t*
dict_index_get_if_in_cache(
/*=======================*/
- dulint index_id) /*!< in: index id */
+ index_id_t index_id) /*!< in: index id */
{
dict_index_t* index;
@@ -4301,15 +4398,18 @@ dict_reload_statistics(
ulint key_cols;
ulint n_cols;
const rec_t* rec;
+ ulint n_fields;
const byte* field;
ulint len;
ib_int64_t* stat_n_diff_key_vals_tmp;
+ ib_int64_t* stat_n_non_null_key_vals_tmp;
byte* buf;
ulint i;
mtr_t mtr;
n_cols = dict_index_get_n_unique(index);
stat_n_diff_key_vals_tmp = mem_heap_zalloc(heap, (n_cols + 1) * sizeof(ib_int64_t));
+ stat_n_non_null_key_vals_tmp = mem_heap_zalloc(heap, (n_cols + 1) * sizeof(ib_int64_t));
sys_stats = dict_sys->sys_stats;
sys_index = UT_LIST_GET_FIRST(sys_stats->indexes);
@@ -4332,11 +4432,11 @@ dict_reload_statistics(
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur)
- || ut_dulint_cmp(mach_read_from_8(rec_get_nth_field_old(rec, 0, &len)),
- index->id)) {
+ || mach_read_from_8(rec_get_nth_field_old(rec, 0, &len))
+ != index->id) {
/* not found: even 1 if not found should not be alowed */
fprintf(stderr, "InnoDB: Warning: stats for %s/%s (%lu/%lu)"
- " not fonund in SYS_STATS\n",
+ " not found in SYS_STATS\n",
index->table_name, index->name, i, n_cols);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -4345,9 +4445,13 @@ dict_reload_statistics(
}
if (rec_get_deleted_flag(rec, 0)) {
+ /* don't count */
+ i--;
goto next_rec;
}
+ n_fields = rec_get_n_fields_old(rec);
+
field = rec_get_nth_field_old(rec, 1, &len);
ut_a(len == 4);
@@ -4358,7 +4462,22 @@ dict_reload_statistics(
field = rec_get_nth_field_old(rec, DICT_SYS_STATS_DIFF_VALS_FIELD, &len);
ut_a(len == 8);
- stat_n_diff_key_vals_tmp[i] = ut_conv_dulint_to_longlong(mach_read_from_8(field));
+ stat_n_diff_key_vals_tmp[i] = mach_read_from_8(field);
+
+ if (n_fields > DICT_SYS_STATS_NON_NULL_VALS_FIELD) {
+ field = rec_get_nth_field_old(rec, DICT_SYS_STATS_NON_NULL_VALS_FIELD, &len);
+ ut_a(len == 8);
+
+ stat_n_non_null_key_vals_tmp[i] = mach_read_from_8(field);
+ } else {
+ /* not enough fields: should be older */
+ fprintf(stderr, "InnoDB: Notice: stats for %s/%s (%lu/%lu)"
+ " in SYS_STATS seems older format. "
+ "Please execute ANALYZE TABLE for it.\n",
+ index->table_name, index->name, i, n_cols);
+
+ stat_n_non_null_key_vals_tmp[i] = ((ib_int64_t)(-1));
+ }
next_rec:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
@@ -4366,11 +4485,15 @@ next_rec:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
- dict_index_stat_mutex_enter(index);
for (i = 0; i <= n_cols; i++) {
index->stat_n_diff_key_vals[i] = stat_n_diff_key_vals_tmp[i];
+ if (stat_n_non_null_key_vals_tmp[i] == ((ib_int64_t)(-1))) {
+ /* approximate value */
+ index->stat_n_non_null_key_vals[i] = stat_n_diff_key_vals_tmp[n_cols];
+ } else {
+ index->stat_n_non_null_key_vals[i] = stat_n_non_null_key_vals_tmp[i];
+ }
}
- dict_index_stat_mutex_exit(index);
}
/*===========================================*/
@@ -4414,21 +4537,23 @@ dict_store_statistics(
ulint n_cols;
ulint rests;
const rec_t* rec;
+ ulint n_fields;
const byte* field;
ulint len;
ib_int64_t* stat_n_diff_key_vals_tmp;
+ ib_int64_t* stat_n_non_null_key_vals_tmp;
byte* buf;
ulint i;
mtr_t mtr;
n_cols = dict_index_get_n_unique(index);
stat_n_diff_key_vals_tmp = mem_heap_zalloc(heap, (n_cols + 1) * sizeof(ib_int64_t));
+ stat_n_non_null_key_vals_tmp = mem_heap_zalloc(heap, (n_cols + 1) * sizeof(ib_int64_t));
- dict_index_stat_mutex_enter(index);
for (i = 0; i <= n_cols; i++) {
stat_n_diff_key_vals_tmp[i] = index->stat_n_diff_key_vals[i];
+ stat_n_non_null_key_vals_tmp[i] = index->stat_n_non_null_key_vals[i];
}
- dict_index_stat_mutex_exit(index);
sys_stats = dict_sys->sys_stats;
sys_index = UT_LIST_GET_FIRST(sys_stats->indexes);
@@ -4452,15 +4577,29 @@ dict_store_statistics(
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur)
- || ut_dulint_cmp(mach_read_from_8(rec_get_nth_field_old(rec, 0, &len)),
- index->id)) {
+ || mach_read_from_8(rec_get_nth_field_old(rec, 0, &len))
+ != index->id) {
/* not found */
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
+
+
break;
}
+ btr_pcur_store_position(&pcur, &mtr);
+
if (rec_get_deleted_flag(rec, 0)) {
+ /* don't count */
+ i--;
+ goto next_rec;
+ }
+
+ n_fields = rec_get_n_fields_old(rec);
+
+ if (n_fields <= DICT_SYS_STATS_NON_NULL_VALS_FIELD) {
+ /* not update for the older smaller format */
+ fprintf(stderr, "InnoDB: Notice: stats for %s/%s (%lu/%lu)"
+ " in SYS_STATS seems older format. Please ANALYZE TABLE it.\n",
+ index->table_name, index->name, i, n_cols);
goto next_rec;
}
@@ -4472,14 +4611,20 @@ dict_store_statistics(
field = rec_get_nth_field_old(rec, DICT_SYS_STATS_DIFF_VALS_FIELD, &len);
ut_a(len == 8);
- mlog_write_dulint((byte*)field,
- ut_dulint_create((ulint) (stat_n_diff_key_vals_tmp[key_cols] >> 32),
- (ulint) stat_n_diff_key_vals_tmp[key_cols] & 0xFFFFFFFF),
- &mtr);
+ mlog_write_ull((byte*)field, stat_n_diff_key_vals_tmp[key_cols], &mtr);
+
+ field = rec_get_nth_field_old(rec, DICT_SYS_STATS_NON_NULL_VALS_FIELD, &len);
+ ut_a(len == 8);
+
+ mlog_write_ull((byte*)field, stat_n_non_null_key_vals_tmp[key_cols], &mtr);
rests--;
next_rec:
+ mtr_commit(&mtr);
+ mtr_start(&mtr);
+ btr_pcur_restore_position(BTR_MODIFY_LEAF, &pcur, &mtr);
+
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
btr_pcur_close(&pcur);
@@ -4504,12 +4649,13 @@ Calculates new estimates for table and index statistics. The statistics
are used in query optimization. */
UNIV_INTERN
void
-dict_update_statistics_low(
-/*=======================*/
+dict_update_statistics(
+/*===================*/
dict_table_t* table, /*!< in/out: table */
- ibool has_dict_mutex __attribute__((unused)),
- /*!< in: TRUE if the caller has the
- dictionary mutex */
+ ibool only_calc_if_missing_stats,/*!< in: only
+ update/recalc the stats if they have
+ not been initialized yet, otherwise
+ do nothing */
ibool sync) /*!< in: TRUE if must update SYS_STATS */
{
dict_index_t* index;
@@ -4528,15 +4674,19 @@ dict_update_statistics_low(
}
if (srv_use_sys_stats_table && !((table->flags >> DICT_TF2_SHIFT) & DICT_TF2_TEMPORARY) && !sync) {
+ dict_table_stats_lock(table, RW_X_LATCH);
+
/* reload statistics from SYS_STATS table */
if (dict_reload_statistics(table, &sum_of_index_sizes)) {
/* success */
#ifdef UNIV_DEBUG
- fprintf(stderr, "InnoDB: DEBUG: reload_statistics is scceeded for %s.\n",
+ fprintf(stderr, "InnoDB: DEBUG: reload_statistics succeeded for %s.\n",
table->name);
#endif
goto end;
}
+
+ dict_table_stats_unlock(table, RW_X_LATCH);
}
#ifdef UNIV_DEBUG
fprintf(stderr, "InnoDB: DEBUG: update_statistics for %s.\n",
@@ -4555,17 +4705,26 @@ dict_update_statistics_low(
return;
}
- do {
- if (table->is_corrupt) {
- ut_a(srv_pass_corrupt_table);
- return;
- }
+ dict_table_stats_lock(table, RW_X_LATCH);
+ if (only_calc_if_missing_stats && table->stat_initialized) {
+ dict_table_stats_unlock(table, RW_X_LATCH);
+ return;
+ }
+
+ do {
if (UNIV_LIKELY
(srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE
|| (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
&& dict_index_is_clust(index)))) {
ulint size;
+
+ if (table->is_corrupt) {
+ ut_a(srv_pass_corrupt_table);
+ dict_table_stats_unlock(table, RW_X_LATCH);
+ return;
+ }
+
size = btr_get_size(index, BTR_TOTAL_SIZE);
index->stat_index_size = size;
@@ -4597,6 +4756,10 @@ dict_update_statistics_low(
for (i = dict_index_get_n_unique(index); i; ) {
index->stat_n_diff_key_vals[i--] = 1;
}
+
+ memset(index->stat_n_non_null_key_vals, 0,
+ (1 + dict_index_get_n_unique(index))
+ * sizeof(*index->stat_n_non_null_key_vals));
}
index = dict_table_get_next_index(index);
@@ -4609,13 +4772,9 @@ dict_update_statistics_low(
end:
index = dict_table_get_first_index(table);
- dict_index_stat_mutex_enter(index);
-
table->stat_n_rows = index->stat_n_diff_key_vals[
dict_index_get_n_unique(index)];
- dict_index_stat_mutex_exit(index);
-
table->stat_clustered_index_size = index->stat_index_size;
table->stat_sum_of_other_index_sizes = sum_of_index_sizes
@@ -4624,19 +4783,80 @@ end:
table->stat_initialized = TRUE;
table->stat_modified_counter = 0;
+
+ dict_table_stats_unlock(table, RW_X_LATCH);
}
/*********************************************************************//**
-Calculates new estimates for table and index statistics. The statistics
-are used in query optimization. */
+*/
UNIV_INTERN
-void
-dict_update_statistics(
-/*===================*/
- dict_table_t* table, /*!< in/out: table */
- ibool sync)
+ibool
+dict_is_older_statistics(
+/*=====================*/
+ dict_index_t* index)
{
- dict_update_statistics_low(table, FALSE, sync);
+ mem_heap_t* heap;
+ dict_table_t* sys_stats;
+ dict_index_t* sys_index;
+ btr_pcur_t pcur;
+ dtuple_t* tuple;
+ dfield_t* dfield;
+ const rec_t* rec;
+ ulint n_fields;
+ ulint len;
+ byte* buf;
+ mtr_t mtr;
+
+ heap = mem_heap_create(100);
+
+ sys_stats = dict_sys->sys_stats;
+ sys_index = UT_LIST_GET_FIRST(sys_stats->indexes);
+ ut_a(!dict_table_is_comp(sys_stats));
+
+ tuple = dtuple_create(heap, 1);
+ dfield = dtuple_get_nth_field(tuple, 0);
+
+ buf = mem_heap_alloc(heap, 8);
+ mach_write_to_8(buf, index->id);
+
+ dfield_set_data(dfield, buf, 8);
+ dict_index_copy_types(tuple, sys_index, 1);
+
+ mtr_start(&mtr);
+
+ btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
+ BTR_SEARCH_LEAF, &pcur, &mtr);
+
+next_rec:
+ rec = btr_pcur_get_rec(&pcur);
+
+ if (!btr_pcur_is_on_user_rec(&pcur)
+ || mach_read_from_8(rec_get_nth_field_old(rec, 0, &len))
+ != index->id) {
+ /* not found */
+ btr_pcur_close(&pcur);
+ mtr_commit(&mtr);
+ mem_heap_free(heap);
+ /* no statistics == not older statistics */
+ return(FALSE);
+ }
+
+ if (rec_get_deleted_flag(rec, 0)) {
+ btr_pcur_move_to_next_user_rec(&pcur, &mtr);
+ goto next_rec;
+ }
+
+ n_fields = rec_get_n_fields_old(rec);
+
+ btr_pcur_close(&pcur);
+ mtr_commit(&mtr);
+ mem_heap_free(heap);
+
+ if (n_fields > DICT_SYS_STATS_NON_NULL_VALS_FIELD) {
+ return(FALSE);
+ } else {
+ return(TRUE);
+ }
}
/**********************************************************************//**
@@ -4717,16 +4937,17 @@ dict_table_print_low(
ut_ad(mutex_own(&(dict_sys->mutex)));
if (srv_stats_auto_update)
- dict_update_statistics_low(table, TRUE, FALSE);
+ dict_update_statistics(table, FALSE /* update even if initialized */, FALSE);
+
+ dict_table_stats_lock(table, RW_S_LATCH);
fprintf(stderr,
"--------------------------------------\n"
- "TABLE: name %s, id %lu %lu, flags %lx, columns %lu,"
+ "TABLE: name %s, id %llu, flags %lx, columns %lu,"
" indexes %lu, appr.rows %lu\n"
" COLUMNS: ",
table->name,
- (ulong) ut_dulint_get_high(table->id),
- (ulong) ut_dulint_get_low(table->id),
+ (ullint) table->id,
(ulong) table->flags,
(ulong) table->n_cols,
(ulong) UT_LIST_GET_LEN(table->indexes),
@@ -4746,6 +4967,8 @@ dict_table_print_low(
index = UT_LIST_GET_NEXT(indexes, index);
}
+ dict_table_stats_unlock(table, RW_S_LATCH);
+
foreign = UT_LIST_GET_FIRST(table->foreign_list);
while (foreign != NULL) {
@@ -4791,12 +5014,9 @@ dict_index_print_low(
{
ib_int64_t n_vals;
ulint i;
- const char* type_string;
ut_ad(mutex_own(&(dict_sys->mutex)));
- dict_index_stat_mutex_enter(index);
-
if (index->n_user_defined_cols > 0) {
n_vals = index->stat_n_diff_key_vals[
index->n_user_defined_cols];
@@ -4804,25 +5024,14 @@ dict_index_print_low(
n_vals = index->stat_n_diff_key_vals[1];
}
- dict_index_stat_mutex_exit(index);
-
- if (dict_index_is_clust(index)) {
- type_string = "clustered index";
- } else if (dict_index_is_unique(index)) {
- type_string = "unique index";
- } else {
- type_string = "secondary index";
- }
-
fprintf(stderr,
- " INDEX: name %s, id %lu %lu, fields %lu/%lu,"
+ " INDEX: name %s, id %llu, fields %lu/%lu,"
" uniq %lu, type %lu\n"
" root page %lu, appr.key vals %lu,"
" leaf pages %lu, size pages %lu\n"
" FIELDS: ",
index->name,
- (ulong) ut_dulint_get_high(index->id),
- (ulong) ut_dulint_get_low(index->id),
+ (ullint) index->id,
(ulong) index->n_user_defined_cols,
(ulong) index->n_fields,
(ulong) index->n_uniq,
@@ -4909,8 +5118,8 @@ dict_print_info_on_foreign_key_in_create_format(
fputs(") REFERENCES ", file);
- if (dict_tables_have_same_db(foreign->foreign_table_name,
- foreign->referenced_table_name)) {
+ if (dict_tables_have_same_db(foreign->foreign_table_name_lookup,
+ foreign->referenced_table_name_lookup)) {
/* Do not print the database name of the referenced table */
ut_print_name(file, trx, TRUE,
dict_remove_db_name(
@@ -5157,7 +5366,8 @@ void
dict_table_replace_index_in_foreign_list(
/*=====================================*/
dict_table_t* table, /*!< in/out: table */
- dict_index_t* index) /*!< in: index to be replaced */
+ dict_index_t* index, /*!< in: index to be replaced */
+ const trx_t* trx) /*!< in: transaction handle */
{
dict_foreign_t* foreign;
@@ -5168,7 +5378,13 @@ dict_table_replace_index_in_foreign_list(
if (foreign->foreign_index == index) {
dict_index_t* new_index
= dict_foreign_find_equiv_index(foreign);
- ut_a(new_index);
+
+ /* There must exist an alternative index if
+ check_foreigns (FOREIGN_KEY_CHECKS) is on,
+ since ha_innobase::prepare_drop_index had done
+ the check before we reach here. */
+
+ ut_a(new_index || !trx->check_foreigns);
foreign->foreign_index = new_index;
}
@@ -5194,8 +5410,7 @@ dict_table_get_index_on_name_and_min_id(
while (index != NULL) {
if (ut_strcmp(index->name, name) == 0) {
- if (!min_index
- || ut_dulint_cmp(index->id, min_index->id) < 0) {
+ if (!min_index || index->id < min_index->id) {
min_index = index;
}
@@ -5302,8 +5517,8 @@ dict_close(void)
mem_free(dict_sys);
dict_sys = NULL;
- for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) {
- mutex_free(&dict_index_stat_mutex[i]);
+ for (i = 0; i < DICT_TABLE_STATS_LATCHES_SIZE; i++) {
+ rw_lock_free(&dict_table_stats_latches[i]);
}
}
diff --git a/storage/xtradb/dict/dict0load.c b/storage/xtradb/dict/dict0load.c
index 43c0810fe67..c5bd84f84ad 100644
--- a/storage/xtradb/dict/dict0load.c
+++ b/storage/xtradb/dict/dict0load.c
@@ -40,8 +40,20 @@ Created 4/24/1996 Heikki Tuuri
#include "rem0cmp.h"
#include "srv0start.h"
#include "srv0srv.h"
+#include "ha_prototypes.h" /* innobase_casedn_str() */
#include "trx0sys.h"
+
+/** Following are six InnoDB system tables */
+static const char* SYSTEM_TABLE_NAME[] = {
+ "SYS_TABLES",
+ "SYS_INDEXES",
+ "SYS_COLUMNS",
+ "SYS_FIELDS",
+ "SYS_FOREIGN",
+ "SYS_FOREIGN_COLS",
+ "SYS_STATS"
+};
/****************************************************************//**
Compare the name of an index column.
@return TRUE if the i'th column of index is 'name'. */
@@ -152,13 +164,10 @@ void
dict_print(void)
/*============*/
{
- dict_table_t* sys_tables;
- dict_index_t* sys_index;
dict_table_t* table;
btr_pcur_t pcur;
const rec_t* rec;
- const byte* field;
- ulint len;
+ mem_heap_t* heap;
mtr_t mtr;
/* Enlarge the fatal semaphore wait timeout during the InnoDB table
@@ -168,75 +177,482 @@ dict_print(void)
srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
mutex_exit(&kernel_mutex);
+ heap = mem_heap_create(1000);
mutex_enter(&(dict_sys->mutex));
-
mtr_start(&mtr);
- sys_tables = dict_table_get_low("SYS_TABLES");
- sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
-
- btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
- TRUE, &mtr);
-loop:
- btr_pcur_move_to_next_user_rec(&pcur, &mtr);
+ rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES);
- rec = btr_pcur_get_rec(&pcur);
+ while (rec) {
+ const char* err_msg;
- if (!btr_pcur_is_on_user_rec(&pcur)) {
- /* end of index */
+ err_msg = dict_process_sys_tables_rec(
+ heap, rec, &table, DICT_TABLE_LOAD_FROM_CACHE
+ | DICT_TABLE_UPDATE_STATS);
- btr_pcur_close(&pcur);
mtr_commit(&mtr);
- mutex_exit(&(dict_sys->mutex));
+ if (!err_msg) {
+ dict_table_print_low(table);
+ } else {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: %s\n", err_msg);
+ }
- /* Restore the fatal semaphore wait timeout */
+ mem_heap_empty(heap);
- mutex_enter(&kernel_mutex);
- srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
- mutex_exit(&kernel_mutex);
+ mtr_start(&mtr);
+ rec = dict_getnext_system(&pcur, &mtr);
+ }
- return;
+ mtr_commit(&mtr);
+ mutex_exit(&(dict_sys->mutex));
+ mem_heap_free(heap);
+
+ /* Restore the fatal semaphore wait timeout */
+ mutex_enter(&kernel_mutex);
+ srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
+ mutex_exit(&kernel_mutex);
+}
+
+
+/********************************************************************//**
+This function gets the next system table record as it scans the table.
+@return the next record if found, NULL if end of scan */
+static
+const rec_t*
+dict_getnext_system_low(
+/*====================*/
+ btr_pcur_t* pcur, /*!< in/out: persistent cursor to the
+ record*/
+ mtr_t* mtr) /*!< in: the mini-transaction */
+{
+ rec_t* rec = NULL;
+
+ while (!rec || rec_get_deleted_flag(rec, 0)) {
+ btr_pcur_move_to_next_user_rec(pcur, mtr);
+
+ rec = btr_pcur_get_rec(pcur);
+
+ if (!btr_pcur_is_on_user_rec(pcur)) {
+ /* end of index */
+ btr_pcur_close(pcur);
+
+ return(NULL);
+ }
}
- field = rec_get_nth_field_old(rec, 0, &len);
+ /* Get a record, let's save the position */
+ btr_pcur_store_position(pcur, mtr);
- if (!rec_get_deleted_flag(rec, 0)) {
+ return(rec);
+}
- /* We found one */
+/********************************************************************//**
+This function opens a system table, and return the first record.
+@return first record of the system table */
+UNIV_INTERN
+const rec_t*
+dict_startscan_system(
+/*==================*/
+ btr_pcur_t* pcur, /*!< out: persistent cursor to
+ the record */
+ mtr_t* mtr, /*!< in: the mini-transaction */
+ dict_system_id_t system_id) /*!< in: which system table to open */
+{
+ dict_table_t* system_table;
+ dict_index_t* clust_index;
+ const rec_t* rec;
- char* table_name = mem_strdupl((char*) field, len);
+ ut_a(system_id < SYS_NUM_SYSTEM_TABLES);
- btr_pcur_store_position(&pcur, &mtr);
+ system_table = dict_table_get_low(SYSTEM_TABLE_NAME[system_id]);
- mtr_commit(&mtr);
+ clust_index = UT_LIST_GET_FIRST(system_table->indexes);
- table = dict_table_get_low(table_name);
- mem_free(table_name);
+ btr_pcur_open_at_index_side(TRUE, clust_index, BTR_SEARCH_LEAF, pcur,
+ TRUE, mtr);
- if (table == NULL) {
- fputs("InnoDB: Failed to load table ", stderr);
- ut_print_namel(stderr, NULL, TRUE, (char*) field, len);
- putc('\n', stderr);
- } else {
- /* The table definition was corrupt if there
- is no index */
+ rec = dict_getnext_system_low(pcur, mtr);
- if (srv_stats_auto_update && dict_table_get_first_index(table)) {
- dict_update_statistics_low(table, TRUE, FALSE);
- }
+ return(rec);
+}
- dict_table_print_low(table);
+/********************************************************************//**
+This function gets the next system table record as it scans the table.
+@return the next record if found, NULL if end of scan */
+UNIV_INTERN
+const rec_t*
+dict_getnext_system(
+/*================*/
+ btr_pcur_t* pcur, /*!< in/out: persistent cursor
+ to the record */
+ mtr_t* mtr) /*!< in: the mini-transaction */
+{
+ const rec_t* rec;
+
+ /* Restore the position */
+ btr_pcur_restore_position(BTR_SEARCH_LEAF, pcur, mtr);
+
+ /* Get the next record */
+ rec = dict_getnext_system_low(pcur, mtr);
+
+ return(rec);
+}
+/********************************************************************//**
+This function processes one SYS_TABLES record and populate the dict_table_t
+struct for the table. Extracted out of dict_print() to be used by
+both monitor table output and information schema innodb_sys_tables output.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_tables_rec(
+/*========================*/
+ mem_heap_t* heap, /*!< in/out: temporary memory heap */
+ const rec_t* rec, /*!< in: SYS_TABLES record */
+ dict_table_t** table, /*!< out: dict_table_t to fill */
+ dict_table_info_t status) /*!< in: status bit controls
+ options such as whether we shall
+ look for dict_table_t from cache
+ first */
+{
+ ulint len;
+ const char* field;
+ const char* err_msg = NULL;
+ char* table_name;
+
+ field = (const char*) rec_get_nth_field_old(rec, 0, &len);
+
+ ut_a(!rec_get_deleted_flag(rec, 0));
+
+ /* Get the table name */
+ table_name = mem_heap_strdupl(heap, field, len);
+
+ /* If DICT_TABLE_LOAD_FROM_CACHE is set, first check
+ whether there is cached dict_table_t struct first */
+ if (status & DICT_TABLE_LOAD_FROM_CACHE) {
+ *table = dict_table_get_low(table_name);
+
+ if (!(*table)) {
+ err_msg = "Table not found in cache";
}
+ } else {
+ err_msg = dict_load_table_low(table_name, rec, table);
+ }
- mtr_start(&mtr);
+ if (err_msg) {
+ return(err_msg);
+ }
- btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr);
+ if ((status & DICT_TABLE_UPDATE_STATS)
+ && srv_stats_auto_update
+ && dict_table_get_first_index(*table)) {
+
+ /* Update statistics if DICT_TABLE_UPDATE_STATS
+ is set */
+ dict_update_statistics(*table, FALSE /* update even if
+ initialized */, FALSE);
}
- goto loop;
+ return(NULL);
+}
+
+/********************************************************************//**
+This function parses a SYS_INDEXES record and populate a dict_index_t
+structure with the information from the record. For detail information
+about SYS_INDEXES fields, please refer to dict_boot() function.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_indexes_rec(
+/*=========================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_INDEXES rec */
+ dict_index_t* index, /*!< out: index to be filled */
+ table_id_t* table_id) /*!< out: index table id */
+{
+ const char* err_msg;
+ byte* buf;
+
+ buf = mem_heap_alloc(heap, 8);
+
+ /* Parse the record, and get "dict_index_t" struct filled */
+ err_msg = dict_load_index_low(buf, NULL,
+ heap, rec, FALSE, &index);
+
+ *table_id = mach_read_from_8(buf);
+
+ return(err_msg);
+}
+/********************************************************************//**
+This function parses a SYS_COLUMNS record and populate a dict_column_t
+structure with the information from the record.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_columns_rec(
+/*=========================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_COLUMNS rec */
+ dict_col_t* column, /*!< out: dict_col_t to be filled */
+ table_id_t* table_id, /*!< out: table id */
+ const char** col_name) /*!< out: column name */
+{
+ const char* err_msg;
+
+ /* Parse the record, and get "dict_col_t" struct filled */
+ err_msg = dict_load_column_low(NULL, heap, column,
+ table_id, col_name, rec);
+
+ return(err_msg);
+}
+/********************************************************************//**
+This function parses a SYS_FIELDS record and populates a dict_field_t
+structure with the information from the record.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_fields_rec(
+/*========================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_FIELDS rec */
+ dict_field_t* sys_field, /*!< out: dict_field_t to be
+ filled */
+ ulint* pos, /*!< out: Field position */
+ index_id_t* index_id, /*!< out: current index id */
+ index_id_t last_id) /*!< in: previous index id */
+{
+ byte* buf;
+ byte* last_index_id;
+ const char* err_msg;
+
+ buf = mem_heap_alloc(heap, 8);
+
+ last_index_id = mem_heap_alloc(heap, 8);
+ mach_write_to_8(last_index_id, last_id);
+
+ err_msg = dict_load_field_low(buf, NULL, sys_field,
+ pos, last_index_id, heap, rec, NULL, 0);
+
+ *index_id = mach_read_from_8(buf);
+
+ return(err_msg);
+
+}
+
+//#ifdef FOREIGN_NOT_USED
+/********************************************************************//**
+This function parses a SYS_FOREIGN record and populate a dict_foreign_t
+structure with the information from the record. For detail information
+about SYS_FOREIGN fields, please refer to dict_load_foreign() function.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_foreign_rec(
+/*=========================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_FOREIGN rec */
+ dict_foreign_t* foreign) /*!< out: dict_foreign_t struct
+ to be filled */
+{
+ ulint len;
+ const byte* field;
+ ulint n_fields_and_type;
+
+ if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
+ return("delete-marked record in SYS_FOREIGN");
+ }
+
+ if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 6)) {
+ return("wrong number of columns in SYS_FOREIGN record");
+ }
+
+ field = rec_get_nth_field_old(rec, 0/*ID*/, &len);
+ if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
+err_len:
+ return("incorrect column length in SYS_FOREIGN");
+ }
+
+ /* This recieves a dict_foreign_t* that points to a stack variable.
+ So mem_heap_free(foreign->heap) is not used as elsewhere.
+ Since the heap used here is freed elsewhere, foreign->heap
+ is not assigned. */
+ foreign->id = mem_heap_strdupl(heap, (const char*) field, len);
+
+ rec_get_nth_field_offs_old(rec, 1/*DB_TRX_ID*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ rec_get_nth_field_offs_old(rec, 2/*DB_ROLL_PTR*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+
+ /* The _lookup versions of the referenced and foreign table names
+ are not assigned since they are not used in this dict_foreign_t */
+
+ field = rec_get_nth_field_old(rec, 3/*FOR_NAME*/, &len);
+ if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ foreign->foreign_table_name = mem_heap_strdupl(
+ heap, (const char*) field, len);
+
+ field = rec_get_nth_field_old(rec, 4/*REF_NAME*/, &len);
+ if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ foreign->referenced_table_name = mem_heap_strdupl(
+ heap, (const char*) field, len);
+
+ field = rec_get_nth_field_old(rec, 5/*N_COLS*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+ n_fields_and_type = mach_read_from_4(field);
+
+ foreign->type = (unsigned int) (n_fields_and_type >> 24);
+ foreign->n_fields = (unsigned int) (n_fields_and_type & 0x3FFUL);
+
+ return(NULL);
}
+//#endif /* FOREIGN_NOT_USED */
+//#ifdef FOREIGN_NOT_USED
+/********************************************************************//**
+This function parses a SYS_FOREIGN_COLS record and extract necessary
+information from the record and return to caller.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_foreign_col_rec(
+/*=============================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_FOREIGN_COLS rec */
+ const char** name, /*!< out: foreign key constraint name */
+ const char** for_col_name, /*!< out: referencing column name */
+ const char** ref_col_name, /*!< out: referenced column name
+ in referenced table */
+ ulint* pos) /*!< out: column position */
+{
+ ulint len;
+ const byte* field;
+
+ if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
+ return("delete-marked record in SYS_FOREIGN_COLS");
+ }
+
+ if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 6)) {
+ return("wrong number of columns in SYS_FOREIGN_COLS record");
+ }
+
+ field = rec_get_nth_field_old(rec, 0/*ID*/, &len);
+ if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
+err_len:
+ return("incorrect column length in SYS_FOREIGN_COLS");
+ }
+ *name = mem_heap_strdupl(heap, (char*) field, len);
+
+ field = rec_get_nth_field_old(rec, 1/*POS*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+ *pos = mach_read_from_4(field);
+
+ rec_get_nth_field_offs_old(rec, 2/*DB_TRX_ID*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ rec_get_nth_field_offs_old(rec, 3/*DB_ROLL_PTR*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+
+ field = rec_get_nth_field_old(rec, 4/*FOR_COL_NAME*/, &len);
+ if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ *for_col_name = mem_heap_strdupl(heap, (char*) field, len);
+
+ field = rec_get_nth_field_old(rec, 5/*REF_COL_NAME*/, &len);
+ if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ *ref_col_name = mem_heap_strdupl(heap, (char*) field, len);
+
+ return(NULL);
+}
+//#endif /* FOREIGN_NOT_USED */
+
+/********************************************************************//**
+This function parses a SYS_STATS record and extract necessary
+information from the record and return to caller.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_stats_rec(
+/*=============================*/
+ mem_heap_t* heap __attribute__((unused)), /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_STATS rec */
+ index_id_t* index_id, /*!< out: INDEX_ID */
+ ulint* key_cols, /*!< out: KEY_COLS */
+ ib_uint64_t* diff_vals, /*!< out: DIFF_VALS */
+ ib_uint64_t* non_null_vals) /*!< out: NON_NULL_VALS */
+{
+ ulint len;
+ const byte* field;
+ ulint n_fields;
+
+ if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
+ return("delete-marked record in SYS_STATS");
+ }
+
+ n_fields = rec_get_n_fields_old(rec);
+
+ if (UNIV_UNLIKELY(n_fields < 5)) {
+ return("wrong number of columns in SYS_STATS record");
+ }
+
+ field = rec_get_nth_field_old(rec, 0/*INDEX_ID*/, &len);
+ if (UNIV_UNLIKELY(len != 8)) {
+err_len:
+ return("incorrect column length in SYS_STATS");
+ }
+ *index_id = mach_read_from_8(field);
+
+ field = rec_get_nth_field_old(rec, 1/*KEY_COLS*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+ *key_cols = mach_read_from_4(field);
+
+ rec_get_nth_field_offs_old(rec, 2/*DB_TRX_ID*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ rec_get_nth_field_offs_old(rec, 3/*DB_ROLL_PTR*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+
+ field = rec_get_nth_field_old(rec, 4/*DIFF_VALS*/, &len);
+ if (UNIV_UNLIKELY(len != 8)) {
+ goto err_len;
+ }
+ *diff_vals = mach_read_from_8(field);
+
+ if (n_fields < 6) {
+ *non_null_vals = ((ib_uint64_t)(-1));
+ } else {
+ field = rec_get_nth_field_old(rec, 5/*NON_NULL_VALS*/, &len);
+ if (UNIV_UNLIKELY(len != 8)) {
+ goto err_len;
+ }
+ *non_null_vals = mach_read_from_8(field);
+ }
+
+ return(NULL);
+}
/********************************************************************//**
Determine the flags of a table described in SYS_TABLES.
@return compressed page size in kilobytes; or 0 if the tablespace is
@@ -447,13 +863,151 @@ loop:
}
/********************************************************************//**
+Loads a table column definition from a SYS_COLUMNS record to
+dict_table_t.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_load_column_low(
+/*=================*/
+ dict_table_t* table, /*!< in/out: table, could be NULL
+ if we just populate a dict_column_t
+ struct with information from
+ a SYS_COLUMNS record */
+ mem_heap_t* heap, /*!< in/out: memory heap
+ for temporary storage */
+ dict_col_t* column, /*!< out: dict_column_t to fill,
+ or NULL if table != NULL */
+ table_id_t* table_id, /*!< out: table id */
+ const char** col_name, /*!< out: column name */
+ const rec_t* rec) /*!< in: SYS_COLUMNS record */
+{
+ char* name;
+ const byte* field;
+ ulint len;
+ ulint mtype;
+ ulint prtype;
+ ulint col_len;
+ ulint pos;
+
+ ut_ad(table || column);
+
+ if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
+ return("delete-marked record in SYS_COLUMNS");
+ }
+
+ if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 9)) {
+ return("wrong number of columns in SYS_COLUMNS record");
+ }
+
+ field = rec_get_nth_field_old(rec, 0/*TABLE_ID*/, &len);
+ if (UNIV_UNLIKELY(len != 8)) {
+err_len:
+ return("incorrect column length in SYS_COLUMNS");
+ }
+
+ if (table_id) {
+ *table_id = mach_read_from_8(field);
+ } else if (UNIV_UNLIKELY(table->id != mach_read_from_8(field))) {
+ return("SYS_COLUMNS.TABLE_ID mismatch");
+ }
+
+ field = rec_get_nth_field_old(rec, 1/*POS*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+
+ goto err_len;
+ }
+
+ pos = mach_read_from_4(field);
+
+ if (UNIV_UNLIKELY(table && table->n_def != pos)) {
+ return("SYS_COLUMNS.POS mismatch");
+ }
+
+ rec_get_nth_field_offs_old(rec, 2/*DB_TRX_ID*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ rec_get_nth_field_offs_old(rec, 3/*DB_ROLL_PTR*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+
+ field = rec_get_nth_field_old(rec, 4/*NAME*/, &len);
+ if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+
+ name = mem_heap_strdupl(heap, (const char*) field, len);
+
+ if (col_name) {
+ *col_name = name;
+ }
+
+ field = rec_get_nth_field_old(rec, 5/*MTYPE*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+
+ mtype = mach_read_from_4(field);
+
+ field = rec_get_nth_field_old(rec, 6/*PRTYPE*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+ prtype = mach_read_from_4(field);
+
+ if (dtype_get_charset_coll(prtype) == 0
+ && dtype_is_string_type(mtype)) {
+ /* The table was created with < 4.1.2. */
+
+ if (dtype_is_binary_string_type(mtype, prtype)) {
+ /* Use the binary collation for
+ string columns of binary type. */
+
+ prtype = dtype_form_prtype(
+ prtype,
+ DATA_MYSQL_BINARY_CHARSET_COLL);
+ } else {
+ /* Use the default charset for
+ other than binary columns. */
+
+ prtype = dtype_form_prtype(
+ prtype,
+ data_mysql_default_charset_coll);
+ }
+ }
+
+ field = rec_get_nth_field_old(rec, 7/*LEN*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+ col_len = mach_read_from_4(field);
+ field = rec_get_nth_field_old(rec, 8/*PREC*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+
+ if (!column) {
+ dict_mem_table_add_col(table, heap, name, mtype,
+ prtype, col_len);
+ } else {
+ dict_mem_fill_column_struct(column, pos, mtype,
+ prtype, col_len);
+ }
+
+ return(NULL);
+}
+
+/********************************************************************//**
Loads definitions for table columns. */
static
void
dict_load_columns(
/*==============*/
- dict_table_t* table, /*!< in: table */
- mem_heap_t* heap) /*!< in: memory heap for temporary storage */
+ dict_table_t* table, /*!< in/out: table */
+ mem_heap_t* heap) /*!< in/out: memory heap
+ for temporary storage */
{
dict_table_t* sys_columns;
dict_index_t* sys_index;
@@ -461,13 +1015,7 @@ dict_load_columns(
dtuple_t* tuple;
dfield_t* dfield;
const rec_t* rec;
- const byte* field;
- ulint len;
byte* buf;
- char* name;
- ulint mtype;
- ulint prtype;
- ulint col_len;
ulint i;
mtr_t mtr;
@@ -479,6 +1027,9 @@ dict_load_columns(
sys_index = UT_LIST_GET_FIRST(sys_columns->indexes);
ut_a(!dict_table_is_comp(sys_columns));
+ ut_a(name_of_col_is(sys_columns, sys_index, 4, "NAME"));
+ ut_a(name_of_col_is(sys_columns, sys_index, 8, "PREC"));
+
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
@@ -491,74 +1042,177 @@ dict_load_columns(
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i + DATA_N_SYS_COLS < (ulint) table->n_cols; i++) {
+ const char* err_msg;
rec = btr_pcur_get_rec(&pcur);
ut_a(btr_pcur_is_on_user_rec(&pcur));
- ut_a(!rec_get_deleted_flag(rec, 0));
+ err_msg = dict_load_column_low(table, heap, NULL, NULL,
+ NULL, rec);
- field = rec_get_nth_field_old(rec, 0, &len);
- ut_ad(len == 8);
- ut_a(ut_dulint_cmp(table->id, mach_read_from_8(field)) == 0);
+ if (err_msg) {
+ fprintf(stderr, "InnoDB: %s\n", err_msg);
+ ut_error;
+ }
- field = rec_get_nth_field_old(rec, 1, &len);
- ut_ad(len == 4);
- ut_a(i == mach_read_from_4(field));
+ btr_pcur_move_to_next_user_rec(&pcur, &mtr);
+ }
- ut_a(name_of_col_is(sys_columns, sys_index, 4, "NAME"));
+ btr_pcur_close(&pcur);
+ mtr_commit(&mtr);
+}
- field = rec_get_nth_field_old(rec, 4, &len);
- name = mem_heap_strdupl(heap, (char*) field, len);
+/** Error message for a delete-marked record in dict_load_field_low() */
+static const char* dict_load_field_del = "delete-marked record in SYS_FIELDS";
- field = rec_get_nth_field_old(rec, 5, &len);
- mtype = mach_read_from_4(field);
+static const char* dict_load_field_too_big = "column prefix exceeds maximum"
+ " limit";
- field = rec_get_nth_field_old(rec, 6, &len);
- prtype = mach_read_from_4(field);
+/********************************************************************//**
+Loads an index field definition from a SYS_FIELDS record to
+dict_index_t.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_load_field_low(
+/*================*/
+ byte* index_id, /*!< in/out: index id (8 bytes)
+ an "in" value if index != NULL
+ and "out" if index == NULL */
+ dict_index_t* index, /*!< in/out: index, could be NULL
+ if we just populate a dict_field_t
+ struct with information from
+ a SYS_FIELDSS record */
+ dict_field_t* sys_field, /*!< out: dict_field_t to be
+ filled */
+ ulint* pos, /*!< out: Field position */
+ byte* last_index_id, /*!< in: last index id */
+ mem_heap_t* heap, /*!< in/out: memory heap
+ for temporary storage */
+ const rec_t* rec, /*!< in: SYS_FIELDS record */
+ char* addition_err_str,/*!< out: additional error message
+ that requires information to be
+ filled, or NULL */
+ ulint err_str_len) /*!< in: length of addition_err_str
+ in bytes */
+{
+ const byte* field;
+ ulint len;
+ ulint pos_and_prefix_len;
+ ulint prefix_len;
+ ibool first_field;
+ ulint position;
- if (dtype_get_charset_coll(prtype) == 0
- && dtype_is_string_type(mtype)) {
- /* The table was created with < 4.1.2. */
+ /* Either index or sys_field is supplied, not both */
+ ut_a((!index) || (!sys_field));
- if (dtype_is_binary_string_type(mtype, prtype)) {
- /* Use the binary collation for
- string columns of binary type. */
+ if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
+ return(dict_load_field_del);
+ }
- prtype = dtype_form_prtype(
- prtype,
- DATA_MYSQL_BINARY_CHARSET_COLL);
- } else {
- /* Use the default charset for
- other than binary columns. */
+ if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 5)) {
+ return("wrong number of columns in SYS_FIELDS record");
+ }
- prtype = dtype_form_prtype(
- prtype,
- data_mysql_default_charset_coll);
- }
+ field = rec_get_nth_field_old(rec, 0/*INDEX_ID*/, &len);
+ if (UNIV_UNLIKELY(len != 8)) {
+err_len:
+ return("incorrect column length in SYS_FIELDS");
+ }
+
+ if (!index) {
+ ut_a(last_index_id);
+ memcpy(index_id, (const char*)field, 8);
+ first_field = memcmp(index_id, last_index_id, 8);
+ } else {
+ first_field = (index->n_def == 0);
+ if (memcmp(field, index_id, 8)) {
+ return("SYS_FIELDS.INDEX_ID mismatch");
}
+ }
- field = rec_get_nth_field_old(rec, 7, &len);
- col_len = mach_read_from_4(field);
+ field = rec_get_nth_field_old(rec, 1/*POS*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+
+ rec_get_nth_field_offs_old(rec, 2/*DB_TRX_ID*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ rec_get_nth_field_offs_old(rec, 3/*DB_ROLL_PTR*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
- ut_a(name_of_col_is(sys_columns, sys_index, 8, "PREC"));
+ /* The next field stores the field position in the index and a
+ possible column prefix length if the index field does not
+ contain the whole column. The storage format is like this: if
+ there is at least one prefix field in the index, then the HIGH
+ 2 bytes contain the field number (index->n_def) and the low 2
+ bytes the prefix length for the field. Otherwise the field
+ number (index->n_def) is contained in the 2 LOW bytes. */
- dict_mem_table_add_col(table, heap, name,
- mtype, prtype, col_len);
- btr_pcur_move_to_next_user_rec(&pcur, &mtr);
+ pos_and_prefix_len = mach_read_from_4(field);
+
+ if (index && UNIV_UNLIKELY
+ ((pos_and_prefix_len & 0xFFFFUL) != index->n_def
+ && (pos_and_prefix_len >> 16 & 0xFFFF) != index->n_def)) {
+ return("SYS_FIELDS.POS mismatch");
}
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
+ if (first_field || pos_and_prefix_len > 0xFFFFUL) {
+ prefix_len = pos_and_prefix_len & 0xFFFFUL;
+ position = (pos_and_prefix_len & 0xFFFF0000UL) >> 16;
+ } else {
+ prefix_len = 0;
+ position = pos_and_prefix_len & 0xFFFFUL;
+ }
+
+ field = rec_get_nth_field_old(rec, 4, &len);
+ if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+
+ if (prefix_len > REC_VERSION_56_MAX_INDEX_COL_LEN) {
+ if (addition_err_str) {
+ ut_snprintf(addition_err_str, err_str_len,
+ "index field '%s' has a prefix length"
+ " of %lu bytes",
+ mem_heap_strdupl(
+ heap, (const char*) field, len),
+ (ulong) prefix_len);
+ }
+
+ return(dict_load_field_too_big);
+ }
+
+ if (index) {
+ dict_mem_index_add_field(
+ index, mem_heap_strdupl(heap, (const char*) field, len),
+ prefix_len);
+ } else {
+ ut_a(sys_field);
+ ut_a(pos);
+
+ sys_field->name = mem_heap_strdupl(
+ heap, (const char*) field, len);
+ sys_field->prefix_len = prefix_len;
+ *pos = position;
+ }
+
+ return(NULL);
}
/********************************************************************//**
-Loads definitions for index fields. */
+Loads definitions for index fields.
+@return DB_SUCCESS if ok, DB_CORRUPTION if corruption */
static
-void
+ulint
dict_load_fields(
/*=============*/
- dict_index_t* index, /*!< in: index whose fields to load */
+ dict_index_t* index, /*!< in/out: index whose fields to load */
mem_heap_t* heap) /*!< in: memory heap for temporary storage */
{
dict_table_t* sys_fields;
@@ -566,14 +1220,11 @@ dict_load_fields(
btr_pcur_t pcur;
dtuple_t* tuple;
dfield_t* dfield;
- ulint pos_and_prefix_len;
- ulint prefix_len;
const rec_t* rec;
- const byte* field;
- ulint len;
byte* buf;
ulint i;
mtr_t mtr;
+ ulint error;
ut_ad(mutex_own(&(dict_sys->mutex)));
@@ -582,6 +1233,7 @@ dict_load_fields(
sys_fields = dict_table_get_low("SYS_FIELDS");
sys_index = UT_LIST_GET_FIRST(sys_fields->indexes);
ut_a(!dict_table_is_comp(sys_fields));
+ ut_a(name_of_col_is(sys_fields, sys_index, 4, "COL_NAME"));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
@@ -595,62 +1247,182 @@ dict_load_fields(
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < index->n_fields; i++) {
+ const char* err_msg;
+ char addition_err_str[1024];
rec = btr_pcur_get_rec(&pcur);
ut_a(btr_pcur_is_on_user_rec(&pcur));
- /* There could be delete marked records in SYS_FIELDS
- because SYS_FIELDS.INDEX_ID can be updated
- by ALTER TABLE ADD INDEX. */
+ err_msg = dict_load_field_low(buf, index, NULL, NULL, NULL,
+ heap, rec, addition_err_str,
+ sizeof(addition_err_str));
- if (rec_get_deleted_flag(rec, 0)) {
+ if (err_msg == dict_load_field_del) {
+ /* There could be delete marked records in
+ SYS_FIELDS because SYS_FIELDS.INDEX_ID can be
+ updated by ALTER TABLE ADD INDEX. */
goto next_rec;
+ } else if (err_msg) {
+ if (err_msg == dict_load_field_too_big) {
+ fprintf(stderr, "InnoDB: Error: load index"
+ " '%s' failed.\n"
+ "InnoDB: %s,\n"
+ "InnoDB: which exceeds the"
+ " maximum limit of %lu bytes.\n"
+ "InnoDB: Please use server that"
+ " supports long index prefix\n"
+ "InnoDB: or turn on"
+ " innodb_force_recovery to load"
+ " the table\n",
+ index->name, addition_err_str,
+ (ulong) (REC_VERSION_56_MAX_INDEX_COL_LEN));
+
+ } else {
+ fprintf(stderr, "InnoDB: %s\n", err_msg);
+ }
+
+ error = DB_CORRUPTION;
+ goto func_exit;
}
+next_rec:
+ btr_pcur_move_to_next_user_rec(&pcur, &mtr);
+ }
- field = rec_get_nth_field_old(rec, 0, &len);
- ut_ad(len == 8);
+ error = DB_SUCCESS;
+func_exit:
+ btr_pcur_close(&pcur);
+ mtr_commit(&mtr);
+ return(error);
+}
- field = rec_get_nth_field_old(rec, 1, &len);
- ut_a(len == 4);
+/** Error message for a delete-marked record in dict_load_index_low() */
+static const char* dict_load_index_del = "delete-marked record in SYS_INDEXES";
+/** Error message for table->id mismatch in dict_load_index_low() */
+static const char* dict_load_index_id_err = "SYS_INDEXES.TABLE_ID mismatch";
- /* The next field stores the field position in the index
- and a possible column prefix length if the index field
- does not contain the whole column. The storage format is
- like this: if there is at least one prefix field in the index,
- then the HIGH 2 bytes contain the field number (== i) and the
- low 2 bytes the prefix length for the field. Otherwise the
- field number (== i) is contained in the 2 LOW bytes. */
+/********************************************************************//**
+Loads an index definition from a SYS_INDEXES record to dict_index_t.
+If allocate=TRUE, we will create a dict_index_t structure and fill it
+accordingly. If allocated=FALSE, the dict_index_t will be supplied by
+the caller and filled with information read from the record. @return
+error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_load_index_low(
+/*================*/
+ byte* table_id, /*!< in/out: table id (8 bytes),
+ an "in" value if allocate=TRUE
+ and "out" when allocate=FALSE */
+ const char* table_name, /*!< in: table name */
+ mem_heap_t* heap, /*!< in/out: temporary memory heap */
+ const rec_t* rec, /*!< in: SYS_INDEXES record */
+ ibool allocate, /*!< in: TRUE=allocate *index,
+ FALSE=fill in a pre-allocated
+ *index */
+ dict_index_t** index) /*!< out,own: index, or NULL */
+{
+ const byte* field;
+ ulint len;
+ ulint name_len;
+ char* name_buf;
+ index_id_t id;
+ ulint n_fields;
+ ulint type;
+ ulint space;
- pos_and_prefix_len = mach_read_from_4(field);
+ if (allocate) {
+ /* If allocate=TRUE, no dict_index_t will
+ be supplied. Initialize "*index" to NULL */
+ *index = NULL;
+ }
- ut_a((pos_and_prefix_len & 0xFFFFUL) == i
- || (pos_and_prefix_len & 0xFFFF0000UL) == (i << 16));
+ if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
+ return(dict_load_index_del);
+ }
- if ((i == 0 && pos_and_prefix_len > 0)
- || (pos_and_prefix_len & 0xFFFF0000UL) > 0) {
+ if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 9)) {
+ return("wrong number of columns in SYS_INDEXES record");
+ }
- prefix_len = pos_and_prefix_len & 0xFFFFUL;
- } else {
- prefix_len = 0;
- }
+ field = rec_get_nth_field_old(rec, 0/*TABLE_ID*/, &len);
+ if (UNIV_UNLIKELY(len != 8)) {
+err_len:
+ return("incorrect column length in SYS_INDEXES");
+ }
- ut_a(name_of_col_is(sys_fields, sys_index, 4, "COL_NAME"));
+ if (!allocate) {
+ /* We are reading a SYS_INDEXES record. Copy the table_id */
+ memcpy(table_id, (const char*)field, 8);
+ } else if (memcmp(field, table_id, 8)) {
+ /* Caller supplied table_id, verify it is the same
+ id as on the index record */
+ return(dict_load_index_id_err);
+ }
- field = rec_get_nth_field_old(rec, 4, &len);
+ field = rec_get_nth_field_old(rec, 1/*ID*/, &len);
+ if (UNIV_UNLIKELY(len != 8)) {
+ goto err_len;
+ }
- dict_mem_index_add_field(index,
- mem_heap_strdupl(heap,
- (char*) field, len),
- prefix_len);
+ id = mach_read_from_8(field);
-next_rec:
- btr_pcur_move_to_next_user_rec(&pcur, &mtr);
+ rec_get_nth_field_offs_old(rec, 2/*DB_TRX_ID*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ rec_get_nth_field_offs_old(rec, 3/*DB_ROLL_PTR*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
}
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
+ field = rec_get_nth_field_old(rec, 4/*NAME*/, &name_len);
+ if (UNIV_UNLIKELY(name_len == UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+
+ name_buf = mem_heap_strdupl(heap, (const char*) field,
+ name_len);
+
+ field = rec_get_nth_field_old(rec, 5/*N_FIELDS*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+ n_fields = mach_read_from_4(field);
+
+ field = rec_get_nth_field_old(rec, 6/*TYPE*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+ type = mach_read_from_4(field);
+
+ field = rec_get_nth_field_old(rec, 7/*SPACE*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+ space = mach_read_from_4(field);
+
+ field = rec_get_nth_field_old(rec, 8/*PAGE_NO*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
+
+ if (allocate) {
+ *index = dict_mem_index_create(table_name, name_buf,
+ space, type, n_fields);
+ } else {
+ ut_a(*index);
+
+ dict_mem_fill_index_struct(*index, NULL, NULL, name_buf,
+ space, type, n_fields);
+ }
+
+ (*index)->id = id;
+ (*index)->page = mach_read_from_4(field);
+ ut_ad((*index)->page);
+
+ return(NULL);
}
/********************************************************************//**
@@ -662,44 +1434,31 @@ static
ulint
dict_load_indexes(
/*==============*/
- dict_table_t* table, /*!< in: table */
- mem_heap_t* heap) /*!< in: memory heap for temporary storage */
+ dict_table_t* table, /*!< in/out: table */
+ mem_heap_t* heap, /*!< in: memory heap for temporary storage */
+ dict_err_ignore_t ignore_err)
+ /*!< in: error to be ignored when
+ loading the index definition */
{
dict_table_t* sys_indexes;
dict_index_t* sys_index;
- dict_index_t* index;
btr_pcur_t pcur;
dtuple_t* tuple;
dfield_t* dfield;
const rec_t* rec;
- const byte* field;
- ulint len;
- ulint name_len;
- char* name_buf;
- ulint type;
- ulint space;
- ulint page_no;
- ulint n_fields;
byte* buf;
- ibool is_sys_table;
- dulint id;
mtr_t mtr;
ulint error = DB_SUCCESS;
ut_ad(mutex_own(&(dict_sys->mutex)));
- if ((ut_dulint_get_high(table->id) == 0)
- && (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
- is_sys_table = TRUE;
- } else {
- is_sys_table = FALSE;
- }
-
mtr_start(&mtr);
sys_indexes = dict_table_get_low("SYS_INDEXES");
sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes);
ut_a(!dict_table_is_comp(sys_indexes));
+ ut_a(name_of_col_is(sys_indexes, sys_index, 4, "NAME"));
+ ut_a(name_of_col_is(sys_indexes, sys_index, 8, "PAGE_NO"));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
@@ -713,6 +1472,9 @@ dict_load_indexes(
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (;;) {
+ dict_index_t* index = NULL;
+ const char* err_msg;
+
if (!btr_pcur_is_on_user_rec(&pcur)) {
break;
@@ -720,90 +1482,104 @@ dict_load_indexes(
rec = btr_pcur_get_rec(&pcur);
- field = rec_get_nth_field_old(rec, 0, &len);
- ut_ad(len == 8);
+ err_msg = dict_load_index_low(buf, table->name, heap, rec,
+ TRUE, &index);
+ ut_ad((index == NULL) == (err_msg != NULL));
- if (ut_memcmp(buf, field, len) != 0) {
+ if (err_msg == dict_load_index_id_err) {
+ /* TABLE_ID mismatch means that we have
+ run out of index definitions for the table. */
break;
- } else if (rec_get_deleted_flag(rec, 0)) {
- /* Skip delete marked records */
+ } else if (err_msg == dict_load_index_del) {
+ /* Skip delete-marked records. */
goto next_rec;
+ } else if (err_msg) {
+ fprintf(stderr, "InnoDB: %s\n", err_msg);
+ error = DB_CORRUPTION;
+ goto func_exit;
}
- field = rec_get_nth_field_old(rec, 1, &len);
- ut_ad(len == 8);
- id = mach_read_from_8(field);
-
- ut_a(name_of_col_is(sys_indexes, sys_index, 4, "NAME"));
-
- field = rec_get_nth_field_old(rec, 4, &name_len);
- name_buf = mem_heap_strdupl(heap, (char*) field, name_len);
-
- field = rec_get_nth_field_old(rec, 5, &len);
- n_fields = mach_read_from_4(field);
-
- field = rec_get_nth_field_old(rec, 6, &len);
- type = mach_read_from_4(field);
-
- field = rec_get_nth_field_old(rec, 7, &len);
- space = mach_read_from_4(field);
-
- ut_a(name_of_col_is(sys_indexes, sys_index, 8, "PAGE_NO"));
-
- field = rec_get_nth_field_old(rec, 8, &len);
- page_no = mach_read_from_4(field);
+ ut_ad(index);
/* We check for unsupported types first, so that the
subsequent checks are relevant for the supported types. */
- if (type & ~(DICT_CLUSTERED | DICT_UNIQUE)) {
+ if (index->type & ~(DICT_CLUSTERED | DICT_UNIQUE)) {
fprintf(stderr,
"InnoDB: Error: unknown type %lu"
" of index %s of table %s\n",
- (ulong) type, name_buf, table->name);
+ (ulong) index->type, index->name, table->name);
error = DB_UNSUPPORTED;
+ dict_mem_index_free(index);
goto func_exit;
- } else if (page_no == FIL_NULL) {
+ } else if (index->page == FIL_NULL) {
fprintf(stderr,
"InnoDB: Error: trying to load index %s"
" for table %s\n"
"InnoDB: but the index tree has been freed!\n",
- name_buf, table->name);
-
- error = DB_CORRUPTION;
- goto func_exit;
- } else if ((type & DICT_CLUSTERED) == 0
- && NULL == dict_table_get_first_index(table)) {
+ index->name, table->name);
+
+ if (ignore_err & DICT_ERR_IGNORE_INDEX_ROOT) {
+ /* If caller can tolerate this error,
+ we will continue to load the index and
+ let caller deal with this error. However
+ mark the index and table corrupted */
+ index->corrupted = TRUE;
+ table->corrupted = TRUE;
+ fprintf(stderr,
+ "InnoDB: Index is corrupt but forcing"
+ " load into data dictionary\n");
+ } else {
+corrupted:
+ dict_mem_index_free(index);
+ error = DB_CORRUPTION;
+ goto func_exit;
+ }
+ } else if (!dict_index_is_clust(index)
+ && NULL == dict_table_get_first_index(table)) {
fputs("InnoDB: Error: trying to load index ",
stderr);
- ut_print_name(stderr, NULL, FALSE, name_buf);
+ ut_print_name(stderr, NULL, FALSE, index->name);
fputs(" for table ", stderr);
ut_print_name(stderr, NULL, TRUE, table->name);
fputs("\nInnoDB: but the first index"
" is not clustered!\n", stderr);
- error = DB_CORRUPTION;
- goto func_exit;
- } else if (is_sys_table
- && ((type & DICT_CLUSTERED)
+ goto corrupted;
+ } else if (table->id < DICT_HDR_FIRST_ID
+ && (dict_index_is_clust(index)
|| ((table == dict_sys->sys_tables)
- && (name_len == (sizeof "ID_IND") - 1)
- && (0 == ut_memcmp(name_buf,
- "ID_IND", name_len))))) {
+ && !strcmp("ID_IND", index->name)))) {
/* The index was created in memory already at booting
of the database server */
+ dict_mem_index_free(index);
} else {
- index = dict_mem_index_create(table->name, name_buf,
- space, type, n_fields);
- index->id = id;
+ error = dict_load_fields(index, heap);
+
+ if (error != DB_SUCCESS) {
+
+ fprintf(stderr, "InnoDB: Error: load index '%s'"
+ " for table '%s' failed\n",
+ index->name, table->name);
+
+ /* If the force recovery flag is set, and
+ if the failed index is not the primary index, we
+ will continue and open other indexes */
+ if (srv_force_recovery
+ && !dict_index_is_clust(index)) {
+ error = DB_SUCCESS;
+ goto next_rec;
+ } else {
+ goto func_exit;
+ }
+ }
- dict_load_fields(index, heap);
- error = dict_index_add_to_cache(table, index, page_no,
- FALSE);
+ error = dict_index_add_to_cache(table, index,
+ index->page, FALSE);
/* The data dictionary tables should never contain
invalid index definitions. If we ignored this error
and simply did not load this index definition, the
@@ -827,80 +1603,83 @@ func_exit:
}
/********************************************************************//**
-Loads a table definition and also all its index definitions, and also
-the cluster definition if the table is a member in a cluster. Also loads
-all foreign key constraints where the foreign key is in the table or where
-a foreign key references columns in this table. Adds all these to the data
-dictionary cache.
-@return table, NULL if does not exist; if the table is stored in an
-.ibd file, but the file does not exist, then we set the
-ibd_file_missing flag TRUE in the table object we return */
+Loads a table definition from a SYS_TABLES record to dict_table_t.
+Does not load any columns or indexes.
+@return error message, or NULL on success */
UNIV_INTERN
-dict_table_t*
-dict_load_table(
-/*============*/
- const char* name) /*!< in: table name in the
- databasename/tablename format */
+const char*
+dict_load_table_low(
+/*================*/
+ const char* name, /*!< in: table name */
+ const rec_t* rec, /*!< in: SYS_TABLES record */
+ dict_table_t** table) /*!< out,own: table, or NULL */
{
- ibool ibd_file_missing = FALSE;
- dict_table_t* table;
- dict_table_t* sys_tables;
- btr_pcur_t pcur;
- dict_index_t* sys_index;
- dtuple_t* tuple;
- mem_heap_t* heap;
- dfield_t* dfield;
- const rec_t* rec;
const byte* field;
ulint len;
ulint space;
ulint n_cols;
ulint flags;
- ulint err;
- mtr_t mtr;
- ut_ad(mutex_own(&(dict_sys->mutex)));
+ if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
+ return("delete-marked record in SYS_TABLES");
+ }
- heap = mem_heap_create(32000);
+ if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 10)) {
+ return("wrong number of columns in SYS_TABLES record");
+ }
- mtr_start(&mtr);
+ rec_get_nth_field_offs_old(rec, 0/*NAME*/, &len);
+ if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
+err_len:
+ return("incorrect column length in SYS_TABLES");
+ }
+ rec_get_nth_field_offs_old(rec, 1/*DB_TRX_ID*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
+ rec_get_nth_field_offs_old(rec, 2/*DB_ROLL_PTR*/, &len);
+ if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
- sys_tables = dict_table_get_low("SYS_TABLES");
- sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
- ut_a(!dict_table_is_comp(sys_tables));
+ rec_get_nth_field_offs_old(rec, 3/*ID*/, &len);
+ if (UNIV_UNLIKELY(len != 8)) {
+ goto err_len;
+ }
- tuple = dtuple_create(heap, 1);
- dfield = dtuple_get_nth_field(tuple, 0);
+ field = rec_get_nth_field_old(rec, 4/*N_COLS*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
- dfield_set_data(dfield, name, ut_strlen(name));
- dict_index_copy_types(tuple, sys_index, 1);
+ n_cols = mach_read_from_4(field);
- btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
- rec = btr_pcur_get_rec(&pcur);
+ rec_get_nth_field_offs_old(rec, 5/*TYPE*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
+ }
- if (!btr_pcur_is_on_user_rec(&pcur)
- || rec_get_deleted_flag(rec, 0)) {
- /* Not found */
-err_exit:
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
- mem_heap_free(heap);
+ rec_get_nth_field_offs_old(rec, 6/*MIX_ID*/, &len);
+ if (UNIV_UNLIKELY(len != 8)) {
+ goto err_len;
+ }
- return(NULL);
+ rec_get_nth_field_offs_old(rec, 7/*MIX_LEN*/, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
}
- field = rec_get_nth_field_old(rec, 0, &len);
+ rec_get_nth_field_offs_old(rec, 8/*CLUSTER_ID*/, &len);
+ if (UNIV_UNLIKELY(len != UNIV_SQL_NULL)) {
+ goto err_len;
+ }
- /* Check if the table name in record is the searched one */
- if (len != ut_strlen(name) || ut_memcmp(name, field, len) != 0) {
+ field = rec_get_nth_field_old(rec, 9/*SPACE*/, &len);
- goto err_exit;
+ if (UNIV_UNLIKELY(len != 4)) {
+ goto err_len;
}
- ut_a(name_of_col_is(sys_tables, sys_index, 9, "SPACE"));
-
- field = rec_get_nth_field_old(rec, 9, &len);
space = mach_read_from_4(field);
/* Check if the tablespace exists and has the right name */
@@ -908,7 +1687,8 @@ err_exit:
flags = dict_sys_tables_get_flags(rec);
if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
- field = rec_get_nth_field_old(rec, 5, &len);
+ field = rec_get_nth_field_old(rec, 5/*TYPE*/, &len);
+ ut_ad(len == 4); /* this was checked earlier */
flags = mach_read_from_4(field);
ut_print_timestamp(stderr);
@@ -918,17 +1698,12 @@ err_exit:
"InnoDB: in InnoDB data dictionary"
" has unknown type %lx.\n",
(ulong) flags);
- goto err_exit;
+ return("incorrect flags in SYS_TABLES");
}
} else {
flags = 0;
}
- ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS"));
-
- field = rec_get_nth_field_old(rec, 4, &len);
- n_cols = mach_read_from_4(field);
-
/* The high-order bit of N_COLS is the "compact format" flag.
For tables in that format, MIX_LEN may hold additional flags. */
if (n_cols & 0x80000000UL) {
@@ -936,9 +1711,13 @@ err_exit:
flags |= DICT_TF_COMPACT;
- ut_a(name_of_col_is(sys_tables, sys_index, 7, "MIX_LEN"));
field = rec_get_nth_field_old(rec, 7, &len);
+ if (UNIV_UNLIKELY(len != 4)) {
+
+ goto err_len;
+ }
+
flags2 = mach_read_from_4(field);
if (flags2 & (~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT))) {
@@ -957,58 +1736,153 @@ err_exit:
}
/* See if the tablespace is available. */
- if (trx_sys_sys_space(space)) {
+ *table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL,
+ flags);
+
+ field = rec_get_nth_field_old(rec, 3/*ID*/, &len);
+ ut_ad(len == 8); /* this was checked earlier */
+
+ (*table)->id = mach_read_from_8(field);
+
+ (*table)->ibd_file_missing = FALSE;
+
+ return(NULL);
+}
+
+/********************************************************************//**
+Loads a table definition and also all its index definitions, and also
+the cluster definition if the table is a member in a cluster. Also loads
+all foreign key constraints where the foreign key is in the table or where
+a foreign key references columns in this table. Adds all these to the data
+dictionary cache.
+@return table, NULL if does not exist; if the table is stored in an
+.ibd file, but the file does not exist, then we set the
+ibd_file_missing flag TRUE in the table object we return */
+UNIV_INTERN
+dict_table_t*
+dict_load_table(
+/*============*/
+ const char* name, /*!< in: table name in the
+ databasename/tablename format */
+ ibool cached, /*!< in: TRUE=add to cache, FALSE=do not */
+ dict_err_ignore_t ignore_err)
+ /*!< in: error to be ignored when loading
+ table and its indexes' definition */
+{
+ dict_table_t* table;
+ dict_table_t* sys_tables;
+ btr_pcur_t pcur;
+ dict_index_t* sys_index;
+ dtuple_t* tuple;
+ mem_heap_t* heap;
+ dfield_t* dfield;
+ const rec_t* rec;
+ const byte* field;
+ ulint len;
+ ulint err;
+ const char* err_msg;
+ mtr_t mtr;
+
+ ut_ad(mutex_own(&(dict_sys->mutex)));
+
+ heap = mem_heap_create(32000);
+
+ mtr_start(&mtr);
+
+ sys_tables = dict_table_get_low("SYS_TABLES");
+ sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
+ ut_a(!dict_table_is_comp(sys_tables));
+ ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID"));
+ ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS"));
+ ut_a(name_of_col_is(sys_tables, sys_index, 5, "TYPE"));
+ ut_a(name_of_col_is(sys_tables, sys_index, 7, "MIX_LEN"));
+ ut_a(name_of_col_is(sys_tables, sys_index, 9, "SPACE"));
+
+ tuple = dtuple_create(heap, 1);
+ dfield = dtuple_get_nth_field(tuple, 0);
+
+ dfield_set_data(dfield, name, ut_strlen(name));
+ dict_index_copy_types(tuple, sys_index, 1);
+
+ btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
+ BTR_SEARCH_LEAF, &pcur, &mtr);
+ rec = btr_pcur_get_rec(&pcur);
+
+ if (!btr_pcur_is_on_user_rec(&pcur)
+ || rec_get_deleted_flag(rec, 0)) {
+ /* Not found */
+err_exit:
+ btr_pcur_close(&pcur);
+ mtr_commit(&mtr);
+ mem_heap_free(heap);
+
+ return(NULL);
+ }
+
+ field = rec_get_nth_field_old(rec, 0, &len);
+
+ /* Check if the table name in record is the searched one */
+ if (len != ut_strlen(name) || ut_memcmp(name, field, len) != 0) {
+
+ goto err_exit;
+ }
+
+ err_msg = dict_load_table_low(name, rec, &table);
+
+ if (err_msg) {
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: %s\n", err_msg);
+ goto err_exit;
+ }
+
+ if (trx_sys_sys_space(table->space)) {
/* The system tablespace is always available. */
} else if (!fil_space_for_table_exists_in_mem(
- space, name,
- (flags >> DICT_TF2_SHIFT) & DICT_TF2_TEMPORARY,
+ table->space, name,
+ (table->flags >> DICT_TF2_SHIFT)
+ & DICT_TF2_TEMPORARY,
FALSE, FALSE)) {
- if ((flags >> DICT_TF2_SHIFT) & DICT_TF2_TEMPORARY) {
+ if (table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT)) {
/* Do not bother to retry opening temporary tables. */
- ibd_file_missing = TRUE;
+ table->ibd_file_missing = TRUE;
} else {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: error: space object of table");
+ " InnoDB: error: space object of table ");
ut_print_filename(stderr, name);
fprintf(stderr, ",\n"
"InnoDB: space id %lu did not exist in memory."
" Retrying an open.\n",
- (ulong) space);
+ (ulong) table->space);
/* Try to open the tablespace */
if (!fil_open_single_table_tablespace(
- TRUE, space,
- flags == DICT_TF_COMPACT ? 0 :
- flags & ~(~0 << DICT_TF_BITS), name)) {
+ TRUE, table->space,
+ table->flags == DICT_TF_COMPACT ? 0 :
+ table->flags & ~(~0 << DICT_TF_BITS), name)) {
/* We failed to find a sensible
tablespace file */
- ibd_file_missing = TRUE;
+ table->ibd_file_missing = TRUE;
}
}
}
- table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL,
- flags);
-
- table->ibd_file_missing = (unsigned int) ibd_file_missing;
-
- ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID"));
-
- field = rec_get_nth_field_old(rec, 3, &len);
- table->id = mach_read_from_8(field);
-
btr_pcur_close(&pcur);
mtr_commit(&mtr);
dict_load_columns(table, heap);
- dict_table_add_to_cache(table, heap);
+ if (cached) {
+ dict_table_add_to_cache(table, heap);
+ } else {
+ dict_table_add_system_columns(table, heap);
+ }
mem_heap_empty(heap);
- err = dict_load_indexes(table, heap);
+ err = dict_load_indexes(table, heap, ignore_err);
/* Initialize table foreign_child value. Its value could be
changed when dict_load_foreigns() is called below */
@@ -1018,19 +1892,29 @@ err_exit:
of the error condition, since the user may want to dump data from the
clustered index. However we load the foreign key information only if
all indexes were loaded. */
- if (err == DB_SUCCESS) {
+ if (!cached) {
+ } else if (err == DB_SUCCESS) {
err = dict_load_foreigns(table->name, TRUE, TRUE);
if (err != DB_SUCCESS) {
dict_table_remove_from_cache(table);
table = NULL;
+ } else {
+ table->fk_max_recusive_level = 0;
}
- } else if (!srv_force_recovery) {
- dict_table_remove_from_cache(table);
- table = NULL;
- }
+ } else {
+ dict_index_t* index;
- table->fk_max_recusive_level = 0;
+ /* Make sure that at least the clustered index was loaded.
+ Otherwise refuse to load the table */
+ index = dict_table_get_first_index(table);
+
+ if (!srv_force_recovery || !index
+ || !dict_index_is_clust(index)) {
+ dict_table_remove_from_cache(table);
+ table = NULL;
+ }
+ }
#if 0
if (err != DB_SUCCESS && table != NULL) {
@@ -1067,7 +1951,7 @@ UNIV_INTERN
dict_table_t*
dict_load_table_on_id(
/*==================*/
- dulint table_id) /*!< in: table id */
+ table_id_t table_id) /*!< in: table id */
{
byte id_buf[8];
btr_pcur_t pcur;
@@ -1134,14 +2018,15 @@ dict_load_table_on_id(
ut_ad(len == 8);
/* Check if the table id in record is the one searched for */
- if (ut_dulint_cmp(table_id, mach_read_from_8(field)) != 0) {
+ if (table_id != mach_read_from_8(field)) {
goto func_exit;
}
/* Now we get the table name from the record */
field = rec_get_nth_field_old(rec, 1, &len);
/* Load the table definition to memory */
- table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len));
+ table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len),
+ TRUE, DICT_ERR_IGNORE_NONE);
func_exit:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -1166,7 +2051,7 @@ dict_load_sys_table(
heap = mem_heap_create(1000);
- dict_load_indexes(table, heap);
+ dict_load_indexes(table, heap, DICT_ERR_IGNORE_NONE);
mem_heap_free(heap);
}
@@ -1345,12 +2230,15 @@ dict_load_foreign(
foreign->id = mem_heap_strdup(foreign->heap, id);
field = rec_get_nth_field_old(rec, 3, &len);
+
foreign->foreign_table_name = mem_heap_strdupl(
foreign->heap, (char*) field, len);
+ dict_mem_foreign_table_name_lookup_set(foreign, TRUE);
field = rec_get_nth_field_old(rec, 4, &len);
foreign->referenced_table_name = mem_heap_strdupl(
foreign->heap, (char*) field, len);
+ dict_mem_referenced_table_name_lookup_set(foreign, TRUE);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -1358,7 +2246,7 @@ dict_load_foreign(
dict_load_foreign_cols(id, foreign);
ref_table = dict_table_check_if_in_cache_low(
- foreign->referenced_table_name);
+ foreign->referenced_table_name_lookup);
/* We could possibly wind up in a deep recursive calls if
we call dict_table_get_low() again here if there
@@ -1391,7 +2279,7 @@ dict_load_foreign(
have to load it so that we are able to make type comparisons
in the next function call. */
- for_table = dict_table_get_low(foreign->foreign_table_name);
+ for_table = dict_table_get_low(foreign->foreign_table_name_lookup);
if (for_table && ref_table && check_recursive) {
/* This is to record the longest chain of ancesters
@@ -1510,10 +2398,12 @@ loop:
/* Since table names in SYS_FOREIGN are stored in a case-insensitive
order, we have to check that the table name matches also in a binary
string comparison. On Unix, MySQL allows table names that only differ
- in character case. */
-
- if (0 != ut_memcmp(field, table_name, len)) {
+ in character case. If lower_case_table_names=2 then what is stored
+ may not be the same case, but the previous comparison showed that they
+ match with no-case. */
+ if ((innobase_get_lower_case_table_names() != 2)
+ && (0 != ut_memcmp(field, table_name, len))) {
goto next_rec;
}
diff --git a/storage/xtradb/dict/dict0mem.c b/storage/xtradb/dict/dict0mem.c
index f2d219bfd4f..617c68925cb 100644
--- a/storage/xtradb/dict/dict0mem.c
+++ b/storage/xtradb/dict/dict0mem.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. 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
@@ -33,13 +33,22 @@ Created 1/8/1996 Heikki Tuuri
#include "data0type.h"
#include "mach0data.h"
#include "dict0dict.h"
+#include "ha_prototypes.h" /* innobase_casedn_str()*/
#ifndef UNIV_HOTBACKUP
# include "lock0lock.h"
#endif /* !UNIV_HOTBACKUP */
+#ifdef UNIV_BLOB_DEBUG
+# include "ut0rbt.h"
+#endif /* UNIV_BLOB_DEBUG */
#define DICT_HEAP_SIZE 100 /*!< initial memory heap size when
creating a table or index object */
+#ifdef UNIV_PFS_MUTEX
+/* Key to register autoinc_mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t autoinc_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
/**********************************************************************//**
Creates a table memory object.
@return own: table object */
@@ -79,7 +88,8 @@ dict_mem_table_create(
#ifndef UNIV_HOTBACKUP
table->autoinc_lock = mem_heap_alloc(heap, lock_get_size());
- mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
+ mutex_create(autoinc_mutex_key,
+ &table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
table->autoinc = 0;
@@ -175,10 +185,6 @@ dict_mem_table_add_col(
ulint len) /*!< in: precision */
{
dict_col_t* col;
-#ifndef UNIV_HOTBACKUP
- ulint mbminlen;
- ulint mbmaxlen;
-#endif /* !UNIV_HOTBACKUP */
ulint i;
ut_ad(table);
@@ -203,18 +209,38 @@ dict_mem_table_add_col(
col = dict_table_get_nth_col(table, i);
- col->ind = (unsigned int) i;
- col->ord_part = 0;
+ dict_mem_fill_column_struct(col, i, mtype, prtype, len);
+}
- col->mtype = (unsigned int) mtype;
- col->prtype = (unsigned int) prtype;
- col->len = (unsigned int) len;
+/**********************************************************************//**
+This function populates a dict_col_t memory structure with
+supplied information. */
+UNIV_INTERN
+void
+dict_mem_fill_column_struct(
+/*========================*/
+ dict_col_t* column, /*!< out: column struct to be
+ filled */
+ ulint col_pos, /*!< in: column position */
+ ulint mtype, /*!< in: main data type */
+ ulint prtype, /*!< in: precise type */
+ ulint col_len) /*!< in: column length */
+{
#ifndef UNIV_HOTBACKUP
- dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen);
+ ulint mbminlen;
+ ulint mbmaxlen;
+#endif /* !UNIV_HOTBACKUP */
- col->mbminlen = (unsigned int) mbminlen;
- col->mbmaxlen = (unsigned int) mbmaxlen;
+ column->ind = (unsigned int) col_pos;
+ column->ord_part = 0;
+ column->max_prefix = 0;
+ column->mtype = (unsigned int) mtype;
+ column->prtype = (unsigned int) prtype;
+ column->len = (unsigned int) col_len;
+#ifndef UNIV_HOTBACKUP
+ dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen);
+ dict_col_set_mbminmaxlen(column, mbminlen, mbmaxlen);
#endif /* !UNIV_HOTBACKUP */
}
@@ -242,22 +268,9 @@ dict_mem_index_create(
heap = mem_heap_create(DICT_HEAP_SIZE);
index = mem_heap_zalloc(heap, sizeof(dict_index_t));
- index->heap = heap;
+ dict_mem_fill_index_struct(index, heap, table_name, index_name,
+ space, type, n_fields);
- index->type = type;
-#ifndef UNIV_HOTBACKUP
- index->space = (unsigned int) space;
-#endif /* !UNIV_HOTBACKUP */
- index->name = mem_heap_strdup(heap, index_name);
- index->table_name = table_name;
- index->n_fields = (unsigned int) n_fields;
- index->fields = mem_heap_alloc(heap, 1 + n_fields
- * sizeof(dict_field_t));
- /* The '1 +' above prevents allocation
- of an empty mem block */
-#ifdef UNIV_DEBUG
- index->magic_n = DICT_INDEX_MAGIC_N;
-#endif /* UNIV_DEBUG */
return(index);
}
@@ -282,6 +295,60 @@ dict_mem_foreign_create(void)
}
/**********************************************************************//**
+Sets the foreign_table_name_lookup pointer based on the value of
+lower_case_table_names. If that is 0 or 1, foreign_table_name_lookup
+will point to foreign_table_name. If 2, then another string is
+allocated from foreign->heap and set to lower case. */
+UNIV_INTERN
+void
+dict_mem_foreign_table_name_lookup_set(
+/*===================================*/
+ dict_foreign_t* foreign, /*!< in/out: foreign struct */
+ ibool do_alloc) /*!< in: is an alloc needed */
+{
+ if (innobase_get_lower_case_table_names() == 2) {
+ if (do_alloc) {
+ foreign->foreign_table_name_lookup = mem_heap_alloc(
+ foreign->heap,
+ strlen(foreign->foreign_table_name) + 1);
+ }
+ strcpy(foreign->foreign_table_name_lookup,
+ foreign->foreign_table_name);
+ innobase_casedn_str(foreign->foreign_table_name_lookup);
+ } else {
+ foreign->foreign_table_name_lookup
+ = foreign->foreign_table_name;
+ }
+}
+
+/**********************************************************************//**
+Sets the referenced_table_name_lookup pointer based on the value of
+lower_case_table_names. If that is 0 or 1, referenced_table_name_lookup
+will point to referenced_table_name. If 2, then another string is
+allocated from foreign->heap and set to lower case. */
+UNIV_INTERN
+void
+dict_mem_referenced_table_name_lookup_set(
+/*======================================*/
+ dict_foreign_t* foreign, /*!< in/out: foreign struct */
+ ibool do_alloc) /*!< in: is an alloc needed */
+{
+ if (innobase_get_lower_case_table_names() == 2) {
+ if (do_alloc) {
+ foreign->referenced_table_name_lookup = mem_heap_alloc(
+ foreign->heap,
+ strlen(foreign->referenced_table_name) + 1);
+ }
+ strcpy(foreign->referenced_table_name_lookup,
+ foreign->referenced_table_name);
+ innobase_casedn_str(foreign->referenced_table_name_lookup);
+ } else {
+ foreign->referenced_table_name_lookup
+ = foreign->referenced_table_name;
+ }
+}
+
+/**********************************************************************//**
Adds a field definition to an index. NOTE: does not take a copy
of the column name if the field is a column. The memory occupied
by the column name may be released only after publishing the index. */
@@ -318,6 +385,12 @@ dict_mem_index_free(
{
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
+#ifdef UNIV_BLOB_DEBUG
+ if (index->blobs) {
+ mutex_free(&index->blobs_mutex);
+ rbt_free(index->blobs);
+ }
+#endif /* UNIV_BLOB_DEBUG */
mem_heap_free(index->heap);
}
diff --git a/storage/xtradb/eval/eval0eval.c b/storage/xtradb/eval/eval0eval.c
index 589b0fa1576..dcd416adeee 100644
--- a/storage/xtradb/eval/eval0eval.c
+++ b/storage/xtradb/eval/eval0eval.c
@@ -384,18 +384,13 @@ eval_notfound(
/*==========*/
func_node_t* func_node) /*!< in: function node */
{
- que_node_t* arg1;
- que_node_t* arg2;
sym_node_t* cursor;
sel_node_t* sel_node;
ibool ibool_val;
- arg1 = func_node->args;
- arg2 = que_node_get_next(arg1);
-
ut_ad(func_node->func == PARS_NOTFOUND_TOKEN);
- cursor = arg1;
+ cursor = func_node->args;
ut_ad(que_node_get_type(cursor) == QUE_NODE_SYMBOL);
diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c
index a8520187013..e244985d096 100644
--- a/storage/xtradb/fil/fil0fil.c
+++ b/storage/xtradb/fil/fil0fil.c
@@ -46,6 +46,8 @@ Created 10/25/1995 Heikki Tuuri
#include "row0mysql.h"
#include "row0row.h"
#include "que0que.h"
+#include "btr0btr.h"
+#include "btr0sea.h"
#ifndef UNIV_HOTBACKUP
# include "buf0lru.h"
# include "ibuf0ibuf.h"
@@ -127,6 +129,16 @@ UNIV_INTERN ulint fil_n_pending_tablespace_flushes = 0;
/** The null file address */
UNIV_INTERN fil_addr_t fil_addr_null = {FIL_NULL, 0};
+#ifdef UNIV_PFS_MUTEX
+/* Key to register fil_system_mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t fil_system_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
+#ifdef UNIV_PFS_RWLOCK
+/* Key to register file space latch with performance schema */
+UNIV_INTERN mysql_pfs_key_t fil_space_latch_key;
+#endif /* UNIV_PFS_RWLOCK */
+
/** File node of a tablespace or the log data space */
struct fil_node_struct {
fil_space_t* space; /*!< backpointer to the space where this node
@@ -242,6 +254,7 @@ the ib_logfiles form a 'space' and it is handled here */
struct fil_system_struct {
#ifndef UNIV_HOTBACKUP
mutex_t mutex; /*!< The mutex protecting the cache */
+ mutex_t file_extend_mutex;
#endif /* !UNIV_HOTBACKUP */
hash_table_t* spaces; /*!< The hash table of spaces in the
system; they are hashed on the space
@@ -296,6 +309,34 @@ struct fil_system_struct {
initialized. */
static fil_system_t* fil_system = NULL;
+#ifdef UNIV_DEBUG
+/** Try fil_validate() every this many times */
+# define FIL_VALIDATE_SKIP 17
+
+/******************************************************************//**
+Checks the consistency of the tablespace cache some of the time.
+@return TRUE if ok or the check was skipped */
+static
+ibool
+fil_validate_skip(void)
+/*===================*/
+{
+ /** The fil_validate() call skip counter. Use a signed type
+ because of the race condition below. */
+ static int fil_validate_count = FIL_VALIDATE_SKIP;
+
+ /* There is a race condition below, but it does not matter,
+ because this call is only for heuristic purposes. We want to
+ reduce the call frequency of the costly fil_validate() check
+ in debug builds. */
+ if (--fil_validate_count > 0) {
+ return(TRUE);
+ }
+
+ fil_validate_count = FIL_VALIDATE_SKIP;
+ return(fil_validate());
+}
+#endif /* UNIV_DEBUG */
/********************************************************************//**
NOTE: you must call fil_mutex_enter_and_prepare_for_io() first!
@@ -336,14 +377,15 @@ fil_get_space_id_for_table(
/*******************************************************************//**
Frees a space object from the tablespace memory cache. Closes the files in
the chain but does not delete them. There must not be any pending i/o's or
-flushes on the files. */
+flushes on the files.
+@return TRUE on success */
static
ibool
fil_space_free(
/*===========*/
- /* out: TRUE if success */
- ulint id, /* in: space id */
- ibool own_mutex);/* in: TRUE if own system->mutex */
+ ulint id, /* in: space id */
+ ibool x_latched); /* in: TRUE if caller has space->latch
+ in X mode */
/********************************************************************//**
Reads data from a space to a buffer. Remember that the possible incomplete
blocks at the end of file are ignored: they are not taken into account when
@@ -617,7 +659,7 @@ fil_node_create(
UT_LIST_ADD_LAST(chain, space->chain, node);
- if (id < SRV_LOG_SPACE_FIRST_ID && fil_system->max_assigned_id < id) {
+ if (id < SRV_EXTRA_SYS_SPACE_FIRST_ID && fil_system->max_assigned_id < id) {
fil_system->max_assigned_id = id;
}
@@ -660,7 +702,8 @@ fil_node_open_file(
async I/O! */
node->handle = os_file_create_simple_no_error_handling(
- node->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
+ innodb_file_data_key, node->name, OS_FILE_OPEN,
+ OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
@@ -778,15 +821,21 @@ add_size:
os_file_create() to fall back to the normal file I/O mode. */
if (space->purpose == FIL_LOG) {
- node->handle = os_file_create(node->name, OS_FILE_OPEN,
- OS_FILE_AIO, OS_LOG_FILE, &ret);
+ node->handle = os_file_create(innodb_file_log_key,
+ node->name, OS_FILE_OPEN,
+ OS_FILE_AIO, OS_LOG_FILE,
+ &ret);
} else if (node->is_raw_disk) {
- node->handle = os_file_create(node->name,
+ node->handle = os_file_create(innodb_file_data_key,
+ node->name,
OS_FILE_OPEN_RAW,
- OS_FILE_AIO, OS_DATA_FILE, &ret);
+ OS_FILE_AIO, OS_DATA_FILE,
+ &ret);
} else {
- node->handle = os_file_create(node->name, OS_FILE_OPEN,
- OS_FILE_AIO, OS_DATA_FILE, &ret);
+ node->handle = os_file_create(innodb_file_data_key,
+ node->name, OS_FILE_OPEN,
+ OS_FILE_AIO, OS_DATA_FILE,
+ &ret);
}
ut_a(ret);
@@ -815,9 +864,10 @@ fil_node_close_file(
ut_ad(node && system);
ut_ad(mutex_own(&(system->mutex)));
ut_a(node->open);
- ut_a(node->n_pending == 0);
+ ut_a(node->n_pending == 0 || node->space->is_being_deleted);
ut_a(node->n_pending_flushes == 0);
- ut_a(node->modification_counter == node->flush_counter);
+ ut_a(node->modification_counter == node->flush_counter
+ || srv_fast_shutdown == 2);
ret = os_file_close(node->handle);
ut_a(ret);
@@ -828,7 +878,7 @@ fil_node_close_file(
ut_a(system->n_open > 0);
system->n_open--;
- if (node->space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(node->space->id)) {
+ if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(node->space->id)) {
ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
/* The node is in the LRU list, remove it */
@@ -1027,7 +1077,7 @@ fil_node_free(
ut_ad(node && system && space);
ut_ad(mutex_own(&(system->mutex)));
ut_a(node->magic_n == FIL_NODE_MAGIC_N);
- ut_a(node->n_pending == 0);
+ ut_a(node->n_pending == 0 || space->is_being_deleted);
if (node->open) {
/* We fool the assertion in fil_node_close_file() to think
@@ -1130,6 +1180,7 @@ try_again:
space = fil_space_get_by_name(name);
if (UNIV_LIKELY_NULL(space)) {
+ ibool success;
ulint namesake_id;
ut_print_timestamp(stderr);
@@ -1168,9 +1219,10 @@ try_again:
namesake_id = space->id;
- mutex_exit(&fil_system->mutex);
+ success = fil_space_free(namesake_id, FALSE);
+ ut_a(success);
- fil_space_free(namesake_id, FALSE);
+ mutex_exit(&fil_system->mutex);
goto try_again;
}
@@ -1205,6 +1257,7 @@ try_again:
space->mark = FALSE;
if (UNIV_LIKELY(purpose == FIL_TABLESPACE && !recv_recovery_on)
+ && UNIV_UNLIKELY(id < SRV_EXTRA_SYS_SPACE_FIRST_ID)
&& UNIV_UNLIKELY(id > fil_system->max_assigned_id)) {
if (!fil_system->space_id_reuse_warned) {
fil_system->space_id_reuse_warned = TRUE;
@@ -1235,7 +1288,7 @@ try_again:
UT_LIST_INIT(space->chain);
space->magic_n = FIL_SPACE_MAGIC_N;
- rw_lock_create(&space->latch, SYNC_FSP);
+ rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP);
HASH_INSERT(fil_space_t, hash, fil_system->spaces, id, space);
@@ -1290,7 +1343,7 @@ fil_assign_new_space_id(
(ulong) SRV_LOG_SPACE_FIRST_ID);
}
- success = (id < SRV_LOG_SPACE_FIRST_ID);
+ success = (id < SRV_EXTRA_SYS_SPACE_FIRST_ID);
if (success) {
*space_id = fil_system->max_assigned_id = id;
@@ -1323,15 +1376,14 @@ fil_space_free(
/*===========*/
/* out: TRUE if success */
ulint id, /* in: space id */
- ibool own_mutex) /* in: TRUE if own system->mutex */
+ ibool x_latched) /* in: TRUE if caller has space->latch
+ in X mode */
{
fil_space_t* space;
fil_space_t* namespace;
fil_node_t* fil_node;
- if (!own_mutex) {
- mutex_enter(&fil_system->mutex);
- }
+ ut_ad(mutex_own(&fil_system->mutex));
space = fil_space_get_by_id(id);
@@ -1342,8 +1394,6 @@ fil_space_free(
" from the cache but\n"
"InnoDB: it is not there.\n", (ulong) id);
- mutex_exit(&fil_system->mutex);
-
return(FALSE);
}
@@ -1378,8 +1428,8 @@ fil_space_free(
ut_a(0 == UT_LIST_GET_LEN(space->chain));
- if (!own_mutex) {
- mutex_exit(&fil_system->mutex);
+ if (x_latched) {
+ rw_lock_x_unlock(&space->latch);
}
rw_lock_free(&(space->latch));
@@ -1547,7 +1597,10 @@ fil_init(
fil_system = mem_zalloc(sizeof(fil_system_t));
- mutex_create(&fil_system->mutex, SYNC_ANY_LATCH);
+ mutex_create(fil_system_mutex_key,
+ &fil_system->mutex, SYNC_ANY_LATCH);
+ mutex_create(fil_system_mutex_key,
+ &fil_system->file_extend_mutex, SYNC_OUTER_ANY_LATCH);
fil_system->spaces = hash_create(hash_size);
fil_system->name_hash = hash_create(hash_size);
@@ -1626,25 +1679,27 @@ fil_close_all_files(void)
/*=====================*/
{
fil_space_t* space;
- fil_node_t* node;
mutex_enter(&fil_system->mutex);
space = UT_LIST_GET_FIRST(fil_system->space_list);
while (space != NULL) {
+ fil_node_t* node;
fil_space_t* prev_space = space;
- node = UT_LIST_GET_FIRST(space->chain);
+ for (node = UT_LIST_GET_FIRST(space->chain);
+ node != NULL;
+ node = UT_LIST_GET_NEXT(chain, node)) {
- while (node != NULL) {
if (node->open) {
fil_node_close_file(node, fil_system);
}
- node = UT_LIST_GET_NEXT(chain, node);
}
+
space = UT_LIST_GET_NEXT(space_list, space);
- fil_space_free(prev_space->id, TRUE);
+
+ fil_space_free(prev_space->id, FALSE);
}
mutex_exit(&fil_system->mutex);
@@ -1666,6 +1721,10 @@ fil_set_max_space_id_if_bigger(
ut_error;
}
+ if (max_id >= SRV_EXTRA_SYS_SPACE_FIRST_ID) {
+ return;
+ }
+
mutex_enter(&fil_system->mutex);
if (fil_system->max_assigned_id < max_id) {
@@ -1684,6 +1743,7 @@ static
ulint
fil_write_lsn_and_arch_no_to_file(
/*==============================*/
+ ulint space_id,
ulint sum_of_sizes, /*!< in: combined size of previous files
in space, in database pages */
ib_uint64_t lsn, /*!< in: lsn to write */
@@ -1693,14 +1753,16 @@ fil_write_lsn_and_arch_no_to_file(
byte* buf1;
byte* buf;
+ ut_a(trx_sys_sys_space(space_id));
+
buf1 = mem_alloc(2 * UNIV_PAGE_SIZE);
buf = ut_align(buf1, UNIV_PAGE_SIZE);
- fil_read(TRUE, 0, 0, sum_of_sizes, 0, UNIV_PAGE_SIZE, buf, NULL);
+ fil_read(TRUE, space_id, 0, sum_of_sizes, 0, UNIV_PAGE_SIZE, buf, NULL);
- mach_write_ull(buf + FIL_PAGE_FILE_FLUSH_LSN, lsn);
+ mach_write_to_8(buf + FIL_PAGE_FILE_FLUSH_LSN, lsn);
- fil_write(TRUE, 0, 0, sum_of_sizes, 0, UNIV_PAGE_SIZE, buf, NULL);
+ fil_write(TRUE, space_id, 0, sum_of_sizes, 0, UNIV_PAGE_SIZE, buf, NULL);
mem_free(buf1);
@@ -1736,7 +1798,7 @@ fil_write_flushed_lsn_to_data_files(
always open. */
if (space->purpose == FIL_TABLESPACE
- && space->id == 0) {
+ && trx_sys_sys_space(space->id)) {
sum_of_sizes = 0;
node = UT_LIST_GET_FIRST(space->chain);
@@ -1744,7 +1806,7 @@ fil_write_flushed_lsn_to_data_files(
mutex_exit(&fil_system->mutex);
err = fil_write_lsn_and_arch_no_to_file(
- sum_of_sizes, lsn, arch_log_no);
+ space->id, sum_of_sizes, lsn, arch_log_no);
if (err != DB_SUCCESS) {
return(err);
@@ -1792,7 +1854,7 @@ fil_read_flushed_lsn_and_arch_log_no(
os_file_read(data_file, buf, 0, 0, UNIV_PAGE_SIZE);
- flushed_lsn = mach_read_ull(buf + FIL_PAGE_FILE_FLUSH_LSN);
+ flushed_lsn = mach_read_from_8(buf + FIL_PAGE_FILE_FLUSH_LSN);
ut_free(buf2);
@@ -2264,6 +2326,19 @@ try_again:
path = mem_strdup(space->name);
mutex_exit(&fil_system->mutex);
+
+ /* Important: We rely on the data dictionary mutex to ensure
+ that a race is not possible here. It should serialize the tablespace
+ drop/free. We acquire an X latch only to avoid a race condition
+ when accessing the tablespace instance via:
+
+ fsp_get_available_space_in_free_extents().
+
+ There our main motivation is to reduce the contention on the
+ dictionary mutex. */
+
+ rw_lock_x_lock(&space->latch);
+
#ifndef UNIV_HOTBACKUP
/* Invalidate in the buffer pool all pages belonging to the
tablespace. Since we have set space->is_being_deleted = TRUE, readahead
@@ -2272,11 +2347,19 @@ try_again:
completely and permanently. The flag is_being_deleted also prevents
fil_flush() from being applied to this tablespace. */
+ if (srv_lazy_drop_table) {
+ buf_LRU_mark_space_was_deleted(id);
+ } else {
buf_LRU_invalidate_tablespace(id);
+ }
#endif
/* printf("Deleting tablespace %s id %lu\n", space->name, id); */
- success = fil_space_free(id, FALSE);
+ mutex_enter(&fil_system->mutex);
+
+ success = fil_space_free(id, TRUE);
+
+ mutex_exit(&fil_system->mutex);
if (success) {
success = os_file_delete(path);
@@ -2284,6 +2367,8 @@ try_again:
if (!success) {
success = os_file_delete_if_exists(path);
}
+ } else {
+ rw_lock_x_unlock(&space->latch);
}
if (success) {
@@ -2311,6 +2396,31 @@ try_again:
return(FALSE);
}
+/*******************************************************************//**
+Returns TRUE if a single-table tablespace is being deleted.
+@return TRUE if being deleted */
+UNIV_INTERN
+ibool
+fil_tablespace_is_being_deleted(
+/*============================*/
+ ulint id) /*!< in: space id */
+{
+ fil_space_t* space;
+ ibool is_being_deleted;
+
+ mutex_enter(&fil_system->mutex);
+
+ space = fil_space_get_by_id(id);
+
+ ut_a(space != NULL);
+
+ is_being_deleted = space->is_being_deleted;
+
+ mutex_exit(&fil_system->mutex);
+
+ return(is_being_deleted);
+}
+
#ifndef UNIV_HOTBACKUP
/*******************************************************************//**
Discards a single-table tablespace. The tablespace must be cached in the
@@ -2519,7 +2629,7 @@ retry:
os_thread_sleep(20000);
- fil_flush(id);
+ fil_flush(id, TRUE);
goto retry;
@@ -2545,7 +2655,7 @@ retry:
success = fil_rename_tablespace_in_mem(space, node, path);
if (success) {
- success = os_file_rename(old_path, path);
+ success = os_file_rename(innodb_file_data_key, old_path, path);
if (!success) {
/* We have to revert the changes we made
@@ -2622,7 +2732,8 @@ fil_create_new_single_table_tablespace(
path = fil_make_ibd_name(tablename, is_temp);
- file = os_file_create(path, OS_FILE_CREATE, OS_FILE_NORMAL,
+ file = os_file_create(innodb_file_data_key, path,
+ OS_FILE_CREATE, OS_FILE_NORMAL,
OS_DATA_FILE, &ret);
if (ret == FALSE) {
ut_print_timestamp(stderr);
@@ -2732,7 +2843,7 @@ error_exit2:
goto error_exit;
}
- ret = os_file_flush(file);
+ ret = os_file_flush(file, TRUE);
if (!ret) {
fputs("InnoDB: Error: file flush of tablespace ", stderr);
@@ -2810,7 +2921,8 @@ fil_reset_too_high_lsns(
filepath = fil_make_ibd_name(name, FALSE);
file = os_file_create_simple_no_error_handling(
- filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success);
+ innodb_file_data_key, filepath, OS_FILE_OPEN,
+ OS_FILE_READ_WRITE, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
@@ -2841,7 +2953,7 @@ fil_reset_too_high_lsns(
/* We have to read the file flush lsn from the header of the file */
- flush_lsn = mach_read_ull(page + FIL_PAGE_FILE_FLUSH_LSN);
+ flush_lsn = mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN);
if (current_lsn >= flush_lsn) {
/* Ok */
@@ -2889,7 +3001,7 @@ fil_reset_too_high_lsns(
goto func_exit;
}
- if (mach_read_ull(page + FIL_PAGE_LSN) > current_lsn) {
+ if (mach_read_from_8(page + FIL_PAGE_LSN) > current_lsn) {
/* We have to reset the lsn */
if (zip_size) {
@@ -2917,7 +3029,7 @@ fil_reset_too_high_lsns(
}
}
- success = os_file_flush(file);
+ success = os_file_flush(file, TRUE);
if (!success) {
goto func_exit;
@@ -2931,7 +3043,7 @@ fil_reset_too_high_lsns(
goto func_exit;
}
- mach_write_ull(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
+ mach_write_to_8(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
success = os_file_write(filepath, file, page, 0, 0,
zip_size ? zip_size : UNIV_PAGE_SIZE);
@@ -2939,7 +3051,7 @@ fil_reset_too_high_lsns(
goto func_exit;
}
- success = os_file_flush(file);
+ success = os_file_flush(file, TRUE);
func_exit:
os_file_close(file);
ut_free(buf2);
@@ -2949,6 +3061,97 @@ func_exit:
}
/********************************************************************//**
+Checks if a page is corrupt. (for offline page)
+*/
+static
+ibool
+fil_page_buf_page_is_corrupted_offline(
+/*===================================*/
+ const byte* page, /*!< in: a database page */
+ ulint zip_size) /*!< in: size of compressed page;
+ 0 for uncompressed pages */
+{
+ ulint checksum_field;
+ ulint old_checksum_field;
+
+ if (!zip_size
+ && memcmp(page + FIL_PAGE_LSN + 4,
+ page + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)) {
+ return(TRUE);
+ }
+
+ checksum_field = mach_read_from_4(page
+ + FIL_PAGE_SPACE_OR_CHKSUM);
+
+ if (zip_size) {
+ return(checksum_field != BUF_NO_CHECKSUM_MAGIC
+ && checksum_field
+ != page_zip_calc_checksum(page, zip_size));
+ }
+
+ old_checksum_field = mach_read_from_4(
+ page + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM);
+
+ if (old_checksum_field != mach_read_from_4(page
+ + FIL_PAGE_LSN)
+ && old_checksum_field != BUF_NO_CHECKSUM_MAGIC
+ && old_checksum_field
+ != buf_calc_page_old_checksum(page)) {
+ return(TRUE);
+ }
+
+ if (!srv_fast_checksum
+ && checksum_field != 0
+ && checksum_field != BUF_NO_CHECKSUM_MAGIC
+ && checksum_field
+ != buf_calc_page_new_checksum(page)) {
+ return(TRUE);
+ }
+
+ if (srv_fast_checksum
+ && checksum_field != 0
+ && checksum_field != BUF_NO_CHECKSUM_MAGIC
+ && checksum_field
+ != buf_calc_page_new_checksum_32(page)
+ && checksum_field
+ != buf_calc_page_new_checksum(page)) {
+ return(TRUE);
+ }
+
+ return(FALSE);
+}
+
+/********************************************************************//**
+*/
+static
+void
+fil_page_buf_page_store_checksum(
+/*=============================*/
+ byte* page,
+ ulint zip_size)
+{
+ if (!zip_size) {
+ mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
+ srv_use_checksums
+ ? (!srv_fast_checksum
+ ? buf_calc_page_new_checksum(page)
+ : buf_calc_page_new_checksum_32(page))
+ : BUF_NO_CHECKSUM_MAGIC);
+ mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
+ srv_use_checksums
+ ? buf_calc_page_old_checksum(page)
+ : BUF_NO_CHECKSUM_MAGIC);
+ } else {
+ mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
+ srv_use_checksums
+ ? page_zip_calc_checksum(page, zip_size)
+ : BUF_NO_CHECKSUM_MAGIC);
+ }
+}
+
+/********************************************************************//**
Tries to open a single-table tablespace and optionally checks the space id is
right in it. If does not succeed, prints an error message to the .err log. This
function is used to open a tablespace when we start up mysqld, and also in
@@ -2994,7 +3197,8 @@ fil_open_single_table_tablespace(
ut_a(!(flags & (~0UL << DICT_TF_BITS)));
file = os_file_create_simple_no_error_handling(
- filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success);
+ innodb_file_data_key, filepath, OS_FILE_OPEN,
+ OS_FILE_READ_WRITE, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
@@ -3041,14 +3245,14 @@ fil_open_single_table_tablespace(
space_id = fsp_header_get_space_id(page);
space_flags = fsp_header_get_flags(page);
- if (srv_expand_import
- && (space_id != id || space_flags != (flags & ~(~0 << DICT_TF_BITS)))) {
+ if (srv_expand_import) {
+
ibool file_is_corrupt = FALSE;
byte* buf3;
byte* descr_page;
ibool descr_is_corrupt = FALSE;
- dulint old_id[31];
- dulint new_id[31];
+ index_id_t old_id[31];
+ index_id_t new_id[31];
ulint root_page[31];
ulint n_index;
os_file_t info_file = (os_file_t) -1;
@@ -3063,6 +3267,7 @@ fil_open_single_table_tablespace(
fil_system_t* system;
fil_node_t* node = NULL;
fil_space_t* space;
+ ulint zip_size;
buf3 = ut_malloc(2 * UNIV_PAGE_SIZE);
descr_page = ut_align(buf3, UNIV_PAGE_SIZE);
@@ -3080,30 +3285,26 @@ fil_open_single_table_tablespace(
/* store as first descr page */
memcpy(descr_page, page, UNIV_PAGE_SIZE);
+ zip_size = dict_table_flags_to_zip_size(flags);
+ ut_a(zip_size == dict_table_flags_to_zip_size(space_flags));
+
/* get free limit (page number) of the table space */
/* these should be same to the definition in fsp0fsp.c */
#define FSP_HEADER_OFFSET FIL_PAGE_DATA
#define FSP_FREE_LIMIT 12
free_limit = mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT + page);
- free_limit_bytes = (ib_int64_t)free_limit * (ib_int64_t)UNIV_PAGE_SIZE;
+ free_limit_bytes = (ib_int64_t)free_limit * (ib_int64_t)(zip_size ? zip_size : UNIV_PAGE_SIZE);
/* overwrite fsp header */
fsp_header_init_fields(page, id, flags);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
space_id = id;
space_flags = flags;
- if (mach_read_ull(page + FIL_PAGE_FILE_FLUSH_LSN) > current_lsn)
- mach_write_ull(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
- mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
- srv_use_checksums
- ? (!srv_fast_checksum
- ? buf_calc_page_new_checksum(page)
- : buf_calc_page_new_checksum_32(page))
- : BUF_NO_CHECKSUM_MAGIC);
- mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- srv_use_checksums
- ? buf_calc_page_old_checksum(page)
- : BUF_NO_CHECKSUM_MAGIC);
+ if (mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN) > current_lsn)
+ mach_write_to_8(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
+
+ fil_page_buf_page_store_checksum(page, zip_size);
+
success = os_file_write(filepath, file, page, 0, 0, UNIV_PAGE_SIZE);
/* get file size */
@@ -3113,8 +3314,10 @@ fil_open_single_table_tablespace(
if (size_bytes < free_limit_bytes) {
free_limit_bytes = size_bytes;
- fprintf(stderr, "InnoDB: free limit of %s is larger than its real size.\n", filepath);
- file_is_corrupt = TRUE;
+ if (size_bytes >= (lint)FSP_EXTENT_SIZE * (lint)(zip_size ? zip_size : UNIV_PAGE_SIZE)) {
+ fprintf(stderr, "InnoDB: free limit of %s is larger than its real size.\n", filepath);
+ file_is_corrupt = TRUE;
+ }
}
/* get cruster index information */
@@ -3134,30 +3337,30 @@ fil_open_single_table_tablespace(
info_file_path[len - 2] = 'x';
info_file_path[len - 1] = 'p';
- info_file = os_file_create_simple_no_error_handling(
+ info_file = os_file_create_simple_no_error_handling(innodb_file_data_key,
info_file_path, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
- fprintf(stderr, "InnoDB: cannot open %s\n", info_file_path);
+ fprintf(stderr, "InnoDB: Cannot open the file: %s\n", info_file_path);
file_is_corrupt = TRUE;
goto skip_info;
}
success = os_file_read(info_file, page, 0, 0, UNIV_PAGE_SIZE);
if (!success) {
- fprintf(stderr, "InnoDB: cannot read %s\n", info_file_path);
+ fprintf(stderr, "InnoDB: Cannot read the file: %s\n", info_file_path);
file_is_corrupt = TRUE;
goto skip_info;
}
if (mach_read_from_4(page) != 0x78706f72UL
|| mach_read_from_4(page + 4) != 0x74696e66UL) {
- fprintf(stderr, "InnoDB: %s seems not to be a correct .exp file\n", info_file_path);
+ fprintf(stderr, "InnoDB: %s seems to be an incorrect .exp file.\n", info_file_path);
file_is_corrupt = TRUE;
goto skip_info;
}
- fprintf(stderr, "InnoDB: import: extended import of %s is started.\n", name);
+ fprintf(stderr, "InnoDB: Import: The extended import of %s is being started.\n", name);
n_index = mach_read_from_4(page + 8);
- fprintf(stderr, "InnoDB: import: %lu indexes are detected.\n", (ulong)n_index);
+ fprintf(stderr, "InnoDB: Import: %lu indexes have been detected.\n", (ulong)n_index);
for (i = 0; i < n_index; i++) {
new_id[i] =
dict_table_get_index_on_name(table,
@@ -3175,75 +3378,41 @@ skip_info:
size_bytes = ut_2pow_round(size_bytes, 1024 * 1024);
}
*/
- if (!(flags & DICT_TF_ZSSIZE_MASK)) {
+
+ if (zip_size) {
+ fprintf(stderr, "InnoDB: Warning: importing compressed table is still EXPERIMENTAL, currently.\n");
+ }
+
+ {
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
ib_int64_t offset;
- size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
+ size = (ulint) (size_bytes / (zip_size ? zip_size : UNIV_PAGE_SIZE));
/* over write space id of all pages */
rec_offs_init(offsets_);
fprintf(stderr, "InnoDB: Progress in %%:");
- for (offset = 0; offset < free_limit_bytes; offset += UNIV_PAGE_SIZE) {
- ulint checksum_field;
- ulint old_checksum_field;
+ for (offset = 0; offset < free_limit_bytes;
+ offset += zip_size ? zip_size : UNIV_PAGE_SIZE) {
ibool page_is_corrupt;
success = os_file_read(file, page,
(ulint)(offset & 0xFFFFFFFFUL),
- (ulint)(offset >> 32), UNIV_PAGE_SIZE);
+ (ulint)(offset >> 32),
+ zip_size ? zip_size : UNIV_PAGE_SIZE);
page_is_corrupt = FALSE;
/* check consistency */
- if (memcmp(page + FIL_PAGE_LSN + 4,
- page + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)) {
-
+ if (fil_page_buf_page_is_corrupted_offline(page, zip_size)) {
page_is_corrupt = TRUE;
}
if (mach_read_from_4(page + FIL_PAGE_OFFSET)
- != offset / UNIV_PAGE_SIZE) {
-
- page_is_corrupt = TRUE;
- }
-
- checksum_field = mach_read_from_4(page
- + FIL_PAGE_SPACE_OR_CHKSUM);
-
- old_checksum_field = mach_read_from_4(
- page + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM);
-
- if (old_checksum_field != mach_read_from_4(page
- + FIL_PAGE_LSN)
- && old_checksum_field != BUF_NO_CHECKSUM_MAGIC
- && old_checksum_field
- != buf_calc_page_old_checksum(page)) {
-
- page_is_corrupt = TRUE;
- }
-
- if (!srv_fast_checksum
- && checksum_field != 0
- && checksum_field != BUF_NO_CHECKSUM_MAGIC
- && checksum_field
- != buf_calc_page_new_checksum(page)) {
-
- page_is_corrupt = TRUE;
- }
-
- if (srv_fast_checksum
- && checksum_field != 0
- && checksum_field != BUF_NO_CHECKSUM_MAGIC
- && checksum_field
- != buf_calc_page_new_checksum_32(page)
- && checksum_field
- != buf_calc_page_new_checksum(page)) {
+ != offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)) {
page_is_corrupt = TRUE;
}
@@ -3254,18 +3423,19 @@ skip_info:
/* it should be overwritten already */
ut_a(!page_is_corrupt);
- } else if (!((offset / UNIV_PAGE_SIZE) % UNIV_PAGE_SIZE)) {
+ } else if (!((offset / (zip_size ? zip_size : UNIV_PAGE_SIZE))
+ % (zip_size ? zip_size : UNIV_PAGE_SIZE))) {
/* descr page (not header) */
if (page_is_corrupt) {
file_is_corrupt = TRUE;
descr_is_corrupt = TRUE;
} else {
- ut_a(fil_page_get_type(page) == FIL_PAGE_TYPE_XDES);
+ ut_ad(fil_page_get_type(page) == FIL_PAGE_TYPE_XDES);
descr_is_corrupt = FALSE;
}
/* store as descr page */
- memcpy(descr_page, page, UNIV_PAGE_SIZE);
+ memcpy(descr_page, page, (zip_size ? zip_size : UNIV_PAGE_SIZE));
} else if (descr_is_corrupt) {
/* unknown state of the page */
@@ -3293,9 +3463,12 @@ skip_info:
ulint bit_index;
descr = descr_page + XDES_ARR_OFFSET
- + XDES_SIZE * (ut_2pow_remainder((offset / UNIV_PAGE_SIZE), UNIV_PAGE_SIZE) / FSP_EXTENT_SIZE);
+ + XDES_SIZE * (ut_2pow_remainder(
+ (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)),
+ (zip_size ? zip_size : UNIV_PAGE_SIZE)) / FSP_EXTENT_SIZE);
- index = XDES_FREE_BIT + XDES_BITS_PER_PAGE * ((offset / UNIV_PAGE_SIZE) % FSP_EXTENT_SIZE);
+ index = XDES_FREE_BIT
+ + XDES_BITS_PER_PAGE * ((offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)) % FSP_EXTENT_SIZE);
byte_index = index / 8;
bit_index = index % 8;
@@ -3313,7 +3486,7 @@ skip_info:
}
if (page_is_corrupt) {
- fprintf(stderr, " [errp:%lld]", offset / UNIV_PAGE_SIZE);
+ fprintf(stderr, " [errp:%lld]", offset / (zip_size ? zip_size : UNIV_PAGE_SIZE));
/* cannot treat corrupt page */
goto skip_write;
@@ -3322,8 +3495,14 @@ skip_info:
if (mach_read_from_4(page + FIL_PAGE_OFFSET) || !offset) {
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
- for (i = 0; (ulint) i < n_index; i++) {
- if ((ulint) (offset / UNIV_PAGE_SIZE) == root_page[i]) {
+ for (i = 0; i < n_index; i++) {
+ if (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE) == root_page[i]) {
+ if (fil_page_get_type(page) != FIL_PAGE_INDEX) {
+ file_is_corrupt = TRUE;
+ fprintf(stderr, " [etyp:%lld]",
+ offset / (zip_size ? zip_size : UNIV_PAGE_SIZE));
+ goto skip_write;
+ }
/* this is index root page */
mach_write_to_4(page + FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
+ FSEG_HDR_SPACE, id);
@@ -3334,10 +3513,17 @@ skip_info:
}
if (fil_page_get_type(page) == FIL_PAGE_INDEX) {
- dulint tmp = mach_read_from_8(page + (PAGE_HEADER + PAGE_INDEX_ID));
+ index_id_t tmp = mach_read_from_8(page + (PAGE_HEADER + PAGE_INDEX_ID));
+
+ for (i = 0; i < n_index; i++) {
+ if (old_id[i] == tmp) {
+ mach_write_to_8(page + (PAGE_HEADER + PAGE_INDEX_ID), new_id[i]);
+ break;
+ }
+ }
- if (mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL) == 0
- && ut_dulint_cmp(old_id[0], tmp) == 0) {
+ if (!zip_size && mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL) == 0
+ && old_id[0] == tmp) {
/* leaf page of cluster index, reset trx_id of records */
rec_t* rec;
rec_t* supremum;
@@ -3357,7 +3543,7 @@ skip_info:
if (!offset) {
offset = row_get_trx_id_offset(rec, index, offsets);
}
- trx_write_trx_id(rec + offset, ut_dulint_create(0, 1));
+ trx_write_trx_id(rec + offset, 1);
for (i = 0; i < n_fields; i++) {
if (rec_offs_nth_extern(offsets, i)) {
@@ -3375,44 +3561,34 @@ skip_info:
rec = page_rec_get_next(rec);
n_recs--;
}
- }
-
- for (i = 0; i < n_index; i++) {
- if (ut_dulint_cmp(old_id[i], tmp) == 0) {
- mach_write_to_8(page + (PAGE_HEADER + PAGE_INDEX_ID), new_id[i]);
- break;
- }
+ } else if (mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL) == 0
+ && old_id[0] != tmp) {
+ mach_write_to_8(page + (PAGE_HEADER + PAGE_MAX_TRX_ID), 1);
}
}
- if (mach_read_ull(page + FIL_PAGE_LSN) > current_lsn) {
- mach_write_ull(page + FIL_PAGE_LSN, current_lsn);
- mach_write_ull(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- current_lsn);
+ if (mach_read_from_8(page + FIL_PAGE_LSN) > current_lsn) {
+ mach_write_to_8(page + FIL_PAGE_LSN, current_lsn);
+ if (!zip_size) {
+ mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
+ current_lsn);
+ }
}
- mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
- srv_use_checksums
- ? (!srv_fast_checksum
- ? buf_calc_page_new_checksum(page)
- : buf_calc_page_new_checksum_32(page))
- : BUF_NO_CHECKSUM_MAGIC);
- mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- srv_use_checksums
- ? buf_calc_page_old_checksum(page)
- : BUF_NO_CHECKSUM_MAGIC);
+ fil_page_buf_page_store_checksum(page, zip_size);
success = os_file_write(filepath, file, page,
(ulint)(offset & 0xFFFFFFFFUL),
- (ulint)(offset >> 32), UNIV_PAGE_SIZE);
+ (ulint)(offset >> 32),
+ zip_size ? zip_size : UNIV_PAGE_SIZE);
}
skip_write:
if (free_limit_bytes
- && ((ib_int64_t)((offset + UNIV_PAGE_SIZE) * 100) / free_limit_bytes)
+ && ((ib_int64_t)((offset + (zip_size ? zip_size : UNIV_PAGE_SIZE)) * 100) / free_limit_bytes)
!= ((offset * 100) / free_limit_bytes)) {
fprintf(stderr, " %lu",
- (ulong)((ib_int64_t)((offset + UNIV_PAGE_SIZE) * 100) / free_limit_bytes));
+ (ulong)((ib_int64_t)((offset + (zip_size ? zip_size : UNIV_PAGE_SIZE)) * 100) / free_limit_bytes));
}
}
@@ -3422,7 +3598,7 @@ skip_write:
index = dict_table_get_first_index(table);
while (index) {
for (i = 0; i < n_index; i++) {
- if (ut_dulint_cmp(new_id[i], index->id) == 0) {
+ if (new_id[i] == index->id) {
break;
}
}
@@ -3439,7 +3615,7 @@ skip_write:
info = pars_info_create();
- pars_info_add_dulint_literal(info, "indexid", new_id[i]);
+ pars_info_add_ull_literal(info, "indexid", new_id[i]);
pars_info_add_int4_literal(info, "new_page", (lint) root_page[i]);
error = que_eval_sql(info,
@@ -3468,13 +3644,6 @@ skip_write:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
- } else {
- /* zip page? */
- size = (ulint)
- (size_bytes
- / dict_table_flags_to_zip_size(flags));
- fprintf(stderr, "InnoDB: import: table %s seems to be in newer format."
- " It may not be able to treated for now.\n", name);
}
/* .exp file should be removed */
success = os_file_delete(info_file_path);
@@ -3502,10 +3671,10 @@ skip_write:
stderr);
ut_print_filename(stderr, filepath);
fprintf(stderr, " seems to be corrupt.\n"
- "InnoDB: anyway, all not corrupt pages were tried to be converted to salvage.\n"
+ "InnoDB: An attempt to convert and salvage all corrupt pages was not made.\n"
"InnoDB: ##### CAUTION #####\n"
- "InnoDB: ## The .ibd must cause to crash InnoDB, though re-import would seem to be succeeded.\n"
- "InnoDB: ## If you don't have knowledge about salvaging data from .ibd, you should not use the file.\n"
+ "InnoDB: ## The .ibd file may cause InnoDB to crash, even though its re-import seems to have succeeded.\n"
+ "InnoDB: ## If you don't know how to salvage data from a .ibd, you should not use the file.\n"
"InnoDB: ###################\n");
success = FALSE;
@@ -3556,6 +3725,271 @@ func_exit:
os_file_close(file);
mem_free(filepath);
+ if (srv_expand_import && dict_table_flags_to_zip_size(flags)) {
+ ulint page_no;
+ ulint zip_size;
+ ulint height;
+ ulint root_height = 0;
+ rec_t* node_ptr;
+ dict_table_t* table;
+ dict_index_t* index;
+ buf_block_t* block;
+ page_t* page;
+ page_zip_des_t* page_zip;
+ mtr_t mtr;
+
+ mem_heap_t* heap = NULL;
+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ ulint* offsets = offsets_;
+
+ rec_offs_init(offsets_);
+
+ zip_size = dict_table_flags_to_zip_size(flags);
+
+ table = dict_table_get_low(name);
+ index = dict_table_get_first_index(table);
+ page_no = dict_index_get_page(index);
+ ut_a(page_no == 3);
+
+ fprintf(stderr, "InnoDB: It is compressed .ibd file. need to convert additionaly on buffer pool.\n");
+
+ /* down to leaf */
+ mtr_start(&mtr);
+ mtr_set_log_mode(&mtr, MTR_LOG_NONE);
+
+ height = ULINT_UNDEFINED;
+
+ for (;;) {
+ block = buf_page_get(space_id, zip_size, page_no,
+ RW_NO_LATCH, &mtr);
+ page = buf_block_get_frame(block);
+
+ block->check_index_page_at_flush = TRUE;
+
+ if (height == ULINT_UNDEFINED) {
+ height = btr_page_get_level(page, &mtr);
+ root_height = height;
+ }
+
+ if (height == 0) {
+ break;
+ }
+
+ node_ptr = page_rec_get_next(page_get_infimum_rec(page));
+
+ height--;
+
+ offsets = rec_get_offsets(node_ptr, index, offsets, ULINT_UNDEFINED, &heap);
+ page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
+ }
+
+ mtr_commit(&mtr);
+
+ fprintf(stderr, "InnoDB: pages needs split are ...");
+
+ /* scan reaf pages */
+ while (page_no != FIL_NULL) {
+ rec_t* rec;
+ rec_t* supremum;
+ ulint n_recs;
+
+ mtr_start(&mtr);
+
+ block = buf_page_get(space_id, zip_size, page_no,
+ RW_X_LATCH, &mtr);
+ page = buf_block_get_frame(block);
+ page_zip = buf_block_get_page_zip(block);
+
+ if (!page_zip) {
+ /*something wrong*/
+ fprintf(stderr, "InnoDB: Something wrong with reading page %lu.\n", page_no);
+convert_err_exit:
+ mtr_commit(&mtr);
+ mutex_enter(&fil_system->mutex);
+ fil_space_free(space_id, FALSE);
+ mutex_exit(&fil_system->mutex);
+ success = FALSE;
+ goto convert_exit;
+ }
+
+ supremum = page_get_supremum_rec(page);
+ rec = page_rec_get_next(page_get_infimum_rec(page));
+ n_recs = page_get_n_recs(page);
+
+ /* illegal operation as InnoDB online system. so not logged */
+ while (rec && rec != supremum && n_recs > 0) {
+ ulint n_fields;
+ ulint i;
+ ulint offset = index->trx_id_offset;
+
+ offsets = rec_get_offsets(rec, index, offsets,
+ ULINT_UNDEFINED, &heap);
+ n_fields = rec_offs_n_fields(offsets);
+ if (!offset) {
+ offset = row_get_trx_id_offset(rec, index, offsets);
+ }
+ trx_write_trx_id(rec + offset, 1);
+
+ for (i = 0; i < n_fields; i++) {
+ if (rec_offs_nth_extern(offsets, i)) {
+ ulint local_len;
+ byte* data;
+
+ data = rec_get_nth_field(rec, offsets, i, &local_len);
+
+ local_len -= BTR_EXTERN_FIELD_REF_SIZE;
+
+ mach_write_to_4(data + local_len + BTR_EXTERN_SPACE_ID, id);
+ }
+ }
+
+ rec = page_rec_get_next(rec);
+ n_recs--;
+ }
+
+ /* dummy logged update for along with modified page path */
+ if (index->id != btr_page_get_index_id(page)) {
+ /* this should be adjusted already */
+ fprintf(stderr, "InnoDB: The page %lu seems to be converted wrong.\n", page_no);
+ goto convert_err_exit;
+ }
+ btr_page_set_index_id(page, page_zip, index->id, &mtr);
+
+ /* confirm whether fits to the page size or not */
+ if (!page_zip_compress(page_zip, page, index, &mtr)
+ && !btr_page_reorganize(block, index, &mtr)) {
+ buf_block_t* new_block;
+ page_t* new_page;
+ page_zip_des_t* new_page_zip;
+ rec_t* split_rec;
+ ulint n_uniq;
+
+ /* split page is needed */
+ fprintf(stderr, " %lu", page_no);
+
+ mtr_x_lock(dict_index_get_lock(index), &mtr);
+
+ n_uniq = dict_index_get_n_unique_in_tree(index);
+
+ if(page_get_n_recs(page) < 2) {
+ /* no way to make smaller */
+ fprintf(stderr, "InnoDB: The page %lu cannot be store to the page size.\n", page_no);
+ goto convert_err_exit;
+ }
+
+ if (UNIV_UNLIKELY(page_no == dict_index_get_page(index))) {
+ ulint new_page_no;
+ dtuple_t* node_ptr;
+ ulint level;
+ rec_t* node_ptr_rec;
+ page_cur_t page_cursor;
+
+ /* it is root page, need to raise before split */
+
+ level = btr_page_get_level(page, &mtr);
+
+ new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, &mtr);
+ new_page = buf_block_get_frame(new_block);
+ new_page_zip = buf_block_get_page_zip(new_block);
+ btr_page_create(new_block, new_page_zip, index, level, &mtr);
+
+ btr_page_set_next(new_page, new_page_zip, FIL_NULL, &mtr);
+ btr_page_set_prev(new_page, new_page_zip, FIL_NULL, &mtr);
+
+ page_zip_copy_recs(new_page_zip, new_page,
+ page_zip, page, index, &mtr);
+ btr_search_move_or_delete_hash_entries(new_block, block, index);
+
+ rec = page_rec_get_next(page_get_infimum_rec(new_page));
+ new_page_no = buf_block_get_page_no(new_block);
+
+ node_ptr = dict_index_build_node_ptr(index, rec, new_page_no, heap,
+ level);
+ dtuple_set_info_bits(node_ptr,
+ dtuple_get_info_bits(node_ptr)
+ | REC_INFO_MIN_REC_FLAG);
+ btr_page_empty(block, page_zip, index, level + 1, &mtr);
+
+ btr_page_set_next(page, page_zip, FIL_NULL, &mtr);
+ btr_page_set_prev(page, page_zip, FIL_NULL, &mtr);
+
+ page_cur_set_before_first(block, &page_cursor);
+
+ node_ptr_rec = page_cur_tuple_insert(&page_cursor, node_ptr,
+ index, 0, &mtr);
+ ut_a(node_ptr_rec);
+
+ if (!btr_page_reorganize(block, index, &mtr)) {
+ fprintf(stderr, "InnoDB: failed to store the page %lu.\n", page_no);
+ goto convert_err_exit;
+ }
+
+ /* move to the raised page */
+ page_no = new_page_no;
+ block = new_block;
+ page = new_page;
+ page_zip = new_page_zip;
+
+ fprintf(stderr, "(raise_to:%lu)", page_no);
+ }
+
+ split_rec = page_get_middle_rec(page);
+
+ new_block = btr_page_alloc(index, page_no + 1, FSP_UP,
+ btr_page_get_level(page, &mtr), &mtr);
+ new_page = buf_block_get_frame(new_block);
+ new_page_zip = buf_block_get_page_zip(new_block);
+ btr_page_create(new_block, new_page_zip, index,
+ btr_page_get_level(page, &mtr), &mtr);
+
+ offsets = rec_get_offsets(split_rec, index, offsets, n_uniq, &heap);
+
+ btr_attach_half_pages(index, block,
+ split_rec, new_block, FSP_UP, &mtr);
+
+ page_zip_copy_recs(new_page_zip, new_page,
+ page_zip, page, index, &mtr);
+ page_delete_rec_list_start(split_rec - page + new_page,
+ new_block, index, &mtr);
+ btr_search_move_or_delete_hash_entries(new_block, block, index);
+ page_delete_rec_list_end(split_rec, block, index,
+ ULINT_UNDEFINED, ULINT_UNDEFINED, &mtr);
+
+ fprintf(stderr, "(new:%lu)", buf_block_get_page_no(new_block));
+
+ /* Are they needed? */
+ if (!btr_page_reorganize(block, index, &mtr)) {
+ fprintf(stderr, "InnoDB: failed to store the page %lu.\n", page_no);
+ goto convert_err_exit;
+ }
+ if (!btr_page_reorganize(new_block, index, &mtr)) {
+ fprintf(stderr, "InnoDB: failed to store the page %lu.\n", buf_block_get_page_no(new_block));
+ goto convert_err_exit;
+ }
+ }
+
+ page_no = btr_page_get_next(page, &mtr);
+
+ mtr_commit(&mtr);
+
+ if (heap) {
+ mem_heap_empty(heap);
+ }
+ }
+
+ fprintf(stderr, "...done.\nInnoDB: waiting the flush batch of the additional conversion.\n");
+
+ /* should wait for the not-logged changes are all flushed */
+ buf_flush_list(ULINT_MAX, mtr.end_lsn + 1);
+ buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
+
+ fprintf(stderr, "InnoDB: done.\n");
+convert_exit:
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
+ }
+ }
+
return(success);
}
#endif /* !UNIV_HOTBACKUP */
@@ -3624,7 +4058,8 @@ fil_load_single_table_tablespace(
# endif /* !UNIV_HOTBACKUP */
#endif
file = os_file_create_simple_no_error_handling(
- filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
+ innodb_file_data_key, filepath, OS_FILE_OPEN,
+ OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
@@ -3782,7 +4217,7 @@ fil_load_single_table_tablespace(
os_file_close(file);
new_path = fil_make_ibbackup_old_name(filepath);
- ut_a(os_file_rename(filepath, new_path));
+ ut_a(os_file_rename(innodb_file_data_key, filepath, new_path));
ut_free(buf2);
mem_free(filepath);
@@ -3820,7 +4255,7 @@ fil_load_single_table_tablespace(
mutex_exit(&fil_system->mutex);
- ut_a(os_file_rename(filepath, new_path));
+ ut_a(os_file_rename(innodb_file_data_key, filepath, new_path));
ut_free(buf2);
mem_free(filepath);
@@ -4294,6 +4729,10 @@ fil_extend_space_to_desired_size(
ulint page_size;
ibool success = TRUE;
+ /* file_extend_mutex is for http://bugs.mysql.com/56433 */
+ /* to protect from the other fil_extend_space_to_desired_size() */
+ /* during temprary releasing &fil_system->mutex */
+ mutex_enter(&fil_system->file_extend_mutex);
fil_mutex_enter_and_prepare_for_io(space_id);
space = fil_space_get_by_id(space_id);
@@ -4305,6 +4744,7 @@ fil_extend_space_to_desired_size(
*actual_size = space->size;
mutex_exit(&fil_system->mutex);
+ mutex_exit(&fil_system->file_extend_mutex);
return(TRUE);
}
@@ -4337,6 +4777,8 @@ fil_extend_space_to_desired_size(
offset_low = ((start_page_no - file_start_page_no)
% (4096 * ((1024 * 1024) / page_size)))
* page_size;
+
+ mutex_exit(&fil_system->mutex);
#ifdef UNIV_HOTBACKUP
success = os_file_write(node->name, node->handle, buf,
offset_low, offset_high,
@@ -4346,8 +4788,10 @@ fil_extend_space_to_desired_size(
node->name, node->handle, buf,
offset_low, offset_high,
page_size * n_pages,
- NULL, NULL, NULL);
+ NULL, NULL, space_id, NULL);
#endif
+ mutex_enter(&fil_system->mutex);
+
if (success) {
node->size += n_pages;
space->size += n_pages;
@@ -4393,8 +4837,9 @@ fil_extend_space_to_desired_size(
printf("Extended %s to %lu, actual size %lu pages\n", space->name,
size_after_extend, *actual_size); */
mutex_exit(&fil_system->mutex);
+ mutex_exit(&fil_system->file_extend_mutex);
- fil_flush(space_id);
+ fil_flush(space_id, TRUE);
return(success);
}
@@ -4725,15 +5170,13 @@ _fil_io(
//#if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE
//# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE"
//#endif
- ut_ad(fil_validate());
+ ut_ad(fil_validate_skip());
#ifndef UNIV_HOTBACKUP
# ifndef UNIV_LOG_DEBUG
/* ibuf bitmap pages must be read in the sync aio mode: */
ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE)
|| !ibuf_bitmap_page(zip_size, block_offset)
|| sync || is_log);
- ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE)
- || ibuf_page(space_id, zip_size, block_offset, NULL));
# endif /* UNIV_LOG_DEBUG */
if (sync) {
mode = OS_AIO_SYNC;
@@ -4757,6 +5200,22 @@ _fil_io(
srv_data_written+= len;
}
+ /* if the table space was already deleted, space might not exist already. */
+ if (message
+ && space_id < SRV_LOG_SPACE_FIRST_ID
+ && ((buf_page_t*)message)->space_was_being_deleted) {
+
+ if (mode == OS_AIO_NORMAL) {
+ buf_page_io_complete(message);
+ return(DB_SUCCESS); /*fake*/
+ }
+ if (type == OS_FILE_READ) {
+ return(DB_TABLESPACE_DELETED);
+ } else {
+ return(DB_SUCCESS); /*fake*/
+ }
+ }
+
/* Reserve the fil_system mutex and make sure that we can open at
least one file while holding it, if the file is not already open */
@@ -4858,14 +5317,14 @@ _fil_io(
ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
- if (srv_pass_corrupt_table && space->is_corrupt) {
+ if (srv_pass_corrupt_table == 1 && space->is_corrupt) {
/* should ignore i/o for the crashed space */
mutex_enter(&fil_system->mutex);
fil_node_complete_io(node, fil_system, type);
mutex_exit(&fil_system->mutex);
if (mode == OS_AIO_NORMAL) {
ut_a(space->purpose == FIL_TABLESPACE);
- buf_page_io_complete(message, trx);
+ buf_page_io_complete(message);
}
if (type == OS_FILE_READ) {
return(DB_TABLESPACE_DELETED);
@@ -4873,7 +5332,19 @@ _fil_io(
return(DB_SUCCESS);
}
} else {
- ut_a(!space->is_corrupt);
+ if (srv_pass_corrupt_table > 1 && space->is_corrupt) {
+ /* should ignore write i/o for the crashed space */
+ if (type == OS_FILE_WRITE) {
+ mutex_enter(&fil_system->mutex);
+ fil_node_complete_io(node, fil_system, type);
+ mutex_exit(&fil_system->mutex);
+ if (mode == OS_AIO_NORMAL) {
+ ut_a(space->purpose == FIL_TABLESPACE);
+ buf_page_io_complete(message);
+ }
+ return(DB_SUCCESS);
+ }
+ }
#ifdef UNIV_HOTBACKUP
/* In ibbackup do normal i/o, not aio */
if (type == OS_FILE_READ) {
@@ -4886,10 +5357,24 @@ _fil_io(
#else
/* Queue the aio request */
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
- offset_low, offset_high, len, node, message, trx);
+ offset_low, offset_high, len, node, message, space_id, trx);
#endif
} /**/
+ /* if the table space was already deleted, space might not exist already. */
+ if (message
+ && space_id < SRV_LOG_SPACE_FIRST_ID
+ && ((buf_page_t*)message)->space_was_being_deleted) {
+
+ if (mode == OS_AIO_SYNC) {
+ if (type == OS_FILE_READ) {
+ return(DB_TABLESPACE_DELETED);
+ } else {
+ return(DB_SUCCESS); /*fake*/
+ }
+ }
+ }
+
ut_a(ret);
if (mode == OS_AIO_SYNC) {
@@ -4902,7 +5387,7 @@ _fil_io(
mutex_exit(&fil_system->mutex);
- ut_ad(fil_validate());
+ ut_ad(fil_validate_skip());
}
return(DB_SUCCESS);
@@ -4912,21 +5397,10 @@ _fil_io(
Confirm whether the parameters are valid or not */
UNIV_INTERN
ibool
-fil_area_is_exist(
+fil_is_exist(
/*==============*/
ulint space_id, /*!< in: space id */
- ulint zip_size __attribute__((unused)),
- /*!< in: compressed page size in bytes;
- 0 for uncompressed pages */
- ulint block_offset, /*!< in: offset in number of blocks */
- ulint byte_offset __attribute__((unused)),
- /*!< in: remainder of offset in bytes; in
- aio this must be divisible by the OS block
- size */
- ulint len __attribute__((unused)))
- /*!< in: how many bytes to read or write; this
- must not cross a file boundary; in aio this
- must be a block size multiple */
+ ulint block_offset) /*!< in: offset in number of blocks */
{
fil_space_t* space;
fil_node_t* node;
@@ -5000,26 +5474,49 @@ fil_aio_wait(
fil_node_t* fil_node;
void* message;
ulint type;
+ ulint space_id = 0;
- ut_ad(fil_validate());
+ ut_ad(fil_validate_skip());
- if (os_aio_use_native_aio) {
+ if (srv_use_native_aio) {
srv_set_io_thread_op_info(segment, "native aio handle");
#ifdef WIN_ASYNC_IO
ret = os_aio_windows_handle(segment, 0, &fil_node,
- &message, &type);
+ &message, &type, &space_id);
+#elif defined(LINUX_NATIVE_AIO)
+ ret = os_aio_linux_handle(segment, &fil_node,
+ &message, &type, &space_id);
#else
- ret = 0; /* Eliminate compiler warning */
ut_error;
+ ret = 0; /* Eliminate compiler warning */
#endif
} else {
srv_set_io_thread_op_info(segment, "simulated aio handle");
ret = os_aio_simulated_handle(segment, &fil_node,
- &message, &type);
+ &message, &type, &space_id);
+ }
+
+ /* if the table space was already deleted, fil_node might not exist already. */
+ if (message
+ && space_id < SRV_LOG_SPACE_FIRST_ID
+ && ((buf_page_t*)message)->space_was_being_deleted) {
+
+ /* intended not to be uncompress read page */
+ ut_a(buf_page_get_io_fix(message) == BUF_IO_WRITE
+ || !buf_page_get_zip_size(message)
+ || buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE);
+
+ srv_set_io_thread_op_info(segment, "complete io for buf page");
+ buf_page_io_complete(message);
+ return;
}
ut_a(ret);
+ if (UNIV_UNLIKELY(fil_node == NULL)) {
+ ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS);
+ return;
+ }
srv_set_io_thread_op_info(segment, "complete io for fil node");
@@ -5029,7 +5526,7 @@ fil_aio_wait(
mutex_exit(&fil_system->mutex);
- ut_ad(fil_validate());
+ ut_ad(fil_validate_skip());
/* Do the i/o handling */
/* IMPORTANT: since i/o handling for reads will read also the insert
@@ -5039,7 +5536,7 @@ fil_aio_wait(
if (fil_node->space->purpose == FIL_TABLESPACE) {
srv_set_io_thread_op_info(segment, "complete io for buf page");
- buf_page_io_complete(message, NULL);
+ buf_page_io_complete(message);
} else {
srv_set_io_thread_op_info(segment, "complete io for log");
log_io_complete(message);
@@ -5054,8 +5551,9 @@ UNIV_INTERN
void
fil_flush(
/*======*/
- ulint space_id) /*!< in: file space id (this can be a group of
+ ulint space_id, /*!< in: file space id (this can be a group of
log files or a tablespace of the database) */
+ ibool metadata)
{
fil_space_t* space;
fil_node_t* node;
@@ -5126,7 +5624,7 @@ retry:
/* fprintf(stderr, "Flushing to file %s\n",
node->name); */
- os_file_flush(file);
+ os_file_flush(file, metadata);
mutex_enter(&fil_system->mutex);
@@ -5209,7 +5707,7 @@ fil_flush_file_spaces(
a non-existing space id. */
for (i = 0; i < n_space_ids; i++) {
- fil_flush(space_ids[i]);
+ fil_flush(space_ids[i], TRUE);
}
mem_free(space_ids);
@@ -5342,7 +5840,7 @@ fil_page_get_type(
return(mach_read_from_2(page + FIL_PAGE_TYPE));
}
-/********************************************************************
+/****************************************************************//**
Initializes the tablespace memory cache. */
UNIV_INTERN
void
diff --git a/storage/xtradb/fsp/fsp0fsp.c b/storage/xtradb/fsp/fsp0fsp.c
index cd28186109f..5e3959a3c7f 100644
--- a/storage/xtradb/fsp/fsp0fsp.c
+++ b/storage/xtradb/fsp/fsp0fsp.c
@@ -127,9 +127,8 @@ typedef byte fseg_inode_t;
#define FSEG_ARR_OFFSET (FSEG_PAGE_DATA + FLST_NODE_SIZE)
/*-------------------------------------*/
-#define FSEG_ID 0 /* 8 bytes of segment id: if this is
- ut_dulint_zero, it means that the
- header is unused */
+#define FSEG_ID 0 /* 8 bytes of segment id: if this is 0,
+ it means that the header is unused */
#define FSEG_NOT_FULL_N_USED 8
/* number of used segment pages in
the FSEG_NOT_FULL list */
@@ -657,13 +656,18 @@ xdes_calc_descriptor_page(
0 for uncompressed pages */
ulint offset) /*!< in: page offset */
{
-#ifndef DOXYGEN /* Doxygen gets confused of these */
-# if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET \
- + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
-# error
-# endif
-#endif /* !DOXYGEN */
+//#ifndef DOXYGEN /* Doxygen gets confused of these */
+//# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET
+// + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
+//# error
+//# endif
+//# if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET
+// + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
+//# error
+//# endif
+//#endif /* !DOXYGEN */
ut_a(UNIV_PAGE_SIZE > XDES_ARR_OFFSET + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE);
+ ut_a(PAGE_ZIP_MIN_SIZE > XDES_ARR_OFFSET + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE);
ut_ad(ut_is_2pow(zip_size));
if (!zip_size) {
@@ -1008,11 +1012,11 @@ fsp_header_init(
flst_init(header + FSP_SEG_INODES_FULL, mtr);
flst_init(header + FSP_SEG_INODES_FREE, mtr);
- mlog_write_dulint(header + FSP_SEG_ID, ut_dulint_create(0, 1), mtr);
+ mlog_write_ull(header + FSP_SEG_ID, 1, mtr);
if (space == TRX_SYS_SPACE || space == TRX_DOUBLEWRITE_SPACE) {
fsp_fill_free_list(FALSE, space, header, mtr);
btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,
- space, 0, ut_dulint_add(DICT_IBUF_ID_MIN, space),
+ space, 0, DICT_IBUF_ID_MIN + space,
dict_ind_redundant, mtr);
} else {
fsp_fill_free_list(TRUE, space, header, mtr);
@@ -1850,7 +1854,7 @@ fsp_seg_inode_page_find_used(
inode = fsp_seg_inode_page_get_nth_inode(
page, i, zip_size, mtr);
- if (!ut_dulint_is_zero(mach_read_from_8(inode + FSEG_ID))) {
+ if (mach_read_from_8(inode + FSEG_ID)) {
/* This is used */
ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N)
@@ -1886,7 +1890,7 @@ fsp_seg_inode_page_find_free(
inode = fsp_seg_inode_page_get_nth_inode(
page, i, zip_size, mtr);
- if (ut_dulint_is_zero(mach_read_from_8(inode + FSEG_ID))) {
+ if (!mach_read_from_8(inode + FSEG_ID)) {
/* This is unused */
return(i);
@@ -1945,7 +1949,7 @@ fsp_alloc_seg_inode_page(
inode = fsp_seg_inode_page_get_nth_inode(page, i,
zip_size, mtr);
- mlog_write_dulint(inode + FSEG_ID, ut_dulint_zero, mtr);
+ mlog_write_ull(inode + FSEG_ID, 0, mtr);
}
flst_add_last(space_header + FSP_SEG_INODES_FREE,
@@ -2017,7 +2021,7 @@ fsp_alloc_seg_inode(
page + FSEG_INODE_PAGE_NODE, mtr);
}
- ut_ad(ut_dulint_is_zero(mach_read_from_8(inode + FSEG_ID))
+ ut_ad(!mach_read_from_8(inode + FSEG_ID)
|| mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
return(inode);
}
@@ -2055,7 +2059,7 @@ fsp_free_seg_inode(
page + FSEG_INODE_PAGE_NODE, mtr);
}
- mlog_write_dulint(inode + FSEG_ID, ut_dulint_zero, mtr);
+ mlog_write_ull(inode + FSEG_ID, 0, mtr);
mlog_write_ulint(inode + FSEG_MAGIC_N, 0xfa051ce3, MLOG_4BYTES, mtr);
if (ULINT_UNDEFINED
@@ -2097,8 +2101,7 @@ fseg_inode_try_get(
}
ut_a(inode);
- if (UNIV_UNLIKELY
- (ut_dulint_is_zero(mach_read_from_8(inode + FSEG_ID)))) {
+ if (UNIV_UNLIKELY(!mach_read_from_8(inode + FSEG_ID))) {
inode = NULL;
} else {
@@ -2273,7 +2276,7 @@ fseg_create_general(
ulint zip_size;
fsp_header_t* space_header;
fseg_inode_t* inode;
- dulint seg_id;
+ ib_id_t seg_id;
buf_block_t* block = 0; /* remove warning */
fseg_header_t* header = 0; /* remove warning */
rw_lock_t* latch;
@@ -2327,12 +2330,11 @@ fseg_create_general(
/* Read the next segment id from space header and increment the
value in space header */
- seg_id = mtr_read_dulint(space_header + FSP_SEG_ID, mtr);
+ seg_id = mach_read_from_8(space_header + FSP_SEG_ID);
- mlog_write_dulint(space_header + FSP_SEG_ID, ut_dulint_add(seg_id, 1),
- mtr);
+ mlog_write_ull(space_header + FSP_SEG_ID, seg_id + 1, mtr);
- mlog_write_dulint(inode + FSEG_ID, seg_id, mtr);
+ mlog_write_ull(inode + FSEG_ID, seg_id, mtr);
mlog_write_ulint(inode + FSEG_NOT_FULL_N_USED, 0, MLOG_4BYTES, mtr);
flst_init(inode + FSEG_FREE, mtr);
@@ -2484,7 +2486,7 @@ fseg_fill_free_list(
{
xdes_t* descr;
ulint i;
- dulint seg_id;
+ ib_id_t seg_id;
ulint reserved;
ulint used;
@@ -2521,10 +2523,10 @@ fseg_fill_free_list(
xdes_set_state(descr, XDES_FSEG, mtr);
- seg_id = mtr_read_dulint(inode + FSEG_ID, mtr);
+ seg_id = mach_read_from_8(inode + FSEG_ID);
ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
- mlog_write_dulint(descr + XDES_ID, seg_id, mtr);
+ mlog_write_ull(descr + XDES_ID, seg_id, mtr);
flst_add_last(inode + FSEG_FREE, descr + XDES_FLST_NODE, mtr);
hint += FSP_EXTENT_SIZE;
@@ -2548,7 +2550,7 @@ fseg_alloc_free_extent(
mtr_t* mtr) /*!< in: mtr */
{
xdes_t* descr;
- dulint seg_id;
+ ib_id_t seg_id;
fil_addr_t first;
ut_ad(!((page_offset(inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
@@ -2569,10 +2571,10 @@ fseg_alloc_free_extent(
return(NULL);
}
- seg_id = mtr_read_dulint(inode + FSEG_ID, mtr);
+ seg_id = mach_read_from_8(inode + FSEG_ID);
xdes_set_state(descr, XDES_FSEG, mtr);
- mlog_write_dulint(descr + XDES_ID, seg_id, mtr);
+ mlog_write_ull(descr + XDES_ID, seg_id, mtr);
flst_add_last(inode + FSEG_FREE, descr + XDES_FLST_NODE, mtr);
/* Try to fill the segment free list */
@@ -2607,7 +2609,7 @@ fseg_alloc_free_page_low(
{
fsp_header_t* space_header;
ulint space_size;
- dulint seg_id;
+ ib_id_t seg_id;
ulint used;
ulint reserved;
xdes_t* descr; /*!< extent of the hinted page */
@@ -2623,9 +2625,9 @@ fseg_alloc_free_page_low(
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
- seg_id = mtr_read_dulint(seg_inode + FSEG_ID, mtr);
+ seg_id = mach_read_from_8(seg_inode + FSEG_ID);
- ut_ad(!ut_dulint_is_zero(seg_id));
+ ut_ad(seg_id);
reserved = fseg_n_reserved_pages_low(seg_inode, &used, mtr);
@@ -2643,8 +2645,7 @@ fseg_alloc_free_page_low(
/* In the big if-else below we look for ret_page and ret_descr */
/*-------------------------------------------------------------*/
if ((xdes_get_state(descr, mtr) == XDES_FSEG)
- && (0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID,
- mtr), seg_id))
+ && mach_read_from_8(descr + XDES_ID) == seg_id
&& (xdes_get_bit(descr, XDES_FREE_BIT,
hint % FSP_EXTENT_SIZE, mtr) == TRUE)) {
@@ -2666,7 +2667,7 @@ fseg_alloc_free_page_low(
ut_a(ret_descr == descr);
xdes_set_state(ret_descr, XDES_FSEG, mtr);
- mlog_write_dulint(ret_descr + XDES_ID, seg_id, mtr);
+ mlog_write_ull(ret_descr + XDES_ID, seg_id, mtr);
flst_add_last(seg_inode + FSEG_FREE,
ret_descr + XDES_FLST_NODE, mtr);
@@ -2695,8 +2696,7 @@ fseg_alloc_free_page_low(
}
/*-----------------------------------------------------------*/
} else if ((xdes_get_state(descr, mtr) == XDES_FSEG)
- && (0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID,
- mtr), seg_id))
+ && mach_read_from_8(descr + XDES_ID) == seg_id
&& (!xdes_is_full(descr, mtr))) {
/* 4. We can take the page from the same extent as the
@@ -3126,13 +3126,63 @@ fsp_get_available_space_in_free_extents(
ut_ad(!mutex_own(&kernel_mutex));
+ /* The convoluted mutex acquire is to overcome latching order
+ issues: The problem is that the fil_mutex is at a lower level
+ than the tablespace latch and the buffer pool mutex. We have to
+ first prevent any operations on the file system by acquiring the
+ dictionary mutex. Then acquire the tablespace latch to obey the
+ latching order and then release the dictionary mutex. That way we
+ ensure that the tablespace instance can't be freed while we are
+ examining its contents (see fil_space_free()).
+
+ However, there is one further complication, we release the fil_mutex
+ when we need to invalidate the the pages in the buffer pool and we
+ reacquire the fil_mutex when deleting and freeing the tablespace
+ instance in fil0fil.c. Here we need to account for that situation
+ too. */
+
+ mutex_enter(&dict_sys->mutex);
+
+ /* At this stage there is no guarantee that the tablespace even
+ exists in the cache. */
+
+ if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) {
+
+ mutex_exit(&dict_sys->mutex);
+
+ return(ULLINT_UNDEFINED);
+ }
+
mtr_start(&mtr);
latch = fil_space_get_latch(space, &flags);
+
+ /* This should ensure that the tablespace instance can't be freed
+ by another thread. However, the tablespace pages can still be freed
+ from the buffer pool. We need to check for that again. */
+
zip_size = dict_table_flags_to_zip_size(flags);
mtr_x_lock(latch, &mtr);
+ mutex_exit(&dict_sys->mutex);
+
+ /* At this point it is possible for the tablespace to be deleted and
+ its pages removed from the buffer pool. We need to check for that
+ situation. However, the tablespace instance can't be deleted because
+ our latching above should ensure that. */
+
+ if (fil_tablespace_is_being_deleted(space)) {
+
+ mtr_commit(&mtr);
+
+ return(ULLINT_UNDEFINED);
+ }
+
+ /* From here on even if the user has dropped the tablespace, the
+ pages _must_ still exist in the buffer pool and the tablespace
+ instance _must_ be in the file system hash table. */
+
space_header = fsp_get_space_header(space, zip_size, &mtr);
size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, &mtr);
@@ -3267,8 +3317,8 @@ fseg_free_page_low(
xdes_t* descr;
ulint not_full_n_used;
ulint state;
- dulint descr_id;
- dulint seg_id;
+ ib_id_t descr_id;
+ ib_id_t seg_id;
ulint i;
ut_ad(seg_inode && mtr);
@@ -3305,7 +3355,7 @@ fseg_free_page_low(
"InnoDB: database!\n", (ulong) page);
crash:
fputs("InnoDB: Please refer to\n"
- "InnoDB: " REFMAN "forcing-recovery.html\n"
+ "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
ut_error;
}
@@ -3332,20 +3382,18 @@ crash:
/* If we get here, the page is in some extent of the segment */
- descr_id = mtr_read_dulint(descr + XDES_ID, mtr);
- seg_id = mtr_read_dulint(seg_inode + FSEG_ID, mtr);
+ descr_id = mach_read_from_8(descr + XDES_ID);
+ seg_id = mach_read_from_8(seg_inode + FSEG_ID);
#if 0
fprintf(stderr,
"InnoDB: InnoDB is freeing space %lu page %lu,\n"
- "InnoDB: which belongs to descr seg %lu %lu\n"
- "InnoDB: segment %lu %lu.\n",
+ "InnoDB: which belongs to descr seg %llu\n"
+ "InnoDB: segment %llu.\n",
(ulong) space, (ulong) page,
- (ulong) ut_dulint_get_high(descr_id),
- (ulong) ut_dulint_get_low(descr_id),
- (ulong) ut_dulint_get_high(seg_id),
- (ulong) ut_dulint_get_low(seg_id));
+ (ullint) descr_id,
+ (ullint) seg_id);
#endif /* 0 */
- if (0 != ut_dulint_cmp(descr_id, seg_id)) {
+ if (UNIV_UNLIKELY(descr_id != seg_id)) {
fputs("InnoDB: Dump of the tablespace extent descriptor: ",
stderr);
ut_print_buf(stderr, descr, 40);
@@ -3357,13 +3405,11 @@ crash:
"InnoDB: Serious error: InnoDB is trying to"
" free space %lu page %lu,\n"
"InnoDB: which does not belong to"
- " segment %lu %lu but belongs\n"
- "InnoDB: to segment %lu %lu.\n",
+ " segment %llu but belongs\n"
+ "InnoDB: to segment %llu.\n",
(ulong) space, (ulong) page,
- (ulong) ut_dulint_get_high(descr_id),
- (ulong) ut_dulint_get_low(descr_id),
- (ulong) ut_dulint_get_high(seg_id),
- (ulong) ut_dulint_get_low(seg_id));
+ (ullint) descr_id,
+ (ullint) seg_id);
goto crash;
}
@@ -3423,9 +3469,9 @@ fseg_free_page(
fseg_free_page_low(seg_inode, space, zip_size, page, mtr);
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
buf_page_set_file_page_was_freed(space, page);
-#endif
+#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
}
/**********************************************************************//**
@@ -3452,8 +3498,7 @@ fseg_free_extent(
descr = xdes_get_descriptor(space, zip_size, page, mtr);
ut_a(xdes_get_state(descr, mtr) == XDES_FSEG);
- ut_a(0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID, mtr),
- mtr_read_dulint(seg_inode + FSEG_ID, mtr)));
+ ut_a(!memcmp(descr + XDES_ID, seg_inode + FSEG_ID, 8));
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
@@ -3492,13 +3537,13 @@ fseg_free_extent(
fsp_free_extent(space, zip_size, page, mtr);
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
for (i = 0; i < FSP_EXTENT_SIZE; i++) {
buf_page_set_file_page_was_freed(space,
first_page_in_extent + i);
}
-#endif
+#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
}
/**********************************************************************//**
@@ -3724,7 +3769,7 @@ fseg_validate_low(
mtr_t* mtr2) /*!< in: mtr */
{
ulint space;
- dulint seg_id;
+ ib_id_t seg_id;
mtr_t mtr;
xdes_t* descr;
fil_addr_t node_addr;
@@ -3736,7 +3781,7 @@ fseg_validate_low(
space = page_get_space_id(page_align(inode));
- seg_id = mtr_read_dulint(inode + FSEG_ID, mtr2);
+ seg_id = mach_read_from_8(inode + FSEG_ID);
n_used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED,
MLOG_4BYTES, mtr2);
flst_validate(inode + FSEG_FREE, mtr2);
@@ -3759,8 +3804,7 @@ fseg_validate_low(
ut_a(xdes_get_n_used(descr, &mtr) == 0);
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
- ut_a(!ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID, &mtr),
- seg_id));
+ ut_a(mach_read_from_8(descr + XDES_ID) == seg_id);
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
mtr_commit(&mtr);
@@ -3784,8 +3828,7 @@ fseg_validate_low(
ut_a(xdes_get_n_used(descr, &mtr) > 0);
ut_a(xdes_get_n_used(descr, &mtr) < FSP_EXTENT_SIZE);
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
- ut_a(!ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID, &mtr),
- seg_id));
+ ut_a(mach_read_from_8(descr + XDES_ID) == seg_id);
n_used2 += xdes_get_n_used(descr, &mtr);
@@ -3810,8 +3853,7 @@ fseg_validate_low(
ut_a(xdes_get_n_used(descr, &mtr) == FSP_EXTENT_SIZE);
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
- ut_a(!ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID, &mtr),
- seg_id));
+ ut_a(mach_read_from_8(descr + XDES_ID) == seg_id);
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
mtr_commit(&mtr);
@@ -3862,8 +3904,6 @@ fseg_print_low(
mtr_t* mtr) /*!< in: mtr */
{
ulint space;
- ulint seg_id_low;
- ulint seg_id_high;
ulint n_used;
ulint n_frag;
ulint n_free;
@@ -3872,7 +3912,7 @@ fseg_print_low(
ulint reserved;
ulint used;
ulint page_no;
- dulint d_var;
+ ib_id_t seg_id;
ut_ad(mtr_memo_contains_page(mtr, inode, MTR_MEMO_PAGE_X_FIX));
space = page_get_space_id(page_align(inode));
@@ -3880,10 +3920,7 @@ fseg_print_low(
reserved = fseg_n_reserved_pages_low(inode, &used, mtr);
- d_var = mtr_read_dulint(inode + FSEG_ID, mtr);
-
- seg_id_low = ut_dulint_get_low(d_var);
- seg_id_high = ut_dulint_get_high(d_var);
+ seg_id = mach_read_from_8(inode + FSEG_ID);
n_used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED,
MLOG_4BYTES, mtr);
@@ -3893,11 +3930,11 @@ fseg_print_low(
n_full = flst_get_len(inode + FSEG_FULL, mtr);
fprintf(stderr,
- "SEGMENT id %lu %lu space %lu; page %lu;"
+ "SEGMENT id %llu space %lu; page %lu;"
" res %lu used %lu; full ext %lu\n"
"fragm pages %lu; free extents %lu;"
" not full extents %lu: pages %lu\n",
- (ulong) seg_id_high, (ulong) seg_id_low,
+ (ullint) seg_id,
(ulong) space, (ulong) page_no,
(ulong) reserved, (ulong) used, (ulong) n_full,
(ulong) n_frag, (ulong) n_free, (ulong) n_not_full,
@@ -4099,8 +4136,7 @@ fsp_validate(
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, zip_size, &mtr);
- ut_a(!ut_dulint_is_zero(
- mach_read_from_8(seg_inode + FSEG_ID)));
+ ut_a(mach_read_from_8(seg_inode + FSEG_ID) != 0);
fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_FREE,
@@ -4145,8 +4181,7 @@ fsp_validate(
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, zip_size, &mtr);
- if (!ut_dulint_is_zero(
- mach_read_from_8(seg_inode + FSEG_ID))) {
+ if (mach_read_from_8(seg_inode + FSEG_ID)) {
fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len(
@@ -4208,11 +4243,9 @@ fsp_print(
ulint n_free;
ulint n_free_frag;
ulint n_full_frag;
- ulint seg_id_low;
- ulint seg_id_high;
+ ib_id_t seg_id;
ulint n;
ulint n_segs = 0;
- dulint d_var;
mtr_t mtr;
mtr_t mtr2;
@@ -4242,21 +4275,18 @@ fsp_print(
n_free_frag = flst_get_len(header + FSP_FREE_FRAG, &mtr);
n_full_frag = flst_get_len(header + FSP_FULL_FRAG, &mtr);
- d_var = mtr_read_dulint(header + FSP_SEG_ID, &mtr);
-
- seg_id_low = ut_dulint_get_low(d_var);
- seg_id_high = ut_dulint_get_high(d_var);
+ seg_id = mach_read_from_8(header + FSP_SEG_ID);
fprintf(stderr,
"FILE SPACE INFO: id %lu\n"
"size %lu, free limit %lu, free extents %lu\n"
"not full frag extents %lu: used pages %lu,"
" full frag extents %lu\n"
- "first seg id not used %lu %lu\n",
+ "first seg id not used %llu\n",
(ulong) space,
(ulong) size, (ulong) free_limit, (ulong) n_free,
(ulong) n_free_frag, (ulong) frag_n_used, (ulong) n_full_frag,
- (ulong) seg_id_high, (ulong) seg_id_low);
+ (ullint) seg_id);
mtr_commit(&mtr);
@@ -4286,8 +4316,7 @@ fsp_print(
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, zip_size, &mtr);
- ut_a(!ut_dulint_is_zero(
- mach_read_from_8(seg_inode + FSEG_ID)));
+ ut_a(mach_read_from_8(seg_inode + FSEG_ID) != 0);
fseg_print_low(seg_inode, &mtr);
n_segs++;
@@ -4324,8 +4353,7 @@ fsp_print(
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, zip_size, &mtr);
- if (!ut_dulint_is_zero(
- mach_read_from_8(seg_inode + FSEG_ID))) {
+ if (mach_read_from_8(seg_inode + FSEG_ID)) {
fseg_print_low(seg_inode, &mtr);
n_segs++;
diff --git a/storage/xtradb/ha/ha0ha.c b/storage/xtradb/ha/ha0ha.c
index 7f11917de0a..b28995553e0 100644
--- a/storage/xtradb/ha/ha0ha.c
+++ b/storage/xtradb/ha/ha0ha.c
@@ -102,7 +102,8 @@ ha_clear(
ut_ad(table);
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EXCLUSIVE));
+ /* cannot identificate which btr_search_latch[i] for now */
+ //ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EXCLUSIVE));
#endif /* UNIV_SYNC_DEBUG */
#ifndef UNIV_HOTBACKUP
diff --git a/storage/xtradb/ha/hash0hash.c b/storage/xtradb/ha/hash0hash.c
index 0f4fc55d895..9589da00454 100644
--- a/storage/xtradb/ha/hash0hash.c
+++ b/storage/xtradb/ha/hash0hash.c
@@ -31,6 +31,11 @@ Created 5/20/1997 Heikki Tuuri
#include "mem0mem.h"
#ifndef UNIV_HOTBACKUP
+
+# ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t hash_table_mutex_key;
+# endif /* UNIV_PFS_MUTEX */
+
/************************************************************//**
Reserves the mutex for a fold value in a hash table. */
UNIV_INTERN
@@ -128,70 +133,6 @@ hash_create(
}
/*************************************************************//**
-*/
-UNIV_INTERN
-ulint
-hash_create_needed(
-/*===============*/
- ulint n)
-{
- ulint prime;
- ulint offset;
-
- prime = ut_find_prime(n);
-
- offset = (sizeof(hash_table_t) + 7) / 8;
- offset *= 8;
-
- return(offset + sizeof(hash_cell_t) * prime);
-}
-
-UNIV_INTERN
-void
-hash_create_init(
-/*=============*/
- hash_table_t* table,
- ulint n)
-{
- ulint prime;
- ulint offset;
-
- prime = ut_find_prime(n);
-
- offset = (sizeof(hash_table_t) + 7) / 8;
- offset *= 8;
-
- table->array = (hash_cell_t*)(((byte*)table) + offset);
- table->n_cells = prime;
-# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- table->adaptive = FALSE;
-# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
- table->n_mutexes = 0;
- table->mutexes = NULL;
- table->heaps = NULL;
- table->heap = NULL;
- ut_d(table->magic_n = HASH_TABLE_MAGIC_N);
-
- /* Initialize the cell array */
- hash_table_clear(table);
-}
-
-UNIV_INTERN
-void
-hash_create_reuse(
-/*==============*/
- hash_table_t* table)
-{
- ulint offset;
-
- offset = (sizeof(hash_table_t) + 7) / 8;
- offset *= 8;
-
- table->array = (hash_cell_t*)(((byte*)table) + offset);
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
-}
-
-/*************************************************************//**
Frees a hash table. */
UNIV_INTERN
void
@@ -234,7 +175,8 @@ hash_create_mutexes_func(
table->mutexes = mem_alloc(n_mutexes * sizeof(mutex_t));
for (i = 0; i < n_mutexes; i++) {
- mutex_create(table->mutexes + i, sync_level);
+ mutex_create(hash_table_mutex_key,
+ table->mutexes + i, sync_level);
}
table->n_mutexes = n_mutexes;
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 4a341b4a83e..e4208e8d0ea 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved.
+Copyright (c) 2000, 2011, MySQL AB & Innobase Oy. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
@@ -32,7 +32,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/* TODO list for the InnoDB handler in 5.0:
- - Remove the flag trx->active_trans and look at trx->conc_state
- fix savepoint functions to use savepoint storage area
- Find out what kind of problems the OS X case-insensitivity causes to
table and database names; should we 'normalize' the names like we do
@@ -43,21 +42,24 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#pragma implementation // gcc: Class implementation
#endif
-#ifndef MYSQL_SERVER
-#define MYSQL_SERVER
-#endif
+#define MYSQL_SERVER 1
#include <sql_table.h> // explain_filename, nz2, EXPLAIN_PARTITIONS_AS_COMMENT,
// EXPLAIN_FILENAME_MAX_EXTRA_LENGTH
#include <sql_acl.h> // PROCESS_ACL
-#include <slave.h> // relay_log_info_file
-#include <log_event.h> // rpl_get_position_info
#include <m_ctype.h>
#include <mysys_err.h>
#include <mysql/plugin.h>
#include <mysql/innodb_priv.h>
-//#include <mysql/psi/psi.h>
+#include <mysql/psi/psi.h>
+#include <my_sys.h>
+
+#ifdef MYSQL_SERVER
+#include <rpl_mi.h>
+#include <slave.h>
+#include <log_event.h> // rpl_get_position_info
+#endif /* MYSQL_SERVER */
/** @file ha_innodb.cc */
@@ -88,7 +90,6 @@ extern "C" {
#include "fil0fil.h"
#include "trx0xa.h"
#include "row0merge.h"
-#include "thr0loc.h"
#include "dict0boot.h"
#include "ha_prototypes.h"
#include "ut0mem.h"
@@ -106,26 +107,18 @@ extern char trx_sys_mysql_relay_log_name[];
extern ib_int64_t trx_sys_mysql_relay_log_pos;
#endif /* MYSQL_SERVER */
-#ifndef MYSQL_SERVER
# ifndef MYSQL_PLUGIN_IMPORT
# define MYSQL_PLUGIN_IMPORT /* nothing */
# endif /* MYSQL_PLUGIN_IMPORT */
-#if MYSQL_VERSION_ID < 50124
-/* this is defined in mysql_priv.h inside #ifdef MYSQL_SERVER
-but we need it here */
-bool check_global_access(THD *thd, ulong want_access);
-#endif /* MYSQL_VERSION_ID < 50124 */
-#endif /* MYSQL_SERVER */
-
/** to protect innobase_open_files */
-static pthread_mutex_t innobase_share_mutex;
+static mysql_mutex_t innobase_share_mutex;
/** to force correct commit order in binlog */
-static pthread_mutex_t prepare_commit_mutex;
+static mysql_mutex_t prepare_commit_mutex;
static ulong commit_threads = 0;
-static pthread_mutex_t commit_threads_m;
-static pthread_cond_t commit_cond;
-static pthread_mutex_t commit_cond_m;
+static mysql_mutex_t commit_threads_m;
+static mysql_cond_t commit_cond;
+static mysql_mutex_t commit_cond_m;
static bool innodb_inited = 0;
C_MODE_START
@@ -156,8 +149,10 @@ static long innobase_mirrored_log_groups, innobase_log_files_in_group,
static ulong innobase_commit_concurrency = 0;
static ulong innobase_read_io_threads;
static ulong innobase_write_io_threads;
+static long innobase_buffer_pool_instances = 1;
static ulong innobase_page_size;
+static ulong innobase_log_block_size;
static my_bool innobase_thread_concurrency_timer_based;
static long long innobase_buffer_pool_size, innobase_log_file_size;
@@ -176,10 +171,10 @@ static char* innobase_file_format_name = NULL;
static char* innobase_change_buffering = NULL;
static char* innobase_doublewrite_file = NULL;
-/* Note: This variable can be set to on/off and any of the supported
-file formats in the configuration file, but can only be set to any
-of the supported file formats during runtime. */
-static char* innobase_file_format_check = NULL;
+/* The highest file format being used in the database. The value can be
+set by user, however, it will be adjusted to the newer file format if
+a table of such format is created/opened. */
+static char* innobase_file_format_max = NULL;
static char* innobase_file_flush_method = NULL;
@@ -187,6 +182,7 @@ static char* innobase_file_flush_method = NULL;
values */
static ulong innobase_fast_shutdown = 1;
+static my_bool innobase_file_format_check = TRUE;
#ifdef UNIV_LOG_ARCHIVE
static my_bool innobase_log_archive = FALSE;
static char* innobase_log_arch_dir = NULL;
@@ -194,8 +190,6 @@ static char* innobase_log_arch_dir = NULL;
static my_bool innobase_use_doublewrite = TRUE;
static my_bool innobase_use_checksums = TRUE;
static my_bool innobase_fast_checksum = FALSE;
-static my_bool innobase_extra_undoslots = FALSE;
-static my_bool innobase_fast_recovery = FALSE;
static my_bool innobase_recovery_stats = TRUE;
static my_bool innobase_locks_unsafe_for_binlog = FALSE;
static my_bool innobase_overwrite_relay_log_info = FALSE;
@@ -204,11 +198,33 @@ static my_bool innobase_create_status_file = FALSE;
static my_bool innobase_stats_on_metadata = TRUE;
static my_bool innobase_use_sys_stats_table = FALSE;
static my_bool innobase_buffer_pool_shm_checksum = TRUE;
+static uint innobase_buffer_pool_shm_key = 0;
+static my_bool innobase_large_prefix = FALSE;
+
static char* internal_innobase_data_file_path = NULL;
static char* innodb_version_str = (char*) INNODB_VERSION_STR;
+/** Possible values for system variable "innodb_stats_method". The values
+are defined the same as its corresponding MyISAM system variable
+"myisam_stats_method"(see "myisam_stats_method_names"), for better usability */
+static const char* innodb_stats_method_names[] = {
+ "nulls_equal",
+ "nulls_unequal",
+ "nulls_ignored",
+ NullS
+};
+
+/** Used to define an enumerate type of the system variable innodb_stats_method.
+This is the same as "myisam_stats_method_typelib" */
+static TYPELIB innodb_stats_method_typelib = {
+ array_elements(innodb_stats_method_names) - 1,
+ "innodb_stats_method_typelib",
+ innodb_stats_method_names,
+ NULL
+};
+
/* The following counter is used to convey information to InnoDB
about server activity: in selects it is not sensible to call
srv_active_wake_master_thread after each fetch or search, we only do
@@ -219,15 +235,143 @@ static ulong innobase_active_counter = 0;
static hash_table_t* innobase_open_tables;
-#ifdef __NETWARE__ /* some special cleanup for NetWare */
-bool nw_panic = FALSE;
-#endif
-
/** Allowed values of innodb_change_buffering */
static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = {
"none", /* IBUF_USE_NONE */
- "inserts" /* IBUF_USE_INSERT */
+ "inserts", /* IBUF_USE_INSERT */
+ "deletes", /* IBUF_USE_DELETE_MARK */
+ "changes", /* IBUF_USE_INSERT_DELETE_MARK */
+ "purges", /* IBUF_USE_DELETE */
+ "all" /* IBUF_USE_ALL */
+};
+
+#ifdef HAVE_PSI_INTERFACE
+/* Keys to register pthread mutexes/cond in the current file with
+performance schema */
+static mysql_pfs_key_t innobase_share_mutex_key;
+static mysql_pfs_key_t prepare_commit_mutex_key;
+static mysql_pfs_key_t commit_threads_m_key;
+static mysql_pfs_key_t commit_cond_mutex_key;
+static mysql_pfs_key_t commit_cond_key;
+
+static PSI_mutex_info all_pthread_mutexes[] = {
+ {&commit_threads_m_key, "commit_threads_m", 0},
+ {&commit_cond_mutex_key, "commit_cond_mutex", 0},
+ {&innobase_share_mutex_key, "innobase_share_mutex", 0},
+ {&prepare_commit_mutex_key, "prepare_commit_mutex", 0}
+};
+
+static PSI_cond_info all_innodb_conds[] = {
+ {&commit_cond_key, "commit_cond", 0}
+};
+
+# ifdef UNIV_PFS_MUTEX
+/* all_innodb_mutexes array contains mutexes that are
+performance schema instrumented if "UNIV_PFS_MUTEX"
+is defined */
+static PSI_mutex_info all_innodb_mutexes[] = {
+ {&autoinc_mutex_key, "autoinc_mutex", 0},
+ {&btr_search_enabled_mutex_key, "btr_search_enabled_mutex", 0},
+# ifndef PFS_SKIP_BUFFER_MUTEX_RWLOCK
+ {&buffer_block_mutex_key, "buffer_block_mutex", 0},
+# endif /* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
+ {&buf_pool_mutex_key, "buf_pool_mutex", 0},
+ {&buf_pool_zip_mutex_key, "buf_pool_zip_mutex", 0},
+ {&buf_pool_LRU_list_mutex_key, "buf_pool_LRU_list_mutex", 0},
+ {&buf_pool_free_list_mutex_key, "buf_pool_free_list_mutex", 0},
+ {&buf_pool_zip_free_mutex_key, "buf_pool_zip_free_mutex", 0},
+ {&buf_pool_zip_hash_mutex_key, "buf_pool_zip_hash_mutex", 0},
+ {&cache_last_read_mutex_key, "cache_last_read_mutex", 0},
+ {&dict_foreign_err_mutex_key, "dict_foreign_err_mutex", 0},
+ {&dict_sys_mutex_key, "dict_sys_mutex", 0},
+ {&file_format_max_mutex_key, "file_format_max_mutex", 0},
+ {&fil_system_mutex_key, "fil_system_mutex", 0},
+ {&flush_list_mutex_key, "flush_list_mutex", 0},
+ {&log_flush_order_mutex_key, "log_flush_order_mutex", 0},
+ {&hash_table_mutex_key, "hash_table_mutex", 0},
+ {&ibuf_bitmap_mutex_key, "ibuf_bitmap_mutex", 0},
+ {&ibuf_mutex_key, "ibuf_mutex", 0},
+ {&ibuf_pessimistic_insert_mutex_key,
+ "ibuf_pessimistic_insert_mutex", 0},
+ {&kernel_mutex_key, "kernel_mutex", 0},
+ {&log_sys_mutex_key, "log_sys_mutex", 0},
+# ifdef UNIV_MEM_DEBUG
+ {&mem_hash_mutex_key, "mem_hash_mutex", 0},
+# endif /* UNIV_MEM_DEBUG */
+ {&mem_pool_mutex_key, "mem_pool_mutex", 0},
+ {&mutex_list_mutex_key, "mutex_list_mutex", 0},
+ {&purge_sys_bh_mutex_key, "purge_sys_bh_mutex", 0},
+ {&recv_sys_mutex_key, "recv_sys_mutex", 0},
+ {&rseg_mutex_key, "rseg_mutex", 0},
+# ifdef UNIV_SYNC_DEBUG
+ {&rw_lock_debug_mutex_key, "rw_lock_debug_mutex", 0},
+# endif /* UNIV_SYNC_DEBUG */
+ {&rw_lock_list_mutex_key, "rw_lock_list_mutex", 0},
+ {&rw_lock_mutex_key, "rw_lock_mutex", 0},
+ {&srv_dict_tmpfile_mutex_key, "srv_dict_tmpfile_mutex", 0},
+ {&srv_innodb_monitor_mutex_key, "srv_innodb_monitor_mutex", 0},
+ {&srv_misc_tmpfile_mutex_key, "srv_misc_tmpfile_mutex", 0},
+ {&srv_monitor_file_mutex_key, "srv_monitor_file_mutex", 0},
+ {&syn_arr_mutex_key, "syn_arr_mutex", 0},
+# ifdef UNIV_SYNC_DEBUG
+ {&sync_thread_mutex_key, "sync_thread_mutex", 0},
+# endif /* UNIV_SYNC_DEBUG */
+ {&trx_doublewrite_mutex_key, "trx_doublewrite_mutex", 0},
+ {&trx_undo_mutex_key, "trx_undo_mutex", 0}
};
+# endif /* UNIV_PFS_MUTEX */
+
+# ifdef UNIV_PFS_RWLOCK
+/* all_innodb_rwlocks array contains rwlocks that are
+performance schema instrumented if "UNIV_PFS_RWLOCK"
+is defined */
+static PSI_rwlock_info all_innodb_rwlocks[] = {
+# ifdef UNIV_LOG_ARCHIVE
+ {&archive_lock_key, "archive_lock", 0},
+# endif /* UNIV_LOG_ARCHIVE */
+ {&btr_search_latch_key, "btr_search_latch", 0},
+ {&buf_pool_page_hash_key, "buf_pool_page_hash_latch", 0},
+# ifndef PFS_SKIP_BUFFER_MUTEX_RWLOCK
+ {&buf_block_lock_key, "buf_block_lock", 0},
+# endif /* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
+# ifdef UNIV_SYNC_DEBUG
+ {&buf_block_debug_latch_key, "buf_block_debug_latch", 0},
+# endif /* UNIV_SYNC_DEBUG */
+ {&dict_operation_lock_key, "dict_operation_lock", 0},
+ {&fil_space_latch_key, "fil_space_latch", 0},
+ {&checkpoint_lock_key, "checkpoint_lock", 0},
+ {&trx_i_s_cache_lock_key, "trx_i_s_cache_lock", 0},
+ {&trx_purge_latch_key, "trx_purge_latch", 0},
+ {&index_tree_rw_lock_key, "index_tree_rw_lock", 0},
+ {&dict_table_stats_latch_key, "dict_table_stats", 0}
+};
+# endif /* UNIV_PFS_RWLOCK */
+
+# ifdef UNIV_PFS_THREAD
+/* all_innodb_threads array contains threads that are
+performance schema instrumented if "UNIV_PFS_THREAD"
+is defined */
+static PSI_thread_info all_innodb_threads[] = {
+ {&trx_rollback_clean_thread_key, "trx_rollback_clean_thread", 0},
+ {&io_handler_thread_key, "io_handler_thread", 0},
+ {&srv_lock_timeout_thread_key, "srv_lock_timeout_thread", 0},
+ {&srv_error_monitor_thread_key, "srv_error_monitor_thread", 0},
+ {&srv_monitor_thread_key, "srv_monitor_thread", 0},
+ {&srv_master_thread_key, "srv_master_thread", 0},
+ {&srv_purge_thread_key, "srv_purge_thread", 0}
+};
+# endif /* UNIV_PFS_THREAD */
+
+# ifdef UNIV_PFS_IO
+/* all_innodb_files array contains the type of files that are
+performance schema instrumented if "UNIV_PFS_IO" is defined */
+static PSI_file_info all_innodb_files[] = {
+ {&innodb_file_data_key, "innodb_data_file", 0},
+ {&innodb_file_log_key, "innodb_log_file", 0},
+ {&innodb_file_temp_key, "innodb_temp_file", 0}
+};
+# endif /* UNIV_PFS_IO */
+#endif /* HAVE_PSI_INTERFACE */
static INNOBASE_SHARE *get_share(const char *table_name);
static void free_share(INNOBASE_SHARE *share);
@@ -271,22 +415,13 @@ innobase_file_format_name_lookup(
name */
/************************************************************//**
Validate the file format check config parameters, as a side effect it
-sets the srv_check_file_format_at_startup variable.
-@return true if one of "on" or "off" */
-static
-bool
-innobase_file_format_check_on_off(
-/*==============================*/
- const char* format_check); /*!< in: parameter value */
-/************************************************************//**
-Validate the file format check config parameters, as a side effect it
-sets the srv_check_file_format_at_startup variable.
+sets the srv_max_file_format_at_startup variable.
@return the format_id if valid config value, otherwise, return -1 */
static
int
innobase_file_format_validate_and_set(
-/*================================*/
- const char* format_check); /*!< in: parameter value */
+/*==================================*/
+ const char* format_max); /*!< in: parameter value */
/****************************************************************//**
Return alter table flags supported in an InnoDB database. */
static
@@ -347,11 +482,11 @@ static MYSQL_THDVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG,
"Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.",
NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0);
-static MYSQL_THDVAR_ULONG(flush_log_at_trx_commit_session, PLUGIN_VAR_RQCMDARG,
- "Control innodb_flush_log_at_trx_commit for each sessions. "
- "The value 0~2 are same meanings to innodb_flush_log_at_trx_commit. "
- "The value 3 regards innodb_flush_log_at_trx_commit (default).",
- NULL, NULL, 3, 0, 3, 0);
+static MYSQL_THDVAR_ULONG(flush_log_at_trx_commit, PLUGIN_VAR_OPCMDARG,
+ "Set to 0 (write and flush once per second),"
+ " 1 (write and flush at each commit)"
+ " or 2 (write at commit, flush once per second).",
+ NULL, NULL, 1, 0, 2, 0);
static handler *innobase_create_handler(handlerton *hton,
@@ -493,7 +628,7 @@ innodb_show_status(
THD* thd, /*!< in: the MySQL query thread of the caller */
stat_print_fn *stat_print);
static
-bool innobase_show_status(handlerton *hton, THD* thd,
+bool innobase_show_status(handlerton *hton, THD* thd,
stat_print_fn* stat_print,
enum ha_stat_type stat_type);
@@ -506,20 +641,38 @@ innobase_commit_low(
trx_t* trx); /*!< in: transaction handle */
static SHOW_VAR innodb_status_variables[]= {
+ {"adaptive_hash_cells",
+ (char*) &export_vars.innodb_adaptive_hash_cells, SHOW_LONG},
+ {"adaptive_hash_heap_buffers",
+ (char*) &export_vars.innodb_adaptive_hash_heap_buffers, SHOW_LONG},
+ {"adaptive_hash_hash_searches",
+ (char*) &export_vars.innodb_adaptive_hash_hash_searches, SHOW_LONG},
+ {"adaptive_hash_non_hash_searches",
+ (char*) &export_vars.innodb_adaptive_hash_non_hash_searches, SHOW_LONG},
+ {"background_log_sync",
+ (char*) &export_vars.innodb_background_log_sync, SHOW_LONG},
{"buffer_pool_pages_data",
(char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG},
{"buffer_pool_pages_dirty",
(char*) &export_vars.innodb_buffer_pool_pages_dirty, SHOW_LONG},
{"buffer_pool_pages_flushed",
(char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG},
+ {"buffer_pool_pages_LRU_flushed",
+ (char*) &export_vars.innodb_buffer_pool_pages_LRU_flushed, SHOW_LONG},
{"buffer_pool_pages_free",
(char*) &export_vars.innodb_buffer_pool_pages_free, SHOW_LONG},
#ifdef UNIV_DEBUG
{"buffer_pool_pages_latched",
(char*) &export_vars.innodb_buffer_pool_pages_latched, SHOW_LONG},
#endif /* UNIV_DEBUG */
+ {"buffer_pool_pages_made_not_young",
+ (char*) &export_vars.innodb_buffer_pool_pages_made_not_young, SHOW_LONG},
+ {"buffer_pool_pages_made_young",
+ (char*) &export_vars.innodb_buffer_pool_pages_made_young, SHOW_LONG},
{"buffer_pool_pages_misc",
(char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG},
+ {"buffer_pool_pages_old",
+ (char*) &export_vars.innodb_buffer_pool_pages_old, SHOW_LONG},
{"buffer_pool_pages_total",
(char*) &export_vars.innodb_buffer_pool_pages_total, SHOW_LONG},
{"buffer_pool_read_ahead",
@@ -534,6 +687,12 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_buffer_pool_wait_free, SHOW_LONG},
{"buffer_pool_write_requests",
(char*) &export_vars.innodb_buffer_pool_write_requests, SHOW_LONG},
+ {"checkpoint_age",
+ (char*) &export_vars.innodb_checkpoint_age, SHOW_LONG},
+ {"checkpoint_max_age",
+ (char*) &export_vars.innodb_checkpoint_max_age, SHOW_LONG},
+ {"checkpoint_target_age",
+ (char*) &export_vars.innodb_checkpoint_target_age, SHOW_LONG},
{"data_fsyncs",
(char*) &export_vars.innodb_data_fsyncs, SHOW_LONG},
{"data_pending_fsyncs",
@@ -552,20 +711,74 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_data_written, SHOW_LONG},
{"dblwr_pages_written",
(char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},
- {"deadlocks",
- (char*) &export_vars.innodb_deadlocks, SHOW_LONG},
{"dblwr_writes",
(char*) &export_vars.innodb_dblwr_writes, SHOW_LONG},
+ {"deadlocks",
+ (char*) &export_vars.innodb_deadlocks, SHOW_LONG},
{"dict_tables",
(char*) &export_vars.innodb_dict_tables, SHOW_LONG},
{"have_atomic_builtins",
(char*) &export_vars.innodb_have_atomic_builtins, SHOW_BOOL},
+ {"history_list_length",
+ (char*) &export_vars.innodb_history_list_length, SHOW_LONG},
+ {"ibuf_discarded_delete_marks",
+ (char*) &export_vars.innodb_ibuf_discarded_delete_marks, SHOW_LONG},
+ {"ibuf_discarded_deletes",
+ (char*) &export_vars.innodb_ibuf_discarded_deletes, SHOW_LONG},
+ {"ibuf_discarded_inserts",
+ (char*) &export_vars.innodb_ibuf_discarded_inserts, SHOW_LONG},
+ {"ibuf_free_list",
+ (char*) &export_vars.innodb_ibuf_free_list, SHOW_LONG},
+ {"ibuf_merged_delete_marks",
+ (char*) &export_vars.innodb_ibuf_merged_delete_marks, SHOW_LONG},
+ {"ibuf_merged_deletes",
+ (char*) &export_vars.innodb_ibuf_merged_deletes, SHOW_LONG},
+ {"ibuf_merged_inserts",
+ (char*) &export_vars.innodb_ibuf_merged_inserts, SHOW_LONG},
+ {"ibuf_merges",
+ (char*) &export_vars.innodb_ibuf_merges, SHOW_LONG},
+ {"ibuf_segment_size",
+ (char*) &export_vars.innodb_ibuf_segment_size, SHOW_LONG},
+ {"ibuf_size",
+ (char*) &export_vars.innodb_ibuf_size, SHOW_LONG},
{"log_waits",
(char*) &export_vars.innodb_log_waits, SHOW_LONG},
{"log_write_requests",
(char*) &export_vars.innodb_log_write_requests, SHOW_LONG},
{"log_writes",
(char*) &export_vars.innodb_log_writes, SHOW_LONG},
+ {"lsn_current",
+ (char*) &export_vars.innodb_lsn_current, SHOW_LONGLONG},
+ {"lsn_flushed",
+ (char*) &export_vars.innodb_lsn_flushed, SHOW_LONGLONG},
+ {"lsn_last_checkpoint",
+ (char*) &export_vars.innodb_lsn_last_checkpoint, SHOW_LONGLONG},
+ {"master_thread_1_second_loops",
+ (char*) &export_vars.innodb_master_thread_1_second_loops, SHOW_LONG},
+ {"master_thread_10_second_loops",
+ (char*) &export_vars.innodb_master_thread_10_second_loops, SHOW_LONG},
+ {"master_thread_background_loops",
+ (char*) &export_vars.innodb_master_thread_background_loops, SHOW_LONG},
+ {"master_thread_main_flush_loops",
+ (char*) &export_vars.innodb_master_thread_main_flush_loops, SHOW_LONG},
+ {"master_thread_sleeps",
+ (char*) &export_vars.innodb_master_thread_sleeps, SHOW_LONG},
+ {"max_trx_id",
+ (char*) &export_vars.innodb_max_trx_id, SHOW_LONGLONG},
+ {"mem_adaptive_hash",
+ (char*) &export_vars.innodb_mem_adaptive_hash, SHOW_LONG},
+ {"mem_dictionary",
+ (char*) &export_vars.innodb_mem_dictionary, SHOW_LONG},
+ {"mem_total",
+ (char*) &export_vars.innodb_mem_total, SHOW_LONG},
+ {"mutex_os_waits",
+ (char*) &export_vars.innodb_mutex_os_waits, SHOW_LONGLONG},
+ {"mutex_spin_rounds",
+ (char*) &export_vars.innodb_mutex_spin_rounds, SHOW_LONGLONG},
+ {"mutex_spin_waits",
+ (char*) &export_vars.innodb_mutex_spin_waits, SHOW_LONGLONG},
+ {"oldest_view_low_limit_trx_id",
+ (char*) &export_vars.innodb_oldest_view_low_limit_trx_id, SHOW_LONGLONG},
{"os_log_fsyncs",
(char*) &export_vars.innodb_os_log_fsyncs, SHOW_LONG},
{"os_log_pending_fsyncs",
@@ -582,8 +795,14 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_pages_read, SHOW_LONG},
{"pages_written",
(char*) &export_vars.innodb_pages_written, SHOW_LONG},
+ {"purge_trx_id",
+ (char*) &export_vars.innodb_purge_trx_id, SHOW_LONGLONG},
+ {"purge_undo_no",
+ (char*) &export_vars.innodb_purge_undo_no, SHOW_LONGLONG},
{"row_lock_current_waits",
(char*) &export_vars.innodb_row_lock_current_waits, SHOW_LONG},
+ {"current_row_locks",
+ (char*) &export_vars.innodb_current_row_locks, SHOW_LONG},
{"row_lock_time",
(char*) &export_vars.innodb_row_lock_time, SHOW_LONGLONG},
{"row_lock_time_avg",
@@ -600,6 +819,20 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_rows_read, SHOW_LONG},
{"rows_updated",
(char*) &export_vars.innodb_rows_updated, SHOW_LONG},
+ {"s_lock_os_waits",
+ (char*) &export_vars.innodb_s_lock_os_waits, SHOW_LONGLONG},
+ {"s_lock_spin_rounds",
+ (char*) &export_vars.innodb_s_lock_spin_rounds, SHOW_LONGLONG},
+ {"s_lock_spin_waits",
+ (char*) &export_vars.innodb_s_lock_spin_waits, SHOW_LONGLONG},
+ {"truncated_status_writes",
+ (char*) &export_vars.innodb_truncated_status_writes, SHOW_LONG},
+ {"x_lock_os_waits",
+ (char*) &export_vars.innodb_x_lock_os_waits, SHOW_LONGLONG},
+ {"x_lock_spin_rounds",
+ (char*) &export_vars.innodb_x_lock_spin_rounds, SHOW_LONGLONG},
+ {"x_lock_spin_waits",
+ (char*) &export_vars.innodb_x_lock_spin_waits, SHOW_LONGLONG},
{NullS, NullS, SHOW_LONG}
};
@@ -734,14 +967,28 @@ thd_lock_wait_timeout(
}
/******************************************************************//**
+Set the time waited for the lock for the current query. */
+extern "C" UNIV_INTERN
+void
+thd_set_lock_wait_time(
+/*===================*/
+ void* thd, /*!< in: thread handle (THD*) */
+ ulint value) /*!< in: time waited for the lock */
+{
+ if (thd) {
+ thd_storage_lock_wait((THD*)thd, value);
+ }
+}
+
+/******************************************************************//**
*/
extern "C" UNIV_INTERN
ulong
-thd_flush_log_at_trx_commit_session(
+thd_flush_log_at_trx_commit(
/*================================*/
void* thd)
{
- return(THDVAR((THD*) thd, flush_log_at_trx_commit_session));
+ return(THDVAR((THD*) thd, flush_log_at_trx_commit));
}
/********************************************************************//**
@@ -812,7 +1059,7 @@ int
convert_error_code_to_mysql(
/*========================*/
int error, /*!< in: InnoDB error code */
- ulint flags, /*!< in: InnoDB table flags, or 0 */
+ ulint flags, /*!< in: InnoDB table flags, or 0 */
THD* thd) /*!< in: user thread handle or NULL */
{
switch (error) {
@@ -887,6 +1134,8 @@ convert_error_code_to_mysql(
return(HA_ERR_ROW_IS_REFERENCED);
case DB_CANNOT_ADD_CONSTRAINT:
+ case DB_CHILD_NO_INDEX:
+ case DB_PARENT_NO_INDEX:
return(HA_ERR_CANNOT_ADD_FOREIGN);
case DB_CANNOT_DROP_CONSTRAINT:
@@ -914,6 +1163,11 @@ convert_error_code_to_mysql(
& DICT_TF_COMPACT) / 2);
return(HA_ERR_TO_BIG_ROW);
+ case DB_TOO_BIG_INDEX_COL:
+ my_error(ER_INDEX_COLUMN_TOO_LONG, MYF(0),
+ DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(flags));
+ return(HA_ERR_INDEX_COL_TOO_LONG);
+
case DB_NO_SAVEPOINT:
return(HA_ERR_NO_SAVEPOINT);
@@ -982,6 +1236,8 @@ innobase_get_cset_width(
if (cs) {
*mbminlen = cs->mbminlen;
*mbmaxlen = cs->mbmaxlen;
+ ut_ad(*mbminlen < DATA_MBMAX);
+ ut_ad(*mbmaxlen < DATA_MBMAX);
} else {
THD* thd = current_thd;
@@ -1050,6 +1306,20 @@ innobase_strcasecmp(
}
/******************************************************************//**
+Strip dir name from a full path name and return only the file name
+@return file name or "null" if no file name */
+extern "C" UNIV_INTERN
+const char*
+innobase_basename(
+/*==============*/
+ const char* path_name) /*!< in: full path name */
+{
+ const char* name = base_name(path_name);
+
+ return((name) ? name : "null");
+}
+
+/******************************************************************//**
Makes all characters in a NUL-terminated UTF-8 string lower case. */
extern "C" UNIV_INTERN
void
@@ -1082,17 +1352,25 @@ innobase_get_stmt(
void* mysql_thd, /*!< in: MySQL thread handle */
size_t* length) /*!< out: length of the SQL statement */
{
-#if MYSQL_VERSION_ID >= 50142
LEX_STRING* stmt;
stmt = thd_query_string((THD*) mysql_thd);
*length = stmt->length;
return(stmt->str);
-#else
- const char* stmt_str = thd_query((THD*) mysql_thd);
- *length = strlen(stmt_str);
- return(stmt_str);
-#endif
+}
+
+/**********************************************************************//**
+Get the current setting of the lower_case_table_names global parameter from
+mysqld.cc. We do a dirty read because for one there is no synchronization
+object and secondly there is little harm in doing so even if we get a torn
+read.
+@return value of lower_case_table_names */
+extern "C" UNIV_INTERN
+ulint
+innobase_get_lower_case_table_names(void)
+/*=====================================*/
+{
+ return(lower_case_table_names);
}
#if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN)
@@ -1208,7 +1486,29 @@ innobase_mysql_tmpfile(void)
will be passed to fdopen(), it will be closed by invoking
fclose(), which in turn will invoke close() instead of
my_close(). */
+
+#ifdef _WIN32
+ /* Note that on Windows, the integer returned by mysql_tmpfile
+ has no relation to C runtime file descriptor. Here, we need
+ to call my_get_osfhandle to get the HANDLE and then convert it
+ to C runtime filedescriptor. */
+ {
+ HANDLE hFile = my_get_osfhandle(fd);
+ HANDLE hDup;
+ BOOL bOK =
+ DuplicateHandle(GetCurrentProcess(), hFile, GetCurrentProcess(),
+ &hDup, 0, FALSE, DUPLICATE_SAME_ACCESS);
+ if(bOK) {
+ fd2 = _open_osfhandle((intptr_t)hDup,0);
+ }
+ else {
+ my_osmaperr(GetLastError());
+ fd2 = -1;
+ }
+ }
+#else
fd2 = dup(fd);
+#endif
if (fd2 < 0) {
DBUG_PRINT("error",("Got error %d on dup",fd2));
my_errno=errno;
@@ -1426,7 +1726,7 @@ Gets the InnoDB transaction handle for a MySQL handler object, creates
an InnoDB transaction struct if the corresponding MySQL thread struct still
lacks one.
@return InnoDB transaction handle */
-static
+static inline
trx_t*
check_trx_exists(
/*=============*/
@@ -1448,7 +1748,6 @@ check_trx_exists(
return(trx);
}
-
/*************************************************************************
Gets current trx. */
extern "C"
@@ -1476,6 +1775,78 @@ innobase_get_slow_log()
}
/*********************************************************************//**
+Note that a transaction has been registered with MySQL.
+@return true if transaction is registered with MySQL 2PC coordinator */
+static inline
+bool
+trx_is_registered_for_2pc(
+/*=========================*/
+ const trx_t* trx) /* in: transaction */
+{
+ return(trx->is_registered == 1);
+}
+
+/*********************************************************************//**
+Note that a transaction owns the prepare_commit_mutex. */
+static inline
+void
+trx_owns_prepare_commit_mutex_set(
+/*==============================*/
+ trx_t* trx) /* in: transaction */
+{
+ ut_a(trx_is_registered_for_2pc(trx));
+ trx->owns_prepare_mutex = 1;
+}
+
+/*********************************************************************//**
+Note that a transaction has been registered with MySQL 2PC coordinator. */
+static inline
+void
+trx_register_for_2pc(
+/*==================*/
+ trx_t* trx) /* in: transaction */
+{
+ trx->is_registered = 1;
+ ut_ad(trx->owns_prepare_mutex == 0);
+}
+
+/*********************************************************************//**
+Note that a transaction has been deregistered. */
+static inline
+void
+trx_deregister_from_2pc(
+/*====================*/
+ trx_t* trx) /* in: transaction */
+{
+ trx->is_registered = 0;
+ trx->owns_prepare_mutex = 0;
+}
+
+/*********************************************************************//**
+Check whether atransaction owns the prepare_commit_mutex.
+@return true if transaction owns the prepare commit mutex */
+static inline
+bool
+trx_has_prepare_commit_mutex(
+/*=========================*/
+ const trx_t* trx) /* in: transaction */
+{
+ return(trx->owns_prepare_mutex == 1);
+}
+
+/*********************************************************************//**
+Check if transaction is started.
+@reutrn true if transaction is in state started */
+static
+bool
+trx_is_started(
+/*===========*/
+ trx_t* trx) /* in: transaction */
+{
+ return(trx->conc_state != TRX_NOT_STARTED);
+}
+
+/*********************************************************************//**
Construct ha_innobase handler. */
UNIV_INTERN
ha_innobase::ha_innobase(handlerton *hton, TABLE_SHARE *table_arg)
@@ -1537,48 +1908,31 @@ ha_innobase::update_thd()
}
/*********************************************************************//**
-Registers that InnoDB takes part in an SQL statement, so that MySQL knows to
-roll back the statement if the statement results in an error. This MUST be
-called for every SQL statement that may be rolled back by MySQL. Calling this
-several times to register the same statement is allowed, too. */
+Registers an InnoDB transaction with the MySQL 2PC coordinator, so that
+the MySQL XA code knows to call the InnoDB prepare and commit, or rollback
+for the transaction. This MUST be called for every transaction for which
+the user may call commit or rollback. Calling this several times to register
+the same transaction is allowed, too. This function also registers the
+current SQL statement. */
static inline
void
-innobase_register_stmt(
-/*===================*/
- handlerton* hton, /*!< in: Innobase hton */
- THD* thd) /*!< in: MySQL thd (connection) object */
+innobase_register_trx(
+/*==================*/
+ handlerton* hton, /* in: Innobase handlerton */
+ THD* thd, /* in: MySQL thd (connection) object */
+ trx_t* trx) /* in: transaction to register */
{
- DBUG_ASSERT(hton == innodb_hton_ptr);
- /* Register the statement */
trans_register_ha(thd, FALSE, hton);
-}
-/*********************************************************************//**
-Registers an InnoDB transaction in MySQL, so that the MySQL XA code knows
-to call the InnoDB prepare and commit, or rollback for the transaction. This
-MUST be called for every transaction for which the user may call commit or
-rollback. Calling this several times to register the same transaction is
-allowed, too.
-This function also registers the current SQL statement. */
-static inline
-void
-innobase_register_trx_and_stmt(
-/*===========================*/
- handlerton *hton, /*!< in: Innobase handlerton */
- THD* thd) /*!< in: MySQL thd (connection) object */
-{
- /* NOTE that actually innobase_register_stmt() registers also
- the transaction in the AUTOCOMMIT=1 mode. */
+ if (!trx_is_registered_for_2pc(trx)
+ && thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
- innobase_register_stmt(hton, thd);
-
- if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
-
- /* No autocommit mode, register for a transaction */
trans_register_ha(thd, TRUE, hton);
}
-}
+ trx_register_for_2pc(trx);
+}
+
/* BACKGROUND INFO: HOW THE MYSQL QUERY CACHE WORKS WITH INNODB
------------------------------------------------------------
@@ -1724,14 +2078,8 @@ innobase_query_caching_of_table_permitted(
#ifdef __WIN__
innobase_casedn_str(norm_name);
#endif
- /* The call of row_search_.. will start a new transaction if it is
- not yet started */
-
- if (trx->active_trans == 0) {
- innobase_register_trx_and_stmt(innodb_hton_ptr, thd);
- trx->active_trans = 1;
- }
+ innobase_register_trx(innodb_hton_ptr, thd, trx);
if (row_search_check_if_query_cache_permitted(trx, norm_name)) {
@@ -1791,11 +2139,7 @@ innobase_convert_identifier(
FALSE=id is an UTF-8 string */
{
char nz[NAME_LEN + 1];
-#if MYSQL_VERSION_ID >= 50141
char nz2[NAME_LEN + 1 + EXPLAIN_FILENAME_MAX_EXTRA_LENGTH];
-#else /* MYSQL_VERSION_ID >= 50141 */
- char nz2[NAME_LEN + 1 + sizeof srv_mysql50_table_name_prefix];
-#endif /* MYSQL_VERSION_ID >= 50141 */
const char* s = id;
int q;
@@ -1813,13 +2157,9 @@ innobase_convert_identifier(
nz[idlen] = 0;
s = nz2;
-#if MYSQL_VERSION_ID >= 50141
idlen = explain_filename((THD*) thd, nz, nz2, sizeof nz2,
EXPLAIN_PARTITIONS_AS_COMMENT);
goto no_quote;
-#else /* MYSQL_VERSION_ID >= 50141 */
- idlen = filename_to_tablename(nz, nz2, sizeof nz2);
-#endif /* MYSQL_VERSION_ID >= 50141 */
}
/* See if the identifier needs to be quoted. */
@@ -1830,9 +2170,7 @@ innobase_convert_identifier(
}
if (q == EOF) {
-#if MYSQL_VERSION_ID >= 50141
no_quote:
-#endif /* MYSQL_VERSION_ID >= 50141 */
if (UNIV_UNLIKELY(idlen > buflen)) {
idlen = buflen;
}
@@ -1998,14 +2336,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
trx_assign_read_view(prebuilt->trx);
- /* Set the MySQL flag to mark that there is an active transaction */
-
- if (prebuilt->trx->active_trans == 0) {
-
- innobase_register_trx_and_stmt(ht, user_thd);
-
- prebuilt->trx->active_trans = 1;
- }
+ innobase_register_trx(ht, user_thd, prebuilt->trx);
/* We did the necessary inits in this function, no need to repeat them
in row_search_for_mysql */
@@ -2076,13 +2407,13 @@ innobase_init(
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
-#ifdef UNIV_DEBUG
+#ifndef DBUG_OFF
static const char test_filename[] = "-@";
char test_tablename[sizeof test_filename
+ sizeof srv_mysql50_table_name_prefix];
if ((sizeof test_tablename) - 1
!= filename_to_tablename(test_filename, test_tablename,
- sizeof test_tablename)
+ sizeof test_tablename, true)
|| strncmp(test_tablename,
srv_mysql50_table_name_prefix,
sizeof srv_mysql50_table_name_prefix)
@@ -2092,7 +2423,7 @@ innobase_init(
sql_print_error("tablename encoding has been changed");
goto error;
}
-#endif /* UNIV_DEBUG */
+#endif /* DBUG_OFF */
srv_page_size = 0;
srv_page_size_shift = 0;
@@ -2119,11 +2450,40 @@ innobase_init(
if (!srv_page_size_shift) {
fprintf(stderr,
- "InnoDB: Error: %lu is not valid value for innodb_page_size.\n",
+ "InnoDB: Error: %lu is not a valid value for innodb_page_size.\n"
+ "InnoDB: Error: Valid values are 4096, 8192, and 16384 (default=16384).\n",
innobase_page_size);
goto error;
}
+ srv_log_block_size = 0;
+ if (innobase_log_block_size != (1 << 9)) { /*!=512*/
+ uint n_shift;
+
+ fprintf(stderr,
+ "InnoDB: Warning: innodb_log_block_size has been changed from default value 512. (###EXPERIMENTAL### operation)\n");
+ for (n_shift = 9; n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX; n_shift++) {
+ if (innobase_log_block_size == ((ulong)1 << n_shift)) {
+ srv_log_block_size = (1 << n_shift);
+ fprintf(stderr,
+ "InnoDB: The log block size is set to %lu.\n",
+ srv_log_block_size);
+ break;
+ }
+ }
+ } else {
+ srv_log_block_size = 512;
+ }
+
+ if (!srv_log_block_size) {
+ fprintf(stderr,
+ "InnoDB: Error: %lu is not a valid value for innodb_log_block_size.\n"
+ "InnoDB: Error: A valid value for innodb_log_block_size is\n"
+ "InnoDB: Error: a power of 2 from 512 to 16384.\n",
+ innobase_log_block_size);
+ goto error;
+ }
+
#ifndef MYSQL_SERVER
innodb_overwrite_relay_log_info = FALSE;
#endif
@@ -2142,7 +2502,7 @@ innobase_init(
fprintf(stderr,
"InnoDB: Warning: innodb_overwrite_relay_log_info is enabled."
- " Updates in other storage engines may have problem with consistency.\n");
+ " Updates by other storage engines may not be synchronized.\n");
bzero((char*) &info_file, sizeof(info_file));
fn_format(fname, relay_log_info_file, mysql_data_home, "", 4+32);
@@ -2247,13 +2607,6 @@ skip_relay:
ut_a(default_path);
- if (specialflag & SPECIAL_NO_PRIOR) {
- srv_set_thread_priorities = FALSE;
- } else {
- srv_set_thread_priorities = TRUE;
- srv_query_thread_priority = QUERY_PRIOR;
- }
-
/* Set InnoDB initialization parameters according to the values
read from MySQL .cnf file */
@@ -2291,8 +2644,6 @@ mem_free_and_error:
srv_doublewrite_file = innobase_doublewrite_file;
- srv_extra_undoslots = (ibool) innobase_extra_undoslots;
-
srv_use_sys_stats_table = (ibool) innobase_use_sys_stats_table;
/* -------------- Log files ---------------------------*/
@@ -2348,32 +2699,35 @@ mem_free_and_error:
innobase_file_format_name is used in the MySQL set variable
interface and so can't be const. */
- innobase_file_format_name =
+ innobase_file_format_name =
(char*) trx_sys_file_format_id_to_name(format_id);
- /* Process innobase_file_format_check variable */
- ut_a(innobase_file_format_check != NULL);
+ /* Check innobase_file_format_check variable */
+ if (!innobase_file_format_check) {
+
+ /* Set the value to disable checking. */
+ srv_max_file_format_at_startup = DICT_TF_FORMAT_MAX + 1;
- /* As a side effect it will set srv_check_file_format_at_startup
- on valid input. First we check for "on"/"off". */
- if (!innobase_file_format_check_on_off(innobase_file_format_check)) {
+ } else {
- /* Did the user specify a format name that we support ?
- As a side effect it will update the variable
- srv_check_file_format_at_startup */
- if (innobase_file_format_validate_and_set(
- innobase_file_format_check) < 0) {
+ /* Set the value to the lowest supported format. */
+ srv_max_file_format_at_startup = DICT_TF_FORMAT_MIN;
+ }
- sql_print_error("InnoDB: invalid "
- "innodb_file_format_check value: "
- "should be either 'on' or 'off' or "
- "any value up to %s or its "
- "equivalent numeric id",
- trx_sys_file_format_id_to_name(
- DICT_TF_FORMAT_MAX));
+ /* Did the user specify a format name that we support?
+ As a side effect it will update the variable
+ srv_max_file_format_at_startup */
+ if (innobase_file_format_validate_and_set(
+ innobase_file_format_max) < 0) {
- goto mem_free_and_error;
- }
+ sql_print_error("InnoDB: invalid "
+ "innodb_file_format_max value: "
+ "should be any value up to %s or its "
+ "equivalent numeric id",
+ trx_sys_file_format_id_to_name(
+ DICT_TF_FORMAT_MAX));
+
+ goto mem_free_and_error;
}
if (innobase_change_buffering) {
@@ -2418,6 +2772,13 @@ innobase_change_buffering_inited_ok:
srv_log_buffer_size = (ulint) innobase_log_buffer_size;
srv_buf_pool_size = (ulint) innobase_buffer_pool_size;
+ srv_buf_pool_instances = (ulint) innobase_buffer_pool_instances;
+
+ if (innobase_buffer_pool_shm_key) {
+ fprintf(stderr,
+ "InnoDB: Warning: innodb_buffer_pool_shm_key is deprecated function.\n"
+ "InnoDB: innodb_buffer_pool_shm_key was ignored.\n");
+ }
srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
@@ -2426,7 +2787,7 @@ innobase_change_buffering_inited_ok:
srv_n_write_io_threads = (ulint) innobase_write_io_threads;
srv_read_ahead &= 3;
- srv_adaptive_checkpoint %= 3;
+ srv_adaptive_flushing_method %= 3;
srv_force_recovery = (ulint) innobase_force_recovery;
@@ -2435,7 +2796,6 @@ innobase_change_buffering_inited_ok:
srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
srv_use_checksums = (ibool) innobase_use_checksums;
srv_fast_checksum = (ibool) innobase_fast_checksum;
- srv_buffer_pool_shm_checksum = (ibool) innobase_buffer_pool_shm_checksum;
#ifdef HAVE_LARGE_PAGES
if ((os_use_large_pages = (ibool) my_use_large_pages))
@@ -2468,11 +2828,47 @@ innobase_change_buffering_inited_ok:
ut_a(0 == strcmp(my_charset_latin1.name, "latin1_swedish_ci"));
srv_latin1_ordering = my_charset_latin1.sort_order;
- innobase_old_blocks_pct = buf_LRU_old_ratio_update(
- innobase_old_blocks_pct, FALSE);
-
innobase_commit_concurrency_init_default();
+#ifdef HAVE_PSI_INTERFACE
+ /* Register keys with MySQL performance schema */
+ if (PSI_server) {
+ int count;
+
+ count = array_elements(all_pthread_mutexes);
+ PSI_server->register_mutex("innodb",
+ all_pthread_mutexes, count);
+
+# ifdef UNIV_PFS_MUTEX
+ count = array_elements(all_innodb_mutexes);
+ PSI_server->register_mutex("innodb",
+ all_innodb_mutexes, count);
+# endif /* UNIV_PFS_MUTEX */
+
+# ifdef UNIV_PFS_RWLOCK
+ count = array_elements(all_innodb_rwlocks);
+ PSI_server->register_rwlock("innodb",
+ all_innodb_rwlocks, count);
+# endif /* UNIV_PFS_MUTEX */
+
+# ifdef UNIV_PFS_THREAD
+ count = array_elements(all_innodb_threads);
+ PSI_server->register_thread("innodb",
+ all_innodb_threads, count);
+# endif /* UNIV_PFS_THREAD */
+
+# ifdef UNIV_PFS_IO
+ count = array_elements(all_innodb_files);
+ PSI_server->register_file("innodb",
+ all_innodb_files, count);
+# endif /* UNIV_PFS_IO */
+
+ count = array_elements(all_innodb_conds);
+ PSI_server->register_cond("innodb",
+ all_innodb_conds, count);
+ }
+#endif /* HAVE_PSI_INTERFACE */
+
/* Since we in this module access directly the fields of a trx
struct, and due to different headers and flags it might happen that
mutex_t has a different size in this module and in InnoDB
@@ -2491,7 +2887,7 @@ innobase_change_buffering_inited_ok:
/* If InnoDB progressed from relay-log.info, overwrite it */
if (fname[0] == '\0') {
fprintf(stderr,
- "InnoDB: something wrong with relay-info.log. InnoDB will not overwrite it.\n");
+ "InnoDB: Something is wrong with the file relay-info.log. InnoDB will not overwrite it.\n");
} else if (0 != strcmp(fname, trx_sys_mysql_master_log_name)
|| pos != trx_sys_mysql_master_log_pos) {
/* Overwrite relay-log.info */
@@ -2542,10 +2938,10 @@ innobase_change_buffering_inited_ok:
skip_overwrite:
if (error) {
fprintf(stderr,
- "InnoDB: ERROR: error occured during overwriting relay-log.info.\n");
+ "InnoDB: ERROR: An error occurred while overwriting relay-log.info.\n");
} else {
fprintf(stderr,
- "InnoDB: relay-log.info was overwritten.\n");
+ "InnoDB: The file relay-log.info was successfully overwritten.\n");
}
} else {
fprintf(stderr,
@@ -2555,12 +2951,20 @@ skip_overwrite:
#endif /* MYSQL_SERVER */
#endif /* HAVE_REPLICATION */
+ innobase_old_blocks_pct = buf_LRU_old_ratio_update(
+ innobase_old_blocks_pct, TRUE);
+
innobase_open_tables = hash_create(200);
- pthread_mutex_init(&innobase_share_mutex, MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST);
- pthread_cond_init(&commit_cond, NULL);
+ mysql_mutex_init(innobase_share_mutex_key,
+ &innobase_share_mutex,
+ MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(prepare_commit_mutex_key,
+ &prepare_commit_mutex, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(commit_threads_m_key,
+ &commit_threads_m, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(commit_cond_mutex_key,
+ &commit_cond_m, MY_MUTEX_INIT_FAST);
+ mysql_cond_init(commit_cond_key, &commit_cond, NULL);
innodb_inited= 1;
#ifdef MYSQL_DYNAMIC_PLUGIN
if (innobase_hton != p) {
@@ -2570,7 +2974,7 @@ skip_overwrite:
#endif /* MYSQL_DYNAMIC_PLUGIN */
/* Get the current high water mark format. */
- innobase_file_format_check = (char*) trx_sys_file_format_max_get();
+ innobase_file_format_max = (char*) trx_sys_file_format_max_get();
btr_search_fully_disabled = (!btr_search_enabled);
DBUG_RETURN(FALSE);
@@ -2594,11 +2998,6 @@ innobase_end(
DBUG_ENTER("innobase_end");
DBUG_ASSERT(hton == innodb_hton_ptr);
-#ifdef __NETWARE__ /* some special cleanup for NetWare */
- if (nw_panic) {
- set_panic_flag_for_netware();
- }
-#endif
if (innodb_inited) {
srv_fast_shutdown = (ulint) innobase_fast_shutdown;
@@ -2610,11 +3009,11 @@ innobase_end(
}
srv_free_paths_and_sizes();
my_free(internal_innobase_data_file_path);
- pthread_mutex_destroy(&innobase_share_mutex);
- pthread_mutex_destroy(&prepare_commit_mutex);
- pthread_mutex_destroy(&commit_threads_m);
- pthread_mutex_destroy(&commit_cond_m);
- pthread_cond_destroy(&commit_cond);
+ mysql_mutex_destroy(&innobase_share_mutex);
+ mysql_mutex_destroy(&prepare_commit_mutex);
+ mysql_mutex_destroy(&commit_threads_m);
+ mysql_mutex_destroy(&commit_cond_m);
+ mysql_cond_destroy(&commit_cond);
}
DBUG_RETURN(err);
@@ -2648,11 +3047,13 @@ innobase_alter_table_flags(
/*=======================*/
uint flags)
{
- return(HA_ONLINE_ADD_INDEX_NO_WRITES
- | HA_ONLINE_DROP_INDEX_NO_WRITES
- | HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES
- | HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES
- | HA_ONLINE_ADD_PK_INDEX_NO_WRITES);
+ return(HA_INPLACE_ADD_INDEX_NO_READ_WRITE
+ | HA_INPLACE_ADD_INDEX_NO_WRITE
+ | HA_INPLACE_DROP_INDEX_NO_READ_WRITE
+ | HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE
+ | HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE
+ | HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE
+ | HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE);
}
/*****************************************************************//**
@@ -2663,34 +3064,31 @@ innobase_commit_low(
/*================*/
trx_t* trx) /*!< in: transaction handle */
{
- if (trx->conc_state == TRX_NOT_STARTED) {
-
- return;
- }
-
+ if (trx_is_started(trx)) {
#ifdef HAVE_REPLICATION
#ifdef MYSQL_SERVER
- THD *thd=current_thd;
+ THD *thd=current_thd;
- if (thd && thd->slave_thread) {
+ if (thd && thd->slave_thread) {
/* Update the replication position info inside InnoDB.
In embedded server, does nothing. */
- const char *log_file_name, *group_relay_log_name;
- ulonglong log_pos, relay_log_pos;
- bool res = rpl_get_position_info(&log_file_name, &log_pos,
- &group_relay_log_name,
- &relay_log_pos);
- if (res) {
- trx->mysql_master_log_file_name = log_file_name;
- trx->mysql_master_log_pos = (ib_int64_t)log_pos;
- trx->mysql_relay_log_file_name = group_relay_log_name;
- trx->mysql_relay_log_pos = (ib_int64_t)relay_log_pos;
+ const char *log_file_name, *group_relay_log_name;
+ ulonglong log_pos, relay_log_pos;
+ bool res = rpl_get_position_info(&log_file_name, &log_pos,
+ &group_relay_log_name,
+ &relay_log_pos);
+ if (res) {
+ trx->mysql_master_log_file_name = log_file_name;
+ trx->mysql_master_log_pos = (ib_int64_t)log_pos;
+ trx->mysql_relay_log_file_name = group_relay_log_name;
+ trx->mysql_relay_log_pos = (ib_int64_t)relay_log_pos;
+ }
}
- }
#endif /* MYSQL_SERVER */
#endif /* HAVE_REPLICATION */
- trx_commit_for_mysql(trx);
+ trx_commit_for_mysql(trx);
+ }
}
/*****************************************************************//**
@@ -2703,7 +3101,7 @@ static
int
innobase_start_trx_and_assign_read_view(
/*====================================*/
- handlerton *hton, /*!< in: Innodb handlerton */
+ handlerton *hton, /*!< in: Innodb handlerton */
THD* thd) /*!< in: MySQL thread handle of the user for whom
the transaction should be committed */
{
@@ -2732,10 +3130,7 @@ innobase_start_trx_and_assign_read_view(
/* Set the MySQL flag to mark that there is an active transaction */
- if (trx->active_trans == 0) {
- innobase_register_trx_and_stmt(hton, thd);
- trx->active_trans = 1;
- }
+ innobase_register_trx(hton, current_thd, trx);
DBUG_RETURN(0);
}
@@ -2748,7 +3143,7 @@ static
int
innobase_commit(
/*============*/
- handlerton *hton, /*!< in: Innodb handlerton */
+ handlerton *hton, /*!< in: Innodb handlerton */
THD* thd, /*!< in: MySQL thread handle of the user for whom
the transaction should be committed */
bool all) /*!< in: TRUE - commit transaction
@@ -2769,29 +3164,19 @@ innobase_commit(
trx_search_latch_release_if_reserved(trx);
}
- /* The flag trx->active_trans is set to 1 in
-
- 1. ::external_lock(),
- 2. ::start_stmt(),
- 3. innobase_query_caching_of_table_permitted(),
- 4. innobase_savepoint(),
- 5. ::init_table_handle_for_HANDLER(),
- 6. innobase_start_trx_and_assign_read_view(),
- 7. ::transactional_table_lock()
-
- and it is only set to 0 in a commit or a rollback. If it is 0 we know
- there cannot be resources to be freed and we could return immediately.
- For the time being, we play safe and do the cleanup though there should
- be nothing to clean up. */
+ /* Transaction is deregistered only in a commit or a rollback. If
+ it is deregistered we know there cannot be resources to be freed
+ and we could return immediately. For the time being, we play safe
+ and do the cleanup though there should be nothing to clean up. */
- if (trx->active_trans == 0
- && trx->conc_state != TRX_NOT_STARTED) {
+ if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) {
- sql_print_error("trx->active_trans == 0, but"
- " trx->conc_state != TRX_NOT_STARTED");
+ sql_print_error("Transaction not registered for MySQL 2PC, "
+ "but transaction is active");
}
+
if (all
- || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
+ || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
/* We were instructed to commit the whole transaction, or
this is an SQL statement end and autocommit is on */
@@ -2801,18 +3186,18 @@ innobase_commit(
prepare_commit_mutex */
retry:
if (innobase_commit_concurrency > 0) {
- pthread_mutex_lock(&commit_cond_m);
+ mysql_mutex_lock(&commit_cond_m);
commit_threads++;
if (commit_threads > innobase_commit_concurrency) {
commit_threads--;
- pthread_cond_wait(&commit_cond,
+ mysql_cond_wait(&commit_cond,
&commit_cond_m);
- pthread_mutex_unlock(&commit_cond_m);
+ mysql_mutex_unlock(&commit_cond_m);
goto retry;
}
else {
- pthread_mutex_unlock(&commit_cond_m);
+ mysql_mutex_unlock(&commit_cond_m);
}
}
@@ -2840,21 +3225,21 @@ retry:
trx->flush_log_later = FALSE;
if (innobase_commit_concurrency > 0) {
- pthread_mutex_lock(&commit_cond_m);
+ mysql_mutex_lock(&commit_cond_m);
commit_threads--;
- pthread_cond_signal(&commit_cond);
- pthread_mutex_unlock(&commit_cond_m);
+ mysql_cond_signal(&commit_cond);
+ mysql_mutex_unlock(&commit_cond_m);
}
- if (trx->active_trans == 2) {
-
- pthread_mutex_unlock(&prepare_commit_mutex);
- }
+ if (trx_has_prepare_commit_mutex(trx)) {
+
+ mysql_mutex_unlock(&prepare_commit_mutex);
+ }
+
+ trx_deregister_from_2pc(trx);
/* Now do a write + flush of logs. */
trx_commit_complete_for_mysql(trx);
- trx->active_trans = 0;
-
} else {
/* We just mark the SQL statement ended and do not do a
transaction commit */
@@ -2923,10 +3308,10 @@ innobase_rollback(
row_unlock_table_autoinc_for_mysql(trx);
if (all
- || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
+ || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
error = trx_rollback_for_mysql(trx);
- trx->active_trans = 0;
+ trx_deregister_from_2pc(trx);
} else {
error = trx_rollback_last_sql_stat_for_mysql(trx);
}
@@ -3069,8 +3454,8 @@ innobase_savepoint(
innobase_release_stat_resources(trx);
- /* cannot happen outside of transaction */
- DBUG_ASSERT(trx->active_trans);
+ /* Cannot happen outside of transaction */
+ DBUG_ASSERT(trx_is_registered_for_2pc(trx));
/* TODO: use provided savepoint data area to store savepoint data */
char name[64];
@@ -3100,26 +3485,24 @@ innobase_close_connection(
ut_a(trx);
- if (trx->active_trans == 0
- && trx->conc_state != TRX_NOT_STARTED) {
+ if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) {
- sql_print_error("trx->active_trans == 0, but"
- " trx->conc_state != TRX_NOT_STARTED");
+ sql_print_error("Transaction not registered for MySQL 2PC, "
+ "but transaction is active");
}
- if (trx->conc_state != TRX_NOT_STARTED &&
- global_system_variables.log_warnings) {
+ if (trx_is_started(trx) && global_system_variables.log_warnings) {
+
sql_print_warning(
"MySQL is closing a connection that has an active "
- "InnoDB transaction. %lu row modifications will "
+ "InnoDB transaction. %llu row modifications will "
"roll back.",
- (ulong) trx->undo_no.low);
+ (ullint) trx->undo_no);
}
innobase_rollback_trx(trx);
- thr_local_free(trx->mysql_thread_id);
trx_free_for_mysql(trx);
DBUG_RETURN(0);
@@ -3502,6 +3885,8 @@ innobase_build_index_translation(
DBUG_ENTER("innobase_build_index_translation");
+ mutex_enter(&dict_sys->mutex);
+
mysql_num_index = table->s->keys;
ib_num_index = UT_LIST_GET_LEN(ib_table->indexes);
@@ -3532,6 +3917,13 @@ innobase_build_index_translation(
MYF(MY_ALLOW_ZERO_PTR));
if (!index_mapping) {
+ /* Report an error if index_mapping continues to be
+ NULL and mysql_num_index is a non-zero value */
+ sql_print_error("InnoDB: fail to allocate memory for "
+ "index translation table. Number of "
+ "Index:%lu, array size:%lu",
+ mysql_num_index,
+ share->idx_trans_tbl.array_size);
ret = FALSE;
goto func_exit;
}
@@ -3539,7 +3931,6 @@ innobase_build_index_translation(
share->idx_trans_tbl.array_size = mysql_num_index;
}
-
/* For each index in the mysql key_info array, fetch its
corresponding InnoDB index pointer into index_mapping
array. */
@@ -3585,6 +3976,8 @@ func_exit:
share->idx_trans_tbl.index_mapping = index_mapping;
+ mutex_exit(&dict_sys->mutex);
+
DBUG_RETURN(ret);
}
@@ -3759,7 +4152,7 @@ ha_innobase::open(
DBUG_RETURN(1);
}
- if (share->ib_table && share->ib_table->is_corrupt) {
+ if (srv_pass_corrupt_table <= 1 && share->ib_table && share->ib_table->is_corrupt) {
free_share(share);
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
@@ -3792,7 +4185,7 @@ retry:
/* Get pointer to a table object in InnoDB dictionary cache */
ib_table = dict_table_get(norm_name, TRUE);
- if (ib_table && ib_table->is_corrupt) {
+ if (srv_pass_corrupt_table <= 1 && ib_table && ib_table->is_corrupt) {
free_share(share);
my_free(upd_buff);
@@ -3992,7 +4385,7 @@ retry:
space, if this table has higher file format setting. */
trx_sys_file_format_max_upgrade(
- (const char**) &innobase_file_format_check,
+ (const char**) &innobase_file_format_max,
dict_table_get_format(prebuilt->table));
}
@@ -4021,7 +4414,11 @@ UNIV_INTERN
uint
ha_innobase::max_supported_key_part_length() const
{
- return(DICT_MAX_INDEX_COL_LEN - 1);
+ /* A table format specific index column length check will be performed
+ at ha_innobase::add_index() and row_create_index_for_mysql() */
+ return(innobase_large_prefix
+ ? REC_VERSION_56_MAX_INDEX_COL_LEN
+ : REC_ANTELOPE_MAX_INDEX_COL_LEN - 1);
}
/******************************************************************//**
@@ -4598,15 +4995,14 @@ ha_innobase::store_key_val_for_row(
memcpy(buff, src_start, true_len);
buff += true_len;
- /* Pad the unused space with spaces. Note that no
- padding is ever needed for UCS-2 because in MySQL,
- all UCS2 characters are 2 bytes, as MySQL does not
- support surrogate pairs, which are needed to represent
- characters in the range U+10000 to U+10FFFF. */
+ /* Pad the unused space with spaces. */
if (true_len < key_len) {
- ulint pad_len = key_len - true_len;
- memset(buff, ' ', pad_len);
+ ulint pad_len = key_len - true_len;
+ ut_a(!(pad_len % cs->mbminlen));
+
+ cs->cset->fill(cs, buff, pad_len,
+ 0x20 /* space */);
buff += pad_len;
}
}
@@ -4729,6 +5125,7 @@ build_template(
/* Note that in InnoDB, i is the column number. MySQL calls columns
'fields'. */
for (sql_idx = 0; sql_idx < n_fields; sql_idx++) {
+ const dict_col_t* col = &index->table->cols[innodb_idx];
templ = prebuilt->mysql_template + n_requested_fields;
field = table->field[sql_idx];
if (!field->stored_in_db)
@@ -4782,17 +5179,18 @@ include_field:
n_requested_fields++;
templ->col_no = innodb_idx;
+ templ->clust_rec_field_no = dict_col_get_clust_pos(
+ col, clust_index);
+ ut_ad(templ->clust_rec_field_no != ULINT_UNDEFINED);
if (index == clust_index) {
- templ->rec_field_no = dict_col_get_clust_pos(
- &index->table->cols[innodb_idx], index);
+ templ->rec_field_no = templ->clust_rec_field_no;
} else {
templ->rec_field_no = dict_index_get_nth_col_pos(
index, innodb_idx);
- }
-
- if (templ->rec_field_no == ULINT_UNDEFINED) {
- prebuilt->need_to_access_clustered = TRUE;
+ if (templ->rec_field_no == ULINT_UNDEFINED) {
+ prebuilt->need_to_access_clustered = TRUE;
+ }
}
if (field->null_ptr) {
@@ -4814,7 +5212,7 @@ include_field:
mysql_prefix_len = templ->mysql_col_offset
+ templ->mysql_col_len;
}
- templ->type = index->table->cols[innodb_idx].mtype;
+ templ->type = col->mtype;
templ->mysql_type = (ulint)field->type();
if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR) {
@@ -4822,12 +5220,10 @@ include_field:
(((Field_varstring*)field)->length_bytes);
}
- templ->charset = dtype_get_charset_coll(
- index->table->cols[innodb_idx].prtype);
- templ->mbminlen = index->table->cols[innodb_idx].mbminlen;
- templ->mbmaxlen = index->table->cols[innodb_idx].mbmaxlen;
- templ->is_unsigned = index->table->cols[innodb_idx].prtype
- & DATA_UNSIGNED;
+ templ->charset = dtype_get_charset_coll(col->prtype);
+ templ->mbminlen = dict_col_get_mbminlen(col);
+ templ->mbmaxlen = dict_col_get_mbmaxlen(col);
+ templ->is_unsigned = col->prtype & DATA_UNSIGNED;
if (templ->type == DATA_BLOB) {
prebuilt->templ_contains_blob = TRUE;
}
@@ -4864,9 +5260,8 @@ skip_field:
for (ulint i = do_idx_cond_push? prebuilt->n_index_fields : 0;
i < n_requested_fields; i++) {
templ = prebuilt->mysql_template + i;
- templ->rec_field_no = dict_col_get_clust_pos(
- &index->table->cols[templ->col_no],
- clust_index);
+
+ templ->rec_field_no = templ->clust_rec_field_no;
}
}
}
@@ -5066,7 +5461,7 @@ no_commit:
/* Altering to InnoDB format */
innobase_commit(ht, user_thd, 1);
/* Note that this transaction is still active. */
- prebuilt->trx->active_trans = 1;
+ trx_register_for_2pc(prebuilt->trx);
/* We will need an IX lock on the destination table. */
prebuilt->sql_stat_start = TRUE;
} else {
@@ -5082,7 +5477,7 @@ no_commit:
locks, so they have to be acquired again. */
innobase_commit(ht, user_thd, 1);
/* Note that this transaction is still active. */
- prebuilt->trx->active_trans = 1;
+ trx_register_for_2pc(prebuilt->trx);
/* Re-acquire the table lock on the source table. */
row_lock_table_for_mysql(prebuilt, src_table, mode);
/* We will need an IX lock on the destination table. */
@@ -5811,7 +6206,7 @@ ha_innobase::index_read(
ha_statistic_increment(&SSV::ha_read_key_count);
- if (share->ib_table->is_corrupt) {
+ if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -5881,7 +6276,7 @@ ha_innobase::index_read(
ret = DB_UNSUPPORTED;
}
- if (share->ib_table->is_corrupt) {
+ if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -5889,6 +6284,11 @@ ha_innobase::index_read(
case DB_SUCCESS:
error = 0;
table->status = 0;
+#ifdef EXTENDED_FOR_USERSTAT
+ rows_read++;
+ if (active_index >= 0 && active_index < MAX_KEY)
+ index_rows_read[active_index]++;
+#endif
break;
case DB_RECORD_NOT_FOUND:
error = HA_ERR_KEY_NOT_FOUND;
@@ -5995,7 +6395,7 @@ ha_innobase::change_active_index(
{
DBUG_ENTER("change_active_index");
- if (share->ib_table->is_corrupt) {
+ if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -6090,7 +6490,7 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
- if (share->ib_table->is_corrupt) {
+ if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -6103,7 +6503,7 @@ ha_innobase::general_fetch(
innodb_srv_conc_exit_innodb(prebuilt->trx);
- if (share->ib_table->is_corrupt) {
+ if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -6444,9 +6844,16 @@ create_table_def(
DBUG_PRINT("enter", ("table_name: %s", table_name));
ut_a(trx->mysql_thd != NULL);
- if (IS_MAGIC_TABLE_AND_USER_DENIED_ACCESS(table_name,
- (THD*) trx->mysql_thd)) {
- DBUG_RETURN(HA_ERR_GENERIC);
+
+ /* MySQL does the name length check. But we do additional check
+ on the name length here */
+ if (strlen(table_name) > MAX_FULL_NAME_LEN) {
+ push_warning_printf(
+ (THD*) trx->mysql_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_TABLE_NAME,
+ "InnoDB: Table Name or Database Name is too long");
+
+ DBUG_RETURN(ER_TABLE_NAME);
}
n_cols = form->s->fields;
@@ -6733,6 +7140,60 @@ create_clustered_index_when_no_primary(
}
/*****************************************************************//**
+Return a display name for the row format
+@return row format name */
+UNIV_INTERN
+const char*
+get_row_format_name(
+/*================*/
+ enum row_type row_format) /*!< in: Row Format */
+{
+ switch (row_format) {
+ case ROW_TYPE_COMPACT:
+ return("COMPACT");
+ case ROW_TYPE_COMPRESSED:
+ return("COMPRESSED");
+ case ROW_TYPE_DYNAMIC:
+ return("DYNAMIC");
+ case ROW_TYPE_REDUNDANT:
+ return("REDUNDANT");
+ case ROW_TYPE_DEFAULT:
+ return("DEFAULT");
+ case ROW_TYPE_FIXED:
+ return("FIXED");
+ case ROW_TYPE_PAGE:
+ case ROW_TYPE_NOT_USED:
+ break;
+ }
+ return("NOT USED");
+}
+
+/** If file-per-table is missing, issue warning and set ret false */
+#define CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE \
+ if (!srv_file_per_table) { \
+ push_warning_printf( \
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN, \
+ ER_ILLEGAL_HA_CREATE_OPTION, \
+ "InnoDB: ROW_FORMAT=%s requires" \
+ " innodb_file_per_table.", \
+ get_row_format_name(row_format)); \
+ ret = FALSE; \
+ }
+
+/** If file-format is Antelope, issue warning and set ret false */
+#define CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE \
+ if (srv_file_format < DICT_TF_FORMAT_ZIP) { \
+ push_warning_printf( \
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN, \
+ ER_ILLEGAL_HA_CREATE_OPTION, \
+ "InnoDB: ROW_FORMAT=%s requires" \
+ " innodb_file_format > Antelope.", \
+ get_row_format_name(row_format)); \
+ ret = FALSE; \
+ }
+
+
+/*****************************************************************//**
Validates the create options. We may build on this function
in future. For now, it checks two specifiers:
KEY_BLOCK_SIZE and ROW_FORMAT
@@ -6747,9 +7208,9 @@ create_options_are_valid(
columns and indexes */
HA_CREATE_INFO* create_info) /*!< in: create info. */
{
- ibool kbs_specified = FALSE;
+ ibool kbs_specified = FALSE;
ibool ret = TRUE;
-
+ enum row_type row_format = form->s->row_type;
ut_ad(thd != NULL);
@@ -6761,10 +7222,8 @@ create_options_are_valid(
ut_ad(form != NULL);
ut_ad(create_info != NULL);
- /* First check if KEY_BLOCK_SIZE was specified. */
- if (create_info->key_block_size
- || (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) {
-
+ /* First check if a non-zero KEY_BLOCK_SIZE was specified. */
+ if (create_info->key_block_size) {
kbs_specified = TRUE;
switch (create_info->key_block_size) {
case 1:
@@ -6772,127 +7231,70 @@ create_options_are_valid(
case 4:
case 8:
case 16:
- /* Valid value. */
- break;
- default:
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: invalid"
- " KEY_BLOCK_SIZE = %lu."
- " Valid values are"
- " [1, 2, 4, 8, 16]",
- create_info->key_block_size);
- ret = FALSE;
- }
- }
-
- /* If KEY_BLOCK_SIZE was specified, check for its
- dependencies. */
- if (kbs_specified && !srv_file_per_table) {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: KEY_BLOCK_SIZE"
- " requires innodb_file_per_table.");
- ret = FALSE;
- }
-
- if (kbs_specified && srv_file_format < DICT_TF_FORMAT_ZIP) {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: KEY_BLOCK_SIZE"
- " requires innodb_file_format >"
- " Antelope.");
- ret = FALSE;
- }
-
- /* Now check for ROW_FORMAT specifier. */
- if (create_info->used_fields & HA_CREATE_USED_ROW_FORMAT) {
- switch (form->s->row_type) {
- const char* row_format_name;
- case ROW_TYPE_COMPRESSED:
- case ROW_TYPE_DYNAMIC:
- row_format_name
- = form->s->row_type == ROW_TYPE_COMPRESSED
- ? "COMPRESSED"
- : "DYNAMIC";
-
- /* These two ROW_FORMATs require
- srv_file_per_table and srv_file_format */
+ /* Valid KEY_BLOCK_SIZE, check its dependencies. */
if (!srv_file_per_table) {
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s"
- " requires innodb_file_per_table.",
- row_format_name);
- ret = FALSE;
-
+ "InnoDB: KEY_BLOCK_SIZE requires"
+ " innodb_file_per_table.");
+ ret = FALSE;
}
-
if (srv_file_format < DICT_TF_FORMAT_ZIP) {
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s"
- " requires innodb_file_format >"
- " Antelope.",
- row_format_name);
- ret = FALSE;
- }
-
- /* Cannot specify KEY_BLOCK_SIZE with
- ROW_FORMAT = DYNAMIC.
- However, we do allow COMPRESSED to be
- specified with KEY_BLOCK_SIZE. */
- if (kbs_specified
- && form->s->row_type == ROW_TYPE_DYNAMIC) {
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: cannot specify"
- " ROW_FORMAT = DYNAMIC with"
- " KEY_BLOCK_SIZE.");
+ "InnoDB: KEY_BLOCK_SIZE requires"
+ " innodb_file_format > Antelope.");
ret = FALSE;
}
-
break;
-
- case ROW_TYPE_REDUNDANT:
- case ROW_TYPE_COMPACT:
- case ROW_TYPE_DEFAULT:
- /* Default is COMPACT. */
- row_format_name
- = form->s->row_type == ROW_TYPE_REDUNDANT
- ? "REDUNDANT"
- : "COMPACT";
-
- /* Cannot specify KEY_BLOCK_SIZE with these
- format specifiers. */
- if (kbs_specified) {
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: cannot specify"
- " ROW_FORMAT = %s with"
- " KEY_BLOCK_SIZE.",
- row_format_name);
- ret = FALSE;
- }
-
- break;
-
default:
- push_warning(thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: invalid ROW_FORMAT specifier.");
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: invalid KEY_BLOCK_SIZE = %lu."
+ " Valid values are [1, 2, 4, 8, 16]",
+ create_info->key_block_size);
+ ret = FALSE;
+ break;
+ }
+ }
+
+ /* Check for a valid Innodb ROW_FORMAT specifier and
+ other incompatibilities. */
+ switch (row_format) {
+ case ROW_TYPE_COMPRESSED:
+ CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE;
+ CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE;
+ break;
+ case ROW_TYPE_DYNAMIC:
+ CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE;
+ CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE;
+ /* fall through since dynamic also shuns KBS */
+ case ROW_TYPE_COMPACT:
+ case ROW_TYPE_REDUNDANT:
+ if (kbs_specified) {
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: cannot specify ROW_FORMAT = %s"
+ " with KEY_BLOCK_SIZE.",
+ get_row_format_name(row_format));
ret = FALSE;
-
}
+ break;
+ case ROW_TYPE_DEFAULT:
+ break;
+ case ROW_TYPE_FIXED:
+ case ROW_TYPE_PAGE:
+ case ROW_TYPE_NOT_USED:
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION, \
+ "InnoDB: invalid ROW_FORMAT specifier.");
+ ret = FALSE;
+ break;
}
return(ret);
@@ -6942,7 +7344,7 @@ ha_innobase::create(
const ulint file_format = srv_file_format;
const char* stmt;
size_t stmt_len;
- enum row_type row_type;
+ enum row_type row_format;
DBUG_ENTER("ha_innobase::create");
@@ -6980,52 +7382,28 @@ ha_innobase::create(
DBUG_RETURN(HA_ERR_TO_BIG_ROW);
}
- /* Get the transaction associated with the current thd, or create one
- if not yet created */
-
- parent_trx = check_trx_exists(thd);
-
- /* In case MySQL calls this in the middle of a SELECT query, release
- possible adaptive hash latch to avoid deadlocks of threads */
-
- trx_search_latch_release_if_reserved(parent_trx);
-
- trx = innobase_trx_allocate(thd);
-
- if (lower_case_table_names) {
- srv_lower_case_table_names = TRUE;
- } else {
- srv_lower_case_table_names = FALSE;
- }
-
strcpy(name2, name);
normalize_table_name(norm_name, name2);
- /* Latch the InnoDB data dictionary exclusively so that no deadlocks
- or lock waits can happen in it during a table create operation.
- Drop table etc. do this latching in row0mysql.c. */
-
- row_mysql_lock_data_dictionary(trx);
-
/* Create the table definition in InnoDB */
flags = 0;
/* Validate create options if innodb_strict_mode is set. */
if (!create_options_are_valid(thd, form, create_info)) {
- error = ER_ILLEGAL_HA_CREATE_OPTION;
- goto cleanup;
+ DBUG_RETURN(ER_ILLEGAL_HA_CREATE_OPTION);
}
- if (create_info->key_block_size
- || (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) {
+ if (create_info->key_block_size) {
/* Determine the page_zip.ssize corresponding to the
requested page size (key_block_size) in kilobytes. */
ulint ssize, ksize;
ulint key_block_size = create_info->key_block_size;
+ /* Set 'flags' to the correct key_block_size.
+ It will be zero if key_block_size is an invalid number.*/
for (ssize = ksize = 1; ssize <= DICT_TF_ZSSIZE_MAX;
ssize++, ksize <<= 1) {
if (key_block_size == ksize) {
@@ -7038,40 +7416,40 @@ ha_innobase::create(
}
if (!srv_file_per_table) {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: KEY_BLOCK_SIZE"
- " requires innodb_file_per_table.");
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: KEY_BLOCK_SIZE requires"
+ " innodb_file_per_table.");
flags = 0;
}
if (file_format < DICT_TF_FORMAT_ZIP) {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: KEY_BLOCK_SIZE"
- " requires innodb_file_format >"
- " Antelope.");
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: KEY_BLOCK_SIZE requires"
+ " innodb_file_format > Antelope.");
flags = 0;
}
if (!flags) {
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ignoring"
- " KEY_BLOCK_SIZE=%lu.",
- create_info->key_block_size);
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ignoring KEY_BLOCK_SIZE=%lu.",
+ create_info->key_block_size);
}
}
- row_type = form->s->row_type;
+ row_format = form->s->row_type;
if (flags) {
- /* KEY_BLOCK_SIZE was specified. */
- if (!(create_info->used_fields & HA_CREATE_USED_ROW_FORMAT)) {
- /* ROW_FORMAT was not specified;
- default to ROW_FORMAT=COMPRESSED */
- row_type = ROW_TYPE_COMPRESSED;
- } else if (row_type != ROW_TYPE_COMPRESSED) {
+ /* if ROW_FORMAT is set to default,
+ automatically change it to COMPRESSED.*/
+ if (row_format == ROW_TYPE_DEFAULT) {
+ row_format = ROW_TYPE_COMPRESSED;
+ } else if (row_format != ROW_TYPE_COMPRESSED) {
/* ROW_FORMAT other than COMPRESSED
ignores KEY_BLOCK_SIZE. It does not
make sense to reject conflicting
@@ -7079,8 +7457,7 @@ ha_innobase::create(
such combinations can be obtained
with ALTER TABLE anyway. */
push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ignoring KEY_BLOCK_SIZE=%lu"
" unless ROW_FORMAT=COMPRESSED.",
@@ -7088,8 +7465,8 @@ ha_innobase::create(
flags = 0;
}
} else {
- /* No KEY_BLOCK_SIZE */
- if (row_type == ROW_TYPE_COMPRESSED) {
+ /* flags == 0 means no KEY_BLOCK_SIZE.*/
+ if (row_format == ROW_TYPE_COMPRESSED) {
/* ROW_FORMAT=COMPRESSED without
KEY_BLOCK_SIZE implies half the
maximum KEY_BLOCK_SIZE. */
@@ -7104,49 +7481,40 @@ ha_innobase::create(
}
}
- switch (row_type) {
- const char* row_format_name;
+ switch (row_format) {
case ROW_TYPE_REDUNDANT:
break;
case ROW_TYPE_COMPRESSED:
case ROW_TYPE_DYNAMIC:
- row_format_name
- = row_type == ROW_TYPE_COMPRESSED
- ? "COMPRESSED"
- : "DYNAMIC";
-
if (!srv_file_per_table) {
push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s"
- " requires innodb_file_per_table.",
- row_format_name);
+ "InnoDB: ROW_FORMAT=%s requires"
+ " innodb_file_per_table.",
+ get_row_format_name(row_format));
} else if (file_format < DICT_TF_FORMAT_ZIP) {
push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s"
- " requires innodb_file_format >"
- " Antelope.",
- row_format_name);
+ "InnoDB: ROW_FORMAT=%s requires"
+ " innodb_file_format > Antelope.",
+ get_row_format_name(row_format));
} else {
flags |= DICT_TF_COMPACT
- | (DICT_TF_FORMAT_ZIP
- << DICT_TF_FORMAT_SHIFT);
+ | (DICT_TF_FORMAT_ZIP
+ << DICT_TF_FORMAT_SHIFT);
break;
}
/* fall through */
case ROW_TYPE_NOT_USED:
case ROW_TYPE_FIXED:
- default:
- push_warning(thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: assuming ROW_FORMAT=COMPACT.");
+ case ROW_TYPE_PAGE:
+ push_warning(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: assuming ROW_FORMAT=COMPACT.");
case ROW_TYPE_DEFAULT:
case ROW_TYPE_COMPACT:
flags = DICT_TF_COMPACT;
@@ -7166,16 +7534,37 @@ ha_innobase::create(
/* Check for name conflicts (with reserved name) for
any user indices to be created. */
- if (innobase_index_name_is_reserved(trx, form->key_info,
+ if (innobase_index_name_is_reserved(thd, form->key_info,
form->s->keys)) {
- error = -1;
- goto cleanup;
+ DBUG_RETURN(-1);
+ }
+
+ if (IS_MAGIC_TABLE_AND_USER_DENIED_ACCESS(norm_name, thd)) {
+ DBUG_RETURN(HA_ERR_GENERIC);
}
if (create_info->options & HA_LEX_CREATE_TMP_TABLE) {
flags |= DICT_TF2_TEMPORARY << DICT_TF2_SHIFT;
}
+ /* Get the transaction associated with the current thd, or create one
+ if not yet created */
+
+ parent_trx = check_trx_exists(thd);
+
+ /* In case MySQL calls this in the middle of a SELECT query, release
+ possible adaptive hash latch to avoid deadlocks of threads */
+
+ trx_search_latch_release_if_reserved(parent_trx);
+
+ trx = innobase_trx_allocate(thd);
+
+ /* Latch the InnoDB data dictionary exclusively so that no deadlocks
+ or lock waits can happen in it during a table create operation.
+ Drop table etc. do this latching in row0mysql.c. */
+
+ row_mysql_lock_data_dictionary(trx);
+
error = create_table_def(trx, form, norm_name,
create_info->options & HA_LEX_CREATE_TMP_TABLE ? name2 : NULL,
flags);
@@ -7212,8 +7601,8 @@ ha_innobase::create(
if (i != (uint) primary_key_no) {
- if ((error = create_index(trx, form, flags, norm_name,
- i))) {
+ if ((error = create_index(trx, form, flags,
+ norm_name, i))) {
goto cleanup;
}
}
@@ -7226,6 +7615,29 @@ ha_innobase::create(
trx, stmt, stmt_len, norm_name,
create_info->options & HA_LEX_CREATE_TMP_TABLE);
+ switch (error) {
+
+ case DB_PARENT_NO_INDEX:
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ HA_ERR_CANNOT_ADD_FOREIGN,
+ "Create table '%s' with foreign key constraint"
+ " failed. There is no index in the referenced"
+ " table where the referenced columns appear"
+ " as the first columns.\n", norm_name);
+ break;
+
+ case DB_CHILD_NO_INDEX:
+ push_warning_printf(
+ thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ HA_ERR_CANNOT_ADD_FOREIGN,
+ "Create table '%s' with foreign key constraint"
+ " failed. There is no index in the referencing"
+ " table where referencing columns appear"
+ " as the first columns.\n", norm_name);
+ break;
+ }
+
error = convert_error_code_to_mysql(error, flags, NULL);
if (error) {
@@ -7252,7 +7664,7 @@ ha_innobase::create(
space, if this table has higher file format setting. */
trx_sys_file_format_max_upgrade(
- (const char**) &innobase_file_format_check,
+ (const char**) &innobase_file_format_max,
dict_table_get_format(innobase_table));
}
@@ -7260,23 +7672,25 @@ ha_innobase::create(
setup at this stage and so we use thd. */
/* We need to copy the AUTOINC value from the old table if
- this is an ALTER TABLE or CREATE INDEX because CREATE INDEX
- does a table copy too. */
+ this is an ALTER|OPTIMIZE TABLE or CREATE INDEX because CREATE INDEX
+ does a table copy too. If query was one of :
+
+ CREATE TABLE ...AUTO_INCREMENT = x; or
+ ALTER TABLE...AUTO_INCREMENT = x; or
+ OPTIMIZE TABLE t; or
+ CREATE INDEX x on t(...);
+
+ Find out a table definition from the dictionary and get
+ the current value of the auto increment field. Set a new
+ value to the auto increment field if the value is greater
+ than the maximum value in the column. */
if (((create_info->used_fields & HA_CREATE_USED_AUTO)
|| thd_sql_command(thd) == SQLCOM_ALTER_TABLE
+ || thd_sql_command(thd) == SQLCOM_OPTIMIZE
|| thd_sql_command(thd) == SQLCOM_CREATE_INDEX)
&& create_info->auto_increment_value > 0) {
- /* Query was one of :
- CREATE TABLE ...AUTO_INCREMENT = x; or
- ALTER TABLE...AUTO_INCREMENT = x; or
- CREATE INDEX x on t(...);
- Find out a table definition from the dictionary and get
- the current value of the auto increment field. Set a new
- value to the auto increment field if the value is greater
- than the maximum value in the column. */
-
auto_inc_value = create_info->auto_increment_value;
dict_table_autoinc_lock(innobase_table);
@@ -7329,6 +7743,14 @@ ha_innobase::discard_or_import_tablespace(
err = row_discard_tablespace_for_mysql(dict_table->name, trx);
} else {
err = row_import_tablespace_for_mysql(dict_table->name, trx);
+
+ /* in expanded import mode re-initialize auto_increment again */
+ if ((err == DB_SUCCESS) && srv_expand_import &&
+ (table->found_next_number_field != NULL)) {
+ dict_table_autoinc_lock(dict_table);
+ innobase_initialize_autoinc();
+ dict_table_autoinc_unlock(dict_table);
+ }
}
err = convert_error_code_to_mysql(err, dict_table->flags, NULL);
@@ -7341,26 +7763,18 @@ Deletes all rows of an InnoDB table.
@return error number */
UNIV_INTERN
int
-ha_innobase::delete_all_rows(void)
+ha_innobase::truncate(void)
/*==============================*/
{
int error;
- DBUG_ENTER("ha_innobase::delete_all_rows");
+ DBUG_ENTER("ha_innobase::truncate");
/* Get the transaction associated with the current thd, or create one
if not yet created, and update prebuilt->trx */
update_thd(ha_thd());
- if (thd_sql_command(user_thd) != SQLCOM_TRUNCATE) {
- fallback:
- /* We only handle TRUNCATE TABLE t as a special case.
- DELETE FROM t will have to use ha_innobase::delete_row(),
- because DELETE is transactional while TRUNCATE is not. */
- DBUG_RETURN(my_errno=HA_ERR_WRONG_COMMAND);
- }
-
if (share->ib_table->is_corrupt) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -7368,10 +7782,6 @@ ha_innobase::delete_all_rows(void)
/* Truncate the table in InnoDB */
error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx);
- if (error == DB_ERROR) {
- /* Cannot truncate; resort to ha_innobase::delete_row() */
- goto fallback;
- }
if (share->ib_table->is_corrupt) {
DBUG_RETURN(HA_ERR_CRASHED);
@@ -7425,12 +7835,6 @@ ha_innobase::delete_table(
trx = innobase_trx_allocate(thd);
- if (lower_case_table_names) {
- srv_lower_case_table_names = TRUE;
- } else {
- srv_lower_case_table_names = FALSE;
- }
-
name_len = strlen(name);
ut_a(name_len < 1000);
@@ -7476,7 +7880,6 @@ innobase_drop_database(
ulint len = 0;
trx_t* trx;
char* ptr;
- int error;
char* namebuf;
THD* thd = current_thd;
@@ -7519,7 +7922,7 @@ innobase_drop_database(
#else
trx = innobase_trx_allocate(thd);
#endif
- error = row_drop_database_for_mysql(namebuf, trx);
+ row_drop_database_for_mysql(namebuf, trx);
my_free(namebuf);
/* Flush the log to reduce probability that the .frm files and
@@ -7554,12 +7957,6 @@ innobase_rename_table(
char* norm_from;
DBUG_ENTER("innobase_rename_table");
- if (lower_case_table_names) {
- srv_lower_case_table_names = TRUE;
- } else {
- srv_lower_case_table_names = FALSE;
- }
-
// Magic number 64 arbitrary
norm_to = (char*) my_malloc(strlen(to) + 64, MYF(0));
norm_from = (char*) my_malloc(strlen(from) + 64, MYF(0));
@@ -7795,6 +8192,7 @@ ha_innobase::estimate_rows_upper_bound(void)
dict_index_t* index;
ulonglong estimate;
ulonglong local_data_file_length;
+ ulint stat_n_leaf_pages;
DBUG_ENTER("estimate_rows_upper_bound");
@@ -7814,10 +8212,12 @@ ha_innobase::estimate_rows_upper_bound(void)
index = dict_table_get_first_index(prebuilt->table);
- ut_a(index->stat_n_leaf_pages > 0);
+ stat_n_leaf_pages = index->stat_n_leaf_pages;
+
+ ut_a(stat_n_leaf_pages > 0);
local_data_file_length =
- ((ulonglong) index->stat_n_leaf_pages) * UNIV_PAGE_SIZE;
+ ((ulonglong) stat_n_leaf_pages) * UNIV_PAGE_SIZE;
/* Calculate a minimum length for a clustered index record and from
@@ -7923,10 +8323,7 @@ innobase_get_mysql_key_number_for_index(
const dict_index_t* ind;
unsigned int i;
- ut_ad(index);
- ut_ad(ib_table);
- ut_ad(table);
- ut_ad(share);
+ ut_a(index);
/* If index does not belong to the table of share structure. Search
index->table instead */
@@ -7964,29 +8361,91 @@ innobase_get_mysql_key_number_for_index(
/* If we do not have an "index translation table", or not able
to find the index in the translation table, we'll directly find
- matching index in the dict_index_t list */
+ matching index with information from mysql TABLE structure and
+ InnoDB dict_index_t list */
for (i = 0; i < table->s->keys; i++) {
ind = dict_table_get_index_on_name(
ib_table, table->key_info[i].name);
- if (index == ind) {
+ if (index == ind) {
return(i);
}
}
- sql_print_error("Cannot find matching index number for index %s "
- "in InnoDB index list.", index->name);
+ ut_error;
return(0);
}
+
+/*********************************************************************//**
+Calculate Record Per Key value. Need to exclude the NULL value if
+innodb_stats_method is set to "nulls_ignored"
+@return estimated record per key value */
+static
+ha_rows
+innodb_rec_per_key(
+/*===============*/
+ dict_index_t* index, /*!< in: dict_index_t structure */
+ ulint i, /*!< in: the column we are
+ calculating rec per key */
+ ha_rows records) /*!< in: estimated total records */
+{
+ ha_rows rec_per_key;
+
+ ut_ad(i < dict_index_get_n_unique(index));
+
+ /* Note the stat_n_diff_key_vals[] stores the diff value with
+ n-prefix indexing, so it is always stat_n_diff_key_vals[i + 1] */
+ if (index->stat_n_diff_key_vals[i + 1] == 0) {
+
+ rec_per_key = records;
+ } else if (srv_innodb_stats_method == SRV_STATS_NULLS_IGNORED) {
+ ib_int64_t num_null;
+
+ /* Number of rows with NULL value in this
+ field */
+ num_null = records - index->stat_n_non_null_key_vals[i];
+
+ /* In theory, index->stat_n_non_null_key_vals[i]
+ should always be less than the number of records.
+ Since this is statistics value, the value could
+ have slight discrepancy. But we will make sure
+ the number of null values is not a negative number. */
+ num_null = (num_null < 0) ? 0 : num_null;
+
+ /* If the number of NULL values is the same as or
+ large than that of the distinct values, we could
+ consider that the table consists mostly of NULL value.
+ Set rec_per_key to 1. */
+ if (index->stat_n_diff_key_vals[i + 1] <= num_null) {
+ rec_per_key = 1;
+ } else {
+ /* Need to exclude rows with NULL values from
+ rec_per_key calculation */
+ rec_per_key = (ha_rows)(
+ (records - num_null)
+ / (index->stat_n_diff_key_vals[i + 1]
+ - num_null));
+ }
+ } else {
+ rec_per_key = (ha_rows)
+ (records / index->stat_n_diff_key_vals[i + 1]);
+ }
+
+ return(rec_per_key);
+}
+
/*********************************************************************//**
Returns statistics information of the table to the MySQL interpreter,
in various fields of the handle object. */
UNIV_INTERN
int
-ha_innobase::info(
-/*==============*/
- uint flag) /*!< in: what information MySQL requests */
+ha_innobase::info_low(
+/*==================*/
+ uint flag, /*!< in: what information MySQL
+ requests */
+ bool called_from_analyze) /* in: TRUE if called from
+ ::analyze() */
{
dict_table_t* ib_table;
dict_index_t* index;
@@ -8017,14 +8476,12 @@ ha_innobase::info(
ib_table = prebuilt->table;
if (flag & HA_STATUS_TIME) {
- if ((innobase_stats_on_metadata
- || thd_sql_command(user_thd) == SQLCOM_ANALYZE)
- && !share->ib_table->is_corrupt) {
+ if ((called_from_analyze || innobase_stats_on_metadata) && !share->ib_table->is_corrupt) {
/* In sql_show we call with this flag: update
then statistics so that they are up-to-date */
if (srv_use_sys_stats_table && !((ib_table->flags >> DICT_TF2_SHIFT) & DICT_TF2_TEMPORARY)
- && thd_sql_command(user_thd) == SQLCOM_ANALYZE) {
+ && called_from_analyze) {
/* If the indexes on the table don't have enough rows in SYS_STATS system table, */
/* they need to be created. */
dict_index_t* index;
@@ -8036,6 +8493,10 @@ ha_innobase::info(
for (index = dict_table_get_first_index(ib_table);
index != NULL;
index = dict_table_get_next_index(index)) {
+ if (dict_is_older_statistics(index)) {
+ row_delete_stats_for_mysql(index, prebuilt->trx);
+ innobase_commit_low(prebuilt->trx);
+ }
row_insert_stats_for_mysql(index, prebuilt->trx);
innobase_commit_low(prebuilt->trx);
}
@@ -8046,7 +8507,8 @@ ha_innobase::info(
prebuilt->trx->op_info = "updating table statistics";
dict_update_statistics(ib_table,
- (thd_sql_command(user_thd) == SQLCOM_ANALYZE)?TRUE:FALSE);
+ FALSE /* update even if stats
+ are initialized */, called_from_analyze);
prebuilt->trx->op_info = "returning various info to MySQL";
}
@@ -8065,6 +8527,9 @@ ha_innobase::info(
}
if (flag & HA_STATUS_VARIABLE) {
+
+ dict_table_stats_lock(ib_table, RW_S_LATCH);
+
n_rows = ib_table->stat_n_rows;
/* Because we do not protect stat_n_rows by any mutex in a
@@ -8114,36 +8579,33 @@ ha_innobase::info(
ib_table->stat_sum_of_other_index_sizes)
* UNIV_PAGE_SIZE;
+ dict_table_stats_unlock(ib_table, RW_S_LATCH);
+
/* Since fsp_get_available_space_in_free_extents() is
acquiring latches inside InnoDB, we do not call it if we
are asked by MySQL to avoid locking. Another reason to
avoid the call is that it uses quite a lot of CPU.
See Bug#38185. */
- if (flag & HA_STATUS_NO_LOCK) {
+ if (flag & HA_STATUS_NO_LOCK || !srv_stats_update_need_lock
+ || !(flag & HA_STATUS_VARIABLE_EXTRA)) {
/* We do not update delete_length if no
locking is requested so the "old" value can
remain. delete_length is initialized to 0 in
- the ha_statistics' constructor. */
+ the ha_statistics' constructor. Also we only
+ need delete_length to be set when
+ HA_STATUS_VARIABLE_EXTRA is set */
} else if (UNIV_UNLIKELY
(srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE)) {
/* Avoid accessing the tablespace if
innodb_crash_recovery is set to a high value. */
stats.delete_length = 0;
- } else if (srv_stats_update_need_lock) {
-
- /* lock the data dictionary to avoid races with
- ibd_file_missing and tablespace_discarded */
- row_mysql_lock_data_dictionary(prebuilt->trx);
-
- /* ib_table->space must be an existent tablespace */
- if (!ib_table->ibd_file_missing
- && !ib_table->tablespace_discarded) {
+ } else {
+ ullint avail_space;
- stats.delete_length =
- fsp_get_available_space_in_free_extents(
- ib_table->space) * 1024;
- } else {
+ avail_space = fsp_get_available_space_in_free_extents(
+ ib_table->space);
+ if (avail_space == ULLINT_UNDEFINED) {
THD* thd;
thd = ha_thd();
@@ -8160,13 +8622,13 @@ ha_innobase::info(
ib_table->name);
stats.delete_length = 0;
+ } else {
+ stats.delete_length = avail_space * 1024;
}
-
- row_mysql_unlock_data_dictionary(prebuilt->trx);
}
stats.check_time = 0;
- stats.mrr_length_per_rec= ref_length + 8; // 8 = max(sizeof(void *));
+ stats.mrr_length_per_rec= ref_length + portable_sizeof_char_ptr;
if (stats.records == 0) {
stats.mean_rec_length = 0;
@@ -8192,6 +8654,8 @@ ha_innobase::info(
table->s->keys);
}
+ dict_table_stats_lock(ib_table, RW_S_LATCH);
+
for (i = 0; i < table->s->keys; i++) {
ulong j;
/* We could get index quickly through internal
@@ -8229,17 +8693,8 @@ ha_innobase::info(
break;
}
- dict_index_stat_mutex_enter(index);
-
- if (index->stat_n_diff_key_vals[j + 1] == 0) {
-
- rec_per_key = stats.records;
- } else {
- rec_per_key = (ha_rows)(stats.records /
- index->stat_n_diff_key_vals[j + 1]);
- }
-
- dict_index_stat_mutex_exit(index);
+ rec_per_key = innodb_rec_per_key(
+ index, j, stats.records);
/* Since MySQL seems to favor table scans
too much over index searches, we pretend
@@ -8257,6 +8712,8 @@ ha_innobase::info(
(ulong) rec_per_key;
}
}
+
+ dict_table_stats_unlock(ib_table, RW_S_LATCH);
}
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
@@ -8290,6 +8747,18 @@ func_exit:
DBUG_RETURN(0);
}
+/*********************************************************************//**
+Returns statistics information of the table to the MySQL interpreter,
+in various fields of the handle object. */
+UNIV_INTERN
+int
+ha_innobase::info(
+/*==============*/
+ uint flag) /*!< in: what information MySQL requests */
+{
+ return(info_low(flag, false /* not called from analyze */));
+}
+
/**********************************************************************//**
Updates index cardinalities of the table, based on 8 random dives into
each index tree. This does NOT calculate exact statistics on the table.
@@ -8306,7 +8775,8 @@ ha_innobase::analyze(
}
/* Simply call ::info() with all the flags */
- info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
+ info_low(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE,
+ true /* called from analyze */);
if (share->ib_table->is_corrupt) {
return(HA_ADMIN_CORRUPT);
@@ -8615,8 +9085,6 @@ ha_innobase::get_foreign_key_create_info(void)
flen = ftell(srv_dict_tmpfile);
if (flen < 0) {
flen = 0;
- } else if (flen > 64000 - 1) {
- flen = 64000 - 1;
}
/* allocate buffer for the string, and
@@ -8636,136 +9104,199 @@ ha_innobase::get_foreign_key_create_info(void)
}
+/***********************************************************************//**
+Maps a InnoDB foreign key constraint to a equivalent MySQL foreign key info.
+@return pointer to foreign key info */
+static
+FOREIGN_KEY_INFO*
+get_foreign_key_info(
+/*=================*/
+ THD* thd, /*!< in: user thread handle */
+ dict_foreign_t* foreign) /*!< in: foreign key constraint */
+{
+ FOREIGN_KEY_INFO f_key_info;
+ FOREIGN_KEY_INFO* pf_key_info;
+ uint i = 0;
+ ulint len;
+ char tmp_buff[NAME_LEN+1];
+ char name_buff[NAME_LEN+1];
+ const char* ptr;
+ LEX_STRING* referenced_key_name;
+ LEX_STRING* name = NULL;
+
+ ptr = dict_remove_db_name(foreign->id);
+ f_key_info.foreign_id = thd_make_lex_string(thd, 0, ptr,
+ (uint) strlen(ptr), 1);
+
+ /* Name format: database name, '/', table name, '\0' */
+
+ /* Referenced (parent) database name */
+ len = dict_get_db_name_len(foreign->referenced_table_name);
+ ut_a(len < sizeof(tmp_buff));
+ ut_memcpy(tmp_buff, foreign->referenced_table_name, len);
+ tmp_buff[len] = 0;
+
+ len = filename_to_tablename(tmp_buff, name_buff, sizeof(name_buff));
+ f_key_info.referenced_db = thd_make_lex_string(thd, 0, name_buff, len, 1);
+
+ /* Referenced (parent) table name */
+ ptr = dict_remove_db_name(foreign->referenced_table_name);
+ len = filename_to_tablename(ptr, name_buff, sizeof(name_buff));
+ f_key_info.referenced_table = thd_make_lex_string(thd, 0, name_buff, len, 1);
+
+ /* Dependent (child) database name */
+ len = dict_get_db_name_len(foreign->foreign_table_name);
+ ut_a(len < sizeof(tmp_buff));
+ ut_memcpy(tmp_buff, foreign->foreign_table_name, len);
+ tmp_buff[len] = 0;
+
+ len = filename_to_tablename(tmp_buff, name_buff, sizeof(name_buff));
+ f_key_info.foreign_db = thd_make_lex_string(thd, 0, name_buff, len, 1);
+
+ /* Dependent (child) table name */
+ ptr = dict_remove_db_name(foreign->foreign_table_name);
+ len = filename_to_tablename(ptr, name_buff, sizeof(name_buff));
+ f_key_info.foreign_table = thd_make_lex_string(thd, 0, name_buff, len, 1);
+
+ do {
+ ptr = foreign->foreign_col_names[i];
+ name = thd_make_lex_string(thd, name, ptr,
+ (uint) strlen(ptr), 1);
+ f_key_info.foreign_fields.push_back(name);
+ ptr = foreign->referenced_col_names[i];
+ name = thd_make_lex_string(thd, name, ptr,
+ (uint) strlen(ptr), 1);
+ f_key_info.referenced_fields.push_back(name);
+ } while (++i < foreign->n_fields);
+
+ if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE) {
+ len = 7;
+ ptr = "CASCADE";
+ } else if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) {
+ len = 8;
+ ptr = "SET NULL";
+ } else if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) {
+ len = 9;
+ ptr = "NO ACTION";
+ } else {
+ len = 8;
+ ptr = "RESTRICT";
+ }
+
+ f_key_info.delete_method = thd_make_lex_string(thd,
+ f_key_info.delete_method,
+ ptr, len, 1);
+
+ if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) {
+ len = 7;
+ ptr = "CASCADE";
+ } else if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) {
+ len = 8;
+ ptr = "SET NULL";
+ } else if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) {
+ len = 9;
+ ptr = "NO ACTION";
+ } else {
+ len = 8;
+ ptr = "RESTRICT";
+ }
+
+ f_key_info.update_method = thd_make_lex_string(thd,
+ f_key_info.update_method,
+ ptr, len, 1);
+
+ if (foreign->referenced_index && foreign->referenced_index->name) {
+ referenced_key_name = thd_make_lex_string(thd,
+ f_key_info.referenced_key_name,
+ foreign->referenced_index->name,
+ (uint) strlen(foreign->referenced_index->name),
+ 1);
+ } else {
+ referenced_key_name = NULL;
+ }
+
+ f_key_info.referenced_key_name = referenced_key_name;
+
+ pf_key_info = (FOREIGN_KEY_INFO *) thd_memdup(thd, &f_key_info,
+ sizeof(FOREIGN_KEY_INFO));
+
+ return(pf_key_info);
+}
+
+/*******************************************************************//**
+Gets the list of foreign keys in this table.
+@return always 0, that is, always succeeds */
UNIV_INTERN
int
-ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
-{
- dict_foreign_t* foreign;
-
- DBUG_ENTER("get_foreign_key_list");
- ut_a(prebuilt != NULL);
- update_thd(ha_thd());
- prebuilt->trx->op_info = (char*)"getting list of foreign keys";
- trx_search_latch_release_if_reserved(prebuilt->trx);
- mutex_enter(&(dict_sys->mutex));
- foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
-
- while (foreign != NULL) {
- uint i;
- FOREIGN_KEY_INFO f_key_info;
- LEX_STRING *name= 0;
- uint ulen;
- char uname[NAME_LEN+1]; /* Unencoded name */
- char db_name[NAME_LEN+1];
- const char *tmp_buff;
-
- tmp_buff= foreign->id;
- i= 0;
- while (tmp_buff[i] != '/')
- i++;
- tmp_buff+= i + 1;
- f_key_info.forein_id = thd_make_lex_string(thd, 0,
- tmp_buff, (uint) strlen(tmp_buff), 1);
- tmp_buff= foreign->referenced_table_name;
-
- /* Database name */
- i= 0;
- while (tmp_buff[i] != '/')
- {
- db_name[i]= tmp_buff[i];
- i++;
- }
- db_name[i]= 0;
- ulen= filename_to_tablename(db_name, uname, sizeof(uname));
- f_key_info.referenced_db = thd_make_lex_string(thd, 0,
- uname, ulen, 1);
-
- /* Table name */
- tmp_buff+= i + 1;
- ulen= filename_to_tablename(tmp_buff, uname, sizeof(uname));
- f_key_info.referenced_table = thd_make_lex_string(thd, 0,
- uname, ulen, 1);
-
- for (i= 0;;) {
- tmp_buff= foreign->foreign_col_names[i];
- name = thd_make_lex_string(thd, name,
- tmp_buff, (uint) strlen(tmp_buff), 1);
- f_key_info.foreign_fields.push_back(name);
- tmp_buff= foreign->referenced_col_names[i];
- name = thd_make_lex_string(thd, name,
- tmp_buff, (uint) strlen(tmp_buff), 1);
- f_key_info.referenced_fields.push_back(name);
- if (++i >= foreign->n_fields)
- break;
- }
-
- ulong length;
- if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)
- {
- length=7;
- tmp_buff= "CASCADE";
- }
- else if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)
- {
- length=8;
- tmp_buff= "SET NULL";
- }
- else if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION)
- {
- length=9;
- tmp_buff= "NO ACTION";
- }
- else
- {
- length=8;
- tmp_buff= "RESTRICT";
- }
- f_key_info.delete_method = thd_make_lex_string(
- thd, f_key_info.delete_method, tmp_buff, length, 1);
-
-
- if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)
- {
- length=7;
- tmp_buff= "CASCADE";
- }
- else if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)
- {
- length=8;
- tmp_buff= "SET NULL";
- }
- else if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION)
- {
- length=9;
- tmp_buff= "NO ACTION";
- }
- else
- {
- length=8;
- tmp_buff= "RESTRICT";
- }
- f_key_info.update_method = thd_make_lex_string(
- thd, f_key_info.update_method, tmp_buff, length, 1);
- if (foreign->referenced_index &&
- foreign->referenced_index->name)
- {
- f_key_info.referenced_key_name = thd_make_lex_string(
- thd, f_key_info.referenced_key_name,
- foreign->referenced_index->name,
- (uint) strlen(foreign->referenced_index->name), 1);
- }
- else
- f_key_info.referenced_key_name= 0;
-
- FOREIGN_KEY_INFO *pf_key_info = (FOREIGN_KEY_INFO *)
- thd_memdup(thd, &f_key_info, sizeof(FOREIGN_KEY_INFO));
- f_key_list->push_back(pf_key_info);
- foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
- }
- mutex_exit(&(dict_sys->mutex));
- prebuilt->trx->op_info = (char*)"";
+ha_innobase::get_foreign_key_list(
+/*==============================*/
+ THD* thd, /*!< in: user thread handle */
+ List<FOREIGN_KEY_INFO>* f_key_list) /*!< out: foreign key list */
+{
+ FOREIGN_KEY_INFO* pf_key_info;
+ dict_foreign_t* foreign;
+
+ ut_a(prebuilt != NULL);
+ update_thd(ha_thd());
- DBUG_RETURN(0);
+ prebuilt->trx->op_info = "getting list of foreign keys";
+
+ trx_search_latch_release_if_reserved(prebuilt->trx);
+
+ mutex_enter(&(dict_sys->mutex));
+
+ for (foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
+ foreign != NULL;
+ foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
+ pf_key_info = get_foreign_key_info(thd, foreign);
+ if (pf_key_info) {
+ f_key_list->push_back(pf_key_info);
+ }
+ }
+
+ mutex_exit(&(dict_sys->mutex));
+
+ prebuilt->trx->op_info = "";
+
+ return(0);
+}
+
+/*******************************************************************//**
+Gets the set of foreign keys where this table is the referenced table.
+@return always 0, that is, always succeeds */
+UNIV_INTERN
+int
+ha_innobase::get_parent_foreign_key_list(
+/*=====================================*/
+ THD* thd, /*!< in: user thread handle */
+ List<FOREIGN_KEY_INFO>* f_key_list) /*!< out: foreign key list */
+{
+ FOREIGN_KEY_INFO* pf_key_info;
+ dict_foreign_t* foreign;
+
+ ut_a(prebuilt != NULL);
+ update_thd(ha_thd());
+
+ prebuilt->trx->op_info = "getting list of referencing foreign keys";
+
+ trx_search_latch_release_if_reserved(prebuilt->trx);
+
+ mutex_enter(&(dict_sys->mutex));
+
+ for (foreign = UT_LIST_GET_FIRST(prebuilt->table->referenced_list);
+ foreign != NULL;
+ foreign = UT_LIST_GET_NEXT(referenced_list, foreign)) {
+ pf_key_info = get_foreign_key_info(thd, foreign);
+ if (pf_key_info) {
+ f_key_list->push_back(pf_key_info);
+ }
+ }
+
+ mutex_exit(&(dict_sys->mutex));
+
+ prebuilt->trx->op_info = "";
+
+ return(0);
}
/*****************************************************************//**
@@ -8966,39 +9497,30 @@ ha_innobase::start_stmt(
prepared for an update of a row */
prebuilt->select_lock_type = LOCK_X;
- } else {
- if (trx->isolation_level != TRX_ISO_SERIALIZABLE
- && thd_sql_command(thd) == SQLCOM_SELECT
- && lock_type == TL_READ) {
- /* For other than temporary tables, we obtain
- no lock for consistent read (plain SELECT). */
+ } else if (trx->isolation_level != TRX_ISO_SERIALIZABLE
+ && thd_sql_command(thd) == SQLCOM_SELECT
+ && lock_type == TL_READ) {
- prebuilt->select_lock_type = LOCK_NONE;
- } else {
- /* Not a consistent read: restore the
- select_lock_type value. The value of
- stored_select_lock_type was decided in:
- 1) ::store_lock(),
- 2) ::external_lock(),
- 3) ::init_table_handle_for_HANDLER(), and
- 4) ::transactional_table_lock(). */
+ /* For other than temporary tables, we obtain
+ no lock for consistent read (plain SELECT). */
- prebuilt->select_lock_type =
- prebuilt->stored_select_lock_type;
- }
- }
+ prebuilt->select_lock_type = LOCK_NONE;
+ } else {
+ /* Not a consistent read: restore the
+ select_lock_type value. The value of
+ stored_select_lock_type was decided in:
+ 1) ::store_lock(),
+ 2) ::external_lock(),
+ 3) ::init_table_handle_for_HANDLER(), and
+ 4) ::transactional_table_lock(). */
- trx->detailed_error[0] = '\0';
+ prebuilt->select_lock_type = prebuilt->stored_select_lock_type;
+ }
- /* Set the MySQL flag to mark that there is an active transaction */
- if (trx->active_trans == 0) {
+ *trx->detailed_error = 0;
- innobase_register_trx_and_stmt(ht, thd);
- trx->active_trans = 1;
- } else {
- innobase_register_stmt(ht, thd);
- }
+ innobase_register_trx(ht, thd, trx);
return(0);
}
@@ -9047,27 +9569,24 @@ ha_innobase::external_lock(
/* Statement based binlogging does not work in isolation level
READ UNCOMMITTED and READ COMMITTED since the necessary
locks cannot be taken. In this case, we print an
- informative error message and return with an error. */
- if (lock_type == F_WRLCK)
- {
- ulong const binlog_format= thd_binlog_format(thd);
- ulong const tx_isolation = thd_tx_isolation(ha_thd());
- if (tx_isolation <= ISO_READ_COMMITTED
- && binlog_format == BINLOG_FORMAT_STMT
- && thd_binlog_filter_ok(thd)
- && thd_sqlcom_can_generate_row_events(thd)
- )
- {
- int skip = 0;
- /* used by test case */
- DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = 1;);
- if (!skip) {
- my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
- " InnoDB is limited to row-logging when "
- "transaction isolation level is "
- "READ COMMITTED or READ UNCOMMITTED.");
- DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE);
- }
+ informative error message and return with an error.
+ Note: decide_logging_format would give the same error message,
+ except it cannot give the extra details. */
+ if (lock_type == F_WRLCK
+ && !(table_flags() & HA_BINLOG_STMT_CAPABLE)
+ && thd_binlog_format(thd) == BINLOG_FORMAT_STMT
+ && thd_binlog_filter_ok(thd)
+ && thd_sqlcom_can_generate_row_events(thd))
+ {
+ int skip = 0;
+ /* used by test case */
+ DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = 1;);
+ if (!skip) {
+ my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
+ " InnoDB is limited to row-logging when "
+ "transaction isolation level is "
+ "READ COMMITTED or READ UNCOMMITTED.");
+ DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE);
}
}
@@ -9090,22 +9609,14 @@ ha_innobase::external_lock(
if (lock_type != F_UNLCK) {
/* MySQL is setting a new table lock */
- trx->detailed_error[0] = '\0';
-
- /* Set the MySQL flag to mark that there is an active
- transaction */
- if (trx->active_trans == 0) {
+ *trx->detailed_error = 0;
- innobase_register_trx_and_stmt(ht, thd);
- trx->active_trans = 1;
- } else if (trx->n_mysql_tables_in_use == 0) {
- innobase_register_stmt(ht, thd);
- }
+ innobase_register_trx(ht, thd, trx);
if (trx->isolation_level == TRX_ISO_SERIALIZABLE
- && prebuilt->select_lock_type == LOCK_NONE
- && thd_test_options(thd,
- OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
+ && prebuilt->select_lock_type == LOCK_NONE
+ && thd_test_options(
+ thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
/* To get serializable execution, we let InnoDB
conceptually add 'LOCK IN SHARE MODE' to all SELECTs
@@ -9173,7 +9684,7 @@ ha_innobase::external_lock(
if (trx->n_mysql_tables_in_use == 0) {
#ifdef EXTENDED_SLOWLOG
increment_thd_innodb_stats(thd,
- (unsigned long long) ut_conv_dulint_to_longlong(trx->id),
+ (unsigned long long) trx->id,
trx->io_reads,
trx->io_read,
trx->io_reads_wait_timer,
@@ -9194,19 +9705,20 @@ ha_innobase::external_lock(
trx->mysql_n_tables_locked = 0;
prebuilt->used_in_HANDLER = FALSE;
- if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
- if (trx->active_trans != 0) {
+ if (!thd_test_options(
+ thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
+
+ if (trx_is_started(trx)) {
innobase_commit(ht, thd, TRUE);
}
- } else {
- if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
- && trx->global_read_view) {
- /* At low transaction isolation levels we let
- each consistent read set its own snapshot */
+ } else if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
+ && trx->global_read_view) {
- read_view_close_for_mysql(trx);
- }
+ /* At low transaction isolation levels we let
+ each consistent read set its own snapshot */
+
+ read_view_close_for_mysql(trx);
}
}
@@ -9279,12 +9791,7 @@ ha_innobase::transactional_table_lock(
/* MySQL is setting a new transactional table lock */
- /* Set the MySQL flag to mark that there is an active transaction */
- if (trx->active_trans == 0) {
-
- innobase_register_trx_and_stmt(ht, thd);
- trx->active_trans = 1;
- }
+ innobase_register_trx(ht, thd, trx);
if (THDVAR(thd, table_locks) && thd_in_lock_tables(thd)) {
ulint error = DB_SUCCESS;
@@ -9297,7 +9804,8 @@ ha_innobase::transactional_table_lock(
DBUG_RETURN((int) error);
}
- if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
+ if (thd_test_options(
+ thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
/* Store the current undo_no of the transaction
so that we know where to roll back if we have
@@ -9335,7 +9843,7 @@ innodb_show_status(
{
trx_t* trx;
static const char truncated_msg[] = "... truncated...\n";
- const long MAX_STATUS_SIZE = 64000;
+ const long MAX_STATUS_SIZE = 1048576;
ulint trx_list_start = ULINT_UNDEFINED;
ulint trx_list_end = ULINT_UNDEFINED;
@@ -9365,6 +9873,7 @@ innodb_show_status(
if (flen > MAX_STATUS_SIZE) {
usable_len = MAX_STATUS_SIZE;
+ srv_truncated_status_writes++;
} else {
usable_len = flen;
}
@@ -9373,8 +9882,8 @@ innodb_show_status(
read the contents of the temporary file */
if (!(str = (char*) my_malloc(usable_len + 1, MYF(0)))) {
- mutex_exit(&srv_monitor_file_mutex);
- DBUG_RETURN(TRUE);
+ mutex_exit(&srv_monitor_file_mutex);
+ DBUG_RETURN(TRUE);
}
rewind(srv_monitor_file);
@@ -9400,12 +9909,9 @@ innodb_show_status(
mutex_exit(&srv_monitor_file_mutex);
- bool result = FALSE;
+ stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name),
+ STRING_WITH_LEN(""), str, flen);
- if (stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name),
- STRING_WITH_LEN(""), str, flen)) {
- result= TRUE;
- }
my_free(str);
DBUG_RETURN(FALSE);
@@ -9461,7 +9967,8 @@ innodb_mutex_show_status(
if (mutex->count_using > 0) {
buf1len= my_snprintf(buf1, sizeof(buf1),
"%s:%s",
- mutex->cmutex_name, mutex->cfile_name);
+ mutex->cmutex_name,
+ innobase_basename(mutex->cfile_name));
buf2len= my_snprintf(buf2, sizeof(buf2),
"count=%lu, spin_waits=%lu,"
" spin_rounds=%lu, "
@@ -9612,7 +10119,7 @@ bool innobase_show_status(handlerton *hton, THD* thd,
static INNOBASE_SHARE* get_share(const char* table_name)
{
INNOBASE_SHARE *share;
- pthread_mutex_lock(&innobase_share_mutex);
+ mysql_mutex_lock(&innobase_share_mutex);
ulint fold = ut_fold_string(table_name);
@@ -9646,14 +10153,14 @@ static INNOBASE_SHARE* get_share(const char* table_name)
}
share->use_count++;
- pthread_mutex_unlock(&innobase_share_mutex);
+ mysql_mutex_unlock(&innobase_share_mutex);
return(share);
}
static void free_share(INNOBASE_SHARE* share)
{
- pthread_mutex_lock(&innobase_share_mutex);
+ mysql_mutex_lock(&innobase_share_mutex);
#ifdef UNIV_DEBUG
INNOBASE_SHARE* share2;
@@ -9683,7 +10190,7 @@ static void free_share(INNOBASE_SHARE* share)
shrinks too much */
}
- pthread_mutex_unlock(&innobase_share_mutex);
+ mysql_mutex_unlock(&innobase_share_mutex);
}
/*****************************************************************//**
@@ -9785,8 +10292,7 @@ ha_innobase::store_lock(
&& (sql_command == SQLCOM_INSERT_SELECT
|| sql_command == SQLCOM_REPLACE_SELECT
|| sql_command == SQLCOM_UPDATE
- || sql_command == SQLCOM_CREATE_TABLE
- || sql_command == SQLCOM_SET_OPTION)) {
+ || sql_command == SQLCOM_CREATE_TABLE)) {
/* If we either have innobase_locks_unsafe_for_binlog
option set or this session is using READ COMMITTED
@@ -9794,9 +10300,9 @@ ha_innobase::store_lock(
is not set to serializable and MySQL is doing
INSERT INTO...SELECT or REPLACE INTO...SELECT
or UPDATE ... = (SELECT ...) or CREATE ...
- SELECT... or SET ... = (SELECT ...) without
- FOR UPDATE or IN SHARE MODE in select,
- then we use consistent read for select. */
+ SELECT... without FOR UPDATE or IN SHARE
+ MODE in select, then we use consistent read
+ for select. */
prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = LOCK_NONE;
@@ -9922,7 +10428,7 @@ ha_innobase::innobase_get_autoinc(
}
/*******************************************************************//**
-This function reads the global auto-inc counter. It doesn't use the
+This function reads the global auto-inc counter. It doesn't use the
AUTOINC lock even if the lock mode is set to TRADITIONAL.
@return the autoinc value */
UNIV_INTERN
@@ -9942,7 +10448,11 @@ ha_innobase::innobase_peek_autoinc(void)
auto_inc = dict_table_autoinc_read(innodb_table);
- ut_a(auto_inc > 0);
+ if (auto_inc == 0) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: AUTOINC next value generation "
+ "is disabled for '%s'\n", innodb_table->name);
+ }
dict_table_autoinc_unlock(innodb_table);
@@ -10335,19 +10845,19 @@ innobase_xa_prepare(
innobase_release_stat_resources(trx);
- if (trx->active_trans == 0 && trx->conc_state != TRX_NOT_STARTED) {
+ if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) {
- sql_print_error("trx->active_trans == 0, but trx->conc_state != "
- "TRX_NOT_STARTED");
+ sql_print_error("Transaction not registered for MySQL 2PC, "
+ "but transaction is active");
}
if (all
- || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
+ || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
/* We were instructed to prepare the whole transaction, or
this is an SQL statement end and autocommit is on */
- ut_ad(trx->active_trans);
+ ut_ad(trx_is_registered_for_2pc(trx));
error = (int) trx_prepare_for_mysql(trx);
} else {
@@ -10371,13 +10881,10 @@ innobase_xa_prepare(
srv_active_wake_master_thread();
- if (thd_sql_command(thd) != SQLCOM_XA_PREPARE &&
- (all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
- {
- if (srv_enable_unsafe_group_commit && !THDVAR(thd, support_xa)) {
- /* choose group commit rather than binlog order */
- return(error);
- }
+ if (thd_sql_command(thd) != SQLCOM_XA_PREPARE
+ && (all
+ || !thd_test_options(
+ thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
/* For ibbackup to work the order of transactions in binlog
and InnoDB must be the same. Consider the situation
@@ -10397,8 +10904,8 @@ innobase_xa_prepare(
In this case we cannot know how many minutes or hours
will be between XA PREPARE and XA COMMIT, and we don't want
to block for undefined period of time. */
- pthread_mutex_lock(&prepare_commit_mutex);
- trx->active_trans = 2;
+ mysql_mutex_lock(&prepare_commit_mutex);
+ trx_owns_prepare_commit_mutex_set(trx);
}
return(error);
@@ -10433,8 +10940,8 @@ static
int
innobase_commit_by_xid(
/*===================*/
- handlerton *hton,
- XID* xid) /*!< in: X/Open XA transaction identification */
+ handlerton* hton,
+ XID* xid) /*!< in: X/Open XA transaction identification */
{
trx_t* trx;
@@ -10444,7 +10951,7 @@ innobase_commit_by_xid(
if (trx) {
innobase_commit_low(trx);
-
+ trx_free_for_background(trx);
return(XA_OK);
} else {
return(XAER_NOTA);
@@ -10470,7 +10977,9 @@ innobase_rollback_by_xid(
trx = trx_get_trx_by_xid(xid);
if (trx) {
- return(innobase_rollback_trx(trx));
+ int ret = innobase_rollback_trx(trx);
+ trx_free_for_background(trx);
+ return(ret);
} else {
return(XAER_NOTA);
}
@@ -10762,49 +11271,21 @@ innobase_file_format_name_lookup(
}
/************************************************************//**
-Validate the file format check value, is it one of "on" or "off",
-as a side effect it sets the srv_check_file_format_at_startup variable.
-@return true if config value one of "on" or "off" */
-static
-bool
-innobase_file_format_check_on_off(
-/*==============================*/
- const char* format_check) /*!< in: parameter value */
-{
- bool ret = true;
-
- if (!innobase_strcasecmp(format_check, "off")) {
-
- /* Set the value to disable checking. */
- srv_check_file_format_at_startup = DICT_TF_FORMAT_MAX + 1;
-
- } else if (!innobase_strcasecmp(format_check, "on")) {
-
- /* Set the value to the lowest supported format. */
- srv_check_file_format_at_startup = DICT_TF_FORMAT_51;
- } else {
- ret = FALSE;
- }
-
- return(ret);
-}
-
-/************************************************************//**
Validate the file format check config parameters, as a side effect it
-sets the srv_check_file_format_at_startup variable.
+sets the srv_max_file_format_at_startup variable.
@return the format_id if valid config value, otherwise, return -1 */
static
int
innobase_file_format_validate_and_set(
-/*================================*/
- const char* format_check) /*!< in: parameter value */
+/*==================================*/
+ const char* format_max) /*!< in: parameter value */
{
uint format_id;
- format_id = innobase_file_format_name_lookup(format_check);
+ format_id = innobase_file_format_name_lookup(format_max);
if (format_id < DICT_TF_FORMAT_MAX + 1) {
- srv_check_file_format_at_startup = format_id;
+ srv_max_file_format_at_startup = format_id;
return((int) format_id);
} else {
@@ -10892,15 +11373,14 @@ innodb_file_format_name_update(
*static_cast<const char**>(var_ptr)
= trx_sys_file_format_id_to_name(srv_file_format);
}
-
/*************************************************************//**
-Check if valid argument to innodb_file_format_check. This
-function is registered as a callback with MySQL.
+Check if valid argument to innodb_file_format_max. This function
+is registered as a callback with MySQL.
@return 0 for valid file format */
static
int
-innodb_file_format_check_validate(
-/*==============================*/
+innodb_file_format_max_validate(
+/*============================*/
THD* thd, /*!< in: thread handle */
struct st_mysql_sys_var* var, /*!< in: pointer to system
variable */
@@ -10920,39 +11400,27 @@ innodb_file_format_check_validate(
if (file_format_input != NULL) {
- /* Check if user set on/off, we want to print a suitable
- message if they did so. */
-
- if (innobase_file_format_check_on_off(file_format_input)) {
- push_warning_printf(thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_WRONG_ARGUMENTS,
- "InnoDB: invalid innodb_file_format_check "
- "value; on/off can only be set at startup or "
- "in the configuration file");
- } else {
- format_id = innobase_file_format_validate_and_set(
- file_format_input);
+ format_id = innobase_file_format_validate_and_set(
+ file_format_input);
- if (format_id >= 0) {
- /* Save a pointer to the name in the
- 'file_format_name_map' constant array. */
- *static_cast<const char**>(save) =
- trx_sys_file_format_id_to_name(
- (uint)format_id);
+ if (format_id >= 0) {
+ /* Save a pointer to the name in the
+ 'file_format_name_map' constant array. */
+ *static_cast<const char**>(save) =
+ trx_sys_file_format_id_to_name(
+ (uint)format_id);
- return(0);
+ return(0);
- } else {
- push_warning_printf(thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_WRONG_ARGUMENTS,
- "InnoDB: invalid innodb_file_format_check "
- "value; can be any format up to %s "
- "or its equivalent numeric id",
- trx_sys_file_format_id_to_name(
- DICT_TF_FORMAT_MAX));
- }
+ } else {
+ push_warning_printf(thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WRONG_ARGUMENTS,
+ "InnoDB: invalid innodb_file_format_max "
+ "value; can be any format up to %s "
+ "or equivalent id of %d",
+ trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX),
+ DICT_TF_FORMAT_MAX);
}
}
@@ -10961,12 +11429,12 @@ innodb_file_format_check_validate(
}
/****************************************************************//**
-Update the system variable innodb_file_format_check using the "saved"
+Update the system variable innodb_file_format_max using the "saved"
value. This function is registered as a callback with MySQL. */
static
void
-innodb_file_format_check_update(
-/*============================*/
+innodb_file_format_max_update(
+/*==========================*/
THD* thd, /*!< in: thread handle */
struct st_mysql_sys_var* var, /*!< in: pointer to
system variable */
@@ -11162,19 +11630,19 @@ static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff)
return 0;
}
-/***********************************************************************
+/*********************************************************************//**
This function checks each index name for a table against reserved
-system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
-this function pushes an warning message to the client, and returns true. */
+system default primary index name 'GEN_CLUST_INDEX'. If a name
+matches, this function pushes an warning message to the client,
+and returns true.
+@return true if the index name matches the reserved name */
extern "C" UNIV_INTERN
bool
innobase_index_name_is_reserved(
/*============================*/
- /* out: true if an index name
- matches the reserved name */
- const trx_t* trx, /* in: InnoDB transaction handle */
- const KEY* key_info, /* in: Indexes to be created */
- ulint num_of_keys) /* in: Number of indexes to
+ THD* thd, /*!< in/out: MySQL connection */
+ const KEY* key_info, /*!< in: Indexes to be created */
+ ulint num_of_keys) /*!< in: Number of indexes to
be created. */
{
const KEY* key;
@@ -11186,7 +11654,7 @@ innobase_index_name_is_reserved(
if (innobase_strcasecmp(key->name,
innobase_index_reserve_name) == 0) {
/* Push warning to mysql */
- push_warning_printf((THD*) trx->mysql_thd,
+ push_warning_printf(thd,
MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WRONG_NAME_FOR_INDEX,
"Cannot Create Index with name "
@@ -11234,34 +11702,22 @@ static MYSQL_SYSVAR_ULONG(page_size, innobase_page_size,
"###EXPERIMENTAL###: The universal page size of the database. Changing for created database is not supported. Use on your own risk!",
NULL, NULL, (1 << 14), (1 << 12), (1 << UNIV_PAGE_SIZE_SHIFT_MAX), 0);
+static MYSQL_SYSVAR_ULONG(log_block_size, innobase_log_block_size,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "###EXPERIMENTAL###: The log block size of the transaction log file. Changing for created log file is not supported. Use on your own risk!",
+ NULL, NULL, (1 << 9)/*512*/, (1 << 9)/*512*/, (1 << UNIV_PAGE_SIZE_SHIFT_MAX), 0);
+
static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
PLUGIN_VAR_READONLY,
"The common part for InnoDB table spaces.",
NULL, NULL, NULL);
-static MYSQL_SYSVAR_BOOL(extra_undoslots, innobase_extra_undoslots,
- PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
- "Enable to use about 4000 undo slots instead of default 1024. "
- "#### Attention: Once you enable this parameter, "
- "don't use the datafile for normal mysqld or ibbackup! ####",
- NULL, NULL, FALSE);
-
-static MYSQL_SYSVAR_BOOL(fast_recovery, innobase_fast_recovery,
- PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
- "obsolete option. affects nothing.",
- NULL, NULL, FALSE);
-
static MYSQL_SYSVAR_BOOL(recovery_stats, innobase_recovery_stats,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Output statistics of recovery process after it.",
NULL, NULL, FALSE);
-static MYSQL_SYSVAR_ULINT(use_purge_thread, srv_use_purge_thread,
- PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "Number of purge devoted threads. #### over 1 is EXPERIMENTAL ####",
- NULL, NULL, 1, 0, 64, 0);
-
-static MYSQL_SYSVAR_BOOL(overwrite_relay_log_info, innobase_overwrite_relay_log_info,
+static MYSQL_SYSVAR_BOOL(recovery_update_relay_log, innobase_overwrite_relay_log_info,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"During InnoDB crash recovery on slave overwrite relay-log.info "
"to align master log file position if information in InnoDB and relay-log.info is different.",
@@ -11278,6 +11734,30 @@ static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
"Number of IOPs the server can do. Tunes the background IO rate",
NULL, NULL, 200, 100, ~0L, 0);
+static MYSQL_SYSVAR_ULONG(purge_batch_size, srv_purge_batch_size,
+ PLUGIN_VAR_OPCMDARG,
+ "Number of UNDO log pages to purge in one batch from the history list.",
+ NULL, NULL,
+ 20, /* Default setting */
+ 1, /* Minimum value */
+ 5000, 0); /* Maximum value */
+
+static MYSQL_SYSVAR_ULONG(rollback_segments, srv_rollback_segments,
+ PLUGIN_VAR_OPCMDARG,
+ "Number of UNDO logs to use.",
+ NULL, NULL,
+ 128, /* Default setting */
+ 1, /* Minimum value */
+ TRX_SYS_N_RSEGS, 0); /* Maximum value */
+
+static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads,
+ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
+ "Purge threads can be either 0 or 1.",
+ NULL, NULL,
+ 1, /* Default setting */
+ 0, /* Minimum value */
+ 1, 0); /* Maximum value */
+
static MYSQL_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown,
PLUGIN_VAR_OPCMDARG,
"Speeds up the shutdown process of the InnoDB storage engine. Possible "
@@ -11295,27 +11775,49 @@ static MYSQL_SYSVAR_STR(file_format, innobase_file_format_name,
innodb_file_format_name_validate,
innodb_file_format_name_update, "Antelope");
+/* "innobase_file_format_check" decides whether we would continue
+booting the server if the file format stamped on the system
+table space exceeds the maximum file format supported
+by the server. Can be set during server startup at command
+line or configure file, and a read only variable after
+server startup */
+static MYSQL_SYSVAR_BOOL(file_format_check, innobase_file_format_check,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Whether to perform system file format check.",
+ NULL, NULL, TRUE);
+
/* If a new file format is introduced, the file format
name needs to be updated accordingly. Please refer to
file_format_name_map[] defined in trx0sys.c for the next
file format name. */
-static MYSQL_SYSVAR_STR(file_format_check, innobase_file_format_check,
+static MYSQL_SYSVAR_STR(file_format_max, innobase_file_format_max,
PLUGIN_VAR_OPCMDARG,
"The highest file format in the tablespace.",
- innodb_file_format_check_validate,
- innodb_file_format_check_update, "Barracuda");
-
-static MYSQL_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
- PLUGIN_VAR_OPCMDARG,
- "Set to 0 (write and flush once per second),"
- " 1 (write and flush at each commit)"
- " or 2 (write at commit, flush once per second).",
- NULL, NULL, 1, 0, 2, 0);
+ innodb_file_format_max_validate,
+ innodb_file_format_max_update, "Antelope");
+
+/* Changed to the THDVAR */
+//static MYSQL_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
+// PLUGIN_VAR_OPCMDARG,
+// "Set to 0 (write and flush once per second),"
+// " 1 (write and flush at each commit)"
+// " or 2 (write at commit, flush once per second).",
+// NULL, NULL, 1, 0, 2, 0);
+
+static MYSQL_SYSVAR_BOOL(use_global_flush_log_at_trx_commit, srv_use_global_flush_log_at_trx_commit,
+ PLUGIN_VAR_NOCMDARG,
+ "Use global innodb_flush_log_at_trx_commit value. (default: ON).",
+ NULL, NULL, TRUE);
static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"With which method to flush data.", NULL, NULL, NULL);
+static MYSQL_SYSVAR_BOOL(large_prefix, innobase_large_prefix,
+ PLUGIN_VAR_NOCMDARG,
+ "Support large index prefix length of REC_VERSION_56_MAX_INDEX_COL_LEN (3072) bytes.",
+ NULL, NULL, FALSE);
+
static MYSQL_SYSVAR_BOOL(locks_unsafe_for_binlog, innobase_locks_unsafe_for_binlog,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Force InnoDB to not use next-key locking, to use only row-level locking.",
@@ -11353,7 +11855,7 @@ static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
static MYSQL_SYSVAR_BOOL(adaptive_flushing, srv_adaptive_flushing,
PLUGIN_VAR_NOCMDARG,
"Attempt flushing dirty pages to avoid IO bursts at checkpoints.",
- NULL, NULL, FALSE);
+ NULL, NULL, TRUE);
static MYSQL_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
PLUGIN_VAR_RQCMDARG,
@@ -11380,25 +11882,6 @@ static MYSQL_SYSVAR_ULONGLONG(stats_sample_pages, srv_stats_sample_pages,
"The number of index pages to sample when calculating statistics (default 8)",
NULL, NULL, 8, 1, ~0ULL, 0);
-const char *innobase_stats_method_names[]=
-{
- "nulls_equal",
- "nulls_unequal",
- "nulls_ignored",
- NullS
-};
-TYPELIB innobase_stats_method_typelib=
-{
- array_elements(innobase_stats_method_names) - 1, "innobase_stats_method_typelib",
- innobase_stats_method_names, NULL
-};
-static MYSQL_SYSVAR_ENUM(stats_method, srv_stats_method,
- PLUGIN_VAR_RQCMDARG,
- "Specifies how InnoDB index statistics collection code should threat NULLs. "
- "Possible values of name are same to for 'myisam_stats_method'. "
- "This is startup parameter.",
- NULL, NULL, 0, &innobase_stats_method_typelib);
-
static MYSQL_SYSVAR_ULONG(stats_auto_update, srv_stats_auto_update,
PLUGIN_VAR_RQCMDARG,
"Enable/Disable InnoDB's auto update statistics of indexes. "
@@ -11425,6 +11908,11 @@ static MYSQL_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
"Disable with --skip-innodb-adaptive-hash-index.",
NULL, innodb_adaptive_hash_index_update, TRUE);
+static MYSQL_SYSVAR_ULONG(adaptive_hash_index_partitions, btr_search_index_num,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Number of InnoDB adaptive hash index partitions (default 1: disable partitioning)",
+ NULL, NULL, 1, 1, sizeof(ulint) * 8, 0);
+
static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay,
PLUGIN_VAR_RQCMDARG,
"Replication thread delay (ms) on the slave server if "
@@ -11446,14 +11934,19 @@ static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
NULL, NULL, 128*1024*1024L, 5*1024*1024L, LONGLONG_MAX, 1024*1024L);
-static MYSQL_SYSVAR_UINT(buffer_pool_shm_key, srv_buffer_pool_shm_key,
+static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Number of buffer pool instances, set to higher value on high-end machines to increase scalability",
+ NULL, NULL, 1L, 1L, MAX_BUFFER_POOLS, 1L);
+
+static MYSQL_SYSVAR_UINT(buffer_pool_shm_key, innobase_buffer_pool_shm_key,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "[experimental] The key value of shared memory segment for the buffer pool. 0 (default) disables the feature.",
+ "[Deprecated option] no effect",
NULL, NULL, 0, 0, INT_MAX32, 0);
static MYSQL_SYSVAR_BOOL(buffer_pool_shm_checksum, innobase_buffer_pool_shm_checksum,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
- "Enable buffer_pool_shm checksum validation (enabled by default).",
+ "[Deprecated option] no effect",
NULL, NULL, TRUE);
static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
@@ -11580,12 +12073,31 @@ static MYSQL_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
"Use OS memory allocator instead of InnoDB's internal memory allocator",
NULL, NULL, TRUE);
+static MYSQL_SYSVAR_BOOL(use_native_aio, srv_use_native_aio,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Use native AIO if supported on this platform.",
+ NULL, NULL, TRUE);
+
static MYSQL_SYSVAR_STR(change_buffering, innobase_change_buffering,
PLUGIN_VAR_RQCMDARG,
"Buffer changes to reduce random access: "
- "OFF, ON, none, inserts.",
+ "OFF, ON, inserting, deleting, changing, or purging.",
innodb_change_buffering_validate,
- innodb_change_buffering_update, "inserts");
+ innodb_change_buffering_update, "all");
+
+static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method,
+ PLUGIN_VAR_RQCMDARG,
+ "Specifies how InnoDB index statistics collection code should "
+ "treat NULLs. Possible values are NULLS_EQUAL (default), "
+ "NULLS_UNEQUAL and NULLS_IGNORED",
+ NULL, NULL, SRV_STATS_NULLS_EQUAL, &innodb_stats_method_typelib);
+
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
+ PLUGIN_VAR_RQCMDARG,
+ "Debug flags for InnoDB change buffering (0=none)",
+ NULL, NULL, 0, 0, 1, 0);
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
PLUGIN_VAR_RQCMDARG,
@@ -11653,74 +12165,84 @@ static MYSQL_SYSVAR_ENUM(read_ahead, srv_read_ahead,
static
void
-innodb_adaptive_checkpoint_update(
+innodb_adaptive_flushing_method_update(
THD* thd,
struct st_mysql_sys_var* var,
void* var_ptr,
const void* save)
{
- *(long *)var_ptr= (*(long *)save) % 3;
+ *(long *)var_ptr= (*(long *)save) % 4;
}
-const char *adaptive_checkpoint_names[]=
+const char *adaptive_flushing_method_names[]=
{
- "none", /* 0 */
- "reflex", /* 1 */
- "estimate", /* 2 */
+ "native", /* 0 */
+ "estimate", /* 1 */
+ "keep_average", /* 2 */
/* For compatibility of the older patch */
"0", /* 3 ("none" + 3) */
- "1", /* 4 ("reflex" + 3) */
- "2", /* 5 ("estimate" + 3) */
+ "1", /* 4 ("estimate" + 3) */
+ "2", /* 5 ("keep_average" + 3) */
NullS
};
-TYPELIB adaptive_checkpoint_typelib=
+TYPELIB adaptive_flushing_method_typelib=
{
- array_elements(adaptive_checkpoint_names) - 1, "adaptive_checkpoint_typelib",
- adaptive_checkpoint_names, NULL
+ array_elements(adaptive_flushing_method_names) - 1, "adaptive_flushing_method_typelib",
+ adaptive_flushing_method_names, NULL
};
-static MYSQL_SYSVAR_ENUM(adaptive_checkpoint, srv_adaptive_checkpoint,
+static MYSQL_SYSVAR_ENUM(adaptive_flushing_method, srv_adaptive_flushing_method,
PLUGIN_VAR_RQCMDARG,
- "Enable/Disable flushing along modified age. (none, reflex, [estimate])",
- NULL, innodb_adaptive_checkpoint_update, 2, &adaptive_checkpoint_typelib);
+ "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
+ NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
-static MYSQL_SYSVAR_ULONG(enable_unsafe_group_commit, srv_enable_unsafe_group_commit,
- PLUGIN_VAR_RQCMDARG,
- "Enable/Disable unsafe group commit when support_xa=OFF and use with binlog or other XA storage engine.",
- NULL, NULL, 0, 0, 1, 0);
-
-static MYSQL_SYSVAR_ULONG(expand_import, srv_expand_import,
+static MYSQL_SYSVAR_ULONG(import_table_from_xtrabackup, srv_expand_import,
PLUGIN_VAR_RQCMDARG,
"Enable/Disable converting automatically *.ibd files when import tablespace.",
NULL, NULL, 0, 0, 1, 0);
-static MYSQL_SYSVAR_ULONG(extra_rsegments, srv_extra_rsegments,
- PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "Number of extra user rollback segments when create new database.",
- NULL, NULL, 0, 0, 126, 0);
-
static MYSQL_SYSVAR_ULONG(dict_size_limit, srv_dict_size_limit,
PLUGIN_VAR_RQCMDARG,
"Limit the allocated memory for dictionary cache. (0: unlimited)",
NULL, NULL, 0, 0, LONG_MAX, 0);
-static MYSQL_SYSVAR_UINT(auto_lru_dump, srv_auto_lru_dump,
+static MYSQL_SYSVAR_UINT(buffer_pool_restore_at_startup, srv_auto_lru_dump,
PLUGIN_VAR_RQCMDARG,
"Time in seconds between automatic buffer pool dumps. "
"0 (the default) disables automatic dumps.",
NULL, NULL, 0, 0, UINT_MAX32, 0);
-static MYSQL_SYSVAR_ULINT(pass_corrupt_table, srv_pass_corrupt_table,
+const char *corrupt_table_action_names[]=
+{
+ "assert", /* 0 */
+ "warn", /* 1 */
+ "salvage", /* 2 */
+ NullS
+};
+TYPELIB corrupt_table_action_typelib=
+{
+ array_elements(corrupt_table_action_names) - 1, "corrupt_table_action_typelib",
+ corrupt_table_action_names, NULL
+};
+static MYSQL_SYSVAR_ENUM(corrupt_table_action, srv_pass_corrupt_table,
PLUGIN_VAR_RQCMDARG,
- "Pass corruptions of user tables as 'corrupt table' instead of not crashing itself, "
+ "Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, "
"when used with file_per_table. "
"All file io for the datafile after detected as corrupt are disabled, "
"except for the deletion.",
+ NULL, NULL, 0, &corrupt_table_action_typelib);
+
+static MYSQL_SYSVAR_ULONG(lazy_drop_table, srv_lazy_drop_table,
+ PLUGIN_VAR_RQCMDARG,
+ "At deleting tablespace, only miminum needed processes at the time are done. "
+ "e.g. for http://bugs.mysql.com/51325",
NULL, NULL, 0, 0, 1, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(page_size),
+ MYSQL_SYSVAR(log_block_size),
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
MYSQL_SYSVAR(buffer_pool_size),
+ MYSQL_SYSVAR(buffer_pool_instances),
MYSQL_SYSVAR(buffer_pool_shm_key),
MYSQL_SYSVAR(buffer_pool_shm_checksum),
MYSQL_SYSVAR(checksums),
@@ -11731,8 +12253,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(doublewrite_file),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
- MYSQL_SYSVAR(extra_undoslots),
- MYSQL_SYSVAR(fast_recovery),
MYSQL_SYSVAR(recovery_stats),
MYSQL_SYSVAR(fast_shutdown),
MYSQL_SYSVAR(file_io_threads),
@@ -11741,9 +12261,12 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(file_per_table),
MYSQL_SYSVAR(file_format),
MYSQL_SYSVAR(file_format_check),
+ MYSQL_SYSVAR(file_format_max),
MYSQL_SYSVAR(flush_log_at_trx_commit),
+ MYSQL_SYSVAR(use_global_flush_log_at_trx_commit),
MYSQL_SYSVAR(flush_method),
MYSQL_SYSVAR(force_recovery),
+ MYSQL_SYSVAR(large_prefix),
MYSQL_SYSVAR(locks_unsafe_for_binlog),
MYSQL_SYSVAR(lock_wait_timeout),
#ifdef UNIV_LOG_ARCHIVE
@@ -11761,15 +12284,16 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(old_blocks_pct),
MYSQL_SYSVAR(old_blocks_time),
MYSQL_SYSVAR(open_files),
- MYSQL_SYSVAR(overwrite_relay_log_info),
+ MYSQL_SYSVAR(recovery_update_relay_log),
MYSQL_SYSVAR(rollback_on_timeout),
MYSQL_SYSVAR(stats_on_metadata),
- MYSQL_SYSVAR(stats_method),
MYSQL_SYSVAR(stats_auto_update),
MYSQL_SYSVAR(stats_update_need_lock),
MYSQL_SYSVAR(use_sys_stats_table),
MYSQL_SYSVAR(stats_sample_pages),
MYSQL_SYSVAR(adaptive_hash_index),
+ MYSQL_SYSVAR(adaptive_hash_index_partitions),
+ MYSQL_SYSVAR(stats_method),
MYSQL_SYSVAR(replication_delay),
MYSQL_SYSVAR(status_file),
MYSQL_SYSVAR(strict_mode),
@@ -11790,19 +12314,23 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(checkpoint_age_target),
MYSQL_SYSVAR(flush_neighbor_pages),
MYSQL_SYSVAR(read_ahead),
- MYSQL_SYSVAR(adaptive_checkpoint),
- MYSQL_SYSVAR(flush_log_at_trx_commit_session),
- MYSQL_SYSVAR(enable_unsafe_group_commit),
- MYSQL_SYSVAR(expand_import),
- MYSQL_SYSVAR(extra_rsegments),
+ MYSQL_SYSVAR(adaptive_flushing_method),
+ MYSQL_SYSVAR(import_table_from_xtrabackup),
MYSQL_SYSVAR(dict_size_limit),
MYSQL_SYSVAR(use_sys_malloc),
+ MYSQL_SYSVAR(use_native_aio),
MYSQL_SYSVAR(change_buffering),
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+ MYSQL_SYSVAR(change_buffering_debug),
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
MYSQL_SYSVAR(read_ahead_threshold),
MYSQL_SYSVAR(io_capacity),
- MYSQL_SYSVAR(auto_lru_dump),
- MYSQL_SYSVAR(use_purge_thread),
- MYSQL_SYSVAR(pass_corrupt_table),
+ MYSQL_SYSVAR(buffer_pool_restore_at_startup),
+ MYSQL_SYSVAR(purge_threads),
+ MYSQL_SYSVAR(purge_batch_size),
+ MYSQL_SYSVAR(rollback_segments),
+ MYSQL_SYSVAR(corrupt_table_action),
+ MYSQL_SYSVAR(lazy_drop_table),
NULL
};
@@ -11811,7 +12339,7 @@ mysql_declare_plugin(xtradb)
MYSQL_STORAGE_ENGINE_PLUGIN,
&innobase_storage_engine,
innobase_hton_name,
- "Percona",
+ plugin_author,
"Percona-XtraDB, Supports transactions, row-level locking, and foreign keys",
PLUGIN_LICENSE_GPL,
innobase_init, /* Plugin Init */
@@ -11822,9 +12350,6 @@ mysql_declare_plugin(xtradb)
NULL /* reserved */
},
i_s_innodb_rseg,
-i_s_innodb_buffer_pool_pages,
-i_s_innodb_buffer_pool_pages_index,
-i_s_innodb_buffer_pool_pages_blob,
i_s_innodb_trx,
i_s_innodb_locks,
i_s_innodb_lock_waits,
@@ -11832,21 +12357,28 @@ i_s_innodb_cmp,
i_s_innodb_cmp_reset,
i_s_innodb_cmpmem,
i_s_innodb_cmpmem_reset,
-i_s_innodb_table_stats,
-i_s_innodb_index_stats,
-i_s_innodb_admin_command,
i_s_innodb_sys_tables,
+i_s_innodb_sys_tablestats,
i_s_innodb_sys_indexes,
+i_s_innodb_sys_columns,
+i_s_innodb_sys_fields,
+i_s_innodb_sys_foreign,
+i_s_innodb_sys_foreign_cols,
i_s_innodb_sys_stats,
-i_s_innodb_patches
+i_s_innodb_table_stats,
+i_s_innodb_index_stats,
+i_s_innodb_buffer_pool_pages,
+i_s_innodb_buffer_pool_pages_index,
+i_s_innodb_buffer_pool_pages_blob,
+i_s_innodb_admin_command
mysql_declare_plugin_end;
maria_declare_plugin(xtradb)
{ /* InnoDB */
MYSQL_STORAGE_ENGINE_PLUGIN,
&innobase_storage_engine,
innobase_hton_name,
- "Percona",
- "XtraDB engine based on InnoDB plugin. Supports transactions, row-level locking, and foreign keys",
+ plugin_author,
+ "Percona-XtraDB, Supports transactions, row-level locking, and foreign keys",
PLUGIN_LICENSE_GPL,
innobase_init, /* Plugin Init */
NULL, /* Plugin Deinit */
@@ -11857,9 +12389,6 @@ maria_declare_plugin(xtradb)
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
},
i_s_innodb_rseg_maria,
-i_s_innodb_buffer_pool_pages_maria,
-i_s_innodb_buffer_pool_pages_index_maria,
-i_s_innodb_buffer_pool_pages_blob_maria,
i_s_innodb_trx_maria,
i_s_innodb_locks_maria,
i_s_innodb_lock_waits_maria,
@@ -11867,13 +12396,20 @@ i_s_innodb_cmp_maria,
i_s_innodb_cmp_reset_maria,
i_s_innodb_cmpmem_maria,
i_s_innodb_cmpmem_reset_maria,
-i_s_innodb_table_stats_maria,
-i_s_innodb_index_stats_maria,
-i_s_innodb_admin_command_maria,
i_s_innodb_sys_tables_maria,
+i_s_innodb_sys_tablestats_maria,
i_s_innodb_sys_indexes_maria,
+i_s_innodb_sys_columns_maria,
+i_s_innodb_sys_fields_maria,
+i_s_innodb_sys_foreign_maria,
+i_s_innodb_sys_foreign_cols_maria,
i_s_innodb_sys_stats_maria,
-i_s_innodb_patches_maria
+i_s_innodb_table_stats_maria,
+i_s_innodb_index_stats_maria,
+i_s_innodb_buffer_pool_pages_maria,
+i_s_innodb_buffer_pool_pages_index_maria,
+i_s_innodb_buffer_pool_pages_blob_maria,
+i_s_innodb_admin_command_maria
maria_declare_plugin_end;
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index 03358012878..d2da3df6422 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -110,6 +110,7 @@ class ha_innobase: public handler
ulint innobase_update_autoinc(ulonglong auto_inc);
void innobase_initialize_autoinc();
dict_index_t* innobase_get_index(uint keynr);
+ int info_low(uint flag, bool called_from_analyze);
/* Init values for the class: */
public:
@@ -180,13 +181,15 @@ class ha_innobase: public handler
void update_create_info(HA_CREATE_INFO* create_info);
int create(const char *name, register TABLE *form,
HA_CREATE_INFO *create_info);
- int delete_all_rows();
+ int truncate();
int delete_table(const char *name);
int rename_table(const char* from, const char* to);
int check(THD* thd, HA_CHECK_OPT* check_opt);
char* update_table_comment(const char* comment);
char* get_foreign_key_create_info();
int get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list);
+ int get_parent_foreign_key_list(THD *thd,
+ List<FOREIGN_KEY_INFO> *f_key_list);
bool can_switch_engines();
uint referenced_by_foreign_key();
void free_foreign_key_create_info(char* str);
@@ -214,7 +217,9 @@ class ha_innobase: public handler
bool primary_key_is_clustered();
int cmp_ref(const uchar *ref1, const uchar *ref2);
/** Fast index creation (smart ALTER TABLE) @see handler0alter.cc @{ */
- int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys);
+ int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys,
+ handler_add_index **add);
+ int final_add_index(handler_add_index *add, bool commit);
int prepare_drop_index(TABLE *table_arg, uint *key_num,
uint num_of_keys);
int final_drop_index(TABLE *table_arg);
@@ -250,11 +255,7 @@ the definitions are bracketed with #ifdef INNODB_COMPATIBILITY_HOOKS */
extern "C" {
struct charset_info_st *thd_charset(MYSQL_THD thd);
-#if MYSQL_VERSION_ID >= 50142
LEX_STRING *thd_query_string(MYSQL_THD thd);
-#else
-char **thd_query(MYSQL_THD thd);
-#endif
/** Get the file name of the MySQL binlog.
* @return the name of the binlog file
@@ -341,15 +342,14 @@ innobase_trx_allocate(
This function checks each index name for a table against reserved
system default primary index name 'GEN_CLUST_INDEX'. If a name
matches, this function pushes an warning message to the client,
-and returns true. */
+and returns true.
+@return true if the index name matches the reserved name */
extern "C"
bool
innobase_index_name_is_reserved(
/*============================*/
- /* out: true if the index name
- matches the reserved name */
- const trx_t* trx, /* in: InnoDB transaction handle */
- const KEY* key_info, /* in: Indexes to be created */
- ulint num_of_keys); /* in: Number of indexes to
+ THD* thd, /*!< in/out: MySQL connection */
+ const KEY* key_info, /*!< in: Indexes to be created */
+ ulint num_of_keys); /*!< in: Number of indexes to
be created. */
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index daad61ed341..f2dd3c11f80 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -99,8 +99,10 @@ innobase_col_to_mysql(
#ifdef UNIV_DEBUG
case DATA_MYSQL:
ut_ad(flen >= len);
- ut_ad(col->mbmaxlen >= col->mbminlen);
- ut_ad(col->mbmaxlen > col->mbminlen || flen == len);
+ ut_ad(DATA_MBMAXLEN(col->mbminmaxlen)
+ >= DATA_MBMINLEN(col->mbminmaxlen));
+ ut_ad(DATA_MBMAXLEN(col->mbminmaxlen)
+ > DATA_MBMINLEN(col->mbminmaxlen) || flen == len);
memcpy(dest, data, len);
break;
@@ -537,7 +539,7 @@ innobase_create_key_def(
if (!new_primary && (key_info->flags & HA_NOSAME)
&& (!(key_info->flags & HA_KEY_HAS_PART_KEY_SEG))
&& row_table_got_default_clust_index(table)) {
- uint key_part = key_info->key_parts;
+ uint key_part = key_info->key_parts;
new_primary = TRUE;
@@ -593,6 +595,27 @@ innobase_create_key_def(
}
/*******************************************************************//**
+Check each index column size, make sure they do not exceed the max limit
+@return HA_ERR_INDEX_COL_TOO_LONG if index column size exceeds limit */
+static
+int
+innobase_check_column_length(
+/*=========================*/
+ const dict_table_t*table, /*!< in: table definition */
+ const KEY* key_info) /*!< in: Indexes to be created */
+{
+ ulint max_col_len = DICT_MAX_FIELD_LEN_BY_FORMAT(table);
+
+ for (ulint key_part = 0; key_part < key_info->key_parts; key_part++) {
+ if (key_info->key_part[key_part].length > max_col_len) {
+ my_error(ER_INDEX_COLUMN_TOO_LONG, MYF(0), max_col_len);
+ return(HA_ERR_INDEX_COL_TOO_LONG);
+ }
+ }
+ return(0);
+}
+
+/*******************************************************************//**
Create a temporary tablename using query id, thread id, and id
@return temporary tablename */
static
@@ -617,6 +640,18 @@ innobase_create_temporary_tablename(
return(name);
}
+class ha_innobase_add_index : public handler_add_index
+{
+public:
+ /** table where the indexes are being created */
+ dict_table_t* indexed_table;
+ ha_innobase_add_index(TABLE* table, KEY* key_info, uint num_of_keys,
+ dict_table_t* indexed_table_arg) :
+ handler_add_index(table, key_info, num_of_keys),
+ indexed_table (indexed_table_arg) {}
+ ~ha_innobase_add_index() {}
+};
+
/*******************************************************************//**
Create indexes.
@return 0 or error number */
@@ -624,12 +659,15 @@ UNIV_INTERN
int
ha_innobase::add_index(
/*===================*/
- TABLE* table, /*!< in: Table where indexes are created */
- KEY* key_info, /*!< in: Indexes to be created */
- uint num_of_keys) /*!< in: Number of indexes to be created */
+ TABLE* table, /*!< in: Table where indexes
+ are created */
+ KEY* key_info, /*!< in: Indexes
+ to be created */
+ uint num_of_keys, /*!< in: Number of indexes
+ to be created */
+ handler_add_index** add) /*!< out: context */
{
dict_index_t** index; /*!< Index to be created */
- dict_table_t* innodb_table; /*!< InnoDB table in dictionary */
dict_table_t* indexed_table; /*!< Table where indexes are created */
merge_index_def_t* index_defs; /*!< Index definitions */
mem_heap_t* heap; /*!< Heap for index definitions */
@@ -645,50 +683,57 @@ ha_innobase::add_index(
ut_a(key_info);
ut_a(num_of_keys);
+ *add = NULL;
+
if (srv_created_new_raw || srv_force_recovery) {
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
update_thd();
- heap = mem_heap_create(1024);
-
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads. */
trx_search_latch_release_if_reserved(prebuilt->trx);
- trx_start_if_not_started(prebuilt->trx);
- /* Create a background transaction for the operations on
- the data dictionary tables. */
- trx = innobase_trx_allocate(user_thd);
- trx_start_if_not_started(trx);
+ /* Check if the index name is reserved. */
+ if (innobase_index_name_is_reserved(user_thd, key_info, num_of_keys)) {
+ DBUG_RETURN(ER_WRONG_NAME_FOR_INDEX);
+ }
- innodb_table = indexed_table
- = dict_table_get(prebuilt->table->name, FALSE);
+ indexed_table = dict_table_get(prebuilt->table->name, FALSE);
- if (UNIV_UNLIKELY(!innodb_table)) {
- error = HA_ERR_NO_SUCH_TABLE;
- goto err_exit;
+ if (UNIV_UNLIKELY(!indexed_table)) {
+ DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
}
- /* Check if the index name is reserved. */
- if (innobase_index_name_is_reserved(trx, key_info, num_of_keys)) {
- error = ER_WRONG_NAME_FOR_INDEX;
- } else {
- /* Check that index keys are sensible */
- error = innobase_check_index_keys(key_info, num_of_keys,
- innodb_table);
- }
+ ut_a(indexed_table == prebuilt->table);
+
+ /* Check that index keys are sensible */
+ error = innobase_check_index_keys(key_info, num_of_keys, prebuilt->table);
if (UNIV_UNLIKELY(error)) {
-err_exit:
- mem_heap_free(heap);
- trx_general_rollback_for_mysql(trx, NULL);
- trx_free_for_mysql(trx);
- trx_commit_for_mysql(prebuilt->trx);
DBUG_RETURN(error);
}
+ /* Check each index's column length to make sure they do not
+ exceed limit */
+ for (ulint i = 0; i < num_of_keys; i++) {
+ error = innobase_check_column_length(prebuilt->table,
+ &key_info[i]);
+
+ if (error) {
+ DBUG_RETURN(error);
+ }
+ }
+
+ heap = mem_heap_create(1024);
+ trx_start_if_not_started(prebuilt->trx);
+
+ /* Create a background transaction for the operations on
+ the data dictionary tables. */
+ trx = innobase_trx_allocate(user_thd);
+ trx_start_if_not_started(trx);
+
/* Create table containing all indexes to be built in this
alter table add index so that they are in the correct order
in the table. */
@@ -696,7 +741,7 @@ err_exit:
num_of_idx = num_of_keys;
index_defs = innobase_create_key_def(
- trx, innodb_table, heap, key_info, num_of_idx);
+ trx, prebuilt->table, heap, key_info, num_of_idx);
new_primary = DICT_CLUSTERED & index_defs[0].ind_type;
@@ -710,7 +755,7 @@ err_exit:
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
/* Acquire a lock on the table before creating any indexes. */
- error = row_merge_lock_table(prebuilt->trx, innodb_table,
+ error = row_merge_lock_table(prebuilt->trx, prebuilt->table,
new_primary ? LOCK_X : LOCK_S);
if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
@@ -724,7 +769,7 @@ err_exit:
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
- ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
/* If a new primary key is defined for the table we need
to drop the original table and rebuild all indexes. */
@@ -732,15 +777,15 @@ err_exit:
if (UNIV_UNLIKELY(new_primary)) {
/* This transaction should be the only one
operating on the table. */
- ut_a(innodb_table->n_mysql_handles_opened == 1);
+ ut_a(prebuilt->table->n_mysql_handles_opened == 1);
char* new_table_name = innobase_create_temporary_tablename(
- heap, '1', innodb_table->name);
+ heap, '1', prebuilt->table->name);
/* Clone the table. */
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
indexed_table = row_merge_create_temporary_table(
- new_table_name, index_defs, innodb_table, trx);
+ new_table_name, index_defs, prebuilt->table, trx);
if (!indexed_table) {
@@ -754,14 +799,19 @@ err_exit:
break;
default:
error = convert_error_code_to_mysql(
- trx->error_state, innodb_table->flags,
+ trx->error_state,
+ prebuilt->table->flags,
user_thd);
}
- ut_d(dict_table_check_for_dup_indexes(innodb_table,
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table,
FALSE));
+ mem_heap_free(heap);
+ trx_general_rollback_for_mysql(trx, NULL);
row_mysql_unlock_data_dictionary(trx);
- goto err_exit;
+ trx_free_for_mysql(trx);
+ trx_commit_for_mysql(prebuilt->trx);
+ DBUG_RETURN(error);
}
trx->table_id = indexed_table->id;
@@ -769,25 +819,19 @@ err_exit:
/* Create the indexes in SYS_INDEXES and load into dictionary. */
- for (ulint i = 0; i < num_of_idx; i++) {
+ for (num_created = 0; num_created < num_of_idx; num_created++) {
- index[i] = row_merge_create_index(trx, indexed_table,
- &index_defs[i]);
+ index[num_created] = row_merge_create_index(
+ trx, indexed_table, &index_defs[num_created]);
- if (!index[i]) {
+ if (!index[num_created]) {
error = trx->error_state;
goto error_handling;
}
-
- num_created++;
}
ut_ad(error == DB_SUCCESS);
- /* We will need to rebuild index translation table. Set
- valid index entry count in the translation table to zero */
- share->idx_trans_tbl.index_count = 0;
-
/* Commit the data dictionary transaction in order to release
the table locks on the system tables. This means that if
MySQL crashes while creating a new primary key inside
@@ -805,7 +849,7 @@ err_exit:
if (UNIV_UNLIKELY(new_primary)) {
/* A primary key is to be built. Acquire an exclusive
table lock also on the table that is being created. */
- ut_ad(indexed_table != innodb_table);
+ ut_ad(indexed_table != prebuilt->table);
error = row_merge_lock_table(prebuilt->trx, indexed_table,
LOCK_X);
@@ -819,7 +863,7 @@ err_exit:
/* Read the clustered index of the table and build indexes
based on this information using temporary files and merge sort. */
error = row_merge_build_indexes(prebuilt->trx,
- innodb_table, indexed_table,
+ prebuilt->table, indexed_table,
index, num_of_idx, table);
error_handling:
@@ -827,63 +871,15 @@ error_handling:
dictionary which were defined. */
switch (error) {
- const char* old_name;
- char* tmp_name;
case DB_SUCCESS:
ut_a(!dict_locked);
- row_mysql_lock_data_dictionary(trx);
- dict_locked = TRUE;
+ ut_d(mutex_enter(&dict_sys->mutex));
ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
-
- if (!new_primary) {
- error = row_merge_rename_indexes(trx, indexed_table);
-
- if (error != DB_SUCCESS) {
- row_merge_drop_indexes(trx, indexed_table,
- index, num_created);
- }
-
- goto convert_error;
- }
-
- /* If a new primary key was defined for the table and
- there was no error at this point, we can now rename
- the old table as a temporary table, rename the new
- temporary table as the old table and drop the old table. */
- old_name = innodb_table->name;
- tmp_name = innobase_create_temporary_tablename(heap, '2',
- old_name);
-
- error = row_merge_rename_tables(innodb_table, indexed_table,
- tmp_name, trx);
-
- if (error != DB_SUCCESS) {
-
- row_merge_drop_table(trx, indexed_table);
-
- switch (error) {
- case DB_TABLESPACE_ALREADY_EXISTS:
- case DB_DUPLICATE_KEY:
- innobase_convert_tablename(tmp_name);
- my_error(HA_ERR_TABLE_EXIST, MYF(0), tmp_name);
- error = HA_ERR_TABLE_EXIST;
- break;
- default:
- goto convert_error;
- }
- break;
- }
-
- trx_commit_for_mysql(prebuilt->trx);
- row_prebuilt_free(prebuilt, TRUE);
- prebuilt = row_create_prebuilt(indexed_table);
-
- indexed_table->n_mysql_handles_opened++;
-
- error = row_merge_drop_table(trx, innodb_table);
- innodb_table = indexed_table;
- goto convert_error;
+ ut_d(mutex_exit(&dict_sys->mutex));
+ *add = new ha_innobase_add_index(table, key_info, num_of_keys,
+ indexed_table);
+ break;
case DB_TOO_BIG_RECORD:
my_error(HA_ERR_TO_BIG_ROW, MYF(0));
@@ -899,7 +895,7 @@ error:
trx->error_state = DB_SUCCESS;
if (new_primary) {
- if (indexed_table != innodb_table) {
+ if (indexed_table != prebuilt->table) {
row_merge_drop_table(trx, indexed_table);
}
} else {
@@ -911,30 +907,161 @@ error:
row_merge_drop_indexes(trx, indexed_table,
index, num_created);
}
-
-convert_error:
- error = convert_error_code_to_mysql(error,
- innodb_table->flags,
- user_thd);
}
- mem_heap_free(heap);
trx_commit_for_mysql(trx);
if (prebuilt->trx) {
trx_commit_for_mysql(prebuilt->trx);
}
if (dict_locked) {
- ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE));
row_mysql_unlock_data_dictionary(trx);
}
trx_free_for_mysql(trx);
+ mem_heap_free(heap);
/* There might be work for utility threads.*/
srv_active_wake_master_thread();
- DBUG_RETURN(error);
+ DBUG_RETURN(convert_error_code_to_mysql(error, prebuilt->table->flags,
+ user_thd));
+}
+
+/*******************************************************************//**
+Finalize or undo add_index().
+@return 0 or error number */
+UNIV_INTERN
+int
+ha_innobase::final_add_index(
+/*=========================*/
+ handler_add_index* add_arg,/*!< in: context from add_index() */
+ bool commit) /*!< in: true=commit, false=rollback */
+{
+ ha_innobase_add_index* add;
+ trx_t* trx;
+ int err = 0;
+
+ DBUG_ENTER("ha_innobase::final_add_index");
+
+ ut_ad(add_arg);
+ add = static_cast<class ha_innobase_add_index*>(add_arg);
+
+ /* Create a background transaction for the operations on
+ the data dictionary tables. */
+ trx = innobase_trx_allocate(user_thd);
+ trx_start_if_not_started(trx);
+
+ /* Flag this transaction as a dictionary operation, so that
+ the data dictionary will be locked in crash recovery. */
+ trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
+
+ /* Latch the InnoDB data dictionary exclusively so that no deadlocks
+ or lock waits can happen in it during an index create operation. */
+ row_mysql_lock_data_dictionary(trx);
+
+ if (add->indexed_table != prebuilt->table) {
+ ulint error;
+
+ /* We copied the table (new_primary). */
+ if (commit) {
+ mem_heap_t* heap;
+ char* tmp_name;
+
+ heap = mem_heap_create(1024);
+
+ /* A new primary key was defined for the table
+ and there was no error at this point. We can
+ now rename the old table as a temporary table,
+ rename the new temporary table as the old
+ table and drop the old table. */
+ tmp_name = innobase_create_temporary_tablename(
+ heap, '2', prebuilt->table->name);
+
+ error = row_merge_rename_tables(
+ prebuilt->table, add->indexed_table,
+ tmp_name, trx);
+
+ switch (error) {
+ case DB_TABLESPACE_ALREADY_EXISTS:
+ case DB_DUPLICATE_KEY:
+ innobase_convert_tablename(tmp_name);
+ my_error(HA_ERR_TABLE_EXIST, MYF(0), tmp_name);
+ err = HA_ERR_TABLE_EXIST;
+ break;
+ default:
+ err = convert_error_code_to_mysql(
+ error, prebuilt->table->flags,
+ user_thd);
+ break;
+ }
+
+ mem_heap_free(heap);
+ }
+
+ if (!commit || err) {
+ error = row_merge_drop_table(trx, add->indexed_table);
+ trx_commit_for_mysql(prebuilt->trx);
+ } else {
+ dict_table_t* old_table = prebuilt->table;
+ trx_commit_for_mysql(prebuilt->trx);
+ row_prebuilt_free(prebuilt, TRUE);
+ error = row_merge_drop_table(trx, old_table);
+ add->indexed_table->n_mysql_handles_opened++;
+ prebuilt = row_create_prebuilt(add->indexed_table);
+ }
+
+ err = convert_error_code_to_mysql(
+ error, prebuilt->table->flags, user_thd);
+ } else {
+ /* We created secondary indexes (!new_primary). */
+
+ if (commit) {
+ err = convert_error_code_to_mysql(
+ row_merge_rename_indexes(trx, prebuilt->table),
+ prebuilt->table->flags, user_thd);
+ }
+
+ if (!commit || err) {
+ dict_index_t* index;
+ dict_index_t* next_index;
+
+ for (index = dict_table_get_first_index(
+ prebuilt->table);
+ index; index = next_index) {
+
+ next_index = dict_table_get_next_index(index);
+
+ if (*index->name == TEMP_INDEX_PREFIX) {
+ row_merge_drop_index(
+ index, prebuilt->table, trx);
+ }
+ }
+ }
+ }
+
+ /* If index is successfully built, we will need to rebuild index
+ translation table. Set valid index entry count in the translation
+ table to zero. */
+ if (err == 0 && commit) {
+ share->idx_trans_tbl.index_count = 0;
+ }
+
+ trx_commit_for_mysql(trx);
+ if (prebuilt->trx) {
+ trx_commit_for_mysql(prebuilt->trx);
+ }
+
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ row_mysql_unlock_data_dictionary(trx);
+
+ trx_free_for_mysql(trx);
+
+ /* There might be work for utility threads.*/
+ srv_active_wake_master_thread();
+
+ delete add;
+ DBUG_RETURN(err);
}
/*******************************************************************//**
@@ -1014,12 +1141,13 @@ ha_innobase::prepare_drop_index(
index->to_be_dropped = TRUE;
}
- /* If FOREIGN_KEY_CHECK = 1 you may not drop an index defined
+ /* If FOREIGN_KEY_CHECKS = 1 you may not drop an index defined
for a foreign key constraint because InnoDB requires that both
- tables contain indexes for the constraint. Note that CREATE
- INDEX id ON table does a CREATE INDEX and DROP INDEX, and we
- can ignore here foreign keys because a new index for the
- foreign key has already been created.
+ tables contain indexes for the constraint. Such index can
+ be dropped only if FOREIGN_KEY_CHECKS is set to 0.
+ Note that CREATE INDEX id ON table does a CREATE INDEX and
+ DROP INDEX, and we can ignore here foreign keys because a
+ new index for the foreign key has already been created.
We check for the foreign key constraints after marking the
candidate indexes for deletion, because when we check for an
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index 17c22212ab5..6154ddb3cb4 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -32,26 +32,28 @@ Created July 18, 2007 Vasil Dimov
#include <mysys_err.h>
#include <my_sys.h>
#include "i_s.h"
-#include "innodb_patch_info.h"
-#include <mysql/plugin.h>
+#include <sql_plugin.h>
+#include <mysql/innodb_priv.h>
extern "C" {
-#include "trx0i_s.h"
-#include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */
+#include "btr0pcur.h" /* for file sys_tables related info. */
+#include "btr0types.h"
#include "buf0buddy.h" /* for i_s_cmpmem */
#include "buf0buf.h" /* for buf_pool and PAGE_ZIP_MIN_SIZE */
+#include "dict0load.h" /* for file sys_tables related info. */
+#include "dict0mem.h"
+#include "dict0types.h"
#include "ha_prototypes.h" /* for innobase_convert_name() */
#include "srv0start.h" /* for srv_was_started */
-#include "btr0btr.h" /* for btr_page_get_index_id */
+#include "trx0i_s.h"
+#include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */
#include "trx0rseg.h" /* for trx_rseg_struct */
#include "trx0sys.h" /* for trx_sys */
#include "dict0dict.h" /* for dict_sys */
-#include "btr0pcur.h"
#include "buf0lru.h" /* for XTRA_LRU_[DUMP/RESTORE] */
+#include "btr0btr.h" /* for btr_page_get_index_id */
}
-static const char plugin_author[] = "Innobase Oy";
-
#define OK(expr) \
if ((expr) != 0) { \
DBUG_RETURN(1); \
@@ -115,11 +117,6 @@ time_t MYSQL_TYPE_DATETIME
---------------------------------
*/
-/* XXX these are defined in mysql_priv.h inside #ifdef MYSQL_SERVER */
-bool schema_table_store_record(THD *thd, TABLE *table);
-void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
-bool check_global_access(THD *thd, ulong want_access);
-
/*******************************************************************//**
Common function to fill any of the dynamic tables:
INFORMATION_SCHEMA.innodb_trx
@@ -142,7 +139,6 @@ int
i_s_common_deinit(
/*==============*/
void* p); /*!< in/out: table schema object */
-
/*******************************************************************//**
Auxiliary function to store time_t value in MYSQL_TYPE_DATETIME
field.
@@ -224,357 +220,56 @@ field_store_ulint(
return(ret);
}
-/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_patches */
-static ST_FIELD_INFO innodb_patches_fields_info[] =
+/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */
+static ST_FIELD_INFO innodb_trx_fields_info[] =
{
-#define IDX_PATCH_NAME 0
- {STRUCT_FLD(field_name, "name"),
- STRUCT_FLD(field_length, 255),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
-#define IDX_PATCH_DESCR 1
- {STRUCT_FLD(field_name, "description"),
- STRUCT_FLD(field_length, 255),
+#define IDX_TRX_ID 0
+ {STRUCT_FLD(field_name, "trx_id"),
+ STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define IDX_PATCH_COMMENT 2
- {STRUCT_FLD(field_name, "comment"),
- STRUCT_FLD(field_length, 100),
+#define IDX_TRX_STATE 1
+ {STRUCT_FLD(field_name, "trx_state"),
+ STRUCT_FLD(field_length, TRX_QUE_STATE_STR_MAX_LEN + 1),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define IDX_PATCH_LINK 3
- {STRUCT_FLD(field_name, "link"),
- STRUCT_FLD(field_length, 255),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+#define IDX_TRX_STARTED 2
+ {STRUCT_FLD(field_name, "trx_started"),
+ STRUCT_FLD(field_length, 0),
+ STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- END_OF_ST_FIELD_INFO
-};
-
-static struct st_mysql_information_schema i_s_info =
-{
- MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
-};
-
-/***********************************************************************
-Fill the dynamic table information_schema.innodb_patches */
-static
-int
-innodb_patches_fill(
-/*=============*/
- /* out: 0 on success, 1 on failure */
- THD* thd, /* in: thread */
- TABLE_LIST* tables, /* in/out: tables to fill */
- COND* cond) /* in: condition (ignored) */
-{
- TABLE* table = (TABLE *) tables->table;
- int status = 0;
- int i;
- Field** fields;
-
-
- DBUG_ENTER("innodb_patches_fill");
- fields = table->field;
-
- /* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
-
- DBUG_RETURN(0);
- }
-
- RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
-
- for (i = 0; innodb_enhancements[i].file; i++) {
-
- field_store_string(fields[0],innodb_enhancements[i].file);
- field_store_string(fields[1],innodb_enhancements[i].name);
- field_store_string(fields[2],innodb_enhancements[i].comment);
- field_store_string(fields[3],innodb_enhancements[i].link);
-
- if (schema_table_store_record(thd, table)) {
- status = 1;
- break;
- }
-
- }
-
-
- DBUG_RETURN(status);
-}
-
-/***********************************************************************
-Bind the dynamic table information_schema.innodb_patches. */
-static
-int
-innodb_patches_init(
-/*=========*/
- /* out: 0 on success */
- void* p) /* in/out: table schema object */
-{
- DBUG_ENTER("innodb_patches_init");
- ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
-
- schema->fields_info = innodb_patches_fields_info;
- schema->fill_table = innodb_patches_fill;
-
- DBUG_RETURN(0);
-}
-
-
-UNIV_INTERN struct st_mysql_plugin i_s_innodb_patches =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "XTRADB_ENHANCEMENTS"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, "Percona"),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "Enhancements applied to InnoDB plugin"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, innodb_patches_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, INNODB_VERSION_SHORT),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* reserved for dependency checking */
- /* void* */
- STRUCT_FLD(__reserved1, NULL)
-};
-
-UNIV_INTERN struct st_maria_plugin i_s_innodb_patches_maria =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "XTRADB_ENHANCEMENTS"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, "Percona"),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "Enhancements applied to InnoDB plugin"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, innodb_patches_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, INNODB_VERSION_SHORT),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
-
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
-
-static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_fields_info[] =
-{
- {STRUCT_FLD(field_name, "page_type"),
- STRUCT_FLD(field_length, 64),
+#define IDX_TRX_REQUESTED_LOCK_ID 3
+ {STRUCT_FLD(field_name, "trx_requested_lock_id"),
+ STRUCT_FLD(field_length, TRX_I_S_LOCK_ID_MAX_LEN + 1),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "space_id"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "page_no"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "lru_position"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "fix_count"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "flush_type"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- END_OF_ST_FIELD_INFO
-};
-
-static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
-{
- {STRUCT_FLD(field_name, "index_id"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "space_id"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "page_no"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "n_recs"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "data_size"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "hashed"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "access_time"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "modified"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "dirty"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
- {STRUCT_FLD(field_name, "old"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+#define IDX_TRX_WAIT_STARTED 4
+ {STRUCT_FLD(field_name, "trx_wait_started"),
+ STRUCT_FLD(field_length, 0),
+ STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "lru_position"),
+#define IDX_TRX_WEIGHT 5
+ {STRUCT_FLD(field_name, "trx_weight"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -582,7 +277,8 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "fix_count"),
+#define IDX_TRX_MYSQL_THREAD_ID 6
+ {STRUCT_FLD(field_name, "trx_mysql_thread_id"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -590,28 +286,26 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "flush_type"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+#define IDX_TRX_QUERY 7
+ {STRUCT_FLD(field_name, "trx_query"),
+ STRUCT_FLD(field_length, TRX_I_S_TRX_QUERY_MAX_LEN),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- END_OF_ST_FIELD_INFO
-};
-
-static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
-{
- {STRUCT_FLD(field_name, "space_id"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+#define IDX_TRX_OPERATION_STATE 8
+ {STRUCT_FLD(field_name, "trx_operation_state"),
+ STRUCT_FLD(field_length, TRX_I_S_TRX_OP_STATE_MAX_LEN),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "page_no"),
+#define IDX_TRX_TABLES_IN_USE 9
+ {STRUCT_FLD(field_name, "trx_tables_in_use"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -619,7 +313,8 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "compressed"),
+#define IDX_TRX_TABLES_LOCKED 10
+ {STRUCT_FLD(field_name, "trx_tables_locked"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -627,7 +322,8 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "part_len"),
+#define IDX_TRX_LOCK_STRUCTS 11
+ {STRUCT_FLD(field_name, "trx_lock_structs"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -635,7 +331,8 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "next_page_no"),
+#define IDX_TRX_LOCK_MEMORY_BYTES 12
+ {STRUCT_FLD(field_name, "trx_lock_memory_bytes"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -643,7 +340,8 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "lru_position"),
+#define IDX_TRX_ROWS_LOCKED 13
+ {STRUCT_FLD(field_name, "trx_rows_locked"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -651,7 +349,8 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "fix_count"),
+#define IDX_TRX_ROWS_MODIFIED 14
+ {STRUCT_FLD(field_name, "trx_rows_modified"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -659,7 +358,8 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "flush_type"),
+#define IDX_TRX_CONNCURRENCY_TICKETS 15
+ {STRUCT_FLD(field_name, "trx_concurrency_tickets"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -667,695 +367,53 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- END_OF_ST_FIELD_INFO
-};
-
-/***********************************************************************
-Fill the dynamic table information_schema.innodb_buffer_pool_pages. */
-static
-int
-i_s_innodb_buffer_pool_pages_fill(
-/*================*/
- /* out: 0 on success, 1 on failure */
- THD* thd, /* in: thread */
- TABLE_LIST* tables, /* in/out: tables to fill */
- COND* cond) /* in: condition (ignored) */
-{
- TABLE* table = (TABLE *) tables->table;
- int status = 0;
-
- ulint n_chunks, n_blocks;
-
- buf_chunk_t* chunk;
-
- DBUG_ENTER("i_s_innodb_buffer_pool_pages_fill");
-
- /* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
-
- DBUG_RETURN(0);
- }
-
- RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
-
- buf_pool_mutex_enter();
-
- chunk = buf_pool->chunks;
-
- for (n_chunks = buf_pool->n_chunks; n_chunks--; chunk++) {
- buf_block_t* block = chunk->blocks;
-
- for (n_blocks = chunk->size; n_blocks--; block++) {
- const buf_frame_t* frame = block->frame;
-
- char page_type[64];
-
- switch(fil_page_get_type(frame))
- {
- case FIL_PAGE_INDEX:
- strcpy(page_type, "index");
- break;
- case FIL_PAGE_UNDO_LOG:
- strcpy(page_type, "undo_log");
- break;
- case FIL_PAGE_INODE:
- strcpy(page_type, "inode");
- break;
- case FIL_PAGE_IBUF_FREE_LIST:
- strcpy(page_type, "ibuf_free_list");
- break;
- case FIL_PAGE_TYPE_ALLOCATED:
- strcpy(page_type, "allocated");
- break;
- case FIL_PAGE_IBUF_BITMAP:
- strcpy(page_type, "bitmap");
- break;
- case FIL_PAGE_TYPE_SYS:
- strcpy(page_type, "sys");
- break;
- case FIL_PAGE_TYPE_TRX_SYS:
- strcpy(page_type, "trx_sys");
- break;
- case FIL_PAGE_TYPE_FSP_HDR:
- strcpy(page_type, "fsp_hdr");
- break;
- case FIL_PAGE_TYPE_XDES:
- strcpy(page_type, "xdes");
- break;
- case FIL_PAGE_TYPE_BLOB:
- strcpy(page_type, "blob");
- break;
- case FIL_PAGE_TYPE_ZBLOB:
- strcpy(page_type, "zblob");
- break;
- case FIL_PAGE_TYPE_ZBLOB2:
- strcpy(page_type, "zblob2");
- break;
- default:
- sprintf(page_type, "unknown (type=%li)", fil_page_get_type(frame));
- }
-
- field_store_string(table->field[0], page_type);
- table->field[1]->store(block->page.space);
- table->field[2]->store(block->page.offset);
- table->field[3]->store(0);
- table->field[4]->store(block->page.buf_fix_count);
- table->field[5]->store(block->page.flush_type);
-
- if (schema_table_store_record(thd, table)) {
- status = 1;
- break;
- }
-
- }
- }
-
- buf_pool_mutex_exit();
-
- DBUG_RETURN(status);
-}
-
-/***********************************************************************
-Fill the dynamic table information_schema.innodb_buffer_pool_pages_index. */
-static
-int
-i_s_innodb_buffer_pool_pages_index_fill(
-/*================*/
- /* out: 0 on success, 1 on failure */
- THD* thd, /* in: thread */
- TABLE_LIST* tables, /* in/out: tables to fill */
- COND* cond) /* in: condition (ignored) */
-{
- TABLE* table = (TABLE *) tables->table;
- int status = 0;
-
- ulint n_chunks, n_blocks;
- dulint index_id;
-
- buf_chunk_t* chunk;
-
- DBUG_ENTER("i_s_innodb_buffer_pool_pages_index_fill");
-
- /* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
-
- DBUG_RETURN(0);
- }
-
- RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
-
- buf_pool_mutex_enter();
-
- chunk = buf_pool->chunks;
-
- for (n_chunks = buf_pool->n_chunks; n_chunks--; chunk++) {
- buf_block_t* block = chunk->blocks;
-
- for (n_blocks = chunk->size; n_blocks--; block++) {
- const buf_frame_t* frame = block->frame;
-
- if (fil_page_get_type(frame) == FIL_PAGE_INDEX) {
- index_id = btr_page_get_index_id(frame);
- table->field[0]->store(ut_conv_dulint_to_longlong(index_id));
- table->field[1]->store(block->page.space);
- table->field[2]->store(block->page.offset);
- table->field[3]->store(page_get_n_recs(frame));
- table->field[4]->store(page_get_data_size(frame));
- table->field[5]->store(block->is_hashed);
- table->field[6]->store(block->page.access_time);
- table->field[7]->store(block->page.newest_modification != 0);
- table->field[8]->store(block->page.oldest_modification != 0);
- table->field[9]->store(block->page.old);
- table->field[10]->store(0);
- table->field[11]->store(block->page.buf_fix_count);
- table->field[12]->store(block->page.flush_type);
-
- if (schema_table_store_record(thd, table)) {
- status = 1;
- break;
- }
- }
- }
- }
-
- buf_pool_mutex_exit();
-
- DBUG_RETURN(status);
-}
-
-/***********************************************************************
-Fill the dynamic table information_schema.innodb_buffer_pool_pages_index. */
-static
-int
-i_s_innodb_buffer_pool_pages_blob_fill(
-/*================*/
- /* out: 0 on success, 1 on failure */
- THD* thd, /* in: thread */
- TABLE_LIST* tables, /* in/out: tables to fill */
- COND* cond) /* in: condition (ignored) */
-{
- TABLE* table = (TABLE *) tables->table;
- int status = 0;
-
- ulint n_chunks, n_blocks;
- buf_chunk_t* chunk;
- page_zip_des_t* block_page_zip;
-
- ulint part_len;
- ulint next_page_no;
-
- DBUG_ENTER("i_s_innodb_buffer_pool_pages_blob_fill");
-
- /* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
-
- DBUG_RETURN(0);
- }
-
- RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
-
- buf_pool_mutex_enter();
-
- chunk = buf_pool->chunks;
-
- for (n_chunks = buf_pool->n_chunks; n_chunks--; chunk++) {
- buf_block_t* block = chunk->blocks;
- block_page_zip = buf_block_get_page_zip(block);
-
- for (n_blocks = chunk->size; n_blocks--; block++) {
- const buf_frame_t* frame = block->frame;
-
- if (fil_page_get_type(frame) == FIL_PAGE_TYPE_BLOB) {
-
- if (UNIV_LIKELY_NULL(block_page_zip)) {
- part_len = 0; /* hmm, can't figure it out */
-
- next_page_no = mach_read_from_4(
- buf_block_get_frame(block)
- + FIL_PAGE_NEXT);
- } else {
- part_len = mach_read_from_4(
- buf_block_get_frame(block)
- + FIL_PAGE_DATA
- + 0 /*BTR_BLOB_HDR_PART_LEN*/);
-
- next_page_no = mach_read_from_4(
- buf_block_get_frame(block)
- + FIL_PAGE_DATA
- + 4 /*BTR_BLOB_HDR_NEXT_PAGE_NO*/);
- }
-
- table->field[0]->store(block->page.space);
- table->field[1]->store(block->page.offset);
- table->field[2]->store(block_page_zip != NULL);
- table->field[3]->store(part_len);
-
- if(next_page_no == FIL_NULL)
- {
- table->field[4]->store(0);
- } else {
- table->field[4]->store(block->page.offset);
- }
-
- table->field[5]->store(0);
- table->field[6]->store(block->page.buf_fix_count);
- table->field[7]->store(block->page.flush_type);
-
- if (schema_table_store_record(thd, table)) {
- status = 1;
- break;
- }
-
- }
- }
- }
-
- buf_pool_mutex_exit();
-
- DBUG_RETURN(status);
-}
-
-/***********************************************************************
-Bind the dynamic table information_schema.innodb_buffer_pool_pages. */
-static
-int
-i_s_innodb_buffer_pool_pages_init(
-/*=========*/
- /* out: 0 on success */
- void* p) /* in/out: table schema object */
-{
- DBUG_ENTER("i_s_innodb_buffer_pool_pages_init");
- ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
-
- schema->fields_info = i_s_innodb_buffer_pool_pages_fields_info;
- schema->fill_table = i_s_innodb_buffer_pool_pages_fill;
-
- DBUG_RETURN(0);
-}
-
-/***********************************************************************
-Bind the dynamic table information_schema.innodb_buffer_pool_pages. */
-static
-int
-i_s_innodb_buffer_pool_pages_index_init(
-/*=========*/
- /* out: 0 on success */
- void* p) /* in/out: table schema object */
-{
- DBUG_ENTER("i_s_innodb_buffer_pool_pages_index_init");
- ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
-
- schema->fields_info = i_s_innodb_buffer_pool_pages_index_fields_info;
- schema->fill_table = i_s_innodb_buffer_pool_pages_index_fill;
-
- DBUG_RETURN(0);
-}
-
-/***********************************************************************
-Bind the dynamic table information_schema.innodb_buffer_pool_pages. */
-static
-int
-i_s_innodb_buffer_pool_pages_blob_init(
-/*=========*/
- /* out: 0 on success */
- void* p) /* in/out: table schema object */
-{
- DBUG_ENTER("i_s_innodb_buffer_pool_pages_blob_init");
- ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
-
- schema->fields_info = i_s_innodb_buffer_pool_pages_blob_fields_info;
- schema->fill_table = i_s_innodb_buffer_pool_pages_blob_fill;
-
- DBUG_RETURN(0);
-}
-
-
-UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_pool_pages =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "InnoDB buffer pool pages"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* reserved for dependency checking */
- /* void* */
- STRUCT_FLD(__reserved1, NULL)
-};
-
-UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_pool_pages_maria =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "InnoDB buffer pool pages"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
-
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
-UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_pool_pages_index =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES_INDEX"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "InnoDB buffer pool index pages"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_index_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* reserved for dependency checking */
- /* void* */
- STRUCT_FLD(__reserved1, NULL)
-};
-
-UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_pool_pages_index_maria =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES_INDEX"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "InnoDB buffer pool index pages"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_index_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
-
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
-UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_pool_pages_blob =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES_BLOB"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "InnoDB buffer pool blob pages"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_blob_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* reserved for dependency checking */
- /* void* */
- STRUCT_FLD(__reserved1, NULL)
-};
-
-UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_pool_pages_blob_maria =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES_BLOB"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "InnoDB buffer pool blob pages"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_blob_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
-
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
-
-/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */
-static ST_FIELD_INFO innodb_trx_fields_info[] =
-{
-#define IDX_TRX_ID 0
- {STRUCT_FLD(field_name, "trx_id"),
- STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
+#define IDX_TRX_ISOLATION_LEVEL 16
+ {STRUCT_FLD(field_name, "trx_isolation_level"),
+ STRUCT_FLD(field_length, TRX_I_S_TRX_ISOLATION_LEVEL_MAX_LEN),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define IDX_TRX_STATE 1
- {STRUCT_FLD(field_name, "trx_state"),
- STRUCT_FLD(field_length, TRX_QUE_STATE_STR_MAX_LEN + 1),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
+#define IDX_TRX_UNIQUE_CHECKS 17
+ {STRUCT_FLD(field_name, "trx_unique_checks"),
+ STRUCT_FLD(field_length, 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 1),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define IDX_TRX_STARTED 2
- {STRUCT_FLD(field_name, "trx_started"),
- STRUCT_FLD(field_length, 0),
- STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
- STRUCT_FLD(value, 0),
+#define IDX_TRX_FOREIGN_KEY_CHECKS 18
+ {STRUCT_FLD(field_name, "trx_foreign_key_checks"),
+ STRUCT_FLD(field_length, 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 1),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define IDX_TRX_REQUESTED_LOCK_ID 3
- {STRUCT_FLD(field_name, "trx_requested_lock_id"),
- STRUCT_FLD(field_length, TRX_I_S_LOCK_ID_MAX_LEN + 1),
+#define IDX_TRX_LAST_FOREIGN_KEY_ERROR 19
+ {STRUCT_FLD(field_name, "trx_last_foreign_key_error"),
+ STRUCT_FLD(field_length, TRX_I_S_TRX_FK_ERROR_MAX_LEN),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define IDX_TRX_WAIT_STARTED 4
- {STRUCT_FLD(field_name, "trx_wait_started"),
- STRUCT_FLD(field_length, 0),
- STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
-#define IDX_TRX_WEIGHT 5
- {STRUCT_FLD(field_name, "trx_weight"),
- STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
- STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+#define IDX_TRX_ADAPTIVE_HASH_LATCHED 20
+ {STRUCT_FLD(field_name, "trx_adaptive_hash_latched"),
+ STRUCT_FLD(field_length, 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define IDX_TRX_MYSQL_THREAD_ID 6
- {STRUCT_FLD(field_name, "trx_mysql_thread_id"),
+#define IDX_TRX_ADAPTIVE_HASH_TIMEOUT 21
+ {STRUCT_FLD(field_name, "trx_adaptive_hash_timeout"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -1363,15 +421,6 @@ static ST_FIELD_INFO innodb_trx_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define IDX_TRX_QUERY 7
- {STRUCT_FLD(field_name, "trx_query"),
- STRUCT_FLD(field_length, TRX_I_S_TRX_QUERY_MAX_LEN),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
- STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
- STRUCT_FLD(old_name, ""),
- STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-
END_OF_ST_FIELD_INFO
};
@@ -1451,8 +500,72 @@ fill_innodb_trx_from_cache(
row->trx_mysql_thread_id));
/* trx_query */
- OK(field_store_string(fields[IDX_TRX_QUERY],
- row->trx_query));
+ if (row->trx_query) {
+ /* store will do appropriate character set
+ conversion check */
+ fields[IDX_TRX_QUERY]->store(
+ row->trx_query, strlen(row->trx_query),
+ row->trx_query_cs);
+ fields[IDX_TRX_QUERY]->set_notnull();
+ } else {
+ fields[IDX_TRX_QUERY]->set_null();
+ }
+
+ /* trx_operation_state */
+ OK(field_store_string(fields[IDX_TRX_OPERATION_STATE],
+ row->trx_operation_state));
+
+ /* trx_tables_in_use */
+ OK(fields[IDX_TRX_TABLES_IN_USE]->store(
+ (longlong) row->trx_tables_in_use, true));
+
+ /* trx_tables_locked */
+ OK(fields[IDX_TRX_TABLES_LOCKED]->store(
+ (longlong) row->trx_tables_locked, true));
+
+ /* trx_lock_structs */
+ OK(fields[IDX_TRX_LOCK_STRUCTS]->store(
+ (longlong) row->trx_lock_structs, true));
+
+ /* trx_lock_memory_bytes */
+ OK(fields[IDX_TRX_LOCK_MEMORY_BYTES]->store(
+ (longlong) row->trx_lock_memory_bytes, true));
+
+ /* trx_rows_locked */
+ OK(fields[IDX_TRX_ROWS_LOCKED]->store(
+ (longlong) row->trx_rows_locked, true));
+
+ /* trx_rows_modified */
+ OK(fields[IDX_TRX_ROWS_MODIFIED]->store(
+ (longlong) row->trx_rows_modified, true));
+
+ /* trx_concurrency_tickets */
+ OK(fields[IDX_TRX_CONNCURRENCY_TICKETS]->store(
+ (longlong) row->trx_concurrency_tickets, true));
+
+ /* trx_isolation_level */
+ OK(field_store_string(fields[IDX_TRX_ISOLATION_LEVEL],
+ row->trx_isolation_level));
+
+ /* trx_unique_checks */
+ OK(fields[IDX_TRX_UNIQUE_CHECKS]->store(
+ row->trx_unique_checks));
+
+ /* trx_foreign_key_checks */
+ OK(fields[IDX_TRX_FOREIGN_KEY_CHECKS]->store(
+ row->trx_foreign_key_checks));
+
+ /* trx_last_foreign_key_error */
+ OK(field_store_string(fields[IDX_TRX_LAST_FOREIGN_KEY_ERROR],
+ row->trx_foreign_key_error));
+
+ /* trx_adaptive_hash_latched */
+ OK(fields[IDX_TRX_ADAPTIVE_HASH_LATCHED]->store(
+ row->trx_has_search_latch));
+
+ /* trx_adaptive_hash_timeout */
+ OK(fields[IDX_TRX_ADAPTIVE_HASH_TIMEOUT]->store(
+ (longlong) row->trx_search_latch_timeout, true));
OK(schema_table_store_record(thd, table));
}
@@ -1481,6 +594,10 @@ innodb_trx_init(
DBUG_RETURN(0);
}
+static struct st_mysql_information_schema i_s_info =
+{
+ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
+};
UNIV_INTERN struct st_mysql_plugin i_s_innodb_trx =
{
@@ -1532,59 +649,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_trx =
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_trx_maria =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_TRX"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "InnoDB transactions"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, innodb_trx_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, INNODB_VERSION_SHORT),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
-
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */
static ST_FIELD_INFO innodb_locks_fields_info[] =
{
@@ -1709,16 +773,7 @@ fill_innodb_locks_from_cache(
for (i = 0; i < rows_num; i++) {
i_s_locks_row_t* row;
-
- /* note that the decoded database or table name is
- never expected to be longer than NAME_LEN;
- NAME_LEN for database name
- 2 for surrounding quotes around database name
- NAME_LEN for table name
- 2 for surrounding quotes around table name
- 1 for the separating dot (.)
- 9 for the #mysql50# prefix */
- char buf[2 * NAME_LEN + 14];
+ char buf[MAX_FULL_NAME_LEN + 1];
const char* bufend;
char lock_trx_id[TRX_ID_MAX_LEN + 1];
@@ -1860,59 +915,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_locks =
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_locks_maria =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_LOCKS"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "InnoDB conflicting locks"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, innodb_locks_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, INNODB_VERSION_SHORT),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
-
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
static ST_FIELD_INFO innodb_lock_waits_fields_info[] =
{
@@ -2063,7 +1065,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_lock_waits =
/* plugin author (for SHOW PLUGINS) */
/* const char* */
- STRUCT_FLD(author, "Innobase Oy"),
+ STRUCT_FLD(author, plugin_author),
/* general descriptive text (for SHOW PLUGINS) */
/* const char* */
@@ -2096,59 +1098,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_lock_waits =
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits_maria =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_LOCK_WAITS"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, "Innobase Oy"),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "InnoDB which lock is blocking which"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, innodb_lock_waits_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, INNODB_VERSION_SHORT),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
-
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
/*******************************************************************//**
Common function to fill any of the dynamic tables:
INFORMATION_SCHEMA.innodb_trx
@@ -2248,6 +1197,7 @@ trx_i_s_common_fill_table(
deadlock occurs between the mysqld server and mysql client,
see http://bugs.mysql.com/29900 ; when that bug is resolved
we can enable the DBUG_RETURN(ret) above */
+ ret++; // silence a gcc46 warning
DBUG_RETURN(0);
#endif
}
@@ -2481,59 +1431,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp =
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_maria =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_CMP"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "Statistics for the InnoDB compression"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_cmp_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, INNODB_VERSION_SHORT),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
-
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_reset =
{
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
@@ -2584,59 +1481,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_reset =
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset_maria =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_CMP_RESET"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "Statistics for the InnoDB compression;"
- " reset cumulated counts"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_cmp_reset_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, INNODB_VERSION_SHORT),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
-
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
/* Fields of the dynamic table information_schema.innodb_cmpmem. */
static ST_FIELD_INFO i_s_cmpmem_fields_info[] =
{
@@ -2648,6 +1492,14 @@ static ST_FIELD_INFO i_s_cmpmem_fields_info[] =
STRUCT_FLD(old_name, "Buddy Block Size"),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+ {STRUCT_FLD(field_name, "buffer_pool_instance"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, "Buffer Pool Id"),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
{STRUCT_FLD(field_name, "pages_used"),
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
@@ -2678,7 +1530,7 @@ static ST_FIELD_INFO i_s_cmpmem_fields_info[] =
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, "Total Duration of Relocations,"
- " in Seconds"),
+ " in Seconds"),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
END_OF_ST_FIELD_INFO
@@ -2697,8 +1549,8 @@ i_s_cmpmem_fill_low(
COND* cond, /*!< in: condition (ignored) */
ibool reset) /*!< in: TRUE=reset cumulated counts */
{
+ int status = 0;
TABLE* table = (TABLE *) tables->table;
- int status = 0;
DBUG_ENTER("i_s_cmpmem_fill_low");
@@ -2710,35 +1562,52 @@ i_s_cmpmem_fill_low(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
- //buf_pool_mutex_enter();
- mutex_enter(&zip_free_mutex);
+ for (ulint i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
- for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
- buf_buddy_stat_t* buddy_stat = &buf_buddy_stat[x];
+ status = 0;
- table->field[0]->store(BUF_BUDDY_LOW << x);
- table->field[1]->store(buddy_stat->used);
- table->field[2]->store(UNIV_LIKELY(x < BUF_BUDDY_SIZES)
- ? UT_LIST_GET_LEN(buf_pool->zip_free[x])
- : 0);
- table->field[3]->store((longlong) buddy_stat->relocated, true);
- table->field[4]->store(
- (ulong) (buddy_stat->relocated_usec / 1000000));
+ buf_pool = buf_pool_from_array(i);
- if (reset) {
- /* This is protected by buf_pool_mutex. */
- buddy_stat->relocated = 0;
- buddy_stat->relocated_usec = 0;
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->zip_free_mutex);
+
+ for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
+ buf_buddy_stat_t* buddy_stat;
+
+ buddy_stat = &buf_pool->buddy_stat[x];
+
+ table->field[0]->store(BUF_BUDDY_LOW << x);
+ table->field[1]->store(i);
+ table->field[2]->store(buddy_stat->used);
+ table->field[3]->store(UNIV_LIKELY(x < BUF_BUDDY_SIZES)
+ ? UT_LIST_GET_LEN(buf_pool->zip_free[x])
+ : 0);
+ table->field[4]->store((longlong)
+ buddy_stat->relocated, true);
+ table->field[5]->store(
+ (ulong) (buddy_stat->relocated_usec / 1000000));
+
+ if (reset) {
+ /* This is protected by buf_pool->mutex. */
+ buddy_stat->relocated = 0;
+ buddy_stat->relocated_usec = 0;
+ }
+
+ if (schema_table_store_record(thd, table)) {
+ status = 1;
+ break;
+ }
}
- if (schema_table_store_record(thd, table)) {
- status = 1;
+ //buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->zip_free_mutex);
+
+ if (status) {
break;
}
}
- //buf_pool_mutex_exit();
- mutex_exit(&zip_free_mutex);
DBUG_RETURN(status);
}
@@ -2855,60 +1724,273 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem =
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_maria =
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset =
{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_CMPMEM_RESET"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, plugin_author),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool;"
+ " reset cumulated counts"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, i_s_cmpmem_reset_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(deinit, i_s_common_deinit),
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_CMPMEM"),
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool"),
+ /* reserved for dependency checking */
+ /* void* */
+ STRUCT_FLD(__reserved1, NULL)
+};
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_cmpmem_init),
+/*******************************************************************//**
+Unbind a dynamic INFORMATION_SCHEMA table.
+@return 0 on success */
+static
+int
+i_s_common_deinit(
+/*==============*/
+ void* p) /*!< in/out: table schema object */
+{
+ DBUG_ENTER("i_s_common_deinit");
+
+ /* Do nothing */
+
+ DBUG_RETURN(0);
+}
+
+/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLES */
+static ST_FIELD_INFO innodb_sys_tables_fields_info[] =
+{
+#define SYS_TABLE_ID 0
+ {STRUCT_FLD(field_name, "TABLE_ID"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
+#define SYS_TABLE_SCHEMA 1
+ {STRUCT_FLD(field_name, "SCHEMA"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, INNODB_VERSION_SHORT),
+#define SYS_TABLE_NAME 2
+ {STRUCT_FLD(field_name, "NAME"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
+#define SYS_TABLE_FLAG 3
+ {STRUCT_FLD(field_name, "FLAG"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
+#define SYS_TABLE_NUM_COLUMN 4
+ {STRUCT_FLD(field_name, "N_COLS"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
+#define SYS_TABLE_SPACE 5
+ {STRUCT_FLD(field_name, "SPACE"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
+ END_OF_ST_FIELD_INFO
};
-UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset =
+/**********************************************************************//**
+Populate information_schema.innodb_sys_tables table with information
+from SYS_TABLES.
+@return 0 on success */
+static
+int
+i_s_dict_fill_sys_tables(
+/*=====================*/
+ THD* thd, /*!< in: thread */
+ dict_table_t* table, /*!< in: table */
+ TABLE* table_to_fill) /*!< in/out: fill this table */
+{
+ Field** fields;
+ char buf[NAME_LEN * 2 + 2];
+ char* ptr;
+
+ DBUG_ENTER("i_s_dict_fill_sys_tables");
+
+ fields = table_to_fill->field;
+
+ OK(fields[SYS_TABLE_ID]->store(longlong(table->id), TRUE));
+
+ strncpy(buf, table->name, NAME_LEN * 2 + 2);
+ ptr = strchr(buf, '/');
+ if (ptr) {
+ *ptr = '\0';
+ ++ptr;
+
+ OK(field_store_string(fields[SYS_TABLE_SCHEMA], buf));
+ OK(field_store_string(fields[SYS_TABLE_NAME], ptr));
+ } else {
+ fields[SYS_TABLE_SCHEMA]->set_null();
+ OK(field_store_string(fields[SYS_TABLE_NAME], buf));
+ }
+
+ OK(fields[SYS_TABLE_FLAG]->store(table->flags));
+
+ OK(fields[SYS_TABLE_NUM_COLUMN]->store(table->n_cols));
+
+ OK(fields[SYS_TABLE_SPACE]->store(table->space));
+
+ OK(schema_table_store_record(thd, table_to_fill));
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Function to go through each record in SYS_TABLES table, and fill the
+information_schema.innodb_sys_tables table with related table information
+@return 0 on success */
+static
+int
+i_s_sys_tables_fill_table(
+/*======================*/
+ THD* thd, /*!< in: thread */
+ TABLE_LIST* tables, /*!< in/out: tables to fill */
+ COND* cond) /*!< in: condition (not used) */
+{
+ btr_pcur_t pcur;
+ const rec_t* rec;
+ mem_heap_t* heap;
+ mtr_t mtr;
+
+ DBUG_ENTER("i_s_sys_tables_fill_table");
+
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+
+ DBUG_RETURN(0);
+ }
+
+ heap = mem_heap_create(1000);
+ mutex_enter(&(dict_sys->mutex));
+ mtr_start(&mtr);
+
+ rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES);
+
+ while (rec) {
+ const char* err_msg;
+ dict_table_t* table_rec;
+
+ /* Create and populate a dict_table_t structure with
+ information from SYS_TABLES row */
+ err_msg = dict_process_sys_tables_rec(
+ heap, rec, &table_rec, DICT_TABLE_LOAD_FROM_RECORD);
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+
+ if (!err_msg) {
+ i_s_dict_fill_sys_tables(thd, table_rec, tables->table);
+ } else {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_FIND_SYSTEM_REC,
+ err_msg);
+ }
+
+ /* Since dict_process_sys_tables_rec() is called with
+ DICT_TABLE_LOAD_FROM_RECORD, the table_rec is created in
+ dict_process_sys_tables_rec(), we will need to free it */
+ if (table_rec) {
+ dict_mem_table_free(table_rec);
+ }
+
+ mem_heap_empty(heap);
+
+ /* Get the next record */
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+ rec = dict_getnext_system(&pcur, &mtr);
+ }
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+ mem_heap_free(heap);
+
+ DBUG_RETURN(0);
+}
+
+/*******************************************************************//**
+Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_tables
+@return 0 on success */
+static
+int
+innodb_sys_tables_init(
+/*===================*/
+ void* p) /*!< in/out: table schema object */
+{
+ ST_SCHEMA_TABLE* schema;
+
+ DBUG_ENTER("innodb_sys_tables_init");
+
+ schema = (ST_SCHEMA_TABLE*) p;
+
+ schema->fields_info = innodb_sys_tables_fields_info;
+ schema->fill_table = i_s_sys_tables_fill_table;
+
+ DBUG_RETURN(0);
+}
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tables =
{
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
/* int */
@@ -2920,16 +2002,15 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset =
/* plugin name */
/* const char* */
- STRUCT_FLD(name, "INNODB_CMPMEM_RESET"),
+ STRUCT_FLD(name, "INNODB_SYS_TABLES"),
/* plugin author (for SHOW PLUGINS) */
/* const char* */
- STRUCT_FLD(author, plugin_author),
+ STRUCT_FLD(author, "Percona"),
/* general descriptive text (for SHOW PLUGINS) */
/* const char* */
- STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool;"
- " reset cumulated counts"),
+ STRUCT_FLD(descr, "InnoDB SYS_TABLES"),
/* the plugin license (PLUGIN_LICENSE_XXX) */
/* int */
@@ -2937,7 +2018,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset =
/* the function to invoke when plugin is loaded */
/* int (*)(void*); */
- STRUCT_FLD(init, i_s_cmpmem_reset_init),
+ STRUCT_FLD(init, innodb_sys_tables_init),
/* the function to invoke when plugin is unloaded */
/* int (*)(void*); */
@@ -2958,75 +2039,1641 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset =
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset_maria =
+/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLESTATS */
+static ST_FIELD_INFO innodb_sys_tablestats_fields_info[] =
{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+#define SYS_TABLESTATS_ID 0
+ {STRUCT_FLD(field_name, "TABLE_ID"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
+#define SYS_TABLESTATS_SCHEMA 1
+ {STRUCT_FLD(field_name, "SCHEMA"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_CMPMEM_RESET"),
+#define SYS_TABLESTATS_NAME 2
+ {STRUCT_FLD(field_name, "NAME"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
+#define SYS_TABLESTATS_INIT 3
+ {STRUCT_FLD(field_name, "STATS_INITIALIZED"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool;"
- " reset cumulated counts"),
+#define SYS_TABLESTATS_NROW 4
+ {STRUCT_FLD(field_name, "NUM_ROWS"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+#define SYS_TABLESTATS_CLUST_SIZE 5
+ {STRUCT_FLD(field_name, "CLUST_INDEX_SIZE"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_cmpmem_reset_init),
+#define SYS_TABLESTATS_INDEX_SIZE 6
+ {STRUCT_FLD(field_name, "OTHER_INDEX_SIZE"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
+#define SYS_TABLESTATS_MODIFIED 7
+ {STRUCT_FLD(field_name, "MODIFIED_COUNTER"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, INNODB_VERSION_SHORT),
+#define SYS_TABLESTATS_AUTONINC 8
+ {STRUCT_FLD(field_name, "AUTOINC"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
+#define SYS_TABLESTATS_MYSQL_OPEN_HANDLE 9
+ {STRUCT_FLD(field_name, "MYSQL_HANDLES_OPENED"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+ END_OF_ST_FIELD_INFO
+};
+
+/**********************************************************************//**
+Populate information_schema.innodb_sys_tablestats table with information
+from SYS_TABLES.
+@return 0 on success */
+static
+int
+i_s_dict_fill_sys_tablestats(
+/*=========================*/
+ THD* thd, /*!< in: thread */
+ dict_table_t* table, /*!< in: table */
+ TABLE* table_to_fill) /*!< in/out: fill this table */
+{
+ Field** fields;
+ char buf[NAME_LEN * 2 + 2];
+ char* ptr;
+
+ DBUG_ENTER("i_s_dict_fill_sys_tablestats");
+
+ fields = table_to_fill->field;
+
+ OK(fields[SYS_TABLESTATS_ID]->store(longlong(table->id), TRUE));
+
+ strncpy(buf, table->name, NAME_LEN * 2 + 2);
+ ptr = strchr(buf, '/');
+ if (ptr) {
+ *ptr = '\0';
+ ++ptr;
+
+ OK(field_store_string(fields[SYS_TABLESTATS_SCHEMA], buf));
+ OK(field_store_string(fields[SYS_TABLESTATS_NAME], ptr));
+ } else {
+ fields[SYS_TABLESTATS_SCHEMA]->set_null();
+ OK(field_store_string(fields[SYS_TABLESTATS_NAME], buf));
+ }
+
+ if (table->stat_initialized) {
+ OK(field_store_string(fields[SYS_TABLESTATS_INIT],
+ "Initialized"));
+ } else {
+ OK(field_store_string(fields[SYS_TABLESTATS_INIT],
+ "Uninitialized"));
+ }
+
+ OK(fields[SYS_TABLESTATS_NROW]->store(table->stat_n_rows, TRUE));
+
+ OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(
+ table->stat_clustered_index_size));
+
+ OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(
+ table->stat_sum_of_other_index_sizes));
+
+ OK(fields[SYS_TABLESTATS_MODIFIED]->store(
+ table->stat_modified_counter));
+
+ OK(fields[SYS_TABLESTATS_AUTONINC]->store(table->autoinc, TRUE));
+
+ OK(fields[SYS_TABLESTATS_MYSQL_OPEN_HANDLE]->store(
+ table->n_mysql_handles_opened));
+
+ OK(schema_table_store_record(thd, table_to_fill));
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Function to go through each record in SYS_TABLES table, and fill the
+information_schema.innodb_sys_tablestats table with table statistics
+related information
+@return 0 on success */
+static
+int
+i_s_sys_tables_fill_table_stats(
+/*============================*/
+ THD* thd, /*!< in: thread */
+ TABLE_LIST* tables, /*!< in/out: tables to fill */
+ COND* cond) /*!< in: condition (not used) */
+{
+ btr_pcur_t pcur;
+ const rec_t* rec;
+ mem_heap_t* heap;
+ mtr_t mtr;
+
+ DBUG_ENTER("i_s_sys_tables_fill_table_stats");
+
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+
+ DBUG_RETURN(0);
+ }
+
+ heap = mem_heap_create(1000);
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+
+ rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES);
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
+ while (rec) {
+ const char* err_msg;
+ dict_table_t* table_rec;
+
+ /* Fetch the dict_table_t structure corresponding to
+ this SYS_TABLES record */
+ err_msg = dict_process_sys_tables_rec(
+ heap, rec, &table_rec, DICT_TABLE_LOAD_FROM_CACHE);
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+
+ if (!err_msg) {
+ i_s_dict_fill_sys_tablestats(thd, table_rec,
+ tables->table);
+ } else {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_FIND_SYSTEM_REC,
+ err_msg);
+ }
+
+ mem_heap_empty(heap);
+
+ /* Get the next record */
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+ rec = dict_getnext_system(&pcur, &mtr);
+ }
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+ mem_heap_free(heap);
+
+ DBUG_RETURN(0);
+}
+
+/*******************************************************************//**
+Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_tablestats
+@return 0 on success */
+static
+int
+innodb_sys_tablestats_init(
+/*=======================*/
+ void* p) /*!< in/out: table schema object */
+{
+ ST_SCHEMA_TABLE* schema;
+
+ DBUG_ENTER("innodb_sys_tablestats_init");
+
+ schema = (ST_SCHEMA_TABLE*) p;
+
+ schema->fields_info = innodb_sys_tablestats_fields_info;
+ schema->fill_table = i_s_sys_tables_fill_table_stats;
+
+ DBUG_RETURN(0);
+}
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tablestats =
+{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_SYS_TABLESTATS"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB SYS_TABLESTATS"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, innodb_sys_tablestats_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
+
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
+
+ /* reserved for dependency checking */
+ /* void* */
+ STRUCT_FLD(__reserved1, NULL)
+};
+
+/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_INDEXES */
+static ST_FIELD_INFO innodb_sysindex_fields_info[] =
+{
+#define SYS_INDEX_ID 0
+ {STRUCT_FLD(field_name, "INDEX_ID"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_INDEX_NAME 1
+ {STRUCT_FLD(field_name, "NAME"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_INDEX_TABLE_ID 2
+ {STRUCT_FLD(field_name, "TABLE_ID"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_INDEX_TYPE 3
+ {STRUCT_FLD(field_name, "TYPE"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_INDEX_NUM_FIELDS 4
+ {STRUCT_FLD(field_name, "N_FIELDS"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_INDEX_PAGE_NO 5
+ {STRUCT_FLD(field_name, "PAGE_NO"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_INDEX_SPACE 6
+ {STRUCT_FLD(field_name, "SPACE"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+ END_OF_ST_FIELD_INFO
};
+/**********************************************************************//**
+Function to populate the information_schema.innodb_sys_indexes table with
+collected index information
+@return 0 on success */
+static
+int
+i_s_dict_fill_sys_indexes(
+/*======================*/
+ THD* thd, /*!< in: thread */
+ table_id_t table_id, /*!< in: table id */
+ dict_index_t* index, /*!< in: populated dict_index_t
+ struct with index info */
+ TABLE* table_to_fill) /*!< in/out: fill this table */
+{
+ Field** fields;
+
+ DBUG_ENTER("i_s_dict_fill_sys_indexes");
+
+ fields = table_to_fill->field;
+
+ OK(fields[SYS_INDEX_ID]->store(longlong(index->id), TRUE));
+
+ OK(field_store_string(fields[SYS_INDEX_NAME], index->name));
+
+ OK(fields[SYS_INDEX_TABLE_ID]->store(longlong(table_id), TRUE));
+
+ OK(fields[SYS_INDEX_TYPE]->store(index->type));
+
+ OK(fields[SYS_INDEX_NUM_FIELDS]->store(index->n_fields));
+
+ OK(fields[SYS_INDEX_PAGE_NO]->store(index->page));
+
+ OK(fields[SYS_INDEX_SPACE]->store(index->space));
+
+ OK(schema_table_store_record(thd, table_to_fill));
+
+ DBUG_RETURN(0);
+}
/*******************************************************************//**
-Unbind a dynamic INFORMATION_SCHEMA table.
-@return 0 on success */
+Function to go through each record in SYS_INDEXES table, and fill the
+information_schema.innodb_sys_indexes table with related index information
+@return 0 on success */
static
int
-i_s_common_deinit(
-/*==============*/
- void* p) /*!< in/out: table schema object */
+i_s_sys_indexes_fill_table(
+/*=======================*/
+ THD* thd, /*!< in: thread */
+ TABLE_LIST* tables, /*!< in/out: tables to fill */
+ COND* cond) /*!< in: condition (not used) */
{
- DBUG_ENTER("i_s_common_deinit");
+ btr_pcur_t pcur;
+ const rec_t* rec;
+ mem_heap_t* heap;
+ mtr_t mtr;
- /* Do nothing */
+ DBUG_ENTER("i_s_sys_indexes_fill_table");
+
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+
+ DBUG_RETURN(0);
+ }
+
+ heap = mem_heap_create(1000);
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+
+ /* Start scan the SYS_INDEXES table */
+ rec = dict_startscan_system(&pcur, &mtr, SYS_INDEXES);
+
+ /* Process each record in the table */
+ while (rec) {
+ const char* err_msg;;
+ table_id_t table_id;
+ dict_index_t index_rec;
+
+ /* Populate a dict_index_t structure with information from
+ a SYS_INDEXES row */
+ err_msg = dict_process_sys_indexes_rec(heap, rec, &index_rec,
+ &table_id);
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+
+ if (!err_msg) {
+ i_s_dict_fill_sys_indexes(thd, table_id, &index_rec,
+ tables->table);
+ } else {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_FIND_SYSTEM_REC,
+ err_msg);
+ }
+
+ mem_heap_empty(heap);
+
+ /* Get the next record */
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+ rec = dict_getnext_system(&pcur, &mtr);
+ }
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+ mem_heap_free(heap);
DBUG_RETURN(0);
}
+/*******************************************************************//**
+Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_indexes
+@return 0 on success */
+static
+int
+innodb_sys_indexes_init(
+/*====================*/
+ void* p) /*!< in/out: table schema object */
+{
+ ST_SCHEMA_TABLE* schema;
+
+ DBUG_ENTER("innodb_sys_index_init");
+
+ schema = (ST_SCHEMA_TABLE*) p;
+
+ schema->fields_info = innodb_sysindex_fields_info;
+ schema->fill_table = i_s_sys_indexes_fill_table;
+
+ DBUG_RETURN(0);
+}
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_indexes =
+{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_SYS_INDEXES"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB SYS_INDEXES"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, innodb_sys_indexes_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
+
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
+
+ /* reserved for dependency checking */
+ /* void* */
+ STRUCT_FLD(__reserved1, NULL)
+};
+
+/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_COLUMNS */
+static ST_FIELD_INFO innodb_sys_columns_fields_info[] =
+{
+#define SYS_COLUMN_TABLE_ID 0
+ {STRUCT_FLD(field_name, "TABLE_ID"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_COLUMN_NAME 1
+ {STRUCT_FLD(field_name, "NAME"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_COLUMN_POSITION 2
+ {STRUCT_FLD(field_name, "POS"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_COLUMN_MTYPE 3
+ {STRUCT_FLD(field_name, "MTYPE"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_COLUMN__PRTYPE 4
+ {STRUCT_FLD(field_name, "PRTYPE"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_COLUMN_COLUMN_LEN 5
+ {STRUCT_FLD(field_name, "LEN"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+ END_OF_ST_FIELD_INFO
+};
+
+/**********************************************************************//**
+Function to populate the information_schema.innodb_sys_columns with
+related column information
+@return 0 on success */
+static
+int
+i_s_dict_fill_sys_columns(
+/*======================*/
+ THD* thd, /*!< in: thread */
+ table_id_t table_id, /*!< in: table ID */
+ const char* col_name, /*!< in: column name */
+ dict_col_t* column, /*!< in: dict_col_t struct holding
+ more column information */
+ TABLE* table_to_fill) /*!< in/out: fill this table */
+{
+ Field** fields;
+
+ DBUG_ENTER("i_s_dict_fill_sys_columns");
+
+ fields = table_to_fill->field;
+
+ OK(fields[SYS_COLUMN_TABLE_ID]->store(longlong(table_id), TRUE));
+
+ OK(field_store_string(fields[SYS_COLUMN_NAME], col_name));
+
+ OK(fields[SYS_COLUMN_POSITION]->store(column->ind));
+
+ OK(fields[SYS_COLUMN_MTYPE]->store(column->mtype));
+
+ OK(fields[SYS_COLUMN__PRTYPE]->store(column->prtype));
+
+ OK(fields[SYS_COLUMN_COLUMN_LEN]->store(column->len));
+
+ OK(schema_table_store_record(thd, table_to_fill));
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Function to fill information_schema.innodb_sys_columns with information
+collected by scanning SYS_COLUMNS table.
+@return 0 on success */
+static
+int
+i_s_sys_columns_fill_table(
+/*=======================*/
+ THD* thd, /*!< in: thread */
+ TABLE_LIST* tables, /*!< in/out: tables to fill */
+ COND* cond) /*!< in: condition (not used) */
+{
+ btr_pcur_t pcur;
+ const rec_t* rec;
+ const char* col_name;
+ mem_heap_t* heap;
+ mtr_t mtr;
+
+ DBUG_ENTER("i_s_sys_columns_fill_table");
+
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+
+ DBUG_RETURN(0);
+ }
+
+ heap = mem_heap_create(1000);
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+
+ rec = dict_startscan_system(&pcur, &mtr, SYS_COLUMNS);
+
+ while (rec) {
+ const char* err_msg;
+ dict_col_t column_rec;
+ table_id_t table_id;
+
+ /* populate a dict_col_t structure with information from
+ a SYS_COLUMNS row */
+ err_msg = dict_process_sys_columns_rec(heap, rec, &column_rec,
+ &table_id, &col_name);
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+
+ if (!err_msg) {
+ i_s_dict_fill_sys_columns(thd, table_id, col_name,
+ &column_rec,
+ tables->table);
+ } else {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_FIND_SYSTEM_REC,
+ err_msg);
+ }
+
+ mem_heap_empty(heap);
+
+ /* Get the next record */
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+ rec = dict_getnext_system(&pcur, &mtr);
+ }
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+ mem_heap_free(heap);
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_columns
+@return 0 on success */
+static
+int
+innodb_sys_columns_init(
+/*====================*/
+ void* p) /*!< in/out: table schema object */
+{
+ ST_SCHEMA_TABLE* schema;
+
+ DBUG_ENTER("innodb_sys_columns_init");
+
+ schema = (ST_SCHEMA_TABLE*) p;
+
+ schema->fields_info = innodb_sys_columns_fields_info;
+ schema->fill_table = i_s_sys_columns_fill_table;
+
+ DBUG_RETURN(0);
+}
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_columns =
+{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_SYS_COLUMNS"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB SYS_COLUMNS"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, innodb_sys_columns_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
+
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
+
+ /* reserved for dependency checking */
+ /* void* */
+ STRUCT_FLD(__reserved1, NULL)
+};
+/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_fields */
+static ST_FIELD_INFO innodb_sys_fields_fields_info[] =
+{
+#define SYS_FIELD_INDEX_ID 0
+ {STRUCT_FLD(field_name, "INDEX_ID"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_FIELD_NAME 1
+ {STRUCT_FLD(field_name, "NAME"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_FIELD_POS 2
+ {STRUCT_FLD(field_name, "POS"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+ END_OF_ST_FIELD_INFO
+};
+
+/**********************************************************************//**
+Function to fill information_schema.innodb_sys_fields with information
+collected by scanning SYS_FIELDS table.
+@return 0 on success */
+static
+int
+i_s_dict_fill_sys_fields(
+/*=====================*/
+ THD* thd, /*!< in: thread */
+ index_id_t index_id, /*!< in: index id for the field */
+ dict_field_t* field, /*!< in: table */
+ ulint pos, /*!< in: Field position */
+ TABLE* table_to_fill) /*!< in/out: fill this table */
+{
+ Field** fields;
+
+ DBUG_ENTER("i_s_dict_fill_sys_fields");
+
+ fields = table_to_fill->field;
+
+ OK(fields[SYS_FIELD_INDEX_ID]->store(longlong(index_id), TRUE));
+
+ OK(field_store_string(fields[SYS_FIELD_NAME], field->name));
+
+ OK(fields[SYS_FIELD_POS]->store(pos));
+
+ OK(schema_table_store_record(thd, table_to_fill));
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Function to go through each record in SYS_FIELDS table, and fill the
+information_schema.innodb_sys_fields table with related index field
+information
+@return 0 on success */
+static
+int
+i_s_sys_fields_fill_table(
+/*======================*/
+ THD* thd, /*!< in: thread */
+ TABLE_LIST* tables, /*!< in/out: tables to fill */
+ COND* cond) /*!< in: condition (not used) */
+{
+ btr_pcur_t pcur;
+ const rec_t* rec;
+ mem_heap_t* heap;
+ index_id_t last_id;
+ mtr_t mtr;
+
+ DBUG_ENTER("i_s_sys_fields_fill_table");
+
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+
+ DBUG_RETURN(0);
+ }
+
+ heap = mem_heap_create(1000);
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+
+ /* will save last index id so that we know whether we move to
+ the next index. This is used to calculate prefix length */
+ last_id = 0;
+
+ rec = dict_startscan_system(&pcur, &mtr, SYS_FIELDS);
+
+ while (rec) {
+ ulint pos;
+ const char* err_msg;
+ index_id_t index_id;
+ dict_field_t field_rec;
+
+ /* Populate a dict_field_t structure with information from
+ a SYS_FIELDS row */
+ err_msg = dict_process_sys_fields_rec(heap, rec, &field_rec,
+ &pos, &index_id, last_id);
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+
+ if (!err_msg) {
+ i_s_dict_fill_sys_fields(thd, index_id, &field_rec,
+ pos, tables->table);
+ last_id = index_id;
+ } else {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_FIND_SYSTEM_REC,
+ err_msg);
+ }
+
+ mem_heap_empty(heap);
+
+ /* Get the next record */
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+ rec = dict_getnext_system(&pcur, &mtr);
+ }
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+ mem_heap_free(heap);
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_fields
+@return 0 on success */
+static
+int
+innodb_sys_fields_init(
+/*===================*/
+ void* p) /*!< in/out: table schema object */
+{
+ ST_SCHEMA_TABLE* schema;
+
+ DBUG_ENTER("innodb_sys_field_init");
+
+ schema = (ST_SCHEMA_TABLE*) p;
+
+ schema->fields_info = innodb_sys_fields_fields_info;
+ schema->fill_table = i_s_sys_fields_fill_table;
+
+ DBUG_RETURN(0);
+}
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_fields =
+{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_SYS_FIELDS"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB SYS_FIELDS"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, innodb_sys_fields_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
+
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
+
+ /* reserved for dependency checking */
+ /* void* */
+ STRUCT_FLD(__reserved1, NULL)
+};
+
+/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign */
+static ST_FIELD_INFO innodb_sys_foreign_fields_info[] =
+{
+#define SYS_FOREIGN_ID 0
+ {STRUCT_FLD(field_name, "ID"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_FOREIGN_FOR_NAME 1
+ {STRUCT_FLD(field_name, "FOR_NAME"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_FOREIGN_REF_NAME 2
+ {STRUCT_FLD(field_name, "REF_NAME"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_FOREIGN_NUM_COL 3
+ {STRUCT_FLD(field_name, "N_COLS"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_FOREIGN_TYPE 4
+ {STRUCT_FLD(field_name, "TYPE"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+ END_OF_ST_FIELD_INFO
+};
+
+/**********************************************************************//**
+Function to fill information_schema.innodb_sys_foreign with information
+collected by scanning SYS_FOREIGN table.
+@return 0 on success */
+static
+int
+i_s_dict_fill_sys_foreign(
+/*======================*/
+ THD* thd, /*!< in: thread */
+ dict_foreign_t* foreign, /*!< in: table */
+ TABLE* table_to_fill) /*!< in/out: fill this table */
+{
+ Field** fields;
+
+ DBUG_ENTER("i_s_dict_fill_sys_foreign");
+
+ fields = table_to_fill->field;
+
+ OK(field_store_string(fields[SYS_FOREIGN_ID], foreign->id));
+
+ OK(field_store_string(fields[SYS_FOREIGN_FOR_NAME],
+ foreign->foreign_table_name));
+
+ OK(field_store_string(fields[SYS_FOREIGN_REF_NAME],
+ foreign->referenced_table_name));
+
+ OK(fields[SYS_FOREIGN_NUM_COL]->store(foreign->n_fields));
+
+ OK(fields[SYS_FOREIGN_TYPE]->store(foreign->type));
+
+ OK(schema_table_store_record(thd, table_to_fill));
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Function to populate INFORMATION_SCHEMA.innodb_sys_foreign table. Loop
+through each record in SYS_FOREIGN, and extract the foreign key
+information.
+@return 0 on success */
+static
+int
+i_s_sys_foreign_fill_table(
+/*=======================*/
+ THD* thd, /*!< in: thread */
+ TABLE_LIST* tables, /*!< in/out: tables to fill */
+ COND* cond) /*!< in: condition (not used) */
+{
+ btr_pcur_t pcur;
+ const rec_t* rec;
+ mem_heap_t* heap;
+ mtr_t mtr;
+
+ DBUG_ENTER("i_s_sys_foreign_fill_table");
+
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+
+ DBUG_RETURN(0);
+ }
+
+ heap = mem_heap_create(1000);
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+
+ rec = dict_startscan_system(&pcur, &mtr, SYS_FOREIGN);
+
+ while (rec) {
+ const char* err_msg;
+ dict_foreign_t foreign_rec;
+
+ /* Populate a dict_foreign_t structure with information from
+ a SYS_FOREIGN row */
+ err_msg = dict_process_sys_foreign_rec(heap, rec, &foreign_rec);
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+
+ if (!err_msg) {
+ i_s_dict_fill_sys_foreign(thd, &foreign_rec,
+ tables->table);
+ } else {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_FIND_SYSTEM_REC,
+ err_msg);
+ }
+
+ mem_heap_empty(heap);
+
+ /* Get the next record */
+ mtr_start(&mtr);
+ mutex_enter(&dict_sys->mutex);
+ rec = dict_getnext_system(&pcur, &mtr);
+ }
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+ mem_heap_free(heap);
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign
+@return 0 on success */
+static
+int
+innodb_sys_foreign_init(
+/*====================*/
+ void* p) /*!< in/out: table schema object */
+{
+ ST_SCHEMA_TABLE* schema;
+
+ DBUG_ENTER("innodb_sys_foreign_init");
+
+ schema = (ST_SCHEMA_TABLE*) p;
+
+ schema->fields_info = innodb_sys_foreign_fields_info;
+ schema->fill_table = i_s_sys_foreign_fill_table;
+
+ DBUG_RETURN(0);
+}
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_foreign =
+{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_SYS_FOREIGN"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB SYS_FOREIGN"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, innodb_sys_foreign_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
+
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
+
+ /* reserved for dependency checking */
+ /* void* */
+ STRUCT_FLD(__reserved1, NULL)
+};
+/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign_cols */
+static ST_FIELD_INFO innodb_sys_foreign_cols_fields_info[] =
+{
+#define SYS_FOREIGN_COL_ID 0
+ {STRUCT_FLD(field_name, "ID"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_FOREIGN_COL_FOR_NAME 1
+ {STRUCT_FLD(field_name, "FOR_COL_NAME"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_FOREIGN_COL_REF_NAME 2
+ {STRUCT_FLD(field_name, "REF_COL_NAME"),
+ STRUCT_FLD(field_length, NAME_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_FOREIGN_COL_POS 3
+ {STRUCT_FLD(field_name, "POS"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+ END_OF_ST_FIELD_INFO
+};
+
+/**********************************************************************//**
+Function to fill information_schema.innodb_sys_foreign_cols with information
+collected by scanning SYS_FOREIGN_COLS table.
+@return 0 on success */
+static
+int
+i_s_dict_fill_sys_foreign_cols(
+/*==========================*/
+ THD* thd, /*!< in: thread */
+ const char* name, /*!< in: foreign key constraint name */
+ const char* for_col_name, /*!< in: referencing column name*/
+ const char* ref_col_name, /*!< in: referenced column
+ name */
+ ulint pos, /*!< in: column position */
+ TABLE* table_to_fill) /*!< in/out: fill this table */
+{
+ Field** fields;
+
+ DBUG_ENTER("i_s_dict_fill_sys_foreign_cols");
+
+ fields = table_to_fill->field;
+
+ OK(field_store_string(fields[SYS_FOREIGN_COL_ID], name));
+
+ OK(field_store_string(fields[SYS_FOREIGN_COL_FOR_NAME], for_col_name));
+
+ OK(field_store_string(fields[SYS_FOREIGN_COL_REF_NAME], ref_col_name));
+
+ OK(fields[SYS_FOREIGN_COL_POS]->store(pos));
+
+ OK(schema_table_store_record(thd, table_to_fill));
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Function to populate INFORMATION_SCHEMA.innodb_sys_foreign_cols table. Loop
+through each record in SYS_FOREIGN_COLS, and extract the foreign key column
+information and fill the INFORMATION_SCHEMA.innodb_sys_foreign_cols table.
+@return 0 on success */
+static
+int
+i_s_sys_foreign_cols_fill_table(
+/*============================*/
+ THD* thd, /*!< in: thread */
+ TABLE_LIST* tables, /*!< in/out: tables to fill */
+ COND* cond) /*!< in: condition (not used) */
+{
+ btr_pcur_t pcur;
+ const rec_t* rec;
+ mem_heap_t* heap;
+ mtr_t mtr;
+
+ DBUG_ENTER("i_s_sys_foreign_cols_fill_table");
+
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+ DBUG_RETURN(0);
+ }
+
+ heap = mem_heap_create(1000);
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+
+ rec = dict_startscan_system(&pcur, &mtr, SYS_FOREIGN_COLS);
+
+ while (rec) {
+ const char* err_msg;
+ const char* name;
+ const char* for_col_name;
+ const char* ref_col_name;
+ ulint pos;
+
+ /* Extract necessary information from a SYS_FOREIGN_COLS row */
+ err_msg = dict_process_sys_foreign_col_rec(
+ heap, rec, &name, &for_col_name, &ref_col_name, &pos);
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+
+ if (!err_msg) {
+ i_s_dict_fill_sys_foreign_cols(
+ thd, name, for_col_name, ref_col_name, pos,
+ tables->table);
+ } else {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_FIND_SYSTEM_REC,
+ err_msg);
+ }
+
+ mem_heap_empty(heap);
+
+ /* Get the next record */
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+ rec = dict_getnext_system(&pcur, &mtr);
+ }
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+ mem_heap_free(heap);
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign_cols
+@return 0 on success */
+static
+int
+innodb_sys_foreign_cols_init(
+/*========================*/
+ void* p) /*!< in/out: table schema object */
+{
+ ST_SCHEMA_TABLE* schema;
+
+ DBUG_ENTER("innodb_sys_foreign_cols_init");
+
+ schema = (ST_SCHEMA_TABLE*) p;
+
+ schema->fields_info = innodb_sys_foreign_cols_fields_info;
+ schema->fill_table = i_s_sys_foreign_cols_fill_table;
+
+ DBUG_RETURN(0);
+}
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_foreign_cols =
+{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_SYS_FOREIGN_COLS"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB SYS_FOREIGN_COLS"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, innodb_sys_foreign_cols_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
+
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
+
+ /* reserved for dependency checking */
+ /* void* */
+ STRUCT_FLD(__reserved1, NULL)
+};
+
+/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_stats */
+static ST_FIELD_INFO innodb_sys_stats_fields_info[] =
+{
+#define SYS_STATS_INDEX_ID 0
+ {STRUCT_FLD(field_name, "INDEX_ID"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_STATS_KEY_COLS 1
+ {STRUCT_FLD(field_name, "KEY_COLS"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_STATS_DIFF_VALS 2
+ {STRUCT_FLD(field_name, "DIFF_VALS"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define SYS_STATS_NON_NULL_VALS 3
+ {STRUCT_FLD(field_name, "NON_NULL_VALS"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+ END_OF_ST_FIELD_INFO
+};
+/**********************************************************************//**
+Function to fill information_schema.innodb_sys_stats
+@return 0 on success */
+static
+int
+i_s_dict_fill_sys_stats(
+/*====================*/
+ THD* thd, /*!< in: thread */
+ index_id_t index_id, /*!< in: INDEX_ID */
+ ulint key_cols, /*!< in: KEY_COLS */
+ ib_uint64_t diff_vals, /*!< in: DIFF_VALS */
+ ib_uint64_t non_null_vals, /*!< in: NON_NULL_VALS */
+ TABLE* table_to_fill) /*!< in/out: fill this table */
+{
+ Field** fields;
+
+ DBUG_ENTER("i_s_dict_fill_sys_stats");
+
+ fields = table_to_fill->field;
+
+ OK(fields[SYS_STATS_INDEX_ID]->store(longlong(index_id), TRUE));
+
+ OK(fields[SYS_STATS_KEY_COLS]->store(key_cols));
+
+ OK(fields[SYS_STATS_DIFF_VALS]->store(longlong(diff_vals), TRUE));
+
+ if (non_null_vals == ((ib_uint64_t)(-1))) {
+ fields[SYS_STATS_NON_NULL_VALS]->set_null();
+ } else {
+ OK(fields[SYS_STATS_NON_NULL_VALS]->store(longlong(non_null_vals), TRUE));
+ fields[SYS_STATS_NON_NULL_VALS]->set_notnull();
+ }
+
+ OK(schema_table_store_record(thd, table_to_fill));
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Function to populate INFORMATION_SCHEMA.innodb_sys_stats table.
+@return 0 on success */
+static
+int
+i_s_sys_stats_fill_table(
+/*=====================*/
+ THD* thd, /*!< in: thread */
+ TABLE_LIST* tables, /*!< in/out: tables to fill */
+ COND* cond) /*!< in: condition (not used) */
+{
+ btr_pcur_t pcur;
+ const rec_t* rec;
+ mem_heap_t* heap;
+ mtr_t mtr;
+
+ DBUG_ENTER("i_s_sys_stats_fill_table");
+
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+ DBUG_RETURN(0);
+ }
+
+ heap = mem_heap_create(1000);
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+
+ rec = dict_startscan_system(&pcur, &mtr, SYS_STATS);
+
+ while (rec) {
+ const char* err_msg;
+ index_id_t index_id;
+ ulint key_cols;
+ ib_uint64_t diff_vals;
+ ib_uint64_t non_null_vals;
+
+ /* Extract necessary information from a SYS_FOREIGN_COLS row */
+ err_msg = dict_process_sys_stats_rec(
+ heap, rec, &index_id, &key_cols, &diff_vals, &non_null_vals);
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+
+ if (!err_msg) {
+ i_s_dict_fill_sys_stats(
+ thd, index_id, key_cols, diff_vals, non_null_vals,
+ tables->table);
+ } else {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_FIND_SYSTEM_REC,
+ err_msg);
+ }
+
+ mem_heap_empty(heap);
+
+ /* Get the next record */
+ mutex_enter(&dict_sys->mutex);
+ mtr_start(&mtr);
+ rec = dict_getnext_system(&pcur, &mtr);
+ }
+
+ mtr_commit(&mtr);
+ mutex_exit(&dict_sys->mutex);
+ mem_heap_free(heap);
+
+ DBUG_RETURN(0);
+}
+/*******************************************************************//**
+Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_stats
+@return 0 on success */
+static
+int
+innodb_sys_stats_init(
+/*========================*/
+ void* p) /*!< in/out: table schema object */
+{
+ ST_SCHEMA_TABLE* schema;
+
+ DBUG_ENTER("innodb_sys_stats_init");
+
+ schema = (ST_SCHEMA_TABLE*) p;
+
+ schema->fields_info = innodb_sys_stats_fields_info;
+ schema->fill_table = i_s_sys_stats_fill_table;
+
+ DBUG_RETURN(0);
+}
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_stats =
+{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_SYS_STATS"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "XtraDB SYS_STATS table"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, innodb_sys_stats_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
+
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
+
+ /* reserved for dependency checking */
+ /* void* */
+ STRUCT_FLD(__reserved1, NULL)
+};
/***********************************************************************
*/
@@ -3158,7 +3805,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_rseg =
/* plugin author (for SHOW PLUGINS) */
/* const char* */
- STRUCT_FLD(author, plugin_author),
+ STRUCT_FLD(author, "Percona"),
/* general descriptive text (for SHOW PLUGINS) */
/* const char* */
@@ -3191,59 +3838,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_rseg =
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_rseg_maria =
-{
- /* the plugin type (a MYSQL_XXX_PLUGIN value) */
- /* int */
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
-
- /* pointer to type-specific plugin descriptor */
- /* void* */
- STRUCT_FLD(info, &i_s_info),
-
- /* plugin name */
- /* const char* */
- STRUCT_FLD(name, "INNODB_RSEG"),
-
- /* plugin author (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(author, plugin_author),
-
- /* general descriptive text (for SHOW PLUGINS) */
- /* const char* */
- STRUCT_FLD(descr, "InnoDB rollback segment information"),
-
- /* the plugin license (PLUGIN_LICENSE_XXX) */
- /* int */
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
-
- /* the function to invoke when plugin is loaded */
- /* int (*)(void*); */
- STRUCT_FLD(init, i_s_innodb_rseg_init),
-
- /* the function to invoke when plugin is unloaded */
- /* int (*)(void*); */
- STRUCT_FLD(deinit, i_s_common_deinit),
-
- /* plugin version (for SHOW PLUGINS) */
- /* unsigned int */
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
-
- /* struct st_mysql_show_var* */
- STRUCT_FLD(status_vars, NULL),
-
- /* struct st_mysql_sys_var** */
- STRUCT_FLD(system_vars, NULL),
-
- /* string version */
- /* const char * */
- STRUCT_FLD(version_info, "1.0"),
-
- /* Maturity */
- /* int */
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
/***********************************************************************
*/
static ST_FIELD_INFO i_s_innodb_table_stats_info[] =
@@ -3333,7 +3927,7 @@ static ST_FIELD_INFO i_s_innodb_index_stats_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "row_per_keys"),
+ {STRUCT_FLD(field_name, "rows_per_key"),
STRUCT_FLD(field_length, 256),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
@@ -3341,7 +3935,7 @@ static ST_FIELD_INFO i_s_innodb_index_stats_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "index_size"),
+ {STRUCT_FLD(field_name, "index_total_pages"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3349,7 +3943,7 @@ static ST_FIELD_INFO i_s_innodb_index_stats_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "leaf_pages"),
+ {STRUCT_FLD(field_name, "index_leaf_pages"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3561,7 +4155,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_table_stats =
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
STRUCT_FLD(info, &i_s_info),
STRUCT_FLD(name, "INNODB_TABLE_STATS"),
- STRUCT_FLD(author, plugin_author),
+ STRUCT_FLD(author, "Percona"),
STRUCT_FLD(descr, "InnoDB table statistics in memory"),
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
STRUCT_FLD(init, i_s_innodb_table_stats_init),
@@ -3572,29 +4166,12 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_table_stats =
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_table_stats_maria =
-{
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
- STRUCT_FLD(info, &i_s_info),
- STRUCT_FLD(name, "INNODB_TABLE_STATS"),
- STRUCT_FLD(author, plugin_author),
- STRUCT_FLD(descr, "InnoDB table statistics in memory"),
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
- STRUCT_FLD(init, i_s_innodb_table_stats_init),
- STRUCT_FLD(deinit, i_s_common_deinit),
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
- STRUCT_FLD(status_vars, NULL),
- STRUCT_FLD(system_vars, NULL),
- STRUCT_FLD(version_info, "1.0"),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
UNIV_INTERN struct st_mysql_plugin i_s_innodb_index_stats =
{
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
STRUCT_FLD(info, &i_s_info),
STRUCT_FLD(name, "INNODB_INDEX_STATS"),
- STRUCT_FLD(author, plugin_author),
+ STRUCT_FLD(author, "Percona"),
STRUCT_FLD(descr, "InnoDB index statistics in memory"),
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
STRUCT_FLD(init, i_s_innodb_index_stats_init),
@@ -3605,23 +4182,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_index_stats =
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_index_stats_maria =
-{
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
- STRUCT_FLD(info, &i_s_info),
- STRUCT_FLD(name, "INNODB_INDEX_STATS"),
- STRUCT_FLD(author, plugin_author),
- STRUCT_FLD(descr, "InnoDB index statistics in memory"),
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
- STRUCT_FLD(init, i_s_innodb_index_stats_init),
- STRUCT_FLD(deinit, i_s_common_deinit),
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
- STRUCT_FLD(status_vars, NULL),
- STRUCT_FLD(system_vars, NULL),
- STRUCT_FLD(version_info, "1.0"),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
/***********************************************************************
*/
static ST_FIELD_INFO i_s_innodb_admin_command_info[] =
@@ -3716,7 +4276,7 @@ nomatch:
}
else if (!strncasecmp("XTRA_LRU_DUMP", ptr, 13)) {
ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: administration command 'XTRA_LRU_DUMP'"
+ fprintf(stderr, " InnoDB: Administrative command 'XTRA_LRU_DUMP'"
" was detected.\n");
if (buf_LRU_file_dump()) {
@@ -3731,7 +4291,7 @@ nomatch:
}
else if (!strncasecmp("XTRA_LRU_RESTORE", ptr, 16)) {
ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: administration command 'XTRA_LRU_RESTORE'"
+ fprintf(stderr, " InnoDB: Administrative command 'XTRA_LRU_RESTORE'"
" was detected.\n");
if (buf_LRU_file_restore()) {
@@ -3777,7 +4337,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_admin_command =
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
STRUCT_FLD(info, &i_s_info),
STRUCT_FLD(name, "XTRADB_ADMIN_COMMAND"),
- STRUCT_FLD(author, plugin_author),
+ STRUCT_FLD(author, "Percona"),
STRUCT_FLD(descr, "XtraDB specific command acceptor"),
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
STRUCT_FLD(init, i_s_innodb_admin_command_init),
@@ -3788,42 +4348,27 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_admin_command =
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_admin_command_maria =
-{
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
- STRUCT_FLD(info, &i_s_info),
- STRUCT_FLD(name, "XTRADB_ADMIN_COMMAND"),
- STRUCT_FLD(author, plugin_author),
- STRUCT_FLD(descr, "XtraDB specific command acceptor"),
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
- STRUCT_FLD(init, i_s_innodb_admin_command_init),
- STRUCT_FLD(deinit, i_s_common_deinit),
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
- STRUCT_FLD(status_vars, NULL),
- STRUCT_FLD(system_vars, NULL),
- STRUCT_FLD(version_info, "1.0"),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
-};
-
-static ST_FIELD_INFO i_s_innodb_sys_tables_info[] =
+/***********************************************************************
+*/
+static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_fields_info[] =
{
- {STRUCT_FLD(field_name, "SCHEMA"),
- STRUCT_FLD(field_length, NAME_LEN),
+ {STRUCT_FLD(field_name, "page_type"),
+ STRUCT_FLD(field_length, 64),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, NAME_LEN),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ {STRUCT_FLD(field_name, "space_id"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "ID"),
+ {STRUCT_FLD(field_name, "page_no"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3831,7 +4376,7 @@ static ST_FIELD_INFO i_s_innodb_sys_tables_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "N_COLS"),
+ {STRUCT_FLD(field_name, "lru_position"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3839,7 +4384,7 @@ static ST_FIELD_INFO i_s_innodb_sys_tables_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "TYPE"),
+ {STRUCT_FLD(field_name, "fix_count"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3847,7 +4392,7 @@ static ST_FIELD_INFO i_s_innodb_sys_tables_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "MIX_ID"),
+ {STRUCT_FLD(field_name, "flush_type"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3855,7 +4400,12 @@ static ST_FIELD_INFO i_s_innodb_sys_tables_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "MIX_LEN"),
+ END_OF_ST_FIELD_INFO
+};
+
+static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
+{
+ {STRUCT_FLD(field_name, "index_id"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3863,15 +4413,15 @@ static ST_FIELD_INFO i_s_innodb_sys_tables_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "CLUSTER_NAME"),
- STRUCT_FLD(field_length, NAME_LEN),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ {STRUCT_FLD(field_name, "space_id"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "SPACE"),
+ {STRUCT_FLD(field_name, "page_no"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3879,12 +4429,7 @@ static ST_FIELD_INFO i_s_innodb_sys_tables_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- END_OF_ST_FIELD_INFO
-};
-
-static ST_FIELD_INFO i_s_innodb_sys_indexes_info[] =
-{
- {STRUCT_FLD(field_name, "TABLE_ID"),
+ {STRUCT_FLD(field_name, "n_recs"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3892,7 +4437,7 @@ static ST_FIELD_INFO i_s_innodb_sys_indexes_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "ID"),
+ {STRUCT_FLD(field_name, "data_size"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3900,15 +4445,15 @@ static ST_FIELD_INFO i_s_innodb_sys_indexes_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "NAME"),
- STRUCT_FLD(field_length, NAME_LEN),
- STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ {STRUCT_FLD(field_name, "hashed"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
- STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "N_FIELDS"),
+ {STRUCT_FLD(field_name, "access_time"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3916,7 +4461,7 @@ static ST_FIELD_INFO i_s_innodb_sys_indexes_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "TYPE"),
+ {STRUCT_FLD(field_name, "modified"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3924,7 +4469,7 @@ static ST_FIELD_INFO i_s_innodb_sys_indexes_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "SPACE"),
+ {STRUCT_FLD(field_name, "dirty"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3932,7 +4477,7 @@ static ST_FIELD_INFO i_s_innodb_sys_indexes_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "PAGE_NO"),
+ {STRUCT_FLD(field_name, "old"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3940,12 +4485,7 @@ static ST_FIELD_INFO i_s_innodb_sys_indexes_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- END_OF_ST_FIELD_INFO
-};
-
-static ST_FIELD_INFO i_s_innodb_sys_stats_info[] =
-{
- {STRUCT_FLD(field_name, "INDEX_ID"),
+ {STRUCT_FLD(field_name, "lru_position"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3953,7 +4493,7 @@ static ST_FIELD_INFO i_s_innodb_sys_stats_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "KEY_COLS"),
+ {STRUCT_FLD(field_name, "fix_count"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3961,7 +4501,7 @@ static ST_FIELD_INFO i_s_innodb_sys_stats_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- {STRUCT_FLD(field_name, "DIFF_VALS"),
+ {STRUCT_FLD(field_name, "flush_type"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
@@ -3972,545 +4512,868 @@ static ST_FIELD_INFO i_s_innodb_sys_stats_info[] =
END_OF_ST_FIELD_INFO
};
-static
-int
-copy_string_field(
-/*==============*/
- TABLE* table,
- int table_field,
- const rec_t* rec,
- int rec_field)
+static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
{
- int status;
- const byte* data;
- ulint len;
+ {STRUCT_FLD(field_name, "space_id"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- /*fprintf(stderr, "copy_string_field %d %d\n", table_field, rec_field);*/
+ {STRUCT_FLD(field_name, "page_no"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- data = rec_get_nth_field_old(rec, rec_field, &len);
- if (len == UNIV_SQL_NULL) {
- table->field[table_field]->set_null();
- status = 0; /* success */
- } else {
- table->field[table_field]->set_notnull();
- status = table->field[table_field]->store(
- (char *) data, len, system_charset_info);
- }
+ {STRUCT_FLD(field_name, "compressed"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- return status;
-}
+ {STRUCT_FLD(field_name, "part_len"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-static
-int
-copy_name_fields(
-/*=============*/
- TABLE* table,
- int table_field_1,
- const rec_t* rec,
- int rec_field)
-{
- int status;
- const byte* data;
- ulint len;
-
- data = rec_get_nth_field_old(rec, rec_field, &len);
- if (len == UNIV_SQL_NULL) {
- table->field[table_field_1]->set_null();
- table->field[table_field_1 + 1]->set_null();
- status = 0; /* success */
- } else {
- char buf[NAME_LEN * 2 + 2];
- char* ptr;
+ {STRUCT_FLD(field_name, "next_page_no"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- if (len > NAME_LEN * 2 + 1) {
- table->field[table_field_1]->set_null();
- status = field_store_string(table->field[table_field_1 + 1],
- "###TOO LONG NAME###");
- goto end_func;
- }
+ {STRUCT_FLD(field_name, "lru_position"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- strncpy(buf, (char*)data, len);
- buf[len] = '\0';
- ptr = strchr(buf, '/');
- if (ptr) {
- *ptr = '\0';
- ++ptr;
+ {STRUCT_FLD(field_name, "fix_count"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
- status = field_store_string(table->field[table_field_1], buf);
- status |= field_store_string(table->field[table_field_1 + 1], ptr);
- } else {
- table->field[table_field_1]->set_null();
- status = field_store_string(table->field[table_field_1 + 1], buf);
- }
- }
+ {STRUCT_FLD(field_name, "flush_type"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-end_func:
- return status;
-}
+ END_OF_ST_FIELD_INFO
+};
+/***********************************************************************
+Fill the dynamic table information_schema.innodb_buffer_pool_pages. */
static
int
-copy_int_field(
-/*===========*/
- TABLE* table,
- int table_field,
- const rec_t* rec,
- int rec_field)
+i_s_innodb_buffer_pool_pages_fill(
+/*================*/
+ /* out: 0 on success, 1 on failure */
+ THD* thd, /* in: thread */
+ TABLE_LIST* tables, /* in/out: tables to fill */
+ COND* cond) /* in: condition (ignored) */
{
- int status;
- const byte* data;
- ulint len;
+ TABLE* table = (TABLE *) tables->table;
+ int status = 0;
+ ulint i;
- /*fprintf(stderr, "copy_int_field %d %d\n", table_field, rec_field);*/
+ DBUG_ENTER("i_s_innodb_buffer_pool_pages_fill");
- data = rec_get_nth_field_old(rec, rec_field, &len);
- if (len == UNIV_SQL_NULL) {
- table->field[table_field]->set_null();
- status = 0; /* success */
- } else {
- table->field[table_field]->set_notnull();
- status = table->field[table_field]->store(
- mach_read_from_4(data), true);
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+
+ DBUG_RETURN(0);
}
- return status;
-}
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
-static
-int
-copy_id_field(
-/*==========*/
- TABLE* table,
- int table_field,
- const rec_t* rec,
- int rec_field)
-{
- int status;
- const byte* data;
- ulint len;
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ ulint n_block;
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ buf_pool_mutex_enter(buf_pool);
+
+ for (n_block = 0; n_block < buf_pool->curr_size; n_block++) {
+ buf_block_t* block = buf_page_from_array(buf_pool, n_block);
+ const buf_frame_t* frame = block->frame;
+
+ char page_type[64];
+
+ switch(fil_page_get_type(frame))
+ {
+ case FIL_PAGE_INDEX:
+ strcpy(page_type, "index");
+ break;
+ case FIL_PAGE_UNDO_LOG:
+ strcpy(page_type, "undo_log");
+ break;
+ case FIL_PAGE_INODE:
+ strcpy(page_type, "inode");
+ break;
+ case FIL_PAGE_IBUF_FREE_LIST:
+ strcpy(page_type, "ibuf_free_list");
+ break;
+ case FIL_PAGE_TYPE_ALLOCATED:
+ strcpy(page_type, "allocated");
+ break;
+ case FIL_PAGE_IBUF_BITMAP:
+ strcpy(page_type, "bitmap");
+ break;
+ case FIL_PAGE_TYPE_SYS:
+ strcpy(page_type, "sys");
+ break;
+ case FIL_PAGE_TYPE_TRX_SYS:
+ strcpy(page_type, "trx_sys");
+ break;
+ case FIL_PAGE_TYPE_FSP_HDR:
+ strcpy(page_type, "fsp_hdr");
+ break;
+ case FIL_PAGE_TYPE_XDES:
+ strcpy(page_type, "xdes");
+ break;
+ case FIL_PAGE_TYPE_BLOB:
+ strcpy(page_type, "blob");
+ break;
+ case FIL_PAGE_TYPE_ZBLOB:
+ strcpy(page_type, "zblob");
+ break;
+ case FIL_PAGE_TYPE_ZBLOB2:
+ strcpy(page_type, "zblob2");
+ break;
+ default:
+ sprintf(page_type, "unknown (type=%li)", fil_page_get_type(frame));
+ }
- /*fprintf(stderr, "copy_id_field %d %d\n", table_field, rec_field);*/
+ field_store_string(table->field[0], page_type);
+ table->field[1]->store(block->page.space);
+ table->field[2]->store(block->page.offset);
+ table->field[3]->store(0);
+ table->field[4]->store(block->page.buf_fix_count);
+ table->field[5]->store(block->page.flush_type);
- data = rec_get_nth_field_old(rec, rec_field, &len);
- if (len == UNIV_SQL_NULL) {
- table->field[table_field]->set_null();
- status = 0; /* success */
- } else {
- table->field[table_field]->set_notnull();
- status = table->field[table_field]->store(
- ut_conv_dulint_to_longlong(mach_read_from_8(data)), true);
+ if (schema_table_store_record(thd, table)) {
+ status = 1;
+ break;
+ }
+
+ }
+
+ buf_pool_mutex_exit(buf_pool);
}
- return status;
+ DBUG_RETURN(status);
}
+/***********************************************************************
+Fill the dynamic table information_schema.innodb_buffer_pool_pages_index. */
static
int
-copy_sys_tables_rec(
+i_s_innodb_buffer_pool_pages_index_fill(
/*================*/
- TABLE* table,
- const dict_index_t* index,
- const rec_t* rec
-)
+ /* out: 0 on success, 1 on failure */
+ THD* thd, /* in: thread */
+ TABLE_LIST* tables, /* in/out: tables to fill */
+ COND* cond) /* in: condition (ignored) */
{
- int status;
- int field;
-
- /* NAME */
- field = dict_index_get_nth_col_pos(index, 0);
- status = copy_name_fields(table, 0, rec, field);
- if (status) {
- return status;
- }
- /* ID */
- field = dict_index_get_nth_col_pos(index, 1);
- status = copy_id_field(table, 2, rec, field);
- if (status) {
- return status;
- }
- /* N_COLS */
- field = dict_index_get_nth_col_pos(index, 2);
- status = copy_int_field(table, 3, rec, field);
- if (status) {
- return status;
- }
- /* TYPE */
- field = dict_index_get_nth_col_pos(index, 3);
- status = copy_int_field(table, 4, rec, field);
- if (status) {
- return status;
- }
- /* MIX_ID */
- field = dict_index_get_nth_col_pos(index, 4);
- status = copy_id_field(table, 5, rec, field);
- if (status) {
- return status;
- }
- /* MIX_LEN */
- field = dict_index_get_nth_col_pos(index, 5);
- status = copy_int_field(table, 6, rec, field);
- if (status) {
- return status;
- }
- /* CLUSTER_NAME */
- field = dict_index_get_nth_col_pos(index, 6);
- status = copy_string_field(table, 7, rec, field);
- if (status) {
- return status;
- }
- /* SPACE */
- field = dict_index_get_nth_col_pos(index, 7);
- status = copy_int_field(table, 8, rec, field);
- if (status) {
- return status;
- }
+ TABLE* table = (TABLE *) tables->table;
+ int status = 0;
+ ulint i;
+ index_id_t index_id;
- return 0;
-}
+ DBUG_ENTER("i_s_innodb_buffer_pool_pages_index_fill");
-static
-int
-copy_sys_indexes_rec(
-/*=================*/
- TABLE* table,
- const dict_index_t* index,
- const rec_t* rec
-)
-{
- int status;
- int field;
-
- /* TABLE_ID */
- field = dict_index_get_nth_col_pos(index, 0);
- status = copy_id_field(table, 0, rec, field);
- if (status) {
- return status;
- }
- /* ID */
- field = dict_index_get_nth_col_pos(index, 1);
- status = copy_id_field(table, 1, rec, field);
- if (status) {
- return status;
- }
- /* NAME */
- field = dict_index_get_nth_col_pos(index, 2);
- status = copy_string_field(table, 2, rec, field);
- if (status) {
- return status;
- }
- /* N_FIELDS */
- field = dict_index_get_nth_col_pos(index, 3);
- status = copy_int_field(table, 3, rec, field);
- if (status) {
- return status;
- }
- /* TYPE */
- field = dict_index_get_nth_col_pos(index, 4);
- status = copy_int_field(table, 4, rec, field);
- if (status) {
- return status;
- }
- /* SPACE */
- field = dict_index_get_nth_col_pos(index, 5);
- status = copy_int_field(table, 5, rec, field);
- if (status) {
- return status;
- }
- /* PAGE_NO */
- field = dict_index_get_nth_col_pos(index, 6);
- status = copy_int_field(table, 6, rec, field);
- if (status) {
- return status;
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+
+ DBUG_RETURN(0);
}
- return 0;
-}
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
-static
-int
-copy_sys_stats_rec(
-/*===============*/
- TABLE* table,
- const dict_index_t* index,
- const rec_t* rec
-)
-{
- int status;
- int field;
-
- /* INDEX_ID */
- field = dict_index_get_nth_col_pos(index, 0);
- status = copy_id_field(table, 0, rec, field);
- if (status) {
- return status;
- }
- /* KEY_COLS */
- field = dict_index_get_nth_col_pos(index, 1);
- status = copy_int_field(table, 1, rec, field);
- if (status) {
- return status;
- }
- /* DIFF_VALS */
- field = dict_index_get_nth_col_pos(index, 2);
- status = copy_id_field(table, 2, rec, field);
- if (status) {
- return status;
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ ulint n_block;
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+
+ buf_pool_mutex_enter(buf_pool);
+
+ for (n_block = 0; n_block < buf_pool->curr_size; n_block++) {
+ buf_block_t* block = buf_page_from_array(buf_pool, n_block);
+ const buf_frame_t* frame = block->frame;
+
+ if (fil_page_get_type(frame) == FIL_PAGE_INDEX) {
+ index_id = btr_page_get_index_id(frame);
+ table->field[0]->store(index_id);
+ table->field[1]->store(block->page.space);
+ table->field[2]->store(block->page.offset);
+ table->field[3]->store(page_get_n_recs(frame));
+ table->field[4]->store(page_get_data_size(frame));
+ table->field[5]->store(block->is_hashed);
+ table->field[6]->store(block->page.access_time);
+ table->field[7]->store(block->page.newest_modification != 0);
+ table->field[8]->store(block->page.oldest_modification != 0);
+ table->field[9]->store(block->page.old);
+ table->field[10]->store(0);
+ table->field[11]->store(block->page.buf_fix_count);
+ table->field[12]->store(block->page.flush_type);
+
+ if (schema_table_store_record(thd, table)) {
+ status = 1;
+ break;
+ }
+ }
+ }
+
+ buf_pool_mutex_exit(buf_pool);
}
- return 0;
+ DBUG_RETURN(status);
}
+/***********************************************************************
+Fill the dynamic table information_schema.innodb_buffer_pool_pages_index. */
static
int
-i_s_innodb_schema_table_fill(
-/*=========================*/
- THD* thd,
- TABLE_LIST* tables,
- COND* cond)
+i_s_innodb_buffer_pool_pages_blob_fill(
+/*================*/
+ /* out: 0 on success, 1 on failure */
+ THD* thd, /* in: thread */
+ TABLE_LIST* tables, /* in/out: tables to fill */
+ COND* cond) /* in: condition (ignored) */
{
- int status = 0;
- TABLE* table = (TABLE *) tables->table;
- const char* table_name = tables->schema_table_name;
- dict_table_t* innodb_table;
- dict_index_t* index;
- btr_pcur_t pcur;
- const rec_t* rec;
- mtr_t mtr;
- int id;
+ TABLE* table = (TABLE *) tables->table;
+ int status = 0;
+ ulint i;
- DBUG_ENTER("i_s_innodb_schema_table_fill");
+ ulint part_len;
+ ulint next_page_no;
+
+ DBUG_ENTER("i_s_innodb_buffer_pool_pages_blob_fill");
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
+
DBUG_RETURN(0);
}
- if (innobase_strcasecmp(table_name, "innodb_sys_tables") == 0) {
- id = 0;
- } else if (innobase_strcasecmp(table_name, "innodb_sys_indexes") == 0) {
- id = 1;
- } else if (innobase_strcasecmp(table_name, "innodb_sys_stats") == 0) {
- id = 2;
- } else {
- DBUG_RETURN(1);
- }
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ ulint n_block;
+ buf_pool_t* buf_pool;
- RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+ buf_pool = buf_pool_from_array(i);
- mutex_enter(&(dict_sys->mutex));
+ buf_pool_mutex_enter(buf_pool);
+
+ for (n_block = 0; n_block < buf_pool->curr_size; n_block++) {
+ buf_block_t* block = buf_page_from_array(buf_pool, n_block);
+ page_zip_des_t* block_page_zip = buf_block_get_page_zip(block);
+ const buf_frame_t* frame = block->frame;
- mtr_start(&mtr);
+ if (fil_page_get_type(frame) == FIL_PAGE_TYPE_BLOB) {
- if (id == 0) {
- innodb_table = dict_table_get_low("SYS_TABLES");
- } else if (id == 1) {
- innodb_table = dict_table_get_low("SYS_INDEXES");
- } else {
- innodb_table = dict_table_get_low("SYS_STATS");
- }
- index = UT_LIST_GET_FIRST(innodb_table->indexes);
-
- btr_pcur_open_at_index_side(TRUE, index, BTR_SEARCH_LEAF, &pcur,
- TRUE, &mtr);
- for (;;) {
- btr_pcur_move_to_next_user_rec(&pcur, &mtr);
-
- rec = btr_pcur_get_rec(&pcur);
- if (!btr_pcur_is_on_user_rec(&pcur)) {
- /* end of index */
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
- break;
- }
- if (rec_get_deleted_flag(rec, 0)) {
- /* record marked as deleted */
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
- continue;
- }
+ if (UNIV_LIKELY_NULL(block_page_zip)) {
+ part_len = 0; /* hmm, can't figure it out */
- if (id == 0) {
- status = copy_sys_tables_rec(table, index, rec);
- } else if (id == 1) {
- status = copy_sys_indexes_rec(table, index, rec);
- } else {
- status = copy_sys_stats_rec(table, index, rec);
- }
- if (status) {
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
- break;
- }
+ next_page_no = mach_read_from_4(
+ buf_block_get_frame(block)
+ + FIL_PAGE_NEXT);
+ } else {
+ part_len = mach_read_from_4(
+ buf_block_get_frame(block)
+ + FIL_PAGE_DATA
+ + 0 /*BTR_BLOB_HDR_PART_LEN*/);
-#if 0
- btr_pcur_store_position(&pcur, &mtr);
- mtr_commit(&mtr);
+ next_page_no = mach_read_from_4(
+ buf_block_get_frame(block)
+ + FIL_PAGE_DATA
+ + 4 /*BTR_BLOB_HDR_NEXT_PAGE_NO*/);
+ }
- status = schema_table_store_record(thd, table);
- if (status) {
- btr_pcur_close(&pcur);
- break;
- }
+ table->field[0]->store(block->page.space);
+ table->field[1]->store(block->page.offset);
+ table->field[2]->store(block_page_zip != NULL);
+ table->field[3]->store(part_len);
- mtr_start(&mtr);
- btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr);
-#else
- status = schema_table_store_record(thd, table);
- if (status) {
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
- break;
- }
-#endif
- }
+ if(next_page_no == FIL_NULL)
+ {
+ table->field[4]->store(0);
+ } else {
+ table->field[4]->store(block->page.offset);
+ }
- mutex_exit(&(dict_sys->mutex));
+ table->field[5]->store(0);
+ table->field[6]->store(block->page.buf_fix_count);
+ table->field[7]->store(block->page.flush_type);
+
+ if (schema_table_store_record(thd, table)) {
+ status = 1;
+ break;
+ }
+
+ }
+ }
+
+ buf_pool_mutex_exit(buf_pool);
+ }
DBUG_RETURN(status);
}
+/***********************************************************************
+Bind the dynamic table information_schema.innodb_buffer_pool_pages. */
static
int
-i_s_innodb_sys_tables_init(
-/*=======================*/
- void* p)
+i_s_innodb_buffer_pool_pages_init(
+/*=========*/
+ /* out: 0 on success */
+ void* p) /* in/out: table schema object */
{
- DBUG_ENTER("i_s_innodb_sys_tables_init");
+ DBUG_ENTER("i_s_innodb_buffer_pool_pages_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_innodb_sys_tables_info;
- schema->fill_table = i_s_innodb_schema_table_fill;
+ schema->fields_info = i_s_innodb_buffer_pool_pages_fields_info;
+ schema->fill_table = i_s_innodb_buffer_pool_pages_fill;
DBUG_RETURN(0);
}
+/***********************************************************************
+Bind the dynamic table information_schema.innodb_buffer_pool_pages. */
static
int
-i_s_innodb_sys_indexes_init(
-/*========================*/
- void* p)
+i_s_innodb_buffer_pool_pages_index_init(
+/*=========*/
+ /* out: 0 on success */
+ void* p) /* in/out: table schema object */
{
- DBUG_ENTER("i_s_innodb_sys_indexes_init");
+ DBUG_ENTER("i_s_innodb_buffer_pool_pages_index_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_innodb_sys_indexes_info;
- schema->fill_table = i_s_innodb_schema_table_fill;
+ schema->fields_info = i_s_innodb_buffer_pool_pages_index_fields_info;
+ schema->fill_table = i_s_innodb_buffer_pool_pages_index_fill;
DBUG_RETURN(0);
}
+/***********************************************************************
+Bind the dynamic table information_schema.innodb_buffer_pool_pages. */
static
int
-i_s_innodb_sys_stats_init(
-/*======================*/
- void* p)
+i_s_innodb_buffer_pool_pages_blob_init(
+/*=========*/
+ /* out: 0 on success */
+ void* p) /* in/out: table schema object */
{
- DBUG_ENTER("i_s_innodb_sys_stats_init");
+ DBUG_ENTER("i_s_innodb_buffer_pool_pages_blob_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
- schema->fields_info = i_s_innodb_sys_stats_info;
- schema->fill_table = i_s_innodb_schema_table_fill;
+ schema->fields_info = i_s_innodb_buffer_pool_pages_blob_fields_info;
+ schema->fill_table = i_s_innodb_buffer_pool_pages_blob_fill;
DBUG_RETURN(0);
}
-UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tables =
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_pool_pages =
{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
STRUCT_FLD(info, &i_s_info),
- STRUCT_FLD(name, "INNODB_SYS_TABLES"),
- STRUCT_FLD(author, plugin_author),
- STRUCT_FLD(descr, "InnoDB SYS_TABLES table"),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB buffer pool pages"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
- STRUCT_FLD(init, i_s_innodb_sys_tables_init),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
STRUCT_FLD(version, 0x0100 /* 1.0 */),
+
+ /* struct st_mysql_show_var* */
STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
+
+ /* reserved for dependency checking */
+ /* void* */
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tables_maria =
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_pool_pages_index =
{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
STRUCT_FLD(info, &i_s_info),
- STRUCT_FLD(name, "INNODB_SYS_TABLES"),
- STRUCT_FLD(author, plugin_author),
- STRUCT_FLD(descr, "InnoDB SYS_TABLES table"),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES_INDEX"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB buffer pool index pages"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
- STRUCT_FLD(init, i_s_innodb_sys_tables_init),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_index_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
STRUCT_FLD(version, 0x0100 /* 1.0 */),
+
+ /* struct st_mysql_show_var* */
STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- STRUCT_FLD(version_info, "1.0"),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA)
+
+ /* reserved for dependency checking */
+ /* void* */
+ STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_indexes =
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_pool_pages_blob =
{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
STRUCT_FLD(info, &i_s_info),
- STRUCT_FLD(name, "INNODB_SYS_INDEXES"),
- STRUCT_FLD(author, plugin_author),
- STRUCT_FLD(descr, "InnoDB SYS_INDEXES table"),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES_BLOB"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB buffer pool blob pages"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
- STRUCT_FLD(init, i_s_innodb_sys_indexes_init),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_blob_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */
STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ /* unsigned int */
STRUCT_FLD(version, 0x0100 /* 1.0 */),
+
+ /* struct st_mysql_show_var* */
STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
+
+ /* reserved for dependency checking */
+ /* void* */
STRUCT_FLD(__reserved1, NULL)
};
-UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_indexes_maria =
+/* MariaDB structures of I_S plugins above */
+
+UNIV_INTERN struct st_maria_plugin i_s_innodb_trx_maria =
{
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
- STRUCT_FLD(info, &i_s_info),
- STRUCT_FLD(name, "INNODB_SYS_INDEXES"),
- STRUCT_FLD(author, plugin_author),
- STRUCT_FLD(descr, "InnoDB SYS_INDEXES table"),
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
- STRUCT_FLD(init, i_s_innodb_sys_indexes_init),
- STRUCT_FLD(deinit, i_s_common_deinit),
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
- STRUCT_FLD(status_vars, NULL),
- STRUCT_FLD(system_vars, NULL),
- STRUCT_FLD(version_info, "1.0"),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA)
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_TRX",
+ plugin_author,
+ "InnoDB transactions",
+ PLUGIN_LICENSE_GPL,
+ innodb_trx_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
};
-
-UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_stats =
+UNIV_INTERN struct st_maria_plugin i_s_innodb_locks_maria =
{
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
- STRUCT_FLD(info, &i_s_info),
- STRUCT_FLD(name, "INNODB_SYS_STATS"),
- STRUCT_FLD(author, plugin_author),
- STRUCT_FLD(descr, "InnoDB SYS_STATS table"),
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
- STRUCT_FLD(init, i_s_innodb_sys_stats_init),
- STRUCT_FLD(deinit, i_s_common_deinit),
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
- STRUCT_FLD(status_vars, NULL),
- STRUCT_FLD(system_vars, NULL),
- STRUCT_FLD(__reserved1, NULL)
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_LOCKS",
+ plugin_author,
+ "InnoDB conflicting locks",
+ PLUGIN_LICENSE_GPL,
+ innodb_locks_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
};
-
-UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_stats_maria =
+UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits_maria =
{
- STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
- STRUCT_FLD(info, &i_s_info),
- STRUCT_FLD(name, "INNODB_SYS_STATS"),
- STRUCT_FLD(author, plugin_author),
- STRUCT_FLD(descr, "InnoDB SYS_STATS table"),
- STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
- STRUCT_FLD(init, i_s_innodb_sys_stats_init),
- STRUCT_FLD(deinit, i_s_common_deinit),
- STRUCT_FLD(version, 0x0100 /* 1.0 */),
- STRUCT_FLD(status_vars, NULL),
- STRUCT_FLD(system_vars, NULL),
- STRUCT_FLD(version_info, "1.0"),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA)
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_LOCK_WAITS",
+ plugin_author,
+ "InnoDB which lock is blocking which",
+ PLUGIN_LICENSE_GPL,
+ innodb_lock_waits_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_CMP",
+ plugin_author,
+ "Statistics for the InnoDB compression",
+ PLUGIN_LICENSE_GPL,
+ i_s_cmp_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_CMP_RESET",
+ plugin_author,
+ "Statistics for the InnoDB compression; reset cumulated counts",
+ PLUGIN_LICENSE_GPL,
+ i_s_cmp_reset_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_CMPMEM",
+ plugin_author,
+ "Statistics for the InnoDB compressed buffer pool",
+ PLUGIN_LICENSE_GPL,
+ i_s_cmpmem_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_CMPMEM_RESET",
+ plugin_author,
+ "Statistics for the InnoDB compressed buffer pool; reset cumulated counts",
+ PLUGIN_LICENSE_GPL,
+ i_s_cmpmem_reset_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tables_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_SYS_TABLES",
+ "Percona",
+ "InnoDB SYS_TABLES",
+ PLUGIN_LICENSE_GPL,
+ innodb_sys_tables_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablestats_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_SYS_TABLESTATS",
+ "Percona",
+ "InnoDB SYS_TABLESTATS",
+ PLUGIN_LICENSE_GPL,
+ innodb_sys_tablestats_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_indexes_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_SYS_INDEXES",
+ "Percona",
+ "InnoDB SYS_INDEXES",
+ PLUGIN_LICENSE_GPL,
+ innodb_sys_indexes_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_columns_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_SYS_COLUMNS",
+ "Percona",
+ "InnoDB SYS_COLUMNS",
+ PLUGIN_LICENSE_GPL,
+ innodb_sys_columns_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_fields_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_SYS_FIELDS",
+ "Percona",
+ "InnoDB SYS_FIELDS",
+ PLUGIN_LICENSE_GPL,
+ innodb_sys_fields_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_SYS_FOREIGN",
+ "Percona",
+ "InnoDB SYS_FOREIGN",
+ PLUGIN_LICENSE_GPL,
+ innodb_sys_foreign_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign_cols_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_SYS_FOREIGN_COLS",
+ "Percona",
+ "InnoDB SYS_FOREIGN_COLS",
+ PLUGIN_LICENSE_GPL,
+ innodb_sys_foreign_cols_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_stats_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_SYS_STATS",
+ "Percona",
+ "XtraDB SYS_STATS table",
+ PLUGIN_LICENSE_GPL,
+ innodb_sys_stats_init,
+ i_s_common_deinit,
+ INNODB_VERSION_SHORT,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_rseg_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_RSEG",
+ "Percona",
+ "InnoDB rollback segment information",
+ PLUGIN_LICENSE_GPL,
+ i_s_innodb_rseg_init,
+ i_s_common_deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_table_stats_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_TABLE_STATS",
+ "Percona",
+ "InnoDB table statistics in memory",
+ PLUGIN_LICENSE_GPL,
+ i_s_innodb_table_stats_init,
+ i_s_common_deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_index_stats_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_INDEX_STATS",
+ "Percona",
+ "InnoDB index statistics in memory",
+ PLUGIN_LICENSE_GPL,
+ i_s_innodb_index_stats_init,
+ i_s_common_deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_admin_command_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "XTRADB_ADMIN_COMMAND",
+ "Percona",
+ "XtraDB specific command acceptor",
+ PLUGIN_LICENSE_GPL,
+ i_s_innodb_admin_command_init,
+ i_s_common_deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_pool_pages_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_BUFFER_POOL_PAGES",
+ "Percona",
+ "InnoDB buffer pool pages",
+ PLUGIN_LICENSE_GPL,
+ i_s_innodb_buffer_pool_pages_init,
+ i_s_common_deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_pool_pages_index_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_BUFFER_POOL_PAGES_INDEX",
+ "Percona",
+ "InnoDB buffer pool index pages",
+ PLUGIN_LICENSE_GPL,
+ i_s_innodb_buffer_pool_pages_index_init,
+ i_s_common_deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
+UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_pool_pages_blob_maria =
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &i_s_info,
+ "INNODB_BUFFER_POOL_PAGES_BLOB",
+ "Percona",
+ "InnoDB buffer pool blob pages",
+ PLUGIN_LICENSE_GPL,
+ i_s_innodb_buffer_pool_pages_blob_init,
+ i_s_common_deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
};
-
diff --git a/storage/xtradb/handler/i_s.h b/storage/xtradb/handler/i_s.h
index 7a5c3ead5ed..f39172ea0a9 100644
--- a/storage/xtradb/handler/i_s.h
+++ b/storage/xtradb/handler/i_s.h
@@ -26,9 +26,8 @@ Created July 18, 2007 Vasil Dimov
#ifndef i_s_h
#define i_s_h
-extern struct st_mysql_plugin i_s_innodb_buffer_pool_pages;
-extern struct st_mysql_plugin i_s_innodb_buffer_pool_pages_index;
-extern struct st_mysql_plugin i_s_innodb_buffer_pool_pages_blob;
+const char plugin_author[] = "Oracle Corporation";
+
extern struct st_mysql_plugin i_s_innodb_trx;
extern struct st_mysql_plugin i_s_innodb_locks;
extern struct st_mysql_plugin i_s_innodb_lock_waits;
@@ -36,32 +35,43 @@ extern struct st_mysql_plugin i_s_innodb_cmp;
extern struct st_mysql_plugin i_s_innodb_cmp_reset;
extern struct st_mysql_plugin i_s_innodb_cmpmem;
extern struct st_mysql_plugin i_s_innodb_cmpmem_reset;
-extern struct st_mysql_plugin i_s_innodb_patches;
+extern struct st_mysql_plugin i_s_innodb_sys_tables;
+extern struct st_mysql_plugin i_s_innodb_sys_tablestats;
+extern struct st_mysql_plugin i_s_innodb_sys_indexes;
+extern struct st_mysql_plugin i_s_innodb_sys_columns;
+extern struct st_mysql_plugin i_s_innodb_sys_fields;
+extern struct st_mysql_plugin i_s_innodb_sys_foreign;
+extern struct st_mysql_plugin i_s_innodb_sys_foreign_cols;
extern struct st_mysql_plugin i_s_innodb_rseg;
+extern struct st_mysql_plugin i_s_innodb_sys_stats;
extern struct st_mysql_plugin i_s_innodb_table_stats;
extern struct st_mysql_plugin i_s_innodb_index_stats;
extern struct st_mysql_plugin i_s_innodb_admin_command;
-extern struct st_mysql_plugin i_s_innodb_sys_tables;
-extern struct st_mysql_plugin i_s_innodb_sys_indexes;
-extern struct st_mysql_plugin i_s_innodb_sys_stats;
+extern struct st_mysql_plugin i_s_innodb_buffer_pool_pages;
+extern struct st_mysql_plugin i_s_innodb_buffer_pool_pages_index;
+extern struct st_mysql_plugin i_s_innodb_buffer_pool_pages_blob;
-extern struct st_maria_plugin i_s_innodb_buffer_pool_pages_maria;
-extern struct st_maria_plugin i_s_innodb_buffer_pool_pages_index_maria;
-extern struct st_maria_plugin i_s_innodb_buffer_pool_pages_blob_maria;
-extern struct st_maria_plugin i_s_innodb_trx_maria;
-extern struct st_maria_plugin i_s_innodb_locks_maria;
-extern struct st_maria_plugin i_s_innodb_lock_waits_maria;
-extern struct st_maria_plugin i_s_innodb_cmp_maria;
-extern struct st_maria_plugin i_s_innodb_cmp_reset_maria;
-extern struct st_maria_plugin i_s_innodb_cmpmem_maria;
-extern struct st_maria_plugin i_s_innodb_cmpmem_reset_maria;
-extern struct st_maria_plugin i_s_innodb_patches_maria;
-extern struct st_maria_plugin i_s_innodb_rseg_maria;
-extern struct st_maria_plugin i_s_innodb_table_stats_maria;
-extern struct st_maria_plugin i_s_innodb_index_stats_maria;
-extern struct st_maria_plugin i_s_innodb_admin_command_maria;
-extern struct st_maria_plugin i_s_innodb_sys_tables_maria;
-extern struct st_maria_plugin i_s_innodb_sys_indexes_maria;
-extern struct st_maria_plugin i_s_innodb_sys_stats_maria;
+extern struct st_maria_plugin i_s_innodb_trx_maria;
+extern struct st_maria_plugin i_s_innodb_locks_maria;
+extern struct st_maria_plugin i_s_innodb_lock_waits_maria;
+extern struct st_maria_plugin i_s_innodb_cmp_maria;
+extern struct st_maria_plugin i_s_innodb_cmp_reset_maria;
+extern struct st_maria_plugin i_s_innodb_cmpmem_maria;
+extern struct st_maria_plugin i_s_innodb_cmpmem_reset_maria;
+extern struct st_maria_plugin i_s_innodb_sys_tables_maria;
+extern struct st_maria_plugin i_s_innodb_sys_tablestats_maria;
+extern struct st_maria_plugin i_s_innodb_sys_indexes_maria;
+extern struct st_maria_plugin i_s_innodb_sys_columns_maria;
+extern struct st_maria_plugin i_s_innodb_sys_fields_maria;
+extern struct st_maria_plugin i_s_innodb_sys_foreign_maria;
+extern struct st_maria_plugin i_s_innodb_sys_foreign_cols_maria;
+extern struct st_maria_plugin i_s_innodb_sys_stats_maria;
+extern struct st_maria_plugin i_s_innodb_rseg_maria;
+extern struct st_maria_plugin i_s_innodb_table_stats_maria;
+extern struct st_maria_plugin i_s_innodb_index_stats_maria;
+extern struct st_maria_plugin i_s_innodb_admin_command_maria;
+extern struct st_maria_plugin i_s_innodb_buffer_pool_pages_maria;
+extern struct st_maria_plugin i_s_innodb_buffer_pool_pages_index_maria;
+extern struct st_maria_plugin i_s_innodb_buffer_pool_pages_blob_maria;
#endif /* i_s_h */
diff --git a/storage/xtradb/handler/innodb_patch_info.h b/storage/xtradb/handler/innodb_patch_info.h
deleted file mode 100644
index e68f12d0fec..00000000000
--- a/storage/xtradb/handler/innodb_patch_info.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 2002-2006 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
-struct innodb_enhancement {
- const char *file;
- const char *name;
- const char *comment;
- const char *link;
-}innodb_enhancements[] = {
-{"xtradb_show_enhancements","I_S.XTRADB_ENHANCEMENTS","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_show_status","Improvements to SHOW INNODB STATUS","Memory information and lock info fixes","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_io","Improvements to InnoDB IO","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_opt_lru_count","Fix of buffer_pool mutex","Decreases contention on buffer_pool mutex on LRU operations","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_buffer_pool_pages","Information of buffer pool content","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_expand_undo_slots","expandable maximum number of undo slots","from 1024 (default) to about 4000","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_extra_rseg","allow to create extra rollback segments","When create new db, the new parameter allows to create more rollback segments","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_overwrite_relay_log_info","overwrite relay-log.info when slave recovery","Building as plugin, it is not used.","http://www.percona.com/docs/wiki/percona-xtradb:innodb_overwrite_relay_log_info"},
-{"innodb_thread_concurrency_timer_based","use InnoDB timer based concurrency throttling (backport from MySQL 5.4.0)","",""},
-{"innodb_expand_import","convert .ibd file automatically when import tablespace","the files are generated by xtrabackup export mode.","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_dict_size_limit","Limit dictionary cache size","Variable innodb_dict_size_limit in bytes","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_split_buf_pool_mutex","More fix of buffer_pool mutex","Spliting buf_pool_mutex and optimizing based on innodb_opt_lru_count","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_stats","Additional features about InnoDB statistics/optimizer","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_recovery_patches","Bugfixes and adjustments about recovery process","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_purge_thread","Enable to use purge devoted thread","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_admin_command_base","XtraDB specific command interface through i_s","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_show_lock_name","Show mutex/lock name instead of crated file/line","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_extend_slow","Extended statistics in slow.log","It is InnoDB-part only. It needs to patch also to mysqld.","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_lru_dump_restore","Dump and restore command for content of buffer pool","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_separate_doublewrite","Add option 'innodb_doublewrite_file' to separate doublewrite dedicated tablespace","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_pass_corrupt_table","Treat tables as corrupt instead of crash, when meet corrupt blocks","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_fast_checksum","Using the checksum on 32bit-unit calculation","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_files_extend","allow >4GB transaction log files, and can vary universal page size of datafiles","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_sys_tables_sys_indexes","Expose InnoDB SYS_TABLES and SYS_INDEXES schema tables","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_buffer_pool_shm","Put buffer pool contents to shared memory segment and reuse it at clean restart [experimental]","","http://www.percona.com/docs/wiki/percona-xtradb"},
-{NULL, NULL, NULL, NULL}
-};
diff --git a/storage/xtradb/handler/mysql_addons.cc b/storage/xtradb/handler/mysql_addons.cc
deleted file mode 100644
index ae6306e5db9..00000000000
--- a/storage/xtradb/handler/mysql_addons.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2007, 2009, Innobase Oy. 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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file handler/mysql_addons.cc
-This file contains functions that need to be added to
-MySQL code but have not been added yet.
-
-Whenever you add a function here submit a MySQL bug
-report (feature request) with the implementation. Then
-write the bug number in the comment before the
-function in this file.
-
-When MySQL commits the function it can be deleted from
-here. In a perfect world this file exists but is empty.
-
-Created November 07, 2007 Vasil Dimov
-*******************************************************/
-
-#ifndef MYSQL_SERVER
-#define MYSQL_SERVER
-#endif /* MYSQL_SERVER */
-
-#include <sql_priv.h>
-
-#include "mysql_addons.h"
-#include "univ.i"
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.c b/storage/xtradb/ibuf/ibuf0ibuf.c
index e01c2d6b800..f5ed301dcf1 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.c
+++ b/storage/xtradb/ibuf/ibuf0ibuf.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2010, Innobase Oy. 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
@@ -44,17 +44,18 @@ Created 7/19/1997 Heikki Tuuri
#include "fsp0fsp.h"
#include "trx0sys.h"
#include "fil0fil.h"
-#include "thr0loc.h"
#include "rem0rec.h"
#include "btr0cur.h"
#include "btr0pcur.h"
#include "btr0btr.h"
+#include "row0upd.h"
#include "sync0sync.h"
#include "dict0boot.h"
#include "fut0lst.h"
#include "lock0lock.h"
#include "log0recv.h"
#include "que0que.h"
+#include "srv0start.h" /* srv_shutdown_state */
/* STRUCTURE OF AN INSERT BUFFER RECORD
@@ -89,7 +90,28 @@ is in the compact format. The presence of this marker can be detected by
looking at the length of the field modulo DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE.
The high-order bit of the character set field in the type info is the
-"nullable" flag for the field. */
+"nullable" flag for the field.
+
+In versions >= 5.5:
+
+The optional marker byte at the start of the fourth field is replaced by
+mandatory 3 fields, totaling 4 bytes:
+
+ 1. 2 bytes: Counter field, used to sort records within a (space id, page
+ no) in the order they were added. This is needed so that for example the
+ sequence of operations "INSERT x, DEL MARK x, INSERT x" is handled
+ correctly.
+
+ 2. 1 byte: Operation type (see ibuf_op_t).
+
+ 3. 1 byte: Flags. Currently only one flag exists, IBUF_REC_COMPACT.
+
+To ensure older records, which do not have counters to enforce correct
+sorting, are merged before any new records, ibuf_insert checks if we're
+trying to insert to a position that contains old-style records, and if so,
+refuses the insert. Thus, ibuf pages are gradually converted to the new
+format as their corresponding buffer pool pages are read into memory.
+*/
/* PREVENTING DEADLOCKS IN THE INSERT BUFFER SYSTEM
@@ -168,7 +190,12 @@ access order rules. */
#define IBUF_TABLE_NAME "SYS_IBUF_TABLE"
/** Operations that can currently be buffered. */
-UNIV_INTERN ibuf_use_t ibuf_use = IBUF_USE_INSERT;
+UNIV_INTERN ibuf_use_t ibuf_use = IBUF_USE_ALL;
+
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+/** Flag to control insert buffer debugging. */
+UNIV_INTERN uint ibuf_debug;
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
/** The insert buffer control structure */
UNIV_INTERN ibuf_t* ibuf = NULL;
@@ -176,6 +203,12 @@ UNIV_INTERN ibuf_t* ibuf = NULL;
/** Counter for ibuf_should_try() */
UNIV_INTERN ulint ibuf_flush_count = 0;
+#ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key;
+UNIV_INTERN mysql_pfs_key_t ibuf_mutex_key;
+UNIV_INTERN mysql_pfs_key_t ibuf_bitmap_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
#ifdef UNIV_IBUF_COUNT_DEBUG
/** Number of tablespaces in the ibuf_counts array */
#define IBUF_COUNT_N_SPACES 4
@@ -221,6 +254,32 @@ ibuf_count_check(
list of the ibuf */
/* @} */
+/* Various constants for checking the type of an ibuf record and extracting
+data from it. For details, see the description of the record format at the
+top of this file. */
+
+/** @name Format of the fourth column of an insert buffer record
+The fourth column in the MySQL 5.5 format contains an operation
+type, counter, and some flags. */
+/* @{ */
+#define IBUF_REC_INFO_SIZE 4 /*!< Combined size of info fields at
+ the beginning of the fourth field */
+#if IBUF_REC_INFO_SIZE >= DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
+# error "IBUF_REC_INFO_SIZE >= DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE"
+#endif
+
+/* Offsets for the fields at the beginning of the fourth field */
+#define IBUF_REC_OFFSET_COUNTER 0 /*!< Operation counter */
+#define IBUF_REC_OFFSET_TYPE 2 /*!< Type of operation */
+#define IBUF_REC_OFFSET_FLAGS 3 /*!< Additional flags */
+
+/* Record flag masks */
+#define IBUF_REC_COMPACT 0x1 /*!< Set in
+ IBUF_REC_OFFSET_FLAGS if the
+ user index is in COMPACT
+ format or later */
+
+
/** The mutex used to block pessimistic inserts to ibuf trees */
static mutex_t ibuf_pessimistic_insert_mutex;
@@ -264,52 +323,43 @@ still physically like the index page even if the index would have been
dropped! So, there seems to be no problem. */
/******************************************************************//**
-Sets the flag in the current OS thread local storage denoting that it is
+Sets the flag in the current mini-transaction record indicating we're
inside an insert buffer routine. */
UNIV_INLINE
void
-ibuf_enter(void)
-/*============*/
+ibuf_enter(
+/*=======*/
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
- ibool* ptr;
-
- ptr = thr_local_get_in_ibuf_field();
-
- ut_ad(*ptr == FALSE);
-
- *ptr = TRUE;
+ ut_ad(!mtr->inside_ibuf);
+ mtr->inside_ibuf = TRUE;
}
/******************************************************************//**
-Sets the flag in the current OS thread local storage denoting that it is
+Sets the flag in the current mini-transaction record indicating we're
exiting an insert buffer routine. */
UNIV_INLINE
void
-ibuf_exit(void)
-/*===========*/
+ibuf_exit(
+/*======*/
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
- ibool* ptr;
-
- ptr = thr_local_get_in_ibuf_field();
-
- ut_ad(*ptr == TRUE);
-
- *ptr = FALSE;
+ ut_ad(mtr->inside_ibuf);
+ mtr->inside_ibuf = FALSE;
}
-/******************************************************************//**
-Returns TRUE if the current OS thread is performing an insert buffer
-routine.
-
-For instance, a read-ahead of non-ibuf pages is forbidden by threads
-that are executing an insert buffer routine.
-@return TRUE if inside an insert buffer routine */
-UNIV_INTERN
-ibool
-ibuf_inside(void)
-/*=============*/
+/**************************************************************//**
+Commits an insert buffer mini-transaction and sets the persistent
+cursor latch mode to BTR_NO_LATCHES, that is, detaches the cursor. */
+UNIV_INLINE
+void
+ibuf_btr_pcur_commit_specify_mtr(
+/*=============================*/
+ btr_pcur_t* pcur, /*!< in/out: persistent cursor */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
- return(*thr_local_get_in_ibuf_field());
+ ut_d(ibuf_exit(mtr));
+ btr_pcur_commit_specify_mtr(pcur, mtr);
}
/******************************************************************//**
@@ -319,11 +369,11 @@ static
page_t*
ibuf_header_page_get(
/*=================*/
- mtr_t* mtr) /*!< in: mtr */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
buf_block_t* block;
- ut_ad(!ibuf_inside());
+ ut_ad(!ibuf_inside(mtr));
block = buf_page_get(
IBUF_SPACE_ID, 0, FSP_IBUF_HEADER_PAGE_NO, RW_X_LATCH, mtr);
@@ -342,8 +392,10 @@ ibuf_tree_root_get(
mtr_t* mtr) /*!< in: mtr */
{
buf_block_t* block;
+ page_t* root;
- ut_ad(ibuf_inside());
+ ut_ad(ibuf_inside(mtr));
+ ut_ad(mutex_own(&ibuf_mutex));
mtr_x_lock(dict_index_get_lock(ibuf->index), mtr);
@@ -352,7 +404,13 @@ ibuf_tree_root_get(
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
- return(buf_block_get_frame(block));
+ root = buf_block_get_frame(block);
+
+ ut_ad(page_get_space_id(root) == IBUF_SPACE_ID);
+ ut_ad(page_get_page_no(root) == FSP_IBUF_TREE_ROOT_PAGE_NO);
+ ut_ad(ibuf->empty == (page_get_n_recs(root) == 0));
+
+ return(root);
}
#ifdef UNIV_IBUF_COUNT_DEBUG
@@ -411,6 +469,45 @@ ibuf_close(void)
}
/******************************************************************//**
+Function to pass ibuf status variables */
+UNIV_INTERN
+void
+ibuf_export_ibuf_status(
+/*====================*/
+ ulint* size,
+ ulint* free_list,
+ ulint* segment_size,
+ ulint* merges,
+ ulint* merged_inserts,
+ ulint* merged_delete_marks,
+ ulint* merged_deletes,
+ ulint* discarded_inserts,
+ ulint* discarded_delete_marks,
+ ulint* discarded_deletes)
+{
+ *size
+ = ibuf->size;
+ *free_list
+ = ibuf->free_list_len;
+ *segment_size
+ = ibuf->seg_size;
+ *merges
+ = ibuf->n_merges;
+ *merged_inserts
+ = ibuf->n_merged_ops[IBUF_OP_INSERT];
+ *merged_delete_marks
+ = ibuf->n_merged_ops[IBUF_OP_DELETE_MARK];
+ *merged_deletes
+ = ibuf->n_merged_ops[IBUF_OP_DELETE];
+ *discarded_inserts
+ = ibuf->n_discarded_ops[IBUF_OP_INSERT];
+ *discarded_delete_marks
+ = ibuf->n_discarded_ops[IBUF_OP_DELETE_MARK];
+ *discarded_deletes
+ = ibuf->n_discarded_ops[IBUF_OP_DELETE];
+}
+
+/******************************************************************//**
Updates the size information of the ibuf, assuming the segment size has not
changed. */
static
@@ -429,8 +526,6 @@ ibuf_size_update(
/* the '1 +' is the ibuf header page */
ibuf->size = ibuf->seg_size - (1 + ibuf->free_list_len);
-
- ibuf->empty = page_get_n_recs(root) == 0;
}
/******************************************************************//**
@@ -463,12 +558,15 @@ ibuf_init_at_db_start(void)
srv_ibuf_max_size = (long long) ibuf->max_size * UNIV_PAGE_SIZE;
- mutex_create(&ibuf_pessimistic_insert_mutex,
+ mutex_create(ibuf_pessimistic_insert_mutex_key,
+ &ibuf_pessimistic_insert_mutex,
SYNC_IBUF_PESS_INSERT_MUTEX);
- mutex_create(&ibuf_mutex, SYNC_IBUF_MUTEX);
+ mutex_create(ibuf_mutex_key,
+ &ibuf_mutex, SYNC_IBUF_MUTEX);
- mutex_create(&ibuf_bitmap_mutex, SYNC_IBUF_BITMAP_MUTEX);
+ mutex_create(ibuf_bitmap_mutex_key,
+ &ibuf_bitmap_mutex, SYNC_IBUF_BITMAP_MUTEX);
mtr_start(&mtr);
@@ -480,7 +578,7 @@ ibuf_init_at_db_start(void)
fseg_n_reserved_pages(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
&n_used, &mtr);
- ibuf_enter();
+ ibuf_enter(&mtr);
ut_ad(n_used >= 2);
@@ -500,9 +598,8 @@ ibuf_init_at_db_start(void)
ibuf_size_update(root, &mtr);
mutex_exit(&ibuf_mutex);
- mtr_commit(&mtr);
-
- ibuf_exit();
+ ibuf->empty = (page_get_n_recs(root) == 0);
+ ibuf_mtr_commit(&mtr);
heap = mem_heap_create(450);
@@ -512,7 +609,7 @@ ibuf_init_at_db_start(void)
dict_mem_table_add_col(table, heap, "DUMMY_COLUMN", DATA_BINARY, 0, 0);
- table->id = ut_dulint_add(DICT_IBUF_ID_MIN, IBUF_SPACE_ID);
+ table->id = DICT_IBUF_ID_MIN + IBUF_SPACE_ID;
dict_table_add_to_cache(table, heap);
mem_heap_free(heap);
@@ -523,7 +620,7 @@ ibuf_init_at_db_start(void)
dict_mem_index_add_field(index, "DUMMY_COLUMN", 0);
- index->id = ut_dulint_add(DICT_IBUF_ID_MIN, IBUF_SPACE_ID);
+ index->id = DICT_IBUF_ID_MIN + IBUF_SPACE_ID;
error = dict_index_add_to_cache(table, index,
FSP_IBUF_TREE_ROOT_PAGE_NO, FALSE);
@@ -589,22 +686,49 @@ ibuf_parse_bitmap_init(
return(ptr);
}
#ifndef UNIV_HOTBACKUP
+# ifdef UNIV_DEBUG
+/** Gets the desired bits for a given page from a bitmap page.
+@param page in: bitmap page
+@param offset in: page whose bits to get
+@param zs in: compressed page size in bytes; 0 for uncompressed pages
+@param bit in: IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ...
+@param mtr in: mini-transaction holding an x-latch on the bitmap page
+@return value of bits */
+# define ibuf_bitmap_page_get_bits(page, offset, zs, bit, mtr) \
+ ibuf_bitmap_page_get_bits_low(page, offset, zs, \
+ MTR_MEMO_PAGE_X_FIX, mtr, bit)
+# else /* UNIV_DEBUG */
+/** Gets the desired bits for a given page from a bitmap page.
+@param page in: bitmap page
+@param offset in: page whose bits to get
+@param zs in: compressed page size in bytes; 0 for uncompressed pages
+@param bit in: IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ...
+@param mtr in: mini-transaction holding an x-latch on the bitmap page
+@return value of bits */
+# define ibuf_bitmap_page_get_bits(page, offset, zs, bit, mtr) \
+ ibuf_bitmap_page_get_bits_low(page, offset, zs, bit)
+# endif /* UNIV_DEBUG */
+
/********************************************************************//**
Gets the desired bits for a given page from a bitmap page.
@return value of bits */
UNIV_INLINE
ulint
-ibuf_bitmap_page_get_bits(
-/*======================*/
+ibuf_bitmap_page_get_bits_low(
+/*==========================*/
const page_t* page, /*!< in: bitmap page */
ulint page_no,/*!< in: page whose bits to get */
ulint zip_size,/*!< in: compressed page size in bytes;
0 for uncompressed pages */
- ulint bit, /*!< in: IBUF_BITMAP_FREE,
+#ifdef UNIV_DEBUG
+ ulint latch_type,
+ /*!< in: MTR_MEMO_PAGE_X_FIX,
+ MTR_MEMO_BUF_FIX, ... */
+ mtr_t* mtr, /*!< in: mini-transaction holding latch_type
+ on the bitmap page */
+#endif /* UNIV_DEBUG */
+ ulint bit) /*!< in: IBUF_BITMAP_FREE,
IBUF_BITMAP_BUFFERED, ... */
- mtr_t* mtr __attribute__((unused)))
- /*!< in: mtr containing an
- x-latch to the bitmap page */
{
ulint byte_offset;
ulint bit_offset;
@@ -616,7 +740,7 @@ ibuf_bitmap_page_get_bits(
# error "IBUF_BITS_PER_PAGE % 2 != 0"
#endif
ut_ad(ut_is_2pow(zip_size));
- ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
+ ut_ad(mtr_memo_contains_page(mtr, page, latch_type));
if (!zip_size) {
bit_offset = (page_no % UNIV_PAGE_SIZE) * IBUF_BITS_PER_PAGE
@@ -1042,21 +1166,29 @@ Must not be called when recv_no_ibuf_operations==TRUE.
@return TRUE if level 2 or level 3 page */
UNIV_INTERN
ibool
-ibuf_page(
-/*======*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
- ulint page_no,/*!< in: page number */
- mtr_t* mtr) /*!< in: mtr which will contain an x-latch to the
- bitmap page if the page is not one of the fixed
- address ibuf pages, or NULL, in which case a new
- transaction is created. */
+ibuf_page_low(
+/*==========*/
+ ulint space, /*!< in: space id */
+ ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
+ ulint page_no,/*!< in: page number */
+#ifdef UNIV_DEBUG
+ ibool x_latch,/*!< in: FALSE if relaxed check
+ (avoid latching the bitmap page) */
+#endif /* UNIV_DEBUG */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
+ mtr_t* mtr) /*!< in: mtr which will contain an
+ x-latch to the bitmap page if the page
+ is not one of the fixed address ibuf
+ pages, or NULL, in which case a new
+ transaction is created. */
{
ibool ret;
mtr_t local_mtr;
page_t* bitmap_page;
ut_ad(!recv_no_ibuf_operations);
+ ut_ad(x_latch || mtr == NULL);
if (ibuf_fixed_addr_page(space, zip_size, page_no)) {
@@ -1068,12 +1200,44 @@ ibuf_page(
ut_ad(fil_space_get_type(IBUF_SPACE_ID) == FIL_TABLESPACE);
+#ifdef UNIV_DEBUG
+ if (!x_latch) {
+ mtr_start(&local_mtr);
+
+ /* Get the bitmap page without a page latch, so that
+ we will not be violating the latching order when
+ another bitmap page has already been latched by this
+ thread. The page will be buffer-fixed, and thus it
+ cannot be removed or relocated while we are looking at
+ it. The contents of the page could change, but the
+ IBUF_BITMAP_IBUF bit that we are interested in should
+ not be modified by any other thread. Nobody should be
+ calling ibuf_add_free_page() or ibuf_remove_free_page()
+ while the page is linked to the insert buffer b-tree. */
+
+ bitmap_page = buf_block_get_frame(
+ buf_page_get_gen(
+ space, zip_size,
+ ibuf_bitmap_page_no_calc(zip_size, page_no),
+ RW_NO_LATCH, NULL, BUF_GET_NO_LATCH,
+ file, line, &local_mtr));
+
+ ret = ibuf_bitmap_page_get_bits_low(
+ bitmap_page, page_no, zip_size,
+ MTR_MEMO_BUF_FIX, &local_mtr, IBUF_BITMAP_IBUF);
+
+ mtr_commit(&local_mtr);
+ return(ret);
+ }
+#endif /* UNIV_DEBUG */
+
if (mtr == NULL) {
mtr = &local_mtr;
mtr_start(mtr);
}
- bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, mtr);
+ bitmap_page = ibuf_bitmap_get_map_page_func(space, page_no, zip_size,
+ file, line, mtr);
ret = ibuf_bitmap_page_get_bits(bitmap_page, page_no, zip_size,
IBUF_BITMAP_IBUF, mtr);
@@ -1085,19 +1249,30 @@ ibuf_page(
return(ret);
}
+#ifdef UNIV_DEBUG
+# define ibuf_rec_get_page_no(mtr,rec) ibuf_rec_get_page_no_func(mtr,rec)
+#else /* UNIV_DEBUG */
+# define ibuf_rec_get_page_no(mtr,rec) ibuf_rec_get_page_no_func(rec)
+#endif /* UNIV_DEBUG */
+
/********************************************************************//**
Returns the page number field of an ibuf record.
@return page number */
static
ulint
-ibuf_rec_get_page_no(
-/*=================*/
+ibuf_rec_get_page_no_func(
+/*======================*/
+#ifdef UNIV_DEBUG
+ mtr_t* mtr, /*!< in: mini-transaction owning rec */
+#endif /* UNIV_DEBUG */
const rec_t* rec) /*!< in: ibuf record */
{
const byte* field;
ulint len;
- ut_ad(ibuf_inside());
+ ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
+ || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(ibuf_inside(mtr));
ut_ad(rec_get_n_fields_old(rec) > 2);
field = rec_get_nth_field_old(rec, 1, &len);
@@ -1119,20 +1294,31 @@ ibuf_rec_get_page_no(
return(mach_read_from_4(field));
}
+#ifdef UNIV_DEBUG
+# define ibuf_rec_get_space(mtr,rec) ibuf_rec_get_space_func(mtr,rec)
+#else /* UNIV_DEBUG */
+# define ibuf_rec_get_space(mtr,rec) ibuf_rec_get_space_func(rec)
+#endif /* UNIV_DEBUG */
+
/********************************************************************//**
Returns the space id field of an ibuf record. For < 4.1.x format records
returns 0.
@return space id */
static
ulint
-ibuf_rec_get_space(
-/*===============*/
+ibuf_rec_get_space_func(
+/*====================*/
+#ifdef UNIV_DEBUG
+ mtr_t* mtr, /*!< in: mini-transaction owning rec */
+#endif /* UNIV_DEBUG */
const rec_t* rec) /*!< in: ibuf record */
{
const byte* field;
ulint len;
- ut_ad(ibuf_inside());
+ ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
+ || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(ibuf_inside(mtr));
ut_ad(rec_get_n_fields_old(rec) > 2);
field = rec_get_nth_field_old(rec, 1, &len);
@@ -1153,9 +1339,215 @@ ibuf_rec_get_space(
return(0);
}
+#ifdef UNIV_DEBUG
+# define ibuf_rec_get_info(mtr,rec,op,comp,info_len,counter) \
+ ibuf_rec_get_info_func(mtr,rec,op,comp,info_len,counter)
+#else /* UNIV_DEBUG */
+# define ibuf_rec_get_info(mtr,rec,op,comp,info_len,counter) \
+ ibuf_rec_get_info_func(rec,op,comp,info_len,counter)
+#endif
+/****************************************************************//**
+Get various information about an ibuf record in >= 4.1.x format. */
+static
+void
+ibuf_rec_get_info_func(
+/*===================*/
+#ifdef UNIV_DEBUG
+ mtr_t* mtr, /*!< in: mini-transaction owning rec */
+#endif /* UNIV_DEBUG */
+ const rec_t* rec, /*!< in: ibuf record */
+ ibuf_op_t* op, /*!< out: operation type, or NULL */
+ ibool* comp, /*!< out: compact flag, or NULL */
+ ulint* info_len, /*!< out: length of info fields at the
+ start of the fourth field, or
+ NULL */
+ ulint* counter) /*!< in: counter value, or NULL */
+{
+ const byte* types;
+ ulint fields;
+ ulint len;
+
+ /* Local variables to shadow arguments. */
+ ibuf_op_t op_local;
+ ibool comp_local;
+ ulint info_len_local;
+ ulint counter_local;
+
+ ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
+ || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(ibuf_inside(mtr));
+ fields = rec_get_n_fields_old(rec);
+ ut_a(fields > 4);
+
+ types = rec_get_nth_field_old(rec, 3, &len);
+
+ info_len_local = len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE;
+
+ switch (info_len_local) {
+ case 0:
+ case 1:
+ op_local = IBUF_OP_INSERT;
+ comp_local = info_len_local;
+ ut_ad(!counter);
+ counter_local = ULINT_UNDEFINED;
+ break;
+
+ case IBUF_REC_INFO_SIZE:
+ op_local = (ibuf_op_t)types[IBUF_REC_OFFSET_TYPE];
+ comp_local = types[IBUF_REC_OFFSET_FLAGS] & IBUF_REC_COMPACT;
+ counter_local = mach_read_from_2(
+ types + IBUF_REC_OFFSET_COUNTER);
+ break;
+
+ default:
+ ut_error;
+ }
+
+ ut_a(op_local < IBUF_OP_COUNT);
+ ut_a((len - info_len_local) ==
+ (fields - 4) * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
+
+ if (op) {
+ *op = op_local;
+ }
+
+ if (comp) {
+ *comp = comp_local;
+ }
+
+ if (info_len) {
+ *info_len = info_len_local;
+ }
+
+ if (counter) {
+ *counter = counter_local;
+ }
+}
+
+#ifdef UNIV_DEBUG
+# define ibuf_rec_get_op_type(mtr,rec) ibuf_rec_get_op_type_func(mtr,rec)
+#else /* UNIV_DEBUG */
+# define ibuf_rec_get_op_type(mtr,rec) ibuf_rec_get_op_type_func(rec)
+#endif
+
+/****************************************************************//**
+Returns the operation type field of an ibuf record.
+@return operation type */
+static
+ibuf_op_t
+ibuf_rec_get_op_type_func(
+/*======================*/
+#ifdef UNIV_DEBUG
+ mtr_t* mtr, /*!< in: mini-transaction owning rec */
+#endif /* UNIV_DEBUG */
+ const rec_t* rec) /*!< in: ibuf record */
+{
+ ulint len;
+
+ ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
+ || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(ibuf_inside(mtr));
+ ut_ad(rec_get_n_fields_old(rec) > 2);
+
+ (void) rec_get_nth_field_old(rec, 1, &len);
+
+ if (len > 1) {
+ /* This is a < 4.1.x format record */
+
+ return(IBUF_OP_INSERT);
+ } else {
+ ibuf_op_t op;
+
+ ibuf_rec_get_info(mtr, rec, &op, NULL, NULL, NULL);
+
+ return(op);
+ }
+}
+
+/****************************************************************//**
+Read the first two bytes from a record's fourth field (counter field in new
+records; something else in older records).
+@return "counter" field, or ULINT_UNDEFINED if for some reason it
+can't be read */
+UNIV_INTERN
+ulint
+ibuf_rec_get_counter(
+/*=================*/
+ const rec_t* rec) /*!< in: ibuf record */
+{
+ const byte* ptr;
+ ulint len;
+
+ if (rec_get_n_fields_old(rec) < 4) {
+
+ return(ULINT_UNDEFINED);
+ }
+
+ ptr = rec_get_nth_field_old(rec, 3, &len);
+
+ if (len >= 2) {
+
+ return(mach_read_from_2(ptr));
+ } else {
+
+ return(ULINT_UNDEFINED);
+ }
+}
+
+/****************************************************************//**
+Add accumulated operation counts to a permanent array. Both arrays must be
+of size IBUF_OP_COUNT. */
+static
+void
+ibuf_add_ops(
+/*=========*/
+ ulint* arr, /*!< in/out: array to modify */
+ const ulint* ops) /*!< in: operation counts */
+
+{
+ ulint i;
+
+#ifndef HAVE_ATOMIC_BUILTINS
+ ut_ad(mutex_own(&ibuf_mutex));
+#endif /* !HAVE_ATOMIC_BUILTINS */
+
+ for (i = 0; i < IBUF_OP_COUNT; i++) {
+#ifdef HAVE_ATOMIC_BUILTINS
+ os_atomic_increment_ulint(&arr[i], ops[i]);
+#else /* HAVE_ATOMIC_BUILTINS */
+ arr[i] += ops[i];
+#endif /* HAVE_ATOMIC_BUILTINS */
+ }
+}
+
+/****************************************************************//**
+Print operation counts. The array must be of size IBUF_OP_COUNT. */
+static
+void
+ibuf_print_ops(
+/*===========*/
+ const ulint* ops, /*!< in: operation counts */
+ FILE* file) /*!< in: file where to print */
+{
+ static const char* op_names[] = {
+ "insert",
+ "delete mark",
+ "delete"
+ };
+ ulint i;
+
+ ut_a(UT_ARR_SIZE(op_names) == IBUF_OP_COUNT);
+
+ for (i = 0; i < IBUF_OP_COUNT; i++) {
+ fprintf(file, "%s %lu%s", op_names[i],
+ (ulong) ops[i], (i < (IBUF_OP_COUNT - 1)) ? ", " : "");
+ }
+
+ putc('\n', file);
+}
+
/********************************************************************//**
Creates a dummy index for inserting a record to a non-clustered index.
-
@return dummy index */
static
dict_index_t*
@@ -1265,9 +1657,25 @@ ibuf_build_entry_pre_4_1_x(
return(tuple);
}
+#ifdef UNIV_DEBUG
+# define ibuf_build_entry_from_ibuf_rec(mtr,ibuf_rec,heap,pindex) \
+ ibuf_build_entry_from_ibuf_rec_func(mtr,ibuf_rec,heap,pindex)
+#else /* UNIV_DEBUG */
+# define ibuf_build_entry_from_ibuf_rec(mtr,ibuf_rec,heap,pindex) \
+ ibuf_build_entry_from_ibuf_rec_func(ibuf_rec,heap,pindex)
+#endif
+
/*********************************************************************//**
-Builds the entry to insert into a non-clustered index when we have the
-corresponding record in an ibuf index.
+Builds the entry used to
+
+1) IBUF_OP_INSERT: insert into a non-clustered index
+
+2) IBUF_OP_DELETE_MARK: find the record whose delete-mark flag we need to
+ activate
+
+3) IBUF_OP_DELETE: find the record we need to delete
+
+when we have the corresponding record in an ibuf index.
NOTE that as we copy pointers to fields in ibuf_rec, the caller must
hold a latch to the ibuf_rec page as long as the entry is used!
@@ -1275,8 +1683,11 @@ hold a latch to the ibuf_rec page as long as the entry is used!
@return own: entry to insert to a non-clustered index */
static
dtuple_t*
-ibuf_build_entry_from_ibuf_rec(
-/*===========================*/
+ibuf_build_entry_from_ibuf_rec_func(
+/*================================*/
+#ifdef UNIV_DEBUG
+ mtr_t* mtr, /*!< in: mini-transaction owning rec */
+#endif /* UNIV_DEBUG */
const rec_t* ibuf_rec, /*!< in: record in an insert buffer */
mem_heap_t* heap, /*!< in: heap where built */
dict_index_t** pindex) /*!< out, own: dummy index that
@@ -1288,9 +1699,15 @@ ibuf_build_entry_from_ibuf_rec(
const byte* types;
const byte* data;
ulint len;
+ ulint info_len;
ulint i;
+ ulint comp;
dict_index_t* index;
+ ut_ad(mtr_memo_contains_page(mtr, ibuf_rec, MTR_MEMO_PAGE_X_FIX)
+ || mtr_memo_contains_page(mtr, ibuf_rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(ibuf_inside(mtr));
+
data = rec_get_nth_field_old(ibuf_rec, 1, &len);
if (len > 1) {
@@ -1311,16 +1728,12 @@ ibuf_build_entry_from_ibuf_rec(
types = rec_get_nth_field_old(ibuf_rec, 3, &len);
- ut_a(len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE <= 1);
- index = ibuf_dummy_index_create(
- n_fields, len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
+ ibuf_rec_get_info(mtr, ibuf_rec, NULL, &comp, &info_len, NULL);
- if (len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE) {
- /* compact record format */
- len--;
- ut_a(*types == 0);
- types++;
- }
+ index = ibuf_dummy_index_create(n_fields, comp);
+
+ len -= info_len;
+ types += info_len;
ut_a(len == n_fields * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
@@ -1350,6 +1763,64 @@ ibuf_build_entry_from_ibuf_rec(
return(tuple);
}
+/******************************************************************//**
+Get the data size.
+@return size of fields */
+UNIV_INLINE
+ulint
+ibuf_rec_get_size(
+/*==============*/
+ const rec_t* rec, /*!< in: ibuf record */
+ const byte* types, /*!< in: fields */
+ ulint n_fields, /*!< in: number of fields */
+ ibool pre_4_1, /*!< in: TRUE=pre-4.1 format,
+ FALSE=newer */
+ ulint comp) /*!< in: 0=ROW_FORMAT=REDUNDANT,
+ nonzero=ROW_FORMAT=COMPACT */
+{
+ ulint i;
+ ulint field_offset;
+ ulint types_offset;
+ ulint size = 0;
+
+ if (pre_4_1) {
+ field_offset = 2;
+ types_offset = DATA_ORDER_NULL_TYPE_BUF_SIZE;
+ } else {
+ field_offset = 4;
+ types_offset = DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE;
+ }
+
+ for (i = 0; i < n_fields; i++) {
+ ulint len;
+ dtype_t dtype;
+
+ rec_get_nth_field_offs_old(rec, i + field_offset, &len);
+
+ if (len != UNIV_SQL_NULL) {
+ size += len;
+ } else if (pre_4_1) {
+ dtype_read_for_order_and_null_size(&dtype, types);
+
+ size += dtype_get_sql_null_size(&dtype, comp);
+ } else {
+ dtype_new_read_for_order_and_null_size(&dtype, types);
+
+ size += dtype_get_sql_null_size(&dtype, comp);
+ }
+
+ types += types_offset;
+ }
+
+ return(size);
+}
+
+#ifdef UNIV_DEBUG
+# define ibuf_rec_get_volume(mtr,rec) ibuf_rec_get_volume_func(mtr,rec)
+#else /* UNIV_DEBUG */
+# define ibuf_rec_get_volume(mtr,rec) ibuf_rec_get_volume_func(rec)
+#endif
+
/********************************************************************//**
Returns the space taken by a stored non-clustered index entry if converted to
an index record.
@@ -1357,26 +1828,30 @@ an index record.
taken in the page directory */
static
ulint
-ibuf_rec_get_volume(
-/*================*/
+ibuf_rec_get_volume_func(
+/*=====================*/
+#ifdef UNIV_DEBUG
+ mtr_t* mtr, /*!< in: mini-transaction owning rec */
+#endif /* UNIV_DEBUG */
const rec_t* ibuf_rec)/*!< in: ibuf record */
{
- dtype_t dtype;
- ibool new_format = FALSE;
- ulint data_size = 0;
- ulint n_fields;
- const byte* types;
- const byte* data;
ulint len;
- ulint i;
+ const byte* data;
+ const byte* types;
+ ulint n_fields;
+ ulint data_size;
+ ibool pre_4_1;
ulint comp;
- ut_ad(ibuf_inside());
+ ut_ad(mtr_memo_contains_page(mtr, ibuf_rec, MTR_MEMO_PAGE_X_FIX)
+ || mtr_memo_contains_page(mtr, ibuf_rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(ibuf_inside(mtr));
ut_ad(rec_get_n_fields_old(ibuf_rec) > 2);
data = rec_get_nth_field_old(ibuf_rec, 1, &len);
+ pre_4_1 = (len > 1);
- if (len > 1) {
+ if (pre_4_1) {
/* < 4.1.x format record */
ut_a(trx_doublewrite_must_reset_space_ids);
@@ -1390,54 +1865,46 @@ ibuf_rec_get_volume(
comp = 0;
} else {
/* >= 4.1.x format record */
+ ibuf_op_t op;
+ ulint info_len;
ut_a(trx_sys_multiple_tablespace_format);
ut_a(*data == 0);
types = rec_get_nth_field_old(ibuf_rec, 3, &len);
- comp = len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE;
+ ibuf_rec_get_info(mtr, ibuf_rec, &op, &comp, &info_len, NULL);
+
+ if (op == IBUF_OP_DELETE_MARK || op == IBUF_OP_DELETE) {
+ /* Delete-marking a record doesn't take any
+ additional space, and while deleting a record
+ actually frees up space, we have to play it safe and
+ pretend it takes no additional space (the record
+ might not exist, etc.). */
- ut_a(comp <= 1);
- if (comp) {
- /* compact record format */
+ return(0);
+ } else if (comp) {
+ dtuple_t* entry;
ulint volume;
dict_index_t* dummy_index;
mem_heap_t* heap = mem_heap_create(500);
- dtuple_t* entry = ibuf_build_entry_from_ibuf_rec(
- ibuf_rec, heap, &dummy_index);
+
+ entry = ibuf_build_entry_from_ibuf_rec(
+ mtr, ibuf_rec, heap, &dummy_index);
+
volume = rec_get_converted_size(dummy_index, entry, 0);
+
ibuf_dummy_index_free(dummy_index);
mem_heap_free(heap);
+
return(volume + page_dir_calc_reserved_space(1));
}
+ types += info_len;
n_fields = rec_get_n_fields_old(ibuf_rec) - 4;
-
- new_format = TRUE;
}
- for (i = 0; i < n_fields; i++) {
- if (new_format) {
- data = rec_get_nth_field_old(ibuf_rec, i + 4, &len);
-
- dtype_new_read_for_order_and_null_size(
- &dtype, types + i
- * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
- } else {
- data = rec_get_nth_field_old(ibuf_rec, i + 2, &len);
-
- dtype_read_for_order_and_null_size(
- &dtype, types + i
- * DATA_ORDER_NULL_TYPE_BUF_SIZE);
- }
-
- if (len == UNIV_SQL_NULL) {
- data_size += dtype_get_sql_null_size(&dtype, comp);
- } else {
- data_size += len;
- }
- }
+ data_size = ibuf_rec_get_size(ibuf_rec, types, n_fields, pre_4_1, comp);
return(data_size + rec_get_converted_extra_size(data_size, n_fields, 0)
+ page_dir_calc_reserved_space(1));
@@ -1455,11 +1922,14 @@ static
dtuple_t*
ibuf_entry_build(
/*=============*/
+ ibuf_op_t op, /*!< in: operation type */
dict_index_t* index, /*!< in: non-clustered index */
const dtuple_t* entry, /*!< in: entry for a non-clustered index */
ulint space, /*!< in: space id */
ulint page_no,/*!< in: index page number where entry should
be inserted */
+ ulint counter,/*!< in: counter value;
+ ULINT_UNDEFINED=not used */
mem_heap_t* heap) /*!< in: heap into which to build */
{
dtuple_t* tuple;
@@ -1467,28 +1937,28 @@ ibuf_entry_build(
const dfield_t* entry_field;
ulint n_fields;
byte* buf;
- byte* buf2;
+ byte* ti;
+ byte* type_info;
ulint i;
- /* Starting from 4.1.x, we have to build a tuple whose
- (1) first field is the space id,
- (2) the second field a single marker byte (0) to tell that this
- is a new format record,
- (3) the third contains the page number, and
- (4) the fourth contains the relevent type information of each data
- field; the length of this field % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE is
- (a) 0 for b-trees in the old format, and
- (b) 1 for b-trees in the compact format, the first byte of the field
- being the marker (0);
- (5) and the rest of the fields are copied from entry. All fields
- in the tuple are ordered like the type binary in our insert buffer
- tree. */
+ ut_ad(counter != ULINT_UNDEFINED || op == IBUF_OP_INSERT);
+ ut_ad(counter == ULINT_UNDEFINED || counter <= 0xFFFF);
+ ut_ad(op < IBUF_OP_COUNT);
+
+ /* We have to build a tuple with the following fields:
+
+ 1-4) These are described at the top of this file.
+
+ 5) The rest of the fields are copied from the entry.
+
+ All fields in the tuple are ordered like the type binary in our
+ insert buffer tree. */
n_fields = dtuple_get_n_fields(entry);
tuple = dtuple_create(heap, n_fields + 4);
- /* Store the space id in tuple */
+ /* 1) Space Id */
field = dtuple_get_nth_field(tuple, 0);
@@ -1498,7 +1968,7 @@ ibuf_entry_build(
dfield_set_data(field, buf, 4);
- /* Store the marker byte field in tuple */
+ /* 2) Marker byte */
field = dtuple_get_nth_field(tuple, 1);
@@ -1510,7 +1980,7 @@ ibuf_entry_build(
dfield_set_data(field, buf, 1);
- /* Store the page number in tuple */
+ /* 3) Page number */
field = dtuple_get_nth_field(tuple, 2);
@@ -1520,14 +1990,42 @@ ibuf_entry_build(
dfield_set_data(field, buf, 4);
- /* Store the type info in buf2, and add the fields from entry to
- tuple */
- buf2 = mem_heap_alloc(heap, n_fields
- * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
- + dict_table_is_comp(index->table));
- if (dict_table_is_comp(index->table)) {
- *buf2++ = 0; /* write the compact format indicator */
+ /* 4) Type info, part #1 */
+
+ if (counter == ULINT_UNDEFINED) {
+ i = dict_table_is_comp(index->table) ? 1 : 0;
+ } else {
+ ut_ad(counter <= 0xFFFF);
+ i = IBUF_REC_INFO_SIZE;
+ }
+
+ ti = type_info = mem_heap_alloc(heap, i + n_fields
+ * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
+
+ switch (i) {
+ default:
+ ut_error;
+ break;
+ case 1:
+ /* set the flag for ROW_FORMAT=COMPACT */
+ *ti++ = 0;
+ /* fall through */
+ case 0:
+ /* the old format does not allow delete buffering */
+ ut_ad(op == IBUF_OP_INSERT);
+ break;
+ case IBUF_REC_INFO_SIZE:
+ mach_write_to_2(ti + IBUF_REC_OFFSET_COUNTER, counter);
+
+ ti[IBUF_REC_OFFSET_TYPE] = (byte) op;
+ ti[IBUF_REC_OFFSET_FLAGS] = dict_table_is_comp(index->table)
+ ? IBUF_REC_COMPACT : 0;
+ ti += IBUF_REC_INFO_SIZE;
+ break;
}
+
+ /* 5+) Fields from the entry */
+
for (i = 0; i < n_fields; i++) {
ulint fixed_len;
const dict_field_t* ifield;
@@ -1562,21 +2060,16 @@ ibuf_entry_build(
#endif /* UNIV_DEBUG */
dtype_new_store_for_order_and_null_size(
- buf2 + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
- dfield_get_type(entry_field), fixed_len);
+ ti, dfield_get_type(entry_field), fixed_len);
+ ti += DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE;
}
- /* Store the type info in buf2 to field 3 of tuple */
+ /* 4) Type info, part #2 */
field = dtuple_get_nth_field(tuple, 3);
- if (dict_table_is_comp(index->table)) {
- buf2--;
- }
+ dfield_set_data(field, type_info, ti - type_info);
- dfield_set_data(field, buf2, n_fields
- * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
- + dict_table_is_comp(index->table));
/* Set all the types in the new tuple binary */
dtuple_set_types_binary(tuple, n_fields + 4);
@@ -1713,9 +2206,9 @@ ibuf_data_too_much_free(void)
/*********************************************************************//**
Allocates a new page from the ibuf file segment and adds it to the free
list.
-@return DB_SUCCESS, or DB_STRONG_FAIL if no space left */
+@return TRUE on success, FALSE if no space left */
static
-ulint
+ibool
ibuf_add_free_page(void)
/*====================*/
{
@@ -1751,25 +2244,19 @@ ibuf_add_free_page(void)
header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER, 0, FSP_UP,
&mtr);
- if (page_no == FIL_NULL) {
+ if (UNIV_UNLIKELY(page_no == FIL_NULL)) {
mtr_commit(&mtr);
- return(DB_STRONG_FAIL);
- }
-
- {
- buf_block_t* block;
-
- block = buf_page_get(
+ return(FALSE);
+ } else {
+ buf_block_t* block = buf_page_get(
IBUF_SPACE_ID, 0, page_no, RW_X_LATCH, &mtr);
-
buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW);
-
page = buf_block_get_frame(block);
}
- ibuf_enter();
+ ibuf_enter(&mtr);
mutex_enter(&ibuf_mutex);
@@ -1792,16 +2279,14 @@ ibuf_add_free_page(void)
bitmap_page = ibuf_bitmap_get_map_page(
IBUF_SPACE_ID, page_no, zip_size, &mtr);
+ mutex_exit(&ibuf_mutex);
+
ibuf_bitmap_page_set_bits(
bitmap_page, page_no, zip_size, IBUF_BITMAP_IBUF, TRUE, &mtr);
- mtr_commit(&mtr);
-
- mutex_exit(&ibuf_mutex);
-
- ibuf_exit();
+ ibuf_mtr_commit(&mtr);
- return(DB_SUCCESS);
+ return(TRUE);
}
/*********************************************************************//**
@@ -1831,29 +2316,26 @@ ibuf_remove_free_page(void)
header_page = ibuf_header_page_get(&mtr);
/* Prevent pessimistic inserts to insert buffer trees for a while */
+ ibuf_enter(&mtr);
mutex_enter(&ibuf_pessimistic_insert_mutex);
-
- ibuf_enter();
-
mutex_enter(&ibuf_mutex);
if (!ibuf_data_too_much_free()) {
mutex_exit(&ibuf_mutex);
-
- ibuf_exit();
-
mutex_exit(&ibuf_pessimistic_insert_mutex);
- mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
return;
}
- mtr_start(&mtr2);
+ ibuf_mtr_start(&mtr2);
root = ibuf_tree_root_get(&mtr2);
+ mutex_exit(&ibuf_mutex);
+
page_no = flst_get_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
&mtr2).page;
@@ -1861,10 +2343,8 @@ ibuf_remove_free_page(void)
because in fseg_free_page we access level 1 pages, and the root
is a level 2 page. */
- mtr_commit(&mtr2);
- mutex_exit(&ibuf_mutex);
-
- ibuf_exit();
+ ibuf_mtr_commit(&mtr2);
+ ibuf_exit(&mtr);
/* Since pessimistic inserts were prevented, we know that the
page is still in the free list. NOTE that also deletes may take
@@ -1875,11 +2355,11 @@ ibuf_remove_free_page(void)
fseg_free_page(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
IBUF_SPACE_ID, page_no, &mtr);
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
buf_page_reset_file_page_was_freed(IBUF_SPACE_ID, page_no);
-#endif
+#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
- ibuf_enter();
+ ibuf_enter(&mtr);
mutex_enter(&ibuf_mutex);
@@ -1905,28 +2385,26 @@ ibuf_remove_free_page(void)
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
+ mutex_exit(&ibuf_pessimistic_insert_mutex);
+
ibuf->seg_size--;
ibuf->free_list_len--;
- mutex_exit(&ibuf_pessimistic_insert_mutex);
-
/* Set the bit indicating that this page is no more an ibuf tree page
(level 2 page) */
bitmap_page = ibuf_bitmap_get_map_page(
IBUF_SPACE_ID, page_no, zip_size, &mtr);
+ mutex_exit(&ibuf_mutex);
+
ibuf_bitmap_page_set_bits(
bitmap_page, page_no, zip_size, IBUF_BITMAP_IBUF, FALSE, &mtr);
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
buf_page_set_file_page_was_freed(IBUF_SPACE_ID, page_no);
-#endif
- mtr_commit(&mtr);
-
- mutex_exit(&ibuf_mutex);
-
- ibuf_exit();
+#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
+ ibuf_mtr_commit(&mtr);
}
/***********************************************************************//**
@@ -1948,8 +2426,6 @@ ibuf_free_excess_pages(void)
ut_ad(rw_lock_get_x_lock_count(
fil_space_get_latch(IBUF_SPACE_ID, NULL)) == 1);
- ut_ad(!ibuf_inside());
-
/* NOTE: We require that the thread did not own the latch before,
because then we know that we can obey the correct latching order
for ibuf latches */
@@ -1966,35 +2442,44 @@ ibuf_free_excess_pages(void)
for (i = 0; i < 4; i++) {
- mutex_enter(&ibuf_mutex);
-
- if (!ibuf_data_too_much_free()) {
+ ibool too_much_free;
- mutex_exit(&ibuf_mutex);
+ mutex_enter(&ibuf_mutex);
+ too_much_free = ibuf_data_too_much_free();
+ mutex_exit(&ibuf_mutex);
+ if (!too_much_free) {
return;
}
- mutex_exit(&ibuf_mutex);
-
ibuf_remove_free_page();
}
}
+#ifdef UNIV_DEBUG
+# define ibuf_get_merge_page_nos(contract,rec,mtr,ids,vers,pages,n_stored) \
+ ibuf_get_merge_page_nos_func(contract,rec,mtr,ids,vers,pages,n_stored)
+#else /* UNIV_DEBUG */
+# define ibuf_get_merge_page_nos(contract,rec,mtr,ids,vers,pages,n_stored) \
+ ibuf_get_merge_page_nos_func(contract,rec,ids,vers,pages,n_stored)
+#endif /* UNIV_DEBUG */
+
/*********************************************************************//**
Reads page numbers from a leaf in an ibuf tree.
@return a lower limit for the combined volume of records which will be
merged */
static
ulint
-ibuf_get_merge_page_nos(
-/*====================*/
+ibuf_get_merge_page_nos_func(
+/*=========================*/
ibool contract,/*!< in: TRUE if this function is called to
contract the tree, FALSE if this is called
when a single page becomes full and we look
if it pays to read also nearby pages */
- rec_t* rec, /*!< in: record from which we read up and down
- in the chain of records */
+ const rec_t* rec, /*!< in: insert buffer record */
+#ifdef UNIV_DEBUG
+ mtr_t* mtr, /*!< in: mini-transaction holding rec */
+#endif /* UNIV_DEBUG */
ulint* space_ids,/*!< in/out: space id's of the pages */
ib_int64_t* space_versions,/*!< in/out: tablespace version
timestamps; used to prevent reading in old
@@ -2017,18 +2502,22 @@ ibuf_get_merge_page_nos(
ulint limit;
ulint n_pages;
+ ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
+ || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(ibuf_inside(mtr));
+
*n_stored = 0;
- limit = ut_min(IBUF_MAX_N_PAGES_MERGED, buf_pool->curr_size / 4);
+ limit = ut_min(IBUF_MAX_N_PAGES_MERGED, buf_pool_get_curr_size() / 4);
if (page_rec_is_supremum(rec)) {
- rec = page_rec_get_prev(rec);
+ rec = page_rec_get_prev_const(rec);
}
if (page_rec_is_infimum(rec)) {
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
}
if (page_rec_is_supremum(rec)) {
@@ -2036,8 +2525,8 @@ ibuf_get_merge_page_nos(
return(0);
}
- first_page_no = ibuf_rec_get_page_no(rec);
- first_space_id = ibuf_rec_get_space(rec);
+ first_page_no = ibuf_rec_get_page_no(mtr, rec);
+ first_space_id = ibuf_rec_get_space(mtr, rec);
n_pages = 0;
prev_page_no = 0;
prev_space_id = 0;
@@ -2048,8 +2537,8 @@ ibuf_get_merge_page_nos(
while (!page_rec_is_infimum(rec) && UNIV_LIKELY(n_pages < limit)) {
- rec_page_no = ibuf_rec_get_page_no(rec);
- rec_space_id = ibuf_rec_get_space(rec);
+ rec_page_no = ibuf_rec_get_page_no(mtr, rec);
+ rec_space_id = ibuf_rec_get_space(mtr, rec);
if (rec_space_id != first_space_id
|| (rec_page_no / IBUF_MERGE_AREA)
@@ -2066,10 +2555,10 @@ ibuf_get_merge_page_nos(
prev_page_no = rec_page_no;
prev_space_id = rec_space_id;
- rec = page_rec_get_prev(rec);
+ rec = page_rec_get_prev_const(rec);
}
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
/* At the loop start there is no prev page; we mark this with a pair
of space id, page no (0, 0) for which there can never be entries in
@@ -2087,8 +2576,8 @@ ibuf_get_merge_page_nos(
rec_page_no = 1;
rec_space_id = 0;
} else {
- rec_page_no = ibuf_rec_get_page_no(rec);
- rec_space_id = ibuf_rec_get_space(rec);
+ rec_page_no = ibuf_rec_get_page_no(mtr, rec);
+ rec_space_id = ibuf_rec_get_space(mtr, rec);
ut_ad(rec_page_no > IBUF_TREE_ROOT_PAGE_NO);
}
@@ -2099,9 +2588,9 @@ ibuf_get_merge_page_nos(
|| rec_page_no != prev_page_no)
&& (prev_space_id != 0 || prev_page_no != 0)) {
- if ((prev_page_no == first_page_no
- && prev_space_id == first_space_id)
- || contract
+ if (contract
+ || (prev_page_no == first_page_no
+ && prev_space_id == first_space_id)
|| (volume_for_page
> ((IBUF_MERGE_THRESHOLD - 1)
* 4 * UNIV_PAGE_SIZE
@@ -2134,14 +2623,14 @@ ibuf_get_merge_page_nos(
break;
}
- rec_volume = ibuf_rec_get_volume(rec);
+ rec_volume = ibuf_rec_get_volume(mtr, rec);
volume_for_page += rec_volume;
prev_page_no = rec_page_no;
prev_space_id = rec_space_id;
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
}
#ifdef UNIV_IBUF_DEBUG
@@ -2172,65 +2661,59 @@ ibuf_contract_ext(
ulint page_nos[IBUF_MAX_N_PAGES_MERGED];
ulint space_ids[IBUF_MAX_N_PAGES_MERGED];
ib_int64_t space_versions[IBUF_MAX_N_PAGES_MERGED];
- ulint n_stored;
ulint sum_sizes;
mtr_t mtr;
*n_pages = 0;
- ut_ad(!ibuf_inside());
-
- mutex_enter(&ibuf_mutex);
- if (ibuf->empty) {
-ibuf_is_empty:
- mutex_exit(&ibuf_mutex);
+ /* We perform a dirty read of ibuf->empty, without latching
+ the insert buffer root page. We trust this dirty read except
+ when a slow shutdown is being executed. During a slow
+ shutdown, the insert buffer merge must be completed. */
+ if (UNIV_UNLIKELY(ibuf->empty)
+ && UNIV_LIKELY(!srv_shutdown_state)) {
return(0);
}
- mtr_start(&mtr);
-
- ibuf_enter();
+ ibuf_mtr_start(&mtr);
/* Open a cursor to a randomly chosen leaf of the tree, at a random
position within the leaf */
btr_pcur_open_at_rnd_pos(ibuf->index, BTR_SEARCH_LEAF, &pcur, &mtr);
- if (page_get_n_recs(btr_pcur_get_page(&pcur)) == 0) {
- /* When the ibuf tree is emptied completely, the last record
- is removed using an optimistic delete and ibuf_size_update
- is not called, causing ibuf->empty to remain FALSE. If we do
- not reset it to TRUE here then database shutdown will hang
- in the loop in ibuf_contract_for_n_pages. */
+ ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf->index));
- ibuf->empty = TRUE;
-
- ibuf_exit();
-
- mtr_commit(&mtr);
+ if (page_get_n_recs(btr_pcur_get_page(&pcur)) == 0) {
+ /* If a B-tree page is empty, it must be the root page
+ and the whole B-tree must be empty. InnoDB does not
+ allow empty B-tree pages other than the root. */
+ ut_ad(ibuf->empty);
+ ut_ad(page_get_space_id(btr_pcur_get_page(&pcur))
+ == IBUF_SPACE_ID);
+ ut_ad(page_get_page_no(btr_pcur_get_page(&pcur))
+ == FSP_IBUF_TREE_ROOT_PAGE_NO);
+
+ ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
- goto ibuf_is_empty;
+ return(0);
}
- mutex_exit(&ibuf_mutex);
-
- sum_sizes = ibuf_get_merge_page_nos(TRUE, btr_pcur_get_rec(&pcur),
+ sum_sizes = ibuf_get_merge_page_nos(TRUE,
+ btr_pcur_get_rec(&pcur), &mtr,
space_ids, space_versions,
- page_nos, &n_stored);
+ page_nos, n_pages);
#if 0 /* defined UNIV_IBUF_DEBUG */
fprintf(stderr, "Ibuf contract sync %lu pages %lu volume %lu\n",
- sync, n_stored, sum_sizes);
+ sync, *n_pages, sum_sizes);
#endif
- ibuf_exit();
-
- mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
buf_read_ibuf_merge_pages(sync, space_ids, space_versions, page_nos,
- n_stored);
- *n_pages = n_stored;
+ *n_pages);
return(sum_sizes + 1);
}
@@ -2300,34 +2783,201 @@ ibuf_contract_after_insert(
ibool sync;
ulint sum_sizes;
ulint size;
-
- mutex_enter(&ibuf_mutex);
+ ulint max_size;
+
+ /* Perform dirty reads of ibuf->size and ibuf->max_size, to
+ reduce ibuf_mutex contention. ibuf->max_size remains constant
+ after ibuf_init_at_db_start(), but ibuf->size should be
+ protected by ibuf_mutex. Given that ibuf->size fits in a
+ machine word, this should be OK; at worst we are doing some
+ excessive ibuf_contract() or occasionally skipping a
+ ibuf_contract(). */
+ size = ibuf->size;
+ max_size = ibuf->max_size;
if (!srv_ibuf_active_contract) {
- if (ibuf->size < ibuf->max_size + IBUF_CONTRACT_ON_INSERT_NON_SYNC) {
- mutex_exit(&ibuf_mutex);
-
+ if (size < max_size + IBUF_CONTRACT_ON_INSERT_NON_SYNC) {
return;
}
}
- sync = FALSE;
-
- if (ibuf->size >= ibuf->max_size + IBUF_CONTRACT_ON_INSERT_SYNC) {
-
- sync = TRUE;
- }
-
- mutex_exit(&ibuf_mutex);
+ sync = (size >= max_size + IBUF_CONTRACT_ON_INSERT_SYNC);
/* Contract at least entry_size many bytes */
sum_sizes = 0;
size = 1;
- while ((size > 0) && (sum_sizes < entry_size)) {
+ do {
size = ibuf_contract(sync);
sum_sizes += size;
+ } while (size > 0 && sum_sizes < entry_size);
+}
+
+/*********************************************************************//**
+Determine if an insert buffer record has been encountered already.
+@return TRUE if a new record, FALSE if possible duplicate */
+static
+ibool
+ibuf_get_volume_buffered_hash(
+/*==========================*/
+ const rec_t* rec, /*!< in: ibuf record in post-4.1 format */
+ const byte* types, /*!< in: fields */
+ const byte* data, /*!< in: start of user record data */
+ ulint comp, /*!< in: 0=ROW_FORMAT=REDUNDANT,
+ nonzero=ROW_FORMAT=COMPACT */
+ ulint* hash, /*!< in/out: hash array */
+ ulint size) /*!< in: number of elements in hash array */
+{
+ ulint len;
+ ulint fold;
+ ulint bitmask;
+
+ len = ibuf_rec_get_size(rec, types, rec_get_n_fields_old(rec) - 4,
+ FALSE, comp);
+ fold = ut_fold_binary(data, len);
+
+ hash += (fold / (CHAR_BIT * sizeof *hash)) % size;
+ bitmask = 1 << (fold % (CHAR_BIT * sizeof *hash));
+
+ if (*hash & bitmask) {
+
+ return(FALSE);
+ }
+
+ /* We have not seen this record yet. Insert it. */
+ *hash |= bitmask;
+
+ return(TRUE);
+}
+
+#ifdef UNIV_DEBUG
+# define ibuf_get_volume_buffered_count(mtr,rec,hash,size,n_recs) \
+ ibuf_get_volume_buffered_count_func(mtr,rec,hash,size,n_recs)
+#else /* UNIV_DEBUG */
+# define ibuf_get_volume_buffered_count(mtr,rec,hash,size,n_recs) \
+ ibuf_get_volume_buffered_count_func(rec,hash,size,n_recs)
+#endif
+/*********************************************************************//**
+Update the estimate of the number of records on a page, and
+get the space taken by merging the buffered record to the index page.
+@return size of index record in bytes + an upper limit of the space
+taken in the page directory */
+static
+ulint
+ibuf_get_volume_buffered_count_func(
+/*================================*/
+#ifdef UNIV_DEBUG
+ mtr_t* mtr, /*!< in: mini-transaction owning rec */
+#endif /* UNIV_DEBUG */
+ const rec_t* rec, /*!< in: insert buffer record */
+ ulint* hash, /*!< in/out: hash array */
+ ulint size, /*!< in: number of elements in hash array */
+ lint* n_recs) /*!< in/out: estimated number of records
+ on the page that rec points to */
+{
+ ulint len;
+ ibuf_op_t ibuf_op;
+ const byte* types;
+ ulint n_fields;
+
+ ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
+ || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(ibuf_inside(mtr));
+
+ n_fields = rec_get_n_fields_old(rec);
+ ut_ad(n_fields > 4);
+ n_fields -= 4;
+
+ rec_get_nth_field_offs_old(rec, 1, &len);
+ /* This function is only invoked when buffering new
+ operations. All pre-4.1 records should have been merged
+ when the database was started up. */
+ ut_a(len == 1);
+ ut_ad(trx_sys_multiple_tablespace_format);
+
+ types = rec_get_nth_field_old(rec, 3, &len);
+
+ switch (UNIV_EXPECT(len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
+ IBUF_REC_INFO_SIZE)) {
+ default:
+ ut_error;
+ case 0:
+ /* This ROW_TYPE=REDUNDANT record does not include an
+ operation counter. Exclude it from the *n_recs,
+ because deletes cannot be buffered if there are
+ old-style inserts buffered for the page. */
+
+ len = ibuf_rec_get_size(rec, types, n_fields, FALSE, 0);
+
+ return(len
+ + rec_get_converted_extra_size(len, n_fields, 0)
+ + page_dir_calc_reserved_space(1));
+ case 1:
+ /* This ROW_TYPE=COMPACT record does not include an
+ operation counter. Exclude it from the *n_recs,
+ because deletes cannot be buffered if there are
+ old-style inserts buffered for the page. */
+ goto get_volume_comp;
+
+ case IBUF_REC_INFO_SIZE:
+ ibuf_op = (ibuf_op_t) types[IBUF_REC_OFFSET_TYPE];
+ break;
+ }
+
+ switch (ibuf_op) {
+ case IBUF_OP_INSERT:
+ /* Inserts can be done by updating a delete-marked record.
+ Because delete-mark and insert operations can be pointing to
+ the same records, we must not count duplicates. */
+ case IBUF_OP_DELETE_MARK:
+ /* There must be a record to delete-mark.
+ See if this record has been already buffered. */
+ if (n_recs && ibuf_get_volume_buffered_hash(
+ rec, types + IBUF_REC_INFO_SIZE,
+ types + len,
+ types[IBUF_REC_OFFSET_FLAGS] & IBUF_REC_COMPACT,
+ hash, size)) {
+ (*n_recs)++;
+ }
+
+ if (ibuf_op == IBUF_OP_DELETE_MARK) {
+ /* Setting the delete-mark flag does not
+ affect the available space on the page. */
+ return(0);
+ }
+ break;
+ case IBUF_OP_DELETE:
+ /* A record will be removed from the page. */
+ if (n_recs) {
+ (*n_recs)--;
+ }
+ /* While deleting a record actually frees up space,
+ we have to play it safe and pretend that it takes no
+ additional space (the record might not exist, etc.). */
+ return(0);
+ default:
+ ut_error;
+ }
+
+ ut_ad(ibuf_op == IBUF_OP_INSERT);
+
+get_volume_comp:
+ {
+ dtuple_t* entry;
+ ulint volume;
+ dict_index_t* dummy_index;
+ mem_heap_t* heap = mem_heap_create(500);
+
+ entry = ibuf_build_entry_from_ibuf_rec(
+ mtr, rec, heap, &dummy_index);
+
+ volume = rec_get_converted_size(dummy_index, entry, 0);
+
+ ibuf_dummy_index_free(dummy_index);
+ mem_heap_free(heap);
+
+ return(volume + page_dir_calc_reserved_space(1));
}
}
@@ -2341,55 +2991,63 @@ static
ulint
ibuf_get_volume_buffered(
/*=====================*/
- btr_pcur_t* pcur, /*!< in: pcur positioned at a place in an
+ const btr_pcur_t*pcur, /*!< in: pcur positioned at a place in an
insert buffer tree where we would insert an
entry for the index page whose number is
page_no, latch mode has to be BTR_MODIFY_PREV
or BTR_MODIFY_TREE */
ulint space, /*!< in: space id */
ulint page_no,/*!< in: page number of an index page */
- mtr_t* mtr) /*!< in: mtr */
+ lint* n_recs, /*!< in/out: minimum number of records on the
+ page after the buffered changes have been
+ applied, or NULL to disable the counting */
+ mtr_t* mtr) /*!< in: mini-transaction of pcur */
{
- ulint volume;
- rec_t* rec;
- page_t* page;
- ulint prev_page_no;
- page_t* prev_page;
- ulint next_page_no;
- page_t* next_page;
+ ulint volume;
+ const rec_t* rec;
+ const page_t* page;
+ ulint prev_page_no;
+ const page_t* prev_page;
+ ulint next_page_no;
+ const page_t* next_page;
+ /* bitmap of buffered recs */
+ ulint hash_bitmap[128 / sizeof(ulint)];
ut_a(trx_sys_multiple_tablespace_format);
ut_ad((pcur->latch_mode == BTR_MODIFY_PREV)
|| (pcur->latch_mode == BTR_MODIFY_TREE));
- /* Count the volume of records earlier in the alphabetical order than
+ /* Count the volume of inserts earlier in the alphabetical order than
pcur */
volume = 0;
+ if (n_recs) {
+ memset(hash_bitmap, 0, sizeof hash_bitmap);
+ }
+
rec = btr_pcur_get_rec(pcur);
page = page_align(rec);
+ ut_ad(page_validate(page, ibuf->index));
if (page_rec_is_supremum(rec)) {
- rec = page_rec_get_prev(rec);
+ rec = page_rec_get_prev_const(rec);
}
- for (;;) {
- if (page_rec_is_infimum(rec)) {
+ for (; !page_rec_is_infimum(rec);
+ rec = page_rec_get_prev_const(rec)) {
+ ut_ad(page_align(rec) == page);
- break;
- }
-
- if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ if (page_no != ibuf_rec_get_page_no(mtr, rec)
+ || space != ibuf_rec_get_space(mtr, rec)) {
goto count_later;
}
- volume += ibuf_rec_get_volume(rec);
-
- rec = page_rec_get_prev(rec);
+ volume += ibuf_get_volume_buffered_count(
+ mtr, rec,
+ hash_bitmap, UT_ARR_SIZE(hash_bitmap), n_recs);
}
/* Look at the previous page */
@@ -2405,23 +3063,26 @@ ibuf_get_volume_buffered(
buf_block_t* block;
block = buf_page_get(
- IBUF_SPACE_ID, 0, prev_page_no, RW_X_LATCH, mtr);
+ IBUF_SPACE_ID, 0, prev_page_no, RW_X_LATCH,
+ mtr);
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
prev_page = buf_block_get_frame(block);
+ ut_ad(page_validate(prev_page, ibuf->index));
}
#ifdef UNIV_BTR_DEBUG
- ut_a(btr_page_get_next(prev_page, mtr)
- == page_get_page_no(page));
+ ut_a(btr_page_get_next(prev_page, mtr) == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
rec = page_get_supremum_rec(prev_page);
- rec = page_rec_get_prev(rec);
+ rec = page_rec_get_prev_const(rec);
+
+ for (;; rec = page_rec_get_prev_const(rec)) {
+ ut_ad(page_align(rec) == prev_page);
- for (;;) {
if (page_rec_is_infimum(rec)) {
/* We cannot go to yet a previous page, because we
@@ -2431,39 +3092,35 @@ ibuf_get_volume_buffered(
return(UNIV_PAGE_SIZE);
}
- if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ if (page_no != ibuf_rec_get_page_no(mtr, rec)
+ || space != ibuf_rec_get_space(mtr, rec)) {
goto count_later;
}
- volume += ibuf_rec_get_volume(rec);
-
- rec = page_rec_get_prev(rec);
+ volume += ibuf_get_volume_buffered_count(
+ mtr, rec,
+ hash_bitmap, UT_ARR_SIZE(hash_bitmap), n_recs);
}
count_later:
rec = btr_pcur_get_rec(pcur);
if (!page_rec_is_supremum(rec)) {
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
}
- for (;;) {
- if (page_rec_is_supremum(rec)) {
-
- break;
- }
-
- if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ for (; !page_rec_is_supremum(rec);
+ rec = page_rec_get_next_const(rec)) {
+ if (page_no != ibuf_rec_get_page_no(mtr, rec)
+ || space != ibuf_rec_get_space(mtr, rec)) {
return(volume);
}
- volume += ibuf_rec_get_volume(rec);
-
- rec = page_rec_get_next(rec);
+ volume += ibuf_get_volume_buffered_count(
+ mtr, rec,
+ hash_bitmap, UT_ARR_SIZE(hash_bitmap), n_recs);
}
/* Look at the next page */
@@ -2479,12 +3136,14 @@ count_later:
buf_block_t* block;
block = buf_page_get(
- IBUF_SPACE_ID, 0, next_page_no, RW_X_LATCH, mtr);
+ IBUF_SPACE_ID, 0, next_page_no, RW_X_LATCH,
+ mtr);
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
next_page = buf_block_get_frame(block);
+ ut_ad(page_validate(next_page, ibuf->index));
}
#ifdef UNIV_BTR_DEBUG
@@ -2492,9 +3151,11 @@ count_later:
#endif /* UNIV_BTR_DEBUG */
rec = page_get_infimum_rec(next_page);
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
+
+ for (;; rec = page_rec_get_next_const(rec)) {
+ ut_ad(page_align(rec) == next_page);
- for (;;) {
if (page_rec_is_supremum(rec)) {
/* We give up */
@@ -2502,15 +3163,15 @@ count_later:
return(UNIV_PAGE_SIZE);
}
- if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ if (page_no != ibuf_rec_get_page_no(mtr, rec)
+ || space != ibuf_rec_get_space(mtr, rec)) {
return(volume);
}
- volume += ibuf_rec_get_volume(rec);
-
- rec = page_rec_get_next(rec);
+ volume += ibuf_get_volume_buffered_count(
+ mtr, rec,
+ hash_bitmap, UT_ARR_SIZE(hash_bitmap), n_recs);
}
}
@@ -2531,13 +3192,13 @@ ibuf_update_max_tablespace_id(void)
ut_a(!dict_table_is_comp(ibuf->index->table));
- ibuf_enter();
-
- mtr_start(&mtr);
+ ibuf_mtr_start(&mtr);
btr_pcur_open_at_index_side(
FALSE, ibuf->index, BTR_SEARCH_LEAF, &pcur, TRUE, &mtr);
+ ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf->index));
+
btr_pcur_move_to_prev(&pcur, &mtr);
if (btr_pcur_is_before_first_on_page(&pcur)) {
@@ -2554,23 +3215,248 @@ ibuf_update_max_tablespace_id(void)
max_space_id = mach_read_from_4(field);
}
- mtr_commit(&mtr);
- ibuf_exit();
+ ibuf_mtr_commit(&mtr);
/* printf("Maximum space id in insert buffer %lu\n", max_space_id); */
fil_set_max_space_id_if_bigger(max_space_id);
}
+#ifdef UNIV_DEBUG
+# define ibuf_get_entry_counter_low(mtr,rec,space,page_no) \
+ ibuf_get_entry_counter_low_func(mtr,rec,space,page_no)
+#else /* UNIV_DEBUG */
+# define ibuf_get_entry_counter_low(mtr,rec,space,page_no) \
+ ibuf_get_entry_counter_low_func(rec,space,page_no)
+#endif
+/****************************************************************//**
+Helper function for ibuf_set_entry_counter. Checks if rec is for (space,
+page_no), and if so, reads counter value from it and returns that + 1.
+Otherwise, returns 0.
+@return new counter value, or 0 */
+static
+ulint
+ibuf_get_entry_counter_low_func(
+/*============================*/
+#ifdef UNIV_DEBUG
+ mtr_t* mtr, /*!< in: mini-transaction of rec */
+#endif /* UNIV_DEBUG */
+ const rec_t* rec, /*!< in: insert buffer record */
+ ulint space, /*!< in: space id */
+ ulint page_no) /*!< in: page number */
+{
+ ulint counter;
+ const byte* field;
+ ulint len;
+
+ ut_ad(ibuf_inside(mtr));
+ ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
+ || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
+ ut_ad(rec_get_n_fields_old(rec) > 2);
+
+ field = rec_get_nth_field_old(rec, 1, &len);
+
+ if (UNIV_UNLIKELY(len != 1)) {
+ /* pre-4.1 format */
+ ut_a(trx_doublewrite_must_reset_space_ids);
+ ut_a(!trx_sys_multiple_tablespace_format);
+
+ return(ULINT_UNDEFINED);
+ }
+
+ ut_a(trx_sys_multiple_tablespace_format);
+
+ /* Check the tablespace identifier. */
+ field = rec_get_nth_field_old(rec, 0, &len);
+ ut_a(len == 4);
+
+ if (mach_read_from_4(field) != space) {
+
+ return(0);
+ }
+
+ /* Check the page offset. */
+ field = rec_get_nth_field_old(rec, 2, &len);
+ ut_a(len == 4);
+
+ if (mach_read_from_4(field) != page_no) {
+
+ return(0);
+ }
+
+ /* Check if the record contains a counter field. */
+ field = rec_get_nth_field_old(rec, 3, &len);
+
+ switch (len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE) {
+ default:
+ ut_error;
+ case 0: /* ROW_FORMAT=REDUNDANT */
+ case 1: /* ROW_FORMAT=COMPACT */
+ return(ULINT_UNDEFINED);
+
+ case IBUF_REC_INFO_SIZE:
+ counter = mach_read_from_2(field + IBUF_REC_OFFSET_COUNTER);
+ ut_a(counter < 0xFFFF);
+ return(counter + 1);
+ }
+}
+
+/****************************************************************//**
+Set the counter field in entry to the correct value based on the current
+last record in ibuf for (space, page_no).
+@return FALSE if we should abort this insertion to ibuf */
+static
+ibool
+ibuf_set_entry_counter(
+/*===================*/
+ dtuple_t* entry, /*!< in/out: entry to patch */
+ ulint space, /*!< in: space id of entry */
+ ulint page_no, /*!< in: page number of entry */
+ btr_pcur_t* pcur, /*!< in: pcur positioned on the record
+ found by btr_pcur_open(.., entry,
+ PAGE_CUR_LE, ..., pcur, ...) */
+ ibool is_optimistic, /*!< in: is this an optimistic insert */
+ mtr_t* mtr) /*!< in: mtr */
+{
+ dfield_t* field;
+ byte* data;
+ ulint counter = 0;
+
+ /* pcur points to either a user rec or to a page's infimum record. */
+ ut_ad(ibuf_inside(mtr));
+ ut_ad(mtr_memo_contains(mtr, btr_pcur_get_block(pcur),
+ MTR_MEMO_PAGE_X_FIX));
+ ut_ad(page_validate(btr_pcur_get_page(pcur), ibuf->index));
+
+ if (btr_pcur_is_on_user_rec(pcur)) {
+
+ counter = ibuf_get_entry_counter_low(
+ mtr, btr_pcur_get_rec(pcur), space, page_no);
+
+ if (UNIV_UNLIKELY(counter == ULINT_UNDEFINED)) {
+ /* The record lacks a counter field.
+ Such old records must be merged before
+ new records can be buffered. */
+
+ return(FALSE);
+ }
+ } else if (btr_pcur_is_before_first_in_tree(pcur, mtr)) {
+ /* Ibuf tree is either completely empty, or the insert
+ position is at the very first record of a non-empty tree. In
+ either case we have no previous records for (space,
+ page_no). */
+
+ counter = 0;
+ } else if (btr_pcur_is_before_first_on_page(pcur)) {
+ btr_cur_t* cursor = btr_pcur_get_btr_cur(pcur);
+
+ if (cursor->low_match < 3) {
+ /* If low_match < 3, we know that the father node
+ pointer did not contain the searched for (space,
+ page_no), which means that the search ended on the
+ right page regardless of the counter value, and
+ since we're at the infimum record, there are no
+ existing records. */
+
+ counter = 0;
+ } else {
+ rec_t* rec;
+ const page_t* page;
+ buf_block_t* block;
+ page_t* prev_page;
+ ulint prev_page_no;
+
+ ut_a(cursor->ibuf_cnt != ULINT_UNDEFINED);
+
+ page = btr_pcur_get_page(pcur);
+ prev_page_no = btr_page_get_prev(page, mtr);
+
+ ut_a(prev_page_no != FIL_NULL);
+
+ block = buf_page_get(
+ IBUF_SPACE_ID, 0, prev_page_no,
+ RW_X_LATCH, mtr);
+
+ buf_block_dbg_add_level(block, SYNC_TREE_NODE);
+
+ prev_page = buf_block_get_frame(block);
+
+ rec = page_rec_get_prev(
+ page_get_supremum_rec(prev_page));
+
+ ut_ad(page_rec_is_user_rec(rec));
+
+ counter = ibuf_get_entry_counter_low(
+ mtr, rec, space, page_no);
+
+ if (UNIV_UNLIKELY(counter == ULINT_UNDEFINED)) {
+ /* The record lacks a counter field.
+ Such old records must be merged before
+ new records can be buffered. */
+
+ return(FALSE);
+ }
+
+ if (counter < cursor->ibuf_cnt) {
+ /* Search ended on the wrong page. */
+
+ if (is_optimistic) {
+ /* In an optimistic insert, we can
+ shift the insert position to the left
+ page, since it only needs an X-latch
+ on the page itself, which the
+ original search acquired for us. */
+
+ btr_cur_position(
+ ibuf->index, rec, block,
+ btr_pcur_get_btr_cur(pcur));
+ } else {
+ /* We can't shift the insert
+ position to the left page in a
+ pessimistic insert since it would
+ require an X-latch on the left
+ page's left page, so we have to
+ abort. */
+
+ return(FALSE);
+ }
+ } else {
+ /* The counter field in the father node is
+ the same as we would insert; we don't know
+ whether the insert should go to this page or
+ the left page (the later fields can differ),
+ so refuse the insert. */
+
+ return(FALSE);
+ }
+ }
+ } else {
+ /* The cursor is not positioned at or before a user record. */
+ return(FALSE);
+ }
+
+ /* Patch counter value in already built entry. */
+ field = dtuple_get_nth_field(entry, 3);
+ data = dfield_get_data(field);
+
+ mach_write_to_2(data + IBUF_REC_OFFSET_COUNTER, counter);
+
+ return(TRUE);
+}
+
/*********************************************************************//**
-Makes an index insert to the insert buffer, instead of directly to the disk
-page, if this is possible.
-@return DB_SUCCESS, DB_FAIL, DB_STRONG_FAIL */
+Buffer an operation in the insert/delete buffer, instead of doing it
+directly to the disk page, if this is possible.
+@return DB_SUCCESS, DB_STRONG_FAIL or other error */
static
ulint
ibuf_insert_low(
/*============*/
ulint mode, /*!< in: BTR_MODIFY_PREV or BTR_MODIFY_TREE */
+ ibuf_op_t op, /*!< in: operation type */
+ ibool no_counter,
+ /*!< in: TRUE=use 5.0.3 format;
+ FALSE=allow delete buffering */
const dtuple_t* entry, /*!< in: index entry to insert */
ulint entry_size,
/*!< in: rec_get_converted_size(index, entry) */
@@ -2587,9 +3473,11 @@ ibuf_insert_low(
dtuple_t* ibuf_entry;
mem_heap_t* heap;
ulint buffered;
+ lint min_n_recs;
rec_t* ins_rec;
ibool old_bit_value;
page_t* bitmap_page;
+ buf_block_t* block;
page_t* root;
ulint err;
ibool do_merge;
@@ -2597,25 +3485,30 @@ ibuf_insert_low(
ib_int64_t space_versions[IBUF_MAX_N_PAGES_MERGED];
ulint page_nos[IBUF_MAX_N_PAGES_MERGED];
ulint n_stored;
- ulint bits;
mtr_t mtr;
mtr_t bitmap_mtr;
ut_a(!dict_index_is_clust(index));
ut_ad(dtuple_check_typed(entry));
ut_ad(ut_is_2pow(zip_size));
+ ut_ad(!no_counter || op == IBUF_OP_INSERT);
+ ut_a(op < IBUF_OP_COUNT);
ut_a(trx_sys_multiple_tablespace_format);
do_merge = FALSE;
- mutex_enter(&ibuf_mutex);
-
+ /* Perform dirty reads of ibuf->size and ibuf->max_size, to
+ reduce ibuf_mutex contention. ibuf->max_size remains constant
+ after ibuf_init_at_db_start(), but ibuf->size should be
+ protected by ibuf_mutex. Given that ibuf->size fits in a
+ machine word, this should be OK; at worst we are doing some
+ excessive ibuf_contract() or occasionally skipping a
+ ibuf_contract(). */
if (ibuf->size >= ibuf->max_size + IBUF_CONTRACT_DO_NOT_INSERT) {
/* Insert buffer is now too big, contract it but do not try
to insert */
- mutex_exit(&ibuf_mutex);
#ifdef UNIV_IBUF_DEBUG
fputs("Ibuf too big\n", stderr);
@@ -2626,64 +3519,101 @@ ibuf_insert_low(
return(DB_STRONG_FAIL);
}
- mutex_exit(&ibuf_mutex);
+ heap = mem_heap_create(512);
- if (mode == BTR_MODIFY_TREE) {
- mutex_enter(&ibuf_pessimistic_insert_mutex);
+ /* Build the entry which contains the space id and the page number
+ as the first fields and the type information for other fields, and
+ which will be inserted to the insert buffer. Using a counter value
+ of 0xFFFF we find the last record for (space, page_no), from which
+ we can then read the counter value N and use N + 1 in the record we
+ insert. (We patch the ibuf_entry's counter field to the correct
+ value just before actually inserting the entry.) */
- ibuf_enter();
+ ibuf_entry = ibuf_entry_build(
+ op, index, entry, space, page_no,
+ no_counter ? ULINT_UNDEFINED : 0xFFFF, heap);
- mutex_enter(&ibuf_mutex);
+ /* Open a cursor to the insert buffer tree to calculate if we can add
+ the new entry to it without exceeding the free space limit for the
+ page. */
- while (!ibuf_data_enough_free_for_insert()) {
+ if (mode == BTR_MODIFY_TREE) {
+ for (;;) {
+ mutex_enter(&ibuf_pessimistic_insert_mutex);
+ mutex_enter(&ibuf_mutex);
- mutex_exit(&ibuf_mutex);
+ if (UNIV_LIKELY(ibuf_data_enough_free_for_insert())) {
- ibuf_exit();
+ break;
+ }
+ mutex_exit(&ibuf_mutex);
mutex_exit(&ibuf_pessimistic_insert_mutex);
- err = ibuf_add_free_page();
-
- if (err == DB_STRONG_FAIL) {
+ if (UNIV_UNLIKELY(!ibuf_add_free_page())) {
- return(err);
+ mem_heap_free(heap);
+ return(DB_STRONG_FAIL);
}
-
- mutex_enter(&ibuf_pessimistic_insert_mutex);
-
- ibuf_enter();
-
- mutex_enter(&ibuf_mutex);
}
- } else {
- ibuf_enter();
}
- heap = mem_heap_create(512);
-
- /* Build the entry which contains the space id and the page number as
- the first fields and the type information for other fields, and which
- will be inserted to the insert buffer. */
-
- ibuf_entry = ibuf_entry_build(index, entry, space, page_no, heap);
-
- /* Open a cursor to the insert buffer tree to calculate if we can add
- the new entry to it without exceeding the free space limit for the
- page. */
-
- mtr_start(&mtr);
+ ibuf_mtr_start(&mtr);
btr_pcur_open(ibuf->index, ibuf_entry, PAGE_CUR_LE, mode, &pcur, &mtr);
+ ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf->index));
/* Find out the volume of already buffered inserts for the same index
page */
- buffered = ibuf_get_volume_buffered(&pcur, space, page_no, &mtr);
+ min_n_recs = 0;
+ buffered = ibuf_get_volume_buffered(&pcur, space, page_no,
+ op == IBUF_OP_DELETE
+ ? &min_n_recs
+ : NULL, &mtr);
+
+ if (op == IBUF_OP_DELETE
+ && (min_n_recs < 2
+ || buf_pool_watch_occurred(space, page_no))) {
+ /* The page could become empty after the record is
+ deleted, or the page has been read in to the buffer
+ pool. Refuse to buffer the operation. */
+
+ /* The buffer pool watch is needed for IBUF_OP_DELETE
+ because of latching order considerations. We can
+ check buf_pool_watch_occurred() only after latching
+ the insert buffer B-tree pages that contain buffered
+ changes for the page. We never buffer IBUF_OP_DELETE,
+ unless some IBUF_OP_INSERT or IBUF_OP_DELETE_MARK have
+ been previously buffered for the page. Because there
+ are buffered operations for the page, the insert
+ buffer B-tree page latches held by mtr will guarantee
+ that no changes for the user page will be merged
+ before mtr_commit(&mtr). We must not mtr_commit(&mtr)
+ until after the IBUF_OP_DELETE has been buffered. */
+
+fail_exit:
+ if (mode == BTR_MODIFY_TREE) {
+ mutex_exit(&ibuf_mutex);
+ mutex_exit(&ibuf_pessimistic_insert_mutex);
+ }
+
+ err = DB_STRONG_FAIL;
+ goto func_exit;
+ }
+
+ /* After this point, the page could still be loaded to the
+ buffer pool, but we do not have to care about it, since we are
+ holding a latch on the insert buffer leaf page that contains
+ buffered changes for (space, page_no). If the page enters the
+ buffer pool, buf_page_io_complete() for (space, page_no) will
+ have to acquire a latch on the same insert buffer leaf page,
+ which it cannot do until we have buffered the IBUF_OP_DELETE
+ and done mtr_commit(&mtr) to release the latch. */
#ifdef UNIV_IBUF_COUNT_DEBUG
ut_a((buffered == 0) || ibuf_count_get(space, page_no));
#endif
- mtr_start(&bitmap_mtr);
+ ibuf_mtr_start(&bitmap_mtr);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
zip_size, &bitmap_mtr);
@@ -2692,29 +3622,42 @@ ibuf_insert_low(
if (buf_page_peek(space, page_no)
|| lock_rec_expl_exist_on_page(space, page_no)) {
- err = DB_STRONG_FAIL;
-
- mtr_commit(&bitmap_mtr);
- goto function_exit;
+ goto bitmap_fail;
}
- bits = ibuf_bitmap_page_get_bits(bitmap_page, page_no, zip_size,
- IBUF_BITMAP_FREE, &bitmap_mtr);
+ if (op == IBUF_OP_INSERT) {
+ ulint bits = ibuf_bitmap_page_get_bits(
+ bitmap_page, page_no, zip_size, IBUF_BITMAP_FREE,
+ &bitmap_mtr);
- if (buffered + entry_size + page_dir_calc_reserved_space(1)
- > ibuf_index_page_calc_free_from_bits(zip_size, bits)) {
- mtr_commit(&bitmap_mtr);
+ if (buffered + entry_size + page_dir_calc_reserved_space(1)
+ > ibuf_index_page_calc_free_from_bits(zip_size, bits)) {
+ /* Release the bitmap page latch early. */
+ ibuf_mtr_commit(&bitmap_mtr);
- /* It may not fit */
- err = DB_STRONG_FAIL;
+ /* It may not fit */
+ do_merge = TRUE;
+
+ ibuf_get_merge_page_nos(FALSE,
+ btr_pcur_get_rec(&pcur), &mtr,
+ space_ids, space_versions,
+ page_nos, &n_stored);
+
+ goto fail_exit;
+ }
+ }
- do_merge = TRUE;
+ /* Patch correct counter value to the entry to insert. This can
+ change the insert position, which can result in the need to abort in
+ some cases. */
+ if (!no_counter
+ && !ibuf_set_entry_counter(ibuf_entry, space, page_no, &pcur,
+ mode == BTR_MODIFY_PREV, &mtr)) {
+bitmap_fail:
+ ibuf_mtr_commit(&bitmap_mtr);
- ibuf_get_merge_page_nos(FALSE, btr_pcur_get_rec(&pcur),
- space_ids, space_versions,
- page_nos, &n_stored);
- goto function_exit;
+ goto fail_exit;
}
/* Set the bitmap bit denoting that the insert buffer contains
@@ -2730,7 +3673,7 @@ ibuf_insert_low(
&bitmap_mtr);
}
- mtr_commit(&bitmap_mtr);
+ ibuf_mtr_commit(&bitmap_mtr);
cursor = btr_pcur_get_btr_cur(&pcur);
@@ -2738,10 +3681,19 @@ ibuf_insert_low(
err = btr_cur_optimistic_insert(BTR_NO_LOCKING_FLAG, cursor,
ibuf_entry, &ins_rec,
&dummy_big_rec, 0, thr, &mtr);
- if (err == DB_SUCCESS) {
- /* Update the page max trx id field */
- page_update_max_trx_id(btr_cur_get_block(cursor), NULL,
- thr_get_trx(thr)->id, &mtr);
+ block = btr_cur_get_block(cursor);
+ ut_ad(buf_block_get_space(block) == IBUF_SPACE_ID);
+
+ /* If this is the root page, update ibuf->empty. */
+ if (UNIV_UNLIKELY(buf_block_get_page_no(block)
+ == FSP_IBUF_TREE_ROOT_PAGE_NO)) {
+ const page_t* root = buf_block_get_frame(block);
+
+ ut_ad(page_get_space_id(root) == IBUF_SPACE_ID);
+ ut_ad(page_get_page_no(root)
+ == FSP_IBUF_TREE_ROOT_PAGE_NO);
+
+ ibuf->empty = (page_get_n_recs(root) == 0);
}
} else {
ut_ad(mode == BTR_MODIFY_TREE);
@@ -2758,16 +3710,22 @@ ibuf_insert_low(
cursor,
ibuf_entry, &ins_rec,
&dummy_big_rec, 0, thr, &mtr);
- if (err == DB_SUCCESS) {
- /* Update the page max trx id field */
- page_update_max_trx_id(btr_cur_get_block(cursor), NULL,
- thr_get_trx(thr)->id, &mtr);
- }
-
+ mutex_exit(&ibuf_pessimistic_insert_mutex);
ibuf_size_update(root, &mtr);
+ mutex_exit(&ibuf_mutex);
+ ibuf->empty = (page_get_n_recs(root) == 0);
+
+ block = btr_cur_get_block(cursor);
+ ut_ad(buf_block_get_space(block) == IBUF_SPACE_ID);
}
-function_exit:
+ if (err == DB_SUCCESS && op != IBUF_OP_DELETE) {
+ /* Update the page max trx id field */
+ page_update_max_trx_id(block, NULL,
+ thr_get_trx(thr)->id, &mtr);
+ }
+
+func_exit:
#ifdef UNIV_IBUF_COUNT_DEBUG
if (err == DB_SUCCESS) {
fprintf(stderr,
@@ -2779,29 +3737,14 @@ function_exit:
ibuf_count_get(space, page_no) + 1);
}
#endif
- if (mode == BTR_MODIFY_TREE) {
-
- mutex_exit(&ibuf_mutex);
- mutex_exit(&ibuf_pessimistic_insert_mutex);
- }
- mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
- ibuf_exit();
mem_heap_free(heap);
- if (err == DB_SUCCESS) {
- mutex_enter(&ibuf_mutex);
-
- ibuf->empty = FALSE;
- ibuf->n_inserts++;
-
- mutex_exit(&ibuf_mutex);
-
- if (mode == BTR_MODIFY_TREE) {
- ibuf_contract_after_insert(entry_size);
- }
+ if (err == DB_SUCCESS && mode == BTR_MODIFY_TREE) {
+ ibuf_contract_after_insert(entry_size);
}
if (do_merge) {
@@ -2816,14 +3759,15 @@ function_exit:
}
/*********************************************************************//**
-Makes an index insert to the insert buffer, instead of directly to the disk
-page, if this is possible. Does not do insert if the index is clustered
-or unique.
+Buffer an operation in the insert/delete buffer, instead of doing it
+directly to the disk page, if this is possible. Does not do it if the index
+is clustered or unique.
@return TRUE if success */
UNIV_INTERN
ibool
ibuf_insert(
/*========*/
+ ibuf_op_t op, /*!< in: operation type */
const dtuple_t* entry, /*!< in: index entry to insert */
dict_index_t* index, /*!< in: index where to insert */
ulint space, /*!< in: space id where to insert */
@@ -2831,8 +3775,12 @@ ibuf_insert(
ulint page_no,/*!< in: page number where to insert */
que_thr_t* thr) /*!< in: query thread */
{
- ulint err;
- ulint entry_size;
+ ulint err;
+ ulint entry_size;
+ ibool no_counter;
+ /* Read the settable global variable ibuf_use only once in
+ this function, so that we will have a consistent view of it. */
+ ibuf_use_t use = ibuf_use;
ut_a(trx_sys_multiple_tablespace_format);
ut_ad(dtuple_check_typed(entry));
@@ -2840,30 +3788,111 @@ ibuf_insert(
ut_a(!dict_index_is_clust(index));
- switch (UNIV_EXPECT(ibuf_use, IBUF_USE_INSERT)) {
- case IBUF_USE_NONE:
- return(FALSE);
- case IBUF_USE_INSERT:
- goto do_insert;
- case IBUF_USE_COUNT:
+ no_counter = use <= IBUF_USE_INSERT;
+
+ switch (op) {
+ case IBUF_OP_INSERT:
+ switch (use) {
+ case IBUF_USE_NONE:
+ case IBUF_USE_DELETE:
+ case IBUF_USE_DELETE_MARK:
+ return(FALSE);
+ case IBUF_USE_INSERT:
+ case IBUF_USE_INSERT_DELETE_MARK:
+ case IBUF_USE_ALL:
+ goto check_watch;
+ case IBUF_USE_COUNT:
+ break;
+ }
+ break;
+ case IBUF_OP_DELETE_MARK:
+ switch (use) {
+ case IBUF_USE_NONE:
+ case IBUF_USE_INSERT:
+ return(FALSE);
+ case IBUF_USE_DELETE_MARK:
+ case IBUF_USE_DELETE:
+ case IBUF_USE_INSERT_DELETE_MARK:
+ case IBUF_USE_ALL:
+ ut_ad(!no_counter);
+ goto check_watch;
+ case IBUF_USE_COUNT:
+ break;
+ }
+ break;
+ case IBUF_OP_DELETE:
+ switch (use) {
+ case IBUF_USE_NONE:
+ case IBUF_USE_INSERT:
+ case IBUF_USE_INSERT_DELETE_MARK:
+ return(FALSE);
+ case IBUF_USE_DELETE_MARK:
+ case IBUF_USE_DELETE:
+ case IBUF_USE_ALL:
+ ut_ad(!no_counter);
+ goto skip_watch;
+ case IBUF_USE_COUNT:
+ break;
+ }
+ break;
+ case IBUF_OP_COUNT:
break;
}
- ut_error; /* unknown value of ibuf_use */
+ /* unknown op or use */
+ ut_error;
+
+check_watch:
+ /* If a thread attempts to buffer an insert on a page while a
+ purge is in progress on the same page, the purge must not be
+ buffered, because it could remove a record that was
+ re-inserted later. For simplicity, we block the buffering of
+ all operations on a page that has a purge pending.
+
+ We do not check this in the IBUF_OP_DELETE case, because that
+ would always trigger the buffer pool watch during purge and
+ thus prevent the buffering of delete operations. We assume
+ that the issuer of IBUF_OP_DELETE has called
+ buf_pool_watch_set(space, page_no). */
+
+ {
+ buf_page_t* bpage;
+ ulint fold = buf_page_address_fold(space, page_no);
+ buf_pool_t* buf_pool = buf_pool_get(space, page_no);
+
+ //buf_pool_mutex_enter(buf_pool);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
+ bpage = buf_page_hash_get_low(buf_pool, space, page_no, fold);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
+
+ if (UNIV_LIKELY_NULL(bpage)) {
+ /* A buffer pool watch has been set or the
+ page has been read into the buffer pool.
+ Do not buffer the request. If a purge operation
+ is being buffered, have this request executed
+ directly on the page in the buffer pool after the
+ buffered entries for this page have been merged. */
+ return(FALSE);
+ }
+ }
-do_insert:
+skip_watch:
entry_size = rec_get_converted_size(index, entry, 0);
if (entry_size
- >= (page_get_free_space_of_empty(dict_table_is_comp(index->table))
- / 2)) {
+ >= page_get_free_space_of_empty(dict_table_is_comp(index->table))
+ / 2) {
+
return(FALSE);
}
- err = ibuf_insert_low(BTR_MODIFY_PREV, entry, entry_size,
+ err = ibuf_insert_low(BTR_MODIFY_PREV, op, no_counter,
+ entry, entry_size,
index, space, zip_size, page_no, thr);
if (err == DB_FAIL) {
- err = ibuf_insert_low(BTR_MODIFY_TREE, entry, entry_size,
+ err = ibuf_insert_low(BTR_MODIFY_TREE, op, no_counter,
+ entry, entry_size,
index, space, zip_size, page_no, thr);
}
@@ -2886,9 +3915,80 @@ During merge, inserts to an index page a secondary index entry extracted
from the insert buffer. */
static
void
+ibuf_insert_to_index_page_low(
+/*==========================*/
+ const dtuple_t* entry, /*!< in: buffered entry to insert */
+ buf_block_t* block, /*!< in/out: index page where the buffered
+ entry should be placed */
+ dict_index_t* index, /*!< in: record descriptor */
+ mtr_t* mtr, /*!< in/out: mtr */
+ page_cur_t* page_cur)/*!< in/out: cursor positioned on the record
+ after which to insert the buffered entry */
+{
+ const page_t* page;
+ ulint space;
+ ulint page_no;
+ ulint zip_size;
+ const page_t* bitmap_page;
+ ulint old_bits;
+
+ if (UNIV_LIKELY
+ (page_cur_tuple_insert(page_cur, entry, index, 0, mtr) != NULL)) {
+ return;
+ }
+
+ /* If the record did not fit, reorganize */
+
+ btr_page_reorganize(block, index, mtr);
+ page_cur_search(block, index, entry, PAGE_CUR_LE, page_cur);
+
+ /* This time the record must fit */
+
+ if (UNIV_LIKELY
+ (page_cur_tuple_insert(page_cur, entry, index, 0, mtr) != NULL)) {
+ return;
+ }
+
+ page = buf_block_get_frame(block);
+
+ ut_print_timestamp(stderr);
+
+ fprintf(stderr,
+ " InnoDB: Error: Insert buffer insert fails;"
+ " page free %lu, dtuple size %lu\n",
+ (ulong) page_get_max_insert_size(page, 1),
+ (ulong) rec_get_converted_size(index, entry, 0));
+ fputs("InnoDB: Cannot insert index record ", stderr);
+ dtuple_print(stderr, entry);
+ fputs("\nInnoDB: The table where this index record belongs\n"
+ "InnoDB: is now probably corrupt. Please run CHECK TABLE on\n"
+ "InnoDB: that table.\n", stderr);
+
+ space = page_get_space_id(page);
+ zip_size = buf_block_get_zip_size(block);
+ page_no = page_get_page_no(page);
+
+ bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, mtr);
+ old_bits = ibuf_bitmap_page_get_bits(bitmap_page, page_no, zip_size,
+ IBUF_BITMAP_FREE, mtr);
+
+ fprintf(stderr,
+ "InnoDB: space %lu, page %lu, zip_size %lu, bitmap bits %lu\n",
+ (ulong) space, (ulong) page_no,
+ (ulong) zip_size, (ulong) old_bits);
+
+ fputs("InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n", stderr);
+}
+
+/************************************************************************
+During merge, inserts to an index page a secondary index entry extracted
+from the insert buffer. */
+static
+void
ibuf_insert_to_index_page(
/*======================*/
- dtuple_t* entry, /*!< in: buffered entry to insert */
+ const dtuple_t* entry, /*!< in: buffered entry to insert */
buf_block_t* block, /*!< in/out: index page where the buffered entry
should be placed */
dict_index_t* index, /*!< in: record descriptor */
@@ -2898,11 +3998,10 @@ ibuf_insert_to_index_page(
ulint low_match;
page_t* page = buf_block_get_frame(block);
rec_t* rec;
- page_t* bitmap_page;
- ulint old_bits;
- ut_ad(ibuf_inside());
+ ut_ad(ibuf_inside(mtr));
ut_ad(dtuple_check_typed(entry));
+ ut_ad(!buf_block_align(page)->is_hashed);
if (UNIV_UNLIKELY(dict_table_is_comp(index->table)
!= (ibool)!!page_is_comp(page))) {
@@ -2915,6 +4014,14 @@ ibuf_insert_to_index_page(
rec = page_rec_get_next(page_get_infimum_rec(page));
+ if (page_rec_is_supremum(rec)) {
+ fputs("InnoDB: Trying to insert a record from"
+ " the insert buffer to an index page\n"
+ "InnoDB: but the index page is empty!\n",
+ stderr);
+ goto dump;
+ }
+
if (UNIV_UNLIKELY(rec_get_n_fields(rec, index)
!= dtuple_get_n_fields(entry))) {
fputs("InnoDB: Trying to insert a record from"
@@ -2940,72 +4047,280 @@ dump:
low_match = page_cur_search(block, index, entry,
PAGE_CUR_LE, &page_cur);
- if (low_match == dtuple_get_n_fields(entry)) {
+ if (UNIV_UNLIKELY(low_match == dtuple_get_n_fields(entry))) {
+ mem_heap_t* heap;
+ upd_t* update;
+ ulint* offsets;
page_zip_des_t* page_zip;
rec = page_cur_get_rec(&page_cur);
+
+ /* This is based on
+ row_ins_sec_index_entry_by_modify(BTR_MODIFY_LEAF). */
+ ut_ad(rec_get_deleted_flag(rec, page_is_comp(page)));
+
+ heap = mem_heap_create(1024);
+
+ offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED,
+ &heap);
+ update = row_upd_build_sec_rec_difference_binary(
+ index, entry, rec, NULL, heap);
+
page_zip = buf_block_get_page_zip(block);
- btr_cur_del_unmark_for_ibuf(rec, page_zip, mtr);
+ if (update->n_fields == 0) {
+ /* The records only differ in the delete-mark.
+ Clear the delete-mark, like we did before
+ Bug #56680 was fixed. */
+ btr_cur_set_deleted_flag_for_ibuf(
+ rec, page_zip, FALSE, mtr);
+updated_in_place:
+ mem_heap_free(heap);
+ return;
+ }
+
+ /* Copy the info bits. Clear the delete-mark. */
+ update->info_bits = rec_get_info_bits(rec, page_is_comp(page));
+ update->info_bits &= ~REC_INFO_DELETED_FLAG;
+
+ /* We cannot invoke btr_cur_optimistic_update() here,
+ because we do not have a btr_cur_t or que_thr_t,
+ as the insert buffer merge occurs at a very low level. */
+ if (!row_upd_changes_field_size_or_external(index, offsets,
+ update)
+ && (!page_zip || btr_cur_update_alloc_zip(
+ page_zip, block, index,
+ rec_offs_size(offsets), FALSE, mtr))) {
+ /* This is the easy case. Do something similar
+ to btr_cur_update_in_place(). */
+ row_upd_rec_in_place(rec, index, offsets,
+ update, page_zip);
+ goto updated_in_place;
+ }
+
+ /* A collation may identify values that differ in
+ storage length.
+ Some examples (1 or 2 bytes):
+ utf8_turkish_ci: I = U+0131 LATIN SMALL LETTER DOTLESS I
+ utf8_general_ci: S = U+00DF LATIN SMALL LETTER SHARP S
+ utf8_general_ci: A = U+00E4 LATIN SMALL LETTER A WITH DIAERESIS
+
+ latin1_german2_ci: SS = U+00DF LATIN SMALL LETTER SHARP S
+
+ Examples of a character (3-byte UTF-8 sequence)
+ identified with 2 or 4 characters (1-byte UTF-8 sequences):
+
+ utf8_unicode_ci: 'II' = U+2171 SMALL ROMAN NUMERAL TWO
+ utf8_unicode_ci: '(10)' = U+247D PARENTHESIZED NUMBER TEN
+ */
+
+ /* Delete the different-length record, and insert the
+ buffered one. */
+
+ lock_rec_store_on_page_infimum(block, rec);
+ page_cur_delete_rec(&page_cur, index, offsets, mtr);
+ page_cur_move_to_prev(&page_cur);
+ mem_heap_free(heap);
+
+ ibuf_insert_to_index_page_low(entry, block, index, mtr,
+ &page_cur);
+ lock_rec_restore_from_page_infimum(block, rec, block);
} else {
- rec = page_cur_tuple_insert(&page_cur, entry, index, 0, mtr);
+ ibuf_insert_to_index_page_low(entry, block, index, mtr,
+ &page_cur);
+ }
+}
- if (UNIV_LIKELY(rec != NULL)) {
- return;
+/****************************************************************//**
+During merge, sets the delete mark on a record for a secondary index
+entry. */
+static
+void
+ibuf_set_del_mark(
+/*==============*/
+ const dtuple_t* entry, /*!< in: entry */
+ buf_block_t* block, /*!< in/out: block */
+ const dict_index_t* index, /*!< in: record descriptor */
+ mtr_t* mtr) /*!< in: mtr */
+{
+ page_cur_t page_cur;
+ ulint low_match;
+
+ ut_ad(ibuf_inside(mtr));
+ ut_ad(dtuple_check_typed(entry));
+
+ low_match = page_cur_search(
+ block, index, entry, PAGE_CUR_LE, &page_cur);
+
+ if (low_match == dtuple_get_n_fields(entry)) {
+ rec_t* rec;
+ page_zip_des_t* page_zip;
+
+ rec = page_cur_get_rec(&page_cur);
+ page_zip = page_cur_get_page_zip(&page_cur);
+
+ /* Delete mark the old index record. According to a
+ comment in row_upd_sec_index_entry(), it can already
+ have been delete marked if a lock wait occurred in
+ row_ins_index_entry() in a previous invocation of
+ row_upd_sec_index_entry(). */
+
+ if (UNIV_LIKELY
+ (!rec_get_deleted_flag(
+ rec, dict_table_is_comp(index->table)))) {
+ btr_cur_set_deleted_flag_for_ibuf(rec, page_zip,
+ TRUE, mtr);
+ }
+ } else {
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: unable to find a record to delete-mark\n",
+ stderr);
+ fputs("InnoDB: tuple ", stderr);
+ dtuple_print(stderr, entry);
+ fputs("\n"
+ "InnoDB: record ", stderr);
+ rec_print(stderr, page_cur_get_rec(&page_cur), index);
+ putc('\n', stderr);
+ fputs("\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n", stderr);
+ ut_ad(0);
+ }
+}
+
+/****************************************************************//**
+During merge, delete a record for a secondary index entry. */
+static
+void
+ibuf_delete(
+/*========*/
+ const dtuple_t* entry, /*!< in: entry */
+ buf_block_t* block, /*!< in/out: block */
+ dict_index_t* index, /*!< in: record descriptor */
+ mtr_t* mtr) /*!< in/out: mtr; must be committed
+ before latching any further pages */
+{
+ page_cur_t page_cur;
+ ulint low_match;
+
+ ut_ad(ibuf_inside(mtr));
+ ut_ad(dtuple_check_typed(entry));
+
+ low_match = page_cur_search(
+ block, index, entry, PAGE_CUR_LE, &page_cur);
+
+ if (low_match == dtuple_get_n_fields(entry)) {
+ page_zip_des_t* page_zip= buf_block_get_page_zip(block);
+ page_t* page = buf_block_get_frame(block);
+ rec_t* rec = page_cur_get_rec(&page_cur);
+
+ /* TODO: the below should probably be a separate function,
+ it's a bastardized version of btr_cur_optimistic_delete. */
+
+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ ulint* offsets = offsets_;
+ mem_heap_t* heap = NULL;
+ ulint max_ins_size;
+
+ rec_offs_init(offsets_);
+
+ offsets = rec_get_offsets(
+ rec, index, offsets, ULINT_UNDEFINED, &heap);
+
+ /* Refuse to delete the last record. */
+ ut_a(page_get_n_recs(page) > 1);
+
+ /* The record should have been marked for deletion. */
+ ut_ad(REC_INFO_DELETED_FLAG
+ & rec_get_info_bits(rec, page_is_comp(page)));
+
+ lock_update_delete(block, rec);
+
+ if (!page_zip) {
+ max_ins_size
+ = page_get_max_insert_size_after_reorganize(
+ page, 1);
+ }
+#ifdef UNIV_ZIP_DEBUG
+ ut_a(!page_zip || page_zip_validate(page_zip, page));
+#endif /* UNIV_ZIP_DEBUG */
+ page_cur_delete_rec(&page_cur, index, offsets, mtr);
+#ifdef UNIV_ZIP_DEBUG
+ ut_a(!page_zip || page_zip_validate(page_zip, page));
+#endif /* UNIV_ZIP_DEBUG */
+
+ if (page_zip) {
+ ibuf_update_free_bits_zip(block, mtr);
+ } else {
+ ibuf_update_free_bits_low(block, max_ins_size, mtr);
}
- /* If the record did not fit, reorganize */
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
+ }
+ } else {
+ /* The record must have been purged already. */
+ }
+}
- btr_page_reorganize(block, index, mtr);
- page_cur_search(block, index, entry, PAGE_CUR_LE, &page_cur);
+/*********************************************************************//**
+Restores insert buffer tree cursor position
+@return TRUE if the position was restored; FALSE if not */
+static __attribute__((nonnull))
+ibool
+ibuf_restore_pos(
+/*=============*/
+ ulint space, /*!< in: space id */
+ ulint page_no,/*!< in: index page number where the record
+ should belong */
+ const dtuple_t* search_tuple,
+ /*!< in: search tuple for entries of page_no */
+ ulint mode, /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */
+ btr_pcur_t* pcur, /*!< in/out: persistent cursor whose
+ position is to be restored */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+{
+ ut_ad(mode == BTR_MODIFY_LEAF || mode == BTR_MODIFY_TREE);
- /* This time the record must fit */
- if (UNIV_UNLIKELY
- (!page_cur_tuple_insert(&page_cur, entry, index,
- 0, mtr))) {
- ulint space;
- ulint page_no;
- ulint zip_size;
+ if (btr_pcur_restore_position(mode, pcur, mtr)) {
- ut_print_timestamp(stderr);
+ return(TRUE);
+ }
- fprintf(stderr,
- " InnoDB: Error: Insert buffer insert"
- " fails; page free %lu,"
- " dtuple size %lu\n",
- (ulong) page_get_max_insert_size(
- page, 1),
- (ulong) rec_get_converted_size(
- index, entry, 0));
- fputs("InnoDB: Cannot insert index record ",
- stderr);
- dtuple_print(stderr, entry);
- fputs("\nInnoDB: The table where"
- " this index record belongs\n"
- "InnoDB: is now probably corrupt."
- " Please run CHECK TABLE on\n"
- "InnoDB: that table.\n", stderr);
+ if (fil_space_get_flags(space) == ULINT_UNDEFINED) {
+ /* The tablespace has been dropped. It is possible
+ that another thread has deleted the insert buffer
+ entry. Do not complain. */
+ ibuf_btr_pcur_commit_specify_mtr(pcur, mtr);
+ } else {
+ fprintf(stderr,
+ "InnoDB: ERROR: Submit the output to"
+ " http://bugs.mysql.com\n"
+ "InnoDB: ibuf cursor restoration fails!\n"
+ "InnoDB: ibuf record inserted to page %lu:%lu\n",
+ (ulong) space, (ulong) page_no);
+ fflush(stderr);
- space = page_get_space_id(page);
- zip_size = buf_block_get_zip_size(block);
- page_no = page_get_page_no(page);
+ rec_print_old(stderr, btr_pcur_get_rec(pcur));
+ rec_print_old(stderr, pcur->old_rec);
+ dtuple_print(stderr, search_tuple);
- bitmap_page = ibuf_bitmap_get_map_page(
- space, page_no, zip_size, mtr);
- old_bits = ibuf_bitmap_page_get_bits(
- bitmap_page, page_no, zip_size,
- IBUF_BITMAP_FREE, mtr);
+ rec_print_old(stderr,
+ page_rec_get_next(btr_pcur_get_rec(pcur)));
+ fflush(stderr);
- fprintf(stderr,
- "InnoDB: space %lu, page %lu,"
- " zip_size %lu, bitmap bits %lu\n",
- (ulong) space, (ulong) page_no,
- (ulong) zip_size, (ulong) old_bits);
+ ibuf_btr_pcur_commit_specify_mtr(pcur, mtr);
- fputs("InnoDB: Submit a detailed bug report"
- " to http://bugs.mysql.com\n", stderr);
+ fputs("InnoDB: Validating insert buffer tree:\n", stderr);
+ if (!btr_validate_index(ibuf->index, NULL)) {
+ ut_error;
}
+
+ fprintf(stderr, "InnoDB: ibuf tree ok\n");
+ fflush(stderr);
}
+
+ return(FALSE);
}
/*********************************************************************//**
@@ -3018,8 +4333,8 @@ ibool
ibuf_delete_rec(
/*============*/
ulint space, /*!< in: space id */
- ulint page_no,/*!< in: index page number where the record
- should belong */
+ ulint page_no,/*!< in: index page number that the record
+ should belong to */
btr_pcur_t* pcur, /*!< in: pcur positioned on the record to
delete, having latch mode BTR_MODIFY_LEAF */
const dtuple_t* search_tuple,
@@ -3030,14 +4345,30 @@ ibuf_delete_rec(
page_t* root;
ulint err;
- ut_ad(ibuf_inside());
+ ut_ad(ibuf_inside(mtr));
ut_ad(page_rec_is_user_rec(btr_pcur_get_rec(pcur)));
- ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no);
- ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space);
+ ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no);
+ ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space);
success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr);
if (success) {
+ if (UNIV_UNLIKELY(!page_get_n_recs(btr_pcur_get_page(pcur)))) {
+ /* If a B-tree page is empty, it must be the root page
+ and the whole B-tree must be empty. InnoDB does not
+ allow empty B-tree pages other than the root. */
+ root = btr_pcur_get_page(pcur);
+
+ ut_ad(page_get_space_id(root) == IBUF_SPACE_ID);
+ ut_ad(page_get_page_no(root)
+ == FSP_IBUF_TREE_ROOT_PAGE_NO);
+
+ /* ibuf->empty is protected by the root page latch.
+ Before the deletion, it had to be FALSE. */
+ ut_ad(!ibuf->empty);
+ ibuf->empty = TRUE;
+ }
+
#ifdef UNIV_IBUF_COUNT_DEBUG
fprintf(stderr,
"Decrementing ibuf count of space %lu page %lu\n"
@@ -3050,54 +4381,22 @@ ibuf_delete_rec(
}
ut_ad(page_rec_is_user_rec(btr_pcur_get_rec(pcur)));
- ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no);
- ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space);
+ ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no);
+ ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space);
/* We have to resort to a pessimistic delete from ibuf */
btr_pcur_store_position(pcur, mtr);
+ ibuf_btr_pcur_commit_specify_mtr(pcur, mtr);
- btr_pcur_commit_specify_mtr(pcur, mtr);
-
+ ibuf_mtr_start(mtr);
mutex_enter(&ibuf_mutex);
- mtr_start(mtr);
-
- success = btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr);
-
- if (!success) {
- if (fil_space_get_flags(space) == ULINT_UNDEFINED) {
- /* The tablespace has been dropped. It is possible
- that another thread has deleted the insert buffer
- entry. Do not complain. */
- goto commit_and_exit;
- }
-
- fprintf(stderr,
- "InnoDB: ERROR: Submit the output to"
- " http://bugs.mysql.com\n"
- "InnoDB: ibuf cursor restoration fails!\n"
- "InnoDB: ibuf record inserted to page %lu\n",
- (ulong) page_no);
- fflush(stderr);
-
- rec_print_old(stderr, btr_pcur_get_rec(pcur));
- rec_print_old(stderr, pcur->old_rec);
- dtuple_print(stderr, search_tuple);
-
- rec_print_old(stderr,
- page_rec_get_next(btr_pcur_get_rec(pcur)));
- fflush(stderr);
-
- btr_pcur_commit_specify_mtr(pcur, mtr);
-
- fputs("InnoDB: Validating insert buffer tree:\n", stderr);
- if (!btr_validate_index(ibuf->index, NULL)) {
- ut_error;
- }
-
- fprintf(stderr, "InnoDB: ibuf tree ok\n");
- fflush(stderr);
+ if (!ibuf_restore_pos(space, page_no, search_tuple,
+ BTR_MODIFY_TREE, pcur, mtr)) {
+ mutex_exit(&ibuf_mutex);
+ ut_ad(!ibuf_inside(mtr));
+ ut_ad(mtr->state == MTR_COMMITTED);
goto func_exit;
}
@@ -3111,25 +4410,26 @@ ibuf_delete_rec(
ibuf_count_set(space, page_no, ibuf_count_get(space, page_no) - 1);
#endif
ibuf_size_update(root, mtr);
+ mutex_exit(&ibuf_mutex);
-commit_and_exit:
- btr_pcur_commit_specify_mtr(pcur, mtr);
+ ibuf->empty = (page_get_n_recs(root) == 0);
+ ibuf_btr_pcur_commit_specify_mtr(pcur, mtr);
func_exit:
+ ut_ad(!ibuf_inside(mtr));
+ ut_ad(mtr->state == MTR_COMMITTED);
btr_pcur_close(pcur);
- mutex_exit(&ibuf_mutex);
-
return(TRUE);
}
/*********************************************************************//**
When an index page is read from a disk to the buffer pool, this function
-inserts to the page the possible index entries buffered in the insert buffer.
-The entries are deleted from the insert buffer. If the page is not read, but
-created in the buffer pool, this function deletes its buffered entries from
-the insert buffer; there can exist entries for such a page if the page
-belonged to an index which subsequently was dropped. */
+applies any buffered operations to the page and deletes the entries from the
+insert buffer. If the page is not read, but created in the buffer pool, this
+function deletes its buffered entries from the insert buffer; there can
+exist entries for such a page if the page belonged to an index which
+subsequently was dropped. */
UNIV_INTERN
void
ibuf_merge_or_delete_for_page(
@@ -3150,15 +4450,18 @@ ibuf_merge_or_delete_for_page(
mem_heap_t* heap;
btr_pcur_t pcur;
dtuple_t* search_tuple;
- ulint n_inserts;
#ifdef UNIV_IBUF_DEBUG
- ulint volume;
+ ulint volume = 0;
#endif
page_zip_des_t* page_zip = NULL;
ibool tablespace_being_deleted = FALSE;
ibool corruption_noticed = FALSE;
mtr_t mtr;
+ /* Counts for merged & discarded operations. */
+ ulint mops[IBUF_OP_COUNT];
+ ulint dops[IBUF_OP_COUNT];
+
ut_ad(!block || buf_block_get_space(block) == space);
ut_ad(!block || buf_block_get_page_no(block) == page_no);
ut_ad(!block || buf_block_get_zip_size(block) == zip_size);
@@ -3206,18 +4509,20 @@ ibuf_merge_or_delete_for_page(
update_ibuf_bitmap = FALSE;
} else {
page_t* bitmap_page;
+ ulint bitmap_bits;
- mtr_start(&mtr);
+ ibuf_mtr_start(&mtr);
bitmap_page = ibuf_bitmap_get_map_page(
space, page_no, zip_size, &mtr);
+ bitmap_bits = ibuf_bitmap_page_get_bits(
+ bitmap_page, page_no, zip_size,
+ IBUF_BITMAP_BUFFERED, &mtr);
+
+ ibuf_mtr_commit(&mtr);
- if (!ibuf_bitmap_page_get_bits(bitmap_page, page_no,
- zip_size,
- IBUF_BITMAP_BUFFERED,
- &mtr)) {
+ if (!bitmap_bits) {
/* No inserts buffered for this page */
- mtr_commit(&mtr);
if (!tablespace_being_deleted) {
fil_decr_pending_ibuf_merges(space);
@@ -3225,7 +4530,6 @@ ibuf_merge_or_delete_for_page(
return;
}
- mtr_commit(&mtr);
}
} else if (block
&& (ibuf_fixed_addr_page(space, zip_size, page_no)
@@ -3234,11 +4538,9 @@ ibuf_merge_or_delete_for_page(
return;
}
- ibuf_enter();
-
heap = mem_heap_create(512);
- if (!trx_sys_multiple_tablespace_format) {
+ if (UNIV_UNLIKELY(!trx_sys_multiple_tablespace_format)) {
ut_a(trx_doublewrite_must_reset_space_ids);
search_tuple = ibuf_search_tuple_build(space, page_no, heap);
} else {
@@ -3265,7 +4567,7 @@ ibuf_merge_or_delete_for_page(
ut_print_timestamp(stderr);
- mtr_start(&mtr);
+ ibuf_mtr_start(&mtr);
fputs(" InnoDB: Dump of the ibuf bitmap page:\n",
stderr);
@@ -3273,8 +4575,7 @@ ibuf_merge_or_delete_for_page(
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
zip_size, &mtr);
buf_page_print(bitmap_page, 0);
-
- mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
fputs("\nInnoDB: Dump of the page:\n", stderr);
@@ -3301,12 +4602,11 @@ ibuf_merge_or_delete_for_page(
}
}
- n_inserts = 0;
-#ifdef UNIV_IBUF_DEBUG
- volume = 0;
-#endif
+ memset(mops, 0, sizeof(mops));
+ memset(dops, 0, sizeof(dops));
+
loop:
- mtr_start(&mtr);
+ ibuf_mtr_start(&mtr);
if (block) {
ibool success;
@@ -3340,8 +4640,8 @@ loop:
rec = btr_pcur_get_rec(&pcur);
/* Check if the entry is for this index page */
- if (ibuf_rec_get_page_no(rec) != page_no
- || ibuf_rec_get_space(rec) != space) {
+ if (ibuf_rec_get_page_no(&mtr, rec) != page_no
+ || ibuf_rec_get_space(&mtr, rec) != space) {
if (block) {
page_header_reset_last_insert(
@@ -3357,33 +4657,96 @@ loop:
fputs("\nInnoDB: from the insert buffer!\n\n", stderr);
} else if (block) {
/* Now we have at pcur a record which should be
- inserted to the index page; NOTE that the call below
+ applied on the index page; NOTE that the call below
copies pointers to fields in rec, and we must
keep the latch to the rec page until the
insertion is finished! */
dtuple_t* entry;
trx_id_t max_trx_id;
dict_index_t* dummy_index;
+ ibuf_op_t op = ibuf_rec_get_op_type(&mtr, rec);
max_trx_id = page_get_max_trx_id(page_align(rec));
page_update_max_trx_id(block, page_zip, max_trx_id,
&mtr);
+ ut_ad(page_validate(page_align(rec), ibuf->index));
+
entry = ibuf_build_entry_from_ibuf_rec(
- rec, heap, &dummy_index);
+ &mtr, rec, heap, &dummy_index);
+
+ ut_ad(page_validate(block->frame, dummy_index));
+
+ switch (op) {
+ ibool success;
+ case IBUF_OP_INSERT:
#ifdef UNIV_IBUF_DEBUG
- volume += rec_get_converted_size(dummy_index, entry, 0)
- + page_dir_calc_reserved_space(1);
- ut_a(volume <= 4 * UNIV_PAGE_SIZE
- / IBUF_PAGE_SIZE_PER_FREE_SPACE);
+ volume += rec_get_converted_size(
+ dummy_index, entry, 0);
+
+ volume += page_dir_calc_reserved_space(1);
+
+ ut_a(volume <= 4 * UNIV_PAGE_SIZE
+ / IBUF_PAGE_SIZE_PER_FREE_SPACE);
#endif
- ibuf_insert_to_index_page(entry, block,
- dummy_index, &mtr);
+ ibuf_insert_to_index_page(
+ entry, block, dummy_index, &mtr);
+ break;
+
+ case IBUF_OP_DELETE_MARK:
+ ibuf_set_del_mark(
+ entry, block, dummy_index, &mtr);
+ break;
+
+ case IBUF_OP_DELETE:
+ ibuf_delete(entry, block, dummy_index, &mtr);
+ /* Because ibuf_delete() will latch an
+ insert buffer bitmap page, commit mtr
+ before latching any further pages.
+ Store and restore the cursor position. */
+ ut_ad(rec == btr_pcur_get_rec(&pcur));
+ ut_ad(page_rec_is_user_rec(rec));
+ ut_ad(ibuf_rec_get_page_no(&mtr, rec)
+ == page_no);
+ ut_ad(ibuf_rec_get_space(&mtr, rec) == space);
+
+ btr_pcur_store_position(&pcur, &mtr);
+ ibuf_btr_pcur_commit_specify_mtr(&pcur, &mtr);
+
+ ibuf_mtr_start(&mtr);
+
+ success = buf_page_get_known_nowait(
+ RW_X_LATCH, block,
+ BUF_KEEP_OLD,
+ __FILE__, __LINE__, &mtr);
+ ut_a(success);
+
+ buf_block_dbg_add_level(block, SYNC_TREE_NODE);
+
+ if (!ibuf_restore_pos(space, page_no,
+ search_tuple,
+ BTR_MODIFY_LEAF,
+ &pcur, &mtr)) {
+
+ ut_ad(!ibuf_inside(&mtr));
+ ut_ad(mtr.state == MTR_COMMITTED);
+ mops[op]++;
+ ibuf_dummy_index_free(dummy_index);
+ goto loop;
+ }
+
+ break;
+ default:
+ ut_error;
+ }
+
+ mops[op]++;
+
ibuf_dummy_index_free(dummy_index);
+ } else {
+ dops[ibuf_rec_get_op_type(&mtr, rec)]++;
}
- n_inserts++;
-
/* Delete the record from ibuf */
if (ibuf_delete_rec(space, page_no, &pcur, search_tuple,
&mtr)) {
@@ -3392,7 +4755,7 @@ loop:
goto loop;
} else if (btr_pcur_is_after_last_on_page(&pcur)) {
- mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
goto loop;
@@ -3400,12 +4763,6 @@ loop:
}
reset_bit:
-#ifdef UNIV_IBUF_COUNT_DEBUG
- if (ibuf_count_get(space, page_no) > 0) {
- /* btr_print_tree(ibuf_data->index->tree, 100);
- ibuf_print(); */
- }
-#endif
if (UNIV_LIKELY(update_ibuf_bitmap)) {
page_t* bitmap_page;
@@ -3432,25 +4789,30 @@ reset_bit:
}
}
- mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
mem_heap_free(heap);
+#ifdef HAVE_ATOMIC_BUILTINS
+ os_atomic_increment_ulint(&ibuf->n_merges, 1);
+ ibuf_add_ops(ibuf->n_merged_ops, mops);
+ ibuf_add_ops(ibuf->n_discarded_ops, dops);
+#else /* HAVE_ATOMIC_BUILTINS */
/* Protect our statistics keeping from race conditions */
mutex_enter(&ibuf_mutex);
ibuf->n_merges++;
- ibuf->n_merged_recs += n_inserts;
+ ibuf_add_ops(ibuf->n_merged_ops, mops);
+ ibuf_add_ops(ibuf->n_discarded_ops, dops);
mutex_exit(&ibuf_mutex);
+#endif /* HAVE_ATOMIC_BUILTINS */
if (update_ibuf_bitmap && !tablespace_being_deleted) {
fil_decr_pending_ibuf_merges(space);
}
- ibuf_exit();
-
#ifdef UNIV_IBUF_COUNT_DEBUG
ut_a(ibuf_count_get(space, page_no) == 0);
#endif
@@ -3470,12 +4832,13 @@ ibuf_delete_for_discarded_space(
mem_heap_t* heap;
btr_pcur_t pcur;
dtuple_t* search_tuple;
- rec_t* ibuf_rec;
+ const rec_t* ibuf_rec;
ulint page_no;
- ibool closed;
- ulint n_inserts;
mtr_t mtr;
+ /* Counts for discarded operations. */
+ ulint dops[IBUF_OP_COUNT];
+
heap = mem_heap_create(512);
/* Use page number 0 to build the search tuple so that we get the
@@ -3483,11 +4846,9 @@ ibuf_delete_for_discarded_space(
search_tuple = ibuf_new_search_tuple_build(space, 0, heap);
- n_inserts = 0;
+ memset(dops, 0, sizeof(dops));
loop:
- ibuf_enter();
-
- mtr_start(&mtr);
+ ibuf_mtr_start(&mtr);
/* Position pcur in the insert buffer at the first entry for the
space */
@@ -3507,50 +4868,44 @@ loop:
ibuf_rec = btr_pcur_get_rec(&pcur);
/* Check if the entry is for this space */
- if (ibuf_rec_get_space(ibuf_rec) != space) {
+ if (ibuf_rec_get_space(&mtr, ibuf_rec) != space) {
goto leave_loop;
}
- page_no = ibuf_rec_get_page_no(ibuf_rec);
+ page_no = ibuf_rec_get_page_no(&mtr, ibuf_rec);
- n_inserts++;
+ dops[ibuf_rec_get_op_type(&mtr, ibuf_rec)]++;
/* Delete the record from ibuf */
- closed = ibuf_delete_rec(space, page_no, &pcur, search_tuple,
- &mtr);
- if (closed) {
+ if (ibuf_delete_rec(space, page_no, &pcur, search_tuple,
+ &mtr)) {
/* Deletion was pessimistic and mtr was committed:
we start from the beginning again */
- ibuf_exit();
-
goto loop;
}
if (btr_pcur_is_after_last_on_page(&pcur)) {
- mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
- ibuf_exit();
-
goto loop;
}
}
leave_loop:
- mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
+#ifdef HAVE_ATOMIC_BUILTINS
+ ibuf_add_ops(ibuf->n_discarded_ops, dops);
+#else /* HAVE_ATOMIC_BUILTINS */
/* Protect our statistics keeping from race conditions */
mutex_enter(&ibuf_mutex);
-
- ibuf->n_merges++;
- ibuf->n_merged_recs += n_inserts;
-
+ ibuf_add_ops(ibuf->n_discarded_ops, dops);
mutex_exit(&ibuf_mutex);
-
- ibuf_exit();
+#endif /* HAVE_ATOMIC_BUILTINS */
mem_heap_free(heap);
}
@@ -3567,37 +4922,15 @@ ibuf_is_empty(void)
const page_t* root;
mtr_t mtr;
- ibuf_enter();
+ ibuf_mtr_start(&mtr);
mutex_enter(&ibuf_mutex);
-
- mtr_start(&mtr);
-
root = ibuf_tree_root_get(&mtr);
-
- if (page_get_n_recs(root) == 0) {
-
- is_empty = TRUE;
-
- if (ibuf->empty == FALSE) {
- fprintf(stderr,
- "InnoDB: Warning: insert buffer tree is empty"
- " but the data struct does not\n"
- "InnoDB: know it. This condition is legal"
- " if the master thread has not yet\n"
- "InnoDB: run to completion.\n");
- }
- } else {
- ut_a(ibuf->empty == FALSE);
-
- is_empty = FALSE;
- }
-
- mtr_commit(&mtr);
-
mutex_exit(&ibuf_mutex);
- ibuf_exit();
+ is_empty = (page_get_n_recs(root) == 0);
+ ut_a(is_empty == ibuf->empty);
+ ibuf_mtr_commit(&mtr);
return(is_empty);
}
@@ -3618,14 +4951,19 @@ ibuf_print(
mutex_enter(&ibuf_mutex);
fprintf(file,
- "Ibuf: size %lu, free list len %lu, seg size %lu,\n"
- "%lu inserts, %lu merged recs, %lu merges\n",
+ "Ibuf: size %lu, free list len %lu,"
+ " seg size %lu, %lu merges\n",
(ulong) ibuf->size,
(ulong) ibuf->free_list_len,
(ulong) ibuf->seg_size,
- (ulong) ibuf->n_inserts,
- (ulong) ibuf->n_merged_recs,
(ulong) ibuf->n_merges);
+
+ fputs("merged operations:\n ", file);
+ ibuf_print_ops(ibuf->n_merged_ops, file);
+
+ fputs("discarded operations:\n ", file);
+ ibuf_print_ops(ibuf->n_discarded_ops, file);
+
#ifdef UNIV_IBUF_COUNT_DEBUG
for (i = 0; i < IBUF_COUNT_N_SPACES; i++) {
for (j = 0; j < IBUF_COUNT_N_PAGES; j++) {
diff --git a/storage/xtradb/include/btr0btr.h b/storage/xtradb/include/btr0btr.h
index 5e6a76c7d21..c632e034581 100644
--- a/storage/xtradb/include/btr0btr.h
+++ b/storage/xtradb/include/btr0btr.h
@@ -68,19 +68,115 @@ enum btr_latch_mode {
BTR_MODIFY_PREV = 36
};
+/* BTR_INSERT, BTR_DELETE and BTR_DELETE_MARK are mutually exclusive. */
+
/** If this is ORed to btr_latch_mode, it means that the search tuple
-will be inserted to the index, at the searched position */
+will be inserted to the index, at the searched position.
+When the record is not in the buffer pool, try to use the insert buffer. */
#define BTR_INSERT 512
/** This flag ORed to btr_latch_mode says that we do the search in query
optimization */
#define BTR_ESTIMATE 1024
-/** This flag ORed to btr_latch_mode says that we can ignore possible
+/** This flag ORed to BTR_INSERT says that we can ignore possible
UNIQUE definition on secondary indexes when we decide if we can use
the insert buffer to speed up inserts */
#define BTR_IGNORE_SEC_UNIQUE 2048
+/** Try to delete mark the record at the searched position using the
+insert/delete buffer when the record is not in the buffer pool. */
+#define BTR_DELETE_MARK 4096
+
+/** Try to purge the record at the searched position using the insert/delete
+buffer when the record is not in the buffer pool. */
+#define BTR_DELETE 8192
+
+#ifdef UNIV_BLOB_DEBUG
+# include "ut0rbt.h"
+/** An index->blobs entry for keeping track of off-page column references */
+struct btr_blob_dbg_struct
+{
+ unsigned blob_page_no:32; /*!< first BLOB page number */
+ unsigned ref_page_no:32; /*!< referring page number */
+ unsigned ref_heap_no:16; /*!< referring heap number */
+ unsigned ref_field_no:10; /*!< referring field number */
+ unsigned owner:1; /*!< TRUE if BLOB owner */
+ unsigned always_owner:1; /*!< TRUE if always
+ has been the BLOB owner;
+ reset to TRUE on B-tree
+ page splits and merges */
+ unsigned del:1; /*!< TRUE if currently
+ delete-marked */
+};
+
+/**************************************************************//**
+Add a reference to an off-page column to the index->blobs map. */
+UNIV_INTERN
+void
+btr_blob_dbg_add_blob(
+/*==================*/
+ const rec_t* rec, /*!< in: clustered index record */
+ ulint field_no, /*!< in: number of off-page column */
+ ulint page_no, /*!< in: start page of the column */
+ dict_index_t* index, /*!< in/out: index tree */
+ const char* ctx) /*!< in: context (for logging) */
+ __attribute__((nonnull));
+/**************************************************************//**
+Display the references to off-page columns.
+This function is to be called from a debugger,
+for example when a breakpoint on ut_dbg_assertion_failed is hit. */
+UNIV_INTERN
+void
+btr_blob_dbg_print(
+/*===============*/
+ const dict_index_t* index) /*!< in: index tree */
+ __attribute__((nonnull));
+/**************************************************************//**
+Check that there are no references to off-page columns from or to
+the given page. Invoked when freeing or clearing a page.
+@return TRUE when no orphan references exist */
+UNIV_INTERN
+ibool
+btr_blob_dbg_is_empty(
+/*==================*/
+ dict_index_t* index, /*!< in: index */
+ ulint page_no) /*!< in: page number */
+ __attribute__((nonnull, warn_unused_result));
+
+/**************************************************************//**
+Modify the 'deleted' flag of a record. */
+UNIV_INTERN
+void
+btr_blob_dbg_set_deleted_flag(
+/*==========================*/
+ const rec_t* rec, /*!< in: record */
+ dict_index_t* index, /*!< in/out: index */
+ const ulint* offsets,/*!< in: rec_get_offs(rec, index) */
+ ibool del) /*!< in: TRUE=deleted, FALSE=exists */
+ __attribute__((nonnull));
+/**************************************************************//**
+Change the ownership of an off-page column. */
+UNIV_INTERN
+void
+btr_blob_dbg_owner(
+/*===============*/
+ const rec_t* rec, /*!< in: record */
+ dict_index_t* index, /*!< in/out: index */
+ const ulint* offsets,/*!< in: rec_get_offs(rec, index) */
+ ulint i, /*!< in: ith field in rec */
+ ibool own) /*!< in: TRUE=owned, FALSE=disowned */
+ __attribute__((nonnull));
+/** Assert that there are no BLOB references to or from the given page. */
+# define btr_blob_dbg_assert_empty(index, page_no) \
+ ut_a(btr_blob_dbg_is_empty(index, page_no))
+#else /* UNIV_BLOB_DEBUG */
+# define btr_blob_dbg_add_blob(rec, field_no, page, index, ctx) ((void) 0)
+# define btr_blob_dbg_set_deleted_flag(rec, index, offsets, del)((void) 0)
+# define btr_blob_dbg_owner(rec, index, offsets, i, val) ((void) 0)
+# define btr_blob_dbg_assert_empty(index, page_no) ((void) 0)
+#endif /* UNIV_BLOB_DEBUG */
+
/**************************************************************//**
Gets the root node of a tree and x-latches it.
@return root page, x-latched */
@@ -94,32 +190,52 @@ btr_root_get(
Gets a buffer page and declares its latching order level. */
UNIV_INLINE
buf_block_t*
-btr_block_get(
-/*==========*/
- ulint space, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no, /*!< in: page number */
- ulint mode, /*!< in: latch mode */
- mtr_t* mtr); /*!< in: mtr */
+btr_block_get_func(
+/*===============*/
+ ulint space, /*!< in: space id */
+ ulint zip_size, /*!< in: compressed page size in bytes
+ or 0 for uncompressed pages */
+ ulint page_no, /*!< in: page number */
+ ulint mode, /*!< in: latch mode */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
+ mtr_t* mtr) /*!< in/out: mtr */
+ __attribute__((nonnull));
+/** Gets a buffer page and declares its latching order level.
+@param space tablespace identifier
+@param zip_size compressed page size in bytes or 0 for uncompressed pages
+@param page_no page number
+@param mode latch mode
+@param mtr mini-transaction handle
+@return the block descriptor */
+# define btr_block_get(space,zip_size,page_no,mode,mtr) \
+ btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr)
+/** Gets a buffer page and declares its latching order level.
+@param space tablespace identifier
+@param zip_size compressed page size in bytes or 0 for uncompressed pages
+@param page_no page number
+@param mode latch mode
+@param mtr mini-transaction handle
+@return the uncompressed page frame */
+# define btr_page_get(space,zip_size,page_no,mode,mtr) \
+ buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr))
/**************************************************************//**
-Gets a buffer page and declares its latching order level. */
+Sets the index id field of a page. */
UNIV_INLINE
-page_t*
-btr_page_get(
-/*=========*/
- ulint space, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no, /*!< in: page number */
- ulint mode, /*!< in: latch mode */
- mtr_t* mtr); /*!< in: mtr */
+void
+btr_page_set_index_id(
+/*==================*/
+ page_t* page, /*!< in: page to be created */
+ page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
+ part will be updated, or NULL */
+ index_id_t id, /*!< in: index id */
+ mtr_t* mtr); /*!< in: mtr */
#endif /* !UNIV_HOTBACKUP */
/**************************************************************//**
Gets the index id field of a page.
@return index id */
UNIV_INLINE
-dulint
+index_id_t
btr_page_get_index_id(
/*==================*/
const page_t* page); /*!< in: index page */
@@ -151,6 +267,17 @@ btr_page_get_next(
const page_t* page, /*!< in: index page */
mtr_t* mtr); /*!< in: mini-transaction handle */
/********************************************************//**
+Sets the next index page field. */
+UNIV_INLINE
+void
+btr_page_set_next(
+/*==============*/
+ page_t* page, /*!< in: index page */
+ page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
+ part will be updated, or NULL */
+ ulint next, /*!< in: next page number */
+ mtr_t* mtr); /*!< in: mini-transaction handle */
+/********************************************************//**
Gets the previous index page number.
@return prev page number */
UNIV_INLINE
@@ -159,6 +286,17 @@ btr_page_get_prev(
/*==============*/
const page_t* page, /*!< in: index page */
mtr_t* mtr); /*!< in: mini-transaction handle */
+/********************************************************//**
+Sets the previous index page field. */
+UNIV_INLINE
+void
+btr_page_set_prev(
+/*==============*/
+ page_t* page, /*!< in: index page */
+ page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
+ part will be updated, or NULL */
+ ulint prev, /*!< in: previous page number */
+ mtr_t* mtr); /*!< in: mini-transaction handle */
/*************************************************************//**
Gets pointer to the previous user record in the tree. It is assumed
that the caller has appropriate latches on the page and its neighbor.
@@ -204,6 +342,18 @@ btr_node_ptr_get_child_page_no(
/*===========================*/
const rec_t* rec, /*!< in: node pointer record */
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
+/**************************************************************//**
+Creates a new index page (not the root, and also not
+used in page reorganization). @see btr_page_empty(). */
+UNIV_INTERN
+void
+btr_page_create(
+/*============*/
+ buf_block_t* block, /*!< in/out: page to be created */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
+ dict_index_t* index, /*!< in: index */
+ ulint level, /*!< in: the B-tree level of the page */
+ mtr_t* mtr); /*!< in: mtr */
/************************************************************//**
Creates the root node for a new index tree.
@return page number of the created root, FIL_NULL if did not succeed */
@@ -215,7 +365,7 @@ btr_create(
ulint space, /*!< in: space where created */
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
- dulint index_id,/*!< in: index id */
+ index_id_t index_id,/*!< in: index id */
dict_index_t* index, /*!< in: index */
mtr_t* mtr); /*!< in: mini-transaction handle */
/************************************************************//**
@@ -274,6 +424,17 @@ btr_page_reorganize(
dict_index_t* index, /*!< in: record descriptor */
mtr_t* mtr); /*!< in: mtr */
/*************************************************************//**
+Empties an index page. @see btr_page_create(). */
+UNIV_INTERN
+void
+btr_page_empty(
+/*===========*/
+ buf_block_t* block, /*!< in: page to be emptied */
+ page_zip_des_t* page_zip,/*!< out: compressed page, or NULL */
+ dict_index_t* index, /*!< in: index of the page */
+ ulint level, /*!< in: the B-tree level of the page */
+ mtr_t* mtr); /*!< in: mtr */
+/*************************************************************//**
Decides if the page should be split at the convergence point of
inserts converging to left.
@return TRUE if split recommended */
@@ -332,6 +493,20 @@ btr_insert_on_non_leaf_level_func(
# define btr_insert_on_non_leaf_level(i,l,t,m) \
btr_insert_on_non_leaf_level_func(i,l,t,__FILE__,__LINE__,m)
#endif /* !UNIV_HOTBACKUP */
+/**************************************************************//**
+Attaches the halves of an index page on the appropriate level in an
+index tree. */
+UNIV_INTERN
+void
+btr_attach_half_pages(
+/*==================*/
+ dict_index_t* index, /*!< in: the index tree */
+ buf_block_t* block, /*!< in/out: page to be split */
+ rec_t* split_rec, /*!< in: first record on upper
+ half page */
+ buf_block_t* new_block, /*!< in/out: the new half page */
+ ulint direction, /*!< in: FSP_UP or FSP_DOWN */
+ mtr_t* mtr); /*!< in: mtr */
/****************************************************************//**
Sets a record as the predefined minimum record. */
UNIV_INTERN
diff --git a/storage/xtradb/include/btr0btr.ic b/storage/xtradb/include/btr0btr.ic
index c9c38f3c3b3..99c02ab30dc 100644
--- a/storage/xtradb/include/btr0btr.ic
+++ b/storage/xtradb/include/btr0btr.ic
@@ -39,18 +39,21 @@ Created 6/2/1994 Heikki Tuuri
Gets a buffer page and declares its latching order level. */
UNIV_INLINE
buf_block_t*
-btr_block_get(
-/*==========*/
- ulint space, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no, /*!< in: page number */
- ulint mode, /*!< in: latch mode */
- mtr_t* mtr) /*!< in: mtr */
+btr_block_get_func(
+/*===============*/
+ ulint space, /*!< in: space id */
+ ulint zip_size, /*!< in: compressed page size in bytes
+ or 0 for uncompressed pages */
+ ulint page_no, /*!< in: page number */
+ ulint mode, /*!< in: latch mode */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
+ mtr_t* mtr) /*!< in/out: mtr */
{
buf_block_t* block;
- block = buf_page_get(space, zip_size, page_no, mode, mtr);
+ block = buf_page_get_gen(space, zip_size, page_no, mode,
+ NULL, BUF_GET, file, line, mtr);
ut_a(srv_pass_corrupt_table || block);
@@ -63,23 +66,6 @@ btr_block_get(
}
/**************************************************************//**
-Gets a buffer page and declares its latching order level. */
-UNIV_INLINE
-page_t*
-btr_page_get(
-/*=========*/
- ulint space, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no, /*!< in: page number */
- ulint mode, /*!< in: latch mode */
- mtr_t* mtr) /*!< in: mtr */
-{
- return(buf_block_get_frame(btr_block_get(space, zip_size, page_no,
- mode, mtr)));
-}
-
-/**************************************************************//**
Sets the index id field of a page. */
UNIV_INLINE
void
@@ -88,7 +74,7 @@ btr_page_set_index_id(
page_t* page, /*!< in: page to be created */
page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
part will be updated, or NULL */
- dulint id, /*!< in: index id */
+ index_id_t id, /*!< in: index id */
mtr_t* mtr) /*!< in: mtr */
{
if (UNIV_LIKELY_NULL(page_zip)) {
@@ -97,8 +83,7 @@ btr_page_set_index_id(
page + (PAGE_HEADER + PAGE_INDEX_ID),
8, mtr);
} else {
- mlog_write_dulint(page + (PAGE_HEADER + PAGE_INDEX_ID),
- id, mtr);
+ mlog_write_ull(page + (PAGE_HEADER + PAGE_INDEX_ID), id, mtr);
}
}
#endif /* !UNIV_HOTBACKUP */
@@ -107,7 +92,7 @@ btr_page_set_index_id(
Gets the index id field of a page.
@return index id */
UNIV_INLINE
-dulint
+index_id_t
btr_page_get_index_id(
/*==================*/
const page_t* page) /*!< in: index page */
diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h
index e151fdcb563..be918439f59 100644
--- a/storage/xtradb/include/btr0cur.h
+++ b/storage/xtradb/include/btr0cur.h
@@ -138,7 +138,8 @@ btr_cur_search_to_nth_level(
should always be made using PAGE_CUR_LE to
search the position! */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ..., ORed with
- BTR_INSERT and BTR_ESTIMATE;
+ at most one of BTR_INSERT, BTR_DELETE_MARK,
+ BTR_DELETE, or BTR_ESTIMATE;
cursor->left_block is used to store a pointer
to the left neighbor page, in the cases
BTR_SEARCH_PREV and BTR_MODIFY_PREV;
@@ -242,6 +243,22 @@ btr_cur_pessimistic_insert(
que_thr_t* thr, /*!< in: query thread or NULL */
mtr_t* mtr); /*!< in: mtr */
/*************************************************************//**
+See if there is enough place in the page modification log to log
+an update-in-place.
+@return TRUE if enough place */
+UNIV_INTERN
+ibool
+btr_cur_update_alloc_zip(
+/*=====================*/
+ page_zip_des_t* page_zip,/*!< in/out: compressed page */
+ buf_block_t* block, /*!< in/out: buffer page */
+ dict_index_t* index, /*!< in: the index corresponding to the block */
+ ulint length, /*!< in: size needed */
+ ibool create, /*!< in: TRUE=delete-and-insert,
+ FALSE=update-in-place */
+ mtr_t* mtr) /*!< in: mini-transaction */
+ __attribute__((nonnull, warn_unused_result));
+/*************************************************************//**
Updates a record when the update causes no size changes in its fields.
@return DB_SUCCESS or error number */
UNIV_INTERN
@@ -316,10 +333,14 @@ ulint
btr_cur_del_mark_set_clust_rec(
/*===========================*/
ulint flags, /*!< in: undo logging and locking flags */
- btr_cur_t* cursor, /*!< in: cursor */
+ buf_block_t* block, /*!< in/out: buffer block of the record */
+ rec_t* rec, /*!< in/out: record */
+ dict_index_t* index, /*!< in: clustered index of the record */
+ const ulint* offsets,/*!< in: rec_get_offsets(rec) */
ibool val, /*!< in: value to set */
que_thr_t* thr, /*!< in: query thread */
- mtr_t* mtr); /*!< in: mtr */
+ mtr_t* mtr) /*!< in: mtr */
+ __attribute__((nonnull));
/***********************************************************//**
Sets a secondary index record delete mark to TRUE or FALSE.
@return DB_SUCCESS, DB_LOCK_WAIT, or error number */
@@ -332,19 +353,6 @@ btr_cur_del_mark_set_sec_rec(
ibool val, /*!< in: value to set */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr); /*!< in: mtr */
-/***********************************************************//**
-Clear a secondary index record's delete mark. This function is only
-used by the insert buffer insert merge mechanism. */
-UNIV_INTERN
-void
-btr_cur_del_unmark_for_ibuf(
-/*========================*/
- rec_t* rec, /*!< in/out: record to delete unmark */
- page_zip_des_t* page_zip, /*!< in/out: compressed page
- corresponding to rec, or NULL
- when the tablespace is
- uncompressed */
- mtr_t* mtr); /*!< in: mtr */
/*************************************************************//**
Tries to compress a page of the tree if it seems useful. It is assumed
that mtr holds an x-latch on the tree and on the cursor page. To avoid
@@ -458,57 +466,42 @@ btr_estimate_n_rows_in_range(
/*******************************************************************//**
Estimates the number of different key values in a given index, for
each n-column prefix of the index where n <= dict_index_get_n_unique(index).
-The estimates are stored in the array index->stat_n_diff_key_vals. */
+The estimates are stored in the array index->stat_n_diff_key_vals.
+If innodb_stats_method is nulls_ignored, we also record the number of
+non-null values for each prefix and stored the estimates in
+array index->stat_n_non_null_key_vals. */
UNIV_INTERN
void
btr_estimate_number_of_different_key_vals(
/*======================================*/
dict_index_t* index); /*!< in: index */
/*******************************************************************//**
-Marks not updated extern fields as not-owned by this record. The ownership
-is transferred to the updated record which is inserted elsewhere in the
+Marks non-updated off-page fields as disowned by this record. The ownership
+must be transferred to the updated record which is inserted elsewhere in the
index tree. In purge only the owner of externally stored field is allowed
-to free the field.
-@return TRUE if BLOB ownership was transferred */
+to free the field. */
UNIV_INTERN
-ibool
-btr_cur_mark_extern_inherited_fields(
-/*=================================*/
+void
+btr_cur_disown_inherited_fields(
+/*============================*/
page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed
part will be updated, or NULL */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
- mtr_t* mtr); /*!< in: mtr, or NULL if not logged */
-/*******************************************************************//**
-The complement of the previous function: in an update entry may inherit
-some externally stored fields from a record. We must mark them as inherited
-in entry, so that they are not freed in a rollback. */
-UNIV_INTERN
-void
-btr_cur_mark_dtuple_inherited_extern(
-/*=================================*/
- dtuple_t* entry, /*!< in/out: updated entry to be
- inserted to clustered index */
- const upd_t* update); /*!< in: update vector */
-/*******************************************************************//**
-Marks all extern fields in a dtuple as owned by the record. */
-UNIV_INTERN
-void
-btr_cur_unmark_dtuple_extern_fields(
-/*================================*/
- dtuple_t* entry); /*!< in/out: clustered index entry */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ __attribute__((nonnull(2,3,4,5,6)));
/*******************************************************************//**
Stores the fields in big_rec_vec to the tablespace and puts pointers to
them in rec. The extern flags in rec will have to be set beforehand.
The fields are stored on pages allocated from leaf node
file segment of the index tree.
-@return DB_SUCCESS or error */
+@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
UNIV_INTERN
ulint
-btr_store_big_rec_extern_fields(
-/*============================*/
+btr_store_big_rec_extern_fields_func(
+/*=================================*/
dict_index_t* index, /*!< in: index of rec; the index tree
MUST be X-latched */
buf_block_t* rec_block, /*!< in/out: block containing rec */
@@ -517,10 +510,42 @@ btr_store_big_rec_extern_fields(
the "external storage" flags in offsets
will not correspond to rec when
this function returns */
- big_rec_t* big_rec_vec, /*!< in: vector containing fields
+#ifdef UNIV_DEBUG
+ mtr_t* local_mtr, /*!< in: mtr containing the
+ latch to rec and to the tree */
+#endif /* UNIV_DEBUG */
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ ibool update_in_place,/*! in: TRUE if the record is updated
+ in place (not delete+insert) */
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
+ const big_rec_t*big_rec_vec) /*!< in: vector containing fields
to be stored externally */
- mtr_t* local_mtr); /*!< in: mtr containing the latch to
- rec and to the tree */
+ __attribute__((nonnull));
+
+/** Stores the fields in big_rec_vec to the tablespace and puts pointers to
+them in rec. The extern flags in rec will have to be set beforehand.
+The fields are stored on pages allocated from leaf node
+file segment of the index tree.
+@param index in: clustered index; MUST be X-latched by mtr
+@param b in/out: block containing rec; MUST be X-latched by mtr
+@param rec in/out: clustered index record
+@param offsets in: rec_get_offsets(rec, index);
+ the "external storage" flags in offsets will not be adjusted
+@param mtr in: mini-transaction that holds x-latch on index and b
+@param upd in: TRUE if the record is updated in place (not delete+insert)
+@param big in: vector containing fields to be stored externally
+@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
+#ifdef UNIV_DEBUG
+# define btr_store_big_rec_extern_fields(index,b,rec,offsets,mtr,upd,big) \
+ btr_store_big_rec_extern_fields_func(index,b,rec,offsets,mtr,upd,big)
+#elif defined UNIV_BLOB_LIGHT_DEBUG
+# define btr_store_big_rec_extern_fields(index,b,rec,offsets,mtr,upd,big) \
+ btr_store_big_rec_extern_fields_func(index,b,rec,offsets,upd,big)
+#else
+# define btr_store_big_rec_extern_fields(index,b,rec,offsets,mtr,upd,big) \
+ btr_store_big_rec_extern_fields_func(index,b,rec,offsets,big)
+#endif
+
/*******************************************************************//**
Frees the space in an externally stored field to the file space
management if the field in data is owned the externally stored field,
@@ -597,7 +622,20 @@ btr_push_update_extern_fields(
const upd_t* update, /*!< in: update vector */
mem_heap_t* heap) /*!< in: memory heap */
__attribute__((nonnull));
-
+/***********************************************************//**
+Sets a secondary index record's delete mark to the given value. This
+function is only used by the insert buffer merge mechanism. */
+UNIV_INTERN
+void
+btr_cur_set_deleted_flag_for_ibuf(
+/*==============================*/
+ rec_t* rec, /*!< in/out: record */
+ page_zip_des_t* page_zip, /*!< in/out: compressed page
+ corresponding to rec, or NULL
+ when the tablespace is
+ uncompressed */
+ ibool val, /*!< in: value to set */
+ mtr_t* mtr); /*!< in: mtr */
/*######################################################################*/
/** In the pessimistic delete, if the page data size drops below this
@@ -615,6 +653,11 @@ struct btr_path_struct{
order); value ULINT_UNDEFINED
denotes array end */
ulint n_recs; /*!< number of records on the page */
+ ulint page_no; /*!< no of the page containing the record */
+ ulint page_level; /*!< level of the page, if later we fetch
+ the page under page_no and it is no different
+ level then we know that the tree has been
+ reorganized */
};
#define BTR_PATH_ARRAY_N_SLOTS 250 /*!< size of path array (in slots) */
@@ -629,8 +672,13 @@ enum btr_cur_method {
hash_node, and might be necessary to
update */
BTR_CUR_BINARY, /*!< success using the binary search */
- BTR_CUR_INSERT_TO_IBUF /*!< performed the intended insert to
+ BTR_CUR_INSERT_TO_IBUF, /*!< performed the intended insert to
the insert buffer */
+ BTR_CUR_DEL_MARK_IBUF, /*!< performed the intended delete
+ mark in the insert/delete buffer */
+ BTR_CUR_DELETE_IBUF, /*!< performed the intended delete in
+ the insert/delete buffer */
+ BTR_CUR_DELETE_REF /*!< row_purge_poss_sec() failed */
};
/** The tree cursor: the definition appears here only for the compiler
@@ -638,6 +686,7 @@ to know struct size! */
struct btr_cur_struct {
dict_index_t* index; /*!< index where positioned */
page_cur_t page_cur; /*!< page cursor */
+ purge_node_t* purge_node; /*!< purge node, for BTR_DELETE */
buf_block_t* left_block; /*!< this field is used to store
a pointer to the left neighbor
page, in the cases
@@ -694,6 +743,23 @@ struct btr_cur_struct {
NULL */
ulint fold; /*!< fold value used in the search if
flag is BTR_CUR_HASH */
+ /*----- Delete buffering -------*/
+ ulint ibuf_cnt; /* in searches done on insert buffer
+ trees, this contains the "counter"
+ value (the first two bytes of the
+ fourth field) extracted from the
+ page above the leaf page, from the
+ father node pointer that pointed to
+ the leaf page. in other words, it
+ contains the minimum counter value
+ for records to be inserted on the
+ chosen leaf page. If for some reason
+ this can't be read, or if the search
+ ended on the leftmost leaf page in
+ the tree (in which case the father
+ node pointer had the 'minimum
+ record' flag set), this is
+ ULINT_UNDEFINED. */
/*------------------------------*/
/* @} */
btr_path_t* path_arr; /*!< in estimating the number of
diff --git a/storage/xtradb/include/btr0pcur.h b/storage/xtradb/include/btr0pcur.h
index 2334a266280..6c11c973fc9 100644
--- a/storage/xtradb/include/btr0pcur.h
+++ b/storage/xtradb/include/btr0pcur.h
@@ -150,7 +150,7 @@ UNIV_INLINE
ulint
btr_pcur_get_up_match(
/*==================*/
- btr_pcur_t* cursor); /*!< in: memory buffer for persistent cursor */
+ const btr_pcur_t* cursor); /*!< in: persistent cursor */
/**************************************************************//**
Gets the low_match value for a pcur after a search.
@return number of matched fields at the cursor or to the right if
@@ -159,7 +159,7 @@ UNIV_INLINE
ulint
btr_pcur_get_low_match(
/*===================*/
- btr_pcur_t* cursor); /*!< in: memory buffer for persistent cursor */
+ const btr_pcur_t* cursor); /*!< in: persistent cursor */
/**************************************************************//**
If mode is PAGE_CUR_G or PAGE_CUR_GE, opens a persistent cursor on the first
user record satisfying the search condition, in the case PAGE_CUR_L or
@@ -264,22 +264,6 @@ ulint
btr_pcur_get_rel_pos(
/*=================*/
const btr_pcur_t* cursor);/*!< in: persistent cursor */
-/*********************************************************//**
-Sets the mtr field for a pcur. */
-UNIV_INLINE
-void
-btr_pcur_set_mtr(
-/*=============*/
- btr_pcur_t* cursor, /*!< in: persistent cursor */
- mtr_t* mtr); /*!< in, own: mtr */
-/*********************************************************//**
-Gets the mtr field for a pcur.
-@return mtr */
-UNIV_INLINE
-mtr_t*
-btr_pcur_get_mtr(
-/*=============*/
- btr_pcur_t* cursor); /*!< in: persistent cursor */
/**************************************************************//**
Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES,
that is, the cursor becomes detached. If there have been modifications
@@ -387,10 +371,6 @@ page_cur_t*
btr_pcur_get_page_cur(
/*==================*/
const btr_pcur_t* cursor); /*!< in: persistent cursor */
-#else /* UNIV_DEBUG */
-# define btr_pcur_get_btr_cur(cursor) (&(cursor)->btr_cur)
-# define btr_pcur_get_page_cur(cursor) (&(cursor)->btr_cur.page_cur)
-#endif /* UNIV_DEBUG */
/*********************************************************//**
Returns the page of a persistent cursor.
@return pointer to the page */
@@ -398,7 +378,7 @@ UNIV_INLINE
page_t*
btr_pcur_get_page(
/*==============*/
- btr_pcur_t* cursor);/*!< in: persistent cursor */
+ const btr_pcur_t* cursor);/*!< in: persistent cursor */
/*********************************************************//**
Returns the buffer block of a persistent cursor.
@return pointer to the block */
@@ -406,7 +386,7 @@ UNIV_INLINE
buf_block_t*
btr_pcur_get_block(
/*===============*/
- btr_pcur_t* cursor);/*!< in: persistent cursor */
+ const btr_pcur_t* cursor);/*!< in: persistent cursor */
/*********************************************************//**
Returns the record of a persistent cursor.
@return pointer to the record */
@@ -414,7 +394,14 @@ UNIV_INLINE
rec_t*
btr_pcur_get_rec(
/*=============*/
- btr_pcur_t* cursor);/*!< in: persistent cursor */
+ const btr_pcur_t* cursor);/*!< in: persistent cursor */
+#else /* UNIV_DEBUG */
+# define btr_pcur_get_btr_cur(cursor) (&(cursor)->btr_cur)
+# define btr_pcur_get_page_cur(cursor) (&(cursor)->btr_cur.page_cur)
+# define btr_pcur_get_page(cursor) ((cursor)->btr_cur.page_cur.block->frame)
+# define btr_pcur_get_block(cursor) ((cursor)->btr_cur.page_cur.block)
+# define btr_pcur_get_rec(cursor) ((cursor)->btr_cur.page_cur.rec)
+#endif /* UNIV_DEBUG */
/*********************************************************//**
Checks if the persistent cursor is on a user record. */
UNIV_INLINE
@@ -517,9 +504,6 @@ struct btr_pcur_struct{
/* NOTE that the following fields may possess dynamically allocated
memory which should be freed if not needed anymore! */
- mtr_t* mtr; /*!< NULL, or this field may contain
- a mini-transaction which holds the
- latch on the cursor page */
byte* old_rec_buf; /*!< NULL, or a dynamically allocated
buffer for old_rec */
ulint buf_size; /*!< old_rec_buf size if old_rec_buf
diff --git a/storage/xtradb/include/btr0pcur.ic b/storage/xtradb/include/btr0pcur.ic
index 0c38797e6c5..59fdb21824b 100644
--- a/storage/xtradb/include/btr0pcur.ic
+++ b/storage/xtradb/include/btr0pcur.ic
@@ -42,34 +42,6 @@ btr_pcur_get_rel_pos(
return(cursor->rel_pos);
}
-/*********************************************************//**
-Sets the mtr field for a pcur. */
-UNIV_INLINE
-void
-btr_pcur_set_mtr(
-/*=============*/
- btr_pcur_t* cursor, /*!< in: persistent cursor */
- mtr_t* mtr) /*!< in, own: mtr */
-{
- ut_ad(cursor);
-
- cursor->mtr = mtr;
-}
-
-/*********************************************************//**
-Gets the mtr field for a pcur.
-@return mtr */
-UNIV_INLINE
-mtr_t*
-btr_pcur_get_mtr(
-/*=============*/
- btr_pcur_t* cursor) /*!< in: persistent cursor */
-{
- ut_ad(cursor);
-
- return(cursor->mtr);
-}
-
#ifdef UNIV_DEBUG
/*********************************************************//**
Returns the btr cursor component of a persistent cursor.
@@ -95,7 +67,7 @@ btr_pcur_get_page_cur(
{
return(btr_cur_get_page_cur(btr_pcur_get_btr_cur(cursor)));
}
-#endif /* UNIV_DEBUG */
+
/*********************************************************//**
Returns the page of a persistent cursor.
@return pointer to the page */
@@ -103,7 +75,7 @@ UNIV_INLINE
page_t*
btr_pcur_get_page(
/*==============*/
- btr_pcur_t* cursor) /*!< in: persistent cursor */
+ const btr_pcur_t* cursor) /*!< in: persistent cursor */
{
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
@@ -117,7 +89,7 @@ UNIV_INLINE
buf_block_t*
btr_pcur_get_block(
/*===============*/
- btr_pcur_t* cursor) /*!< in: persistent cursor */
+ const btr_pcur_t* cursor) /*!< in: persistent cursor */
{
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
@@ -131,13 +103,14 @@ UNIV_INLINE
rec_t*
btr_pcur_get_rec(
/*=============*/
- btr_pcur_t* cursor) /*!< in: persistent cursor */
+ const btr_pcur_t* cursor) /*!< in: persistent cursor */
{
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
return(btr_cur_get_rec(btr_pcur_get_btr_cur(cursor)));
}
+#endif /* UNIV_DEBUG */
/**************************************************************//**
Gets the up_match value for a pcur after a search.
@@ -147,9 +120,9 @@ UNIV_INLINE
ulint
btr_pcur_get_up_match(
/*==================*/
- btr_pcur_t* cursor) /*!< in: memory buffer for persistent cursor */
+ const btr_pcur_t* cursor) /*!< in: persistent cursor */
{
- btr_cur_t* btr_cursor;
+ const btr_cur_t* btr_cursor;
ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED)
|| (cursor->pos_state == BTR_PCUR_IS_POSITIONED));
@@ -169,9 +142,9 @@ UNIV_INLINE
ulint
btr_pcur_get_low_match(
/*===================*/
- btr_pcur_t* cursor) /*!< in: memory buffer for persistent cursor */
+ const btr_pcur_t* cursor) /*!< in: persistent cursor */
{
- btr_cur_t* btr_cursor;
+ const btr_cur_t* btr_cursor;
ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED)
|| (cursor->pos_state == BTR_PCUR_IS_POSITIONED));
diff --git a/storage/xtradb/include/btr0sea.h b/storage/xtradb/include/btr0sea.h
index f6d194319ae..9e82602934e 100644
--- a/storage/xtradb/include/btr0sea.h
+++ b/storage/xtradb/include/btr0sea.h
@@ -85,7 +85,8 @@ UNIV_INTERN
ulint
btr_search_info_get_ref_count(
/*==========================*/
- btr_search_t* info); /*!< in: search info. */
+ btr_search_t* info, /*!< in: search info. */
+ index_id_t key);
/*********************************************************************//**
Updates the search info. */
UNIV_INLINE
@@ -136,10 +137,11 @@ UNIV_INTERN
void
btr_search_drop_page_hash_index(
/*============================*/
- buf_block_t* block); /*!< in: block containing index page,
+ buf_block_t* block, /*!< in: block containing index page,
s- or x-latched, or an index page
for which we know that
block->buf_fix_count == 0 */
+ dict_index_t* index_in);
/************************************************************************
Drops a page hash index based on index */
UNIV_INTERN
@@ -199,10 +201,47 @@ btr_search_validate(void);
# define btr_search_validate() TRUE
#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
+/********************************************************************//**
+New functions to control split btr_search_index */
+UNIV_INLINE
+hash_table_t*
+btr_search_get_hash_index(
+/*======================*/
+ index_id_t key);
+
+UNIV_INLINE
+rw_lock_t*
+btr_search_get_latch(
+/*=================*/
+ index_id_t key);
+
+UNIV_INLINE
+void
+btr_search_x_lock_all(void);
+/*========================*/
+
+UNIV_INLINE
+void
+btr_search_x_unlock_all(void);
+/*==========================*/
+
+UNIV_INLINE
+void
+btr_search_s_lock_all(void);
+/*========================*/
+
+UNIV_INLINE
+void
+btr_search_s_unlock_all(void);
+/*==========================*/
+
+
/** Flag: has the search system been enabled?
Protected by btr_search_latch and btr_search_enabled_mutex. */
extern char btr_search_enabled;
+extern ulint btr_search_index_num;
+
/** Flag: whether the search system has completed its disabling process,
It is set to TRUE right after buf_pool_drop_hash_index() in
btr_search_disable(), indicating hash index entries are cleaned up.
@@ -269,7 +308,7 @@ typedef struct btr_search_sys_struct btr_search_sys_t;
/** The hash index system */
struct btr_search_sys_struct{
- hash_table_t* hash_index; /*!< the adaptive hash index,
+ hash_table_t** hash_index; /*!< the adaptive hash index,
mapping dtuple_fold values
to rec_t pointers on index pages */
};
@@ -290,10 +329,12 @@ but does NOT protect:
Bear in mind (3) and (4) when using the hash index.
*/
-extern rw_lock_t* btr_search_latch_temp;
+//extern rw_lock_t* btr_search_latch_temp;
+
+extern rw_lock_t** btr_search_latch_part;
/** The latch protecting the adaptive search system */
-#define btr_search_latch (*btr_search_latch_temp)
+//#define btr_search_latch (*btr_search_latch_temp)
#ifdef UNIV_SEARCH_PERF_STAT
/** Number of successful adaptive hash index lookups */
diff --git a/storage/xtradb/include/btr0sea.ic b/storage/xtradb/include/btr0sea.ic
index beadeeb8d02..e5a8e1190e3 100644
--- a/storage/xtradb/include/btr0sea.ic
+++ b/storage/xtradb/include/btr0sea.ic
@@ -62,8 +62,8 @@ btr_search_info_update(
btr_search_t* info;
#ifdef UNIV_SYNC_DEBUG
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ ut_ad(!rw_lock_own(btr_search_get_latch(index->id), RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(btr_search_get_latch(index->id), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
info = btr_search_get_info(index);
@@ -82,3 +82,72 @@ btr_search_info_update(
btr_search_info_update_slow(info, cursor);
}
+
+/*********************************************************************//**
+New functions to control split btr_search_index */
+UNIV_INLINE
+hash_table_t*
+btr_search_get_hash_index(
+/*======================*/
+ index_id_t key)
+{
+ return(btr_search_sys->hash_index[key % btr_search_index_num]);
+}
+
+UNIV_INLINE
+rw_lock_t*
+btr_search_get_latch(
+/*=================*/
+ index_id_t key)
+{
+ return(btr_search_latch_part[key % btr_search_index_num]);
+}
+
+UNIV_INLINE
+void
+btr_search_x_lock_all(void)
+/*=======================*/
+{
+ ulint i;
+
+ for (i = 0; i < btr_search_index_num; i++) {
+ rw_lock_x_lock(btr_search_latch_part[i]);
+ }
+}
+
+UNIV_INLINE
+void
+btr_search_x_unlock_all(void)
+/*==========================*/
+{
+ ulint i;
+
+ for (i = 0; i < btr_search_index_num; i++) {
+ rw_lock_x_unlock(btr_search_latch_part[i]);
+ }
+}
+
+UNIV_INLINE
+void
+btr_search_s_lock_all(void)
+/*=======================*/
+{
+ ulint i;
+
+ for (i = 0; i < btr_search_index_num; i++) {
+ rw_lock_s_lock(btr_search_latch_part[i]);
+ }
+}
+
+UNIV_INLINE
+void
+btr_search_s_unlock_all(void)
+/*=========================*/
+{
+ ulint i;
+
+ for (i = 0; i < btr_search_index_num; i++) {
+ rw_lock_s_unlock(btr_search_latch_part[i]);
+ }
+}
+
diff --git a/storage/xtradb/include/btr0types.h b/storage/xtradb/include/btr0types.h
index ef4a6b04b34..07c06fb18d7 100644
--- a/storage/xtradb/include/btr0types.h
+++ b/storage/xtradb/include/btr0types.h
@@ -38,6 +38,131 @@ typedef struct btr_cur_struct btr_cur_t;
/** B-tree search information for the adaptive hash index */
typedef struct btr_search_struct btr_search_t;
+#ifdef UNIV_BLOB_DEBUG
+# include "buf0types.h"
+/** An index->blobs entry for keeping track of off-page column references */
+typedef struct btr_blob_dbg_struct btr_blob_dbg_t;
+
+/** Insert to index->blobs a reference to an off-page column.
+@param index the index tree
+@param b the reference
+@param ctx context (for logging) */
+UNIV_INTERN
+void
+btr_blob_dbg_rbt_insert(
+/*====================*/
+ dict_index_t* index, /*!< in/out: index tree */
+ const btr_blob_dbg_t* b, /*!< in: the reference */
+ const char* ctx) /*!< in: context (for logging) */
+ __attribute__((nonnull));
+
+/** Remove from index->blobs a reference to an off-page column.
+@param index the index tree
+@param b the reference
+@param ctx context (for logging) */
+UNIV_INTERN
+void
+btr_blob_dbg_rbt_delete(
+/*====================*/
+ dict_index_t* index, /*!< in/out: index tree */
+ const btr_blob_dbg_t* b, /*!< in: the reference */
+ const char* ctx) /*!< in: context (for logging) */
+ __attribute__((nonnull));
+
+/**************************************************************//**
+Add to index->blobs any references to off-page columns from a record.
+@return number of references added */
+UNIV_INTERN
+ulint
+btr_blob_dbg_add_rec(
+/*=================*/
+ const rec_t* rec, /*!< in: record */
+ dict_index_t* index, /*!< in/out: index */
+ const ulint* offsets,/*!< in: offsets */
+ const char* ctx) /*!< in: context (for logging) */
+ __attribute__((nonnull));
+/**************************************************************//**
+Remove from index->blobs any references to off-page columns from a record.
+@return number of references removed */
+UNIV_INTERN
+ulint
+btr_blob_dbg_remove_rec(
+/*====================*/
+ const rec_t* rec, /*!< in: record */
+ dict_index_t* index, /*!< in/out: index */
+ const ulint* offsets,/*!< in: offsets */
+ const char* ctx) /*!< in: context (for logging) */
+ __attribute__((nonnull));
+/**************************************************************//**
+Count and add to index->blobs any references to off-page columns
+from records on a page.
+@return number of references added */
+UNIV_INTERN
+ulint
+btr_blob_dbg_add(
+/*=============*/
+ const page_t* page, /*!< in: rewritten page */
+ dict_index_t* index, /*!< in/out: index */
+ const char* ctx) /*!< in: context (for logging) */
+ __attribute__((nonnull));
+/**************************************************************//**
+Count and remove from index->blobs any references to off-page columns
+from records on a page.
+Used when reorganizing a page, before copying the records.
+@return number of references removed */
+UNIV_INTERN
+ulint
+btr_blob_dbg_remove(
+/*================*/
+ const page_t* page, /*!< in: b-tree page */
+ dict_index_t* index, /*!< in/out: index */
+ const char* ctx) /*!< in: context (for logging) */
+ __attribute__((nonnull));
+/**************************************************************//**
+Restore in index->blobs any references to off-page columns
+Used when page reorganize fails due to compressed page overflow. */
+UNIV_INTERN
+void
+btr_blob_dbg_restore(
+/*=================*/
+ const page_t* npage, /*!< in: page that failed to compress */
+ const page_t* page, /*!< in: copy of original page */
+ dict_index_t* index, /*!< in/out: index */
+ const char* ctx) /*!< in: context (for logging) */
+ __attribute__((nonnull));
+
+/** Operation that processes the BLOB references of an index record
+@param[in] rec record on index page
+@param[in/out] index the index tree of the record
+@param[in] offsets rec_get_offsets(rec,index)
+@param[in] ctx context (for logging)
+@return number of BLOB references processed */
+typedef ulint (*btr_blob_dbg_op_f)
+(const rec_t* rec,dict_index_t* index,const ulint* offsets,const char* ctx);
+
+/**************************************************************//**
+Count and process all references to off-page columns on a page.
+@return number of references processed */
+UNIV_INTERN
+ulint
+btr_blob_dbg_op(
+/*============*/
+ const page_t* page, /*!< in: B-tree leaf page */
+ const rec_t* rec, /*!< in: record to start from
+ (NULL to process the whole page) */
+ dict_index_t* index, /*!< in/out: index */
+ const char* ctx, /*!< in: context (for logging) */
+ const btr_blob_dbg_op_f op) /*!< in: operation on records */
+ __attribute__((nonnull(1,3,4,5)));
+#else /* UNIV_BLOB_DEBUG */
+# define btr_blob_dbg_add_rec(rec, index, offsets, ctx) ((void) 0)
+# define btr_blob_dbg_add(page, index, ctx) ((void) 0)
+# define btr_blob_dbg_remove_rec(rec, index, offsets, ctx) ((void) 0)
+# define btr_blob_dbg_remove(page, index, ctx) ((void) 0)
+# define btr_blob_dbg_restore(npage, page, index, ctx) ((void) 0)
+# define btr_blob_dbg_op(page, rec, index, ctx, op) ((void) 0)
+#endif /* UNIV_BLOB_DEBUG */
+
/** The size of a reference to data stored on a different page.
The reference is stored at the end of the prefix of the field
in the index record. */
diff --git a/storage/xtradb/include/buf0buddy.h b/storage/xtradb/include/buf0buddy.h
index 3a35f8e46e9..f51b8020918 100644
--- a/storage/xtradb/include/buf0buddy.h
+++ b/storage/xtradb/include/buf0buddy.h
@@ -36,22 +36,24 @@ Created December 2006 by Marko Makela
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool_mutex and must not hold buf_pool_zip_mutex or any
-block->mutex. The buf_pool_mutex may only be released and reacquired
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any
+block->mutex. The buf_pool->mutex may only be released and reacquired
if lru != NULL. This function should only be used for allocating
compressed page frames or control blocks (buf_page_t). Allocated
control blocks must be properly initialized immediately after
buf_buddy_alloc() has returned the memory, before releasing
-buf_pool_mutex.
+buf_pool->mutex.
@return allocated block, possibly NULL if lru == NULL */
UNIV_INLINE
void*
buf_buddy_alloc(
/*============*/
+ buf_pool_t* buf_pool,
+ /*!< buffer pool in which the block resides */
ulint size, /*!< in: block size, up to UNIV_PAGE_SIZE */
ibool* lru, /*!< in: pointer to a variable that will be assigned
TRUE if storage was allocated from the LRU list
- and buf_pool_mutex was temporarily released,
+ and buf_pool->mutex was temporarily released,
or NULL if the LRU list should not be used */
ibool have_page_hash_mutex)
__attribute__((malloc));
@@ -62,29 +64,14 @@ UNIV_INLINE
void
buf_buddy_free(
/*===========*/
+ buf_pool_t* buf_pool,
+ /*!< buffer pool in which the block resides */
void* buf, /*!< in: block to be freed, must not be
pointed to by the buffer pool */
ulint size, /*!< in: block size, up to UNIV_PAGE_SIZE */
ibool have_page_hash_mutex)
__attribute__((nonnull));
-/** Statistics of buddy blocks of a given size. */
-struct buf_buddy_stat_struct {
- /** Number of blocks allocated from the buddy system. */
- ulint used;
- /** Number of blocks relocated by the buddy system. */
- ib_uint64_t relocated;
- /** Total duration of block relocations, in microseconds. */
- ib_uint64_t relocated_usec;
-};
-
-/** Statistics of buddy blocks of a given size. */
-typedef struct buf_buddy_stat_struct buf_buddy_stat_t;
-
-/** Statistics of the buddy system, indexed by block size.
-Protected by buf_pool_mutex. */
-extern buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES_MAX + 1];
-
#ifndef UNIV_NONINL
# include "buf0buddy.ic"
#endif
diff --git a/storage/xtradb/include/buf0buddy.ic b/storage/xtradb/include/buf0buddy.ic
index 69659fb69d6..4dbfed52abe 100644
--- a/storage/xtradb/include/buf0buddy.ic
+++ b/storage/xtradb/include/buf0buddy.ic
@@ -35,18 +35,20 @@ Created December 2006 by Marko Makela
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool_mutex and must not hold buf_pool_zip_mutex or any block->mutex.
-The buf_pool_mutex may only be released and reacquired if lru != NULL.
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex.
+The buf_pool->mutex may only be released and reacquired if lru != NULL.
@return allocated block, possibly NULL if lru==NULL */
UNIV_INTERN
void*
buf_buddy_alloc_low(
/*================*/
+ buf_pool_t* buf_pool,
+ /*!< in: buffer pool in which the page resides */
ulint i, /*!< in: index of buf_pool->zip_free[],
or BUF_BUDDY_SIZES */
ibool* lru, /*!< in: pointer to a variable that will be assigned
TRUE if storage was allocated from the LRU list
- and buf_pool_mutex was temporarily released,
+ and buf_pool->mutex was temporarily released,
or NULL if the LRU list should not be used */
ibool have_page_hash_mutex)
__attribute__((malloc));
@@ -57,11 +59,12 @@ UNIV_INTERN
void
buf_buddy_free_low(
/*===============*/
- void* buf, /*!< in: block to be freed, must not be
- pointed to by the buffer pool */
- ulint i, /*!< in: index of buf_pool->zip_free[],
- or BUF_BUDDY_SIZES */
- ibool have_page_hash_mutex)
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ void* buf, /*!< in: block to be freed, must not be
+ pointed to by the buffer pool */
+ ulint i, /*!< in: index of buf_pool->zip_free[],
+ or BUF_BUDDY_SIZES */
+ ibool have_page_hash_mutex)
__attribute__((nonnull));
/**********************************************************************//**
@@ -85,28 +88,33 @@ buf_buddy_get_slot(
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool_mutex and must not hold buf_pool_zip_mutex or any
-block->mutex. The buf_pool_mutex may only be released and reacquired
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any
+block->mutex. The buf_pool->mutex may only be released and reacquired
if lru != NULL. This function should only be used for allocating
compressed page frames or control blocks (buf_page_t). Allocated
control blocks must be properly initialized immediately after
buf_buddy_alloc() has returned the memory, before releasing
-buf_pool_mutex.
+buf_pool->mutex.
@return allocated block, possibly NULL if lru == NULL */
UNIV_INLINE
void*
buf_buddy_alloc(
/*============*/
- ulint size, /*!< in: block size, up to UNIV_PAGE_SIZE */
- ibool* lru, /*!< in: pointer to a variable that will be assigned
- TRUE if storage was allocated from the LRU list
- and buf_pool_mutex was temporarily released,
- or NULL if the LRU list should not be used */
- ibool have_page_hash_mutex)
+ buf_pool_t* buf_pool, /*!< in: buffer pool in which
+ the page resides */
+ ulint size, /*!< in: block size, up to
+ UNIV_PAGE_SIZE */
+ ibool* lru, /*!< in: pointer to a variable
+ that will be assigned TRUE if
+ storage was allocated from the
+ LRU list and buf_pool->mutex was
+ temporarily released, or NULL if
+ the LRU list should not be used */
+ ibool have_page_hash_mutex)
{
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
- return(buf_buddy_alloc_low(buf_buddy_get_slot(size), lru, have_page_hash_mutex));
+ return(buf_buddy_alloc_low(buf_pool, buf_buddy_get_slot(size), lru, have_page_hash_mutex));
}
/**********************************************************************//**
@@ -115,25 +123,27 @@ UNIV_INLINE
void
buf_buddy_free(
/*===========*/
- void* buf, /*!< in: block to be freed, must not be
- pointed to by the buffer pool */
- ulint size, /*!< in: block size, up to UNIV_PAGE_SIZE */
- ibool have_page_hash_mutex)
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ void* buf, /*!< in: block to be freed, must not be
+ pointed to by the buffer pool */
+ ulint size, /*!< in: block size, up to
+ UNIV_PAGE_SIZE */
+ ibool have_page_hash_mutex)
{
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
if (!have_page_hash_mutex) {
- mutex_enter(&LRU_list_mutex);
- rw_lock_x_lock(&page_hash_latch);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
}
- mutex_enter(&zip_free_mutex);
- buf_buddy_free_low(buf, buf_buddy_get_slot(size), TRUE);
- mutex_exit(&zip_free_mutex);
+ mutex_enter(&buf_pool->zip_free_mutex);
+ buf_buddy_free_low(buf_pool, buf, buf_buddy_get_slot(size), TRUE);
+ mutex_exit(&buf_pool->zip_free_mutex);
if (!have_page_hash_mutex) {
- mutex_exit(&LRU_list_mutex);
- rw_lock_x_unlock(&page_hash_latch);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
}
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index e06927f42f0..ef6a26f9459 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -33,21 +33,29 @@ Created 11/5/1995 Heikki Tuuri
#include "hash0hash.h"
#include "ut0byte.h"
#include "page0types.h"
-#include "ut0rbt.h"
#ifndef UNIV_HOTBACKUP
+#include "ut0rbt.h"
#include "os0proc.h"
-#include "srv0srv.h"
/** @name Modes for buf_page_get_gen */
/* @{ */
#define BUF_GET 10 /*!< get always */
#define BUF_GET_IF_IN_POOL 11 /*!< get if in pool */
+#define BUF_PEEK_IF_IN_POOL 12 /*!< get if in pool, do not make
+ the block young in the LRU list */
#define BUF_GET_NO_LATCH 14 /*!< get and bufferfix, but
set no latch; we have
separated this case, because
it is error-prone programming
not to set a latch, and it
should be used with care */
+#define BUF_GET_IF_IN_POOL_OR_WATCH 15
+ /*!< Get the page only if it's in the
+ buffer pool, if not then set a watch
+ on the page. */
+#define BUF_GET_POSSIBLY_FREED 16
+ /*!< Like BUF_GET, but do not mind
+ if the file page has been freed. */
/* @} */
/** @name Modes for buf_page_get_known_nowait */
/* @{ */
@@ -60,7 +68,14 @@ Created 11/5/1995 Heikki Tuuri
position of the block. */
/* @} */
-extern buf_pool_t* buf_pool; /*!< The buffer pool of the database */
+#define MAX_BUFFER_POOLS 64 /*!< The maximum number of buffer
+ pools that can be defined */
+
+#define BUF_POOL_WATCH_SIZE 1 /*!< Maximum number of concurrent
+ buffer pool watches */
+
+extern buf_pool_t* buf_pool_ptr; /*!< The buffer pools
+ of the database */
#ifdef UNIV_DEBUG
extern ibool buf_debug_prints;/*!< If this is set TRUE, the program
prints info whenever read or flush
@@ -68,6 +83,8 @@ extern ibool buf_debug_prints;/*!< If this is set TRUE, the program
#endif /* UNIV_DEBUG */
extern ulint srv_buf_pool_write_requests; /*!< variable to count write request
issued */
+extern ulint srv_buf_pool_instances;
+extern ulint srv_buf_pool_curr_size;
#else /* !UNIV_HOTBACKUP */
extern buf_block_t* back_block1; /*!< first block, for --apply-log */
extern buf_block_t* back_block2; /*!< second block, for page reorganize */
@@ -83,6 +100,8 @@ The enumeration values must be 0..7. */
enum buf_page_state {
BUF_BLOCK_ZIP_FREE = 0, /*!< contains a free
compressed page */
+ BUF_BLOCK_POOL_WATCH = 0, /*!< a sentinel for the buffer pool
+ watch, element of buf_pool->watch[] */
BUF_BLOCK_ZIP_PAGE, /*!< contains a clean
compressed page */
BUF_BLOCK_ZIP_DIRTY, /*!< contains a compressed
@@ -102,21 +121,123 @@ enum buf_page_state {
before putting to the free list */
};
+
+/** This structure defines information we will fetch from each buffer pool. It
+will be used to print table IO stats */
+struct buf_pool_info_struct{
+ /* General buffer pool info */
+ ulint pool_unique_id; /*!< Buffer Pool ID */
+ ulint pool_size; /*!< Buffer Pool size in pages */
+ ulint pool_size_bytes;
+ ulint lru_len; /*!< Length of buf_pool->LRU */
+ ulint old_lru_len; /*!< buf_pool->LRU_old_len */
+ ulint free_list_len; /*!< Length of buf_pool->free list */
+ ulint flush_list_len; /*!< Length of buf_pool->flush_list */
+ ulint n_pend_unzip; /*!< buf_pool->n_pend_unzip, pages
+ pending decompress */
+ ulint n_pend_reads; /*!< buf_pool->n_pend_reads, pages
+ pending read */
+ ulint n_pending_flush_lru; /*!< Pages pending flush in LRU */
+ ulint n_pending_flush_list; /*!< Pages pending flush in FLUSH
+ LIST */
+ ulint n_pending_flush_single_page;/*!< Pages pending flush in
+ BUF_FLUSH_SINGLE_PAGE list */
+ ulint n_pages_made_young; /*!< number of pages made young */
+ ulint n_pages_not_made_young; /*!< number of pages not made young */
+ ulint n_pages_read; /*!< buf_pool->n_pages_read */
+ ulint n_pages_created; /*!< buf_pool->n_pages_created */
+ ulint n_pages_written; /*!< buf_pool->n_pages_written */
+ ulint n_page_gets; /*!< buf_pool->n_page_gets */
+ ulint n_ra_pages_read; /*!< buf_pool->n_ra_pages_read, number
+ of pages readahead */
+ ulint n_ra_pages_evicted; /*!< buf_pool->n_ra_pages_evicted,
+ number of readahead pages evicted
+ without access */
+ ulint n_page_get_delta; /*!< num of buffer pool page gets since
+ last printout */
+
+ /* Buffer pool access stats */
+ double page_made_young_rate; /*!< page made young rate in pages
+ per second */
+ double page_not_made_young_rate;/*!< page not made young rate
+ in pages per second */
+ double pages_read_rate; /*!< num of pages read per second */
+ double pages_created_rate; /*!< num of pages create per second */
+ double pages_written_rate; /*!< num of pages written per second */
+ ulint page_read_delta; /*!< num of pages read since last
+ printout */
+ ulint young_making_delta; /*!< num of pages made young since
+ last printout */
+ ulint not_young_making_delta; /*!< num of pages not make young since
+ last printout */
+
+ /* Statistics about read ahead algorithm. */
+ double pages_readahead_rate; /*!< readahead rate in pages per
+ second */
+ double pages_evicted_rate; /*!< rate of readahead page evicted
+ without access, in pages per second */
+
+ /* Stats about LRU eviction */
+ ulint unzip_lru_len; /*!< length of buf_pool->unzip_LRU
+ list */
+ /* Counters for LRU policy */
+ ulint io_sum; /*!< buf_LRU_stat_sum.io */
+ ulint io_cur; /*!< buf_LRU_stat_cur.io, num of IO
+ for current interval */
+ ulint unzip_sum; /*!< buf_LRU_stat_sum.unzip */
+ ulint unzip_cur; /*!< buf_LRU_stat_cur.unzip, num
+ pages decompressed in current
+ interval */
+};
+
+typedef struct buf_pool_info_struct buf_pool_info_t;
+
#ifndef UNIV_HOTBACKUP
/********************************************************************//**
+Acquire mutex on all buffer pool instances */
+UNIV_INLINE
+void
+buf_pool_mutex_enter_all(void);
+/*===========================*/
+
+/********************************************************************//**
+Release mutex on all buffer pool instances */
+UNIV_INLINE
+void
+buf_pool_mutex_exit_all(void);
+/*==========================*/
+
+/********************************************************************//**
+*/
+UNIV_INLINE
+void
+buf_pool_page_hash_x_lock_all(void);
+/*================================*/
+
+/********************************************************************//**
+*/
+UNIV_INLINE
+void
+buf_pool_page_hash_x_unlock_all(void);
+/*==================================*/
+
+/********************************************************************//**
Creates the buffer pool.
@return own: buf_pool object, NULL if not enough memory or error */
UNIV_INTERN
-buf_pool_t*
-buf_pool_init(void);
-/*===============*/
+ulint
+buf_pool_init(
+/*=========*/
+ ulint size, /*!< in: Size of the total pool in bytes */
+ ulint n_instances); /*!< in: Number of instances */
/********************************************************************//**
Frees the buffer pool at shutdown. This must not be invoked before
freeing all mutexes. */
UNIV_INTERN
void
-buf_pool_free(void);
-/*===============*/
+buf_pool_free(
+/*==========*/
+ ulint n_instances); /*!< in: numbere of instances to free */
/********************************************************************//**
Drops the adaptive hash index. To prevent a livelock, this function
@@ -153,23 +274,31 @@ UNIV_INLINE
ulint
buf_pool_get_curr_size(void);
/*========================*/
+/*********************************************************************//**
+Gets the current size of buffer buf_pool in frames.
+@return size in pages */
+UNIV_INLINE
+ulint
+buf_pool_get_n_pages(void);
+/*=======================*/
/********************************************************************//**
Gets the smallest oldest_modification lsn for any page in the pool. Returns
zero if all modified pages have been flushed to disk.
@return oldest modification in pool, zero if none */
-UNIV_INLINE
+UNIV_INTERN
ib_uint64_t
buf_pool_get_oldest_modification(void);
/*==================================*/
/********************************************************************//**
Allocates a buffer block.
@return own: the allocated block, in state BUF_BLOCK_MEMORY */
-UNIV_INLINE
+UNIV_INTERN
buf_block_t*
buf_block_alloc(
/*============*/
- ulint zip_size); /*!< in: compressed page size in bytes,
- or 0 if uncompressed tablespace */
+ buf_pool_t* buf_pool); /*!< in: buffer pool instance,
+ or NULL for round-robin selection
+ of the buffer pool */
/********************************************************************//**
Frees a buffer block which does not contain a file page. */
UNIV_INLINE
@@ -287,7 +416,8 @@ buf_page_get_gen(
ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
buf_block_t* guess, /*!< in: guessed block or NULL */
ulint mode, /*!< in: BUF_GET, BUF_GET_IF_IN_POOL,
- BUF_GET_NO_LATCH */
+ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH or
+ BUF_GET_IF_IN_POOL_OR_WATCH */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mini-transaction */
@@ -337,9 +467,8 @@ void
buf_page_release(
/*=============*/
buf_block_t* block, /*!< in: buffer block */
- ulint rw_latch, /*!< in: RW_S_LATCH, RW_X_LATCH,
+ ulint rw_latch); /*!< in: RW_S_LATCH, RW_X_LATCH,
RW_NO_LATCH */
- mtr_t* mtr); /*!< in: mtr */
/********************************************************************//**
Moves a page to the start of the buffer pool LRU list. This high-level
function can be used to prevent an important page from slipping out of
@@ -371,7 +500,7 @@ buf_reset_check_index_page_at_flush(
/*================================*/
ulint space, /*!< in: space id */
ulint offset);/*!< in: page number */
-#ifdef UNIV_DEBUG_FILE_ACCESSES
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
/********************************************************************//**
Sets file_page_was_freed TRUE if the page is found in the buffer pool.
This function should be called when we free a file page and want the
@@ -396,7 +525,7 @@ buf_page_reset_file_page_was_freed(
/*===============================*/
ulint space, /*!< in: space id */
ulint offset); /*!< in: page number */
-#endif /* UNIV_DEBUG_FILE_ACCESSES */
+#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
/********************************************************************//**
Reads the freed_page_clock of a buffer block.
@return freed_page_clock */
@@ -449,7 +578,7 @@ buf_page_get_newest_modification(
page frame */
/********************************************************************//**
Increments the modify clock of a frame by 1. The caller must (1) own the
-buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock
+buf_pool->mutex and block bufferfix count has to be zero, (2) or own an x-lock
on the block. */
UNIV_INLINE
void
@@ -536,7 +665,8 @@ UNIV_INTERN
buf_block_t*
buf_pool_contains_zip(
/*==================*/
- const void* data); /*!< in: pointer to compressed page */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ const void* data); /*!< in: pointer to compressed page */
#endif /* UNIV_DEBUG */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/*********************************************************************//**
@@ -610,8 +740,15 @@ buf_get_modified_ratio_pct(void);
Refreshes the statistics used to print per-second averages. */
UNIV_INTERN
void
-buf_refresh_io_stats(void);
-/*======================*/
+buf_refresh_io_stats(
+/*=================*/
+ buf_pool_t* buf_pool); /*!< buffer pool instance */
+/**********************************************************************//**
+Refreshes the statistics used to print per-second averages. */
+UNIV_INTERN
+void
+buf_refresh_io_stats_all(void);
+/*=================*/
/*********************************************************************//**
Asserts that all file pages in the buffer are in a replaceable state.
@return TRUE */
@@ -836,7 +973,8 @@ buf_page_set_accessed(
__attribute__((nonnull));
/*********************************************************************//**
Gets the buf_block_t handle of a buffered file block if an uncompressed
-page frame exists, or NULL.
+page frame exists, or NULL. Note: even though bpage is not declared a
+const we don't update its value. It is safe to make this pure.
@return control block, or NULL */
UNIV_INLINE
buf_block_t*
@@ -988,8 +1126,7 @@ UNIV_INTERN
void
buf_page_io_complete(
/*=================*/
- buf_page_t* bpage, /*!< in: pointer to the block in question */
- trx_t* trx);
+ buf_page_t* bpage); /*!< in: pointer to the block in question */
/********************************************************************//**
Calculates a folded value of a file page address to use in the page hash
table.
@@ -1001,15 +1138,81 @@ buf_page_address_fold(
ulint space, /*!< in: space id */
ulint offset) /*!< in: offset of the page within space */
__attribute__((const));
+/********************************************************************//**
+Calculates the index of a buffer pool to the buf_pool[] array.
+@return the position of the buffer pool in buf_pool[] */
+UNIV_INLINE
+ulint
+buf_pool_index(
+/*===========*/
+ const buf_pool_t* buf_pool) /*!< in: buffer pool */
+ __attribute__((nonnull, const));
+/********************************************************************//**
+*/
+UNIV_INTERN
+buf_block_t*
+buf_page_from_array(
+/*================*/
+ buf_pool_t* buf_pool,
+ ulint n_block);
+/******************************************************************//**
+Returns the buffer pool instance given a page instance
+@return buf_pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_from_bpage(
+/*================*/
+ const buf_page_t* bpage); /*!< in: buffer pool page */
+/******************************************************************//**
+Returns the buffer pool instance given a block instance
+@return buf_pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_from_block(
+/*================*/
+ const buf_block_t* block); /*!< in: block */
+/******************************************************************//**
+Returns the buffer pool instance given space and offset of page
+@return buffer pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_get(
+/*==========*/
+ ulint space, /*!< in: space id */
+ ulint offset);/*!< in: offset of the page within space */
+/******************************************************************//**
+Returns the buffer pool instance given its array index
+@return buffer pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_from_array(
+/*================*/
+ ulint index); /*!< in: array index to get
+ buffer pool instance from */
/******************************************************************//**
Returns the control block of a file page, NULL if not found.
@return block, NULL if not found */
UNIV_INLINE
buf_page_t*
+buf_page_hash_get_low(
+/*==================*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ ulint space, /*!< in: space id */
+ ulint offset, /*!< in: offset of the page
+ within space */
+ ulint fold); /*!< in: buf_page_address_fold(
+ space, offset) */
+/******************************************************************//**
+Returns the control block of a file page, NULL if not found.
+@return block, NULL if not found or not a real control block */
+UNIV_INLINE
+buf_page_t*
buf_page_hash_get(
/*==============*/
- ulint space, /*!< in: space id */
- ulint offset);/*!< in: offset of the page within space */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint space, /*!< in: space id */
+ ulint offset); /*!< in: offset of the page
+ within space */
/******************************************************************//**
Returns the control block of a file page, NULL if not found
or an uncompressed page frame does not exist.
@@ -1018,8 +1221,10 @@ UNIV_INLINE
buf_block_t*
buf_block_hash_get(
/*===============*/
- ulint space, /*!< in: space id */
- ulint offset);/*!< in: offset of the page within space */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint space, /*!< in: space id */
+ ulint offset); /*!< in: offset of the page
+ within space */
/*********************************************************************//**
Gets the current length of the free list of buffer blocks.
@return length of the free list */
@@ -1027,8 +1232,67 @@ UNIV_INTERN
ulint
buf_get_free_list_len(void);
/*=======================*/
-#endif /* !UNIV_HOTBACKUP */
+/********************************************************************
+Determine if a block is a sentinel for a buffer pool watch.
+@return TRUE if a sentinel for a buffer pool watch, FALSE if not */
+UNIV_INTERN
+ibool
+buf_pool_watch_is_sentinel(
+/*=======================*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ const buf_page_t* bpage) /*!< in: block */
+ __attribute__((nonnull, warn_unused_result));
+/****************************************************************//**
+Add watch for the given page to be read in. Caller must have the buffer pool
+@return NULL if watch set, block if the page is in the buffer pool */
+UNIV_INTERN
+buf_page_t*
+buf_pool_watch_set(
+/*===============*/
+ ulint space, /*!< in: space id */
+ ulint offset, /*!< in: page number */
+ ulint fold) /*!< in: buf_page_address_fold(space, offset) */
+ __attribute__((warn_unused_result));
+/****************************************************************//**
+Stop watching if the page has been read in.
+buf_pool_watch_set(space,offset) must have returned NULL before. */
+UNIV_INTERN
+void
+buf_pool_watch_unset(
+/*=================*/
+ ulint space, /*!< in: space id */
+ ulint offset);/*!< in: page number */
+/****************************************************************//**
+Check if the page has been read in.
+This may only be called after buf_pool_watch_set(space,offset)
+has returned NULL and before invoking buf_pool_watch_unset(space,offset).
+@return FALSE if the given page was not read in, TRUE if it was */
+UNIV_INTERN
+ibool
+buf_pool_watch_occurred(
+/*====================*/
+ ulint space, /*!< in: space id */
+ ulint offset) /*!< in: page number */
+ __attribute__((warn_unused_result));
+/********************************************************************//**
+Get total buffer pool statistics. */
+UNIV_INTERN
+void
+buf_get_total_list_len(
+/*===================*/
+ ulint* LRU_len, /*!< out: length of all LRU lists */
+ ulint* free_len, /*!< out: length of all free lists */
+ ulint* flush_list_len);/*!< out: length of all flush lists */
+/********************************************************************//**
+Get total buffer pool statistics. */
+UNIV_INTERN
+void
+buf_get_total_stat(
+/*===============*/
+ buf_pool_stat_t*tot_stat); /*!< out: buffer pool stats */
+
+#endif /* !UNIV_HOTBACKUP */
/** The common buffer control block structure
for compressed and uncompressed frames */
@@ -1037,18 +1301,18 @@ struct buf_page_struct{
/** @name General fields
None of these bit-fields must be modified without holding
buf_page_get_mutex() [buf_block_struct::mutex or
- buf_pool_zip_mutex], since they can be stored in the same
+ buf_pool->zip_mutex], since they can be stored in the same
machine word. Some of these fields are additionally protected
- by buf_pool_mutex. */
+ by buf_pool->mutex. */
/* @{ */
unsigned space:32; /*!< tablespace id; also protected
- by buf_pool_mutex. */
+ by buf_pool->mutex. */
unsigned offset:32; /*!< page number; also protected
- by buf_pool_mutex. */
+ by buf_pool->mutex. */
unsigned state:3; /*!< state of the control block; also
- protected by buf_pool_mutex.
+ protected by buf_pool->mutex.
State transitions from
BUF_BLOCK_READY_FOR_USE to
BUF_BLOCK_MEMORY need not be
@@ -1060,15 +1324,23 @@ struct buf_page_struct{
flush_type.
@see enum buf_flush */
unsigned io_fix:2; /*!< type of pending I/O operation;
- also protected by buf_pool_mutex
+ also protected by buf_pool->mutex
@see enum buf_io_fix */
- unsigned buf_fix_count:25;/*!< count of how manyfold this block
+ unsigned buf_fix_count:19;/*!< count of how manyfold this block
is currently bufferfixed */
+ unsigned buf_pool_index:6;/*!< index number of the buffer pool
+ that this block belongs to */
+# if MAX_BUFFER_POOLS > 64
+# error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6"
+# endif
/* @} */
#endif /* !UNIV_HOTBACKUP */
page_zip_des_t zip; /*!< compressed page; zip.data
(but not the data it points to) is
- also protected by buf_pool_mutex */
+ also protected by buf_pool->mutex;
+ state == BUF_BLOCK_ZIP_PAGE and
+ zip.data == NULL means an active
+ buf_pool->watch */
#ifndef UNIV_HOTBACKUP
buf_page_t* hash; /*!< node used in chaining to
buf_pool->page_hash or
@@ -1079,14 +1351,16 @@ struct buf_page_struct{
#endif /* UNIV_DEBUG */
/** @name Page flushing fields
- All these are protected by buf_pool_mutex. */
+ All these are protected by buf_pool->mutex. */
/* @{ */
/* UT_LIST_NODE_T(buf_page_t) list; */
/*!< based on state, this is a
- list node, protected only by
- buf_pool_mutex, in one of the
- following lists in buf_pool:
+ list node, protected either by
+ buf_pool->mutex or by
+ buf_pool->flush_list_mutex,
+ in one of the following lists in
+ buf_pool:
- BUF_BLOCK_NOT_USED: free
- BUF_BLOCK_FILE_PAGE: flush_list
@@ -1094,6 +1368,12 @@ struct buf_page_struct{
- BUF_BLOCK_ZIP_PAGE: zip_clean
- BUF_BLOCK_ZIP_FREE: zip_free[]
+ If bpage is part of flush_list
+ then the node pointers are
+ covered by buf_pool->flush_list_mutex.
+ Otherwise these pointers are
+ protected by buf_pool->mutex.
+
The contents of the list node
is undefined if !in_flush_list
&& state == BUF_BLOCK_FILE_PAGE,
@@ -1108,12 +1388,18 @@ struct buf_page_struct{
UT_LIST_NODE_T(buf_page_t) zip_list; /* zip_clean or zip_free[] */
#ifdef UNIV_DEBUG
ibool in_flush_list; /*!< TRUE if in buf_pool->flush_list;
- when buf_pool_mutex is free, the
- following should hold: in_flush_list
+ when buf_pool->flush_list_mutex is
+ free, the following should hold:
+ in_flush_list
== (state == BUF_BLOCK_FILE_PAGE
- || state == BUF_BLOCK_ZIP_DIRTY) */
+ || state == BUF_BLOCK_ZIP_DIRTY)
+ Writes to this field must be
+ covered by both block->mutex
+ and buf_pool->flush_list_mutex. Hence
+ reads can happen while holding
+ any one of the two mutexes */
ibool in_free_list; /*!< TRUE if in buf_pool->free; when
- buf_pool_mutex is free, the following
+ buf_pool->mutex is free, the following
should hold: in_free_list
== (state == BUF_BLOCK_NOT_USED) */
#endif /* UNIV_DEBUG */
@@ -1121,7 +1407,8 @@ struct buf_page_struct{
/*!< log sequence number of
the youngest modification to
this block, zero if not
- modified */
+ modified. Protected by block
+ mutex */
ib_uint64_t oldest_modification;
/*!< log sequence number of
the START of the log entry
@@ -1129,11 +1416,16 @@ struct buf_page_struct{
modification to this block
which has not yet been flushed
on disk; zero if all
- modifications are on disk */
+ modifications are on disk.
+ Writes to this field must be
+ covered by both block->mutex
+ and buf_pool->flush_list_mutex. Hence
+ reads can happen while holding
+ any one of the two mutexes */
/* @} */
/** @name LRU replacement algorithm fields
- These fields are protected by buf_pool_mutex only (not
- buf_pool_zip_mutex or buf_block_struct::mutex). */
+ These fields are protected by buf_pool->mutex only (not
+ buf_pool->zip_mutex or buf_block_struct::mutex). */
/* @{ */
UT_LIST_NODE_T(buf_page_t) LRU;
@@ -1157,12 +1449,13 @@ struct buf_page_struct{
0 if the block was never accessed
in the buffer pool */
/* @} */
+ ibool space_was_being_deleted;
ibool is_corrupt;
-# ifdef UNIV_DEBUG_FILE_ACCESSES
+# if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ibool file_page_was_freed;
/*!< this is set to TRUE when fsp
frees a page in buffer pool */
-# endif /* UNIV_DEBUG_FILE_ACCESSES */
+# endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
};
@@ -1203,7 +1496,7 @@ struct buf_block_struct{
unsigned lock_hash_val:32;/*!< hashed value of the page address
in the record lock hash table;
protected by buf_block_t::lock
- (or buf_block_t::mutex, buf_pool_mutex
+ (or buf_block_t::mutex, buf_pool->mutex
in buf_page_get_gen(),
buf_page_init_for_read()
and buf_page_create()) */
@@ -1264,7 +1557,7 @@ struct buf_block_struct{
pointers in the adaptive hash index
pointing to this frame */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
- unsigned is_hashed:1; /*!< TRUE if hash index has
+ volatile unsigned is_hashed:1; /*!< TRUE if hash index has
already been built on this
page; note that it does not
guarantee that the index is
@@ -1278,6 +1571,7 @@ struct buf_block_struct{
unsigned curr_left_side:1;/*!< TRUE or FALSE in hash indexing */
dict_index_t* index; /*!< Index for which the adaptive
hash index has been created. */
+ volatile rw_lock_t* btr_search_latch;
/* @} */
# ifdef UNIV_SYNC_DEBUG
/** @name Debug fields */
@@ -1302,10 +1596,7 @@ struct buf_block_struct{
/**********************************************************************//**
Compute the hash fold value for blocks in buf_pool->zip_hash. */
/* @{ */
-/* the fold should be relative when srv_buffer_pool_shm_key is enabled */
-#define BUF_POOL_ZIP_FOLD_PTR(ptr) (!srv_buffer_pool_shm_key\
- ?((ulint) (ptr) / UNIV_PAGE_SIZE)\
- :((ulint) ((byte*)ptr - (byte*)(buf_pool->chunks->blocks->frame)) / UNIV_PAGE_SIZE))
+#define BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE)
#define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame)
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
/* @} */
@@ -1344,6 +1635,16 @@ struct buf_pool_stat_struct{
buf_page_peek_if_too_old() */
};
+/** Statistics of buddy blocks of a given size. */
+struct buf_buddy_stat_struct {
+ /** Number of blocks allocated from the buddy system. */
+ ulint used;
+ /** Number of blocks relocated by the buddy system. */
+ ib_uint64_t relocated;
+ /** Total duration of block relocations, in microseconds. */
+ ib_uint64_t relocated_usec;
+};
+
/** @brief The buffer pool structure.
NOTE! The definition appears here only for other modules of this
@@ -1353,7 +1654,30 @@ struct buf_pool_struct{
/** @name General fields */
/* @{ */
-
+ mutex_t mutex; /*!< Buffer pool mutex of this
+ instance */
+ mutex_t zip_mutex; /*!< Zip mutex of this buffer
+ pool instance, protects compressed
+ only pages (of type buf_page_t, not
+ buf_block_t */
+ mutex_t LRU_list_mutex;
+ rw_lock_t page_hash_latch;
+ mutex_t free_list_mutex;
+ mutex_t zip_free_mutex;
+ mutex_t zip_hash_mutex;
+ ulint instance_no; /*!< Array index of this buffer
+ pool instance */
+ ulint old_pool_size; /*!< Old pool size in bytes */
+ ulint curr_pool_size; /*!< Current pool size in bytes */
+ ulint LRU_old_ratio; /*!< Reserve this much of the buffer
+ pool for "old" blocks */
+#ifdef UNIV_DEBUG
+ ulint buddy_n_frames; /*!< Number of frames allocated from
+ the buffer pool to the buddy system */
+#endif
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
+ ulint mutex_exit_forbidden; /*!< Forbid release mutex */
+#endif
ulint n_chunks; /*!< number of buffer pool chunks */
buf_chunk_t* chunks; /*!< buffer pool chunks */
ulint curr_size; /*!< current pool size in pages */
@@ -1365,12 +1689,16 @@ struct buf_pool_struct{
whose frames are allocated to the
zip buddy system,
indexed by block->frame */
- ulint n_pend_reads; /*!< number of pending read operations */
+ ulint n_pend_reads; /*!< number of pending read
+ operations */
ulint n_pend_unzip; /*!< number of pending decompressions */
time_t last_printout_time;
/*!< when buf_print_io was last time
called */
+ buf_buddy_stat_t buddy_stat[BUF_BUDDY_SIZES_MAX + 1];
+ /*!< Statistics of buddy system,
+ indexed by block size */
buf_pool_stat_t stat; /*!< current statistics */
buf_pool_stat_t old_stat; /*!< old statistics */
@@ -1380,6 +1708,13 @@ struct buf_pool_struct{
/* @{ */
+ mutex_t flush_list_mutex;/*!< mutex protecting the
+ flush list access. This mutex
+ protects flush_list, flush_rbt
+ and bpage::list pointers when
+ the bpage is on flush_list. It
+ also protects writes to
+ bpage::oldest_modification */
UT_LIST_BASE_NODE_T(buf_page_t) flush_list;
/*!< base node of the modified block
list */
@@ -1393,7 +1728,7 @@ struct buf_pool_struct{
/*!< this is in the set state
when there is no flush batch
of the given type running */
- ib_rbt_t* flush_rbt; /* !< a red-black tree is used
+ ib_rbt_t* flush_rbt; /*!< a red-black tree is used
exclusively during recovery to
speed up insertions in the
flush_list. This tree contains
@@ -1405,7 +1740,8 @@ struct buf_pool_struct{
also be on the flush_list.
This tree is relevant only in
recovery and is set to NULL
- once the recovery is over. */
+ once the recovery is over.
+ Protected by flush_list_mutex */
ulint freed_page_clock;/*!< a sequence number used
to count the number of buffer
blocks removed from the end of
@@ -1419,8 +1755,8 @@ struct buf_pool_struct{
this is incremented by one; this is
set to zero when a buffer block is
allocated */
-
/* @} */
+
/** @name LRU replacement algorithm fields */
/* @{ */
@@ -1458,6 +1794,12 @@ struct buf_pool_struct{
/*!< unmodified compressed pages */
UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES_MAX];
/*!< buddy free lists */
+
+ buf_page_t watch[BUF_POOL_WATCH_SIZE];
+ /*!< Sentinel records for buffer
+ pool watches. Protected by
+ buf_pool->mutex. */
+
//#if BUF_BUDDY_HIGH != UNIV_PAGE_SIZE
//# error "BUF_BUDDY_HIGH != UNIV_PAGE_SIZE"
//#endif
@@ -1467,58 +1809,56 @@ struct buf_pool_struct{
/* @} */
};
-/** mutex protecting the buffer pool struct and control blocks, except the
-read-write lock in them */
-extern mutex_t buf_pool_mutex;
-extern mutex_t LRU_list_mutex;
-extern mutex_t flush_list_mutex;
-extern rw_lock_t page_hash_latch;
-extern mutex_t free_list_mutex;
-extern mutex_t zip_free_mutex;
-extern mutex_t zip_hash_mutex;
-/** mutex protecting the control blocks of compressed-only pages
-(of type buf_page_t, not buf_block_t) */
-extern mutex_t buf_pool_zip_mutex;
-
-/** @name Accessors for buf_pool_mutex.
-Use these instead of accessing buf_pool_mutex directly. */
+/** @name Accessors for buf_pool->mutex.
+Use these instead of accessing buf_pool->mutex directly. */
/* @{ */
-/** Test if buf_pool_mutex is owned. */
-#define buf_pool_mutex_own() mutex_own(&buf_pool_mutex)
-/** Acquire the buffer pool mutex. */
-#define buf_pool_mutex_enter() do { \
- ut_ad(!mutex_own(&buf_pool_zip_mutex)); \
- mutex_enter(&buf_pool_mutex); \
+/** Test if a buffer pool mutex is owned. */
+#define buf_pool_mutex_own(b) mutex_own(&b->mutex)
+/** Acquire a buffer pool mutex. */
+/* the buf_pool_mutex is changed the latch order */
+#define buf_pool_mutex_enter(b) do { \
+ mutex_enter(&b->mutex); \
+} while (0)
+
+/** Test if flush list mutex is owned. */
+#define buf_flush_list_mutex_own(b) mutex_own(&b->flush_list_mutex)
+
+/** Acquire the flush list mutex. */
+#define buf_flush_list_mutex_enter(b) do { \
+ mutex_enter(&b->flush_list_mutex); \
+} while (0)
+/** Release the flush list mutex. */
+# define buf_flush_list_mutex_exit(b) do { \
+ mutex_exit(&b->flush_list_mutex); \
} while (0)
+
+
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
-/** Flag to forbid the release of the buffer pool mutex.
-Protected by buf_pool_mutex. */
-extern ulint buf_pool_mutex_exit_forbidden;
/** Forbid the release of the buffer pool mutex. */
-# define buf_pool_mutex_exit_forbid() do { \
- ut_ad(buf_pool_mutex_own()); \
- buf_pool_mutex_exit_forbidden++; \
+# define buf_pool_mutex_exit_forbid(b) do { \
+ ut_ad(buf_pool_mutex_own(b)); \
+ b->mutex_exit_forbidden++; \
} while (0)
/** Allow the release of the buffer pool mutex. */
-# define buf_pool_mutex_exit_allow() do { \
- ut_ad(buf_pool_mutex_own()); \
- ut_a(buf_pool_mutex_exit_forbidden); \
- buf_pool_mutex_exit_forbidden--; \
+# define buf_pool_mutex_exit_allow(b) do { \
+ ut_ad(buf_pool_mutex_own(b)); \
+ ut_a(b->mutex_exit_forbidden); \
+ b->mutex_exit_forbidden--; \
} while (0)
/** Release the buffer pool mutex. */
-# define buf_pool_mutex_exit() do { \
- ut_a(!buf_pool_mutex_exit_forbidden); \
- mutex_exit(&buf_pool_mutex); \
+# define buf_pool_mutex_exit(b) do { \
+ ut_a(!b->mutex_exit_forbidden); \
+ mutex_exit(&b->mutex); \
} while (0)
#else
/** Forbid the release of the buffer pool mutex. */
-# define buf_pool_mutex_exit_forbid() ((void) 0)
+# define buf_pool_mutex_exit_forbid(b) ((void) 0)
/** Allow the release of the buffer pool mutex. */
-# define buf_pool_mutex_exit_allow() ((void) 0)
+# define buf_pool_mutex_exit_allow(b) ((void) 0)
/** Release the buffer pool mutex. */
-# define buf_pool_mutex_exit() mutex_exit(&buf_pool_mutex)
+# define buf_pool_mutex_exit(b) mutex_exit(&b->mutex)
#endif
#endif /* !UNIV_HOTBACKUP */
/* @} */
diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic
index 93cc68e7fc9..1a96b575d9b 100644
--- a/storage/xtradb/include/buf0buf.ic
+++ b/storage/xtradb/include/buf0buf.ic
@@ -31,11 +31,74 @@ Created 11/5/1995 Heikki Tuuri
*******************************************************/
#include "mtr0mtr.h"
-#ifndef UNIV_HOTBACKUP
#include "buf0flu.h"
#include "buf0lru.h"
#include "buf0rea.h"
#include "srv0srv.h"
+/*********************************************************************//**
+Gets the current size of buffer buf_pool in bytes.
+@return size in bytes */
+UNIV_INLINE
+ulint
+buf_pool_get_curr_size(void)
+/*========================*/
+{
+ return(srv_buf_pool_curr_size);
+}
+
+/********************************************************************//**
+Calculates the index of a buffer pool to the buf_pool[] array.
+@return the position of the buffer pool in buf_pool[] */
+UNIV_INLINE
+ulint
+buf_pool_index(
+/*===========*/
+ const buf_pool_t* buf_pool) /*!< in: buffer pool */
+{
+ ulint i = buf_pool - buf_pool_ptr;
+ ut_ad(i < MAX_BUFFER_POOLS);
+ ut_ad(i < srv_buf_pool_instances);
+ return(i);
+}
+
+/******************************************************************//**
+Returns the buffer pool instance given a page instance
+@return buf_pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_from_bpage(
+/*================*/
+ const buf_page_t* bpage) /*!< in: buffer pool page */
+{
+ ulint i;
+ i = bpage->buf_pool_index;
+ ut_ad(i < srv_buf_pool_instances);
+ return(&buf_pool_ptr[i]);
+}
+
+/******************************************************************//**
+Returns the buffer pool instance given a block instance
+@return buf_pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_from_block(
+/*================*/
+ const buf_block_t* block) /*!< in: block */
+{
+ return(buf_pool_from_bpage(&block->page));
+}
+
+/*********************************************************************//**
+Gets the current size of buffer buf_pool in pages.
+@return size in pages*/
+UNIV_INLINE
+ulint
+buf_pool_get_n_pages(void)
+/*======================*/
+{
+ return(buf_pool_get_curr_size() / UNIV_PAGE_SIZE);
+}
+
/********************************************************************//**
Reads the freed_page_clock of a buffer block.
@return freed_page_clock */
@@ -45,7 +108,7 @@ buf_page_get_freed_page_clock(
/*==========================*/
const buf_page_t* bpage) /*!< in: block */
{
- /* This is sometimes read without holding buf_pool_mutex. */
+ /* This is sometimes read without holding buf_pool->mutex. */
return(bpage->freed_page_clock);
}
@@ -72,6 +135,8 @@ buf_page_peek_if_too_old(
/*=====================*/
const buf_page_t* bpage) /*!< in: block to make younger */
{
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
if (UNIV_UNLIKELY(buf_pool->freed_page_clock == 0)) {
/* If eviction has not started yet, do not update the
statistics or move blocks in the LRU list. This is
@@ -93,62 +158,12 @@ buf_page_peek_if_too_old(
return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
> ((ulint) bpage->freed_page_clock
+ (buf_pool->curr_size
- * (BUF_LRU_OLD_RATIO_DIV - buf_LRU_old_ratio)
+ * (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio)
/ (BUF_LRU_OLD_RATIO_DIV * 4))));
}
}
/*********************************************************************//**
-Gets the current size of buffer buf_pool in bytes.
-@return size in bytes */
-UNIV_INLINE
-ulint
-buf_pool_get_curr_size(void)
-/*========================*/
-{
- return(buf_pool->curr_size * UNIV_PAGE_SIZE);
-}
-
-/********************************************************************//**
-Gets the smallest oldest_modification lsn for any page in the pool. Returns
-zero if all modified pages have been flushed to disk.
-@return oldest modification in pool, zero if none */
-UNIV_INLINE
-ib_uint64_t
-buf_pool_get_oldest_modification(void)
-/*==================================*/
-{
- buf_page_t* bpage;
- ib_uint64_t lsn;
-
-try_again:
- //buf_pool_mutex_enter();
- mutex_enter(&flush_list_mutex);
-
- bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
-
- if (bpage == NULL) {
- lsn = 0;
- } else {
- ut_ad(bpage->in_flush_list);
- lsn = bpage->oldest_modification;
- if (lsn == 0) {
- mutex_exit(&flush_list_mutex);
- goto try_again;
- }
- }
-
- //buf_pool_mutex_exit();
- mutex_exit(&flush_list_mutex);
-
- /* The returned answer may be out of date: the flush_list can
- change after the mutex has been released. */
-
- return(lsn);
-}
-#endif /* !UNIV_HOTBACKUP */
-
-/*********************************************************************//**
Gets the state of a block.
@return state */
UNIV_INLINE
@@ -300,13 +315,22 @@ buf_page_get_mutex(
/*===============*/
const buf_page_t* bpage) /*!< in: pointer to control block */
{
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+
+ if (/*equivalent to buf_pool_watch_is_sentinel(buf_pool, bpage)*/
+ bpage >= &buf_pool->watch[0]
+ && bpage < &buf_pool->watch[BUF_POOL_WATCH_SIZE]) {
+ /* TODO: this code is the interim. should be confirmed later. */
+ return(&buf_pool->zip_mutex);
+ }
+
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
/* ut_error; */ /* optimistic */
return(NULL);
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
- return(&buf_pool_zip_mutex);
+ return(&buf_pool->zip_mutex);
default:
return(&((buf_block_t*) bpage)->mutex);
}
@@ -384,6 +408,7 @@ buf_block_set_file_page(
buf_block_set_state(block, BUF_BLOCK_FILE_PAGE);
block->page.space = space;
block->page.offset = page_no;
+ block->page.space_was_being_deleted = FALSE;
}
/*********************************************************************//**
@@ -414,7 +439,7 @@ Gets the io_fix state of a block.
UNIV_INLINE
enum buf_io_fix
buf_block_get_io_fix(
-/*================*/
+/*=================*/
const buf_block_t* block) /*!< in: pointer to the control block */
{
return(buf_page_get_io_fix(&block->page));
@@ -429,7 +454,10 @@ buf_page_set_io_fix(
buf_page_t* bpage, /*!< in/out: control block */
enum buf_io_fix io_fix) /*!< in: io_fix state */
{
- //ut_ad(buf_pool_mutex_own());
+#ifdef UNIV_DEBUG
+ //buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+#endif
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
bpage->io_fix = io_fix;
@@ -457,10 +485,12 @@ buf_page_can_relocate(
/*==================*/
const buf_page_t* bpage) /*!< control block being relocated */
{
- //ut_ad(buf_pool_mutex_own());
+#ifdef UNIV_DEBUG
+ //buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+#endif
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(buf_page_in_file(bpage));
- /* optimistic */
//ut_ad(bpage->in_LRU_list);
return(bpage->in_LRU_list && bpage->io_fix == BUF_IO_NONE
@@ -476,8 +506,11 @@ buf_page_is_old(
/*============*/
const buf_page_t* bpage) /*!< in: control block */
{
+#ifdef UNIV_DEBUG
+ //buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+#endif
ut_ad(buf_page_in_file(bpage));
- //ut_ad(buf_pool_mutex_own()); /* This is used in optimistic */
return(bpage->old);
}
@@ -491,9 +524,12 @@ buf_page_set_old(
buf_page_t* bpage, /*!< in/out: control block */
ibool old) /*!< in: old */
{
+#ifdef UNIV_DEBUG
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+#endif /* UNIV_DEBUG */
ut_a(buf_page_in_file(bpage));
- //ut_ad(buf_pool_mutex_own());
- ut_ad(mutex_own(&LRU_list_mutex));
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_ad(bpage->in_LRU_list);
#ifdef UNIV_LRU_DEBUG
@@ -539,9 +575,12 @@ buf_page_set_accessed(
buf_page_t* bpage, /*!< in/out: control block */
ulint time_ms) /*!< in: ut_time_ms() */
{
- ut_a(buf_page_in_file(bpage));
- //ut_ad(buf_pool_mutex_own());
+#ifdef UNIV_DEBUG
+ //buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ //ut_ad(buf_pool_mutex_own(buf_pool));
+#endif
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
+ ut_a(buf_page_in_file(bpage));
if (!bpage->access_time) {
/* Make this the time of the first access. */
@@ -753,25 +792,6 @@ buf_block_get_lock_hash_val(
}
/********************************************************************//**
-Allocates a buffer block.
-@return own: the allocated block, in state BUF_BLOCK_MEMORY */
-UNIV_INLINE
-buf_block_t*
-buf_block_alloc(
-/*============*/
- ulint zip_size) /*!< in: compressed page size in bytes,
- or 0 if uncompressed tablespace */
-{
- buf_block_t* block;
-
- block = buf_LRU_get_free_block(zip_size);
-
- buf_block_set_state(block, BUF_BLOCK_MEMORY);
-
- return(block);
-}
-
-/********************************************************************//**
Frees a buffer block which does not contain a file page. */
UNIV_INLINE
void
@@ -779,7 +799,9 @@ buf_block_free(
/*===========*/
buf_block_t* block) /*!< in, own: block to be freed */
{
- //buf_pool_mutex_enter();
+ //buf_pool_t* buf_pool = buf_pool_from_bpage((buf_page_t*)block);
+
+ //buf_pool_mutex_enter(buf_pool);
mutex_enter(&block->mutex);
@@ -789,7 +811,7 @@ buf_block_free(
mutex_exit(&block->mutex);
- //buf_pool_mutex_exit();
+ //buf_pool_mutex_exit(buf_pool);
}
#endif /* !UNIV_HOTBACKUP */
@@ -863,7 +885,9 @@ buf_block_modify_clock_inc(
buf_block_t* block) /*!< in: block */
{
#ifdef UNIV_SYNC_DEBUG
- ut_ad((mutex_own(&LRU_list_mutex)
+ buf_pool_t* buf_pool = buf_pool_from_bpage((buf_page_t*)block);
+
+ ut_ad((mutex_own(&buf_pool->LRU_list_mutex)
&& (block->page.buf_fix_count == 0))
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /* UNIV_SYNC_DEBUG */
@@ -942,29 +966,66 @@ buf_block_buf_fix_dec(
}
/******************************************************************//**
+Returns the buffer pool instance given space and offset of page
+@return buffer pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_get(
+/*==========*/
+ ulint space, /*!< in: space id */
+ ulint offset) /*!< in: offset of the page within space */
+{
+ ulint fold;
+ ulint index;
+ ulint ignored_offset;
+
+ ignored_offset = offset >> 6; /* 2log of BUF_READ_AHEAD_AREA (64)*/
+ fold = buf_page_address_fold(space, ignored_offset);
+ index = fold % srv_buf_pool_instances;
+ return(&buf_pool_ptr[index]);
+}
+
+/******************************************************************//**
+Returns the buffer pool instance given its array index
+@return buffer pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_from_array(
+/*================*/
+ ulint index) /*!< in: array index to get
+ buffer pool instance from */
+{
+ ut_ad(index < MAX_BUFFER_POOLS);
+ ut_ad(index < srv_buf_pool_instances);
+ return(&buf_pool_ptr[index]);
+}
+
+/******************************************************************//**
Returns the control block of a file page, NULL if not found.
@return block, NULL if not found */
UNIV_INLINE
buf_page_t*
-buf_page_hash_get(
-/*==============*/
- ulint space, /*!< in: space id */
- ulint offset) /*!< in: offset of the page within space */
+buf_page_hash_get_low(
+/*==================*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ ulint space, /*!< in: space id */
+ ulint offset, /*!< in: offset of the page
+ within space */
+ ulint fold) /*!< in: buf_page_address_fold(
+ space, offset) */
{
buf_page_t* bpage;
- ulint fold;
ut_ad(buf_pool);
- //ut_ad(buf_pool_mutex_own());
+ //ut_ad(buf_pool_mutex_own(buf_pool));
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&page_hash_latch, RW_LOCK_EX)
- || rw_lock_own(&page_hash_latch, RW_LOCK_SHARED));
+ ut_ad(rw_lock_own(&buf_pool->page_hash_latch, RW_LOCK_EX)
+ || rw_lock_own(&buf_pool->page_hash_latch, RW_LOCK_SHARED));
#endif
+ ut_ad(fold == buf_page_address_fold(space, offset));
/* Look for the page in the hash table */
- fold = buf_page_address_fold(space, offset);
-
HASH_SEARCH(hash, buf_pool->page_hash, fold, buf_page_t*, bpage,
ut_ad(bpage->in_page_hash && !bpage->in_zip_hash
&& buf_page_in_file(bpage)),
@@ -985,6 +1046,30 @@ buf_page_hash_get(
}
/******************************************************************//**
+Returns the control block of a file page, NULL if not found.
+@return block, NULL if not found or not a real control block */
+UNIV_INLINE
+buf_page_t*
+buf_page_hash_get(
+/*==============*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint space, /*!< in: space id */
+ ulint offset) /*!< in: offset of the page
+ within space */
+{
+ buf_page_t* bpage;
+ ulint fold = buf_page_address_fold(space, offset);
+
+ bpage = buf_page_hash_get_low(buf_pool, space, offset, fold);
+
+ if (bpage && buf_pool_watch_is_sentinel(buf_pool, bpage)) {
+ bpage = NULL;
+ }
+
+ return(bpage);
+}
+
+/******************************************************************//**
Returns the control block of a file page, NULL if not found
or an uncompressed page frame does not exist.
@return block, NULL if not found */
@@ -992,10 +1077,16 @@ UNIV_INLINE
buf_block_t*
buf_block_hash_get(
/*===============*/
- ulint space, /*!< in: space id */
- ulint offset) /*!< in: offset of the page within space */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint space, /*!< in: space id */
+ ulint offset) /*!< in: offset of the page
+ within space */
{
- return(buf_page_get_block(buf_page_hash_get(space, offset)));
+ buf_block_t* block;
+
+ block = buf_page_get_block(buf_page_hash_get(buf_pool, space, offset));
+
+ return(block);
}
/********************************************************************//**
@@ -1013,14 +1104,15 @@ buf_page_peek(
ulint offset) /*!< in: page number */
{
const buf_page_t* bpage;
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
- //buf_pool_mutex_enter();
- rw_lock_s_lock(&page_hash_latch);
+ //buf_pool_mutex_enter(buf_pool);
+ rw_lock_s_lock(&buf_pool->page_hash_latch);
- bpage = buf_page_hash_get(space, offset);
+ bpage = buf_page_hash_get(buf_pool, space, offset);
- //buf_pool_mutex_exit();
- rw_lock_s_unlock(&page_hash_latch);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
return(bpage != NULL);
}
@@ -1034,6 +1126,7 @@ buf_page_release_zip(
buf_page_t* bpage) /*!< in: buffer block */
{
buf_block_t* block;
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(bpage);
ut_a(bpage->buf_fix_count > 0);
@@ -1041,9 +1134,9 @@ buf_page_release_zip(
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
- mutex_enter(&buf_pool_zip_mutex);
+ mutex_enter(&buf_pool->zip_mutex);
bpage->buf_fix_count--;
- mutex_exit(&buf_pool_zip_mutex);
+ mutex_exit(&buf_pool->zip_mutex);
return;
case BUF_BLOCK_FILE_PAGE:
block = (buf_block_t*) bpage;
@@ -1062,6 +1155,7 @@ buf_page_release_zip(
break;
}
+
ut_error;
}
@@ -1073,24 +1167,14 @@ void
buf_page_release(
/*=============*/
buf_block_t* block, /*!< in: buffer block */
- ulint rw_latch, /*!< in: RW_S_LATCH, RW_X_LATCH,
+ ulint rw_latch) /*!< in: RW_S_LATCH, RW_X_LATCH,
RW_NO_LATCH */
- mtr_t* mtr __attribute__((unused))) /*!< in: mtr */
{
ut_ad(block);
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
ut_a(block->page.buf_fix_count > 0);
- /* buf_flush_note_modification() should be called before this function. */
-/*
- if (rw_latch == RW_X_LATCH && mtr->modifications) {
- buf_pool_mutex_enter();
- buf_flush_note_modification(block, mtr);
- buf_pool_mutex_exit();
- }
-*/
-
mutex_enter(&block->mutex);
#ifdef UNIV_SYNC_DEBUG
@@ -1123,4 +1207,71 @@ buf_block_dbg_add_level(
sync_thread_add_level(&block->lock, level);
}
#endif /* UNIV_SYNC_DEBUG */
+/********************************************************************//**
+Acquire mutex on all buffer pool instances. */
+UNIV_INLINE
+void
+buf_pool_mutex_enter_all(void)
+/*==========================*/
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ buf_pool_mutex_enter(buf_pool);
+ }
+}
+
+/********************************************************************//**
+Release mutex on all buffer pool instances. */
+UNIV_INLINE
+void
+buf_pool_mutex_exit_all(void)
+/*=========================*/
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ buf_pool_mutex_exit(buf_pool);
+ }
+}
+
+/********************************************************************//**
+*/
+UNIV_INLINE
+void
+buf_pool_page_hash_x_lock_all(void)
+/*===============================*/
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
+ }
+}
+
+/********************************************************************//**
+*/
+UNIV_INLINE
+void
+buf_pool_page_hash_x_unlock_all(void)
+/*=================================*/
+{
+ ulint i;
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ }
+}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/buf0flu.h b/storage/xtradb/include/buf0flu.h
index 2f7108fda1b..036f4389774 100644
--- a/storage/xtradb/include/buf0flu.h
+++ b/storage/xtradb/include/buf0flu.h
@@ -31,6 +31,7 @@ Created 11/5/1995 Heikki Tuuri
#ifndef UNIV_HOTBACKUP
#include "mtr0types.h"
#include "buf0types.h"
+#include "log0log.h"
/********************************************************************//**
Remove a block from the flush list of modified blocks. */
@@ -39,7 +40,7 @@ void
buf_flush_remove(
/*=============*/
buf_page_t* bpage); /*!< in: pointer to the block in question */
-/********************************************************************//**
+/*******************************************************************//**
Relocates a buffer control block on the flush_list.
Note that it is assumed that the contents of bpage has already been
copied to dpage. */
@@ -58,12 +59,21 @@ buf_flush_write_complete(
buf_page_t* bpage); /*!< in: pointer to the block in question */
/*********************************************************************//**
Flushes pages from the end of the LRU list if there is too small
-a margin of replaceable pages there. */
+a margin of replaceable pages there. If buffer pool is NULL it
+means flush free margin on all buffer pool instances. */
UNIV_INTERN
void
buf_flush_free_margin(
-/*=======================*/
- ibool wait);
+/*==================*/
+ buf_pool_t* buf_pool,
+ ibool wait);
+/*********************************************************************//**
+Flushes pages from the end of all the LRU lists. */
+UNIV_INTERN
+void
+buf_flush_free_margins(
+/*=========================*/
+ ibool wait);
#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
Initializes a page for writing to the tablespace. */
@@ -76,22 +86,46 @@ buf_flush_init_for_writing(
ib_uint64_t newest_lsn); /*!< in: newest modification lsn
to the page */
#ifndef UNIV_HOTBACKUP
+# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+/********************************************************************//**
+Writes a flushable page asynchronously from the buffer pool to a file.
+NOTE: buf_pool->mutex and block->mutex must be held upon entering this
+function, and they will be released by this function after flushing.
+This is loosely based on buf_flush_batch() and buf_flush_page().
+@return TRUE if the page was flushed and the mutexes released */
+UNIV_INTERN
+ibool
+buf_flush_page_try(
+/*===============*/
+ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
+ buf_block_t* block) /*!< in/out: buffer control block */
+ __attribute__((nonnull, warn_unused_result));
+# endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
/*******************************************************************//**
-This utility flushes dirty blocks from the end of the LRU list or flush_list.
-NOTE 1: in the case of an LRU flush the calling thread may own latches to
-pages: to avoid deadlocks, this function must be written so that it cannot
-end up waiting for these latches! NOTE 2: in the case of a flush list flush,
-the calling thread is not allowed to own any latches on pages!
+This utility flushes dirty blocks from the end of the LRU list.
+NOTE: The calling thread may own latches to pages: to avoid deadlocks,
+this function must be written so that it cannot end up waiting for these
+latches!
@return number of blocks for which the write request was queued;
ULINT_UNDEFINED if there was a flush of the same type already running */
UNIV_INTERN
ulint
-buf_flush_batch(
+buf_flush_LRU(
+/*==========*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint min_n); /*!< in: wished minimum mumber of blocks
+ flushed (it is not guaranteed that the
+ actual number is that big, though) */
+/*******************************************************************//**
+This utility flushes dirty blocks from the end of the flush_list of
+all buffer pool instances.
+NOTE: The calling thread is not allowed to own any latches on pages!
+@return number of blocks for which the write request was queued;
+ULINT_UNDEFINED if there was a flush of the same type already running */
+UNIV_INTERN
+ulint
+buf_flush_list(
/*============*/
- enum buf_flush flush_type, /*!< in: BUF_FLUSH_LRU or
- BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
- then the caller must not own any
- latches on pages */
ulint min_n, /*!< in: wished minimum mumber of blocks
flushed (it is not guaranteed that the
actual number is that big, though) */
@@ -106,7 +140,20 @@ UNIV_INTERN
void
buf_flush_wait_batch_end(
/*=====================*/
- enum buf_flush type); /*!< in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ enum buf_flush type); /*!< in: BUF_FLUSH_LRU
+ or BUF_FLUSH_LIST */
+/******************************************************************//**
+Waits until a flush batch of the given type ends. This is called by
+a thread that only wants to wait for a flush to end but doesn't do
+any flushing itself. */
+UNIV_INTERN
+void
+buf_flush_wait_batch_end_wait_only(
+/*===============================*/
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ enum buf_flush type); /*!< in: BUF_FLUSH_LRU
+ or BUF_FLUSH_LIST */
/********************************************************************//**
This function should be called at a mini-transaction commit, if a page was
modified in it. Puts the block to the list of modified blocks, if it not
@@ -150,8 +197,8 @@ how much redo the workload is generating and at what rate. */
struct buf_flush_stat_struct
{
- ib_uint64_t redo; /*!< amount of redo generated. */
- ulint n_flushed; /*!< number of pages flushed. */
+ ib_uint64_t redo; /**< amount of redo generated. */
+ ulint n_flushed; /**< number of pages flushed. */
};
/** Statistics for selecting flush rate of dirty pages. */
@@ -182,11 +229,12 @@ Validates the flush list.
@return TRUE if ok */
UNIV_INTERN
ibool
-buf_flush_validate(void);
-/*====================*/
+buf_flush_validate(
+/*===============*/
+ buf_pool_t* buf_pool);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
-/******************************************************************//**
+/********************************************************************//**
Initialize the red-black tree to speed up insertions into the flush_list
during recovery process. Should be called at the start of recovery
process before any page has been read/written. */
@@ -195,7 +243,7 @@ void
buf_flush_init_flush_rbt(void);
/*==========================*/
-/******************************************************************//**
+/********************************************************************//**
Frees up the red-black tree. */
UNIV_INTERN
void
@@ -206,9 +254,10 @@ buf_flush_free_flush_rbt(void);
available to replacement in the free list and at the end of the LRU list (to
make sure that a read-ahead batch can be read efficiently in a single
sweep). */
-#define BUF_FLUSH_FREE_BLOCK_MARGIN (5 + BUF_READ_AHEAD_AREA)
+#define BUF_FLUSH_FREE_BLOCK_MARGIN(b) (5 + BUF_READ_AHEAD_AREA(b))
/** Extra margin to apply above BUF_FLUSH_FREE_BLOCK_MARGIN */
-#define BUF_FLUSH_EXTRA_MARGIN (BUF_FLUSH_FREE_BLOCK_MARGIN / 4 + 100)
+#define BUF_FLUSH_EXTRA_MARGIN(b) ((BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \
+ + 100) / srv_buf_pool_instances)
#endif /* !UNIV_HOTBACKUP */
#ifndef UNIV_NONINL
diff --git a/storage/xtradb/include/buf0flu.ic b/storage/xtradb/include/buf0flu.ic
index 4ad0814f344..30e2cc8efe8 100644
--- a/storage/xtradb/include/buf0flu.ic
+++ b/storage/xtradb/include/buf0flu.ic
@@ -33,7 +33,9 @@ UNIV_INTERN
void
buf_flush_insert_into_flush_list(
/*=============================*/
- buf_block_t* block); /*!< in/out: block which is modified */
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ buf_block_t* block, /*!< in/out: block which is modified */
+ ib_uint64_t lsn); /*!< in: oldest modification */
/********************************************************************//**
Inserts a modified block into the flush list in the right sorted position.
This function is used by recovery, because there the modifications do not
@@ -42,7 +44,9 @@ UNIV_INTERN
void
buf_flush_insert_sorted_into_flush_list(
/*====================================*/
- buf_block_t* block); /*!< in/out: block which is modified */
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ buf_block_t* block, /*!< in/out: block which is modified */
+ ib_uint64_t lsn); /*!< in: oldest modification */
/********************************************************************//**
This function should be called at a mini-transaction commit, if a page was
@@ -55,15 +59,7 @@ buf_flush_note_modification(
buf_block_t* block, /*!< in: block which is modified */
mtr_t* mtr) /*!< in: mtr */
{
- ibool use_LRU_mutex = FALSE;
-
- if (UT_LIST_GET_LEN(buf_pool->unzip_LRU))
- use_LRU_mutex = TRUE;
-
- if (use_LRU_mutex)
- mutex_enter(&LRU_list_mutex);
-
- mutex_enter(&block->mutex);
+ buf_pool_t* buf_pool = buf_pool_from_block(block);
ut_ad(block);
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
@@ -71,22 +67,22 @@ buf_flush_note_modification(
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
- //ut_ad(buf_pool_mutex_own());
+
+ ut_ad(!buf_pool_mutex_own(buf_pool));
+ ut_ad(!buf_flush_list_mutex_own(buf_pool));
+ ut_ad(log_flush_order_mutex_own());
ut_ad(mtr->start_lsn != 0);
ut_ad(mtr->modifications);
+
+ mutex_enter(&block->mutex);
ut_ad(block->page.newest_modification <= mtr->end_lsn);
block->page.newest_modification = mtr->end_lsn;
if (!block->page.oldest_modification) {
- mutex_enter(&flush_list_mutex);
-
- block->page.oldest_modification = mtr->start_lsn;
- ut_ad(block->page.oldest_modification != 0);
-
- buf_flush_insert_into_flush_list(block);
- mutex_exit(&flush_list_mutex);
+ buf_flush_insert_into_flush_list(
+ buf_pool, block, mtr->start_lsn);
} else {
ut_ad(block->page.oldest_modification <= mtr->start_lsn);
}
@@ -94,9 +90,6 @@ buf_flush_note_modification(
mutex_exit(&block->mutex);
++srv_buf_pool_write_requests;
-
- if (use_LRU_mutex)
- mutex_exit(&LRU_list_mutex);
}
/********************************************************************//**
@@ -111,15 +104,7 @@ buf_flush_recv_note_modification(
ib_uint64_t end_lsn) /*!< in: end lsn of the last mtr in the
set of mtr's */
{
- ibool use_LRU_mutex = FALSE;
-
- if(UT_LIST_GET_LEN(buf_pool->unzip_LRU))
- use_LRU_mutex = TRUE;
-
- if (use_LRU_mutex)
- mutex_enter(&LRU_list_mutex);
-
- mutex_enter(&(block->mutex));
+ buf_pool_t* buf_pool = buf_pool_from_block(block);
ut_ad(block);
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
@@ -128,28 +113,24 @@ buf_flush_recv_note_modification(
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
- //buf_pool_mutex_enter();
+ ut_ad(!buf_pool_mutex_own(buf_pool));
+ ut_ad(!buf_flush_list_mutex_own(buf_pool));
+ ut_ad(log_flush_order_mutex_own());
+ ut_ad(start_lsn != 0);
ut_ad(block->page.newest_modification <= end_lsn);
+ mutex_enter(&block->mutex);
block->page.newest_modification = end_lsn;
if (!block->page.oldest_modification) {
- mutex_enter(&flush_list_mutex);
-
- block->page.oldest_modification = start_lsn;
-
- ut_ad(block->page.oldest_modification != 0);
-
- buf_flush_insert_sorted_into_flush_list(block);
- mutex_exit(&flush_list_mutex);
+ buf_flush_insert_sorted_into_flush_list(
+ buf_pool, block, start_lsn);
} else {
ut_ad(block->page.oldest_modification <= start_lsn);
}
- //buf_pool_mutex_exit();
- if (use_LRU_mutex)
- mutex_exit(&LRU_list_mutex);
- mutex_exit(&(block->mutex));
+ mutex_exit(&block->mutex);
+
}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/buf0lru.h b/storage/xtradb/include/buf0lru.h
index d3b59e8b579..5d004ec4bb7 100644
--- a/storage/xtradb/include/buf0lru.h
+++ b/storage/xtradb/include/buf0lru.h
@@ -52,8 +52,9 @@ operations need new buffer blocks, and the i/o work done in flushing would be
wasted. */
UNIV_INTERN
void
-buf_LRU_try_free_flushed_blocks(void);
-/*==================================*/
+buf_LRU_try_free_flushed_blocks(
+/*============================*/
+ buf_pool_t* buf_pool); /*!< in: buffer pool instance */
/******************************************************************//**
Returns TRUE if less than 25 % of the buffer pool is available. This can be
used in heuristics to prevent huge transactions eating up the whole buffer
@@ -72,7 +73,7 @@ These are low-level functions
#define BUF_LRU_OLD_MIN_LEN 512 /* 8 megabytes of 16k pages */
/** Maximum LRU list search length in buf_flush_LRU_recommendation() */
-#define BUF_LRU_FREE_SEARCH_LEN (5 + 2 * BUF_READ_AHEAD_AREA)
+#define BUF_LRU_FREE_SEARCH_LEN(b) (5 + 2 * BUF_READ_AHEAD_AREA(b))
/******************************************************************//**
Invalidates all pages belonging to a given tablespace when we are deleting
@@ -84,6 +85,13 @@ void
buf_LRU_invalidate_tablespace(
/*==========================*/
ulint id); /*!< in: space id */
+/******************************************************************//**
+*/
+UNIV_INTERN
+void
+buf_LRU_mark_space_was_deleted(
+/*===========================*/
+ ulint id); /*!< in: space id */
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
UNIV_INTERN
@@ -97,10 +105,10 @@ Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
NOTE: If this function returns BUF_LRU_FREED, it will temporarily
-release buf_pool_mutex. Furthermore, the page frame will no longer be
+release buf_pool->mutex. Furthermore, the page frame will no longer be
accessible via bpage.
-The caller must hold buf_pool_mutex and buf_page_get_mutex(bpage) and
+The caller must hold buf_pool->mutex and buf_page_get_mutex(bpage) and
release these two mutexes after the call. No other
buf_page_get_mutex() may be held when calling this function.
@return BUF_LRU_FREED if freed, BUF_LRU_CANNOT_RELOCATE or
@@ -112,11 +120,8 @@ buf_LRU_free_block(
buf_page_t* bpage, /*!< in: block to be freed */
ibool zip, /*!< in: TRUE if should remove also the
compressed page of an uncompressed page */
- ibool* buf_pool_mutex_released,
- /*!< in: pointer to a variable that will
- be assigned TRUE if buf_pool_mutex
- was temporarily released, or NULL */
- ibool have_LRU_mutex);
+ ibool have_LRU_mutex)
+ __attribute__((nonnull));
/******************************************************************//**
Try to free a replaceable block.
@return TRUE if found and freed */
@@ -124,22 +129,26 @@ UNIV_INTERN
ibool
buf_LRU_search_and_free_block(
/*==========================*/
- ulint n_iterations); /*!< in: how many times this has been called
- repeatedly without result: a high value means
- that we should search farther; if
- n_iterations < 10, then we search
- n_iterations / 10 * buf_pool->curr_size
- pages from the end of the LRU list; if
- n_iterations < 5, then we will also search
- n_iterations / 5 of the unzip_LRU list. */
+ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
+ ulint n_iterations); /*!< in: how many times this has
+ been called repeatedly without
+ result: a high value means that
+ we should search farther; if
+ n_iterations < 10, then we search
+ n_iterations / 10 * buf_pool->curr_size
+ pages from the end of the LRU list; if
+ n_iterations < 5, then we will
+ also search n_iterations / 5
+ of the unzip_LRU list. */
/******************************************************************//**
Returns a free block from the buf_pool. The block is taken off the
free list. If it is empty, returns NULL.
@return a free control block, or NULL if the buf_block->free list is empty */
UNIV_INTERN
buf_block_t*
-buf_LRU_get_free_only(void);
-/*=======================*/
+buf_LRU_get_free_only(
+/*==================*/
+ buf_pool_t* buf_pool); /*!< buffer pool instance */
/******************************************************************//**
Returns a free block from the buf_pool. The block is taken off the
free list. If it is empty, blocks are moved from the end of the
@@ -149,8 +158,8 @@ UNIV_INTERN
buf_block_t*
buf_LRU_get_free_block(
/*===================*/
- ulint zip_size); /*!< in: compressed page size in bytes,
- or 0 if uncompressed tablespace */
+ buf_pool_t* buf_pool) /*!< in/out: buffer pool instance */
+ __attribute__((nonnull,warn_unused_result));
/******************************************************************//**
Puts a block back to the free list. */
@@ -198,7 +207,7 @@ buf_LRU_make_block_old(
Updates buf_LRU_old_ratio.
@return updated old_pct */
UNIV_INTERN
-uint
+ulint
buf_LRU_old_ratio_update(
/*=====================*/
uint old_pct,/*!< in: Reserve this percentage of
@@ -246,7 +255,7 @@ buf_LRU_print(void);
/** @name Heuristics for detecting index scan @{ */
/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
-"old" blocks. Protected by buf_pool_mutex. */
+"old" blocks. Protected by buf_pool->mutex. */
extern uint buf_LRU_old_ratio;
/** The denominator of buf_LRU_old_ratio. */
#define BUF_LRU_OLD_RATIO_DIV 1024
@@ -292,7 +301,7 @@ Cleared by buf_LRU_stat_update(). */
extern buf_LRU_stat_t buf_LRU_stat_cur;
/** Running sum of past values of buf_LRU_stat_cur.
-Updated by buf_LRU_stat_update(). Protected by buf_pool_mutex. */
+Updated by buf_LRU_stat_update(). Protected by buf_pool->mutex. */
extern buf_LRU_stat_t buf_LRU_stat_sum;
/********************************************************************//**
diff --git a/storage/xtradb/include/buf0rea.h b/storage/xtradb/include/buf0rea.h
index 56d3d24a3b7..4910c1e2aca 100644
--- a/storage/xtradb/include/buf0rea.h
+++ b/storage/xtradb/include/buf0rea.h
@@ -103,10 +103,10 @@ UNIV_INTERN
ulint
buf_read_ahead_linear(
/*==================*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
- ulint offset, /*!< in: page number of a page; NOTE: the current thread
- must want access to this page (see NOTE 3 above) */
+ ulint space, /*!< in: space id */
+ ulint zip_size, /*!< in: compressed page size in bytes, or 0 */
+ ulint offset, /*!< in: page number; see NOTE 3 above */
+ ibool inside_ibuf, /*!< in: TRUE if we are inside ibuf routine */
trx_t* trx);
/********************************************************************//**
Issues read requests for pages which the ibuf module wants to read in, in
@@ -158,7 +158,7 @@ buf_read_recv_pages(
/** The size in pages of the area which the read-ahead algorithms read if
invoked */
-#define BUF_READ_AHEAD_AREA 64
+#define BUF_READ_AHEAD_AREA(b) 64
/** @name Modes used in read-ahead @{ */
/** read only pages belonging to the insert buffer tree */
diff --git a/storage/xtradb/include/buf0types.h b/storage/xtradb/include/buf0types.h
index 507f1543bbb..888be86e332 100644
--- a/storage/xtradb/include/buf0types.h
+++ b/storage/xtradb/include/buf0types.h
@@ -36,6 +36,8 @@ typedef struct buf_chunk_struct buf_chunk_t;
typedef struct buf_pool_struct buf_pool_t;
/** Buffer pool statistics struct */
typedef struct buf_pool_stat_struct buf_pool_stat_t;
+/** Buffer pool buddy statistics struct */
+typedef struct buf_buddy_stat_struct buf_buddy_stat_t;
/** A buffer frame. @see page_t */
typedef byte buf_frame_t;
@@ -76,7 +78,7 @@ enum buf_io_fix {
/** twice the maximum block size of the buddy system;
the underlying memory is aligned by this amount:
this must be equal to UNIV_PAGE_SIZE */
-#define BUF_BUDDY_HIGH (BUF_BUDDY_LOW << BUF_BUDDY_SIZES)
+#define BUF_BUDDY_HIGH ((ulint)BUF_BUDDY_LOW << BUF_BUDDY_SIZES)
/* @} */
#endif
diff --git a/storage/xtradb/include/data0data.h b/storage/xtradb/include/data0data.h
index f9fce3f3657..f7bdd29ed90 100644
--- a/storage/xtradb/include/data0data.h
+++ b/storage/xtradb/include/data0data.h
@@ -154,14 +154,19 @@ dfield_dup(
dfield_t* field, /*!< in/out: data field */
mem_heap_t* heap); /*!< in: memory heap where allocated */
/*********************************************************************//**
-Tests if data length and content is equal for two dfields.
-@return TRUE if equal */
+Tests if two data fields are equal.
+If len==0, tests the data length and content for equality.
+If len>0, tests the first len bytes of the content for equality.
+@return TRUE if both fields are NULL or if they are equal */
UNIV_INLINE
ibool
dfield_datas_are_binary_equal(
/*==========================*/
const dfield_t* field1, /*!< in: field */
- const dfield_t* field2);/*!< in: field */
+ const dfield_t* field2, /*!< in: field */
+ ulint len) /*!< in: maximum prefix to compare,
+ or 0 to compare the whole field length */
+ __attribute__((nonnull, warn_unused_result));
/*********************************************************************//**
Tests if dfield data length and content is equal to the given.
@return TRUE if equal */
@@ -309,7 +314,7 @@ dtuple_fold(
ulint n_fields,/*!< in: number of complete fields to fold */
ulint n_bytes,/*!< in: number of bytes to fold in an
incomplete last field */
- dulint tree_id)/*!< in: index tree id */
+ index_id_t tree_id)/*!< in: index tree id */
__attribute__((pure));
/*******************************************************************//**
Sets types of fields binary in a tuple. */
diff --git a/storage/xtradb/include/data0data.ic b/storage/xtradb/include/data0data.ic
index da79aa33702..5c0f8039c80 100644
--- a/storage/xtradb/include/data0data.ic
+++ b/storage/xtradb/include/data0data.ic
@@ -229,20 +229,30 @@ dfield_dup(
}
/*********************************************************************//**
-Tests if data length and content is equal for two dfields.
-@return TRUE if equal */
+Tests if two data fields are equal.
+If len==0, tests the data length and content for equality.
+If len>0, tests the first len bytes of the content for equality.
+@return TRUE if both fields are NULL or if they are equal */
UNIV_INLINE
ibool
dfield_datas_are_binary_equal(
/*==========================*/
const dfield_t* field1, /*!< in: field */
- const dfield_t* field2) /*!< in: field */
+ const dfield_t* field2, /*!< in: field */
+ ulint len) /*!< in: maximum prefix to compare,
+ or 0 to compare the whole field length */
{
- ulint len;
+ ulint len2 = len;
- len = field1->len;
+ if (field1->len == UNIV_SQL_NULL || len == 0 || field1->len < len) {
+ len = field1->len;
+ }
+
+ if (field2->len == UNIV_SQL_NULL || len2 == 0 || field2->len < len2) {
+ len2 = field2->len;
+ }
- return(len == field2->len
+ return(len == len2
&& (len == UNIV_SQL_NULL
|| !memcmp(field1->data, field2->data, len)));
}
@@ -518,7 +528,7 @@ dtuple_fold(
ulint n_fields,/*!< in: number of complete fields to fold */
ulint n_bytes,/*!< in: number of bytes to fold in an
incomplete last field */
- dulint tree_id)/*!< in: index tree id */
+ index_id_t tree_id)/*!< in: index tree id */
{
const dfield_t* field;
ulint i;
@@ -530,7 +540,7 @@ dtuple_fold(
ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N);
ut_ad(dtuple_check_typed(tuple));
- fold = ut_fold_dulint(tree_id);
+ fold = ut_fold_ull(tree_id);
for (i = 0; i < n_fields; i++) {
field = dtuple_get_nth_field(tuple, i);
diff --git a/storage/xtradb/include/data0type.h b/storage/xtradb/include/data0type.h
index a73bed3a9f5..d7fa0b9cd44 100644
--- a/storage/xtradb/include/data0type.h
+++ b/storage/xtradb/include/data0type.h
@@ -128,7 +128,7 @@ columns, and for them the precise type is usually not used at all.
/* Precise data types for system columns and the length of those columns;
NOTE: the values must run from 0 up in the order given! All codes must
be less than 256 */
-#define DATA_ROW_ID 0 /* row id: a dulint */
+#define DATA_ROW_ID 0 /* row id: a 48-bit integer */
#define DATA_ROW_ID_LEN 6 /* stored length for row id */
#define DATA_TRX_ID 1 /* transaction id: 6 bytes */
@@ -168,6 +168,20 @@ SQL null*/
store the charset-collation number; one byte is left unused, though */
#define DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE 6
+/* Maximum multi-byte character length in bytes, plus 1 */
+#define DATA_MBMAX 5
+
+/* Pack mbminlen, mbmaxlen to mbminmaxlen. */
+#define DATA_MBMINMAXLEN(mbminlen, mbmaxlen) \
+ ((mbmaxlen) * DATA_MBMAX + (mbminlen))
+/* Get mbminlen from mbminmaxlen. Cast the result of UNIV_EXPECT to ulint
+because in GCC it returns a long. */
+#define DATA_MBMINLEN(mbminmaxlen) ((ulint) \
+ UNIV_EXPECT(((mbminmaxlen) % DATA_MBMAX), \
+ 1))
+/* Get mbmaxlen from mbminmaxlen. */
+#define DATA_MBMAXLEN(mbminmaxlen) ((ulint) ((mbminmaxlen) / DATA_MBMAX))
+
#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
Gets the MySQL type code from a dtype.
@@ -187,10 +201,8 @@ ulint
dtype_get_at_most_n_mbchars(
/*========================*/
ulint prtype, /*!< in: precise type */
- ulint mbminlen, /*!< in: minimum length of a
- multi-byte character */
- ulint mbmaxlen, /*!< in: maximum length of a
- multi-byte character */
+ ulint mbminmaxlen, /*!< in: minimum and maximum length of
+ a multi-byte character */
ulint prefix_len, /*!< in: length of the requested
prefix, in characters, multiplied by
dtype_get_mbmaxlen(dtype) */
@@ -335,6 +347,19 @@ dtype_get_mbmaxlen(
/*===============*/
const dtype_t* type); /*!< in: type */
/*********************************************************************//**
+Sets the minimum and maximum length of a character, in bytes. */
+UNIV_INLINE
+void
+dtype_set_mbminmaxlen(
+/*==================*/
+ dtype_t* type, /*!< in/out: type */
+ ulint mbminlen, /*!< in: minimum length of a char,
+ in bytes, or 0 if this is not
+ a character type */
+ ulint mbmaxlen); /*!< in: maximum length of a char,
+ in bytes, or 0 if this is not
+ a character type */
+/*********************************************************************//**
Gets the padding character code for the type.
@return padding character code, or ULINT_UNDEFINED if no padding specified */
UNIV_INLINE
@@ -354,8 +379,8 @@ dtype_get_fixed_size_low(
ulint mtype, /*!< in: main type */
ulint prtype, /*!< in: precise type */
ulint len, /*!< in: length */
- ulint mbminlen, /*!< in: minimum length of a multibyte char */
- ulint mbmaxlen, /*!< in: maximum length of a multibyte char */
+ ulint mbminmaxlen, /*!< in: minimum and maximum length of a
+ multibyte character, in bytes */
ulint comp); /*!< in: nonzero=ROW_FORMAT=COMPACT */
#ifndef UNIV_HOTBACKUP
/***********************************************************************//**
@@ -368,8 +393,8 @@ dtype_get_min_size_low(
ulint mtype, /*!< in: main type */
ulint prtype, /*!< in: precise type */
ulint len, /*!< in: length */
- ulint mbminlen, /*!< in: minimum length of a multibyte char */
- ulint mbmaxlen); /*!< in: maximum length of a multibyte char */
+ ulint mbminmaxlen); /*!< in: minimum and maximum length of a
+ multibyte character */
/***********************************************************************//**
Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information.
@@ -472,10 +497,11 @@ struct dtype_struct{
the string, MySQL uses 1 or 2
bytes to store the string length) */
#ifndef UNIV_HOTBACKUP
- unsigned mbminlen:2; /*!< minimum length of a
- character, in bytes */
- unsigned mbmaxlen:3; /*!< maximum length of a
- character, in bytes */
+ unsigned mbminmaxlen:5; /*!< minimum and maximum length of a
+ character, in bytes;
+ DATA_MBMINMAXLEN(mbminlen,mbmaxlen);
+ mbminlen=DATA_MBMINLEN(mbminmaxlen);
+ mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */
#endif /* !UNIV_HOTBACKUP */
};
diff --git a/storage/xtradb/include/data0type.ic b/storage/xtradb/include/data0type.ic
index 2bf67a941bd..757dd815c5e 100644
--- a/storage/xtradb/include/data0type.ic
+++ b/storage/xtradb/include/data0type.ic
@@ -93,14 +93,35 @@ dtype_get_mblen(
innobase_get_cset_width(dtype_get_charset_coll(prtype),
mbminlen, mbmaxlen);
ut_ad(*mbminlen <= *mbmaxlen);
- ut_ad(*mbminlen <= 2); /* mbminlen in dtype_t is 0..3 */
- ut_ad(*mbmaxlen < 1 << 3); /* mbmaxlen in dtype_t is 0..7 */
+ ut_ad(*mbminlen < DATA_MBMAX);
+ ut_ad(*mbmaxlen < DATA_MBMAX);
} else {
*mbminlen = *mbmaxlen = 0;
}
}
/*********************************************************************//**
+Sets the minimum and maximum length of a character, in bytes. */
+UNIV_INLINE
+void
+dtype_set_mbminmaxlen(
+/*==================*/
+ dtype_t* type, /*!< in/out: type */
+ ulint mbminlen, /*!< in: minimum length of a char,
+ in bytes, or 0 if this is not
+ a character type */
+ ulint mbmaxlen) /*!< in: maximum length of a char,
+ in bytes, or 0 if this is not
+ a character type */
+{
+ ut_ad(mbminlen < DATA_MBMAX);
+ ut_ad(mbmaxlen < DATA_MBMAX);
+ ut_ad(mbminlen <= mbmaxlen);
+
+ type->mbminmaxlen = DATA_MBMINMAXLEN(mbminlen, mbmaxlen);
+}
+
+/*********************************************************************//**
Compute the mbminlen and mbmaxlen members of a data type structure. */
UNIV_INLINE
void
@@ -112,8 +133,7 @@ dtype_set_mblen(
ulint mbmaxlen;
dtype_get_mblen(type->mtype, type->prtype, &mbminlen, &mbmaxlen);
- type->mbminlen = mbminlen;
- type->mbmaxlen = mbmaxlen;
+ dtype_set_mbminmaxlen(type, mbminlen, mbmaxlen);
ut_ad(dtype_validate(type));
}
@@ -210,7 +230,7 @@ dtype_get_mbminlen(
const dtype_t* type) /*!< in: type */
{
ut_ad(type);
- return(type->mbminlen);
+ return(DATA_MBMINLEN(type->mbminmaxlen));
}
/*********************************************************************//**
Gets the maximum length of a character, in bytes.
@@ -223,7 +243,7 @@ dtype_get_mbmaxlen(
const dtype_t* type) /*!< in: type */
{
ut_ad(type);
- return(type->mbmaxlen);
+ return(DATA_MBMAXLEN(type->mbminmaxlen));
}
/*********************************************************************//**
@@ -404,8 +424,8 @@ dtype_get_fixed_size_low(
ulint mtype, /*!< in: main type */
ulint prtype, /*!< in: precise type */
ulint len, /*!< in: length */
- ulint mbminlen, /*!< in: minimum length of a multibyte char */
- ulint mbmaxlen, /*!< in: maximum length of a multibyte char */
+ ulint mbminmaxlen, /*!< in: minimum and maximum length of
+ a multibyte character, in bytes */
ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */
{
switch (mtype) {
@@ -453,8 +473,9 @@ dtype_get_fixed_size_low(
dtype_get_charset_coll(prtype),
&i_mbminlen, &i_mbmaxlen);
- if (UNIV_UNLIKELY(mbminlen != i_mbminlen)
- || UNIV_UNLIKELY(mbmaxlen != i_mbmaxlen)) {
+ if (UNIV_UNLIKELY
+ (DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen)
+ != mbminmaxlen)) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: "
@@ -464,10 +485,10 @@ dtype_get_fixed_size_low(
"type->mbmaxlen=%lu\n",
(ulong) i_mbminlen,
(ulong) i_mbmaxlen,
- (ulong) mbminlen,
- (ulong) mbmaxlen);
+ (ulong) DATA_MBMINLEN(mbminmaxlen),
+ (ulong) DATA_MBMAXLEN(mbminmaxlen));
}
- if (mbminlen == mbmaxlen) {
+ if (i_mbminlen == i_mbmaxlen) {
return(len);
}
}
@@ -499,8 +520,8 @@ dtype_get_min_size_low(
ulint mtype, /*!< in: main type */
ulint prtype, /*!< in: precise type */
ulint len, /*!< in: length */
- ulint mbminlen, /*!< in: minimum length of a multibyte char */
- ulint mbmaxlen) /*!< in: maximum length of a multibyte char */
+ ulint mbminmaxlen) /*!< in: minimum and maximum length of a
+ multi-byte character */
{
switch (mtype) {
case DATA_SYS:
@@ -527,14 +548,22 @@ dtype_get_min_size_low(
case DATA_DOUBLE:
return(len);
case DATA_MYSQL:
- if ((prtype & DATA_BINARY_TYPE) || mbminlen == mbmaxlen) {
+ if (prtype & DATA_BINARY_TYPE) {
return(len);
+ } else {
+ ulint mbminlen = DATA_MBMINLEN(mbminmaxlen);
+ ulint mbmaxlen = DATA_MBMAXLEN(mbminmaxlen);
+
+ if (mbminlen == mbmaxlen) {
+ return(len);
+ }
+
+ /* this is a variable-length character set */
+ ut_a(mbminlen > 0);
+ ut_a(mbmaxlen > mbminlen);
+ ut_a(len % mbmaxlen == 0);
+ return(len * mbminlen / mbmaxlen);
}
- /* this is a variable-length character set */
- ut_a(mbminlen > 0);
- ut_a(mbmaxlen > mbminlen);
- ut_a(len % mbmaxlen == 0);
- return(len * mbminlen / mbmaxlen);
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
@@ -595,9 +624,9 @@ dtype_get_sql_null_size(
{
#ifndef UNIV_HOTBACKUP
return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len,
- type->mbminlen, type->mbmaxlen, comp));
+ type->mbminmaxlen, comp));
#else /* !UNIV_HOTBACKUP */
return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len,
- 0, 0, 0));
+ 0, 0));
#endif /* !UNIV_HOTBACKUP */
}
diff --git a/storage/xtradb/include/db0err.h b/storage/xtradb/include/db0err.h
index c7fa6d2a444..74a2354bce3 100644
--- a/storage/xtradb/include/db0err.h
+++ b/storage/xtradb/include/db0err.h
@@ -94,9 +94,24 @@ enum db_err {
DB_PRIMARY_KEY_IS_NULL, /* a column in the PRIMARY KEY
was found to be NULL */
+
+ DB_STATS_DO_NOT_EXIST, /* an operation that requires the
+ persistent storage, used for recording
+ table and index statistics, was
+ requested but this storage does not
+ exist itself or the stats for a given
+ table do not exist */
DB_FOREIGN_EXCEED_MAX_CASCADE, /* Foreign key constraint related
cascading delete/update exceeds
maximum allowed depth */
+ DB_CHILD_NO_INDEX, /* the child (foreign) table does not
+ have an index that contains the
+ foreign keys as its prefix columns */
+ DB_PARENT_NO_INDEX, /* the parent table does not
+ have an index that contains the
+ foreign keys as its prefix columns */
+ DB_TOO_BIG_INDEX_COL, /* index column size exceeds maximum
+ limit */
/* The following are partial failure codes */
DB_FAIL = 1000,
diff --git a/storage/xtradb/include/dict0boot.h b/storage/xtradb/include/dict0boot.h
index 9239e031a7f..c8a09ca7de4 100644
--- a/storage/xtradb/include/dict0boot.h
+++ b/storage/xtradb/include/dict0boot.h
@@ -51,32 +51,35 @@ UNIV_INTERN
void
dict_hdr_get_new_id(
/*================*/
- dulint* table_id, /*!< out: table id (not assigned if NULL) */
- dulint* index_id, /*!< out: index id (not assigned if NULL) */
- ulint* space_id); /*!< out: space id (not assigned if NULL) */
+ table_id_t* table_id, /*!< out: table id
+ (not assigned if NULL) */
+ index_id_t* index_id, /*!< out: index id
+ (not assigned if NULL) */
+ ulint* space_id); /*!< out: space id
+ (not assigned if NULL) */
/**********************************************************************//**
Returns a new row id.
@return the new id */
UNIV_INLINE
-dulint
+row_id_t
dict_sys_get_new_row_id(void);
/*=========================*/
/**********************************************************************//**
Reads a row id from a record or other 6-byte stored form.
@return row id */
UNIV_INLINE
-dulint
+row_id_t
dict_sys_read_row_id(
/*=================*/
- byte* field); /*!< in: record field */
+ const byte* field); /*!< in: record field */
/**********************************************************************//**
Writes a row id to a record or other 6-byte stored form. */
UNIV_INLINE
void
dict_sys_write_row_id(
/*==================*/
- byte* field, /*!< in: record field */
- dulint row_id);/*!< in: row id */
+ byte* field, /*!< in: record field */
+ row_id_t row_id);/*!< in: row id */
/*****************************************************************//**
Initializes the data dictionary memory structures when the database is
started. This function is also called when the data dictionary is created. */
@@ -97,13 +100,13 @@ dict_create(void);
#define DICT_HDR_PAGE_NO FSP_DICT_HDR_PAGE_NO
/* The ids for the basic system tables and their indexes */
-#define DICT_TABLES_ID ut_dulint_create(0, 1)
-#define DICT_COLUMNS_ID ut_dulint_create(0, 2)
-#define DICT_INDEXES_ID ut_dulint_create(0, 3)
-#define DICT_FIELDS_ID ut_dulint_create(0, 4)
-#define DICT_STATS_ID ut_dulint_create(0, 6)
+#define DICT_TABLES_ID 1
+#define DICT_COLUMNS_ID 2
+#define DICT_INDEXES_ID 3
+#define DICT_FIELDS_ID 4
+#define DICT_STATS_ID 6
/* The following is a secondary index on SYS_TABLES */
-#define DICT_TABLE_IDS_ID ut_dulint_create(0, 5)
+#define DICT_TABLE_IDS_ID 5
#define DICT_HDR_FIRST_ID 10 /* the ids for tables etc. start
from this number, except for basic
@@ -111,7 +114,7 @@ dict_create(void);
indexes; ibuf tables and indexes are
assigned as the id the number
DICT_IBUF_ID_MIN plus the space id */
-#define DICT_IBUF_ID_MIN ut_dulint_create(0xFFFFFFFFUL, 0)
+#define DICT_IBUF_ID_MIN 0xFFFFFFFF00000000ULL
/* The offset of the dictionary header on the page */
#define DICT_HDR FSEG_PAGE_DATA
@@ -146,13 +149,14 @@ clustered index */
#define DICT_SYS_INDEXES_NAME_FIELD 4
#define DICT_SYS_STATS_DIFF_VALS_FIELD 4
+#define DICT_SYS_STATS_NON_NULL_VALS_FIELD 5
/* When a row id which is zero modulo this number (which must be a power of
two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is
updated */
#define DICT_HDR_ROW_ID_WRITE_MARGIN 256
-#define DICT_HDR_XTRADB_FLAG ut_dulint_create(0x58545241UL,0x44425F31UL) /* "XTRADB_1" */
+#define DICT_HDR_XTRADB_FLAG 0x5854524144425F31ULL /* "XTRADB_1" */
#ifndef UNIV_NONINL
#include "dict0boot.ic"
diff --git a/storage/xtradb/include/dict0boot.ic b/storage/xtradb/include/dict0boot.ic
index d5f372e38c4..d3ba9eee78f 100644
--- a/storage/xtradb/include/dict0boot.ic
+++ b/storage/xtradb/include/dict0boot.ic
@@ -36,22 +36,22 @@ dict_hdr_flush_row_id(void);
Returns a new row id.
@return the new id */
UNIV_INLINE
-dulint
+row_id_t
dict_sys_get_new_row_id(void)
/*=========================*/
{
- dulint id;
+ row_id_t id;
mutex_enter(&(dict_sys->mutex));
id = dict_sys->row_id;
- if (0 == (ut_dulint_get_low(id) % DICT_HDR_ROW_ID_WRITE_MARGIN)) {
+ if (0 == (id % DICT_HDR_ROW_ID_WRITE_MARGIN)) {
dict_hdr_flush_row_id();
}
- UT_DULINT_INC(dict_sys->row_id);
+ dict_sys->row_id++;
mutex_exit(&(dict_sys->mutex));
@@ -62,10 +62,10 @@ dict_sys_get_new_row_id(void)
Reads a row id from a record or other 6-byte stored form.
@return row id */
UNIV_INLINE
-dulint
+row_id_t
dict_sys_read_row_id(
/*=================*/
- byte* field) /*!< in: record field */
+ const byte* field) /*!< in: record field */
{
#if DATA_ROW_ID_LEN != 6
# error "DATA_ROW_ID_LEN != 6"
@@ -80,8 +80,8 @@ UNIV_INLINE
void
dict_sys_write_row_id(
/*==================*/
- byte* field, /*!< in: record field */
- dulint row_id) /*!< in: row id */
+ byte* field, /*!< in: record field */
+ row_id_t row_id) /*!< in: row id */
{
#if DATA_ROW_ID_LEN != 6
# error "DATA_ROW_ID_LEN != 6"
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index d18b3ecb1b0..d99177e0330 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -75,8 +75,8 @@ UNIV_INTERN
dict_table_t*
dict_table_get_on_id(
/*=================*/
- dulint table_id, /*!< in: table id */
- trx_t* trx); /*!< in: transaction handle */
+ table_id_t table_id, /*!< in: table id */
+ trx_t* trx); /*!< in: transaction handle */
/********************************************************************//**
Decrements the count of open MySQL handles to a table. */
UNIV_INTERN
@@ -102,6 +102,33 @@ void
dict_load_space_id_list(void);
/*=========================*/
/*********************************************************************//**
+Gets the minimum number of bytes per character.
+@return minimum multi-byte char size, in bytes */
+UNIV_INLINE
+ulint
+dict_col_get_mbminlen(
+/*==================*/
+ const dict_col_t* col); /*!< in: column */
+/*********************************************************************//**
+Gets the maximum number of bytes per character.
+@return maximum multi-byte char size, in bytes */
+UNIV_INLINE
+ulint
+dict_col_get_mbmaxlen(
+/*==================*/
+ const dict_col_t* col); /*!< in: column */
+/*********************************************************************//**
+Sets the minimum and maximum number of bytes per character. */
+UNIV_INLINE
+void
+dict_col_set_mbminmaxlen(
+/*=====================*/
+ dict_col_t* col, /*!< in/out: column */
+ ulint mbminlen, /*!< in: minimum multi-byte
+ character size, in bytes */
+ ulint mbmaxlen); /*!< in: minimum multi-byte
+ character size, in bytes */
+/*********************************************************************//**
Gets the column data type. */
UNIV_INLINE
void
@@ -109,6 +136,19 @@ dict_col_copy_type(
/*===============*/
const dict_col_t* col, /*!< in: column */
dtype_t* type); /*!< out: data type */
+/**********************************************************************//**
+Determine bytes of column prefix to be stored in the undo log. Please
+note if the table format is UNIV_FORMAT_A (< DICT_TF_FORMAT_ZIP), no prefix
+needs to be stored in the undo log.
+@return bytes of column prefix to be stored in the undo log */
+UNIV_INLINE
+ulint
+dict_max_field_len_store_undo(
+/*==========================*/
+ dict_table_t* table, /*!< in: table */
+ const dict_col_t* col); /*!< in: column which index prefix
+ is based on */
+
#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_DEBUG
/*********************************************************************//**
@@ -277,7 +317,7 @@ void
dict_table_change_id_in_cache(
/*==========================*/
dict_table_t* table, /*!< in/out: table object already in cache */
- dulint new_id);/*!< in: new id to set */
+ table_id_t new_id);/*!< in: new id to set */
/**********************************************************************//**
Adds a foreign key constraint object to the dictionary cache. May free
the object if there already is an object with the same identifier in.
@@ -318,7 +358,8 @@ void
dict_table_replace_index_in_foreign_list(
/*=====================================*/
dict_table_t* table, /*!< in/out: table */
- dict_index_t* index); /*!< in: index to be replaced */
+ dict_index_t* index, /*!< in: index to be replaced */
+ const trx_t* trx); /*!< in: transaction handle */
/*********************************************************************//**
Checks if a index is defined for a foreign key constraint. Index is a part
of a foreign key constraint if the index is referenced by foreign key
@@ -397,7 +438,7 @@ dict_index_t*
dict_index_get_on_id_low(
/*=====================*/
dict_table_t* table, /*!< in: table */
- dulint index_id); /*!< in: index id */
+ index_id_t index_id); /*!< in: index id */
/**********************************************************************//**
Checks if a table is in the dictionary cache.
@return table, NULL if not found */
@@ -413,6 +454,18 @@ function.
@return table, NULL if not found */
UNIV_INLINE
dict_table_t*
+dict_table_get_low_ignore_err(
+/*===========================*/
+ const char* table_name, /*!< in: table name */
+ dict_err_ignore_t
+ ignore_err); /*!< in: error to be ignored when
+ loading a table definition */
+/**********************************************************************//**
+Gets a table; loads it to the dictionary cache if necessary. A low-level
+function.
+@return table, NULL if not found */
+UNIV_INLINE
+dict_table_t*
dict_table_get_low(
/*===============*/
const char* table_name); /*!< in: table name */
@@ -423,7 +476,7 @@ UNIV_INLINE
dict_table_t*
dict_table_get_on_id_low(
/*=====================*/
- dulint table_id); /*!< in: table id */
+ table_id_t table_id); /*!< in: table id */
/**********************************************************************//**
Find an index that is equivalent to the one passed in and is not marked
for deletion.
@@ -726,7 +779,7 @@ UNIV_INTERN
dict_index_t*
dict_index_find_on_id_low(
/*======================*/
- dulint id); /*!< in: index id */
+ index_id_t id); /*!< in: index id */
/**********************************************************************//**
Adds an index to the dictionary cache.
@return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */
@@ -917,7 +970,7 @@ UNIV_INTERN
dict_index_t*
dict_index_get_if_in_cache_low(
/*===========================*/
- dulint index_id); /*!< in: index id */
+ index_id_t index_id); /*!< in: index id */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/**********************************************************************//**
Returns an index object if it is found in the dictionary cache.
@@ -926,7 +979,7 @@ UNIV_INTERN
dict_index_t*
dict_index_get_if_in_cache(
/*=======================*/
- dulint index_id); /*!< in: index id */
+ index_id_t index_id); /*!< in: index id */
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
#ifdef UNIV_DEBUG
/**********************************************************************//**
@@ -1053,21 +1106,21 @@ Calculates new estimates for table and index statistics. The statistics
are used in query optimization. */
UNIV_INTERN
void
-dict_update_statistics_low(
-/*=======================*/
+dict_update_statistics(
+/*===================*/
dict_table_t* table, /*!< in/out: table */
- ibool has_dict_mutex, /*!< in: TRUE if the caller has the
- dictionary mutex */
+ ibool only_calc_if_missing_stats, /*!< in: only
+ update/recalc the stats if they have
+ not been initialized yet, otherwise
+ do nothing */
ibool sync);
/*********************************************************************//**
-Calculates new estimates for table and index statistics. The statistics
-are used in query optimization. */
+*/
UNIV_INTERN
-void
-dict_update_statistics(
-/*===================*/
- dict_table_t* table, /*!< in/out: table */
- ibool sync);
+ibool
+dict_is_older_statistics(
+/*=====================*/
+ dict_index_t* index);
/********************************************************************//**
Reserves the dictionary system mutex for MySQL. */
UNIV_INTERN
@@ -1081,21 +1134,25 @@ void
dict_mutex_exit_for_mysql(void);
/*===========================*/
/**********************************************************************//**
-Lock the appropriate mutex to protect index->stat_n_diff_key_vals[].
-index->id is used to pick the right mutex and it should not change
-before dict_index_stat_mutex_exit() is called on this index. */
+Lock the appropriate latch to protect a given table's statistics.
+table->id is used to pick the corresponding latch from a global array of
+latches. */
UNIV_INTERN
void
-dict_index_stat_mutex_enter(
-/*========================*/
- const dict_index_t* index); /*!< in: index */
+dict_table_stats_lock(
+/*==================*/
+ const dict_table_t* table, /*!< in: table */
+ ulint latch_mode); /*!< in: RW_S_LATCH or
+ RW_X_LATCH */
/**********************************************************************//**
-Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */
+Unlock the latch that has been locked by dict_table_stats_lock() */
UNIV_INTERN
void
-dict_index_stat_mutex_exit(
-/*=======================*/
- const dict_index_t* index); /*!< in: index */
+dict_table_stats_unlock(
+/*====================*/
+ const dict_table_t* table, /*!< in: table */
+ ulint latch_mode); /*!< in: RW_S_LATCH or
+ RW_X_LATCH */
/********************************************************************//**
Checks if the database name in two table names is the same.
@return TRUE if same db name */
@@ -1159,7 +1216,7 @@ struct dict_sys_struct{
and DROP TABLE, as well as reading
the dictionary data for a table from
system tables */
- dulint row_id; /*!< the next row id to assign;
+ row_id_t row_id; /*!< the next row id to assign;
NOTE that at a checkpoint this
must be written to the dict system
header and flushed to a file; in
diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic
index bd7534dc7e2..b03f5117295 100644
--- a/storage/xtradb/include/dict0dict.ic
+++ b/storage/xtradb/include/dict0dict.ic
@@ -29,6 +29,46 @@ Created 1/8/1996 Heikki Tuuri
#include "rem0types.h"
/*********************************************************************//**
+Gets the minimum number of bytes per character.
+@return minimum multi-byte char size, in bytes */
+UNIV_INLINE
+ulint
+dict_col_get_mbminlen(
+/*==================*/
+ const dict_col_t* col) /*!< in: column */
+{
+ return(DATA_MBMINLEN(col->mbminmaxlen));
+}
+/*********************************************************************//**
+Gets the maximum number of bytes per character.
+@return maximum multi-byte char size, in bytes */
+UNIV_INLINE
+ulint
+dict_col_get_mbmaxlen(
+/*==================*/
+ const dict_col_t* col) /*!< in: column */
+{
+ return(DATA_MBMAXLEN(col->mbminmaxlen));
+}
+/*********************************************************************//**
+Sets the minimum and maximum number of bytes per character. */
+UNIV_INLINE
+void
+dict_col_set_mbminmaxlen(
+/*=====================*/
+ dict_col_t* col, /*!< in/out: column */
+ ulint mbminlen, /*!< in: minimum multi-byte
+ character size, in bytes */
+ ulint mbmaxlen) /*!< in: minimum multi-byte
+ character size, in bytes */
+{
+ ut_ad(mbminlen < DATA_MBMAX);
+ ut_ad(mbmaxlen < DATA_MBMAX);
+ ut_ad(mbminlen <= mbmaxlen);
+
+ col->mbminmaxlen = DATA_MBMINMAXLEN(mbminlen, mbmaxlen);
+}
+/*********************************************************************//**
Gets the column data type. */
UNIV_INLINE
void
@@ -42,8 +82,7 @@ dict_col_copy_type(
type->mtype = col->mtype;
type->prtype = col->prtype;
type->len = col->len;
- type->mbminlen = col->mbminlen;
- type->mbmaxlen = col->mbmaxlen;
+ type->mbminmaxlen = col->mbminmaxlen;
}
#endif /* !UNIV_HOTBACKUP */
@@ -65,8 +104,7 @@ dict_col_type_assert_equal(
ut_ad(col->prtype == type->prtype);
ut_ad(col->len == type->len);
# ifndef UNIV_HOTBACKUP
- ut_ad(col->mbminlen == type->mbminlen);
- ut_ad(col->mbmaxlen == type->mbmaxlen);
+ ut_ad(col->mbminmaxlen == type->mbminmaxlen);
# endif /* !UNIV_HOTBACKUP */
return(TRUE);
@@ -84,7 +122,7 @@ dict_col_get_min_size(
const dict_col_t* col) /*!< in: column */
{
return(dtype_get_min_size_low(col->mtype, col->prtype, col->len,
- col->mbminlen, col->mbmaxlen));
+ col->mbminmaxlen));
}
/***********************************************************************//**
Returns the maximum size of the column.
@@ -109,7 +147,7 @@ dict_col_get_fixed_size(
ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */
{
return(dtype_get_fixed_size_low(col->mtype, col->prtype, col->len,
- col->mbminlen, col->mbmaxlen, comp));
+ col->mbminmaxlen, comp));
}
/***********************************************************************//**
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column.
@@ -797,6 +835,34 @@ dict_table_check_if_in_cache_low(
}
/**********************************************************************//**
+load a table into dictionary cache, ignore any error specified during load;
+@return table, NULL if not found */
+UNIV_INLINE
+dict_table_t*
+dict_table_get_low_ignore_err(
+/*==========================*/
+ const char* table_name, /*!< in: table name */
+ dict_err_ignore_t
+ ignore_err) /*!< in: error to be ignored when
+ loading a table definition */
+{
+ dict_table_t* table;
+
+ ut_ad(table_name);
+ ut_ad(mutex_own(&(dict_sys->mutex)));
+
+ table = dict_table_check_if_in_cache_low(table_name);
+
+ if (table == NULL) {
+ table = dict_load_table(table_name, TRUE, ignore_err);
+ }
+
+ ut_ad(!table || table->cached);
+
+ return(table);
+}
+
+/**********************************************************************//**
Gets a table; loads it to the dictionary cache if necessary. A low-level
function.
@return table, NULL if not found */
@@ -814,7 +880,7 @@ dict_table_get_low(
table = dict_table_check_if_in_cache_low(table_name);
if (table == NULL) {
- table = dict_load_table(table_name);
+ table = dict_load_table(table_name, TRUE, DICT_ERR_IGNORE_NONE);
}
ut_ad(!table || table->cached);
@@ -829,7 +895,7 @@ UNIV_INLINE
dict_table_t*
dict_table_get_on_id_low(
/*=====================*/
- dulint table_id) /*!< in: table id */
+ table_id_t table_id) /*!< in: table id */
{
dict_table_t* table;
ulint fold;
@@ -837,11 +903,11 @@ dict_table_get_on_id_low(
ut_ad(mutex_own(&(dict_sys->mutex)));
/* Look for the table name in the hash table */
- fold = ut_fold_dulint(table_id);
+ fold = ut_fold_ull(table_id);
HASH_SEARCH(id_hash, dict_sys->table_id_hash, fold,
dict_table_t*, table, ut_ad(table->cached),
- !ut_dulint_cmp(table->id, table_id));
+ table->id == table_id);
if (table == NULL) {
table = dict_load_table_on_id(table_id);
}
@@ -858,4 +924,30 @@ dict_table_get_on_id_low(
return(table);
}
+
+/**********************************************************************//**
+Determine bytes of column prefix to be stored in the undo log. Please
+note if the table format is UNIV_FORMAT_A (< DICT_TF_FORMAT_ZIP), no prefix
+needs to be stored in the undo log.
+@return bytes of column prefix to be stored in the undo log */
+UNIV_INLINE
+ulint
+dict_max_field_len_store_undo(
+/*==========================*/
+ dict_table_t* table, /*!< in: table */
+ const dict_col_t* col) /*!< in: column which index prefix
+ is based on */
+{
+ ulint prefix_len = 0;
+
+ if (dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP)
+ {
+ prefix_len = col->max_prefix
+ ? col->max_prefix
+ : DICT_MAX_FIELD_LEN_BY_FORMAT(table);
+ }
+
+ return(prefix_len);
+}
+
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/dict0load.h b/storage/xtradb/include/dict0load.h
index f41882019d5..215beee1ba6 100644
--- a/storage/xtradb/include/dict0load.h
+++ b/storage/xtradb/include/dict0load.h
@@ -31,6 +31,36 @@ Created 4/24/1996 Heikki Tuuri
#include "dict0types.h"
#include "ut0byte.h"
#include "mem0mem.h"
+#include "btr0types.h"
+
+/** enum that defines all 6 system table IDs */
+enum dict_system_table_id {
+ SYS_TABLES = 0,
+ SYS_INDEXES,
+ SYS_COLUMNS,
+ SYS_FIELDS,
+ SYS_FOREIGN,
+ SYS_FOREIGN_COLS,
+ SYS_STATS,
+
+ /* This must be last item. Defines the number of system tables. */
+ SYS_NUM_SYSTEM_TABLES
+};
+
+typedef enum dict_system_table_id dict_system_id_t;
+
+/** Status bit for dict_process_sys_tables_rec() */
+enum dict_table_info {
+ DICT_TABLE_LOAD_FROM_RECORD = 0,/*!< Directly populate a dict_table_t
+ structure with information from
+ a SYS_TABLES record */
+ DICT_TABLE_LOAD_FROM_CACHE = 1, /*!< Check first whether dict_table_t
+ is in the cache, if so, return it */
+ DICT_TABLE_UPDATE_STATS = 2 /*!< whether to update statistics
+ when loading SYS_TABLES information. */
+};
+
+typedef enum dict_table_info dict_table_info_t;
/********************************************************************//**
In a crash recovery we already have all the tablespace objects created.
@@ -54,6 +84,84 @@ char*
dict_get_first_table_name_in_db(
/*============================*/
const char* name); /*!< in: database name which ends to '/' */
+
+/********************************************************************//**
+Loads a table definition from a SYS_TABLES record to dict_table_t.
+Does not load any columns or indexes.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_load_table_low(
+/*================*/
+ const char* name, /*!< in: table name */
+ const rec_t* rec, /*!< in: SYS_TABLES record */
+ dict_table_t** table); /*!< out,own: table, or NULL */
+/********************************************************************//**
+Loads a table column definition from a SYS_COLUMNS record to
+dict_table_t.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_load_column_low(
+/*=================*/
+ dict_table_t* table, /*!< in/out: table, could be NULL
+ if we just populate a dict_column_t
+ struct with information from
+ a SYS_COLUMNS record */
+ mem_heap_t* heap, /*!< in/out: memory heap
+ for temporary storage */
+ dict_col_t* column, /*!< out: dict_column_t to fill,
+ or NULL if table != NULL */
+ table_id_t* table_id, /*!< out: table id */
+ const char** col_name, /*!< out: column name */
+ const rec_t* rec); /*!< in: SYS_COLUMNS record */
+/********************************************************************//**
+Loads an index definition from a SYS_INDEXES record to dict_index_t.
+If allocate=TRUE, we will create a dict_index_t structure and fill it
+accordingly. If allocated=FALSE, the dict_index_t will be supplied by
+the caller and filled with information read from the record. @return
+error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_load_index_low(
+/*================*/
+ byte* table_id, /*!< in/out: table id (8 bytes),
+ an "in" value if allocate=TRUE
+ and "out" when allocate=FALSE */
+ const char* table_name, /*!< in: table name */
+ mem_heap_t* heap, /*!< in/out: temporary memory heap */
+ const rec_t* rec, /*!< in: SYS_INDEXES record */
+ ibool allocate, /*!< in: TRUE=allocate *index,
+ FALSE=fill in a pre-allocated
+ *index */
+ dict_index_t** index); /*!< out,own: index, or NULL */
+/********************************************************************//**
+Loads an index field definition from a SYS_FIELDS record to
+dict_index_t.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_load_field_low(
+/*================*/
+ byte* index_id, /*!< in/out: index id (8 bytes)
+ an "in" value if index != NULL
+ and "out" if index == NULL */
+ dict_index_t* index, /*!< in/out: index, could be NULL
+ if we just populate a dict_field_t
+ struct with information from
+ a SYS_FIELDS record */
+ dict_field_t* sys_field, /*!< out: dict_field_t to be
+ filled */
+ ulint* pos, /*!< out: Field position */
+ byte* last_index_id, /*!< in: last index id */
+ mem_heap_t* heap, /*!< in/out: memory heap
+ for temporary storage */
+ const rec_t* rec, /*!< in: SYS_FIELDS record */
+ char* addition_err_str,/*!< out: additional error message
+ that requires information to be
+ filled, or NULL */
+ ulint err_str_len); /*!< in: length of addition_err_str
+ in bytes */
/********************************************************************//**
Loads a table definition and also all its index definitions, and also
the cluster definition if the table is a member in a cluster. Also loads
@@ -66,8 +174,12 @@ UNIV_INTERN
dict_table_t*
dict_load_table(
/*============*/
- const char* name); /*!< in: table name in the
+ const char* name, /*!< in: table name in the
databasename/tablename format */
+ ibool cached, /*!< in: TRUE=add to cache, FALSE=do not */
+ dict_err_ignore_t ignore_err);
+ /*!< in: error to be ignored when loading
+ table and its indexes' definition */
/***********************************************************************//**
Loads a table object based on the table id.
@return table; NULL if table does not exist */
@@ -75,7 +187,7 @@ UNIV_INTERN
dict_table_t*
dict_load_table_on_id(
/*==================*/
- dulint table_id); /*!< in: table id */
+ table_id_t table_id); /*!< in: table id */
/********************************************************************//**
This function is called when the database is booted.
Loads system table index definitions except for the clustered index which
@@ -109,7 +221,127 @@ void
dict_print(void);
/*============*/
-
+/********************************************************************//**
+This function opens a system table, and return the first record.
+@return first record of the system table */
+UNIV_INTERN
+const rec_t*
+dict_startscan_system(
+/*==================*/
+ btr_pcur_t* pcur, /*!< out: persistent cursor to
+ the record */
+ mtr_t* mtr, /*!< in: the mini-transaction */
+ dict_system_id_t system_id); /*!< in: which system table to open */
+/********************************************************************//**
+This function get the next system table record as we scan the table.
+@return the record if found, NULL if end of scan. */
+UNIV_INTERN
+const rec_t*
+dict_getnext_system(
+/*================*/
+ btr_pcur_t* pcur, /*!< in/out: persistent cursor
+ to the record */
+ mtr_t* mtr); /*!< in: the mini-transaction */
+/********************************************************************//**
+This function processes one SYS_TABLES record and populate the dict_table_t
+struct for the table. Extracted out of dict_print() to be used by
+both monitor table output and information schema innodb_sys_tables output.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_tables_rec(
+/*========================*/
+ mem_heap_t* heap, /*!< in: temporary memory heap */
+ const rec_t* rec, /*!< in: SYS_TABLES record */
+ dict_table_t** table, /*!< out: dict_table_t to fill */
+ dict_table_info_t status); /*!< in: status bit controls
+ options such as whether we shall
+ look for dict_table_t from cache
+ first */
+/********************************************************************//**
+This function parses a SYS_INDEXES record and populate a dict_index_t
+structure with the information from the record. For detail information
+about SYS_INDEXES fields, please refer to dict_boot() function.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_indexes_rec(
+/*=========================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_INDEXES rec */
+ dict_index_t* index, /*!< out: dict_index_t to be
+ filled */
+ table_id_t* table_id); /*!< out: table id */
+/********************************************************************//**
+This function parses a SYS_COLUMNS record and populate a dict_column_t
+structure with the information from the record.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_columns_rec(
+/*=========================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_COLUMNS rec */
+ dict_col_t* column, /*!< out: dict_col_t to be filled */
+ table_id_t* table_id, /*!< out: table id */
+ const char** col_name); /*!< out: column name */
+/********************************************************************//**
+This function parses a SYS_FIELDS record and populate a dict_field_t
+structure with the information from the record.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_fields_rec(
+/*========================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_FIELDS rec */
+ dict_field_t* sys_field, /*!< out: dict_field_t to be
+ filled */
+ ulint* pos, /*!< out: Field position */
+ index_id_t* index_id, /*!< out: current index id */
+ index_id_t last_id); /*!< in: previous index id */
+/********************************************************************//**
+This function parses a SYS_FOREIGN record and populate a dict_foreign_t
+structure with the information from the record. For detail information
+about SYS_FOREIGN fields, please refer to dict_load_foreign() function
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_foreign_rec(
+/*=========================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_FOREIGN rec */
+ dict_foreign_t* foreign); /*!< out: dict_foreign_t to be
+ filled */
+/********************************************************************//**
+This function parses a SYS_FOREIGN_COLS record and extract necessary
+information from the record and return to caller.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_foreign_col_rec(
+/*=============================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_FOREIGN_COLS rec */
+ const char** name, /*!< out: foreign key constraint name */
+ const char** for_col_name, /*!< out: referencing column name */
+ const char** ref_col_name, /*!< out: referenced column name
+ in referenced table */
+ ulint* pos); /*!< out: column position */
+/********************************************************************//**
+This function parses a SYS_STATS record and extract necessary
+information from the record and return to caller.
+@return error message, or NULL on success */
+UNIV_INTERN
+const char*
+dict_process_sys_stats_rec(
+/*=============================*/
+ mem_heap_t* heap, /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_STATS rec */
+ index_id_t* index_id, /*!< out: INDEX_ID */
+ ulint* key_cols, /*!< out: KEY_COLS */
+ ib_uint64_t* diff_vals, /*!< out: DIFF_VALS */
+ ib_uint64_t* non_null_vals); /*!< out: NON_NULL_VALS */
#ifndef UNIV_NONINL
#include "dict0load.ic"
#endif
diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h
index 6736c2a3a36..71af9ce2f0c 100644
--- a/storage/xtradb/include/dict0mem.h
+++ b/storage/xtradb/include/dict0mem.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. 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
@@ -88,6 +88,10 @@ combination of types */
new BLOB treatment */
/** Maximum supported file format */
#define DICT_TF_FORMAT_MAX DICT_TF_FORMAT_ZIP
+
+/** Minimum supported file format */
+#define DICT_TF_FORMAT_MIN DICT_TF_FORMAT_51
+
/* @} */
#define DICT_TF_BITS 6 /*!< number of flag bits */
#if (1 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT)) <= DICT_TF_FORMAT_MAX
@@ -118,7 +122,7 @@ This could result in rescursive calls and out of stack error eventually.
DICT_FK_MAX_RECURSIVE_LOAD defines the maximum number of recursive loads,
when exceeded, the child table will not be loaded. It will be loaded when
the foreign constraint check needs to be run. */
-#define DICT_FK_MAX_RECURSIVE_LOAD 250
+#define DICT_FK_MAX_RECURSIVE_LOAD 255
/** Similarly, when tables are chained together with foreign key constraints
with on cascading delete/update clause, delete from parent table could
@@ -126,7 +130,7 @@ result in recursive cascading calls. This defines the maximum number of
such cascading deletes/updates allowed. When exceeded, the delete from
parent table will fail, and user has to drop excessive foreign constraint
before proceeds. */
-#define FK_MAX_CASCADE_DEL 300
+#define FK_MAX_CASCADE_DEL 255
/**********************************************************************//**
Creates a table memory object.
@@ -162,6 +166,36 @@ dict_mem_table_add_col(
ulint prtype, /*!< in: precise type */
ulint len); /*!< in: precision */
/**********************************************************************//**
+This function populates a dict_col_t memory structure with
+supplied information. */
+UNIV_INTERN
+void
+dict_mem_fill_column_struct(
+/*========================*/
+ dict_col_t* column, /*!< out: column struct to be
+ filled */
+ ulint col_pos, /*!< in: column position */
+ ulint mtype, /*!< in: main data type */
+ ulint prtype, /*!< in: precise type */
+ ulint col_len); /*!< in: column length */
+/**********************************************************************//**
+This function poplulates a dict_index_t index memory structure with
+supplied information. */
+UNIV_INLINE
+void
+dict_mem_fill_index_struct(
+/*=======================*/
+ dict_index_t* index, /*!< out: index to be filled */
+ mem_heap_t* heap, /*!< in: memory heap */
+ const char* table_name, /*!< in: table name */
+ const char* index_name, /*!< in: index name */
+ ulint space, /*!< in: space where the index tree is
+ placed, ignored if the index is of
+ the clustered type */
+ ulint type, /*!< in: DICT_UNIQUE,
+ DICT_CLUSTERED, ... ORed */
+ ulint n_fields); /*!< in: number of fields */
+/**********************************************************************//**
Creates an index memory object.
@return own: index object */
UNIV_INTERN
@@ -204,6 +238,30 @@ dict_foreign_t*
dict_mem_foreign_create(void);
/*=========================*/
+/**********************************************************************//**
+Sets the foreign_table_name_lookup pointer based on the value of
+lower_case_table_names. If that is 0 or 1, foreign_table_name_lookup
+will point to foreign_table_name. If 2, then another string is
+allocated from the heap and set to lower case. */
+UNIV_INTERN
+void
+dict_mem_foreign_table_name_lookup_set(
+/*===================================*/
+ dict_foreign_t* foreign, /*!< in/out: foreign struct */
+ ibool do_alloc); /*!< in: is an alloc needed */
+
+/**********************************************************************//**
+Sets the referenced_table_name_lookup pointer based on the value of
+lower_case_table_names. If that is 0 or 1, referenced_table_name_lookup
+will point to referenced_table_name. If 2, then another string is
+allocated from the heap and set to lower case. */
+UNIV_INTERN
+void
+dict_mem_referenced_table_name_lookup_set(
+/*======================================*/
+ dict_foreign_t* foreign, /*!< in/out: foreign struct */
+ ibool do_alloc); /*!< in: is an alloc needed */
+
/** Data structure for a column in a table */
struct dict_col_struct{
/*----------------------*/
@@ -230,10 +288,11 @@ struct dict_col_struct{
the string, MySQL uses 1 or 2
bytes to store the string length) */
- unsigned mbminlen:2; /*!< minimum length of a
- character, in bytes */
- unsigned mbmaxlen:3; /*!< maximum length of a
- character, in bytes */
+ unsigned mbminmaxlen:5; /*!< minimum and maximum length of a
+ character, in bytes;
+ DATA_MBMINMAXLEN(mbminlen,mbmaxlen);
+ mbminlen=DATA_MBMINLEN(mbminmaxlen);
+ mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */
/*----------------------*/
/* End of definitions copied from dtype_t */
/* @} */
@@ -243,38 +302,64 @@ struct dict_col_struct{
unsigned ord_part:1; /*!< nonzero if this column
appears in the ordering fields
of an index */
+ unsigned max_prefix:12; /*!< maximum index prefix length on
+ this column. Our current max limit is
+ 3072 for Barracuda table */
};
-/** @brief DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
-indexed column length (or indexed prefix length).
+/** @brief DICT_ANTELOPE_MAX_INDEX_COL_LEN is measured in bytes and
+is the maximum indexed column length (or indexed prefix length) in
+ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT. Also, in any format,
+any fixed-length field that is longer than this will be encoded as
+a variable-length field.
It is set to 3*256, so that one can create a column prefix index on
256 characters of a TEXT or VARCHAR column also in the UTF-8
charset. In that charset, a character may take at most 3 bytes. This
constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
files would be at risk! */
-#define DICT_MAX_INDEX_COL_LEN REC_MAX_INDEX_COL_LEN
+#define DICT_ANTELOPE_MAX_INDEX_COL_LEN REC_ANTELOPE_MAX_INDEX_COL_LEN
+
+/** Find out maximum indexed column length by its table format.
+For ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT, the maximum
+field length is REC_ANTELOPE_MAX_INDEX_COL_LEN - 1 (767). For new
+barracuda format, the length could be REC_VERSION_56_MAX_INDEX_COL_LEN
+(3072) bytes */
+#define DICT_MAX_FIELD_LEN_BY_FORMAT(table) \
+ ((dict_table_get_format(table) < DICT_TF_FORMAT_ZIP) \
+ ? (REC_ANTELOPE_MAX_INDEX_COL_LEN - 1) \
+ : REC_VERSION_56_MAX_INDEX_COL_LEN)
+
+#define DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(flags) \
+ ((((flags & DICT_TF_FORMAT_MASK) >> DICT_TF_FORMAT_SHIFT)\
+ < DICT_TF_FORMAT_ZIP) \
+ ? (REC_ANTELOPE_MAX_INDEX_COL_LEN - 1) \
+ : REC_VERSION_56_MAX_INDEX_COL_LEN)
+
+/** Defines the maximum fixed length column size */
+#define DICT_MAX_FIXED_COL_LEN DICT_ANTELOPE_MAX_INDEX_COL_LEN
/** Data structure for a field in an index */
struct dict_field_struct{
dict_col_t* col; /*!< pointer to the table column */
const char* name; /*!< name of the column */
- unsigned prefix_len:10; /*!< 0 or the length of the column
+ unsigned prefix_len:12; /*!< 0 or the length of the column
prefix in bytes in a MySQL index of
type, e.g., INDEX (textcol(25));
must be smaller than
- DICT_MAX_INDEX_COL_LEN; NOTE that
- in the UTF-8 charset, MySQL sets this
- to 3 * the prefix len in UTF-8 chars */
+ DICT_MAX_FIELD_LEN_BY_FORMAT;
+ NOTE that in the UTF-8 charset, MySQL
+ sets this to (mbmaxlen * the prefix len)
+ in UTF-8 chars */
unsigned fixed_len:10; /*!< 0 or the fixed length of the
column if smaller than
- DICT_MAX_INDEX_COL_LEN */
+ DICT_ANTELOPE_MAX_INDEX_COL_LEN */
};
/** Data structure for an index. Most fields will be
initialized to 0, NULL or FALSE in dict_mem_index_create(). */
struct dict_index_struct{
- dulint id; /*!< id of the index */
+ index_id_t id; /*!< id of the index */
mem_heap_t* heap; /*!< memory heap */
const char* name; /*!< index name */
const char* table_name;/*!< table name */
@@ -306,6 +391,8 @@ struct dict_index_struct{
/*!< TRUE if this index is marked to be
dropped in ha_innobase::prepare_drop_index(),
otherwise FALSE */
+ unsigned corrupted:1;
+ /*!< TRUE if the index object is corrupted */
dict_field_t* fields; /*!< array of field descriptions */
#ifndef UNIV_HOTBACKUP
UT_LIST_NODE_T(dict_index_t)
@@ -321,6 +408,12 @@ struct dict_index_struct{
dict_get_n_unique(index); we
periodically calculate new
estimates */
+ ib_int64_t* stat_n_non_null_key_vals;
+ /* approximate number of non-null key values
+ for this index, for each column where
+ n < dict_get_n_unique(index); This
+ is used when innodb_stats_method is
+ "nulls_ignored". */
ulint stat_index_size;
/*!< approximate index size in
database pages */
@@ -330,10 +423,17 @@ struct dict_index_struct{
/* @} */
rw_lock_t lock; /*!< read-write lock protecting the
upper levels of the index tree */
- ib_uint64_t trx_id; /*!< id of the transaction that created this
+ trx_id_t trx_id; /*!< id of the transaction that created this
index, or 0 if the index existed
when InnoDB was started up */
#endif /* !UNIV_HOTBACKUP */
+#ifdef UNIV_BLOB_DEBUG
+ mutex_t blobs_mutex;
+ /*!< mutex protecting blobs */
+ void* blobs; /*!< map of (page_no,heap_no,field_no)
+ to first_blob_page_no; protected by
+ blobs_mutex; @see btr_blob_dbg_t */
+#endif /* UNIV_BLOB_DEBUG */
#ifdef UNIV_DEBUG
ulint magic_n;/*!< magic number */
/** Value of dict_index_struct::magic_n */
@@ -358,10 +458,14 @@ struct dict_foreign_struct{
unsigned type:6; /*!< 0 or DICT_FOREIGN_ON_DELETE_CASCADE
or DICT_FOREIGN_ON_DELETE_SET_NULL */
char* foreign_table_name;/*!< foreign table name */
+ char* foreign_table_name_lookup;
+ /*!< foreign table name used for dict lookup */
dict_table_t* foreign_table; /*!< table where the foreign key is */
const char** foreign_col_names;/*!< names of the columns in the
foreign key */
char* referenced_table_name;/*!< referenced table name */
+ char* referenced_table_name_lookup;
+ /*!< referenced table name for dict lookup*/
dict_table_t* referenced_table;/*!< table where the referenced key
is */
const char** referenced_col_names;/*!< names of the referenced
@@ -395,7 +499,7 @@ a foreign key constraint is enforced, therefore RESTRICT just means no flag */
/** Data structure for a database table. Most fields will be
initialized to 0, NULL or FALSE in dict_mem_table_create(). */
struct dict_table_struct{
- dulint id; /*!< id of the table */
+ table_id_t id; /*!< id of the table */
mem_heap_t* heap; /*!< memory heap */
char* name; /*!< table name */
const char* dir_path_of_temp_table;/*!< NULL or the directory path
@@ -422,6 +526,8 @@ struct dict_table_struct{
to the dictionary cache */
unsigned n_def:10;/*!< number of columns defined so far */
unsigned n_cols:10;/*!< number of columns */
+ unsigned corrupted:1;
+ /*!< TRUE if table is corrupted */
dict_col_t* cols; /*!< array of column descriptions */
const char* col_names;
/*!< Column names packed in a character string
diff --git a/storage/xtradb/include/dict0mem.ic b/storage/xtradb/include/dict0mem.ic
index c36adb07a18..1d80ffc9b94 100644
--- a/storage/xtradb/include/dict0mem.ic
+++ b/storage/xtradb/include/dict0mem.ic
@@ -23,4 +23,50 @@ Data dictionary memory object creation
Created 1/8/1996 Heikki Tuuri
***********************************************************************/
+#include "data0type.h"
+#include "dict0mem.h"
+#include "fil0fil.h"
+/**********************************************************************//**
+This function poplulates a dict_index_t index memory structure with
+supplied information. */
+UNIV_INLINE
+void
+dict_mem_fill_index_struct(
+/*=======================*/
+ dict_index_t* index, /*!< out: index to be filled */
+ mem_heap_t* heap, /*!< in: memory heap */
+ const char* table_name, /*!< in: table name */
+ const char* index_name, /*!< in: index name */
+ ulint space, /*!< in: space where the index tree is
+ placed, ignored if the index is of
+ the clustered type */
+ ulint type, /*!< in: DICT_UNIQUE,
+ DICT_CLUSTERED, ... ORed */
+ ulint n_fields) /*!< in: number of fields */
+{
+
+ if (heap) {
+ index->heap = heap;
+ index->name = mem_heap_strdup(heap, index_name);
+ index->fields = (dict_field_t*) mem_heap_alloc(
+ heap, 1 + n_fields * sizeof(dict_field_t));
+ } else {
+ index->name = index_name;
+ index->heap = NULL;
+ index->fields = NULL;
+ }
+
+ index->type = type;
+#ifndef UNIV_HOTBACKUP
+ index->space = (unsigned int) space;
+ index->page = FIL_NULL;
+#endif /* !UNIV_HOTBACKUP */
+ index->table_name = table_name;
+ index->n_fields = (unsigned int) n_fields;
+ /* The '1 +' above prevents allocation
+ of an empty mem block */
+#ifdef UNIV_DEBUG
+ index->magic_n = DICT_INDEX_MAGIC_N;
+#endif /* UNIV_DEBUG */
+}
diff --git a/storage/xtradb/include/dict0types.h b/storage/xtradb/include/dict0types.h
index 7ad69193cc9..8cbd7cd5783 100644
--- a/storage/xtradb/include/dict0types.h
+++ b/storage/xtradb/include/dict0types.h
@@ -33,11 +33,6 @@ typedef struct dict_index_struct dict_index_t;
typedef struct dict_table_struct dict_table_t;
typedef struct dict_foreign_struct dict_foreign_t;
-/* A cluster object is a table object with the type field set to
-DICT_CLUSTERED */
-
-typedef dict_table_t dict_cluster_t;
-
typedef struct ind_node_struct ind_node_t;
typedef struct tab_node_struct tab_node_t;
@@ -45,4 +40,21 @@ typedef struct tab_node_struct tab_node_t;
#define DICT_HDR_SPACE 0 /* the SYSTEM tablespace */
#define DICT_HDR_PAGE_NO FSP_DICT_HDR_PAGE_NO
+typedef ib_id_t table_id_t;
+typedef ib_id_t index_id_t;
+
+/** Error to ignore when we load table dictionary into memory. However,
+the table and index will be marked as "corrupted", and caller will
+be responsible to deal with corrupted table or index.
+Note: please define the IGNORE_ERR_* as bits, so their value can
+be or-ed together */
+enum dict_err_ignore {
+ DICT_ERR_IGNORE_NONE = 0, /*!< no error to ignore */
+ DICT_ERR_IGNORE_INDEX_ROOT = 1, /*!< ignore error if index root
+ page is FIL_NUL or incorrect value */
+ DICT_ERR_IGNORE_ALL = 0xFFFF /*!< ignore all errors */
+};
+
+typedef enum dict_err_ignore dict_err_ignore_t;
+
#endif
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index 07c80ef8609..840a9fbb13a 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -27,12 +27,13 @@ Created 10/25/1995 Heikki Tuuri
#define fil0fil_h
#include "univ.i"
-#ifndef UNIV_HOTBACKUP
-#include "sync0rw.h"
-#endif /* !UNIV_HOTBACKUP */
#include "dict0types.h"
#include "ut0byte.h"
#include "os0file.h"
+#ifndef UNIV_HOTBACKUP
+#include "sync0rw.h"
+#include "ibuf0types.h"
+#endif /* !UNIV_HOTBACKUP */
/** When mysqld is run, the default directory "." is the mysqld datadir,
but in the MySQL Embedded Server Library and ibbackup it is not the default
@@ -648,18 +649,10 @@ _fil_io(
Confirm whether the parameters are valid or not */
UNIV_INTERN
ibool
-fil_area_is_exist(
+fil_is_exist(
/*==============*/
ulint space_id, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size in bytes;
- 0 for uncompressed pages */
- ulint block_offset, /*!< in: offset in number of blocks */
- ulint byte_offset, /*!< in: remainder of offset in bytes; in
- aio this must be divisible by the OS block
- size */
- ulint len); /*!< in: how many bytes to read or write; this
- must not cross a file boundary; in aio this
- must be a block size multiple */
+ ulint block_offset); /*!< in: offset in number of blocks */
/**********************************************************************//**
Waits for an aio operation to complete. This function is used to write the
handler for completed requests. The aio array of pending requests is divided
@@ -678,8 +671,9 @@ UNIV_INTERN
void
fil_flush(
/*======*/
- ulint space_id); /*!< in: file space id (this can be a group of
+ ulint space_id, /*!< in: file space id (this can be a group of
log files or a tablespace of the database) */
+ ibool metadata);
/**********************************************************************//**
Flushes to disk writes in file spaces of the given type possibly cached by
the OS. */
@@ -737,6 +731,15 @@ fil_page_get_type(
/*==============*/
const byte* page); /*!< in: file page */
+/*******************************************************************//**
+Returns TRUE if a single-table tablespace is being deleted.
+@return TRUE if being deleted */
+UNIV_INTERN
+ibool
+fil_tablespace_is_being_deleted(
+/*============================*/
+ ulint id); /*!< in: space id */
+
/*************************************************************************
Return local hash table informations. */
diff --git a/storage/xtradb/include/fsp0types.h b/storage/xtradb/include/fsp0types.h
index 2dd2deca671..43e385b7eb0 100644
--- a/storage/xtradb/include/fsp0types.h
+++ b/storage/xtradb/include/fsp0types.h
@@ -42,7 +42,7 @@ fseg_alloc_free_page) */
/* @} */
/** File space extent size (one megabyte) in pages */
-#define FSP_EXTENT_SIZE (1u << (20 - UNIV_PAGE_SIZE_SHIFT))
+#define FSP_EXTENT_SIZE ((ulint)1 << (20 - UNIV_PAGE_SIZE_SHIFT))
/** On a page of any file segment, data may be put starting from this
offset */
diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h
index 445d94eeabb..02e7712df58 100644
--- a/storage/xtradb/include/ha_prototypes.h
+++ b/storage/xtradb/include/ha_prototypes.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2006, 2010, Innobase Oy. 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
@@ -174,6 +174,15 @@ innobase_strcasecmp(
const char* b); /*!< in: second string to compare */
/******************************************************************//**
+Strip dir name from a full path name and return only its file name.
+@return file name or "null" if no file name */
+UNIV_INTERN
+const char*
+innobase_basename(
+/*==============*/
+ const char* path_name); /*!< in: full path name */
+
+/******************************************************************//**
Returns true if the thread is executing a SELECT statement.
@return true if thd is executing SELECT */
@@ -267,13 +276,31 @@ thd_lock_wait_timeout(
/*==================*/
void* thd); /*!< in: thread handle (THD*), or NULL to query
the global innodb_lock_wait_timeout */
-
+/******************************************************************//**
+Add up the time waited for the lock for the current query. */
+UNIV_INTERN
+void
+thd_set_lock_wait_time(
+/*===================*/
+ void* thd, /*!< in: thread handle (THD*) */
+ ulint value); /*!< in: time waited for the lock */
/******************************************************************//**
*/
ulong
-thd_flush_log_at_trx_commit_session(
+thd_flush_log_at_trx_commit(
/*================================*/
void* thd);
+/**********************************************************************//**
+Get the current setting of the lower_case_table_names global parameter from
+mysqld.cc. We do a dirty read because for one there is no synchronization
+object and secondly there is little harm in doing so even if we get a torn
+read.
+@return value of lower_case_table_names */
+UNIV_INTERN
+ulint
+innobase_get_lower_case_table_names(void);
+/*=====================================*/
+
#endif
diff --git a/storage/xtradb/include/handler0alter.h b/storage/xtradb/include/handler0alter.h
index 7f5af6d2e76..017fe88d533 100644
--- a/storage/xtradb/include/handler0alter.h
+++ b/storage/xtradb/include/handler0alter.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2005, 2010, Innobase Oy. 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
diff --git a/storage/xtradb/include/hash0hash.h b/storage/xtradb/include/hash0hash.h
index 492c767acc4..b17c21a45ef 100644
--- a/storage/xtradb/include/hash0hash.h
+++ b/storage/xtradb/include/hash0hash.h
@@ -49,28 +49,6 @@ hash_table_t*
hash_create(
/*========*/
ulint n); /*!< in: number of array cells */
-
-/*************************************************************//**
-*/
-UNIV_INTERN
-ulint
-hash_create_needed(
-/*===============*/
- ulint n);
-
-UNIV_INTERN
-void
-hash_create_init(
-/*=============*/
- hash_table_t* table,
- ulint n);
-
-UNIV_INTERN
-void
-hash_create_reuse(
-/*==============*/
- hash_table_t* table);
-
#ifndef UNIV_HOTBACKUP
/*************************************************************//**
Creates a mutex array to protect a hash table. */
@@ -350,33 +328,6 @@ do {\
}\
} while (0)
-/********************************************************************//**
-Align nodes with moving location.*/
-#define HASH_OFFSET(TABLE, NODE_TYPE, PTR_NAME, FADDR, FOFFSET, BOFFSET) \
-do {\
- ulint i2222;\
- ulint cell_count2222;\
-\
- cell_count2222 = hash_get_n_cells(TABLE);\
-\
- for (i2222 = 0; i2222 < cell_count2222; i2222++) {\
- NODE_TYPE* node2222;\
-\
- if ((TABLE)->array[i2222].node) \
- (TABLE)->array[i2222].node = (void*)((byte*)(TABLE)->array[i2222].node \
- + (((TABLE)->array[i2222].node > (void*)FADDR)?FOFFSET:BOFFSET));\
- node2222 = HASH_GET_FIRST((TABLE), i2222);\
-\
- while (node2222) {\
- if (node2222->PTR_NAME) \
- node2222->PTR_NAME = (void*)((byte*)(node2222->PTR_NAME) \
- + ((((void*)node2222->PTR_NAME) > (void*)FADDR)?FOFFSET:BOFFSET));\
-\
- node2222 = node2222->PTR_NAME;\
- }\
- }\
-} while (0)
-
/************************************************************//**
Gets the mutex index for a fold value in a hash table.
@return mutex number */
diff --git a/storage/xtradb/include/ibuf0ibuf.h b/storage/xtradb/include/ibuf0ibuf.h
index 8aa21fb9d95..0fb0aae9786 100644
--- a/storage/xtradb/include/ibuf0ibuf.h
+++ b/storage/xtradb/include/ibuf0ibuf.h
@@ -35,12 +35,27 @@ Created 7/19/1997 Heikki Tuuri
#ifndef UNIV_HOTBACKUP
# include "ibuf0types.h"
+/* Possible operations buffered in the insert/whatever buffer. See
+ibuf_insert(). DO NOT CHANGE THE VALUES OF THESE, THEY ARE STORED ON DISK. */
+typedef enum {
+ IBUF_OP_INSERT = 0,
+ IBUF_OP_DELETE_MARK = 1,
+ IBUF_OP_DELETE = 2,
+
+ /* Number of different operation types. */
+ IBUF_OP_COUNT = 3
+} ibuf_op_t;
+
/** Combinations of operations that can be buffered. Because the enum
values are used for indexing innobase_change_buffering_values[], they
should start at 0 and there should not be any gaps. */
typedef enum {
IBUF_USE_NONE = 0,
IBUF_USE_INSERT, /* insert */
+ IBUF_USE_DELETE_MARK, /* delete */
+ IBUF_USE_INSERT_DELETE_MARK, /* insert+delete */
+ IBUF_USE_DELETE, /* delete+purge */
+ IBUF_USE_ALL, /* insert+delete+purge */
IBUF_USE_COUNT /* number of entries in ibuf_use_t */
} ibuf_use_t;
@@ -48,6 +63,11 @@ typedef enum {
/** Operations that can currently be buffered. */
extern ibuf_use_t ibuf_use;
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+/** Flag to control insert buffer debugging. */
+extern uint ibuf_debug;
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+
/** The insert buffer control structure */
extern ibuf_t* ibuf;
@@ -72,8 +92,7 @@ separately committed mini-transaction, because in crash recovery, the
free bits could momentarily be set too high. */
/******************************************************************//**
-Creates the insert buffer data structure at a database startup and
-initializes the data structures for the insert buffer of each tablespace. */
+Creates the insert buffer data structure at a database startup. */
UNIV_INTERN
void
ibuf_init_at_db_start(void);
@@ -85,6 +104,22 @@ UNIV_INTERN
void
ibuf_update_max_tablespace_id(void);
/*===============================*/
+/***************************************************************//**
+Starts an insert buffer mini-transaction. */
+UNIV_INLINE
+void
+ibuf_mtr_start(
+/*===========*/
+ mtr_t* mtr) /*!< out: mini-transaction */
+ __attribute__((nonnull));
+/***************************************************************//**
+Commits an insert buffer mini-transaction. */
+UNIV_INLINE
+void
+ibuf_mtr_commit(
+/*============*/
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ __attribute__((nonnull));
/*********************************************************************//**
Initializes an ibuf bitmap page. */
UNIV_INTERN
@@ -205,10 +240,12 @@ routine.
For instance, a read-ahead of non-ibuf pages is forbidden by threads
that are executing an insert buffer routine.
@return TRUE if inside an insert buffer routine */
-UNIV_INTERN
+UNIV_INLINE
ibool
-ibuf_inside(void);
-/*=============*/
+ibuf_inside(
+/*========*/
+ const mtr_t* mtr) /*!< in: mini-transaction */
+ __attribute__((nonnull, pure));
/***********************************************************************//**
Checks if a page address is an ibuf bitmap page (level 3 page) address.
@return TRUE if a bitmap page */
@@ -225,15 +262,44 @@ Must not be called when recv_no_ibuf_operations==TRUE.
@return TRUE if level 2 or level 3 page */
UNIV_INTERN
ibool
-ibuf_page(
-/*======*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
- ulint page_no,/*!< in: page number */
- mtr_t* mtr); /*!< in: mtr which will contain an x-latch to the
- bitmap page if the page is not one of the fixed
- address ibuf pages, or NULL, in which case a new
- transaction is created. */
+ibuf_page_low(
+/*==========*/
+ ulint space, /*!< in: space id */
+ ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
+ ulint page_no,/*!< in: page number */
+#ifdef UNIV_DEBUG
+ ibool x_latch,/*!< in: FALSE if relaxed check
+ (avoid latching the bitmap page) */
+#endif /* UNIV_DEBUG */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
+ mtr_t* mtr) /*!< in: mtr which will contain an
+ x-latch to the bitmap page if the page
+ is not one of the fixed address ibuf
+ pages, or NULL, in which case a new
+ transaction is created. */
+ __attribute__((warn_unused_result));
+#ifdef UNIV_DEBUG
+/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of
+pages. Must not be called when recv_no_ibuf_operations==TRUE.
+@param space tablespace identifier
+@param zip_size compressed page size in bytes, or 0
+@param page_no page number
+@param mtr mini-transaction or NULL
+@return TRUE if level 2 or level 3 page */
+# define ibuf_page(space, zip_size, page_no, mtr) \
+ ibuf_page_low(space, zip_size, page_no, TRUE, __FILE__, __LINE__, mtr)
+#else /* UVIV_DEBUG */
+/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of
+pages. Must not be called when recv_no_ibuf_operations==TRUE.
+@param space tablespace identifier
+@param zip_size compressed page size in bytes, or 0
+@param page_no page number
+@param mtr mini-transaction or NULL
+@return TRUE if level 2 or level 3 page */
+# define ibuf_page(space, zip_size, page_no, mtr) \
+ ibuf_page_low(space, zip_size, page_no, __FILE__, __LINE__, mtr)
+#endif /* UVIV_DEBUG */
/***********************************************************************//**
Frees excess pages from the ibuf free list. This function is called when an OS
thread calls fsp services to allocate a new file segment, or a new page to a
@@ -243,14 +309,15 @@ void
ibuf_free_excess_pages(void);
/*========================*/
/*********************************************************************//**
-Makes an index insert to the insert buffer, instead of directly to the disk
-page, if this is possible. Does not do insert if the index is clustered
-or unique.
+Buffer an operation in the insert/delete buffer, instead of doing it
+directly to the disk page, if this is possible. Does not do it if the index
+is clustered or unique.
@return TRUE if success */
UNIV_INTERN
ibool
ibuf_insert(
/*========*/
+ ibuf_op_t op, /*!< in: operation type */
const dtuple_t* entry, /*!< in: index entry to insert */
dict_index_t* index, /*!< in: index where to insert */
ulint space, /*!< in: space id where to insert */
@@ -259,11 +326,11 @@ ibuf_insert(
que_thr_t* thr); /*!< in: query thread */
/*********************************************************************//**
When an index page is read from a disk to the buffer pool, this function
-inserts to the page the possible index entries buffered in the insert buffer.
-The entries are deleted from the insert buffer. If the page is not read, but
-created in the buffer pool, this function deletes its buffered entries from
-the insert buffer; there can exist entries for such a page if the page
-belonged to an index which subsequently was dropped. */
+applies any buffered operations to the page and deletes the entries from the
+insert buffer. If the page is not read, but created in the buffer pool, this
+function deletes its buffered entries from the insert buffer; there can
+exist entries for such a page if the page belonged to an index which
+subsequently was dropped. */
UNIV_INTERN
void
ibuf_merge_or_delete_for_page(
@@ -356,12 +423,37 @@ void
ibuf_print(
/*=======*/
FILE* file); /*!< in: file where to print */
+/********************************************************************
+Read the first two bytes from a record's fourth field (counter field in new
+records; something else in older records).
+@return "counter" field, or ULINT_UNDEFINED if for some reason it can't be read */
+UNIV_INTERN
+ulint
+ibuf_rec_get_counter(
+/*=================*/
+ const rec_t* rec); /*!< in: ibuf record */
/******************************************************************//**
Closes insert buffer and frees the data structures. */
UNIV_INTERN
void
ibuf_close(void);
/*============*/
+/******************************************************************//**
+Function to pass ibuf status variables */
+UNIV_INTERN
+void
+ibuf_export_ibuf_status(
+/*====================*/
+ ulint* size,
+ ulint* free_list,
+ ulint* segment_size,
+ ulint* merges,
+ ulint* merged_inserts,
+ ulint* merged_delete_marks,
+ ulint* merged_deletes,
+ ulint* discarded_inserts,
+ ulint* discarded_delete_marks,
+ ulint* discarded_deletes);
#define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO
#define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO
diff --git a/storage/xtradb/include/ibuf0ibuf.ic b/storage/xtradb/include/ibuf0ibuf.ic
index 15bbe61ab30..0a22667a260 100644
--- a/storage/xtradb/include/ibuf0ibuf.ic
+++ b/storage/xtradb/include/ibuf0ibuf.ic
@@ -37,6 +37,30 @@ buffer inserts to this page. If there is this much of free space, the
corresponding bits are set in the ibuf bitmap. */
#define IBUF_PAGE_SIZE_PER_FREE_SPACE 32
+/***************************************************************//**
+Starts an insert buffer mini-transaction. */
+UNIV_INLINE
+void
+ibuf_mtr_start(
+/*===========*/
+ mtr_t* mtr) /*!< out: mini-transaction */
+{
+ mtr_start(mtr);
+ mtr->inside_ibuf = TRUE;
+}
+/***************************************************************//**
+Commits an insert buffer mini-transaction. */
+UNIV_INLINE
+void
+ibuf_mtr_commit(
+/*============*/
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+{
+ ut_ad(mtr->inside_ibuf);
+ ut_d(mtr->inside_ibuf = FALSE);
+ mtr_commit(mtr);
+}
+
/** Insert buffer struct */
struct ibuf_struct{
ulint size; /*!< current size of the ibuf index
@@ -46,19 +70,25 @@ struct ibuf_struct{
ulint seg_size; /*!< allocated pages of the file
segment containing ibuf header and
tree */
- ibool empty; /*!< after an insert to the ibuf tree
- is performed, this is set to FALSE,
- and if a contract operation finds
- the tree empty, this is set to
- TRUE */
+ ibool empty; /*!< Protected by the page
+ latch of the root page of the
+ insert buffer tree
+ (FSP_IBUF_TREE_ROOT_PAGE_NO). TRUE
+ if and only if the insert
+ buffer tree is empty. */
ulint free_list_len; /*!< length of the free list */
ulint height; /*!< tree height */
dict_index_t* index; /*!< insert buffer index */
- ulint n_inserts; /*!< number of inserts made to
- the insert buffer */
ulint n_merges; /*!< number of pages merged */
- ulint n_merged_recs; /*!< number of records merged */
+ ulint n_merged_ops[IBUF_OP_COUNT];
+ /*!< number of operations of each type
+ merged to index pages */
+ ulint n_discarded_ops[IBUF_OP_COUNT];
+ /*!< number of operations of each type
+ discarded without merging due to the
+ tablespace being deleted or the
+ index being dropped */
};
/************************************************************************//**
@@ -105,7 +135,7 @@ ibuf_should_try(
if (ibuf_flush_count % 4 == 0) {
- buf_LRU_try_free_flushed_blocks();
+ buf_LRU_try_free_flushed_blocks(NULL);
}
return(TRUE);
@@ -114,6 +144,22 @@ ibuf_should_try(
return(FALSE);
}
+/******************************************************************//**
+Returns TRUE if the current OS thread is performing an insert buffer
+routine.
+
+For instance, a read-ahead of non-ibuf pages is forbidden by threads
+that are executing an insert buffer routine.
+@return TRUE if inside an insert buffer routine */
+UNIV_INLINE
+ibool
+ibuf_inside(
+/*========*/
+ const mtr_t* mtr) /*!< in: mini-transaction */
+{
+ return(mtr->inside_ibuf);
+}
+
/***********************************************************************//**
Checks if a page address is an ibuf bitmap page address.
@return TRUE if a bitmap page */
diff --git a/storage/xtradb/include/lock0lock.h b/storage/xtradb/include/lock0lock.h
index 73f885ecf04..ea636f985b4 100644
--- a/storage/xtradb/include/lock0lock.h
+++ b/storage/xtradb/include/lock0lock.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. 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
@@ -43,7 +43,7 @@ extern ibool lock_print_waits;
#endif /* UNIV_DEBUG */
/* Buffer for storing information about the most recent deadlock error */
extern FILE* lock_latest_err_file;
-extern ulint srv_n_lock_deadlock_count;
+extern ulint srv_n_lock_deadlock_count;
/*********************************************************************//**
Gets the size of a lock struct.
@@ -73,9 +73,10 @@ UNIV_INLINE
trx_t*
lock_clust_rec_some_has_impl(
/*=========================*/
- const rec_t* rec, /*!< in: user record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets);/*!< in: rec_get_offsets(rec, index) */
+ const rec_t* rec, /*!< in: user record */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ __attribute__((nonnull, warn_unused_result));
/*********************************************************************//**
Gets the heap_no of the smallest user record on a page.
@return heap_no of smallest user record, or PAGE_HEAP_NO_SUPREMUM */
@@ -640,7 +641,7 @@ UNIV_INTERN
ulint
lock_number_of_rows_locked(
/*=======================*/
- trx_t* trx); /*!< in: transaction */
+ const trx_t* trx); /*!< in: transaction */
/*******************************************************************//**
Check if a transaction holds any autoinc locks.
@return TRUE if the transaction holds any AUTOINC locks. */
@@ -671,7 +672,7 @@ lock_get_type(
Gets the id of the transaction owning a lock.
@return transaction id */
UNIV_INTERN
-ullint
+trx_id_t
lock_get_trx_id(
/*============*/
const lock_t* lock); /*!< in: lock */
@@ -700,7 +701,7 @@ lock_get_type_str(
Gets the id of the table on which the lock is.
@return id of the table */
UNIV_INTERN
-ullint
+table_id_t
lock_get_table_id(
/*==============*/
const lock_t* lock); /*!< in: lock */
@@ -816,6 +817,7 @@ struct lock_op_struct{
/** The lock system struct */
struct lock_sys_struct{
hash_table_t* rec_hash; /*!< hash table of the record locks */
+ ulint rec_num;
};
/** The lock system */
diff --git a/storage/xtradb/include/lock0lock.ic b/storage/xtradb/include/lock0lock.ic
index 014722f51c4..1d740a5fa43 100644
--- a/storage/xtradb/include/lock0lock.ic
+++ b/storage/xtradb/include/lock0lock.ic
@@ -75,9 +75,9 @@ UNIV_INLINE
trx_t*
lock_clust_rec_some_has_impl(
/*=========================*/
- const rec_t* rec, /*!< in: user record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_t* rec, /*!< in: user record */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
{
trx_id_t trx_id;
diff --git a/storage/xtradb/include/log0log.h b/storage/xtradb/include/log0log.h
index 8fce4ef96bc..e0bffe6f725 100644
--- a/storage/xtradb/include/log0log.h
+++ b/storage/xtradb/include/log0log.h
@@ -672,6 +672,9 @@ extern log_t* log_sys;
when mysqld is first time started
on the restored database, it can
print helpful info for the user */
+#define LOG_FILE_OS_FILE_LOG_BLOCK_SIZE 64
+ /* extend to record log_block_size
+ of XtraDB. 0 means default 512 */
#define LOG_FILE_ARCH_COMPLETED OS_FILE_LOG_BLOCK_SIZE
/* this 4-byte field is TRUE when
the writing of an archived log file
@@ -763,6 +766,15 @@ struct log_struct{
#ifndef UNIV_HOTBACKUP
mutex_t mutex; /*!< mutex protecting the log */
#endif /* !UNIV_HOTBACKUP */
+
+ mutex_t log_flush_order_mutex;/*!< mutex to serialize access to
+ the flush list when we are putting
+ dirty blocks in the list. The idea
+ behind this mutex is to be able
+ to release log_sys->mutex during
+ mtr_commit and still ensure that
+ insertions in the flush_list happen
+ in the LSN order. */
byte* buf_ptr; /* unaligned log buffer */
byte* buf; /*!< log buffer */
ulint buf_size; /*!< log buffer size in bytes */
@@ -952,6 +964,19 @@ struct log_struct{
#endif /* UNIV_LOG_ARCHIVE */
};
+/** Test if flush order mutex is owned. */
+#define log_flush_order_mutex_own() \
+ mutex_own(&log_sys->log_flush_order_mutex)
+
+/** Acquire the flush order mutex. */
+#define log_flush_order_mutex_enter() do { \
+ mutex_enter(&log_sys->log_flush_order_mutex); \
+} while (0)
+/** Release the flush order mutex. */
+# define log_flush_order_mutex_exit() do { \
+ mutex_exit(&log_sys->log_flush_order_mutex); \
+} while (0)
+
#ifdef UNIV_LOG_ARCHIVE
/** Archiving state @{ */
#define LOG_ARCH_ON 71
diff --git a/storage/xtradb/include/log0log.ic b/storage/xtradb/include/log0log.ic
index 1ce00fd7313..67db6695cab 100644
--- a/storage/xtradb/include/log0log.ic
+++ b/storage/xtradb/include/log0log.ic
@@ -435,7 +435,7 @@ log_free_check(void)
{
#ifdef UNIV_SYNC_DEBUG
- ut_ad(sync_thread_levels_empty_gen(TRUE));
+ ut_ad(sync_thread_levels_empty_except_dict());
#endif /* UNIV_SYNC_DEBUG */
if (log_sys->check_flush_or_checkpoint) {
diff --git a/storage/xtradb/include/mach0data.h b/storage/xtradb/include/mach0data.h
index 44ee3df22ce..8434bc73586 100644
--- a/storage/xtradb/include/mach0data.h
+++ b/storage/xtradb/include/mach0data.h
@@ -166,14 +166,14 @@ UNIV_INLINE
void
mach_write_to_6(
/*============*/
- byte* b, /*!< in: pointer to 6 bytes where to store */
- dulint n); /*!< in: dulint integer to be stored */
+ byte* b, /*!< in: pointer to 6 bytes where to store */
+ ib_uint64_t id); /*!< in: 48-bit integer */
/********************************************************//**
The following function is used to fetch data from 6 consecutive
bytes. The most significant byte is at the lowest address.
-@return dulint integer */
+@return 48-bit integer */
UNIV_INLINE
-dulint
+ib_uint64_t
mach_read_from_6(
/*=============*/
const byte* b) /*!< in: pointer to 6 bytes */
@@ -185,14 +185,14 @@ UNIV_INLINE
void
mach_write_to_7(
/*============*/
- byte* b, /*!< in: pointer to 7 bytes where to store */
- dulint n); /*!< in: dulint integer to be stored */
+ byte* b, /*!< in: pointer to 7 bytes where to store */
+ ib_uint64_t n); /*!< in: 56-bit integer */
/********************************************************//**
The following function is used to fetch data from 7 consecutive
bytes. The most significant byte is at the lowest address.
-@return dulint integer */
+@return 56-bit integer */
UNIV_INLINE
-dulint
+ib_uint64_t
mach_read_from_7(
/*=============*/
const byte* b) /*!< in: pointer to 7 bytes */
@@ -204,88 +204,69 @@ UNIV_INLINE
void
mach_write_to_8(
/*============*/
- byte* b, /*!< in: pointer to 8 bytes where to store */
- dulint n); /*!< in: dulint integer to be stored */
-/*******************************************************//**
-The following function is used to store data in 8 consecutive
-bytes. We store the most significant byte to the lowest address. */
-UNIV_INLINE
-void
-mach_write_ull(
-/*===========*/
byte* b, /*!< in: pointer to 8 bytes where to store */
ib_uint64_t n); /*!< in: 64-bit integer to be stored */
/********************************************************//**
The following function is used to fetch data from 8 consecutive
bytes. The most significant byte is at the lowest address.
-@return dulint integer */
-UNIV_INLINE
-dulint
-mach_read_from_8(
-/*=============*/
- const byte* b) /*!< in: pointer to 8 bytes */
- __attribute__((nonnull, pure));
-/********************************************************//**
-The following function is used to fetch data from 8 consecutive
-bytes. The most significant byte is at the lowest address.
@return 64-bit integer */
UNIV_INLINE
ib_uint64_t
-mach_read_ull(
-/*==========*/
+mach_read_from_8(
+/*=============*/
const byte* b) /*!< in: pointer to 8 bytes */
__attribute__((nonnull, pure));
/*********************************************************//**
-Writes a dulint in a compressed form (5..9 bytes).
+Writes a 64-bit integer in a compressed form (5..9 bytes).
@return size in bytes */
UNIV_INLINE
ulint
-mach_dulint_write_compressed(
-/*=========================*/
- byte* b, /*!< in: pointer to memory where to store */
- dulint n); /*!< in: dulint integer to be stored */
+mach_ull_write_compressed(
+/*======================*/
+ byte* b, /*!< in: pointer to memory where to store */
+ ib_uint64_t n); /*!< in: 64-bit integer to be stored */
/*********************************************************//**
-Returns the size of a dulint when written in the compressed form.
+Returns the size of a 64-bit integer when written in the compressed form.
@return compressed size in bytes */
UNIV_INLINE
ulint
-mach_dulint_get_compressed_size(
-/*============================*/
- dulint n); /*!< in: dulint integer to be stored */
+mach_ull_get_compressed_size(
+/*=========================*/
+ ib_uint64_t n); /*!< in: 64-bit integer to be stored */
/*********************************************************//**
-Reads a dulint in a compressed form.
-@return read dulint */
+Reads a 64-bit integer in a compressed form.
+@return the value read */
UNIV_INLINE
-dulint
-mach_dulint_read_compressed(
-/*========================*/
+ib_uint64_t
+mach_ull_read_compressed(
+/*=====================*/
const byte* b) /*!< in: pointer to memory from where to read */
__attribute__((nonnull, pure));
/*********************************************************//**
-Writes a dulint in a compressed form (1..11 bytes).
+Writes a 64-bit integer in a compressed form (1..11 bytes).
@return size in bytes */
UNIV_INLINE
ulint
-mach_dulint_write_much_compressed(
-/*==============================*/
- byte* b, /*!< in: pointer to memory where to store */
- dulint n); /*!< in: dulint integer to be stored */
+mach_ull_write_much_compressed(
+/*===========================*/
+ byte* b, /*!< in: pointer to memory where to store */
+ ib_uint64_t n); /*!< in: 64-bit integer to be stored */
/*********************************************************//**
-Returns the size of a dulint when written in the compressed form.
+Returns the size of a 64-bit integer when written in the compressed form.
@return compressed size in bytes */
UNIV_INLINE
ulint
-mach_dulint_get_much_compressed_size(
-/*=================================*/
- dulint n) /*!< in: dulint integer to be stored */
+mach_ull_get_much_compressed_size(
+/*==============================*/
+ ib_uint64_t n) /*!< in: 64-bit integer to be stored */
__attribute__((const));
/*********************************************************//**
-Reads a dulint in a compressed form.
-@return read dulint */
+Reads a 64-bit integer in a compressed form.
+@return the value read */
UNIV_INLINE
-dulint
-mach_dulint_read_much_compressed(
-/*=============================*/
+ib_uint64_t
+mach_ull_read_much_compressed(
+/*==========================*/
const byte* b) /*!< in: pointer to memory from where to read */
__attribute__((nonnull, pure));
/*********************************************************//**
@@ -299,15 +280,16 @@ mach_parse_compressed(
byte* end_ptr,/*!< in: pointer to end of the buffer */
ulint* val); /*!< out: read value */
/*********************************************************//**
-Reads a dulint in a compressed form if the log record fully contains it.
-@return pointer to end of the stored field, NULL if not complete */
-UNIV_INTERN
+Reads a 64-bit integer in a compressed form
+if the log record fully contains it.
+@return pointer to end of the stored field, NULL if not complete */
+UNIV_INLINE
byte*
-mach_dulint_parse_compressed(
-/*=========================*/
- byte* ptr, /*!< in: pointer to buffer from where to read */
- byte* end_ptr,/*!< in: pointer to end of the buffer */
- dulint* val); /*!< out: read value */
+mach_ull_parse_compressed(
+/*======================*/
+ byte* ptr, /*!< in: pointer to buffer from where to read */
+ byte* end_ptr,/*!< in: pointer to end of the buffer */
+ ib_uint64_t* val); /*!< out: read value */
#ifndef UNIV_HOTBACKUP
/*********************************************************//**
Reads a double. It is stored in a little-endian format.
diff --git a/storage/xtradb/include/mach0data.ic b/storage/xtradb/include/mach0data.ic
index 96d2417ac81..b1e5991d39e 100644
--- a/storage/xtradb/include/mach0data.ic
+++ b/storage/xtradb/include/mach0data.ic
@@ -280,22 +280,6 @@ UNIV_INLINE
void
mach_write_to_8(
/*============*/
- byte* b, /*!< in: pointer to 8 bytes where to store */
- dulint n) /*!< in: dulint integer to be stored */
-{
- ut_ad(b);
-
- mach_write_to_4(b, ut_dulint_get_high(n));
- mach_write_to_4(b + 4, ut_dulint_get_low(n));
-}
-
-/*******************************************************//**
-The following function is used to store data in 8 consecutive
-bytes. We store the most significant byte to the lowest address. */
-UNIV_INLINE
-void
-mach_write_ull(
-/*===========*/
byte* b, /*!< in: pointer to 8 bytes where to store */
ib_uint64_t n) /*!< in: 64-bit integer to be stored */
{
@@ -308,32 +292,11 @@ mach_write_ull(
/********************************************************//**
The following function is used to fetch data from 8 consecutive
bytes. The most significant byte is at the lowest address.
-@return dulint integer */
-UNIV_INLINE
-dulint
-mach_read_from_8(
-/*=============*/
- const byte* b) /*!< in: pointer to 8 bytes */
-{
- ulint high;
- ulint low;
-
- ut_ad(b);
-
- high = mach_read_from_4(b);
- low = mach_read_from_4(b + 4);
-
- return(ut_dulint_create(high, low));
-}
-
-/********************************************************//**
-The following function is used to fetch data from 8 consecutive
-bytes. The most significant byte is at the lowest address.
@return 64-bit integer */
UNIV_INLINE
ib_uint64_t
-mach_read_ull(
-/*==========*/
+mach_read_from_8(
+/*=============*/
const byte* b) /*!< in: pointer to 8 bytes */
{
ib_uint64_t ull;
@@ -351,34 +314,28 @@ UNIV_INLINE
void
mach_write_to_7(
/*============*/
- byte* b, /*!< in: pointer to 7 bytes where to store */
- dulint n) /*!< in: dulint integer to be stored */
+ byte* b, /*!< in: pointer to 7 bytes where to store */
+ ib_uint64_t n) /*!< in: 56-bit integer */
{
ut_ad(b);
- mach_write_to_3(b, ut_dulint_get_high(n));
- mach_write_to_4(b + 3, ut_dulint_get_low(n));
+ mach_write_to_3(b, (ulint) (n >> 32));
+ mach_write_to_4(b + 3, (ulint) n);
}
/********************************************************//**
The following function is used to fetch data from 7 consecutive
bytes. The most significant byte is at the lowest address.
-@return dulint integer */
+@return 56-bit integer */
UNIV_INLINE
-dulint
+ib_uint64_t
mach_read_from_7(
/*=============*/
const byte* b) /*!< in: pointer to 7 bytes */
{
- ulint high;
- ulint low;
-
ut_ad(b);
- high = mach_read_from_3(b);
- low = mach_read_from_4(b + 3);
-
- return(ut_dulint_create(high, low));
+ return(ut_ull_create(mach_read_from_3(b), mach_read_from_4(b + 3)));
}
/*******************************************************//**
@@ -388,162 +345,196 @@ UNIV_INLINE
void
mach_write_to_6(
/*============*/
- byte* b, /*!< in: pointer to 6 bytes where to store */
- dulint n) /*!< in: dulint integer to be stored */
+ byte* b, /*!< in: pointer to 6 bytes where to store */
+ ib_uint64_t n) /*!< in: 48-bit integer */
{
ut_ad(b);
- mach_write_to_2(b, ut_dulint_get_high(n));
- mach_write_to_4(b + 2, ut_dulint_get_low(n));
+ mach_write_to_2(b, (ulint) (n >> 32));
+ mach_write_to_4(b + 2, (ulint) n);
}
/********************************************************//**
The following function is used to fetch data from 6 consecutive
bytes. The most significant byte is at the lowest address.
-@return dulint integer */
+@return 48-bit integer */
UNIV_INLINE
-dulint
+ib_uint64_t
mach_read_from_6(
/*=============*/
const byte* b) /*!< in: pointer to 6 bytes */
{
- ulint high;
- ulint low;
-
ut_ad(b);
- high = mach_read_from_2(b);
- low = mach_read_from_4(b + 2);
-
- return(ut_dulint_create(high, low));
+ return(ut_ull_create(mach_read_from_2(b), mach_read_from_4(b + 2)));
}
/*********************************************************//**
-Writes a dulint in a compressed form (5..9 bytes).
+Writes a 64-bit integer in a compressed form (5..9 bytes).
@return size in bytes */
UNIV_INLINE
ulint
-mach_dulint_write_compressed(
-/*=========================*/
- byte* b, /*!< in: pointer to memory where to store */
- dulint n) /*!< in: dulint integer to be stored */
+mach_ull_write_compressed(
+/*======================*/
+ byte* b, /*!< in: pointer to memory where to store */
+ ib_uint64_t n) /*!< in: 64-bit integer to be stored */
{
ulint size;
ut_ad(b);
- size = mach_write_compressed(b, ut_dulint_get_high(n));
- mach_write_to_4(b + size, ut_dulint_get_low(n));
+ size = mach_write_compressed(b, (ulint) (n >> 32));
+ mach_write_to_4(b + size, (ulint) n);
return(size + 4);
}
/*********************************************************//**
-Returns the size of a dulint when written in the compressed form.
+Returns the size of a 64-bit integer when written in the compressed form.
@return compressed size in bytes */
UNIV_INLINE
ulint
-mach_dulint_get_compressed_size(
-/*============================*/
- dulint n) /*!< in: dulint integer to be stored */
+mach_ull_get_compressed_size(
+/*=========================*/
+ ib_uint64_t n) /*!< in: 64-bit integer to be stored */
{
- return(4 + mach_get_compressed_size(ut_dulint_get_high(n)));
+ return(4 + mach_get_compressed_size((ulint) (n >> 32)));
}
/*********************************************************//**
-Reads a dulint in a compressed form.
-@return read dulint */
+Reads a 64-bit integer in a compressed form.
+@return the value read */
UNIV_INLINE
-dulint
-mach_dulint_read_compressed(
-/*========================*/
+ib_uint64_t
+mach_ull_read_compressed(
+/*=====================*/
const byte* b) /*!< in: pointer to memory from where to read */
{
- ulint high;
- ulint low;
- ulint size;
+ ib_uint64_t n;
+ ulint size;
ut_ad(b);
- high = mach_read_compressed(b);
+ n = (ib_uint64_t) mach_read_compressed(b);
- size = mach_get_compressed_size(high);
+ size = mach_get_compressed_size((ulint) n);
- low = mach_read_from_4(b + size);
+ n <<= 32;
+ n |= (ib_uint64_t) mach_read_from_4(b + size);
- return(ut_dulint_create(high, low));
+ return(n);
}
/*********************************************************//**
-Writes a dulint in a compressed form (1..11 bytes).
+Writes a 64-bit integer in a compressed form (1..11 bytes).
@return size in bytes */
UNIV_INLINE
ulint
-mach_dulint_write_much_compressed(
-/*==============================*/
- byte* b, /*!< in: pointer to memory where to store */
- dulint n) /*!< in: dulint integer to be stored */
+mach_ull_write_much_compressed(
+/*===========================*/
+ byte* b, /*!< in: pointer to memory where to store */
+ ib_uint64_t n) /*!< in: 64-bit integer to be stored */
{
ulint size;
ut_ad(b);
- if (ut_dulint_get_high(n) == 0) {
- return(mach_write_compressed(b, ut_dulint_get_low(n)));
+ if (!(n >> 32)) {
+ return(mach_write_compressed(b, (ulint) n));
}
*b = (byte)0xFF;
- size = 1 + mach_write_compressed(b + 1, ut_dulint_get_high(n));
+ size = 1 + mach_write_compressed(b + 1, (ulint) (n >> 32));
- size += mach_write_compressed(b + size, ut_dulint_get_low(n));
+ size += mach_write_compressed(b + size, (ulint) n & 0xFFFFFFFF);
return(size);
}
/*********************************************************//**
-Returns the size of a dulint when written in the compressed form.
+Returns the size of a 64-bit integer when written in the compressed form.
@return compressed size in bytes */
UNIV_INLINE
ulint
-mach_dulint_get_much_compressed_size(
-/*=================================*/
- dulint n) /*!< in: dulint integer to be stored */
+mach_ull_get_much_compressed_size(
+/*==============================*/
+ ib_uint64_t n) /*!< in: 64-bit integer to be stored */
{
- if (0 == ut_dulint_get_high(n)) {
- return(mach_get_compressed_size(ut_dulint_get_low(n)));
+ if (!(n >> 32)) {
+ return(mach_get_compressed_size((ulint) n));
}
- return(1 + mach_get_compressed_size(ut_dulint_get_high(n))
- + mach_get_compressed_size(ut_dulint_get_low(n)));
+ return(1 + mach_get_compressed_size((ulint) (n >> 32))
+ + mach_get_compressed_size((ulint) n & ULINT32_MASK));
}
/*********************************************************//**
-Reads a dulint in a compressed form.
-@return read dulint */
+Reads a 64-bit integer in a compressed form.
+@return the value read */
UNIV_INLINE
-dulint
-mach_dulint_read_much_compressed(
-/*=============================*/
+ib_uint64_t
+mach_ull_read_much_compressed(
+/*==========================*/
const byte* b) /*!< in: pointer to memory from where to read */
{
- ulint high;
- ulint low;
- ulint size;
+ ib_uint64_t n;
+ ulint size;
ut_ad(b);
if (*b != (byte)0xFF) {
- high = 0;
+ n = 0;
size = 0;
} else {
- high = mach_read_compressed(b + 1);
+ n = (ib_uint64_t) mach_read_compressed(b + 1);
+
+ size = 1 + mach_get_compressed_size((ulint) n);
+ n <<= 32;
+ }
+
+ n |= mach_read_compressed(b + size);
+
+ return(n);
+}
+
+/*********************************************************//**
+Reads a 64-bit integer in a compressed form
+if the log record fully contains it.
+@return pointer to end of the stored field, NULL if not complete */
+UNIV_INLINE
+byte*
+mach_ull_parse_compressed(
+/*======================*/
+ byte* ptr, /* in: pointer to buffer from where to read */
+ byte* end_ptr,/* in: pointer to end of the buffer */
+ ib_uint64_t* val) /* out: read value */
+{
+ ulint size;
+
+ ut_ad(ptr);
+ ut_ad(end_ptr);
+ ut_ad(val);
+
+ if (end_ptr < ptr + 5) {
+
+ return(NULL);
+ }
+
+ *val = mach_read_compressed(ptr);
+
+ size = mach_get_compressed_size((ulint) *val);
+
+ ptr += size;
+
+ if (end_ptr < ptr + 4) {
- size = 1 + mach_get_compressed_size(high);
+ return(NULL);
}
- low = mach_read_compressed(b + size);
+ *val <<= 32;
+ *val |= mach_read_from_4(ptr);
- return(ut_dulint_create(high, low));
+ return(ptr + 4);
}
#ifndef UNIV_HOTBACKUP
/*********************************************************//**
diff --git a/storage/xtradb/include/mem0mem.h b/storage/xtradb/include/mem0mem.h
index ee28cf7b225..5181bb4c9f7 100644
--- a/storage/xtradb/include/mem0mem.h
+++ b/storage/xtradb/include/mem0mem.h
@@ -359,7 +359,7 @@ struct mem_block_info_struct {
to the heap is also the first block in this list,
though it also contains the base node of the list. */
ulint len; /*!< physical length of this block in bytes */
- ulint total_size; /* physical length in bytes of all blocks
+ ulint total_size; /*!< physical length in bytes of all blocks
in the heap. This is defined only in the base
node and is set to ULINT_UNDEFINED in others. */
ulint type; /*!< type of heap: MEM_HEAP_DYNAMIC, or
diff --git a/storage/xtradb/include/mem0mem.ic b/storage/xtradb/include/mem0mem.ic
index cbce2edc661..d214c3fe6c9 100644
--- a/storage/xtradb/include/mem0mem.ic
+++ b/storage/xtradb/include/mem0mem.ic
@@ -350,27 +350,27 @@ mem_heap_get_top(
ulint n) /*!< in: size of the topmost element */
{
mem_block_t* block;
- void* buf;
+ byte* buf;
ut_ad(mem_heap_check(heap));
block = UT_LIST_GET_LAST(heap->base);
- buf = (byte*)block + mem_block_get_free(block) - MEM_SPACE_NEEDED(n);
+ buf = (byte*) block + mem_block_get_free(block) - MEM_SPACE_NEEDED(n);
#ifdef UNIV_MEM_DEBUG
- ut_ad(mem_block_get_start(block) <=(ulint)((byte*)buf - (byte*)block));
+ ut_ad(mem_block_get_start(block) <= (ulint) (buf - (byte*) block));
/* In the debug version, advance buf to point at the storage which
was given to the caller in the allocation*/
- buf = (byte*)buf + MEM_FIELD_HEADER_SIZE;
+ buf += MEM_FIELD_HEADER_SIZE;
/* Check that the field lengths agree */
- ut_ad(n == (ulint)mem_field_header_get_len(buf));
+ ut_ad(n == mem_field_header_get_len(buf));
#endif
- return(buf);
+ return((void*) buf);
}
/*****************************************************************//**
diff --git a/storage/xtradb/include/mtr0log.h b/storage/xtradb/include/mtr0log.h
index 6322af2a569..d271002a5fe 100644
--- a/storage/xtradb/include/mtr0log.h
+++ b/storage/xtradb/include/mtr0log.h
@@ -47,11 +47,11 @@ Writes 8 bytes to a file page buffered in the buffer pool.
Writes the corresponding log record to the mini-transaction log. */
UNIV_INTERN
void
-mlog_write_dulint(
-/*==============*/
- byte* ptr, /*!< in: pointer where to write */
- dulint val, /*!< in: value to write */
- mtr_t* mtr); /*!< in: mini-transaction handle */
+mlog_write_ull(
+/*===========*/
+ byte* ptr, /*!< in: pointer where to write */
+ ib_uint64_t val, /*!< in: value to write */
+ mtr_t* mtr); /*!< in: mini-transaction handle */
/********************************************************//**
Writes a string to a file page buffered in the buffer pool. Writes the
corresponding log record to the mini-transaction log. */
@@ -125,13 +125,13 @@ mlog_catenate_ulint_compressed(
mtr_t* mtr, /*!< in: mtr */
ulint val); /*!< in: value to write */
/********************************************************//**
-Catenates a compressed dulint to mlog. */
+Catenates a compressed 64-bit integer to mlog. */
UNIV_INLINE
void
-mlog_catenate_dulint_compressed(
-/*============================*/
- mtr_t* mtr, /*!< in: mtr */
- dulint val); /*!< in: value to write */
+mlog_catenate_ull_compressed(
+/*=========================*/
+ mtr_t* mtr, /*!< in: mtr */
+ ib_uint64_t val); /*!< in: value to write */
/********************************************************//**
Opens a buffer to mlog. It must be closed with mlog_close.
@return buffer, NULL if log mode MTR_LOG_NONE */
@@ -183,7 +183,7 @@ mlog_parse_initial_log_record(
ulint* space, /*!< out: space id */
ulint* page_no);/*!< out: page number */
/********************************************************//**
-Parses a log record written by mlog_write_ulint or mlog_write_dulint.
+Parses a log record written by mlog_write_ulint or mlog_write_ull.
@return parsed record end, NULL if not a complete record */
UNIV_INTERN
byte*
diff --git a/storage/xtradb/include/mtr0log.ic b/storage/xtradb/include/mtr0log.ic
index 63af02ba409..fa9ac014f4e 100644
--- a/storage/xtradb/include/mtr0log.ic
+++ b/storage/xtradb/include/mtr0log.ic
@@ -142,13 +142,13 @@ mlog_catenate_ulint_compressed(
}
/********************************************************//**
-Catenates a compressed dulint to mlog. */
+Catenates a compressed 64-bit integer to mlog. */
UNIV_INLINE
void
-mlog_catenate_dulint_compressed(
-/*============================*/
- mtr_t* mtr, /*!< in: mtr */
- dulint val) /*!< in: value to write */
+mlog_catenate_ull_compressed(
+/*=========================*/
+ mtr_t* mtr, /*!< in: mtr */
+ ib_uint64_t val) /*!< in: value to write */
{
byte* log_ptr;
@@ -160,7 +160,7 @@ mlog_catenate_dulint_compressed(
return;
}
- log_ptr += mach_dulint_write_compressed(log_ptr, val);
+ log_ptr += mach_ull_write_compressed(log_ptr, val);
mlog_close(mtr, log_ptr);
}
diff --git a/storage/xtradb/include/mtr0mtr.h b/storage/xtradb/include/mtr0mtr.h
index bc3f1951be9..5582ad63039 100644
--- a/storage/xtradb/include/mtr0mtr.h
+++ b/storage/xtradb/include/mtr0mtr.h
@@ -190,21 +190,21 @@ functions). The page number parameter was originally written as 0. @{ */
/* @} */
/***************************************************************//**
-Starts a mini-transaction and creates a mini-transaction handle
-and buffer in the memory buffer given by the caller.
-@return mtr buffer which also acts as the mtr handle */
+Starts a mini-transaction. */
UNIV_INLINE
-mtr_t*
+void
mtr_start(
/*======*/
- mtr_t* mtr); /*!< in: memory buffer for the mtr buffer */
+ mtr_t* mtr) /*!< out: mini-transaction */
+ __attribute__((nonnull));
/***************************************************************//**
Commits a mini-transaction. */
UNIV_INTERN
void
mtr_commit(
/*=======*/
- mtr_t* mtr); /*!< in: mini-transaction */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ __attribute__((nonnull));
/**********************************************************//**
Sets and returns a savepoint in mtr.
@return savepoint */
@@ -264,15 +264,6 @@ mtr_read_ulint(
const byte* ptr, /*!< in: pointer from where to read */
ulint type, /*!< in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */
mtr_t* mtr); /*!< in: mini-transaction handle */
-/********************************************************//**
-Reads 8 bytes from a file page buffered in the buffer pool.
-@return value read */
-UNIV_INTERN
-dulint
-mtr_read_dulint(
-/*============*/
- const byte* ptr, /*!< in: pointer from where to read */
- mtr_t* mtr); /*!< in: mini-transaction handle */
#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
This macro locks an rw-lock in s-mode. */
@@ -387,6 +378,8 @@ struct mtr_struct{
#endif
dyn_array_t memo; /*!< memo stack for locks etc. */
dyn_array_t log; /*!< mini-transaction log */
+ ibool inside_ibuf;
+ /*!< TRUE if inside ibuf changes */
ibool modifications;
/* TRUE if the mtr made modifications to
buffer pool pages */
diff --git a/storage/xtradb/include/mtr0mtr.ic b/storage/xtradb/include/mtr0mtr.ic
index 18f8e87b3cf..1db4a4bd735 100644
--- a/storage/xtradb/include/mtr0mtr.ic
+++ b/storage/xtradb/include/mtr0mtr.ic
@@ -30,26 +30,25 @@ Created 11/26/1995 Heikki Tuuri
#include "mach0data.h"
/***************************************************************//**
-Starts a mini-transaction and creates a mini-transaction handle
-and a buffer in the memory buffer given by the caller.
-@return mtr buffer which also acts as the mtr handle */
+Starts a mini-transaction. */
UNIV_INLINE
-mtr_t*
+void
mtr_start(
/*======*/
- mtr_t* mtr) /*!< in: memory buffer for the mtr buffer */
+ mtr_t* mtr) /*!< out: mini-transaction */
{
+ UNIV_MEM_INVALID(mtr, sizeof *mtr);
+
dyn_array_create(&(mtr->memo));
dyn_array_create(&(mtr->log));
mtr->log_mode = MTR_LOG_ALL;
mtr->modifications = FALSE;
+ mtr->inside_ibuf = FALSE;
mtr->n_log_recs = 0;
ut_d(mtr->state = MTR_ACTIVE);
ut_d(mtr->magic_n = MTR_MAGIC_N);
-
- return(mtr);
}
/***************************************************//**
@@ -160,7 +159,7 @@ mtr_memo_contains(
while (offset > 0) {
offset -= sizeof(mtr_memo_slot_t);
- slot = dyn_array_get_element(memo, offset);
+ slot = (mtr_memo_slot_t*) dyn_array_get_element(memo, offset);
if ((object == slot->object) && (type == slot->type)) {
diff --git a/storage/xtradb/include/mysql_addons.h b/storage/xtradb/include/mysql_addons.h
deleted file mode 100644
index 17660c18710..00000000000
--- a/storage/xtradb/include/mysql_addons.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2007, 2009, Innobase Oy. 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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file include/mysql_addons.h
-This file contains functions that need to be added to
-MySQL code but have not been added yet.
-
-Whenever you add a function here submit a MySQL bug
-report (feature request) with the implementation. Then
-write the bug number in the comment before the
-function in this file.
-
-When MySQL commits the function it can be deleted from
-here. In a perfect world this file exists but is empty.
-
-Created November 07, 2007 Vasil Dimov
-*******************************************************/
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index eeab8a2b5d9..b778adaa809 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/include/os0file.h
@@ -77,29 +77,23 @@ extern ulint os_n_pending_writes;
#ifdef __WIN__
/** File handle */
-#define os_file_t HANDLE
+# define os_file_t HANDLE
/** Convert a C file descriptor to a native file handle
@param fd file descriptor
@return native file handle */
-#define OS_FILE_FROM_FD(fd) (HANDLE) _get_osfhandle(fd)
+# define OS_FILE_FROM_FD(fd) (HANDLE) _get_osfhandle(fd)
#else
/** File handle */
typedef int os_file_t;
/** Convert a C file descriptor to a native file handle
@param fd file descriptor
@return native file handle */
-#define OS_FILE_FROM_FD(fd) fd
+# define OS_FILE_FROM_FD(fd) fd
#endif
/** Umask for creating files */
extern ulint os_innodb_umask;
-/** If this flag is TRUE, then we will use the native aio of the
-OS (provided we compiled Innobase with it in), otherwise we will
-use simulated aio we build below with threads */
-
-extern ibool os_aio_use_native_aio;
-
/** The next value should be smaller or equal to the smallest sector size used
on any disk. A log block is required to be a portion of disk which is written
so that if the start and the end of a block get written to disk, then the
@@ -107,7 +101,7 @@ whole block gets written. This should be true even in most cases of a crash:
if this fails for a log block, then it is equivalent to a media failure in the
log. */
-#define OS_FILE_LOG_BLOCK_SIZE 512
+#define OS_FILE_LOG_BLOCK_SIZE srv_log_block_size
/** Options for file_create @{ */
#define OS_FILE_OPEN 51
@@ -142,7 +136,8 @@ log. */
#define OS_FILE_SHARING_VIOLATION 76
#define OS_FILE_ERROR_NOT_SPECIFIED 77
#define OS_FILE_INSUFFICIENT_RESOURCE 78
-#define OS_FILE_OPERATION_ABORTED 79
+#define OS_FILE_AIO_INTERRUPTED 79
+#define OS_FILE_OPERATION_ABORTED 80
/* @} */
/** Types for aio operations @{ */
@@ -183,11 +178,177 @@ log. */
#define OS_WIN95 2 /*!< Microsoft Windows 95 */
#define OS_WINNT 3 /*!< Microsoft Windows NT 3.x */
#define OS_WIN2000 4 /*!< Microsoft Windows 2000 */
+#define OS_WINXP 5 /*!< Microsoft Windows XP
+ or Windows Server 2003 */
+#define OS_WINVISTA 6 /*!< Microsoft Windows Vista
+ or Windows Server 2008 */
+#define OS_WIN7 7 /*!< Microsoft Windows 7
+ or Windows Server 2008 R2 */
+
extern ulint os_n_file_reads;
extern ulint os_n_file_writes;
extern ulint os_n_fsyncs;
+extern ulint srv_log_block_size;
+
+#ifdef UNIV_PFS_IO
+/* Keys to register InnoDB I/O with performance schema */
+extern mysql_pfs_key_t innodb_file_data_key;
+extern mysql_pfs_key_t innodb_file_log_key;
+extern mysql_pfs_key_t innodb_file_temp_key;
+
+/* Following four macros are instumentations to register
+various file I/O operations with performance schema.
+1) register_pfs_file_open_begin() and register_pfs_file_open_end() are
+used to register file creation, opening, closing and renaming.
+2) register_pfs_file_io_begin() and register_pfs_file_io_end() are
+used to register actual file read, write and flush */
+# define register_pfs_file_open_begin(state, locker, key, op, name, \
+ src_file, src_line) \
+do { \
+ if (PSI_server) { \
+ locker = PSI_server->get_thread_file_name_locker( \
+ state, key, op, name, &locker); \
+ if (locker) { \
+ PSI_server->start_file_open_wait( \
+ locker, src_file, src_line); \
+ } \
+ } \
+} while (0)
+
+# define register_pfs_file_open_end(locker, file) \
+do { \
+ if (locker) { \
+ PSI_server->end_file_open_wait_and_bind_to_descriptor( \
+ locker, file); \
+ } \
+} while (0)
+
+# define register_pfs_file_io_begin(state, locker, file, count, op, \
+ src_file, src_line) \
+do { \
+ if (PSI_server) { \
+ locker = PSI_server->get_thread_file_descriptor_locker( \
+ state, file, op); \
+ if (locker) { \
+ PSI_server->start_file_wait( \
+ locker, count, src_file, src_line); \
+ } \
+ } \
+} while (0)
+
+# define register_pfs_file_io_end(locker, count) \
+do { \
+ if (locker) { \
+ PSI_server->end_file_wait(locker, count); \
+ } \
+} while (0)
+#endif /* UNIV_PFS_IO */
+
+/* Following macros/functions are file I/O APIs that would be performance
+schema instrumented if "UNIV_PFS_IO" is defined. They would point to
+wrapper functions with performance schema instrumentation in such case.
+
+os_file_create
+os_file_create_simple
+os_file_create_simple_no_error_handling
+os_file_close
+os_file_rename
+os_aio
+os_file_read
+os_file_read_no_error_handling
+os_file_write
+
+The wrapper functions have the prefix of "innodb_". */
+
+#ifdef UNIV_PFS_IO
+# define os_file_create(key, name, create, purpose, type, success) \
+ pfs_os_file_create_func(key, name, create, purpose, type, \
+ success, __FILE__, __LINE__)
+
+# define os_file_create_simple(key, name, create, access, success) \
+ pfs_os_file_create_simple_func(key, name, create, access, \
+ success, __FILE__, __LINE__)
+
+# define os_file_create_simple_no_error_handling( \
+ key, name, create_mode, access, success) \
+ pfs_os_file_create_simple_no_error_handling_func( \
+ key, name, create_mode, access, success, __FILE__, __LINE__)
+
+# define os_file_close(file) \
+ pfs_os_file_close_func(file, __FILE__, __LINE__)
+
+# define os_aio(type, mode, name, file, buf, offset, offset_high, \
+ n, message1, message2, space_id, trx) \
+ pfs_os_aio_func(type, mode, name, file, buf, offset, \
+ offset_high, n, message1, message2, space_id, trx,\
+ __FILE__, __LINE__)
+
+# define os_file_read(file, buf, offset, offset_high, n) \
+ pfs_os_file_read_func(file, buf, offset, offset_high, n, NULL, \
+ __FILE__, __LINE__)
+
+# define os_file_read_trx(file, buf, offset, offset_high, n, trx) \
+ os_file_read_func(file, buf, offset, offset_high, n, trx)
+
+# define os_file_read_no_error_handling(file, buf, offset, \
+ offset_high, n) \
+ pfs_os_file_read_no_error_handling_func(file, buf, offset, \
+ offset_high, n, \
+ __FILE__, __LINE__)
+
+# define os_file_write(name, file, buf, offset, offset_high, n) \
+ pfs_os_file_write_func(name, file, buf, offset, offset_high, \
+ n, __FILE__, __LINE__)
+
+# define os_file_flush(file, metadata) \
+ pfs_os_file_flush_func(file, metadata, __FILE__, __LINE__)
+
+# define os_file_rename(key, oldpath, newpath) \
+ pfs_os_file_rename_func(key, oldpath, newpath, __FILE__, __LINE__)
+#else /* UNIV_PFS_IO */
+
+/* If UNIV_PFS_IO is not defined, these I/O APIs point
+to original un-instrumented file I/O APIs */
+# define os_file_create(key, name, create, purpose, type, success) \
+ os_file_create_func(name, create, purpose, type, success)
+
+# define os_file_create_simple(key, name, create, access, success) \
+ os_file_create_simple_func(name, create_mode, access, success)
+
+# define os_file_create_simple_no_error_handling( \
+ key, name, create_mode, access, success) \
+ os_file_create_simple_no_error_handling_func( \
+ name, create_mode, access, success)
+
+# define os_file_close(file) os_file_close_func(file)
+
+# define os_aio(type, mode, name, file, buf, offset, offset_high, \
+ n, message1, message2, space_id, trx) \
+ os_aio_func(type, mode, name, file, buf, offset, offset_high, n,\
+ message1, message2, space_id, trx)
+
+# define os_file_read(file, buf, offset, offset_high, n) \
+ os_file_read_func(file, buf, offset, offset_high, n, NULL)
+
+# define os_file_read_trx(file, buf, offset, offset_high, n, trx) \
+ os_file_read_func(file, buf, offset, offset_high, n, trx)
+
+# define os_file_read_no_error_handling(file, buf, offset, \
+ offset_high, n) \
+ os_file_read_no_error_handling_func(file, buf, offset, offset_high, n)
+
+# define os_file_write(name, file, buf, offset, offset_high, n) \
+ os_file_write_func(name, file, buf, offset, offset_high, n)
+
+# define os_file_flush(file, metadata) os_file_flush_func(file, metadata)
+
+# define os_file_rename(key, oldpath, newpath) \
+ os_file_rename_func(oldpath, newpath)
+
+#endif /* UNIV_PFS_IO */
+
/* File types for directory entry data type */
enum os_file_type_enum{
@@ -221,13 +382,16 @@ typedef HANDLE os_file_dir_t; /*!< directory stream */
typedef DIR* os_file_dir_t; /*!< directory stream */
#endif
+#ifdef __WIN__
/***********************************************************************//**
Gets the operating system version. Currently works only on Windows.
-@return OS_WIN95, OS_WIN31, OS_WINNT, or OS_WIN2000 */
+@return OS_WIN95, OS_WIN31, OS_WINNT, OS_WIN2000, OS_WINXP, OS_WINVISTA,
+OS_WIN7. */
UNIV_INTERN
ulint
os_get_os_version(void);
/*===================*/
+#endif /* __WIN__ */
#ifndef UNIV_HOTBACKUP
/****************************************************************//**
Creates the seek mutexes used in positioned reads and writes. */
@@ -238,8 +402,6 @@ os_io_init_simple(void);
/***********************************************************************//**
Creates a temporary file. This function is like tmpfile(3), but
the temporary file is created in the MySQL temporary directory.
-On Netware, this function is like tmpfile(3), because the C run-time
-library of Netware does not expose the delete-on-close flag.
@return temporary file handle, or NULL on error */
FILE*
@@ -297,13 +459,15 @@ os_file_create_directory(
ibool fail_if_exists);/*!< in: if TRUE, pre-existing directory
is treated as an error. */
/****************************************************************//**
+NOTE! Use the corresponding macro os_file_create_simple(), not directly
+this function!
A simple function to open or create a file.
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INTERN
os_file_t
-os_file_create_simple(
-/*==================*/
+os_file_create_simple_func(
+/*=======================*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file is
@@ -317,13 +481,15 @@ os_file_create_simple(
OS_FILE_READ_WRITE */
ibool* success);/*!< out: TRUE if succeed, FALSE if error */
/****************************************************************//**
+NOTE! Use the corresponding macro
+os_file_create_simple_no_error_handling(), not directly this function!
A simple function to open or create a file.
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INTERN
os_file_t
-os_file_create_simple_no_error_handling(
-/*====================================*/
+os_file_create_simple_no_error_handling_func(
+/*=========================================*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file
@@ -347,13 +513,15 @@ os_file_set_nocache(
const char* operation_name);/*!< in: "open" or "create"; used in the
diagnostic message */
/****************************************************************//**
+NOTE! Use the corresponding macro os_file_create(), not directly
+this function!
Opens an existing file or creates a new.
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INTERN
os_file_t
-os_file_create(
-/*===========*/
+os_file_create_func(
+/*================*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file
@@ -391,25 +559,262 @@ os_file_delete_if_exists(
/*=====================*/
const char* name); /*!< in: file path as a null-terminated string */
/***********************************************************************//**
+NOTE! Use the corresponding macro os_file_rename(), not directly
+this function!
Renames a file (can also move it to another directory). It is safest that the
file is closed before calling this function.
@return TRUE if success */
UNIV_INTERN
ibool
-os_file_rename(
-/*===========*/
+os_file_rename_func(
+/*================*/
const char* oldpath, /*!< in: old file path as a
null-terminated string */
const char* newpath); /*!< in: new file path */
/***********************************************************************//**
+NOTE! Use the corresponding macro os_file_close(), not directly this
+function!
Closes a file handle. In case of error, error number can be retrieved with
os_file_get_last_error.
@return TRUE if success */
UNIV_INTERN
ibool
-os_file_close(
-/*==========*/
+os_file_close_func(
+/*===============*/
os_file_t file); /*!< in, own: handle to a file */
+
+#ifdef UNIV_PFS_IO
+/****************************************************************//**
+NOTE! Please use the corresponding macro os_file_create_simple(),
+not directly this function!
+A performance schema instrumented wrapper function for
+os_file_create_simple() which opens or creates a file.
+@return own: handle to the file, not defined if error, error number
+can be retrieved with os_file_get_last_error */
+UNIV_INLINE
+os_file_t
+pfs_os_file_create_simple_func(
+/*===========================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file is
+ opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error), or
+ OS_FILE_CREATE_PATH if new file
+ (if exists, error) and subdirectories along
+ its path are created (if needed)*/
+ ulint access_type,/*!< in: OS_FILE_READ_ONLY or
+ OS_FILE_READ_WRITE */
+ ibool* success,/*!< out: TRUE if succeed, FALSE if error */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+
+/****************************************************************//**
+NOTE! Please use the corresponding macro
+os_file_create_simple_no_error_handling(), not directly this function!
+A performance schema instrumented wrapper function for
+os_file_create_simple_no_error_handling(). Add instrumentation to
+monitor file creation/open.
+@return own: handle to the file, not defined if error, error number
+can be retrieved with os_file_get_last_error */
+UNIV_INLINE
+os_file_t
+pfs_os_file_create_simple_no_error_handling_func(
+/*=============================================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file
+ is opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error) */
+ ulint access_type,/*!< in: OS_FILE_READ_ONLY,
+ OS_FILE_READ_WRITE, or
+ OS_FILE_READ_ALLOW_DELETE; the last option is
+ used by a backup program reading the file */
+ ibool* success,/*!< out: TRUE if succeed, FALSE if error */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+
+/****************************************************************//**
+NOTE! Please use the corresponding macro os_file_create(), not directly
+this function!
+A performance schema wrapper function for os_file_create().
+Add instrumentation to monitor file creation/open.
+@return own: handle to the file, not defined if error, error number
+can be retrieved with os_file_get_last_error */
+UNIV_INLINE
+os_file_t
+pfs_os_file_create_func(
+/*====================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file
+ is opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error),
+ OS_FILE_OVERWRITE if a new file is created
+ or an old overwritten;
+ OS_FILE_OPEN_RAW, if a raw device or disk
+ partition should be opened */
+ ulint purpose,/*!< in: OS_FILE_AIO, if asynchronous,
+ non-buffered i/o is desired,
+ OS_FILE_NORMAL, if any normal file;
+ NOTE that it also depends on type, os_aio_..
+ and srv_.. variables whether we really use
+ async i/o or unbuffered i/o: look in the
+ function source code for the exact rules */
+ ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */
+ ibool* success,/*!< out: TRUE if succeed, FALSE if error */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+
+/***********************************************************************//**
+NOTE! Please use the corresponding macro os_file_close(), not directly
+this function!
+A performance schema instrumented wrapper function for os_file_close().
+@return TRUE if success */
+UNIV_INLINE
+ibool
+pfs_os_file_close_func(
+/*===================*/
+ os_file_t file, /*!< in, own: handle to a file */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+/*******************************************************************//**
+NOTE! Please use the corresponding macro os_file_read(), not directly
+this function!
+This is the performance schema instrumented wrapper function for
+os_file_read() which requests a synchronous read operation.
+@return TRUE if request was successful, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_file_read_func(
+/*==================*/
+ os_file_t file, /*!< in: handle to a file */
+ void* buf, /*!< in: buffer where to read */
+ ulint offset, /*!< in: least significant 32 bits of file
+ offset where to read */
+ ulint offset_high,/*!< in: most significant 32 bits of
+ offset */
+ ulint n, /*!< in: number of bytes to read */
+ trx_t* trx,
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+
+/*******************************************************************//**
+NOTE! Please use the corresponding macro os_file_read_no_error_handling(),
+not directly this function!
+This is the performance schema instrumented wrapper function for
+os_file_read_no_error_handling_func() which requests a synchronous
+read operation.
+@return TRUE if request was successful, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_file_read_no_error_handling_func(
+/*====================================*/
+ os_file_t file, /*!< in: handle to a file */
+ void* buf, /*!< in: buffer where to read */
+ ulint offset, /*!< in: least significant 32 bits of file
+ offset where to read */
+ ulint offset_high,/*!< in: most significant 32 bits of
+ offset */
+ ulint n, /*!< in: number of bytes to read */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+
+/*******************************************************************//**
+NOTE! Please use the corresponding macro os_aio(), not directly this
+function!
+Performance schema wrapper function of os_aio() which requests
+an asynchronous i/o operation.
+@return TRUE if request was queued successfully, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_aio_func(
+/*============*/
+ ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE */
+ ulint mode, /*!< in: OS_AIO_NORMAL etc. I/O mode */
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ os_file_t file, /*!< in: handle to a file */
+ void* buf, /*!< in: buffer where to read or from which
+ to write */
+ ulint offset, /*!< in: least significant 32 bits of file
+ offset where to read or write */
+ ulint offset_high,/*!< in: most significant 32 bits of
+ offset */
+ ulint n, /*!< in: number of bytes to read or write */
+ fil_node_t* message1,/*!< in: message for the aio handler
+ (can be used to identify a completed
+ aio operation); ignored if mode is
+ OS_AIO_SYNC */
+ void* message2,/*!< in: message for the aio handler
+ (can be used to identify a completed
+ aio operation); ignored if mode is
+ OS_AIO_SYNC */
+ ulint space_id,
+ trx_t* trx,
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+/*******************************************************************//**
+NOTE! Please use the corresponding macro os_file_write(), not directly
+this function!
+This is the performance schema instrumented wrapper function for
+os_file_write() which requests a synchronous write operation.
+@return TRUE if request was successful, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_file_write_func(
+/*===================*/
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ os_file_t file, /*!< in: handle to a file */
+ const void* buf, /*!< in: buffer from which to write */
+ ulint offset, /*!< in: least significant 32 bits of file
+ offset where to write */
+ ulint offset_high,/*!< in: most significant 32 bits of
+ offset */
+ ulint n, /*!< in: number of bytes to write */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+/***********************************************************************//**
+NOTE! Please use the corresponding macro os_file_flush(), not directly
+this function!
+This is the performance schema instrumented wrapper function for
+os_file_flush() which flushes the write buffers of a given file to the disk.
+Flushes the write buffers of a given file to the disk.
+@return TRUE if success */
+UNIV_INLINE
+ibool
+pfs_os_file_flush_func(
+/*===================*/
+ os_file_t file, /*!< in, own: handle to a file */
+ ibool metadata,
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+
+/***********************************************************************//**
+NOTE! Please use the corresponding macro os_file_rename(), not directly
+this function!
+This is the performance schema instrumented wrapper function for
+os_file_rename()
+@return TRUE if success */
+UNIV_INLINE
+ibool
+pfs_os_file_rename_func(
+/*====================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* oldpath,/*!< in: old file path as a null-terminated
+ string */
+ const char* newpath,/*!< in: new file path */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+#endif /* UNIV_PFS_IO */
+
#ifdef UNIV_HOTBACKUP
/***********************************************************************//**
Closes a file handle.
@@ -461,13 +866,15 @@ os_file_set_eof(
/*============*/
FILE* file); /*!< in: file to be truncated */
/***********************************************************************//**
+NOTE! Use the corresponding macro os_file_flush(), not directly this function!
Flushes the write buffers of a given file to the disk.
@return TRUE if success */
UNIV_INTERN
ibool
-os_file_flush(
-/*==========*/
- os_file_t file); /*!< in, own: handle to a file */
+os_file_flush_func(
+/*===============*/
+ os_file_t file, /*!< in, own: handle to a file */
+ ibool metadata);
/***********************************************************************//**
Retrieves the last error number if an error occurs in a file io function.
The number should be retrieved before any other OS calls (because they may
@@ -481,15 +888,13 @@ os_file_get_last_error(
ibool report_all_errors); /*!< in: TRUE if we want an error message
printed of all errors */
/*******************************************************************//**
+NOTE! Use the corresponding macro os_file_read(), not directly this function!
Requests a synchronous read operation.
@return TRUE if request was successful, FALSE if fail */
-#define os_file_read(file, buf, offset, offset_high, n) \
- _os_file_read(file, buf, offset, offset_high, n, NULL)
-
UNIV_INTERN
ibool
-_os_file_read(
-/*=========*/
+os_file_read_func(
+/*==============*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
ulint offset, /*!< in: least significant 32 bits of file
@@ -510,13 +915,15 @@ os_file_read_string(
char* str, /*!< in: buffer where to read */
ulint size); /*!< in: size of buffer */
/*******************************************************************//**
+NOTE! Use the corresponding macro os_file_read_no_error_handling(),
+not directly this function!
Requests a synchronous positioned read operation. This function does not do
any error handling. In case of error it returns FALSE.
@return TRUE if request was successful, FALSE if fail */
UNIV_INTERN
ibool
-os_file_read_no_error_handling(
-/*===========================*/
+os_file_read_no_error_handling_func(
+/*================================*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
ulint offset, /*!< in: least significant 32 bits of file
@@ -526,12 +933,14 @@ os_file_read_no_error_handling(
ulint n); /*!< in: number of bytes to read */
/*******************************************************************//**
+NOTE! Use the corresponding macro os_file_write(), not directly this
+function!
Requests a synchronous write operation.
@return TRUE if request was successful, FALSE if fail */
UNIV_INTERN
ibool
-os_file_write(
-/*==========*/
+os_file_write_func(
+/*===============*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
os_file_t file, /*!< in: handle to a file */
@@ -600,7 +1009,7 @@ respectively. The caller must create an i/o handler thread for each
segment in these arrays. This function also creates the sync array.
No i/o handler thread needs to be created for that */
UNIV_INTERN
-void
+ibool
os_aio_init(
/*========*/
ulint n_per_seg, /*<! in: maximum number of pending aio
@@ -617,12 +1026,13 @@ os_aio_free(void);
/*=============*/
/*******************************************************************//**
+NOTE! Use the corresponding macro os_aio(), not directly this function!
Requests an asynchronous i/o operation.
@return TRUE if request was queued successfully, FALSE if fail */
UNIV_INTERN
ibool
-os_aio(
-/*===*/
+os_aio_func(
+/*========*/
ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE */
ulint mode, /*!< in: OS_AIO_NORMAL, ..., possibly ORed
to OS_AIO_SIMULATED_WAKE_LATER: the
@@ -655,6 +1065,7 @@ os_aio(
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
+ ulint space_id,
trx_t* trx);
/************************************************************************//**
Wakes up all async i/o threads so that they know to exit themselves in
@@ -715,7 +1126,8 @@ os_aio_windows_handle(
parameters are valid and can be used to
restart the operation, for example */
void** message2,
- ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */
+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
+ ulint* space_id);
#endif
/**********************************************************************//**
@@ -737,7 +1149,8 @@ os_aio_simulated_handle(
parameters are valid and can be used to
restart the operation, for example */
void** message2,
- ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */
+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
+ ulint* space_id);
/**********************************************************************//**
Validates the consistency of the aio system.
@return TRUE if ok */
@@ -780,7 +1193,7 @@ os_file_get_status(
os_file_stat_t* stat_info); /*!< information of a file in a
directory */
-#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__)
+#if !defined(UNIV_HOTBACKUP)
/*********************************************************************//**
Creates a temporary file that will be deleted on close.
This function is defined in ha_innodb.cc.
@@ -789,6 +1202,39 @@ UNIV_INTERN
int
innobase_mysql_tmpfile(void);
/*========================*/
-#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */
+#endif /* !UNIV_HOTBACKUP */
+
+
+#if defined(LINUX_NATIVE_AIO)
+/**************************************************************************
+This function is only used in Linux native asynchronous i/o.
+Waits for an aio operation to complete. This function is used to wait the
+for completed requests. The aio array of pending requests is divided
+into segments. The thread specifies which segment or slot it wants to wait
+for. NOTE: this function will also take care of freeing the aio slot,
+therefore no other thread is allowed to do the freeing!
+@return TRUE if the IO was successful */
+UNIV_INTERN
+ibool
+os_aio_linux_handle(
+/*================*/
+ ulint global_seg, /*!< in: segment number in the aio array
+ to wait for; segment 0 is the ibuf
+ i/o thread, segment 1 is log i/o thread,
+ then follow the non-ibuf read threads,
+ and the last are the non-ibuf write
+ threads. */
+ fil_node_t**message1, /*!< out: the messages passed with the */
+ void** message2, /*!< aio request; note that in case the
+ aio operation failed, these output
+ parameters are valid and can be used to
+ restart the operation. */
+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
+ ulint* space_id);
+#endif /* LINUX_NATIVE_AIO */
+
+#ifndef UNIV_NONINL
+#include "os0file.ic"
+#endif
#endif
diff --git a/storage/xtradb/include/os0file.ic b/storage/xtradb/include/os0file.ic
new file mode 100644
index 00000000000..2d2145d72f0
--- /dev/null
+++ b/storage/xtradb/include/os0file.ic
@@ -0,0 +1,422 @@
+/*****************************************************************************
+
+Copyright (c) 2010, Oracle and/or its affiliates. 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., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+
+*****************************************************************************/
+
+/**************************************************//**
+@file include/os0file.ic
+The interface to the operating system file io
+
+Created 2/20/2010 Jimmy Yang
+*******************************************************/
+
+#include "univ.i"
+
+#ifdef UNIV_PFS_IO
+/****************************************************************//**
+NOTE! Please use the corresponding macro os_file_create_simple(),
+not directly this function!
+A performance schema instrumented wrapper function for
+os_file_create_simple() which opens or creates a file.
+@return own: handle to the file, not defined if error, error number
+can be retrieved with os_file_get_last_error */
+UNIV_INLINE
+os_file_t
+pfs_os_file_create_simple_func(
+/*===========================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file is
+ opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error), or
+ OS_FILE_CREATE_PATH if new file
+ (if exists, error) and subdirectories along
+ its path are created (if needed)*/
+ ulint access_type,/*!< in: OS_FILE_READ_ONLY or
+ OS_FILE_READ_WRITE */
+ ibool* success,/*!< out: TRUE if succeed, FALSE if error */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ os_file_t file;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ /* register a file open or creation depending on "create_mode" */
+ register_pfs_file_open_begin(&state, locker, key,
+ ((create_mode == OS_FILE_CREATE)
+ ? PSI_FILE_CREATE
+ : PSI_FILE_OPEN),
+ name, src_file, src_line);
+
+ file = os_file_create_simple_func(name, create_mode,
+ access_type, success);
+
+ /* Regsiter the returning "file" value with the system */
+ register_pfs_file_open_end(locker, file);
+
+ return(file);
+}
+
+/****************************************************************//**
+NOTE! Please use the corresponding macro
+os_file_create_simple_no_error_handling(), not directly this function!
+A performance schema instrumented wrapper function for
+os_file_create_simple_no_error_handling(). Add instrumentation to
+monitor file creation/open.
+@return own: handle to the file, not defined if error, error number
+can be retrieved with os_file_get_last_error */
+UNIV_INLINE
+os_file_t
+pfs_os_file_create_simple_no_error_handling_func(
+/*=============================================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file
+ is opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error) */
+ ulint access_type,/*!< in: OS_FILE_READ_ONLY,
+ OS_FILE_READ_WRITE, or
+ OS_FILE_READ_ALLOW_DELETE; the last option is
+ used by a backup program reading the file */
+ ibool* success,/*!< out: TRUE if succeed, FALSE if error */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ os_file_t file;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ /* register a file open or creation depending on "create_mode" */
+ register_pfs_file_open_begin(&state, locker, key,
+ ((create_mode == OS_FILE_CREATE)
+ ? PSI_FILE_CREATE
+ : PSI_FILE_OPEN),
+ name, src_file, src_line);
+
+ file = os_file_create_simple_no_error_handling_func(
+ name, create_mode, access_type, success);
+
+ register_pfs_file_open_end(locker, file);
+
+ return(file);
+}
+
+/****************************************************************//**
+NOTE! Please use the corresponding macro os_file_create(), not directly
+this function!
+A performance schema wrapper function for os_file_create().
+Add instrumentation to monitor file creation/open.
+@return own: handle to the file, not defined if error, error number
+can be retrieved with os_file_get_last_error */
+UNIV_INLINE
+os_file_t
+pfs_os_file_create_func(
+/*====================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file
+ is opened (if does not exist, error), or
+ OS_FILE_CREATE if a new file is created
+ (if exists, error),
+ OS_FILE_OVERWRITE if a new file is created
+ or an old overwritten;
+ OS_FILE_OPEN_RAW, if a raw device or disk
+ partition should be opened */
+ ulint purpose,/*!< in: OS_FILE_AIO, if asynchronous,
+ non-buffered i/o is desired,
+ OS_FILE_NORMAL, if any normal file;
+ NOTE that it also depends on type, os_aio_..
+ and srv_.. variables whether we really use
+ async i/o or unbuffered i/o: look in the
+ function source code for the exact rules */
+ ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */
+ ibool* success,/*!< out: TRUE if succeed, FALSE if error */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ os_file_t file;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ /* register a file open or creation depending on "create_mode" */
+ register_pfs_file_open_begin(&state, locker, key,
+ ((create_mode == OS_FILE_CREATE)
+ ? PSI_FILE_CREATE
+ : PSI_FILE_OPEN),
+ name, src_file, src_line);
+
+ file = os_file_create_func(name, create_mode, purpose, type, success);
+
+ register_pfs_file_open_end(locker, file);
+
+ return(file);
+}
+
+/***********************************************************************//**
+NOTE! Please use the corresponding macro os_file_close(), not directly
+this function!
+A performance schema instrumented wrapper function for os_file_close().
+@return TRUE if success */
+UNIV_INLINE
+ibool
+pfs_os_file_close_func(
+/*===================*/
+ os_file_t file, /*!< in, own: handle to a file */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ ibool result;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ /* register the file close */
+ register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_CLOSE,
+ src_file, src_line);
+
+ result = os_file_close_func(file);
+
+ register_pfs_file_io_end(locker, 0);
+
+ return(result);
+}
+
+/*******************************************************************//**
+NOTE! Please use the corresponding macro os_aio(), not directly this
+function!
+Performance schema instrumented wrapper function of os_aio() which
+requests an asynchronous i/o operation.
+@return TRUE if request was queued successfully, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_aio_func(
+/*============*/
+ ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE */
+ ulint mode, /*!< in: OS_AIO_NORMAL etc. I/O mode */
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ os_file_t file, /*!< in: handle to a file */
+ void* buf, /*!< in: buffer where to read or from which
+ to write */
+ ulint offset, /*!< in: least significant 32 bits of file
+ offset where to read or write */
+ ulint offset_high,/*!< in: most significant 32 bits of
+ offset */
+ ulint n, /*!< in: number of bytes to read or write */
+ fil_node_t* message1,/*!< in: message for the aio handler
+ (can be used to identify a completed
+ aio operation); ignored if mode is
+ OS_AIO_SYNC */
+ void* message2,/*!< in: message for the aio handler
+ (can be used to identify a completed
+ aio operation); ignored if mode is
+ OS_AIO_SYNC */
+ ulint space_id,
+ trx_t* trx,
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ ibool result;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ /* Register the read or write I/O depending on "type" */
+ register_pfs_file_io_begin(&state, locker, file, n,
+ (type == OS_FILE_WRITE)
+ ? PSI_FILE_WRITE
+ : PSI_FILE_READ,
+ src_file, src_line);
+
+ result = os_aio_func(type, mode, name, file, buf, offset, offset_high,
+ n, message1, message2, space_id, trx);
+
+ register_pfs_file_io_end(locker, n);
+
+ return(result);
+}
+
+/*******************************************************************//**
+NOTE! Please use the corresponding macro os_file_read(), not directly
+this function!
+This is the performance schema instrumented wrapper function for
+os_file_read() which requests a synchronous read operation.
+@return TRUE if request was successful, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_file_read_func(
+/*==================*/
+ os_file_t file, /*!< in: handle to a file */
+ void* buf, /*!< in: buffer where to read */
+ ulint offset, /*!< in: least significant 32 bits of file
+ offset where to read */
+ ulint offset_high,/*!< in: most significant 32 bits of
+ offset */
+ ulint n, /*!< in: number of bytes to read */
+ trx_t* trx,
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ ibool result;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
+ src_file, src_line);
+
+ result = os_file_read_func(file, buf, offset, offset_high, n, trx);
+
+ register_pfs_file_io_end(locker, n);
+
+ return(result);
+}
+
+/*******************************************************************//**
+NOTE! Please use the corresponding macro
+os_file_read_no_error_handling(), not directly this function!
+This is the performance schema instrumented wrapper function for
+os_file_read_no_error_handling() which requests a synchronous
+positioned read operation. This function does not do any error
+handling. In case of error it returns FALSE.
+@return TRUE if request was successful, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_file_read_no_error_handling_func(
+/*====================================*/
+ os_file_t file, /*!< in: handle to a file */
+ void* buf, /*!< in: buffer where to read */
+ ulint offset, /*!< in: least significant 32 bits of file
+ offset where to read */
+ ulint offset_high,/*!< in: most significant 32 bits of
+ offset */
+ ulint n, /*!< in: number of bytes to read */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ ibool result;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
+ src_file, src_line);
+
+ result = os_file_read_no_error_handling_func(file, buf, offset,
+ offset_high, n);
+
+ register_pfs_file_io_end(locker, n);
+
+ return(result);
+}
+
+/*******************************************************************//**
+NOTE! Please use the corresponding macro os_file_write(), not directly
+this function!
+This is the performance schema instrumented wrapper function for
+os_file_write() which requests a synchronous write operation.
+@return TRUE if request was successful, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_file_write_func(
+/*===================*/
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ os_file_t file, /*!< in: handle to a file */
+ const void* buf, /*!< in: buffer from which to write */
+ ulint offset, /*!< in: least significant 32 bits of file
+ offset where to write */
+ ulint offset_high,/*!< in: most significant 32 bits of
+ offset */
+ ulint n, /*!< in: number of bytes to write */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ ibool result;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE,
+ src_file, src_line);
+
+ result = os_file_write_func(name, file, buf, offset, offset_high, n);
+
+ register_pfs_file_io_end(locker, n);
+
+ return(result);
+}
+
+/***********************************************************************//**
+NOTE! Please use the corresponding macro os_file_flush(), not directly
+this function!
+This is the performance schema instrumented wrapper function for
+os_file_flush() which flushes the write buffers of a given file to the disk.
+@return TRUE if success */
+UNIV_INLINE
+ibool
+pfs_os_file_flush_func(
+/*===================*/
+ os_file_t file, /*!< in, own: handle to a file */
+ ibool metadata,
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ ibool result;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC,
+ src_file, src_line);
+ result = os_file_flush_func(file, metadata);
+
+ register_pfs_file_io_end(locker, 0);
+
+ return(result);
+}
+
+/***********************************************************************//**
+NOTE! Please use the corresponding macro os_file_rename(), not directly
+this function!
+This is the performance schema instrumented wrapper function for
+os_file_rename()
+@return TRUE if success */
+UNIV_INLINE
+ibool
+pfs_os_file_rename_func(
+/*====================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* oldpath,/*!< in: old file path as a null-terminated
+ string */
+ const char* newpath,/*!< in: new file path */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ ibool result;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ register_pfs_file_open_begin(&state, locker, key, PSI_FILE_RENAME, newpath,
+ src_file, src_line);
+
+ result = os_file_rename_func(oldpath, newpath);
+
+ register_pfs_file_open_end(locker, 0);
+
+ return(result);
+}
+#endif /* UNIV_PFS_IO */
diff --git a/storage/xtradb/include/os0proc.h b/storage/xtradb/include/os0proc.h
index 582cef6f803..fd46bd7db87 100644
--- a/storage/xtradb/include/os0proc.h
+++ b/storage/xtradb/include/os0proc.h
@@ -32,11 +32,6 @@ Created 9/30/1995 Heikki Tuuri
#ifdef UNIV_LINUX
#include <sys/ipc.h>
#include <sys/shm.h>
-#else
-# if defined HAVE_SYS_IPC_H && HAVE_SYS_SHM_H
-#include <sys/ipc.h>
-#include <sys/shm.h>
-# endif
#endif
typedef void* os_process_t;
@@ -75,29 +70,6 @@ os_mem_free_large(
ulint size); /*!< in: size returned by
os_mem_alloc_large() */
-
-/****************************************************************//**
-Allocates or attaches and reuses shared memory segment.
-The content is not cleared automatically.
-@return allocated memory */
-UNIV_INTERN
-void*
-os_shm_alloc(
-/*=========*/
- ulint* n, /*!< in/out: number of bytes */
- uint key,
- ibool* is_new);
-
-/****************************************************************//**
-Detach shared memory segment. */
-UNIV_INTERN
-void
-os_shm_free(
-/*========*/
- void *ptr, /*!< in: pointer returned by
- os_shm_alloc() */
- ulint size); /*!< in: size returned by
- os_shm_alloc() */
#ifndef UNIV_NONINL
#include "os0proc.ic"
#endif
diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h
index c230a03b6db..6a99c60226b 100644
--- a/storage/xtradb/include/os0sync.h
+++ b/storage/xtradb/include/os0sync.h
@@ -38,28 +38,18 @@ Created 9/6/1995 Heikki Tuuri
#include "ut0lst.h"
#ifdef __WIN__
-
+/** Native event (slow)*/
+typedef HANDLE os_native_event_t;
/** Native mutex */
-#define os_fast_mutex_t CRITICAL_SECTION
-
-/** Native event */
-typedef HANDLE os_native_event_t;
-
-/** Operating system event */
-typedef struct os_event_struct os_event_struct_t;
-/** Operating system event handle */
-typedef os_event_struct_t* os_event_t;
-
-/** An asynchronous signal sent between threads */
-struct os_event_struct {
- os_native_event_t handle;
- /*!< Windows event */
- UT_LIST_NODE_T(os_event_struct_t) os_event_list;
- /*!< list of all created events */
-};
+typedef CRITICAL_SECTION os_fast_mutex_t;
+/** Native condition variable. */
+typedef CONDITION_VARIABLE os_cond_t;
#else
/** Native mutex */
-typedef pthread_mutex_t os_fast_mutex_t;
+typedef pthread_mutex_t os_fast_mutex_t;
+/** Native condition variable */
+typedef pthread_cond_t os_cond_t;
+#endif
/** Operating system event */
typedef struct os_event_struct os_event_struct_t;
@@ -68,6 +58,10 @@ typedef os_event_struct_t* os_event_t;
/** An asynchronous signal sent between threads */
struct os_event_struct {
+#ifdef __WIN__
+ HANDLE handle; /*!< kernel event object, slow,
+ used on older Windows */
+#endif
os_fast_mutex_t os_mutex; /*!< this mutex protects the next
fields */
ibool is_set; /*!< this is TRUE when the event is
@@ -76,24 +70,23 @@ struct os_event_struct {
this event */
ib_int64_t signal_count; /*!< this is incremented each time
the event becomes signaled */
- pthread_cond_t cond_var; /*!< condition variable is used in
+ os_cond_t cond_var; /*!< condition variable is used in
waiting for the event */
UT_LIST_NODE_T(os_event_struct_t) os_event_list;
/*!< list of all created events */
};
-#endif
+
+/** Denotes an infinite delay for os_event_wait_time() */
+#define OS_SYNC_INFINITE_TIME ULINT_UNDEFINED
+
+/** Return value of os_event_wait_time() when the time is exceeded */
+#define OS_SYNC_TIME_EXCEEDED 1
/** Operating system mutex */
typedef struct os_mutex_struct os_mutex_str_t;
/** Operating system mutex handle */
typedef os_mutex_str_t* os_mutex_t;
-/** Denotes an infinite delay for os_event_wait_time() */
-#define OS_SYNC_INFINITE_TIME ((ulint)(-1))
-
-/** Return value of os_event_wait_time() when the time is exceeded */
-#define OS_SYNC_TIME_EXCEEDED 1
-
/** Mutex protecting counts and the event and OS 'slow' mutex lists */
extern os_mutex_t os_sync_mutex;
@@ -157,10 +150,7 @@ os_event_free(
os_event_t event); /*!< in: event to free */
/**********************************************************//**
-Waits for an event object until it is in the signaled state. If
-srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS this also exits the
-waiting thread when the event becomes signaled (or immediately if the
-event is already in the signaled state).
+Waits for an event object until it is in the signaled state.
Typically, if the event has been signalled after the os_event_reset()
we'll return immediately because event->is_set == TRUE.
@@ -186,6 +176,7 @@ os_event_wait_low(
os_event_reset(). */
#define os_event_wait(event) os_event_wait_low(event, 0)
+#define os_event_wait_time(e, t) os_event_wait_time_low(e, t, 0)
/**********************************************************//**
Waits for an event object until it is in the signaled state or
@@ -193,36 +184,23 @@ a timeout is exceeded.
@return 0 if success, OS_SYNC_TIME_EXCEEDED if timeout was exceeded */
UNIV_INTERN
ulint
-os_event_wait_time(
-/*===============*/
- os_event_t event, /*!< in: event to wait */
- ulint time); /*!< in: timeout in microseconds, or
- OS_SYNC_INFINITE_TIME */
-#ifdef __WIN__
-/**********************************************************//**
-Waits for any event in an OS native event array. Returns if even a single
-one is signaled or becomes signaled.
-@return index of the event which was signaled */
-UNIV_INTERN
-ulint
-os_event_wait_multiple(
+os_event_wait_time_low(
/*===================*/
- ulint n, /*!< in: number of events in the
- array */
- os_native_event_t* native_event_array);
- /*!< in: pointer to an array of event
- handles */
-#endif
+ os_event_t event, /*!< in: event to wait */
+ ulint time_in_usec, /*!< in: timeout in
+ microseconds, or
+ OS_SYNC_INFINITE_TIME */
+ ib_int64_t reset_sig_count); /*!< in: zero or the value
+ returned by previous call of
+ os_event_reset(). */
/*********************************************************//**
Creates an operating system mutex semaphore. Because these are slow, the
mutex semaphore of InnoDB itself (mutex_t) should be used where possible.
@return the mutex handle */
UNIV_INTERN
os_mutex_t
-os_mutex_create(
-/*============*/
- const char* name); /*!< in: the name of the mutex, if NULL
- the mutex is created without a name */
+os_mutex_create(void);
+/*=================*/
/**********************************************************//**
Acquires ownership of a mutex semaphore. */
UNIV_INTERN
@@ -330,7 +308,7 @@ amount of increment. */
Returns the old value of *ptr, atomically sets *ptr to new_val */
# define os_atomic_test_and_set_byte(ptr, new_val) \
- __sync_lock_test_and_set(ptr, new_val)
+ __sync_lock_test_and_set(ptr, (byte) new_val)
#elif defined(HAVE_IB_SOLARIS_ATOMICS)
diff --git a/storage/xtradb/include/os0sync.ic b/storage/xtradb/include/os0sync.ic
index 1f3ce38fa65..c33f13aaad6 100644
--- a/storage/xtradb/include/os0sync.ic
+++ b/storage/xtradb/include/os0sync.ic
@@ -28,8 +28,7 @@ Created 9/6/1995 Heikki Tuuri
#endif
/**********************************************************//**
-Acquires ownership of a fast mutex. Currently in Windows this is the same
-as os_fast_mutex_lock!
+Acquires ownership of a fast mutex.
@return 0 if success, != 0 if was reserved by another thread */
UNIV_INLINE
ulint
@@ -38,9 +37,13 @@ os_fast_mutex_trylock(
os_fast_mutex_t* fast_mutex) /*!< in: mutex to acquire */
{
#ifdef __WIN__
- EnterCriticalSection(fast_mutex);
+ if (TryEnterCriticalSection(fast_mutex)) {
- return(0);
+ return(0);
+ } else {
+
+ return(1);
+ }
#else
/* NOTE that the MySQL my_pthread.h redefines pthread_mutex_trylock
so that it returns 0 on success. In the operating system
diff --git a/storage/xtradb/include/os0thread.h b/storage/xtradb/include/os0thread.h
index 6583de0005f..df3cdb7728e 100644
--- a/storage/xtradb/include/os0thread.h
+++ b/storage/xtradb/include/os0thread.h
@@ -56,6 +56,11 @@ typedef os_thread_t os_thread_id_t; /*!< In Unix we use the thread
/* Define a function pointer type to use in a typecast */
typedef void* (*os_posix_f_t) (void*);
+#ifdef HAVE_PSI_INTERFACE
+/* Define for performance schema registration key */
+typedef unsigned int mysql_pfs_key_t;
+#endif
+
/***************************************************************//**
Compares two thread ids for equality.
@return TRUE if equal */
@@ -86,7 +91,7 @@ os_thread_t
os_thread_create(
/*=============*/
#ifndef __WIN__
- os_posix_f_t start_f,
+ os_posix_f_t start_f,
#else
ulint (*start_f)(void*), /*!< in: pointer to function
from which to start */
@@ -102,8 +107,9 @@ UNIV_INTERN
void
os_thread_exit(
/*===========*/
- void* exit_value); /*!< in: exit value; in Windows this void*
+ void* exit_value) /*!< in: exit value; in Windows this void*
is cast as a DWORD */
+ UNIV_COLD __attribute__((noreturn));
/*****************************************************************//**
Returns the thread identifier of current thread.
@return current thread identifier */
@@ -112,13 +118,6 @@ os_thread_id_t
os_thread_get_curr_id(void);
/*========================*/
/*****************************************************************//**
-Returns handle to the current thread.
-@return current thread handle */
-UNIV_INTERN
-os_thread_t
-os_thread_get_curr(void);
-/*====================*/
-/*****************************************************************//**
Advises the os to give up remainder of the thread's time slice. */
UNIV_INTERN
void
@@ -131,29 +130,6 @@ void
os_thread_sleep(
/*============*/
ulint tm); /*!< in: time in microseconds */
-/******************************************************************//**
-Gets a thread priority.
-@return priority */
-UNIV_INTERN
-ulint
-os_thread_get_priority(
-/*===================*/
- os_thread_t handle);/*!< in: OS handle to the thread */
-/******************************************************************//**
-Sets a thread priority. */
-UNIV_INTERN
-void
-os_thread_set_priority(
-/*===================*/
- os_thread_t handle, /*!< in: OS handle to the thread */
- ulint pri); /*!< in: priority: one of OS_PRIORITY_... */
-/******************************************************************//**
-Gets the last operating system error code for the calling thread.
-@return last error on Windows, 0 otherwise */
-UNIV_INTERN
-ulint
-os_thread_get_last_error(void);
-/*==========================*/
#ifndef UNIV_NONINL
#include "os0thread.ic"
diff --git a/storage/xtradb/include/page0cur.h b/storage/xtradb/include/page0cur.h
index 6b444b3dd96..1544b0abe1c 100644
--- a/storage/xtradb/include/page0cur.h
+++ b/storage/xtradb/include/page0cur.h
@@ -293,22 +293,6 @@ page_cur_open_on_rnd_user_rec(
/*==========================*/
buf_block_t* block, /*!< in: page */
page_cur_t* cursor);/*!< out: page cursor */
-
-UNIV_INTERN
-void
-page_cur_open_on_nth_user_rec(
-/*==========================*/
- buf_block_t* block, /*!< in: page */
- page_cur_t* cursor, /*!< out: page cursor */
- ulint nth);
-
-UNIV_INTERN
-ibool
-page_cur_open_on_rnd_user_rec_after_nth(
-/*==========================*/
- buf_block_t* block, /*!< in: page */
- page_cur_t* cursor, /*!< out: page cursor */
- ulint nth);
#endif /* !UNIV_HOTBACKUP */
/***********************************************************//**
Parses a log record of a record insert on a page.
diff --git a/storage/xtradb/include/page0page.h b/storage/xtradb/include/page0page.h
index 5b2bcf7c054..c06815cb6ca 100644
--- a/storage/xtradb/include/page0page.h
+++ b/storage/xtradb/include/page0page.h
@@ -66,7 +66,7 @@ typedef byte page_header_t;
direction */
#define PAGE_N_RECS 16 /* number of user records on the page */
#define PAGE_MAX_TRX_ID 18 /* highest id of a trx which may have modified
- a record on the page; a dulint; defined only
+ a record on the page; trx_id_t; defined only
in secondary indexes and in the insert buffer
tree; NOTE: this may be modified only
when the thread has an x-latch to the page,
@@ -618,18 +618,19 @@ rec_t*
page_rec_find_owner_rec(
/*====================*/
rec_t* rec); /*!< in: the physical record */
+#ifndef UNIV_HOTBACKUP
/***********************************************************************//**
-This is a low-level operation which is used in a database index creation
-to update the page number of a created B-tree to a data dictionary
-record. */
-UNIV_INTERN
+Write a 32-bit field in a data dictionary record. */
+UNIV_INLINE
void
-page_rec_write_index_page_no(
-/*=========================*/
- rec_t* rec, /*!< in: record to update */
+page_rec_write_field(
+/*=================*/
+ rec_t* rec, /*!< in/out: record to update */
ulint i, /*!< in: index of the field to update */
- ulint page_no,/*!< in: value to write */
- mtr_t* mtr); /*!< in: mtr */
+ ulint val, /*!< in: value to write */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ __attribute__((nonnull));
+#endif /* !UNIV_HOTBACKUP */
/************************************************************//**
Returns the maximum combined size of records which can be inserted on top
of record heap.
@@ -952,7 +953,7 @@ UNIV_INTERN
ibool
page_rec_validate(
/*==============*/
- rec_t* rec, /*!< in: physical record */
+ const rec_t* rec, /*!< in: physical record */
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
/***************************************************************//**
Checks that the first directory slot points to the infimum record and
@@ -972,7 +973,7 @@ UNIV_INTERN
ibool
page_simple_validate_old(
/*=====================*/
- page_t* page); /*!< in: old-style index page */
+ const page_t* page); /*!< in: index page in ROW_FORMAT=REDUNDANT */
/***************************************************************//**
This function checks the consistency of an index page when we do not
know the index. This is also resilient so that this should never crash
@@ -982,7 +983,7 @@ UNIV_INTERN
ibool
page_simple_validate_new(
/*=====================*/
- page_t* block); /*!< in: new-style index page */
+ const page_t* page); /*!< in: index page in ROW_FORMAT!=REDUNDANT */
/***************************************************************//**
This function checks the consistency of an index page.
@return TRUE if ok */
@@ -990,7 +991,7 @@ UNIV_INTERN
ibool
page_validate(
/*==========*/
- page_t* page, /*!< in: index page */
+ const page_t* page, /*!< in: index page */
dict_index_t* index); /*!< in: data dictionary index containing
the page record type definition */
/***************************************************************//**
diff --git a/storage/xtradb/include/page0page.ic b/storage/xtradb/include/page0page.ic
index dab9dc742e4..d8570108115 100644
--- a/storage/xtradb/include/page0page.ic
+++ b/storage/xtradb/include/page0page.ic
@@ -94,11 +94,10 @@ page_update_max_trx_id(
TRUE for the dummy indexes constructed during redo log
application). In that case, PAGE_MAX_TRX_ID is unused,
and trx_id is usually zero. */
- ut_ad(!ut_dulint_is_zero(trx_id) || recv_recovery_is_on());
+ ut_ad(trx_id || recv_recovery_is_on());
ut_ad(page_is_leaf(buf_block_get_frame(block)));
- if (ut_dulint_cmp(page_get_max_trx_id(buf_block_get_frame(block)),
- trx_id) < 0) {
+ if (page_get_max_trx_id(buf_block_get_frame(block)) < trx_id) {
page_set_max_trx_id(block, page_zip, trx_id, mtr);
}
@@ -963,6 +962,29 @@ page_get_free_space_of_empty(
- 2 * PAGE_DIR_SLOT_SIZE));
}
+#ifndef UNIV_HOTBACKUP
+/***********************************************************************//**
+Write a 32-bit field in a data dictionary record. */
+UNIV_INLINE
+void
+page_rec_write_field(
+/*=================*/
+ rec_t* rec, /*!< in/out: record to update */
+ ulint i, /*!< in: index of the field to update */
+ ulint val, /*!< in: value to write */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+{
+ byte* data;
+ ulint len;
+
+ data = rec_get_nth_field_old(rec, i, &len);
+
+ ut_ad(len == 4);
+
+ mlog_write_ulint(data, val, MLOG_4BYTES, mtr);
+}
+#endif /* !UNIV_HOTBACKUP */
+
/************************************************************//**
Each user record on a page, and also the deleted user records in the heap
takes its size plus the fraction of the dir cell size /
diff --git a/storage/xtradb/include/page0zip.h b/storage/xtradb/include/page0zip.h
index 4d37302ed20..fe3d2e52e0b 100644
--- a/storage/xtradb/include/page0zip.h
+++ b/storage/xtradb/include/page0zip.h
@@ -420,7 +420,7 @@ page_zip_copy_recs(
const page_t* src, /*!< in: page */
dict_index_t* index, /*!< in: index of the B-tree */
mtr_t* mtr) /*!< in: mini-transaction */
- __attribute__((nonnull(1,2,3,4)));
+ __attribute__((nonnull));
#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
diff --git a/storage/xtradb/include/pars0pars.h b/storage/xtradb/include/pars0pars.h
index fe5d76ebbb0..141b2706d7d 100644
--- a/storage/xtradb/include/pars0pars.h
+++ b/storage/xtradb/include/pars0pars.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. 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
@@ -521,17 +521,17 @@ Equivalent to:
char buf[8];
mach_write_to_8(buf, val);
-pars_info_add_literal(info, name, buf, 8, DATA_BINARY, 0);
+pars_info_add_literal(info, name, buf, 8, DATA_FIXBINARY, 0);
except that the buffer is dynamically allocated from the info struct's
heap. */
UNIV_INTERN
void
-pars_info_add_dulint_literal(
-/*=========================*/
+pars_info_add_ull_literal(
+/*======================*/
pars_info_t* info, /*!< in: info struct */
const char* name, /*!< in: name */
- dulint val); /*!< in: value */
+ ib_uint64_t val); /*!< in: value */
/****************************************************************//**
Add user function. */
UNIV_INTERN
diff --git a/storage/xtradb/include/que0que.h b/storage/xtradb/include/que0que.h
index ed48f980294..369e74d788c 100644
--- a/storage/xtradb/include/que0que.h
+++ b/storage/xtradb/include/que0que.h
@@ -424,9 +424,6 @@ struct que_fork_struct{
ibool cur_on_row; /*!< TRUE if cursor is on a row, i.e.,
it is not before the first row or
after the last row */
- dulint n_inserts; /*!< number of rows inserted */
- dulint n_updates; /*!< number of rows updated */
- dulint n_deletes; /*!< number of rows deleted */
sel_node_t* last_sel_node; /*!< last executed select node, or NULL
if none */
UT_LIST_NODE_T(que_fork_t)
diff --git a/storage/xtradb/include/read0read.h b/storage/xtradb/include/read0read.h
index 4d9a9fade36..0c9468d985e 100644
--- a/storage/xtradb/include/read0read.h
+++ b/storage/xtradb/include/read0read.h
@@ -43,8 +43,7 @@ read_view_t*
read_view_open_now(
/*===============*/
trx_id_t cr_trx_id, /*!< in: trx_id of creating
- transaction, or ut_dulint_zero
- used in purge */
+ transaction, or 0 used in purge */
mem_heap_t* heap); /*!< in: memory heap from which
allocated */
/*********************************************************************//**
@@ -56,8 +55,7 @@ read_view_t*
read_view_oldest_copy_or_open_new(
/*==============================*/
trx_id_t cr_trx_id, /*!< in: trx_id of creating
- transaction, or ut_dulint_zero
- used in purge */
+ transaction, or 0 used in purge */
mem_heap_t* heap); /*!< in: memory heap from which
allocated */
/*********************************************************************//**
@@ -90,6 +88,7 @@ UNIV_INTERN
void
read_view_print(
/*============*/
+ FILE* file,
const read_view_t* view); /*!< in: read view */
/*********************************************************************//**
Create a consistent cursor view for mysql to be used in cursors. In this
@@ -125,7 +124,7 @@ read should not see the modifications to the database. */
struct read_view_struct{
ulint type; /*!< VIEW_NORMAL, VIEW_HIGH_GRANULARITY */
- undo_no_t undo_no;/*!< ut_dulint_zero or if type is
+ undo_no_t undo_no;/*!< 0 or if type is
VIEW_HIGH_GRANULARITY
transaction undo_no when this high-granularity
consistent read view was created */
@@ -156,7 +155,7 @@ struct read_view_struct{
that is, up_limit_id and low_limit_id. */
trx_id_t creator_trx_id;
/*!< trx id of creating transaction, or
- ut_dulint_zero used in purge */
+ 0 used in purge */
UT_LIST_NODE_T(read_view_t) view_list;
/*!< List of read views in trx_sys */
};
diff --git a/storage/xtradb/include/read0read.ic b/storage/xtradb/include/read0read.ic
index 9924967cc2d..5bb5249b591 100644
--- a/storage/xtradb/include/read0read.ic
+++ b/storage/xtradb/include/read0read.ic
@@ -64,15 +64,14 @@ read_view_sees_trx_id(
trx_id_t trx_id) /*!< in: trx id */
{
ulint n_ids;
- int cmp;
ulint i;
- if (ut_dulint_cmp(trx_id, view->up_limit_id) < 0) {
+ if (trx_id < view->up_limit_id) {
return(TRUE);
}
- if (ut_dulint_cmp(trx_id, view->low_limit_id) >= 0) {
+ if (trx_id >= view->low_limit_id) {
return(FALSE);
}
@@ -85,12 +84,11 @@ read_view_sees_trx_id(
n_ids = view->n_trx_ids;
for (i = 0; i < n_ids; i++) {
+ trx_id_t view_trx_id
+ = read_view_get_nth_trx_id(view, n_ids - i - 1);
- cmp = ut_dulint_cmp(
- trx_id,
- read_view_get_nth_trx_id(view, n_ids - i - 1));
- if (cmp <= 0) {
- return(cmp < 0);
+ if (trx_id <= view_trx_id) {
+ return(trx_id != view_trx_id);
}
}
diff --git a/storage/xtradb/include/rem0cmp.h b/storage/xtradb/include/rem0cmp.h
index fcea62ad486..a908521c9f7 100644
--- a/storage/xtradb/include/rem0cmp.h
+++ b/storage/xtradb/include/rem0cmp.h
@@ -165,15 +165,18 @@ cmp_rec_rec_with_match(
const ulint* offsets1,/*!< in: rec_get_offsets(rec1, index) */
const ulint* offsets2,/*!< in: rec_get_offsets(rec2, index) */
dict_index_t* index, /*!< in: data dictionary index */
+ ibool nulls_unequal,
+ /* in: TRUE if this is for index statistics
+ cardinality estimation, and innodb_stats_method
+ is "nulls_unequal" or "nulls_ignored" */
ulint* matched_fields, /*!< in/out: number of already completely
matched fields; when the function returns,
contains the value the for current
comparison */
- ulint* matched_bytes, /*!< in/out: number of already matched
+ ulint* matched_bytes);/*!< in/out: number of already matched
bytes within the first field not completely
matched; when the function returns, contains
the value for the current comparison */
- ulint stats_method);
/*************************************************************//**
This function is used to compare two physical records. Only the common
first fields are compared.
diff --git a/storage/xtradb/include/rem0cmp.ic b/storage/xtradb/include/rem0cmp.ic
index d5185ec94af..63415fe7837 100644
--- a/storage/xtradb/include/rem0cmp.ic
+++ b/storage/xtradb/include/rem0cmp.ic
@@ -87,5 +87,5 @@ cmp_rec_rec(
ulint match_b = 0;
return(cmp_rec_rec_with_match(rec1, rec2, offsets1, offsets2, index,
- &match_f, &match_b, 0));
+ FALSE, &match_f, &match_b));
}
diff --git a/storage/xtradb/include/rem0rec.h b/storage/xtradb/include/rem0rec.h
index 17d08afabb9..10b74d18c13 100644
--- a/storage/xtradb/include/rem0rec.h
+++ b/storage/xtradb/include/rem0rec.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, Oracle and/or its affiliates. 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
@@ -480,6 +480,18 @@ ulint
rec_offs_any_extern(
/*================*/
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
+#ifdef UNIV_BLOB_NULL_DEBUG
+/******************************************************//**
+Determine if the offsets are for a record containing null BLOB pointers.
+@return first field containing a null BLOB pointer, or NULL if none found */
+UNIV_INLINE
+const byte*
+rec_offs_any_null_extern(
+/*=====================*/
+ const rec_t* rec, /*!< in: record */
+ const ulint* offsets) /*!< in: rec_get_offsets(rec) */
+ __attribute__((nonnull, warn_unused_result));
+#endif /* UNIV_BLOB_NULL_DEBUG */
/******************************************************//**
Returns nonzero if the extern bit is set in nth field of rec.
@return nonzero if externally stored */
@@ -600,6 +612,7 @@ ulint
rec_offs_size(
/*==========*/
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
+#ifdef UNIV_DEBUG
/**********************************************************//**
Returns a pointer to the start of the record.
@return pointer to start */
@@ -607,7 +620,7 @@ UNIV_INLINE
byte*
rec_get_start(
/*==========*/
- rec_t* rec, /*!< in: pointer to record */
+ const rec_t* rec, /*!< in: pointer to record */
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
/**********************************************************//**
Returns a pointer to the end of the record.
@@ -616,8 +629,12 @@ UNIV_INLINE
byte*
rec_get_end(
/*========*/
- rec_t* rec, /*!< in: pointer to record */
+ const rec_t* rec, /*!< in: pointer to record */
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
+#else /* UNIV_DEBUG */
+# define rec_get_start(rec, offsets) ((rec) - rec_offs_extra_size(offsets))
+# define rec_get_end(rec, offsets) ((rec) + rec_offs_data_size(offsets))
+#endif /* UNIV_DEBUG */
/***************************************************************//**
Copies a physical record to a buffer.
@return pointer to the origin of the copy */
@@ -659,7 +676,7 @@ rec_fold(
fields to fold */
ulint n_bytes, /*!< in: number of bytes to fold
in an incomplete last field */
- dulint tree_id) /*!< in: index tree id */
+ index_id_t tree_id) /*!< in: index tree id */
__attribute__((pure));
#endif /* !UNIV_HOTBACKUP */
/*********************************************************//**
@@ -801,13 +818,11 @@ UNIV_INTERN
void
rec_print(
/*======*/
- FILE* file, /*!< in: file where to print */
- const rec_t* rec, /*!< in: physical record */
- dict_index_t* index); /*!< in: record descriptor */
+ FILE* file, /*!< in: file where to print */
+ const rec_t* rec, /*!< in: physical record */
+ const dict_index_t* index); /*!< in: record descriptor */
#endif /* UNIV_HOTBACKUP */
-#define REC_INFO_BITS 6 /* This is single byte bit-field */
-
/* Maximum lengths for the data in a physical record if the offsets
are given in one byte (resp. two byte) format. */
#define REC_1BYTE_OFFS_LIMIT 0x7FUL
diff --git a/storage/xtradb/include/rem0rec.ic b/storage/xtradb/include/rem0rec.ic
index fa96c97f95e..7cd203f131a 100644
--- a/storage/xtradb/include/rem0rec.ic
+++ b/storage/xtradb/include/rem0rec.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, Oracle and/or its affiliates. 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
@@ -26,6 +26,7 @@ Created 5/30/1994 Heikki Tuuri
#include "mach0data.h"
#include "ut0byte.h"
#include "dict0dict.h"
+#include "btr0types.h"
/* Compact flag ORed to the extra size returned by rec_get_offsets() */
#define REC_OFFS_COMPACT ((ulint) 1 << 31)
@@ -1087,6 +1088,44 @@ rec_offs_any_extern(
return(UNIV_UNLIKELY(*rec_offs_base(offsets) & REC_OFFS_EXTERNAL));
}
+#ifdef UNIV_BLOB_NULL_DEBUG
+/******************************************************//**
+Determine if the offsets are for a record containing null BLOB pointers.
+@return first field containing a null BLOB pointer, or NULL if none found */
+UNIV_INLINE
+const byte*
+rec_offs_any_null_extern(
+/*=====================*/
+ const rec_t* rec, /*!< in: record */
+ const ulint* offsets) /*!< in: rec_get_offsets(rec) */
+{
+ ulint i;
+ ut_ad(rec_offs_validate(rec, NULL, offsets));
+
+ if (!rec_offs_any_extern(offsets)) {
+ return(NULL);
+ }
+
+ for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+ if (rec_offs_nth_extern(offsets, i)) {
+ ulint len;
+ const byte* field
+ = rec_get_nth_field(rec, offsets, i, &len);
+
+ ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
+ if (!memcmp(field + len
+ - BTR_EXTERN_FIELD_REF_SIZE,
+ field_ref_zero,
+ BTR_EXTERN_FIELD_REF_SIZE)) {
+ return(field);
+ }
+ }
+ }
+
+ return(NULL);
+}
+#endif /* UNIV_BLOB_NULL_DEBUG */
+
/******************************************************//**
Returns nonzero if the extern bit is set in nth field of rec.
@return nonzero if externally stored */
@@ -1462,6 +1501,7 @@ rec_offs_size(
return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets));
}
+#ifdef UNIV_DEBUG
/**********************************************************//**
Returns a pointer to the end of the record.
@return pointer to end */
@@ -1469,11 +1509,11 @@ UNIV_INLINE
byte*
rec_get_end(
/*========*/
- rec_t* rec, /*!< in: pointer to record */
+ const rec_t* rec, /*!< in: pointer to record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(rec, NULL, offsets));
- return(rec + rec_offs_data_size(offsets));
+ return((rec_t*) rec + rec_offs_data_size(offsets));
}
/**********************************************************//**
@@ -1483,12 +1523,13 @@ UNIV_INLINE
byte*
rec_get_start(
/*==========*/
- rec_t* rec, /*!< in: pointer to record */
+ const rec_t* rec, /*!< in: pointer to record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(rec, NULL, offsets));
- return(rec - rec_offs_extra_size(offsets));
+ return((rec_t*) rec - rec_offs_extra_size(offsets));
}
+#endif /* UNIV_DEBUG */
/***************************************************************//**
Copies a physical record to a buffer.
@@ -1594,7 +1635,7 @@ rec_fold(
fields to fold */
ulint n_bytes, /*!< in: number of bytes to fold
in an incomplete last field */
- dulint tree_id) /*!< in: index tree id */
+ index_id_t tree_id) /*!< in: index tree id */
{
ulint i;
const byte* data;
@@ -1618,7 +1659,7 @@ rec_fold(
n_bytes = 0;
}
- fold = ut_fold_dulint(tree_id);
+ fold = ut_fold_ull(tree_id);
for (i = 0; i < n_fields; i++) {
data = rec_get_nth_field(rec, offsets, i, &len);
diff --git a/storage/xtradb/include/rem0types.h b/storage/xtradb/include/rem0types.h
index 8b84d4af233..7afd595be90 100644
--- a/storage/xtradb/include/rem0types.h
+++ b/storage/xtradb/include/rem0types.h
@@ -34,13 +34,21 @@ typedef byte rec_t;
#define REC_MAX_HEAP_NO (2 * 8192 - 1)
#define REC_MAX_N_OWNED (16 - 1)
-/* REC_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
-indexed column length (or indexed prefix length). It is set to 3*256,
-so that one can create a column prefix index on 256 characters of a
-TEXT or VARCHAR column also in the UTF-8 charset. In that charset,
-a character may take at most 3 bytes.
+/* REC_ANTELOPE_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
+indexed field length (or indexed prefix length) for indexes on tables of
+ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT format.
+Before we support UTF-8 encodings with mbmaxlen = 4, a UTF-8 character
+may take at most 3 bytes. So the limit was set to 3*256, so that one
+can create a column prefix index on 256 characters of a TEXT or VARCHAR
+column also in the UTF-8 charset.
This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
files would be at risk! */
-#define REC_MAX_INDEX_COL_LEN 768
+#define REC_ANTELOPE_MAX_INDEX_COL_LEN 768
+
+/** Maximum indexed field length for table format DICT_TF_FORMAT_ZIP and
+beyond.
+This (3072) is the maximum index row length allowed, so we cannot create index
+prefix column longer than that. */
+#define REC_VERSION_56_MAX_INDEX_COL_LEN 3072
#endif
diff --git a/storage/xtradb/include/row0ext.h b/storage/xtradb/include/row0ext.h
index 43d82d644e6..557da2c4a82 100644
--- a/storage/xtradb/include/row0ext.h
+++ b/storage/xtradb/include/row0ext.h
@@ -30,6 +30,7 @@ Created September 2006 Marko Makela
#include "row0types.h"
#include "data0types.h"
#include "mem0mem.h"
+#include "dict0types.h"
/********************************************************************//**
Creates a cache of column prefixes of externally stored columns.
@@ -43,13 +44,13 @@ row_ext_create(
in the InnoDB table object, as reported by
dict_col_get_no(); NOT relative to the records
in the clustered index */
+ ulint flags, /*!< in: table->flags */
const dtuple_t* tuple, /*!< in: data tuple containing the field
references of the externally stored
columns; must be indexed by col_no;
the clustered index record must be
covered by a lock or a page latch
to prevent deletion (rollback or purge). */
- ulint zip_size,/*!< compressed page size in bytes, or 0 */
mem_heap_t* heap); /*!< in: heap where created */
/********************************************************************//**
@@ -63,7 +64,8 @@ row_ext_lookup_ith(
const row_ext_t* ext, /*!< in/out: column prefix cache */
ulint i, /*!< in: index of ext->ext[] */
ulint* len); /*!< out: length of prefix, in bytes,
- at most REC_MAX_INDEX_COL_LEN */
+ at most the length determined by
+ DICT_MAX_FIELD_LEN_BY_FORMAT() */
/********************************************************************//**
Looks up a column prefix of an externally stored column.
@return column prefix, or NULL if the column is not stored externally,
@@ -78,13 +80,18 @@ row_ext_lookup(
dict_col_get_no(); NOT relative to the
records in the clustered index */
ulint* len); /*!< out: length of prefix, in bytes,
- at most REC_MAX_INDEX_COL_LEN */
+ at most the length determined by
+ DICT_MAX_FIELD_LEN_BY_FORMAT() */
/** Prefixes of externally stored columns */
struct row_ext_struct{
ulint n_ext; /*!< number of externally stored columns */
const ulint* ext; /*!< col_no's of externally stored columns */
byte* buf; /*!< backing store of the column prefix cache */
+ ulint max_len;/*!< maximum prefix length, it could be
+ REC_ANTELOPE_MAX_INDEX_COL_LEN or
+ REC_VERSION_56_MAX_INDEX_COL_LEN depending
+ on row format */
ulint len[1]; /*!< prefix lengths; 0 if not cached */
};
diff --git a/storage/xtradb/include/row0ext.ic b/storage/xtradb/include/row0ext.ic
index 82771a9312a..466046b2821 100644
--- a/storage/xtradb/include/row0ext.ic
+++ b/storage/xtradb/include/row0ext.ic
@@ -37,7 +37,7 @@ row_ext_lookup_ith(
const row_ext_t* ext, /*!< in/out: column prefix cache */
ulint i, /*!< in: index of ext->ext[] */
ulint* len) /*!< out: length of prefix, in bytes,
- at most REC_MAX_INDEX_COL_LEN */
+ at most ext->max_len */
{
ut_ad(ext);
ut_ad(len);
@@ -45,11 +45,14 @@ row_ext_lookup_ith(
*len = ext->len[i];
+ ut_ad(*len <= ext->max_len);
+ ut_ad(ext->max_len > 0);
+
if (UNIV_UNLIKELY(*len == 0)) {
/* The BLOB could not be fetched to the cache. */
return(field_ref_zero);
} else {
- return(ext->buf + i * REC_MAX_INDEX_COL_LEN);
+ return(ext->buf + i * ext->max_len);
}
}
@@ -67,7 +70,7 @@ row_ext_lookup(
dict_col_get_no(); NOT relative to the
records in the clustered index */
ulint* len) /*!< out: length of prefix, in bytes,
- at most REC_MAX_INDEX_COL_LEN */
+ at most ext->max_len */
{
ulint i;
diff --git a/storage/xtradb/include/row0ins.h b/storage/xtradb/include/row0ins.h
index 9f93565ddb7..810973e61a7 100644
--- a/storage/xtradb/include/row0ins.h
+++ b/storage/xtradb/include/row0ins.h
@@ -84,9 +84,10 @@ ulint
row_ins_index_entry(
/*================*/
dict_index_t* index, /*!< in: index */
- dtuple_t* entry, /*!< in: index entry to insert */
+ dtuple_t* entry, /*!< in/out: index entry to insert */
ulint n_ext, /*!< in: number of externally stored columns */
- ibool foreign,/*!< in: TRUE=check foreign key constraints */
+ ibool foreign,/*!< in: TRUE=check foreign key constraints
+ (foreign=FALSE only during CREATE INDEX) */
que_thr_t* thr); /*!< in: query thread */
/***********************************************************//**
Inserts a row to a table. This is a high-level function used in
diff --git a/storage/xtradb/include/row0merge.h b/storage/xtradb/include/row0merge.h
index fbeb125ce7b..be7c77e7724 100644
--- a/storage/xtradb/include/row0merge.h
+++ b/storage/xtradb/include/row0merge.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2005, 2010, Innobase Oy. 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
diff --git a/storage/xtradb/include/row0mysql.h b/storage/xtradb/include/row0mysql.h
index 9090e476bfd..ff00f031e91 100644
--- a/storage/xtradb/include/row0mysql.h
+++ b/storage/xtradb/include/row0mysql.h
@@ -103,6 +103,17 @@ row_mysql_read_blob_ref(
ulint col_len); /*!< in: BLOB reference length
(not BLOB length) */
/**************************************************************//**
+Pad a column with spaces. */
+UNIV_INTERN
+void
+row_mysql_pad_col(
+/*==============*/
+ ulint mbminlen, /*!< in: minimum size of a character,
+ in bytes */
+ byte* pad, /*!< out: padded buffer */
+ ulint len); /*!< in: number of bytes to pad */
+
+/**************************************************************//**
Stores a non-SQL-NULL field given in the MySQL format in the InnoDB format.
The counterpart of this function is row_sel_field_store_in_mysql_format() in
row0sel.c.
@@ -384,6 +395,14 @@ row_insert_stats_for_mysql(
dict_index_t* index,
trx_t* trx);
/*********************************************************************//**
+*/
+UNIV_INTERN
+int
+row_delete_stats_for_mysql(
+/*=======================*/
+ dict_index_t* index,
+ trx_t* trx);
+/*********************************************************************//**
Scans a table create SQL string and adds to the data dictionary
the foreign key constraints declared in the string. This function
should be called after the indexes for a table have been created.
@@ -535,6 +554,10 @@ struct mysql_row_templ_struct {
Innobase record in the current index;
not defined if template_type is
ROW_MYSQL_WHOLE_ROW */
+ ulint clust_rec_field_no; /*!< field number of the column in an
+ Innobase record in the clustered index;
+ not defined if template_type is
+ ROW_MYSQL_WHOLE_ROW */
ulint mysql_col_offset; /*!< offset of the column in the MySQL
row format */
ulint mysql_col_len; /*!< length of the column in the MySQL
@@ -573,7 +596,7 @@ struct mysql_row_templ_struct {
#define ROW_PREBUILT_ALLOCATED 78540783
#define ROW_PREBUILT_FREED 26423527
-typedef int (*index_cond_func_t)(void *param);
+typedef int (*idx_cond_func_t)(void *param);
/** A struct for (sometimes lazily) prebuilt structures in an Innobase table
handle used within MySQL; these are used to save CPU time. */
@@ -774,7 +797,7 @@ struct row_prebuilt_struct {
ulint magic_n2; /*!< this should be the same as
magic_n */
/*----------------------*/
- index_cond_func_t idx_cond_func;/* Index Condition Pushdown function,
+ idx_cond_func_t idx_cond_func; /* Index Condition Pushdown function,
or NULL if there is none set */
void* idx_cond_func_arg;/* ICP function argument */
ulint n_index_fields; /* Number of fields at the start of
diff --git a/storage/xtradb/include/row0purge.h b/storage/xtradb/include/row0purge.h
index 89ec54fb54a..485d51dbc83 100644
--- a/storage/xtradb/include/row0purge.h
+++ b/storage/xtradb/include/row0purge.h
@@ -45,6 +45,28 @@ row_purge_node_create(
que_thr_t* parent, /*!< in: parent node, i.e., a thr node */
mem_heap_t* heap); /*!< in: memory heap where created */
/***********************************************************//**
+Determines if it is possible to remove a secondary index entry.
+Removal is possible if the secondary index entry does not refer to any
+not delete marked version of a clustered index record where DB_TRX_ID
+is newer than the purge view.
+
+NOTE: This function should only be called by the purge thread, only
+while holding a latch on the leaf page of the secondary index entry
+(or keeping the buffer pool watch on the page). It is possible that
+this function first returns TRUE and then FALSE, if a user transaction
+inserts a record that the secondary index entry would refer to.
+However, in that case, the user transaction would also re-insert the
+secondary index entry after purge has removed it and released the leaf
+page latch.
+@return TRUE if the secondary index record can be purged */
+UNIV_INTERN
+ibool
+row_purge_poss_sec(
+/*===============*/
+ purge_node_t* node, /*!< in/out: row purge node */
+ dict_index_t* index, /*!< in: secondary index */
+ const dtuple_t* entry); /*!< in: secondary index entry */
+/***************************************************************
Does the purge operation for a single undo log record. This is a high-level
function used in an SQL execution graph.
@return query thread to run next or NULL */
diff --git a/storage/xtradb/include/row0row.h b/storage/xtradb/include/row0row.h
index 723b7b53395..75e15d67246 100644
--- a/storage/xtradb/include/row0row.h
+++ b/storage/xtradb/include/row0row.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. 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
@@ -41,13 +41,24 @@ Created 4/20/1996 Heikki Tuuri
Gets the offset of the trx id field, in bytes relative to the origin of
a clustered index record.
@return offset of DATA_TRX_ID */
-UNIV_INTERN
+UNIV_INLINE
ulint
-row_get_trx_id_offset(
-/*==================*/
- const rec_t* rec, /*!< in: record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets);/*!< in: rec_get_offsets(rec, index) */
+row_get_trx_id_offset_func(
+/*=======================*/
+#ifdef UNIV_DEBUG
+ const rec_t* rec, /*!< in: record */
+#endif /* UNIV_DEBUG */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ __attribute__((nonnull, warn_unused_result));
+#ifdef UNIV_DEBUG
+# define row_get_trx_id_offset(rec, index, offsets) \
+ row_get_trx_id_offset_func(rec, index, offsets)
+#else /* UNIV_DEBUG */
+# define row_get_trx_id_offset(rec, index, offsets) \
+ row_get_trx_id_offset_func(index, offsets)
+#endif /* UNIV_DEBUG */
+
/*********************************************************************//**
Reads the trx id field from a clustered index record.
@return value of the field */
@@ -55,9 +66,10 @@ UNIV_INLINE
trx_id_t
row_get_rec_trx_id(
/*===============*/
- const rec_t* rec, /*!< in: record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets);/*!< in: rec_get_offsets(rec, index) */
+ const rec_t* rec, /*!< in: record */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ __attribute__((nonnull, warn_unused_result));
/*********************************************************************//**
Reads the roll pointer field from a clustered index record.
@return value of the field */
@@ -257,11 +269,25 @@ row_get_clust_rec(
dict_index_t* index, /*!< in: secondary index */
dict_index_t** clust_index,/*!< out: clustered index */
mtr_t* mtr); /*!< in: mtr */
+
+/** Result of row_search_index_entry */
+enum row_search_result {
+ ROW_FOUND = 0, /*!< the record was found */
+ ROW_NOT_FOUND, /*!< record not found */
+ ROW_BUFFERED, /*!< one of BTR_INSERT, BTR_DELETE, or
+ BTR_DELETE_MARK was specified, the
+ secondary index leaf page was not in
+ the buffer pool, and the operation was
+ enqueued in the insert/delete buffer */
+ ROW_NOT_DELETED_REF /*!< BTR_DELETE was specified, and
+ row_purge_poss_sec() failed */
+};
+
/***************************************************************//**
Searches an index record.
-@return TRUE if found */
+@return whether the record was found or buffered */
UNIV_INTERN
-ibool
+enum row_search_result
row_search_index_entry(
/*===================*/
dict_index_t* index, /*!< in: index */
diff --git a/storage/xtradb/include/row0row.ic b/storage/xtradb/include/row0row.ic
index 05c007641af..9d19e430e16 100644
--- a/storage/xtradb/include/row0row.ic
+++ b/storage/xtradb/include/row0row.ic
@@ -28,15 +28,45 @@ Created 4/20/1996 Heikki Tuuri
#include "trx0undo.h"
/*********************************************************************//**
+Gets the offset of trx id field, in bytes relative to the origin of
+a clustered index record.
+@return offset of DATA_TRX_ID */
+UNIV_INLINE
+ulint
+row_get_trx_id_offset_func(
+/*=======================*/
+#ifdef UNIV_DEBUG
+ const rec_t* rec, /*!< in: record */
+#endif /* UNIV_DEBUG */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+{
+ ulint pos;
+ ulint offset;
+ ulint len;
+
+ ut_ad(dict_index_is_clust(index));
+ ut_ad(rec_offs_validate(rec, index, offsets));
+
+ pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
+
+ offset = rec_get_nth_field_offs(offsets, pos, &len);
+
+ ut_ad(len == DATA_TRX_ID_LEN);
+
+ return(offset);
+}
+
+/*********************************************************************//**
Reads the trx id field from a clustered index record.
@return value of the field */
UNIV_INLINE
trx_id_t
row_get_rec_trx_id(
/*===============*/
- const rec_t* rec, /*!< in: record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_t* rec, /*!< in: record */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ulint offset;
diff --git a/storage/xtradb/include/row0types.h b/storage/xtradb/include/row0types.h
index 1be729206ba..7d6a7c8e2b1 100644
--- a/storage/xtradb/include/row0types.h
+++ b/storage/xtradb/include/row0types.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. 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
diff --git a/storage/xtradb/include/row0upd.h b/storage/xtradb/include/row0upd.h
index 635d746d5a1..c275c1da78e 100644
--- a/storage/xtradb/include/row0upd.h
+++ b/storage/xtradb/include/row0upd.h
@@ -126,13 +126,13 @@ UNIV_INTERN
void
row_upd_index_entry_sys_field(
/*==========================*/
- const dtuple_t* entry, /*!< in: index entry, where the memory buffers
- for sys fields are already allocated:
+ dtuple_t* entry, /*!< in/out: index entry, where the memory
+ buffers for sys fields are already allocated:
the function just copies the new values to
them */
dict_index_t* index, /*!< in: clustered index */
ulint type, /*!< in: DATA_TRX_ID or DATA_ROLL_PTR */
- dulint val); /*!< in: value to write */
+ ib_uint64_t val); /*!< in: value to write */
/*********************************************************************//**
Creates an update node for a query graph.
@return own: update node */
@@ -167,8 +167,11 @@ row_upd_changes_field_size_or_external(
const upd_t* update);/*!< in: update vector */
#endif /* !UNIV_HOTBACKUP */
/***********************************************************//**
-Replaces the new column values stored in the update vector to the record
-given. No field size changes are allowed. */
+Replaces the new column values stored in the update vector to the
+record given. No field size changes are allowed. This function is
+usually invoked on a clustered index. The only use case for a
+secondary index is row_ins_sec_index_entry_by_modify() or its
+counterpart in ibuf_insert_to_index_page(). */
UNIV_INTERN
void
row_upd_rec_in_place(
@@ -277,16 +280,29 @@ NOTE: we compare the fields as binary strings!
@return TRUE if update vector changes an ordering field in the index record */
UNIV_INTERN
ibool
-row_upd_changes_ord_field_binary(
-/*=============================*/
+row_upd_changes_ord_field_binary_func(
+/*==================================*/
+ dict_index_t* index, /*!< in: index of the record */
+ const upd_t* update, /*!< in: update vector for the row; NOTE: the
+ field numbers in this MUST be clustered index
+ positions! */
+#ifdef UNIV_DEBUG
+ const que_thr_t*thr, /*!< in: query thread */
+#endif /* UNIV_DEBUG */
const dtuple_t* row, /*!< in: old value of row, or NULL if the
row and the data values in update are not
known when this function is called, e.g., at
compile time */
- dict_index_t* index, /*!< in: index of the record */
- const upd_t* update);/*!< in: update vector for the row; NOTE: the
- field numbers in this MUST be clustered index
- positions! */
+ const row_ext_t*ext) /*!< NULL, or prefixes of the externally
+ stored columns in the old row */
+ __attribute__((nonnull(1,2), warn_unused_result));
+#ifdef UNIV_DEBUG
+# define row_upd_changes_ord_field_binary(index,update,thr,row,ext) \
+ row_upd_changes_ord_field_binary_func(index,update,thr,row,ext)
+#else /* UNIV_DEBUG */
+# define row_upd_changes_ord_field_binary(index,update,thr,row,ext) \
+ row_upd_changes_ord_field_binary_func(index,update,row,ext)
+#endif /* UNIV_DEBUG */
/***********************************************************//**
Checks if an update vector changes an ordering field of an index record.
This function is fast if the update vector is short or the number of ordering
@@ -459,11 +475,16 @@ struct upd_node_struct{
#define UPD_NODE_INSERT_CLUSTERED 3 /* clustered index record should be
inserted, old record is already delete
marked */
-#define UPD_NODE_UPDATE_ALL_SEC 4 /* an ordering field of the clustered
+#define UPD_NODE_INSERT_BLOB 4 /* clustered index record should be
+ inserted, old record is already
+ delete-marked; non-updated BLOBs
+ should be inherited by the new record
+ and disowned by the old record */
+#define UPD_NODE_UPDATE_ALL_SEC 5 /* an ordering field of the clustered
index record was changed, or this is
a delete operation: should update
all the secondary index records */
-#define UPD_NODE_UPDATE_SOME_SEC 5 /* secondary index entries should be
+#define UPD_NODE_UPDATE_SOME_SEC 6 /* secondary index entries should be
looked at and updated if an ordering
field changed */
diff --git a/storage/xtradb/include/row0upd.ic b/storage/xtradb/include/row0upd.ic
index 18e22f1eca9..2968a548b34 100644
--- a/storage/xtradb/include/row0upd.ic
+++ b/storage/xtradb/include/row0upd.ic
@@ -158,7 +158,7 @@ row_upd_rec_sys_fields(
ut_ad(dict_index_is_clust(index));
ut_ad(rec_offs_validate(rec, index, offsets));
#ifdef UNIV_SYNC_DEBUG
- if (!rw_lock_own(&btr_search_latch, RW_LOCK_EX)) {
+ if (!rw_lock_own(btr_search_get_latch(index->id), RW_LOCK_EX)) {
ut_ad(!buf_block_align(rec)->is_hashed);
}
#endif /* UNIV_SYNC_DEBUG */
diff --git a/storage/xtradb/include/srv0que.h b/storage/xtradb/include/srv0que.h
deleted file mode 100644
index 82ee7739ef7..00000000000
--- a/storage/xtradb/include/srv0que.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 1996, 2009, Innobase Oy. 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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file include/srv0que.h
-Server query execution
-
-Created 6/5/1996 Heikki Tuuri
-*******************************************************/
-
-#ifndef srv0que_h
-#define srv0que_h
-
-#include "univ.i"
-#include "que0types.h"
-
-/**********************************************************************//**
-Enqueues a task to server task queue and releases a worker thread, if there
-is a suspended one. */
-UNIV_INTERN
-void
-srv_que_task_enqueue_low(
-/*=====================*/
- que_thr_t* thr); /*!< in: query thread */
-
-#endif
-
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index 8c64d5cee71..ebd83043040 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2011, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
@@ -60,6 +60,15 @@ extern os_event_t srv_lock_timeout_thread_event;
/* This event is set to tell the purge thread to shut down */
extern os_event_t srv_purge_thread_event;
+/* The monitor thread waits on this event. */
+extern os_event_t srv_monitor_event;
+
+/* The lock timeout thread waits on this event. */
+extern os_event_t srv_timeout_event;
+
+/* The error monitor thread waits on this event. */
+extern os_event_t srv_error_event;
+
/* If the last data file is auto-extended, we add this many pages to it
at a time */
#define SRV_AUTO_EXTEND_INCREMENT \
@@ -68,9 +77,6 @@ at a time */
/* prototypes for new functions added to ha_innodb.cc */
ibool innobase_get_slow_log();
-/* This is set to TRUE if the MySQL user has set it in MySQL */
-extern ibool srv_lower_case_table_names;
-
/* Mutex for locking srv_monitor_file */
extern mutex_t srv_monitor_file_mutex;
/* Temporary file for innodb monitor output */
@@ -107,12 +113,20 @@ extern ulint srv_file_format;
/** Whether to check file format during startup. A value of
DICT_TF_FORMAT_MAX + 1 means no checking ie. FALSE. The default is to
set it to the highest format we support. */
-extern ulint srv_check_file_format_at_startup;
+extern ulint srv_max_file_format_at_startup;
/** Place locks to records only i.e. do not use next-key locking except
on duplicate key checking and foreign key checking */
extern ibool srv_locks_unsafe_for_binlog;
#endif /* !UNIV_HOTBACKUP */
+/* If this flag is TRUE, then we will use the native aio of the
+OS (provided we compiled Innobase with it in), otherwise we will
+use simulated aio we build below with threads.
+Currently we support native aio on windows and linux */
+extern my_bool srv_use_native_aio;
+#ifdef __WIN__
+extern ibool srv_use_native_conditions;
+#endif
extern ulint srv_n_data_files;
extern char** srv_data_file_names;
extern ulint* srv_data_file_sizes;
@@ -120,12 +134,8 @@ extern ulint* srv_data_file_is_raw_partition;
extern char* srv_doublewrite_file;
-extern ibool srv_extra_undoslots;
-
extern ibool srv_recovery_stats;
-extern ulint srv_use_purge_thread;
-
extern ibool srv_auto_extend_last_data_file;
extern ulint srv_last_file_size_max;
extern char** srv_log_group_home_dirs;
@@ -138,7 +148,8 @@ extern ulint srv_n_log_groups;
extern ulint srv_n_log_files;
extern ulint srv_log_file_size;
extern ulint srv_log_buffer_size;
-extern ulong srv_flush_log_at_trx_commit;
+//extern ulong srv_flush_log_at_trx_commit;
+extern char srv_use_global_flush_log_at_trx_commit;
extern char srv_adaptive_flushing;
@@ -154,15 +165,12 @@ extern my_bool srv_use_sys_malloc;
extern ibool srv_use_sys_malloc;
#endif /* UNIV_HOTBACKUP */
extern ulint srv_buf_pool_size; /*!< requested size in bytes */
+extern ulint srv_buf_pool_instances; /*!< requested number of buffer pool instances */
extern ulint srv_buf_pool_old_size; /*!< previously requested size */
extern ulint srv_buf_pool_curr_size; /*!< current size in bytes */
extern ulint srv_mem_pool_size;
extern ulint srv_lock_table_size;
-extern uint srv_buffer_pool_shm_key;
-extern ibool srv_buffer_pool_shm_is_reused;
-extern ibool srv_buffer_pool_shm_checksum;
-
extern ibool srv_thread_concurrency_timer_based;
extern ulint srv_n_file_io_threads;
@@ -177,10 +185,15 @@ capacity. PCT_IO(5) -> returns the number of IO operations that
is 5% of the max where max is srv_io_capacity. */
#define PCT_IO(p) ((ulong) (srv_io_capacity * ((double) p / 100.0)))
+/* The "innodb_stats_method" setting, decides how InnoDB is going
+to treat NULL value when collecting statistics. It is not defined
+as enum type because the configure option takes unsigned integer type. */
+extern ulong srv_innodb_stats_method;
+
#ifdef UNIV_LOG_ARCHIVE
-extern ibool srv_log_archive_on;
-extern ibool srv_archive_recovery;
-extern dulint srv_archive_recovery_limit_lsn;
+extern ibool srv_log_archive_on;
+extern ibool srv_archive_recovery;
+extern ib_uint64_t srv_archive_recovery_limit_lsn;
#endif /* UNIV_LOG_ARCHIVE */
extern char* srv_file_flush_method_str;
@@ -208,11 +221,7 @@ extern ulint srv_fast_shutdown; /* If this is 1, do not do a
extern ibool srv_innodb_status;
extern unsigned long long srv_stats_sample_pages;
-extern ulong srv_stats_method;
-#define SRV_STATS_METHOD_NULLS_EQUAL 0
-#define SRV_STATS_METHOD_NULLS_NOT_EQUAL 1
-#define SRV_STATS_METHOD_IGNORE_NULLS 2
-extern ulong srv_stats_auto_update;
+extern ulint srv_stats_auto_update;
extern ulint srv_stats_update_need_lock;
extern ibool srv_use_sys_stats_table;
@@ -220,9 +229,6 @@ extern ibool srv_use_doublewrite_buf;
extern ibool srv_use_checksums;
extern ibool srv_fast_checksum;
-extern ibool srv_set_thread_priorities;
-extern int srv_query_thread_priority;
-
extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;
@@ -232,16 +238,17 @@ extern long long srv_ibuf_max_size;
extern ulong srv_ibuf_active_contract;
extern ulong srv_ibuf_accel_rate;
extern ulint srv_checkpoint_age_target;
-extern ulong srv_flush_neighbor_pages;
-extern ulong srv_enable_unsafe_group_commit;
-extern ulong srv_read_ahead;
-extern ulong srv_adaptive_checkpoint;
+extern ulint srv_flush_neighbor_pages;
+extern ulint srv_enable_unsafe_group_commit;
+extern ulint srv_read_ahead;
+extern ulint srv_adaptive_flushing_method;
extern ulong srv_expand_import;
extern ulint srv_pass_corrupt_table;
-extern ulong srv_extra_rsegments;
-extern ulong srv_dict_size_limit;
+extern ulint srv_dict_size_limit;
+
+extern ulint srv_lazy_drop_table;
/*-------------------------------------------*/
extern ulint srv_n_rows_inserted;
@@ -265,6 +272,8 @@ extern ulong srv_thread_sleep_delay;
extern ulong srv_spin_wait_delay;
extern ibool srv_priority_boost;
+extern ulint srv_truncated_status_writes;
+
extern ulint srv_mem_pool_size;
extern ulint srv_lock_table_size;
@@ -315,6 +324,15 @@ extern ulint srv_os_log_pending_writes;
log buffer and have to flush it */
extern ulint srv_log_waits;
+/* the number of purge threads to use from the worker pool (currently 0 or 1) */
+extern ulong srv_n_purge_threads;
+
+/* the number of pages to purge in one batch */
+extern ulong srv_purge_batch_size;
+
+/* the number of rollback segments to use */
+extern ulong srv_rollback_segments;
+
/* variable that counts amount of data read in total (in bytes) */
extern ulint srv_data_read;
@@ -341,6 +359,8 @@ extern ulint srv_buf_pool_wait_free;
buffer pool to disk */
extern ulint srv_buf_pool_flushed;
+extern ulint buf_lru_flush_page_count;
+
/** Number of buffer pool reads that led to the
reading of a disk page */
extern ulint srv_buf_pool_reads;
@@ -359,6 +379,38 @@ typedef struct srv_sys_struct srv_sys_t;
/** The server system */
extern srv_sys_t* srv_sys;
+
+# ifdef UNIV_PFS_THREAD
+/* Keys to register InnoDB threads with performance schema */
+extern mysql_pfs_key_t trx_rollback_clean_thread_key;
+extern mysql_pfs_key_t io_handler_thread_key;
+extern mysql_pfs_key_t srv_lock_timeout_thread_key;
+extern mysql_pfs_key_t srv_error_monitor_thread_key;
+extern mysql_pfs_key_t srv_monitor_thread_key;
+extern mysql_pfs_key_t srv_master_thread_key;
+extern mysql_pfs_key_t srv_purge_thread_key;
+
+/* This macro register the current thread and its key with performance
+schema */
+# define pfs_register_thread(key) \
+do { \
+ if (PSI_server) { \
+ struct PSI_thread* psi = PSI_server->new_thread(key, NULL, 0);\
+ if (psi) { \
+ PSI_server->set_thread(psi); \
+ } \
+ } \
+} while (0)
+
+/* This macro delist the current thread from performance schema */
+# define pfs_delete_thread() \
+do { \
+ if (PSI_server) { \
+ PSI_server->delete_current_thread(); \
+ } \
+} while (0)
+# endif /* UNIV_PFS_THREAD */
+
#endif /* !UNIV_HOTBACKUP */
/** Types of raw partitions in innodb_data_file_path */
@@ -380,7 +432,7 @@ enum {
SRV_UNIX_NOSYNC, /*!< do not flush after writing */
SRV_UNIX_O_DIRECT, /*!< invoke os_file_set_nocache() on
data files */
- SRV_UNIX_ALL_O_DIRECT /* new method for examination: logfile also open O_DIRECT */
+ SRV_UNIX_ALL_O_DIRECT /* new method for examination: logfile also open O_DIRECT */
};
/** Alternatives for file i/o in Windows */
@@ -413,21 +465,24 @@ enum {
in connection with recovery */
};
+/* Alternatives for srv_innodb_stats_method, which could be changed by
+setting innodb_stats_method */
+enum srv_stats_method_name_enum {
+ SRV_STATS_NULLS_EQUAL, /* All NULL values are treated as
+ equal. This is the default setting
+ for innodb_stats_method */
+ SRV_STATS_NULLS_UNEQUAL, /* All NULL values are treated as
+ NOT equal. */
+ SRV_STATS_NULLS_IGNORED /* NULL values are ignored */
+};
+
+typedef enum srv_stats_method_name_enum srv_stats_method_name_t;
+
#ifndef UNIV_HOTBACKUP
/** Types of threads existing in the system. */
enum srv_thread_type {
- SRV_COM = 1, /**< threads serving communication and queries */
- SRV_CONSOLE, /**< thread serving console */
- SRV_WORKER, /**< threads serving parallelized queries and
+ SRV_WORKER = 0, /**< threads serving parallelized queries and
queries released from lock wait */
-#if 0
- /* Utility threads */
- SRV_BUFFER, /**< thread flushing dirty buffer blocks */
- SRV_RECOVERY, /**< threads finishing a recovery */
- SRV_INSERT, /**< thread flushing the insert buffer to disk */
-#endif
- SRV_PURGE, /* thread purging undo records */
- SRV_PURGE_WORKER, /* thread purging undo records */
SRV_MASTER /**< the master thread, (whose type number must
be biggest) */
};
@@ -466,12 +521,13 @@ ulint
srv_get_n_threads(void);
/*===================*/
/*********************************************************************//**
-Returns the calling thread type.
-@return SRV_COM, ... */
-
-enum srv_thread_type
-srv_get_thread_type(void);
-/*=====================*/
+Check whether thread type has reserved a slot.
+@return slot number or UNDEFINED if not found*/
+UNIV_INTERN
+ulint
+srv_thread_has_reserved_slot(
+/*=========================*/
+ enum srv_thread_type type); /*!< in: thread type to check */
/*********************************************************************//**
Sets the info describing an i/o thread current state. */
UNIV_INTERN
@@ -501,21 +557,12 @@ srv_master_thread(
/*==============*/
void* arg); /*!< in: a dummy parameter required by
os_thread_create */
-/*************************************************************************
-The undo purge thread. */
-UNIV_INTERN
-os_thread_ret_t
-srv_purge_thread(
-/*=============*/
- void* arg); /* in: a dummy parameter required by
- os_thread_create */
-/*************************************************************************
-The undo purge thread. */
+/*******************************************************************//**
+Wakes up the purge thread if it's not already awake. */
UNIV_INTERN
-os_thread_ret_t
-srv_purge_worker_thread(
-/*====================*/
- void* arg);
+void
+srv_wake_purge_thread(void);
+/*=======================*/
/*******************************************************************//**
Tells the Innobase server that there has been activity in the database
and wakes up the master thread if it is suspended (not sleeping). Used
@@ -532,6 +579,16 @@ UNIV_INTERN
void
srv_wake_master_thread(void);
/*========================*/
+/*******************************************************************//**
+Tells the purge thread that there has been activity in the database
+and wakes up the purge thread if it is suspended (not sleeping). Note
+that there is a small chance that the purge thread stays suspended
+(we do not protect our operation with the kernel mutex, for
+performace reasons). */
+UNIV_INTERN
+void
+srv_wake_purge_thread_if_not_active(void);
+/*=====================================*/
/*********************************************************************//**
Puts an OS thread to wait if there are too many concurrent threads
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
@@ -648,14 +705,40 @@ void
srv_export_innodb_status(void);
/*==========================*/
-/** Thread slot in the thread table */
-typedef struct srv_slot_struct srv_slot_t;
+/*********************************************************************//**
+Asynchronous purge thread.
+@return a dummy parameter */
+UNIV_INTERN
+os_thread_ret_t
+srv_purge_thread(
+/*=============*/
+ void* arg __attribute__((unused))); /*!< in: a dummy parameter
+ required by os_thread_create */
-/** Thread table is an array of slots */
-typedef srv_slot_t srv_table_t;
+/**********************************************************************//**
+Enqueues a task to server task queue and releases a worker thread, if there
+is a suspended one. */
+UNIV_INTERN
+void
+srv_que_task_enqueue_low(
+/*=====================*/
+ que_thr_t* thr); /*!< in: query thread */
+
+/**********************************************************************//**
+Check whether any background thread is active.
+@return FALSE if all are are suspended or have exited. */
+UNIV_INTERN
+ibool
+srv_is_any_background_thread_active(void);
+/*======================================*/
/** Status variables to be passed to MySQL */
struct export_var_struct{
+ ulint innodb_adaptive_hash_cells;
+ ulint innodb_adaptive_hash_heap_buffers;
+ ulint innodb_adaptive_hash_hash_searches;
+ ulint innodb_adaptive_hash_non_hash_searches;
+ ulint innodb_background_log_sync;
ulint innodb_data_pending_reads; /*!< Pending reads */
ulint innodb_data_pending_writes; /*!< Pending writes */
ulint innodb_data_pending_fsyncs; /*!< Pending fsyncs */
@@ -673,20 +756,54 @@ struct export_var_struct{
#ifdef UNIV_DEBUG
ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
#endif /* UNIV_DEBUG */
+ ulint innodb_buffer_pool_pages_made_not_young;
+ ulint innodb_buffer_pool_pages_made_young;
+ ulint innodb_buffer_pool_pages_old;
ulint innodb_buffer_pool_read_requests; /*!< buf_pool->stat.n_page_gets */
ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */
ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */
ulint innodb_buffer_pool_pages_flushed; /*!< srv_buf_pool_flushed */
+ ulint innodb_buffer_pool_pages_LRU_flushed; /*!< buf_lru_flush_page_count */
ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
- ulint innodb_deadlocks; /* ??? */
+ ulint innodb_checkpoint_age;
+ ulint innodb_checkpoint_max_age;
+ ulint innodb_checkpoint_target_age;
ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
+ ulint innodb_deadlocks;
ibool innodb_have_atomic_builtins; /*!< HAVE_ATOMIC_BUILTINS */
+ ulint innodb_history_list_length;
+ ulint innodb_ibuf_size;
+ ulint innodb_ibuf_free_list;
+ ulint innodb_ibuf_segment_size;
+ ulint innodb_ibuf_merges;
+ ulint innodb_ibuf_merged_inserts;
+ ulint innodb_ibuf_merged_delete_marks;
+ ulint innodb_ibuf_merged_deletes;
+ ulint innodb_ibuf_discarded_inserts;
+ ulint innodb_ibuf_discarded_delete_marks;
+ ulint innodb_ibuf_discarded_deletes;
ulint innodb_log_waits; /*!< srv_log_waits */
ulint innodb_log_write_requests; /*!< srv_log_write_requests */
ulint innodb_log_writes; /*!< srv_log_writes */
+ ib_int64_t innodb_lsn_current;
+ ib_int64_t innodb_lsn_flushed;
+ ib_int64_t innodb_lsn_last_checkpoint;
+ ulint innodb_master_thread_1_second_loops;
+ ulint innodb_master_thread_10_second_loops;
+ ulint innodb_master_thread_background_loops;
+ ulint innodb_master_thread_main_flush_loops;
+ ulint innodb_master_thread_sleeps;
+ ib_int64_t innodb_max_trx_id;
+ ulint innodb_mem_adaptive_hash;
+ ulint innodb_mem_dictionary;
+ ulint innodb_mem_total;
+ ib_int64_t innodb_mutex_os_waits;
+ ib_int64_t innodb_mutex_spin_rounds;
+ ib_int64_t innodb_mutex_spin_waits;
+ ib_int64_t innodb_oldest_view_low_limit_trx_id;
ulint innodb_os_log_written; /*!< srv_os_log_written */
ulint innodb_os_log_fsyncs; /*!< fil_n_log_flushes */
ulint innodb_os_log_pending_writes; /*!< srv_os_log_pending_writes */
@@ -695,6 +812,8 @@ struct export_var_struct{
ulint innodb_pages_created; /*!< buf_pool->stat.n_pages_created */
ulint innodb_pages_read; /*!< buf_pool->stat.n_pages_read */
ulint innodb_pages_written; /*!< buf_pool->stat.n_pages_written */
+ ib_int64_t innodb_purge_trx_id;
+ ib_int64_t innodb_purge_undo_no;
ulint innodb_row_lock_waits; /*!< srv_n_lock_wait_count */
ulint innodb_row_lock_current_waits; /*!< srv_n_lock_wait_current_count */
ib_int64_t innodb_row_lock_time; /*!< srv_n_lock_wait_time
@@ -704,12 +823,26 @@ struct export_var_struct{
/ srv_n_lock_wait_count */
ulint innodb_row_lock_time_max; /*!< srv_n_lock_max_wait_time
/ 1000 */
+ ulint innodb_current_row_locks;
ulint innodb_rows_read; /*!< srv_n_rows_read */
ulint innodb_rows_inserted; /*!< srv_n_rows_inserted */
ulint innodb_rows_updated; /*!< srv_n_rows_updated */
ulint innodb_rows_deleted; /*!< srv_n_rows_deleted */
+ ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */
+ ib_int64_t innodb_s_lock_os_waits;
+ ib_int64_t innodb_s_lock_spin_rounds;
+ ib_int64_t innodb_s_lock_spin_waits;
+ ib_int64_t innodb_x_lock_os_waits;
+ ib_int64_t innodb_x_lock_spin_rounds;
+ ib_int64_t innodb_x_lock_spin_waits;
};
+/** Thread slot in the thread table */
+typedef struct srv_slot_struct srv_slot_t;
+
+/** Thread table is an array of slots */
+typedef srv_slot_t srv_table_t;
+
/** The server system struct */
struct srv_sys_struct{
srv_table_t* threads; /*!< server thread table */
@@ -719,8 +852,9 @@ struct srv_sys_struct{
extern ulint srv_n_threads_active[];
#else /* !UNIV_HOTBACKUP */
-# define srv_use_checksums TRUE
# define srv_use_adaptive_hash_indexes FALSE
+# define srv_use_checksums TRUE
+# define srv_use_native_aio FALSE
# define srv_force_recovery 0UL
# define srv_set_io_thread_op_info(t,info) ((void) 0)
# define srv_is_being_started 0
diff --git a/storage/xtradb/include/srv0start.h b/storage/xtradb/include/srv0start.h
index 8abf15da9c1..a7214743887 100644
--- a/storage/xtradb/include/srv0start.h
+++ b/storage/xtradb/include/srv0start.h
@@ -91,10 +91,6 @@ extern ib_uint64_t srv_shutdown_lsn;
/** Log sequence number immediately after startup */
extern ib_uint64_t srv_start_lsn;
-#ifdef __NETWARE__
-void set_panic_flag_for_netware(void);
-#endif
-
#ifdef HAVE_DARWIN_THREADS
/** TRUE if the F_FULLFSYNC option is available */
extern ibool srv_have_fullfsync;
@@ -131,4 +127,7 @@ extern enum srv_shutdown_state srv_shutdown_state;
/** Log 'spaces' have id's >= this */
#define SRV_LOG_SPACE_FIRST_ID 0xFFFFFFF0UL
+/** reserved for extra system tables */
+#define SRV_EXTRA_SYS_SPACE_FIRST_ID 0xFFFFFFE0UL
+
#endif
diff --git a/storage/xtradb/include/sync0arr.h b/storage/xtradb/include/sync0arr.h
index 5f1280f5e28..6e931346238 100644
--- a/storage/xtradb/include/sync0arr.h
+++ b/storage/xtradb/include/sync0arr.h
@@ -115,8 +115,11 @@ Prints warnings of long semaphore waits to stderr.
@return TRUE if fatal semaphore wait threshold was exceeded */
UNIV_INTERN
ibool
-sync_array_print_long_waits(void);
-/*=============================*/
+sync_array_print_long_waits(
+/*========================*/
+ os_thread_id_t* waiter, /*!< out: longest waiting thread */
+ const void** sema) /*!< out: longest-waited-for semaphore */
+ __attribute__((nonnull));
/********************************************************************//**
Validates the integrity of the wait array. Checks
that the number of reserved cells equals the count variable. */
diff --git a/storage/xtradb/include/sync0rw.h b/storage/xtradb/include/sync0rw.h
index 4edf93f4042..6420bc5d3bf 100644
--- a/storage/xtradb/include/sync0rw.h
+++ b/storage/xtradb/include/sync0rw.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -105,23 +105,142 @@ extern ib_int64_t rw_x_os_wait_count;
set only when UNIV_SYNC_PERF_STAT is defined */
extern ib_int64_t rw_x_exit_count;
+#ifdef UNIV_PFS_RWLOCK
+/* Following are rwlock keys used to register with MySQL
+performance schema */
+# ifdef UNIV_LOG_ARCHIVE
+extern mysql_pfs_key_t archive_lock_key;
+# endif /* UNIV_LOG_ARCHIVE */
+extern mysql_pfs_key_t btr_search_latch_key;
+extern mysql_pfs_key_t buf_pool_page_hash_key;
+extern mysql_pfs_key_t buf_block_lock_key;
+# ifdef UNIV_SYNC_DEBUG
+extern mysql_pfs_key_t buf_block_debug_latch_key;
+# endif /* UNIV_SYNC_DEBUG */
+extern mysql_pfs_key_t dict_operation_lock_key;
+extern mysql_pfs_key_t fil_space_latch_key;
+extern mysql_pfs_key_t checkpoint_lock_key;
+extern mysql_pfs_key_t trx_i_s_cache_lock_key;
+extern mysql_pfs_key_t trx_purge_latch_key;
+extern mysql_pfs_key_t index_tree_rw_lock_key;
+extern mysql_pfs_key_t dict_table_stats_latch_key;
+#endif /* UNIV_PFS_RWLOCK */
+
+
+#ifndef UNIV_PFS_RWLOCK
/******************************************************************//**
Creates, or rather, initializes an rw-lock object in a specified memory
location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
-is necessary only if the memory block containing it is freed. */
-#ifdef UNIV_DEBUG
+is necessary only if the memory block containing it is freed.
+if MySQL performance schema is enabled and "UNIV_PFS_RWLOCK" is
+defined, the rwlock are instrumented with performance schema probes. */
+# ifdef UNIV_DEBUG
+# ifdef UNIV_SYNC_DEBUG
+# define rw_lock_create(K, L, level) \
+ rw_lock_create_func((L), (level), __FILE__, __LINE__, #L)
+# else /* UNIV_SYNC_DEBUG */
+# define rw_lock_create(K, L, level) \
+ rw_lock_create_func((L), __FILE__, __LINE__, #L)
+# endif/* UNIV_SYNC_DEBUG */
+# else /* UNIV_DEBUG */
+# define rw_lock_create(K, L, level) \
+ rw_lock_create_func((L), #L)
+# endif /* UNIV_DEBUG */
+
+/**************************************************************//**
+NOTE! The following macros should be used in rw locking and
+unlocking, not the corresponding function. */
+
+# define rw_lock_s_lock(M) \
+ rw_lock_s_lock_func((M), 0, __FILE__, __LINE__)
+
+# define rw_lock_s_lock_gen(M, P) \
+ rw_lock_s_lock_func((M), (P), __FILE__, __LINE__)
+
+# define rw_lock_s_lock_nowait(M, F, L) \
+ rw_lock_s_lock_low((M), 0, (F), (L))
+
# ifdef UNIV_SYNC_DEBUG
-# define rw_lock_create(L, level) \
- rw_lock_create_func((L), (level), #L, __FILE__, __LINE__)
-# else /* UNIV_SYNC_DEBUG */
-# define rw_lock_create(L, level) \
- rw_lock_create_func((L), #L, __FILE__, __LINE__)
-# endif /* UNIV_SYNC_DEBUG */
-#else /* UNIV_DEBUG */
-# define rw_lock_create(L, level) \
- rw_lock_create_func((L), #L, NULL, 0)
-#endif /* UNIV_DEBUG */
+# define rw_lock_s_unlock_gen(L, P) rw_lock_s_unlock_func(P, L)
+# else
+# define rw_lock_s_unlock_gen(L, P) rw_lock_s_unlock_func(L)
+# endif
+
+
+# define rw_lock_x_lock(M) \
+ rw_lock_x_lock_func((M), 0, __FILE__, __LINE__)
+
+# define rw_lock_x_lock_gen(M, P) \
+ rw_lock_x_lock_func((M), (P), __FILE__, __LINE__)
+
+# define rw_lock_x_lock_nowait(M) \
+ rw_lock_x_lock_func_nowait((M), __FILE__, __LINE__)
+
+# ifdef UNIV_SYNC_DEBUG
+# define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(P, L)
+# else
+# define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(L)
+# endif
+
+# define rw_lock_free(M) rw_lock_free_func(M)
+
+#else /* !UNIV_PFS_RWLOCK */
+
+/* Following macros point to Performance Schema instrumented functions. */
+# ifdef UNIV_DEBUG
+# ifdef UNIV_SYNC_DEBUG
+# define rw_lock_create(K, L, level) \
+ pfs_rw_lock_create_func((K), (L), (level), __FILE__, __LINE__, #L)
+# else /* UNIV_SYNC_DEBUG */
+# define rw_lock_create(K, L, level) \
+ pfs_rw_lock_create_func((K), (L), __FILE__, __LINE__, #L)
+# endif/* UNIV_SYNC_DEBUG */
+# else /* UNIV_DEBUG */
+# define rw_lock_create(K, L, level) \
+ pfs_rw_lock_create_func((K), (L), #L)
+# endif /* UNIV_DEBUG */
+
+/******************************************************************
+NOTE! The following macros should be used in rw locking and
+unlocking, not the corresponding function. */
+
+# define rw_lock_s_lock(M) \
+ pfs_rw_lock_s_lock_func((M), 0, __FILE__, __LINE__)
+
+# define rw_lock_s_lock_gen(M, P) \
+ pfs_rw_lock_s_lock_func((M), (P), __FILE__, __LINE__)
+
+# define rw_lock_s_lock_nowait(M, F, L) \
+ pfs_rw_lock_s_lock_low((M), 0, (F), (L))
+
+# ifdef UNIV_SYNC_DEBUG
+# define rw_lock_s_unlock_gen(L, P) pfs_rw_lock_s_unlock_func(P, L)
+# else
+# define rw_lock_s_unlock_gen(L, P) pfs_rw_lock_s_unlock_func(L)
+# endif
+
+# define rw_lock_x_lock(M) \
+ pfs_rw_lock_x_lock_func((M), 0, __FILE__, __LINE__)
+
+# define rw_lock_x_lock_gen(M, P) \
+ pfs_rw_lock_x_lock_func((M), (P), __FILE__, __LINE__)
+
+# define rw_lock_x_lock_nowait(M) \
+ pfs_rw_lock_x_lock_func_nowait((M), __FILE__, __LINE__)
+
+# ifdef UNIV_SYNC_DEBUG
+# define rw_lock_x_unlock_gen(L, P) pfs_rw_lock_x_unlock_func(P, L)
+# else
+# define rw_lock_x_unlock_gen(L, P) pfs_rw_lock_x_unlock_func(L)
+# endif
+
+# define rw_lock_free(M) pfs_rw_lock_free_func(M)
+
+#endif /* UNIV_PFS_RWLOCK */
+
+#define rw_lock_s_unlock(L) rw_lock_s_unlock_gen(L, 0)
+#define rw_lock_x_unlock(L) rw_lock_x_unlock_gen(L, 0)
/******************************************************************//**
Creates, or rather, initializes an rw-lock object in a specified memory
@@ -137,18 +256,18 @@ rw_lock_create_func(
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
-#endif /* UNIV_DEBUG */
- const char* cmutex_name, /*!< in: mutex name */
const char* cfile_name, /*!< in: file name where created */
- ulint cline); /*!< in: file line where created */
+ ulint cline, /*!< in: file line where created */
+#endif /* UNIV_DEBUG */
+ const char* cmutex_name); /*!< in: mutex name */
/******************************************************************//**
Calling this function is obligatory only if the memory buffer containing
the rw-lock is freed. Removes an rw-lock object from the global list. The
rw-lock is checked to be in the non-locked state. */
UNIV_INTERN
void
-rw_lock_free(
-/*=========*/
+rw_lock_free_func(
+/*==============*/
rw_lock_t* lock); /*!< in: rw-lock */
#ifdef UNIV_DEBUG
/******************************************************************//**
@@ -161,24 +280,6 @@ rw_lock_validate(
/*=============*/
rw_lock_t* lock); /*!< in: rw-lock */
#endif /* UNIV_DEBUG */
-/**************************************************************//**
-NOTE! The following macros should be used in rw s-locking, not the
-corresponding function. */
-
-#define rw_lock_s_lock(M) rw_lock_s_lock_func(\
- (M), 0, __FILE__, __LINE__)
-/**************************************************************//**
-NOTE! The following macros should be used in rw s-locking, not the
-corresponding function. */
-
-#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(\
- (M), (P), __FILE__, __LINE__)
-/**************************************************************//**
-NOTE! The following macros should be used in rw s-locking, not the
-corresponding function. */
-
-#define rw_lock_s_lock_nowait(M, F, L) rw_lock_s_lock_low(\
- (M), 0, (F), (L))
/******************************************************************//**
Low-level function which tries to lock an rw-lock in s-mode. Performs no
spinning.
@@ -233,33 +334,6 @@ rw_lock_s_unlock_func(
#endif
rw_lock_t* lock); /*!< in/out: rw-lock */
-#ifdef UNIV_SYNC_DEBUG
-# define rw_lock_s_unlock_gen(L, P) rw_lock_s_unlock_func(P, L)
-#else
-# define rw_lock_s_unlock_gen(L, P) rw_lock_s_unlock_func(L)
-#endif
-/*******************************************************************//**
-Releases a shared mode lock. */
-#define rw_lock_s_unlock(L) rw_lock_s_unlock_gen(L, 0)
-
-/**************************************************************//**
-NOTE! The following macro should be used in rw x-locking, not the
-corresponding function. */
-
-#define rw_lock_x_lock(M) rw_lock_x_lock_func(\
- (M), 0, __FILE__, __LINE__)
-/**************************************************************//**
-NOTE! The following macro should be used in rw x-locking, not the
-corresponding function. */
-
-#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(\
- (M), (P), __FILE__, __LINE__)
-/**************************************************************//**
-NOTE! The following macros should be used in rw x-locking, not the
-corresponding function. */
-
-#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(\
- (M), __FILE__, __LINE__)
/******************************************************************//**
NOTE! Use the corresponding macro, not directly this function! Lock an
rw-lock in exclusive mode for the current thread. If the rw-lock is locked
@@ -290,14 +364,6 @@ rw_lock_x_unlock_func(
#endif
rw_lock_t* lock); /*!< in/out: rw-lock */
-#ifdef UNIV_SYNC_DEBUG
-# define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(P, L)
-#else
-# define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(L)
-#endif
-/*******************************************************************//**
-Releases an exclusive mode lock. */
-#define rw_lock_x_unlock(L) rw_lock_x_unlock_gen(L, 0)
/******************************************************************//**
Low-level function which locks an rw-lock in s-mode when we know that it
@@ -490,6 +556,7 @@ UNIV_INTERN
void
rw_lock_debug_print(
/*================*/
+ FILE* f, /*!< in: output stream */
rw_lock_debug_t* info); /*!< in: debug struct */
#endif /* UNIV_SYNC_DEBUG */
@@ -540,6 +607,9 @@ struct rw_lock_struct {
info list of the lock */
ulint level; /*!< Level in the global latching order. */
#endif /* UNIV_SYNC_DEBUG */
+#ifdef UNIV_PFS_RWLOCK
+ struct PSI_rwlock *pfs_psi;/*!< The instrumentation hook */
+#endif
ulint count_os_wait; /*!< Count of os_waits. May not be accurate */
//const char* cfile_name;/*!< File name where lock created */
const char* lock_name;/*!< lock name */
@@ -580,6 +650,160 @@ struct rw_lock_debug_struct {
};
#endif /* UNIV_SYNC_DEBUG */
+/* For performance schema instrumentation, a new set of rwlock
+wrap functions are created if "UNIV_PFS_RWLOCK" is defined.
+The instrumentations are not planted directly into original
+functions, so that we keep the underlying function as they
+are. And in case, user wants to "take out" some rwlock from
+instrumentation even if performance schema (UNIV_PFS_RWLOCK)
+is defined, they can do so by reinstating APIs directly link to
+original underlying functions.
+The instrumented function names have prefix of "pfs_rw_lock_" vs.
+original name prefix of "rw_lock_". Following are list of functions
+that have been instrumented:
+
+rw_lock_create()
+rw_lock_x_lock()
+rw_lock_x_lock_gen()
+rw_lock_x_lock_nowait()
+rw_lock_x_unlock_gen()
+rw_lock_s_lock()
+rw_lock_s_lock_gen()
+rw_lock_s_lock_nowait()
+rw_lock_s_unlock_gen()
+rw_lock_free()
+
+Two function APIs rw_lock_x_unlock_direct() and rw_lock_s_unlock_direct()
+do not have any caller/user, they are not instrumented.
+*/
+
+#ifdef UNIV_PFS_RWLOCK
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_create_func()
+NOTE! Please use the corresponding macro rw_lock_create(), not
+directly this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_create_func(
+/*====================*/
+ PSI_rwlock_key key, /*!< in: key registered with
+ performance schema */
+ rw_lock_t* lock, /*!< in: rw lock */
+#ifdef UNIV_DEBUG
+# ifdef UNIV_SYNC_DEBUG
+ ulint level, /*!< in: level */
+# endif /* UNIV_SYNC_DEBUG */
+ const char* cfile_name, /*!< in: file name where created */
+ ulint cline, /*!< in: file line where created */
+#endif /* UNIV_DEBUG */
+ const char* cmutex_name); /*!< in: mutex name */
+
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_x_lock_func()
+NOTE! Please use the corresponding macro rw_lock_x_lock(), not
+directly this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_x_lock_func(
+/*====================*/
+ rw_lock_t* lock, /*!< in: pointer to rw-lock */
+ ulint pass, /*!< in: pass value; != 0, if the lock will
+ be passed to another thread to unlock */
+ const char* file_name,/*!< in: file name where lock requested */
+ ulint line); /*!< in: line where requested */
+/******************************************************************//**
+Performance schema instrumented wrap function for
+rw_lock_x_lock_func_nowait()
+NOTE! Please use the corresponding macro, not directly this function!
+@return TRUE if success */
+UNIV_INLINE
+ibool
+pfs_rw_lock_x_lock_func_nowait(
+/*===========================*/
+ rw_lock_t* lock, /*!< in: pointer to rw-lock */
+ const char* file_name,/*!< in: file name where lock requested */
+ ulint line); /*!< in: line where requested */
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_s_lock_func()
+NOTE! Please use the corresponding macro rw_lock_s_lock(), not directly
+this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_s_lock_func(
+/*====================*/
+ rw_lock_t* lock, /*!< in: pointer to rw-lock */
+ ulint pass, /*!< in: pass value; != 0, if the lock will
+ be passed to another thread to unlock */
+ const char* file_name,/*!< in: file name where lock requested */
+ ulint line); /*!< in: line where requested */
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_s_lock_func()
+NOTE! Please use the corresponding macro rw_lock_s_lock(), not directly
+this function!
+@return TRUE if success */
+UNIV_INLINE
+ibool
+pfs_rw_lock_s_lock_low(
+/*===================*/
+ rw_lock_t* lock, /*!< in: pointer to rw-lock */
+ ulint pass, /*!< in: pass value; != 0, if the
+ lock will be passed to another
+ thread to unlock */
+ const char* file_name, /*!< in: file name where lock requested */
+ ulint line); /*!< in: line where requested */
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_x_lock_func()
+NOTE! Please use the corresponding macro rw_lock_x_lock(), not directly
+this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_x_lock_func(
+/*====================*/
+ rw_lock_t* lock, /*!< in: pointer to rw-lock */
+ ulint pass, /*!< in: pass value; != 0, if the lock will
+ be passed to another thread to unlock */
+ const char* file_name,/*!< in: file name where lock requested */
+ ulint line); /*!< in: line where requested */
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_s_unlock_func()
+NOTE! Please use the corresponding macro rw_lock_s_unlock(), not directly
+this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_s_unlock_func(
+/*======================*/
+#ifdef UNIV_SYNC_DEBUG
+ ulint pass, /*!< in: pass value; != 0, if the
+ lock may have been passed to another
+ thread to unlock */
+#endif
+ rw_lock_t* lock); /*!< in/out: rw-lock */
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_s_unlock_func()
+NOTE! Please use the corresponding macro rw_lock_x_unlock(), not directly
+this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_x_unlock_func(
+/*======================*/
+#ifdef UNIV_SYNC_DEBUG
+ ulint pass, /*!< in: pass value; != 0, if the
+ lock may have been passed to another
+ thread to unlock */
+#endif
+ rw_lock_t* lock); /*!< in/out: rw-lock */
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_free_func()
+NOTE! Please use the corresponding macro rw_lock_free(), not directly
+this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_free_func(
+/*==================*/
+ rw_lock_t* lock); /*!< in: rw-lock */
+#endif /* UNIV_PFS_RWLOCK */
+
+
#ifndef UNIV_NONINL
#include "sync0rw.ic"
#endif
diff --git a/storage/xtradb/include/sync0rw.ic b/storage/xtradb/include/sync0rw.ic
index 7116f1b7c9b..a6dfa603c59 100644
--- a/storage/xtradb/include/sync0rw.ic
+++ b/storage/xtradb/include/sync0rw.ic
@@ -622,3 +622,260 @@ rw_lock_x_unlock_direct(
rw_x_exit_count++;
#endif
}
+
+#ifdef UNIV_PFS_RWLOCK
+
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_create_func().
+NOTE! Please use the corresponding macro rw_lock_create(), not directly
+this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_create_func(
+/*====================*/
+ mysql_pfs_key_t key, /*!< in: key registered with
+ performance schema */
+ rw_lock_t* lock, /*!< in: pointer to memory */
+# ifdef UNIV_DEBUG
+# ifdef UNIV_SYNC_DEBUG
+ ulint level, /*!< in: level */
+# endif /* UNIV_SYNC_DEBUG */
+ const char* cfile_name, /*!< in: file name where created */
+ ulint cline, /*!< in: file line where created */
+# endif /* UNIV_DEBUG */
+ const char* cmutex_name) /*!< in: mutex name */
+{
+ /* Initialize the rwlock for performance schema */
+ lock->pfs_psi = (PSI_server && PFS_IS_INSTRUMENTED(key))
+ ? PSI_server->init_rwlock(key, lock)
+ : NULL;
+
+ /* The actual function to initialize an rwlock */
+ rw_lock_create_func(lock,
+# ifdef UNIV_DEBUG
+# ifdef UNIV_SYNC_DEBUG
+ level,
+# endif /* UNIV_SYNC_DEBUG */
+ cfile_name,
+ cline,
+# endif /* UNIV_DEBUG */
+ cmutex_name);
+}
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_x_lock_func()
+NOTE! Please use the corresponding macro rw_lock_x_lock(), not directly
+this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_x_lock_func(
+/*====================*/
+ rw_lock_t* lock, /*!< in: pointer to rw-lock */
+ ulint pass, /*!< in: pass value; != 0, if the lock will
+ be passed to another thread to unlock */
+ const char* file_name,/*!< in: file name where lock requested */
+ ulint line) /*!< in: line where requested */
+{
+ struct PSI_rwlock_locker* locker = NULL;
+ PSI_rwlock_locker_state state;
+
+ /* Record the entry of rw x lock request in performance schema */
+ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
+ locker = PSI_server->get_thread_rwlock_locker(
+ &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
+
+ if (locker) {
+ PSI_server->start_rwlock_wrwait(locker,
+ file_name, line);
+ }
+ }
+
+ rw_lock_x_lock_func(lock, pass, file_name, line);
+
+ if (locker) {
+ PSI_server->end_rwlock_wrwait(locker, 0);
+ }
+}
+/******************************************************************//**
+Performance schema instrumented wrap function for
+rw_lock_x_lock_func_nowait()
+NOTE! Please use the corresponding macro rw_lock_x_lock_func(),
+not directly this function!
+@return TRUE if success */
+UNIV_INLINE
+ibool
+pfs_rw_lock_x_lock_func_nowait(
+/*===========================*/
+ rw_lock_t* lock, /*!< in: pointer to rw-lock */
+ const char* file_name,/*!< in: file name where lock
+ requested */
+ ulint line) /*!< in: line where requested */
+{
+ struct PSI_rwlock_locker* locker = NULL;
+ PSI_rwlock_locker_state state;
+ ibool ret;
+
+ /* Record the entry of rw x lock request in performance schema */
+ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
+ locker = PSI_server->get_thread_rwlock_locker(
+ &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
+
+ if (locker) {
+ PSI_server->start_rwlock_wrwait(locker,
+ file_name, line);
+ }
+ }
+
+ ret = rw_lock_x_lock_func_nowait(lock, file_name, line);
+
+ if (locker) {
+ PSI_server->end_rwlock_wrwait(locker, 0);
+ }
+
+ return(ret);
+}
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_free_func()
+NOTE! Please use the corresponding macro rw_lock_free(), not directly
+this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_free_func(
+/*==================*/
+ rw_lock_t* lock) /*!< in: pointer to rw-lock */
+{
+ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
+ PSI_server->destroy_rwlock(lock->pfs_psi);
+ lock->pfs_psi = NULL;
+ }
+
+ rw_lock_free_func(lock);
+}
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_s_lock_func()
+NOTE! Please use the corresponding macro rw_lock_s_lock(), not
+directly this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_s_lock_func(
+/*====================*/
+ rw_lock_t* lock, /*!< in: pointer to rw-lock */
+ ulint pass, /*!< in: pass value; != 0, if the
+ lock will be passed to another
+ thread to unlock */
+ const char* file_name,/*!< in: file name where lock
+ requested */
+ ulint line) /*!< in: line where requested */
+{
+ struct PSI_rwlock_locker* locker = NULL;
+ PSI_rwlock_locker_state state;
+
+ /* Instrumented to inform we are aquiring a shared rwlock */
+ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
+ locker = PSI_server->get_thread_rwlock_locker(
+ &state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
+ if (locker) {
+ PSI_server->start_rwlock_rdwait(locker,
+ file_name, line);
+ }
+ }
+
+ rw_lock_s_lock_func(lock, pass, file_name, line);
+
+ if (locker) {
+ PSI_server->end_rwlock_rdwait(locker, 0);
+ }
+}
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_s_lock_func()
+NOTE! Please use the corresponding macro rw_lock_s_lock(), not
+directly this function!
+@return TRUE if success */
+UNIV_INLINE
+ibool
+pfs_rw_lock_s_lock_low(
+/*===================*/
+ rw_lock_t* lock, /*!< in: pointer to rw-lock */
+ ulint pass, /*!< in: pass value; != 0, if the
+ lock will be passed to another
+ thread to unlock */
+ const char* file_name, /*!< in: file name where lock requested */
+ ulint line) /*!< in: line where requested */
+{
+ struct PSI_rwlock_locker* locker = NULL;
+ PSI_rwlock_locker_state state;
+ ibool ret;
+
+ /* Instrumented to inform we are aquiring a shared rwlock */
+ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
+ locker = PSI_server->get_thread_rwlock_locker(
+ &state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
+ if (locker) {
+ PSI_server->start_rwlock_rdwait(locker,
+ file_name, line);
+ }
+ }
+
+ ret = rw_lock_s_lock_low(lock, pass, file_name, line);
+
+ if (locker) {
+ PSI_server->end_rwlock_rdwait(locker, 0);
+ }
+
+ return(ret);
+}
+
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_x_unlock_func()
+NOTE! Please use the corresponding macro rw_lock_x_unlock(), not directly
+this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_x_unlock_func(
+/*======================*/
+#ifdef UNIV_SYNC_DEBUG
+ ulint pass, /*!< in: pass value; != 0, if the
+ lock may have been passed to another
+ thread to unlock */
+#endif
+ rw_lock_t* lock) /*!< in/out: rw-lock */
+{
+ /* Inform performance schema we are unlocking the lock */
+ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
+ PSI_server->unlock_rwlock(lock->pfs_psi);
+ }
+
+ rw_lock_x_unlock_func(
+#ifdef UNIV_SYNC_DEBUG
+ pass,
+#endif
+ lock);
+}
+
+/******************************************************************//**
+Performance schema instrumented wrap function for rw_lock_s_unlock_func()
+NOTE! Please use the corresponding macro pfs_rw_lock_s_unlock(), not
+directly this function! */
+UNIV_INLINE
+void
+pfs_rw_lock_s_unlock_func(
+/*======================*/
+#ifdef UNIV_SYNC_DEBUG
+ ulint pass, /*!< in: pass value; != 0, if the
+ lock may have been passed to another
+ thread to unlock */
+#endif
+ rw_lock_t* lock) /*!< in/out: rw-lock */
+{
+ /* Inform performance schema we are unlocking the lock */
+ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
+ PSI_server->unlock_rwlock(lock->pfs_psi);
+ }
+
+ rw_lock_s_unlock_func(
+#ifdef UNIV_SYNC_DEBUG
+ pass,
+#endif
+ lock);
+
+}
+#endif /* UNIV_PFS_RWLOCK */
diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h
index a500cf1da45..32a20807ba0 100644
--- a/storage/xtradb/include/sync0sync.h
+++ b/storage/xtradb/include/sync0sync.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2011, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -52,6 +52,71 @@ typedef LONG lock_word_t; /*!< On Windows, InterlockedExchange operates
typedef byte lock_word_t;
#endif
+#if defined UNIV_PFS_MUTEX || defined UNIV_PFS_RWLOCK
+/* There are mutexes/rwlocks that we want to exclude from
+instrumentation even if their corresponding performance schema
+define is set. And this PFS_NOT_INSTRUMENTED is used
+as the key value to dentify those objects that would
+be excluded from instrumentation. */
+# define PFS_NOT_INSTRUMENTED ULINT32_UNDEFINED
+
+# define PFS_IS_INSTRUMENTED(key) ((key) != PFS_NOT_INSTRUMENTED)
+
+/* By default, buffer mutexes and rwlocks will be excluded from
+instrumentation due to their large number of instances. */
+# define PFS_SKIP_BUFFER_MUTEX_RWLOCK
+
+#endif /* UNIV_PFS_MUTEX || UNIV_PFS_RWLOCK */
+
+#ifdef UNIV_PFS_MUTEX
+/* Key defines to register InnoDB mutexes with performance schema */
+extern mysql_pfs_key_t autoinc_mutex_key;
+extern mysql_pfs_key_t btr_search_enabled_mutex_key;
+extern mysql_pfs_key_t buffer_block_mutex_key;
+extern mysql_pfs_key_t buf_pool_mutex_key;
+extern mysql_pfs_key_t buf_pool_zip_mutex_key;
+extern mysql_pfs_key_t buf_pool_LRU_list_mutex_key;
+extern mysql_pfs_key_t buf_pool_free_list_mutex_key;
+extern mysql_pfs_key_t buf_pool_zip_free_mutex_key;
+extern mysql_pfs_key_t buf_pool_zip_hash_mutex_key;
+extern mysql_pfs_key_t cache_last_read_mutex_key;
+extern mysql_pfs_key_t dict_foreign_err_mutex_key;
+extern mysql_pfs_key_t dict_sys_mutex_key;
+extern mysql_pfs_key_t file_format_max_mutex_key;
+extern mysql_pfs_key_t fil_system_mutex_key;
+extern mysql_pfs_key_t flush_list_mutex_key;
+extern mysql_pfs_key_t hash_table_mutex_key;
+extern mysql_pfs_key_t ibuf_bitmap_mutex_key;
+extern mysql_pfs_key_t ibuf_mutex_key;
+extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key;
+extern mysql_pfs_key_t log_sys_mutex_key;
+extern mysql_pfs_key_t log_flush_order_mutex_key;
+extern mysql_pfs_key_t kernel_mutex_key;
+# ifdef UNIV_MEM_DEBUG
+extern mysql_pfs_key_t mem_hash_mutex_key;
+# endif /* UNIV_MEM_DEBUG */
+extern mysql_pfs_key_t mem_pool_mutex_key;
+extern mysql_pfs_key_t mutex_list_mutex_key;
+extern mysql_pfs_key_t purge_sys_bh_mutex_key;
+extern mysql_pfs_key_t recv_sys_mutex_key;
+extern mysql_pfs_key_t rseg_mutex_key;
+# ifdef UNIV_SYNC_DEBUG
+extern mysql_pfs_key_t rw_lock_debug_mutex_key;
+# endif /* UNIV_SYNC_DEBUG */
+extern mysql_pfs_key_t rw_lock_list_mutex_key;
+extern mysql_pfs_key_t rw_lock_mutex_key;
+extern mysql_pfs_key_t srv_dict_tmpfile_mutex_key;
+extern mysql_pfs_key_t srv_innodb_monitor_mutex_key;
+extern mysql_pfs_key_t srv_misc_tmpfile_mutex_key;
+extern mysql_pfs_key_t srv_monitor_file_mutex_key;
+extern mysql_pfs_key_t syn_arr_mutex_key;
+# ifdef UNIV_SYNC_DEBUG
+extern mysql_pfs_key_t sync_thread_mutex_key;
+# endif /* UNIV_SYNC_DEBUG */
+extern mysql_pfs_key_t trx_doublewrite_mutex_key;
+extern mysql_pfs_key_t trx_undo_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
/******************************************************************//**
Initializes the synchronization data structures. */
UNIV_INTERN
@@ -64,24 +129,82 @@ UNIV_INTERN
void
sync_close(void);
/*===========*/
+
+#undef mutex_free /* Fix for MacOS X */
+
+#ifdef UNIV_PFS_MUTEX
+/**********************************************************************
+Following mutex APIs would be performance schema instrumented
+if "UNIV_PFS_MUTEX" is defined:
+
+mutex_create
+mutex_enter
+mutex_exit
+mutex_enter_nowait
+mutex_free
+
+These mutex APIs will point to corresponding wrapper functions that contain
+the performance schema instrumentation if "UNIV_PFS_MUTEX" is defined.
+The instrumented wrapper functions have the prefix of "innodb_".
+
+NOTE! The following macro should be used in mutex operation, not the
+corresponding function. */
+
/******************************************************************//**
Creates, or rather, initializes a mutex object to a specified memory
location (which must be appropriately aligned). The mutex is initialized
in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */
-
-#ifdef UNIV_DEBUG
-# ifdef UNIV_SYNC_DEBUG
-# define mutex_create(M, level) \
- mutex_create_func((M), #M, (level), __FILE__, __LINE__)
+# ifdef UNIV_DEBUG
+# ifdef UNIV_SYNC_DEBUG
+# define mutex_create(K, M, level) \
+ pfs_mutex_create_func((K), (M), (level), __FILE__, __LINE__, #M)
+# else
+# define mutex_create(K, M, level) \
+ pfs_mutex_create_func((K), (M), __FILE__, __LINE__, #M)
+# endif/* UNIV_SYNC_DEBUG */
# else
-# define mutex_create(M, level) \
- mutex_create_func((M), #M, __FILE__, __LINE__)
-# endif
-#else
-# define mutex_create(M, level) \
- mutex_create_func((M), #M, NULL, 0)
-#endif
+# define mutex_create(K, M, level) \
+ pfs_mutex_create_func((K), (M), #M)
+# endif /* UNIV_DEBUG */
+
+# define mutex_enter(M) \
+ pfs_mutex_enter_func((M), __FILE__, __LINE__)
+
+# define mutex_enter_nowait(M) \
+ pfs_mutex_enter_nowait_func((M), __FILE__, __LINE__)
+
+# define mutex_exit(M) pfs_mutex_exit_func(M)
+
+# define mutex_free(M) pfs_mutex_free_func(M)
+
+#else /* UNIV_PFS_MUTEX */
+
+/* If "UNIV_PFS_MUTEX" is not defined, the mutex APIs point to
+original non-instrumented functions */
+# ifdef UNIV_DEBUG
+# ifdef UNIV_SYNC_DEBUG
+# define mutex_create(K, M, level) \
+ mutex_create_func((M), (level), __FILE__, __LINE__, #M)
+# else /* UNIV_SYNC_DEBUG */
+# define mutex_create(K, M, level) \
+ mutex_create_func((M), __FILE__, __LINE__, #M)
+# endif /* UNIV_SYNC_DEBUG */
+# else /* UNIV_DEBUG */
+# define mutex_create(K, M, level) \
+ mutex_create_func((M), #M)
+# endif /* UNIV_DEBUG */
+
+# define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
+
+# define mutex_enter_nowait(M) \
+ mutex_enter_nowait_func((M), __FILE__, __LINE__)
+
+# define mutex_exit(M) mutex_exit_func(M)
+
+# define mutex_free(M) mutex_free_func(M)
+
+#endif /* UNIV_PFS_MUTEX */
/******************************************************************//**
Creates, or rather, initializes a mutex object in a specified memory
@@ -93,35 +216,29 @@ void
mutex_create_func(
/*==============*/
mutex_t* mutex, /*!< in: pointer to memory */
- const char* cmutex_name, /*!< in: mutex name */
#ifdef UNIV_DEBUG
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
-#endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
- ulint cline); /*!< in: file line where created */
-
-#undef mutex_free /* Fix for MacOS X */
+ ulint cline, /*!< in: file line where created */
+#endif /* UNIV_DEBUG */
+ const char* cmutex_name); /*!< in: mutex name */
/******************************************************************//**
+NOTE! Use the corresponding macro mutex_free(), not directly this function!
Calling this function is obligatory only if the memory buffer containing
the mutex is freed. Removes a mutex object from the mutex list. The mutex
is checked to be in the reset state. */
UNIV_INTERN
void
-mutex_free(
-/*=======*/
+mutex_free_func(
+/*============*/
mutex_t* mutex); /*!< in: mutex */
/**************************************************************//**
NOTE! The following macro should be used in mutex locking, not the
corresponding function. */
-#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
-/**************************************************************//**
-NOTE! The following macro should be used in mutex locking, not the
-corresponding function. */
-
/* NOTE! currently same as mutex_enter! */
#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__)
@@ -137,12 +254,6 @@ mutex_enter_func(
mutex_t* mutex, /*!< in: pointer to mutex */
const char* file_name, /*!< in: file name where locked */
ulint line); /*!< in: line where locked */
-/**************************************************************//**
-NOTE! The following macro should be used in mutex locking, not the
-corresponding function. */
-
-#define mutex_enter_nowait(M) \
- mutex_enter_nowait_func((M), __FILE__, __LINE__)
/********************************************************************//**
NOTE! Use the corresponding macro in the header file, not this function
directly. Tries to lock the mutex for the current thread. If the lock is not
@@ -157,12 +268,86 @@ mutex_enter_nowait_func(
requested */
ulint line); /*!< in: line where requested */
/******************************************************************//**
+NOTE! Use the corresponding macro mutex_exit(), not directly this function!
Unlocks a mutex owned by the current thread. */
UNIV_INLINE
void
-mutex_exit(
-/*=======*/
+mutex_exit_func(
+/*============*/
+ mutex_t* mutex); /*!< in: pointer to mutex */
+
+
+#ifdef UNIV_PFS_MUTEX
+/******************************************************************//**
+NOTE! Please use the corresponding macro mutex_create(), not directly
+this function!
+A wrapper function for mutex_create_func(), registers the mutex
+with peformance schema if "UNIV_PFS_MUTEX" is defined when
+creating the mutex */
+UNIV_INLINE
+void
+pfs_mutex_create_func(
+/*==================*/
+ PSI_mutex_key key, /*!< in: Performance Schema key */
+ mutex_t* mutex, /*!< in: pointer to memory */
+# ifdef UNIV_DEBUG
+# ifdef UNIV_SYNC_DEBUG
+ ulint level, /*!< in: level */
+# endif /* UNIV_SYNC_DEBUG */
+ const char* cfile_name, /*!< in: file name where created */
+ ulint cline, /*!< in: file line where created */
+# endif /* UNIV_DEBUG */
+ const char* cmutex_name);
+/******************************************************************//**
+NOTE! Please use the corresponding macro mutex_enter(), not directly
+this function!
+This is a performance schema instrumented wrapper function for
+mutex_enter_func(). */
+UNIV_INLINE
+void
+pfs_mutex_enter_func(
+/*=================*/
+ mutex_t* mutex, /*!< in: pointer to mutex */
+ const char* file_name, /*!< in: file name where locked */
+ ulint line); /*!< in: line where locked */
+/********************************************************************//**
+NOTE! Please use the corresponding macro mutex_enter_nowait(), not directly
+this function!
+This is a performance schema instrumented wrapper function for
+mutex_enter_nowait_func.
+@return 0 if succeed, 1 if not */
+UNIV_INLINE
+ulint
+pfs_mutex_enter_nowait_func(
+/*========================*/
+ mutex_t* mutex, /*!< in: pointer to mutex */
+ const char* file_name, /*!< in: file name where mutex
+ requested */
+ ulint line); /*!< in: line where requested */
+/******************************************************************//**
+NOTE! Please use the corresponding macro mutex_exit(), not directly
+this function!
+A wrap function of mutex_exit_func() with peformance schema instrumentation.
+Unlocks a mutex owned by the current thread. */
+UNIV_INLINE
+void
+pfs_mutex_exit_func(
+/*================*/
mutex_t* mutex); /*!< in: pointer to mutex */
+
+/******************************************************************//**
+NOTE! Please use the corresponding macro mutex_free(), not directly
+this function!
+Wrapper function for mutex_free_func(). Also destroys the performance
+schema probes when freeing the mutex */
+UNIV_INLINE
+void
+pfs_mutex_free_func(
+/*================*/
+ mutex_t* mutex); /*!< in: mutex */
+
+#endif /* UNIV_PFS_MUTEX */
+
#ifdef UNIV_SYNC_DEBUG
/******************************************************************//**
Returns TRUE if no mutex or rw-lock is currently locked.
@@ -232,13 +417,6 @@ sync_thread_reset_level(
/*====================*/
void* latch); /*!< in: pointer to a mutex or an rw-lock */
/******************************************************************//**
-Checks that the level array for the current thread is empty.
-@return TRUE if empty */
-UNIV_INTERN
-ibool
-sync_thread_levels_empty(void);
-/*==========================*/
-/******************************************************************//**
Checks if the level array for the current thread contains a
mutex or rw-latch at the specified level.
@return a matching latch, or NULL if not found */
@@ -249,17 +427,33 @@ sync_thread_levels_contains(
ulint level); /*!< in: latching order level
(SYNC_DICT, ...)*/
/******************************************************************//**
-Checks if the level array for the current thread is empty.
+Checks that the level array for the current thread is empty.
@return a latch, or NULL if empty except the exceptions specified below */
UNIV_INTERN
void*
sync_thread_levels_nonempty_gen(
/*============================*/
- ibool dict_mutex_allowed); /*!< in: TRUE if dictionary mutex is
- allowed to be owned by the thread,
- also purge_is_running mutex is
- allowed */
-#define sync_thread_levels_empty_gen(d) (!sync_thread_levels_nonempty_gen(d))
+ ibool dict_mutex_allowed) /*!< in: TRUE if dictionary mutex is
+ allowed to be owned by the thread */
+ __attribute__((warn_unused_result));
+/******************************************************************//**
+Checks if the level array for the current thread is empty,
+except for data dictionary latches. */
+#define sync_thread_levels_empty_except_dict() \
+ (!sync_thread_levels_nonempty_gen(TRUE))
+/******************************************************************//**
+Checks if the level array for the current thread is empty,
+except for the btr_search_latch.
+@return a latch, or NULL if empty except the exceptions specified below */
+UNIV_INTERN
+void*
+sync_thread_levels_nonempty_trx(
+/*============================*/
+ ibool has_search_latch)
+ /*!< in: TRUE if and only if the thread
+ is supposed to hold btr_search_latch */
+ __attribute__((warn_unused_result));
+
/******************************************************************//**
Gets the debug information for a reserved mutex. */
UNIV_INTERN
@@ -455,7 +649,6 @@ or row lock! */
#define SYNC_TREE_NODE_NEW 892
#define SYNC_TREE_NODE_FROM_HASH 891
#define SYNC_TREE_NODE 890
-#define SYNC_PURGE_SYS 810
#define SYNC_PURGE_LATCH 800
#define SYNC_TRX_UNDO 700
#define SYNC_RSEG 600
@@ -477,7 +670,9 @@ or row lock! */
#define SYNC_REC_LOCK 299
#define SYNC_TRX_LOCK_HEAP 298
#define SYNC_TRX_SYS_HEADER 290
+#define SYNC_PURGE_QUEUE 200
#define SYNC_LOG 170
+#define SYNC_LOG_FLUSH_ORDER 156
#define SYNC_RECV 168
#define SYNC_WORK_QUEUE 162
#define SYNC_SEARCH_SYS_CONF 161 /* for assigning btr_search_enabled */
@@ -487,15 +682,16 @@ or row lock! */
SYNC_SEARCH_SYS, as memory allocation
can call routines there! Otherwise
the level is SYNC_MEM_HASH. */
-#define SYNC_BUF_LRU_LIST 157
-#define SYNC_BUF_PAGE_HASH 156
-#define SYNC_BUF_BLOCK 155
-#define SYNC_BUF_FREE_LIST 153
-#define SYNC_BUF_ZIP_FREE 152
-#define SYNC_BUF_ZIP_HASH 151
-#define SYNC_BUF_POOL 150
-#define SYNC_BUF_FLUSH_LIST 149
+#define SYNC_BUF_LRU_LIST 158
+#define SYNC_BUF_PAGE_HASH 157
+#define SYNC_BUF_BLOCK 155 /* Block mutex */
+#define SYNC_BUF_FREE_LIST 153
+#define SYNC_BUF_ZIP_FREE 152
+#define SYNC_BUF_ZIP_HASH 151
+#define SYNC_BUF_POOL 150 /* Buffer pool mutex */
+#define SYNC_BUF_FLUSH_LIST 145 /* Buffer flush list mutex */
#define SYNC_DOUBLEWRITE 140
+#define SYNC_OUTER_ANY_LATCH 136
#define SYNC_ANY_LATCH 135
#define SYNC_THR_LOCAL 133
#define SYNC_MEM_HASH 131
@@ -556,6 +752,10 @@ struct mutex_struct {
ulint mutex_type; /*!< 0=usual mutex, 1=rw_lock mutex */
#endif /* UNIV_DEBUG */
const char* cmutex_name; /*!< mutex name */
+#ifdef UNIV_PFS_MUTEX
+ struct PSI_mutex* pfs_psi; /*!< The performance schema
+ instrumentation hook */
+#endif
};
/** The global array of wait cells for implementation of the databases own
@@ -569,6 +769,10 @@ to 20 microseconds. */
#define SYNC_SPIN_ROUNDS srv_n_spin_wait_rounds
+extern ib_int64_t mutex_spin_round_count;
+extern ib_int64_t mutex_spin_wait_count;
+extern ib_int64_t mutex_os_wait_count;
+
/** The number of mutex_exit calls. Intended for performance monitoring. */
extern ib_int64_t mutex_exit_count;
diff --git a/storage/xtradb/include/sync0sync.ic b/storage/xtradb/include/sync0sync.ic
index b05020b5660..1d9c8d59b12 100644
--- a/storage/xtradb/include/sync0sync.ic
+++ b/storage/xtradb/include/sync0sync.ic
@@ -152,11 +152,12 @@ mutex_get_waiters(
}
/******************************************************************//**
+NOTE! Use the corresponding macro mutex_exit(), not directly this function!
Unlocks a mutex owned by the current thread. */
UNIV_INLINE
void
-mutex_exit(
-/*=======*/
+mutex_exit_func(
+/*============*/
mutex_t* mutex) /*!< in: pointer to mutex */
{
ut_ad(mutex_own(mutex));
@@ -220,3 +221,145 @@ mutex_enter_func(
mutex_spin_wait(mutex, file_name, line);
}
+
+#ifdef UNIV_PFS_MUTEX
+/******************************************************************//**
+NOTE! Please use the corresponding macro mutex_enter(), not directly
+this function!
+This is a performance schema instrumented wrapper function for
+mutex_enter_func(). */
+UNIV_INLINE
+void
+pfs_mutex_enter_func(
+/*=================*/
+ mutex_t* mutex, /*!< in: pointer to mutex */
+ const char* file_name, /*!< in: file name where locked */
+ ulint line) /*!< in: line where locked */
+{
+ struct PSI_mutex_locker* locker = NULL;
+ PSI_mutex_locker_state state;
+ int result = 0;
+
+ if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
+ locker = PSI_server->get_thread_mutex_locker(
+ &state, mutex->pfs_psi, PSI_MUTEX_LOCK);
+ if (locker) {
+ PSI_server->start_mutex_wait(locker, file_name, line);
+ }
+ }
+
+ mutex_enter_func(mutex, file_name, line);
+
+ if (locker) {
+ PSI_server->end_mutex_wait(locker, result);
+ }
+}
+/********************************************************************//**
+NOTE! Please use the corresponding macro mutex_enter_nowait(), not directly
+this function!
+This is a performance schema instrumented wrapper function for
+mutex_enter_nowait_func.
+@return 0 if succeed, 1 if not */
+UNIV_INLINE
+ulint
+pfs_mutex_enter_nowait_func(
+/*========================*/
+ mutex_t* mutex, /*!< in: pointer to mutex */
+ const char* file_name, /*!< in: file name where mutex
+ requested */
+ ulint line) /*!< in: line where requested */
+{
+ ulint ret;
+ struct PSI_mutex_locker* locker = NULL;
+ PSI_mutex_locker_state state;
+ int result = 0;
+
+ if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
+ locker = PSI_server->get_thread_mutex_locker(
+ &state, mutex->pfs_psi, PSI_MUTEX_LOCK);
+ if (locker) {
+ PSI_server->start_mutex_wait(locker, file_name, line);
+ }
+ }
+
+ ret = mutex_enter_nowait_func(mutex, file_name, line);
+
+ if (locker) {
+ PSI_server->end_mutex_wait(locker, result);
+ }
+
+ return(ret);
+}
+/******************************************************************//**
+NOTE! Please use the corresponding macro mutex_exit(), not directly
+this function!
+A wrap function of mutex_exit_func() with performance schema instrumentation.
+Unlocks a mutex owned by the current thread. */
+UNIV_INLINE
+void
+pfs_mutex_exit_func(
+/*================*/
+ mutex_t* mutex) /*!< in: pointer to mutex */
+{
+ if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
+ PSI_server->unlock_mutex(mutex->pfs_psi);
+ }
+
+ mutex_exit_func(mutex);
+}
+
+/******************************************************************//**
+NOTE! Please use the corresponding macro mutex_create(), not directly
+this function!
+A wrapper function for mutex_create_func(), registers the mutex
+with performance schema if "UNIV_PFS_MUTEX" is defined when
+creating the mutex */
+UNIV_INLINE
+void
+pfs_mutex_create_func(
+/*==================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema key */
+ mutex_t* mutex, /*!< in: pointer to memory */
+# ifdef UNIV_DEBUG
+# ifdef UNIV_SYNC_DEBUG
+ ulint level, /*!< in: level */
+# endif /* UNIV_SYNC_DEBUG */
+ const char* cfile_name, /*!< in: file name where created */
+ ulint cline, /*!< in: file line where created */
+# endif /* UNIV_DEBUG */
+ const char* cmutex_name) /*!< in: mutex name */
+{
+ mutex->pfs_psi = (PSI_server && PFS_IS_INSTRUMENTED(key))
+ ? PSI_server->init_mutex(key, mutex)
+ : NULL;
+
+ mutex_create_func(mutex,
+# ifdef UNIV_DEBUG
+# ifdef UNIV_SYNC_DEBUG
+ level,
+# endif /* UNIV_SYNC_DEBUG */
+ cfile_name,
+ cline,
+# endif /* UNIV_DEBUG */
+ cmutex_name);
+}
+/******************************************************************//**
+NOTE! Please use the corresponding macro mutex_free(), not directly
+this function!
+Wrapper function for mutex_free_func(). Also destroys the performance
+schema probes when freeing the mutex */
+UNIV_INLINE
+void
+pfs_mutex_free_func(
+/*================*/
+ mutex_t* mutex) /*!< in: mutex */
+{
+ if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
+ PSI_server->destroy_mutex(mutex->pfs_psi);
+ mutex->pfs_psi = NULL;
+ }
+
+ mutex_free_func(mutex);
+}
+
+#endif /* UNIV_PFS_MUTEX */
diff --git a/storage/xtradb/include/thr0loc.h b/storage/xtradb/include/thr0loc.h
deleted file mode 100644
index 293d1ebd57f..00000000000
--- a/storage/xtradb/include/thr0loc.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. 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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file include/thr0loc.h
-The thread local storage
-
-Created 10/5/1995 Heikki Tuuri
-*******************************************************/
-
-/* This module implements storage private to each thread,
-a capability useful in some situations like storing the
-OS handle to the current thread, or its priority. */
-
-#ifndef thr0loc_h
-#define thr0loc_h
-
-#include "univ.i"
-#include "os0thread.h"
-
-/****************************************************************//**
-Initializes the thread local storage module. */
-UNIV_INTERN
-void
-thr_local_init(void);
-/*================*/
- /****************************************************************//**
-Close the thread local storage module. */
-UNIV_INTERN
-void
-thr_local_close(void);
-/*=================*/
-/*******************************************************************//**
-Creates a local storage struct for the calling new thread. */
-UNIV_INTERN
-void
-thr_local_create(void);
-/*==================*/
-/*******************************************************************//**
-Frees the local storage struct for the specified thread. */
-UNIV_INTERN
-void
-thr_local_free(
-/*===========*/
- os_thread_id_t id); /*!< in: thread id */
-/*******************************************************************//**
-Gets the slot number in the thread table of a thread.
-@return slot number */
-UNIV_INTERN
-ulint
-thr_local_get_slot_no(
-/*==================*/
- os_thread_id_t id); /*!< in: thread id of the thread */
-/*******************************************************************//**
-Sets in the local storage the slot number in the thread table of a thread. */
-UNIV_INTERN
-void
-thr_local_set_slot_no(
-/*==================*/
- os_thread_id_t id, /*!< in: thread id of the thread */
- ulint slot_no);/*!< in: slot number */
-/*******************************************************************//**
-Returns pointer to the 'in_ibuf' field within the current thread local
-storage.
-@return pointer to the in_ibuf field */
-UNIV_INTERN
-ibool*
-thr_local_get_in_ibuf_field(void);
-/*=============================*/
-
-/*************************************************************************
-Return local hash table informations. */
-
-ulint
-thr_local_hash_cells(void);
-/*=======================*/
-
-ulint
-thr_local_hash_nodes(void);
-/*=======================*/
-
-#ifndef UNIV_NONINL
-#include "thr0loc.ic"
-#endif
-
-#endif
diff --git a/storage/xtradb/include/thr0loc.ic b/storage/xtradb/include/thr0loc.ic
deleted file mode 100644
index ce44e512320..00000000000
--- a/storage/xtradb/include/thr0loc.ic
+++ /dev/null
@@ -1,24 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. 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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file include/thr0loc.ic
-Thread local storage
-
-Created 10/4/1995 Heikki Tuuri
-*******************************************************/
diff --git a/storage/xtradb/include/trx0i_s.h b/storage/xtradb/include/trx0i_s.h
index 7bd4e1b88c8..73896a3cb76 100644
--- a/storage/xtradb/include/trx0i_s.h
+++ b/storage/xtradb/include/trx0i_s.h
@@ -30,6 +30,7 @@ Created July 17, 2007 Vasil Dimov
#include "univ.i"
#include "trx0types.h"
+#include "dict0types.h"
#include "ut0ut.h"
/** The maximum amount of memory that can be consumed by innodb_trx,
@@ -44,6 +45,37 @@ i_s_locks_row_t::lock_data */
i_s_trx_row_t::trx_query */
#define TRX_I_S_TRX_QUERY_MAX_LEN 1024
+/** The maximum length of a string that can be stored in
+i_s_trx_row_t::trx_operation_state */
+#define TRX_I_S_TRX_OP_STATE_MAX_LEN 64
+
+/** The maximum length of a string that can be stored in
+i_s_trx_row_t::trx_foreign_key_error */
+#define TRX_I_S_TRX_FK_ERROR_MAX_LEN 256
+
+/** The maximum length of a string that can be stored in
+i_s_trx_row_t::trx_isolation_level */
+#define TRX_I_S_TRX_ISOLATION_LEVEL_MAX_LEN 16
+
+/** Safely copy strings in to the INNODB_TRX table's
+string based columns */
+#define TRX_I_S_STRING_COPY(data, field, constraint, tcache) \
+do { \
+ if (strlen(data) > constraint) { \
+ char buff[constraint + 1]; \
+ strncpy(buff, data, constraint); \
+ buff[constraint] = '\0'; \
+ \
+ field = ha_storage_put_memlim( \
+ (tcache)->storage, buff, constraint + 1,\
+ MAX_ALLOWED_FOR_STORAGE(tcache)); \
+ } else { \
+ field = ha_storage_put_str_memlim( \
+ (tcache)->storage, data, \
+ MAX_ALLOWED_FOR_STORAGE(tcache)); \
+ } \
+} while (0)
+
/** A row of INFORMATION_SCHEMA.innodb_locks */
typedef struct i_s_locks_row_struct i_s_locks_row_t;
/** A row of INFORMATION_SCHEMA.innodb_trx */
@@ -64,7 +96,7 @@ struct i_s_hash_chain_struct {
/** This structure represents INFORMATION_SCHEMA.innodb_locks row */
struct i_s_locks_row_struct {
- ullint lock_trx_id; /*!< transaction identifier */
+ trx_id_t lock_trx_id; /*!< transaction identifier */
const char* lock_mode; /*!< lock mode from
lock_get_mode_str() */
const char* lock_type; /*!< lock type from
@@ -85,7 +117,7 @@ struct i_s_locks_row_struct {
/** The following are auxiliary and not included in the table */
/* @{ */
- ullint lock_table_id;
+ table_id_t lock_table_id;
/*!< table identifier from
lock_get_table_id */
i_s_hash_chain_t hash_chain; /*!< hash table chain node for
@@ -95,21 +127,52 @@ struct i_s_locks_row_struct {
/** This structure represents INFORMATION_SCHEMA.innodb_trx row */
struct i_s_trx_row_struct {
- ullint trx_id; /*!< transaction identifier */
+ 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_struct::start_time */
const i_s_locks_row_t* requested_lock_row;
- /*!< pointer to a row
- in innodb_locks if trx
- is waiting, or NULL */
- ib_time_t trx_wait_started;
- /*!< trx_struct::wait_started */
- ullint trx_weight; /*!< TRX_WEIGHT() */
- ulint trx_mysql_thread_id;
- /*!< thd_get_thread_id() */
- const char* trx_query; /*!< MySQL statement being
- executed in the transaction */
+ /*!< pointer to a row
+ in innodb_locks if trx
+ is waiting, or NULL */
+ ib_time_t trx_wait_started; /*!< trx_struct::wait_started */
+ ullint trx_weight; /*!< TRX_WEIGHT() */
+ ulint trx_mysql_thread_id; /*!< thd_get_thread_id() */
+ const char* trx_query; /*!< MySQL statement being
+ executed in the transaction */
+ struct charset_info_st* trx_query_cs;
+ /*!< charset encode the MySQL
+ statement */
+ const char* trx_operation_state; /*!< trx_struct::op_info */
+ ulint trx_tables_in_use;/*!< n_mysql_tables_in_use in
+ trx_struct */
+ ulint trx_tables_locked;
+ /*!< mysql_n_tables_locked in
+ trx_struct */
+ ulint trx_lock_structs;/*!< list len of trx_locks in
+ trx_struct */
+ ulint trx_lock_memory_bytes;
+ /*!< mem_heap_get_size(
+ trx->lock_heap) */
+ ulint trx_rows_locked;/*!< lock_number_of_rows_locked() */
+ ullint trx_rows_modified;/*!< trx_struct::undo_no */
+ ulint trx_concurrency_tickets;
+ /*!< n_tickets_to_enter_innodb in
+ trx_struct */
+ const char* trx_isolation_level;
+ /*!< isolation_level in trx_struct*/
+ ibool trx_unique_checks;
+ /*!< check_unique_secondary in
+ trx_struct*/
+ ibool trx_foreign_key_checks;
+ /*!< check_foreigns in trx_struct */
+ const char* trx_foreign_key_error;
+ /*!< detailed_error in trx_struct */
+ ibool trx_has_search_latch;
+ /*!< has_search_latch in trx_struct */
+ ulint trx_search_latch_timeout;
+ /*!< search_latch_timeout in
+ trx_struct */
};
/** This structure represents INFORMATION_SCHEMA.innodb_lock_waits row */
diff --git a/storage/xtradb/include/trx0purge.h b/storage/xtradb/include/trx0purge.h
index ae5bc6f90be..0b83a76cab7 100644
--- a/storage/xtradb/include/trx0purge.h
+++ b/storage/xtradb/include/trx0purge.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Innobase Oy. 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
@@ -68,8 +68,9 @@ Creates the global purge system control structure and inits the history
mutex. */
UNIV_INTERN
void
-trx_purge_sys_create(void);
-/*======================*/
+trx_purge_sys_create(
+/*=================*/
+ ib_bh_t* ib_bh); /*!< in/own: UNDO log min binary heap*/
/********************************************************************//**
Frees the global purge system control structure. */
UNIV_INTERN
@@ -112,27 +113,10 @@ This function runs a purge batch.
@return number of undo log pages handled in the batch */
UNIV_INTERN
ulint
-trx_purge(void);
-/*===========*/
-/**********************************************************************
-This function runs a purge worker batch */
-UNIV_INTERN
-void
-trx_purge_worker(
-/*=============*/
- ulint worker_id);
-/**********************************************************************
-This function waits the event for worker batch */
-UNIV_INTERN
-void
-trx_purge_worker_wait(void);
-/*========================*/
-/**********************************************************************
-This function wakes the waiting worker batch */
-UNIV_INTERN
-void
-trx_purge_worker_wake(void);
-/*========================*/
+trx_purge(
+/*======*/
+ ulint limit); /*!< in: the maximum number of records to
+ purge in one batch */
/******************************************************************//**
Prints information of the purge system to stderr. */
UNIV_INTERN
@@ -145,25 +129,20 @@ struct trx_purge_struct{
ulint state; /*!< Purge system state */
sess_t* sess; /*!< System session running the purge
query */
- trx_t* trx; /*!< System transaction running the purge
+ trx_t* trx; /*!< System transaction running the
+ purge
query: this trx is not in the trx list
of the trx system and it never ends */
que_t* query; /*!< The query graph which will do the
parallelized purge operation */
- ulint n_worker;
- os_event_t worker_event;
- sess_t** sess_arr;
- trx_t** trx_arr;
- que_t** query_arr;
- rw_lock_t latch; /*!< The latch protecting the purge view.
- A purge operation must acquire an
- x-latch here for the instant at which
+ rw_lock_t latch; /*!< The latch protecting the purge
+ view. A purge operation must acquire
+ an x-latch here for the instant at which
it changes the purge view: an undo
log operation can prevent this by
obtaining an s-latch here. */
read_view_t* view; /*!< The purge will not remove undo logs
which are >= this view (purge view) */
- mutex_t mutex; /*!< Mutex protecting the fields below */
ulint n_pages_handled;/*!< Approximate number of undo log
pages processed in purge */
ulint handle_limit; /*!< Target of how many pages to get
@@ -201,6 +180,11 @@ struct trx_purge_struct{
mem_heap_t* heap; /*!< Temporary storage used during a
purge: can be emptied after purge
completes */
+ /*-----------------------------*/
+ ib_bh_t* ib_bh; /*!< Binary min-heap, ordered on
+ rseg_queue_t::trx_no. It is protected
+ by the bh_mutex */
+ mutex_t bh_mutex; /*!< Mutex protecting ib_bh */
};
#define TRX_PURGE_ON 1 /* purge operation is running */
diff --git a/storage/xtradb/include/trx0rec.h b/storage/xtradb/include/trx0rec.h
index a6e56e963c6..477748f6f89 100644
--- a/storage/xtradb/include/trx0rec.h
+++ b/storage/xtradb/include/trx0rec.h
@@ -108,7 +108,7 @@ trx_undo_rec_get_pars(
ibool* updated_extern, /*!< out: TRUE if we updated an
externally stored fild */
undo_no_t* undo_no, /*!< out: undo log record number */
- dulint* table_id); /*!< out: table id */
+ table_id_t* table_id); /*!< out: table id */
/*******************************************************************//**
Builds a row reference from an undo log record.
@return pointer to remaining part of undo record */
@@ -227,7 +227,7 @@ trx_undo_report_row_operation(
index, otherwise NULL */
roll_ptr_t* roll_ptr); /*!< out: rollback pointer to the
inserted undo log record,
- ut_dulint_zero if BTR_NO_UNDO_LOG
+ 0 if BTR_NO_UNDO_LOG
flag was specified */
/******************************************************************//**
Copies an undo record to heap. This function can be called if we know that
diff --git a/storage/xtradb/include/trx0rec.ic b/storage/xtradb/include/trx0rec.ic
index e7e41d6d9f6..f0b3276ed44 100644
--- a/storage/xtradb/include/trx0rec.ic
+++ b/storage/xtradb/include/trx0rec.ic
@@ -78,7 +78,7 @@ trx_undo_rec_get_undo_no(
ptr = undo_rec + 3;
- return(mach_dulint_read_much_compressed(ptr));
+ return(mach_ull_read_much_compressed(ptr));
}
/**********************************************************************//**
@@ -90,7 +90,7 @@ trx_undo_rec_get_offset(
/*====================*/
undo_no_t undo_no) /*!< in: undo no read from node */
{
- return (3 + mach_dulint_get_much_compressed_size(undo_no));
+ return (3 + mach_ull_get_much_compressed_size(undo_no));
}
/***********************************************************************//**
diff --git a/storage/xtradb/include/trx0rseg.h b/storage/xtradb/include/trx0rseg.h
index 303188f09f2..5acde05de3d 100644
--- a/storage/xtradb/include/trx0rseg.h
+++ b/storage/xtradb/include/trx0rseg.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Innobase Oy. 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
@@ -103,7 +103,7 @@ trx_rseg_header_create(
ulint zip_size, /*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint max_size, /*!< in: max size in pages */
- ulint* slot_no, /*!< out: rseg id == slot number in trx sys */
+ ulint rseg_slot_no, /*!< in: rseg id == slot number in trx sys */
mtr_t* mtr); /*!< in: mtr */
/*********************************************************************//**
Creates the memory copies for rollback segments and initializes the
@@ -113,18 +113,9 @@ void
trx_rseg_list_and_array_init(
/*=========================*/
trx_sysf_t* sys_header, /*!< in: trx system header */
+ ib_bh_t* ib_bh, /*!< in: rseg queue */
mtr_t* mtr); /*!< in: mtr */
-/****************************************************************//**
-Creates a new rollback segment to the database.
-@return the created segment object, NULL if fail */
-UNIV_INTERN
-trx_rseg_t*
-trx_rseg_create(
-/*============*/
- ulint space, /*!< in: space id */
- ulint max_size, /*!< in: max size in pages */
- ulint* id, /*!< out: rseg id */
- mtr_t* mtr); /*!< in: mtr */
+
/***************************************************************************
Free's an instance of the rollback segment in memory. */
UNIV_INTERN
@@ -133,12 +124,15 @@ trx_rseg_mem_free(
/*==============*/
trx_rseg_t* rseg); /* in, own: instance to free */
-
-/* Real max value may be 4076 in usual. But reserve 4 slot for safety or etc... */
-#define TRX_RSEG_N_EXTRA_SLOTS (((UNIV_PAGE_SIZE - (FIL_PAGE_DATA + FIL_PAGE_DATA_END + TRX_RSEG_UNDO_SLOTS)) / TRX_RSEG_SLOT_SIZE) - 4)
+/*********************************************************************
+Creates a rollback segment. */
+UNIV_INTERN
+trx_rseg_t*
+trx_rseg_create(void);
+/*==================*/
/* Number of undo log slots in a rollback segment file copy */
-#define TRX_RSEG_N_SLOTS (srv_extra_undoslots ? TRX_RSEG_N_EXTRA_SLOTS : (UNIV_PAGE_SIZE / 16))
+#define TRX_RSEG_N_SLOTS (UNIV_PAGE_SIZE / 16)
/* Maximum number of transactions supported by a single rollback segment */
#define TRX_RSEG_MAX_N_TRXS (TRX_RSEG_N_SLOTS / 2)
@@ -149,9 +143,7 @@ struct trx_rseg_struct{
ulint id; /*!< rollback segment id == the index of
its slot in the trx system file copy */
mutex_t mutex; /*!< mutex protecting the fields in this
- struct except id; NOTE that the latching
- order must always be kernel mutex ->
- rseg mutex */
+ struct except id, which is constant */
ulint space; /*!< space where the rollback segment is
header is placed */
ulint zip_size;/* compressed page size of space
@@ -190,6 +182,14 @@ struct trx_rseg_struct{
memory objects */
};
+/** For prioritising the rollback segments for purge. */
+struct rseg_queue_struct {
+ trx_id_t trx_no; /*!< trx_rseg_t::last_trx_no */
+ trx_rseg_t* rseg; /*!< Rollback segment */
+};
+
+typedef struct rseg_queue_struct rseg_queue_t;
+
/* Undo log segment slot in a rollback segment header */
/*-------------------------------------------------------------*/
#define TRX_RSEG_SLOT_PAGE_NO 0 /* Page number of the header page of
diff --git a/storage/xtradb/include/trx0sys.h b/storage/xtradb/include/trx0sys.h
index 9ef9485b611..db7bf68deae 100644
--- a/storage/xtradb/include/trx0sys.h
+++ b/storage/xtradb/include/trx0sys.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Innobase Oy. 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
@@ -38,6 +38,7 @@ Created 3/26/1996 Heikki Tuuri
#include "mem0mem.h"
#include "sync0sync.h"
#include "ut0lst.h"
+#include "ut0bh.h"
#include "read0types.h"
#include "page0types.h"
@@ -160,13 +161,6 @@ void
trx_sys_dummy_create(
/*=================*/
ulint space);
-/*********************************************************************
-Create extra rollback segments when create_new_db */
-UNIV_INTERN
-void
-trx_sys_create_extra_rseg(
-/*======================*/
- ulint num); /* in: number of extra user rollback segments */
/****************************************************************//**
Looks for a free slot for a rollback segment in the trx system file copy.
@return slot index or ULINT_UNDEFINED if not found */
@@ -254,13 +248,6 @@ UNIV_INLINE
trx_id_t
trx_sys_get_new_trx_id(void);
/*========================*/
-/*****************************************************************//**
-Allocates a new transaction number.
-@return new, allocated trx number */
-UNIV_INLINE
-trx_id_t
-trx_sys_get_new_trx_no(void);
-/*========================*/
#endif /* !UNIV_HOTBACKUP */
/*****************************************************************//**
Writes a trx id to an index page. In case that the id size changes in
@@ -465,12 +452,20 @@ trx_sys_file_format_id_to_name(
const ulint id); /*!< in: id of the file format */
#endif /* !UNIV_HOTBACKUP */
+/*********************************************************************
+Creates the rollback segments */
+UNIV_INTERN
+void
+trx_sys_create_rsegs(
+/*=================*/
+ ulint n_rsegs); /*!< number of rollback segments to create */
+
/* The automatically created system rollback segment has this id */
#define TRX_SYS_SYSTEM_RSEG_ID 0
/* Space id and page no where the trx system file copy resides */
#define TRX_SYS_SPACE 0 /* the SYSTEM tablespace */
-#define TRX_DOUBLEWRITE_SPACE 1 /* the doublewrite buffer tablespace if used */
+#define TRX_DOUBLEWRITE_SPACE 0xFFFFFFE0UL /* the doublewrite buffer tablespace if used */
#define TRX_SYS_SPACE_MAX 9 /* reserved max space id for system tablespaces */
#include "fsp0fsp.h"
#define TRX_SYS_PAGE_NO FSP_TRX_SYS_PAGE_NO
@@ -501,11 +496,16 @@ trx_sys_file_format_id_to_name(
slots */
/*------------------------------------------------------------- @} */
-/** Maximum number of rollback segments: the number of segment
-specification slots in the transaction system array; rollback segment
-id must fit in one byte, therefore 256; each slot is currently 8 bytes
-in size */
-#define TRX_SYS_N_RSEGS 256
+/* Max number of rollback segments: the number of segment specification slots
+in the transaction system array; rollback segment id must fit in one (signed)
+byte, therefore 128; each slot is currently 8 bytes in size. If you want
+to raise the level to 256 then you will need to fix some assertions that
+impose the 7 bit restriction. e.g., mach_write_to_3() */
+#define TRX_SYS_N_RSEGS 128
+/* Originally, InnoDB defined TRX_SYS_N_RSEGS as 256 but created only one
+rollback segment. It initialized some arrays with this number of entries.
+We must remember this limit in order to keep file compatibility. */
+#define TRX_SYS_OLD_N_RSEGS 256
/** Maximum length of MySQL binlog file name, in bytes.
@see trx_sys_mysql_master_log_name
@@ -593,11 +593,16 @@ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_NO. */
(TRX_SYS_PAGE_NO of TRX_SYS_SPACE) */
#define TRX_SYS_FILE_FORMAT_TAG (UNIV_PAGE_SIZE - 16)
-/** Contents of TRX_SYS_FILE_FORMAT_TAG when valid. The file format
+/** Contents of TRX_SYS_FILE_FORMAT_TAG when valid. The file format
identifier is added to this constant. */
#define TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW 3645922177UL
/** Contents of TRX_SYS_FILE_FORMAT_TAG+4 when valid */
#define TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH 2745987765UL
+/** Contents of TRX_SYS_FILE_FORMAT_TAG when valid. The file format
+identifier is added to this 64-bit constant. */
+#define TRX_SYS_FILE_FORMAT_TAG_MAGIC_N \
+ ((ib_uint64_t) TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH << 32 \
+ | TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW)
/* @} */
/** Doublewrite control struct */
diff --git a/storage/xtradb/include/trx0sys.ic b/storage/xtradb/include/trx0sys.ic
index c7b09d4aec2..aa2d2ea26b0 100644
--- a/storage/xtradb/include/trx0sys.ic
+++ b/storage/xtradb/include/trx0sys.ic
@@ -81,7 +81,7 @@ trx_sys_sys_space(
{
if (srv_doublewrite_file) {
/* several spaces are reserved */
- return((ibool)(space <= TRX_SYS_SPACE_MAX));
+ return((ibool)(space == TRX_SYS_SPACE || space == TRX_DOUBLEWRITE_SPACE));
} else {
return((ibool)(space == TRX_SYS_SPACE));
}
@@ -300,7 +300,7 @@ trx_get_on_id(
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
while (trx != NULL) {
- if (0 == ut_dulint_cmp(trx_id, trx->id)) {
+ if (trx_id == trx->id) {
return(trx);
}
@@ -349,12 +349,12 @@ trx_is_active(
ut_ad(mutex_own(&(kernel_mutex)));
- if (ut_dulint_cmp(trx_id, trx_list_get_min_trx_id()) < 0) {
+ if (trx_id < trx_list_get_min_trx_id()) {
return(FALSE);
}
- if (ut_dulint_cmp(trx_id, trx_sys->max_trx_id) >= 0) {
+ if (UNIV_UNLIKELY(trx_id >= trx_sys->max_trx_id)) {
/* There must be corruption: we return TRUE because this
function is only called by lock_clust_rec_some_has_impl()
@@ -393,29 +393,14 @@ trx_sys_get_new_trx_id(void)
Thus trx id values will not overlap when the database is
repeatedly started! */
- if (ut_dulint_get_low(trx_sys->max_trx_id)
- % TRX_SYS_TRX_ID_WRITE_MARGIN == 0) {
+ if ((ulint) trx_sys->max_trx_id % TRX_SYS_TRX_ID_WRITE_MARGIN == 0) {
trx_sys_flush_max_trx_id();
}
- id = trx_sys->max_trx_id;
-
- UT_DULINT_INC(trx_sys->max_trx_id);
+ id = trx_sys->max_trx_id++;
return(id);
}
-/*****************************************************************//**
-Allocates a new transaction number.
-@return new, allocated trx number */
-UNIV_INLINE
-trx_id_t
-trx_sys_get_new_trx_no(void)
-/*========================*/
-{
- ut_ad(mutex_own(&kernel_mutex));
-
- return(trx_sys_get_new_trx_id());
-}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h
index 4c0ce392bcd..ab7404c5eff 100644
--- a/storage/xtradb/include/trx0trx.h
+++ b/storage/xtradb/include/trx0trx.h
@@ -44,6 +44,9 @@ extern sess_t* trx_dummy_sess;
/** Number of transactions currently allocated for MySQL: protected by
the kernel mutex */
extern ulint trx_n_mysql_transactions;
+/** Number of transactions currently in the XA PREPARED state: protected by
+the kernel mutex */
+extern ulint trx_n_prepared;
/********************************************************************//**
Releases the search latch if trx has reserved it. */
@@ -108,6 +111,14 @@ trx_free(
/*=====*/
trx_t* trx); /*!< in, own: trx object */
/********************************************************************//**
+At shutdown, frees a transaction object that is in the PREPARED state. */
+UNIV_INTERN
+void
+trx_free_prepared(
+/*==============*/
+ trx_t* trx) /*!< in, own: trx object */
+ UNIV_COLD __attribute__((nonnull));
+/********************************************************************//**
Frees a transaction object for MySQL. */
UNIV_INTERN
void
@@ -214,12 +225,12 @@ trx_recover_for_mysql(
/*******************************************************************//**
This function is used to find one X/Open XA distributed transaction
which is in the prepared state
-@return trx or NULL */
+@return trx or NULL; on match, the trx->xid will be invalidated */
UNIV_INTERN
trx_t *
trx_get_trx_by_xid(
/*===============*/
- XID* xid); /*!< in: X/Open XA transaction identification */
+ const XID* xid); /*!< in: X/Open XA transaction identifier */
/**********************************************************************//**
If required, flushes the log to disk if we called trx_commit_for_mysql()
with trx->flush_log_later == TRUE.
@@ -408,30 +419,20 @@ Calculates the "weight" of a transaction. The weight of one transaction
is estimated as the number of altered rows + the number of locked rows.
@param t transaction
@return transaction weight */
-#define TRX_WEIGHT(t) \
- ut_dulint_add((t)->undo_no, UT_LIST_GET_LEN((t)->trx_locks))
+#define TRX_WEIGHT(t) ((t)->undo_no + UT_LIST_GET_LEN((t)->trx_locks))
/*******************************************************************//**
Compares the "weight" (or size) of two transactions. Transactions that
have edited non-transactional tables are considered heavier than ones
that have not.
-@return <0, 0 or >0; similar to strcmp(3) */
+@return TRUE if weight(a) >= weight(b) */
UNIV_INTERN
-int
-trx_weight_cmp(
-/*===========*/
+ibool
+trx_weight_ge(
+/*==========*/
const trx_t* a, /*!< in: the first transaction to be compared */
const trx_t* b); /*!< in: the second transaction to be compared */
-/*******************************************************************//**
-Retrieves transacion's id, represented as unsigned long long.
-@return transaction's id */
-UNIV_INLINE
-ullint
-trx_get_id(
-/*=======*/
- const trx_t* trx); /*!< in: transaction */
-
/* Maximum length of a string that can be returned by
trx_get_que_state_str(). */
#define TRX_QUE_STATE_STR_MAX_LEN 12 /* "ROLLING BACK" */
@@ -480,6 +481,20 @@ struct trx_struct{
of view of concurrency control:
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
... */
+ /*------------------------------*/
+ /* MySQL has a transaction coordinator to coordinate two phase
+ commit between multiple storage engines and the binary log. When
+ an engine participates in a transaction, it's responsible for
+ registering itself using the trans_register_ha() API. */
+ unsigned is_registered:1;/* This flag is set to 1 after the
+ transaction has been registered with
+ the coordinator using the XA API, and
+ is set to 0 after commit or rollback. */
+ unsigned owns_prepare_mutex:1;/* 1 if owns prepare mutex, if
+ this is set to 1 then registered should
+ also be set to 1. This is used in the
+ XA code */
+ /*------------------------------*/
ulint isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */
ulint check_foreigns; /* normally TRUE, but if the user
wants to suppress foreign key checks,
@@ -497,7 +512,6 @@ struct trx_struct{
FALSE, one can save CPU time and about
150 bytes in the undo log size as then
we skip XA steps */
- ulint flush_log_at_trx_commit_session;
ulint flush_log_later;/* In 2PC, we hold the
prepare_commit mutex across
both phases. In that case, we
@@ -511,9 +525,6 @@ struct trx_struct{
in that case we must flush the log
in trx_commit_complete_for_mysql() */
ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
- ulint active_trans; /*!< 1 - if a transaction in MySQL
- is active. 2 - if prepare_commit_mutex
- was taken */
ulint has_search_latch;
/* TRUE if this trx has latched the
search system latch in S-mode */
@@ -556,8 +567,8 @@ struct trx_struct{
max trx id when the transaction is
moved to COMMITTED_IN_MEMORY state */
ib_uint64_t commit_lsn; /*!< lsn at the time of the commit */
- trx_id_t table_id; /*!< Table to drop iff dict_operation
- is TRUE, or ut_dulint_zero. */
+ table_id_t table_id; /*!< Table to drop iff dict_operation
+ is TRUE, or 0. */
/*------------------------------*/
void* mysql_thd; /*!< MySQL thread handle corresponding
to this trx, or NULL */
@@ -583,12 +594,6 @@ struct trx_struct{
replication has processed */
const char* mysql_relay_log_file_name;
ib_int64_t mysql_relay_log_pos;
-
- os_thread_id_t mysql_thread_id;/* id of the MySQL thread associated
- with this transaction object */
- ulint mysql_process_no;/* since in Linux, 'top' reports
- process id's and not thread id's, we
- store the process number too */
/*------------------------------*/
ulint n_mysql_tables_in_use; /* number of Innobase tables
used in the processing of the current
diff --git a/storage/xtradb/include/trx0trx.ic b/storage/xtradb/include/trx0trx.ic
index 7332eeece85..4a1d3bcde0b 100644
--- a/storage/xtradb/include/trx0trx.ic
+++ b/storage/xtradb/include/trx0trx.ic
@@ -69,18 +69,6 @@ trx_get_error_info(
}
/*******************************************************************//**
-Retrieves transacion's id, represented as unsigned long long.
-@return transaction's id */
-UNIV_INLINE
-ullint
-trx_get_id(
-/*=======*/
- const trx_t* trx) /*!< in: transaction */
-{
- return((ullint)ut_conv_dulint_to_longlong(trx->id));
-}
-
-/*******************************************************************//**
Retrieves transaction's que state in a human readable string. The string
should not be free()'d or modified.
@return string in the data segment */
diff --git a/storage/xtradb/include/trx0types.h b/storage/xtradb/include/trx0types.h
index 40a7256cbfd..a4115b5aca7 100644
--- a/storage/xtradb/include/trx0types.h
+++ b/storage/xtradb/include/trx0types.h
@@ -28,10 +28,7 @@ Created 3/26/1996 Heikki Tuuri
#include "ut0byte.h"
-/** prepare trx_t::id for being printed via printf(3) */
-#define TRX_ID_PREP_PRINTF(id) (ullint) ut_conv_dulint_to_longlong(id)
-
-/** printf(3) format used for printing TRX_ID_PRINTF_PREP() */
+/** printf(3) format used for printing DB_TRX_ID and other system fields */
#define TRX_ID_FMT "%llX"
/** maximum length that a formatted trx_t::id could take, not including
@@ -81,12 +78,14 @@ enum trx_rb_ctx {
in crash recovery */
};
+/** Row identifier (DB_ROW_ID, DATA_ROW_ID) */
+typedef ib_id_t row_id_t;
/** Transaction identifier (DB_TRX_ID, DATA_TRX_ID) */
-typedef dulint trx_id_t;
+typedef ib_id_t trx_id_t;
/** Rollback pointer (DB_ROLL_PTR, DATA_ROLL_PTR) */
-typedef dulint roll_ptr_t;
+typedef ib_id_t roll_ptr_t;
/** Undo number */
-typedef dulint undo_no_t;
+typedef ib_id_t undo_no_t;
/** Transaction savepoint */
typedef struct trx_savept_struct trx_savept_t;
diff --git a/storage/xtradb/include/trx0undo.h b/storage/xtradb/include/trx0undo.h
index a084f2394b5..df16c939070 100644
--- a/storage/xtradb/include/trx0undo.h
+++ b/storage/xtradb/include/trx0undo.h
@@ -262,8 +262,6 @@ UNIV_INTERN
page_t*
trx_undo_set_state_at_finish(
/*=========================*/
- trx_rseg_t* rseg, /*!< in: rollback segment memory object */
- trx_t* trx, /*!< in: transaction */
trx_undo_t* undo, /*!< in: undo log memory copy */
mtr_t* mtr); /*!< in: mtr */
/******************************************************************//**
@@ -298,6 +296,15 @@ void
trx_undo_insert_cleanup(
/*====================*/
trx_t* trx); /*!< in: transaction handle */
+
+/********************************************************************//**
+At shutdown, frees the undo logs of a PREPARED transaction. */
+UNIV_INTERN
+void
+trx_undo_free_prepared(
+/*===================*/
+ trx_t* trx) /*!< in/out: PREPARED transaction */
+ UNIV_COLD __attribute__((nonnull));
#endif /* !UNIV_HOTBACKUP */
/***********************************************************//**
Parses the redo log entry of an undo log page initialization.
@@ -383,7 +390,7 @@ struct trx_undo_struct{
XID xid; /*!< X/Open XA transaction
identification */
ibool dict_operation; /*!< TRUE if a dict operation trx */
- dulint table_id; /*!< if a dict operation, then the table
+ table_id_t table_id; /*!< if a dict operation, then the table
id */
trx_rseg_t* rseg; /*!< rseg where the undo log belongs */
/*-----------------------------*/
diff --git a/storage/xtradb/include/trx0undo.ic b/storage/xtradb/include/trx0undo.ic
index 2d289b34ef1..b81330f7f8b 100644
--- a/storage/xtradb/include/trx0undo.ic
+++ b/storage/xtradb/include/trx0undo.ic
@@ -39,16 +39,19 @@ trx_undo_build_roll_ptr(
ulint page_no, /*!< in: page number */
ulint offset) /*!< in: offset of the undo entry within page */
{
+ roll_ptr_t roll_ptr;
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
- ut_ad(rseg_id < 128);
-
- return(ut_dulint_create(is_insert * 128 * 256 * 256
- + rseg_id * 256 * 256
- + (page_no / 256) / 256,
- (page_no % (256 * 256)) * 256 * 256
- + offset));
+ ut_ad(is_insert == 0 || is_insert == 1);
+ ut_ad(rseg_id < TRX_SYS_N_RSEGS);
+ ut_ad(offset < 65536);
+
+ roll_ptr = (roll_ptr_t) is_insert << 55
+ | (roll_ptr_t) rseg_id << 48
+ | (roll_ptr_t) page_no << 16
+ | offset;
+ return(roll_ptr);
}
/***********************************************************************//**
@@ -64,24 +67,20 @@ trx_undo_decode_roll_ptr(
ulint* offset) /*!< out: offset of the undo
entry within page */
{
- ulint low;
- ulint high;
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
#if TRUE != 1
# error "TRUE != 1"
#endif
- high = ut_dulint_get_high(roll_ptr);
- low = ut_dulint_get_low(roll_ptr);
-
- *offset = low % (256 * 256);
-
- *is_insert = high / (256 * 256 * 128); /* TRUE == 1 */
- *rseg_id = (high / (256 * 256)) % 128;
-
- *page_no = (high % (256 * 256)) * 256 * 256
- + (low / 256) / 256;
+ ut_ad(roll_ptr < (1ULL << 56));
+ *offset = (ulint) roll_ptr & 0xFFFF;
+ roll_ptr >>= 16;
+ *page_no = (ulint) roll_ptr & 0xFFFFFFFF;
+ roll_ptr >>= 32;
+ *rseg_id = (ulint) roll_ptr & 0x7F;
+ roll_ptr >>= 7;
+ *is_insert = (ibool) roll_ptr; /* TRUE==1 */
}
/***********************************************************************//**
@@ -93,16 +92,14 @@ trx_undo_roll_ptr_is_insert(
/*========================*/
roll_ptr_t roll_ptr) /*!< in: roll pointer */
{
- ulint high;
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
#if TRUE != 1
# error "TRUE != 1"
#endif
- high = ut_dulint_get_high(roll_ptr);
-
- return(high / (256 * 256 * 128));
+ ut_ad(roll_ptr < (1ULL << 56));
+ return((ibool) (roll_ptr >> 55));
}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 8691e3cf337..17cc21946a1 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -44,10 +44,19 @@ Created 1/20/1994 Heikki Tuuri
#include "hb_univ.i"
#endif /* UNIV_HOTBACKUP */
+/* aux macros to convert M into "123" (string) if M is defined like
+#define M 123 */
+#define _IB_TO_STR(s) #s
+#define IB_TO_STR(s) _IB_TO_STR(s)
+
#define INNODB_VERSION_MAJOR 1
-#define INNODB_VERSION_MINOR 0
-#define INNODB_VERSION_BUGFIX 12
-#define PERCONA_INNODB_VERSION 12.1
+#define INNODB_VERSION_MINOR 1
+#define INNODB_VERSION_BUGFIX 8
+
+#ifndef PERCONA_INNODB_VERSION
+#define PERCONA_INNODB_VERSION 20.1
+#endif
+
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
@@ -58,18 +67,15 @@ component, i.e. we show M.N.P as M.N */
#define INNODB_VERSION_SHORT \
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
-/* auxiliary macros to help creating the version as string */
-#define __INNODB_VERSION(a, b, c, d) (#a "." #b "." #c "-" #d)
-#define _INNODB_VERSION(a, b, c, d) __INNODB_VERSION(a, b, c, d)
-
-
#define INNODB_VERSION_STR \
- _INNODB_VERSION(INNODB_VERSION_MAJOR, \
- INNODB_VERSION_MINOR, \
- INNODB_VERSION_BUGFIX, \
- PERCONA_INNODB_VERSION)
+ IB_TO_STR(INNODB_VERSION_MAJOR) "." \
+ IB_TO_STR(INNODB_VERSION_MINOR) "." \
+ IB_TO_STR(INNODB_VERSION_BUGFIX) "-" \
+ IB_TO_STR(PERCONA_INNODB_VERSION)
-#define REFMAN "http://dev.mysql.com/doc/refman/5.1/en/"
+#define REFMAN "http://dev.mysql.com/doc/refman/" \
+ IB_TO_STR(MYSQL_MAJOR_VERSION) "." \
+ IB_TO_STR(MYSQL_MINOR_VERSION) "/en/"
#ifdef MYSQL_DYNAMIC_PLUGIN
/* In the dynamic plugin, redefine some externally visible symbols
@@ -81,19 +87,6 @@ the virtual method table (vtable) in GCC 3. */
# define ha_innobase ha_innodb
#endif /* MYSQL_DYNAMIC_PLUGIN */
-/* if any of the following macros is defined at this point this means
-that the code from the "right" plug.in was executed and we do not
-need to include ut0auxconf.h which would either define the same macros
-or will be empty */
-#if !defined(HAVE_IB_GCC_ATOMIC_BUILTINS) \
- && !defined(HAVE_IB_ATOMIC_PTHREAD_T_GCC) \
- && !defined(HAVE_IB_SOLARIS_ATOMICS) \
- && !defined(HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS) \
- && !defined(SIZEOF_PTHREAD_T) \
- && !defined(HAVE_IB_PAUSE_INSTRUCTION)
-# include "ut0auxconf.h"
-#endif
-
#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
# undef __WIN__
# define __WIN__
@@ -118,7 +111,7 @@ if we are compiling on Windows. */
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
# include <sys/stat.h>
-# if !defined(__NETWARE__) && !defined(__WIN__)
+# if !defined(__WIN__)
# include <sys/mman.h> /* mmap() for os0proc.c */
# endif
@@ -147,6 +140,23 @@ Sun Studio */
#endif /* #if (defined(WIN32) || ... */
+/* Following defines are to enable performance schema
+instrumentation in each of four InnoDB modules if
+HAVE_PSI_INTERFACE is defined. */
+#ifdef HAVE_PSI_INTERFACE
+# define UNIV_PFS_MUTEX
+# define UNIV_PFS_RWLOCK
+/* For I/O instrumentation, performance schema rely
+on a native descriptor to identify the file, this
+descriptor could conflict with our OS level descriptor.
+Disable IO instrumentation on Windows until this is
+resolved */
+# ifndef __WIN__
+# define UNIV_PFS_IO
+# endif
+# define UNIV_PFS_THREAD
+#endif /* HAVE_PSI_INTERFACE */
+
/* DEBUG VERSION CONTROL
===================== */
@@ -180,14 +190,17 @@ command. Not tested on Windows. */
debugging without UNIV_DEBUG */
#define UNIV_BUF_DEBUG /* Enable buffer pool
debugging without UNIV_DEBUG */
+#define UNIV_BLOB_LIGHT_DEBUG /* Enable off-page column
+ debugging without UNIV_DEBUG */
+#define UNIV_BLOB_NULL_DEBUG /* Enable deep off-page
+ column debugging */
#define UNIV_DEBUG /* Enable ut_ad() assertions
and disable UNIV_INLINE */
#define UNIV_DEBUG_LOCK_VALIDATE /* Enable
ut_ad(lock_rec_validate_page())
assertions. */
-#define UNIV_DEBUG_FILE_ACCESSES /* Debug .ibd file access
- (field file_page_was_freed
- in buf_page_t) */
+#define UNIV_DEBUG_FILE_ACCESSES /* Enable freed block access
+ debugging without UNIV_DEBUG */
#define UNIV_LRU_DEBUG /* debug the buffer pool LRU */
#define UNIV_HASH_DEBUG /* debug HASH_ macros */
#define UNIV_LIST_DEBUG /* debug UT_LIST_ macros */
@@ -196,6 +209,8 @@ this will break redo log file compatibility, but it may be useful when
debugging redo log application problems. */
#define UNIV_MEM_DEBUG /* detect memory leaks etc */
#define UNIV_IBUF_DEBUG /* debug the insert buffer */
+#define UNIV_BLOB_DEBUG /* track BLOB ownership;
+assumes that no BLOBs survive server restart */
#define UNIV_IBUF_COUNT_DEBUG /* debug the insert buffer;
this limits the database to IBUF_COUNT_N_SPACES and IBUF_COUNT_N_PAGES,
and the insert buffer must be empty when the database is started */
@@ -214,6 +229,9 @@ operations (very slow); also UNIV_DEBUG must be defined */
for compressed pages */
#define UNIV_ZIP_COPY /* call page_zip_copy_recs()
more often */
+#define UNIV_AIO_DEBUG /* prints info about
+ submitted and reaped AIO
+ requests to the log. */
#endif
#define UNIV_BTR_DEBUG /* check B-tree links */
@@ -237,14 +255,29 @@ by one. */
option off; also some ibuf tests are suppressed */
/* Linkage specifier for non-static InnoDB symbols (variables and functions)
-that are only referenced from within InnoDB, not from MySQL */
-#if defined(__GNUC__) && (__GNUC__ >= 4) || defined(__INTEL_COMPILER)
+that are only referenced from within InnoDB, not from MySQL. We disable the
+GCC visibility directive on all Sun operating systems because there is no
+easy way to get it to work. See http://bugs.mysql.com/bug.php?id=52263. */
+#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(sun) || defined(__INTEL_COMPILER)
# define UNIV_INTERN __attribute__((visibility ("hidden")))
#else
# define UNIV_INTERN
#endif
+#if defined __GNUC__ && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+/** Starting with GCC 4.3, the "cold" attribute is used to inform the
+compiler that a function is unlikely executed. The function is
+optimized for size rather than speed and on many targets it is placed
+into special subsection of the text section so all cold functions
+appears close together improving code locality of non-cold parts of
+program. The paths leading to call of cold functions within code are
+marked as unlikely by the branch prediction mechanism. optimize a
+rarely invoked function for size instead for speed. */
+# define UNIV_COLD __attribute__((cold))
+#else
+# define UNIV_COLD /* empty */
+#endif
-#if (!defined(UNIV_DEBUG) && !defined(UNIV_MUST_NOT_INLINE))
+#ifndef UNIV_MUST_NOT_INLINE
/* Definition for inline version */
#ifdef __WIN__
@@ -303,6 +336,18 @@ number does not include a terminating '\0'. InnoDB probably can handle
longer names internally */
#define MAX_TABLE_NAME_LEN 192
+/* The maximum length of a database name. Like MAX_TABLE_NAME_LEN this is
+the MySQL's NAME_LEN, see check_and_convert_db_name(). */
+#define MAX_DATABASE_NAME_LEN MAX_TABLE_NAME_LEN
+
+/* MAX_FULL_NAME_LEN defines the full name path including the
+database name and table name. In addition, 14 bytes is added for:
+ 2 for surrounding quotes around table name
+ 1 for the separating dot (.)
+ 9 for the #mysql50# prefix */
+#define MAX_FULL_NAME_LEN \
+ (MAX_TABLE_NAME_LEN + MAX_DATABASE_NAME_LEN + 14)
+
/*
UNIVERSAL TYPE DEFINITIONS
==========================
@@ -360,8 +405,10 @@ typedef unsigned long long int ullint;
/* The 'undefined' value for a ulint */
#define ULINT_UNDEFINED ((ulint)(-1))
+/** The bitmask of 32-bit unsigned integer */
+#define ULINT32_MASK 0xFFFFFFFF
/* The undefined 32-bit unsigned integer */
-#define ULINT32_UNDEFINED 0xFFFFFFFF
+#define ULINT32_UNDEFINED ULINT32_MASK
/* Maximum value for a ulint */
#define ULINT_MAX ((ulint)(-2))
@@ -369,6 +416,12 @@ typedef unsigned long long int ullint;
/* Maximum value for ib_uint64_t */
#define IB_ULONGLONG_MAX ((ib_uint64_t) (~0ULL))
+/** The generic InnoDB system object identifier data type */
+typedef ib_uint64_t ib_id_t;
+
+/* The 'undefined' value for a ullint */
+#define ULLINT_UNDEFINED ((ullint)(-1))
+
/* This 'ibool' type is used within Innobase. Remember that different included
headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */
#define ibool ulint
@@ -418,7 +471,7 @@ it is read or written. */
/* Use sun_prefetch when compile with Sun Studio */
# define UNIV_EXPECT(expr,value) (expr)
# define UNIV_LIKELY_NULL(expr) (expr)
-# define UNIV_PREFETCH_R(addr) sun_prefetch_read_many(addr)
+# define UNIV_PREFETCH_R(addr) sun_prefetch_read_many((void*) addr)
# define UNIV_PREFETCH_RW(addr) sun_prefetch_write_many(addr)
#else
/* Dummy versions of the macros */
diff --git a/storage/xtradb/include/ut0auxconf.h b/storage/xtradb/include/ut0auxconf.h
deleted file mode 100644
index 16bcc308392..00000000000
--- a/storage/xtradb/include/ut0auxconf.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Do not remove this file even though it is empty.
-This file is included in univ.i and will cause compilation failure
-if not present.
-A custom checks have been added in the generated
-storage/innobase/Makefile.in that is shipped with the InnoDB Plugin
-source archive. These checks eventually define some macros and put
-them in this file.
-This is a hack that has been developed in order to deploy new compile
-time checks without the need to regenerate the ./configure script that is
-distributed in the MySQL 5.1 official source archives.
-If by any chance Makefile.in and ./configure are regenerated and thus
-the hack from Makefile.in wiped away then the "real" checks from plug.in
-will take over.
-*/
diff --git a/storage/xtradb/include/ut0bh.h b/storage/xtradb/include/ut0bh.h
new file mode 100644
index 00000000000..1b211390283
--- /dev/null
+++ b/storage/xtradb/include/ut0bh.h
@@ -0,0 +1,152 @@
+/***************************************************************************//**
+
+Copyright (c) 2011, Oracle Corpn. 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., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+
+*****************************************************************************/
+
+/******************************************************************//**
+@file include/ut0bh.h
+Binary min-heap interface.
+
+Created 2010-05-28 by Sunny Bains
+*******************************************************/
+
+#ifndef INNOBASE_UT0BH_H
+#define INNOBASE_UT0BH_H
+
+#include "univ.i"
+
+/** Comparison function for objects in the binary heap. */
+typedef int (*ib_bh_cmp_t)(const void* p1, const void* p2);
+
+typedef struct ib_bh_struct ib_bh_t;
+
+/**********************************************************************//**
+Get the number of elements in the binary heap.
+@return number of elements */
+UNIV_INLINE
+ulint
+ib_bh_size(
+/*=======*/
+ const ib_bh_t* ib_bh); /*!< in: instance */
+
+/**********************************************************************//**
+Test if binary heap is empty.
+@return TRUE if empty. */
+UNIV_INLINE
+ibool
+ib_bh_is_empty(
+/*===========*/
+ const ib_bh_t* ib_bh); /*!< in: instance */
+
+/**********************************************************************//**
+Test if binary heap is full.
+@return TRUE if full. */
+UNIV_INLINE
+ibool
+ib_bh_is_full(
+/*===========*/
+ const ib_bh_t* ib_bh); /*!< in: instance */
+
+/**********************************************************************//**
+Get a pointer to the element.
+@return pointer to element */
+UNIV_INLINE
+void*
+ib_bh_get(
+/*=======*/
+ ib_bh_t* ib_bh, /*!< in: instance */
+ ulint i); /*!< in: index */
+
+/**********************************************************************//**
+Copy an element to the binary heap.
+@return pointer to copied element */
+UNIV_INLINE
+void*
+ib_bh_set(
+/*======*/
+ ib_bh_t* ib_bh, /*!< in/out: instance */
+ ulint i, /*!< in: index */
+ const void* elem); /*!< in: element to add */
+
+/**********************************************************************//**
+Return the first element from the binary heap.
+@return pointer to first element or NULL if empty. */
+UNIV_INLINE
+void*
+ib_bh_first(
+/*========*/
+ ib_bh_t* ib_bh); /*!< in: instance */
+
+/**********************************************************************//**
+Return the last element from the binary heap.
+@return pointer to last element or NULL if empty. */
+UNIV_INLINE
+void*
+ib_bh_last(
+/*========*/
+ ib_bh_t* ib_bh); /*!< in/out: instance */
+
+/**********************************************************************//**
+Create a binary heap.
+@return a new binary heap */
+UNIV_INTERN
+ib_bh_t*
+ib_bh_create(
+/*=========*/
+ ib_bh_cmp_t compare, /*!< in: comparator */
+ ulint sizeof_elem, /*!< in: size of one element */
+ ulint max_elems); /*!< in: max elements allowed */
+
+/**********************************************************************//**
+Free a binary heap.
+@return a new binary heap */
+UNIV_INTERN
+void
+ib_bh_free(
+/*=======*/
+ ib_bh_t* ib_bh); /*!< in,own: instance */
+
+/**********************************************************************//**
+Add an element to the binary heap. Note: The element is copied.
+@return pointer to added element or NULL if full. */
+UNIV_INTERN
+void*
+ib_bh_push(
+/*=======*/
+ ib_bh_t* ib_bh, /*!< in/out: instance */
+ const void* elem); /*!< in: element to add */
+
+/**********************************************************************//**
+Remove the first element from the binary heap. */
+UNIV_INTERN
+void
+ib_bh_pop(
+/*======*/
+ ib_bh_t* ib_bh); /*!< in/out: instance */
+
+/** Binary heap data structure */
+struct ib_bh_struct {
+ ulint max_elems; /*!< max elements allowed */
+ ulint n_elems; /*!< current size */
+ ulint sizeof_elem; /*!< sizeof element */
+ ib_bh_cmp_t compare; /*!< comparator */
+};
+
+#ifndef UNIV_NONINL
+#include "ut0bh.ic"
+#endif
+
+#endif /* INNOBASE_UT0BH_H */
diff --git a/storage/xtradb/include/ut0bh.ic b/storage/xtradb/include/ut0bh.ic
new file mode 100644
index 00000000000..afbe58e7e3b
--- /dev/null
+++ b/storage/xtradb/include/ut0bh.ic
@@ -0,0 +1,125 @@
+/***************************************************************************//**
+Copyright (c) 2011, Oracle Corpn. 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., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+
+*****************************************************************************/
+
+/******************************************************************//**
+@file include/ut0bh.ic
+Binary min-heap implementation.
+
+Created 2011-01-15 by Sunny Bains
+*******************************************************/
+
+#include "ut0bh.h"
+#include "ut0mem.h" /* For ut_memcpy() */
+
+/**********************************************************************//**
+Get the number of elements in the binary heap.
+@return number of elements */
+UNIV_INLINE
+ulint
+ib_bh_size(
+/*=======*/
+ const ib_bh_t* ib_bh) /*!< in: instance */
+{
+ return(ib_bh->n_elems);
+}
+
+/**********************************************************************//**
+Test if binary heap is empty.
+@return TRUE if empty. */
+UNIV_INLINE
+ibool
+ib_bh_is_empty(
+/*===========*/
+ const ib_bh_t* ib_bh) /*!< in: instance */
+{
+ return(ib_bh_size(ib_bh) == 0);
+}
+
+/**********************************************************************//**
+Test if binary heap is full.
+@return TRUE if full. */
+UNIV_INLINE
+ibool
+ib_bh_is_full(
+/*===========*/
+ const ib_bh_t* ib_bh) /*!< in: instance */
+{
+ return(ib_bh_size(ib_bh) >= ib_bh->max_elems);
+}
+
+/**********************************************************************//**
+Get a pointer to the element.
+@return pointer to element */
+UNIV_INLINE
+void*
+ib_bh_get(
+/*=======*/
+ ib_bh_t* ib_bh, /*!< in: instance */
+ ulint i) /*!< in: index */
+{
+ byte* ptr = (byte*) (ib_bh + 1);
+
+ ut_a(i < ib_bh_size(ib_bh));
+
+ return(ptr + (ib_bh->sizeof_elem * i));
+}
+
+/**********************************************************************//**
+Copy an element to the binary heap.
+@return pointer to copied element */
+UNIV_INLINE
+void*
+ib_bh_set(
+/*======*/
+ ib_bh_t* ib_bh, /*!< in/out: instance */
+ ulint i, /*!< in: index */
+ const void* elem) /*!< in: element to add */
+{
+ void* ptr = ib_bh_get(ib_bh, i);
+
+ ut_memcpy(ptr, elem, ib_bh->sizeof_elem);
+
+ return(ptr);
+}
+
+/**********************************************************************//**
+Return the first element from the binary heap.
+@return pointer to first element or NULL if empty. */
+UNIV_INLINE
+void*
+ib_bh_first(
+/*========*/
+ ib_bh_t* ib_bh) /*!< in: instance */
+{
+ return(ib_bh_is_empty(ib_bh) ? NULL : ib_bh_get(ib_bh, 0));
+}
+
+/**********************************************************************//**
+Return the last element from the binary heap.
+@return pointer to last element or NULL if empty. */
+UNIV_INLINE
+void*
+ib_bh_last(
+/*========*/
+ ib_bh_t* ib_bh) /*!< in/out: instance */
+{
+ return(ib_bh_is_empty(ib_bh)
+ ? NULL
+ : ib_bh_get(ib_bh, ib_bh_size(ib_bh) - 1));
+}
+
+
diff --git a/storage/xtradb/include/ut0byte.h b/storage/xtradb/include/ut0byte.h
index f55e2888c60..b99d7175b94 100644
--- a/storage/xtradb/include/ut0byte.h
+++ b/storage/xtradb/include/ut0byte.h
@@ -27,145 +27,22 @@ Created 1/20/1994 Heikki Tuuri
#define ut0byte_h
-#include "univ.i"
-
-/** Pair of ulint integers. */
-typedef struct dulint_struct dulint;
-/** Type definition for a 64-bit unsigned integer, which works also
-in 32-bit machines. NOTE! Access the fields only with the accessor
-functions. This definition appears here only for the compiler to
-know the size of a dulint. */
-struct dulint_struct{
- ulint high; /*!< most significant 32 bits */
- ulint low; /*!< least significant 32 bits */
-};
-
-/** Zero value for a dulint */
-extern const dulint ut_dulint_zero;
-/** Maximum value for a dulint */
-extern const dulint ut_dulint_max;
+#include "univ.i"
/*******************************************************//**
-Creates a 64-bit dulint out of two ulints.
+Creates a 64-bit integer out of two 32-bit integers.
@return created dulint */
UNIV_INLINE
-dulint
-ut_dulint_create(
-/*=============*/
- ulint high, /*!< in: high-order 32 bits */
- ulint low); /*!< in: low-order 32 bits */
-/*******************************************************//**
-Gets the high-order 32 bits of a dulint.
-@return 32 bits in ulint */
-UNIV_INLINE
-ulint
-ut_dulint_get_high(
-/*===============*/
- dulint d); /*!< in: dulint */
-/*******************************************************//**
-Gets the low-order 32 bits of a dulint.
-@return 32 bits in ulint */
-UNIV_INLINE
-ulint
-ut_dulint_get_low(
-/*==============*/
- dulint d); /*!< in: dulint */
-/*******************************************************//**
-Converts a dulint (a struct of 2 ulints) to ib_int64_t, which is a 64-bit
-integer type.
-@return value in ib_int64_t type */
-UNIV_INLINE
-ib_int64_t
-ut_conv_dulint_to_longlong(
-/*=======================*/
- dulint d); /*!< in: dulint */
-/*******************************************************//**
-Tests if a dulint is zero.
-@return TRUE if zero */
-UNIV_INLINE
-ibool
-ut_dulint_is_zero(
-/*==============*/
- dulint a); /*!< in: dulint */
-/*******************************************************//**
-Compares two dulints.
-@return -1 if a < b, 0 if a == b, 1 if a > b */
-UNIV_INLINE
-int
-ut_dulint_cmp(
-/*==========*/
- dulint a, /*!< in: dulint */
- dulint b); /*!< in: dulint */
-/*******************************************************//**
-Calculates the max of two dulints.
-@return max(a, b) */
-UNIV_INLINE
-dulint
-ut_dulint_get_max(
-/*==============*/
- dulint a, /*!< in: dulint */
- dulint b); /*!< in: dulint */
-/*******************************************************//**
-Calculates the min of two dulints.
-@return min(a, b) */
-UNIV_INLINE
-dulint
-ut_dulint_get_min(
-/*==============*/
- dulint a, /*!< in: dulint */
- dulint b); /*!< in: dulint */
-/*******************************************************//**
-Adds a ulint to a dulint.
-@return sum a + b */
-UNIV_INLINE
-dulint
-ut_dulint_add(
+ib_uint64_t
+ut_ull_create(
/*==========*/
- dulint a, /*!< in: dulint */
- ulint b); /*!< in: ulint */
-/*******************************************************//**
-Subtracts a ulint from a dulint.
-@return a - b */
-UNIV_INLINE
-dulint
-ut_dulint_subtract(
-/*===============*/
- dulint a, /*!< in: dulint */
- ulint b); /*!< in: ulint, b <= a */
-/*******************************************************//**
-Subtracts a dulint from another. NOTE that the difference must be positive
-and smaller that 4G.
-@return a - b */
-UNIV_INLINE
-ulint
-ut_dulint_minus(
-/*============*/
- dulint a, /*!< in: dulint; NOTE a must be >= b and at most
- 2 to power 32 - 1 greater */
- dulint b); /*!< in: dulint */
-/********************************************************//**
-Rounds a dulint downward to a multiple of a power of 2.
-@return rounded value */
-UNIV_INLINE
-dulint
-ut_dulint_align_down(
-/*=================*/
- dulint n, /*!< in: number to be rounded */
- ulint align_no); /*!< in: align by this number which must be a
- power of 2 */
-/********************************************************//**
-Rounds a dulint upward to a multiple of a power of 2.
-@return rounded value */
-UNIV_INLINE
-dulint
-ut_dulint_align_up(
-/*===============*/
- dulint n, /*!< in: number to be rounded */
- ulint align_no); /*!< in: align by this number which must be a
- power of 2 */
+ ulint high, /*!< in: high-order 32 bits */
+ ulint low) /*!< in: low-order 32 bits */
+ __attribute__((const));
+
/********************************************************//**
-Rounds a dulint downward to a multiple of a power of 2.
+Rounds a 64-bit integer downward to a multiple of a power of 2.
@return rounded value */
UNIV_INLINE
ib_uint64_t
@@ -184,34 +61,6 @@ ut_uint64_align_up(
ib_uint64_t n, /*!< in: number to be rounded */
ulint align_no); /*!< in: align by this number
which must be a power of 2 */
-/*******************************************************//**
-Increments a dulint variable by 1. */
-#define UT_DULINT_INC(D)\
-{\
- if ((D).low == 0xFFFFFFFFUL) {\
- (D).high = (D).high + 1;\
- (D).low = 0;\
- } else {\
- (D).low = (D).low + 1;\
- }\
-}
-/*******************************************************//**
-Tests if two dulints are equal. */
-#define UT_DULINT_EQ(D1, D2) (((D1).low == (D2).low)\
- && ((D1).high == (D2).high))
-#ifdef notdefined
-/************************************************************//**
-Sort function for dulint arrays. */
-UNIV_INTERN
-void
-ut_dulint_sort(
-/*===========*/
- dulint* arr, /*!< in/out: array to be sorted */
- dulint* aux_arr,/*!< in/out: auxiliary array (same size as arr) */
- ulint low, /*!< in: low bound of sort interval, inclusive */
- ulint high); /*!< in: high bound of sort interval, noninclusive */
-#endif /* notdefined */
-
/*********************************************************//**
The following function rounds up a pointer to the nearest aligned address.
@return aligned pointer */
diff --git a/storage/xtradb/include/ut0byte.ic b/storage/xtradb/include/ut0byte.ic
index 3dd51890cb4..e7908efa41a 100644
--- a/storage/xtradb/include/ut0byte.ic
+++ b/storage/xtradb/include/ut0byte.ic
@@ -24,260 +24,22 @@ Created 5/30/1994 Heikki Tuuri
*******************************************************************/
/*******************************************************//**
-Creates a 64-bit dulint out of two ulints.
+Creates a 64-bit integer out of two 32-bit integers.
@return created dulint */
UNIV_INLINE
-dulint
-ut_dulint_create(
-/*=============*/
+ib_uint64_t
+ut_ull_create(
+/*==========*/
ulint high, /*!< in: high-order 32 bits */
ulint low) /*!< in: low-order 32 bits */
{
- dulint res;
-
- ut_ad(high <= 0xFFFFFFFF);
- ut_ad(low <= 0xFFFFFFFF);
-
- res.high = high;
- res.low = low;
-
- return(res);
-}
-
-/*******************************************************//**
-Gets the high-order 32 bits of a dulint.
-@return 32 bits in ulint */
-UNIV_INLINE
-ulint
-ut_dulint_get_high(
-/*===============*/
- dulint d) /*!< in: dulint */
-{
- return(d.high);
-}
-
-/*******************************************************//**
-Gets the low-order 32 bits of a dulint.
-@return 32 bits in ulint */
-UNIV_INLINE
-ulint
-ut_dulint_get_low(
-/*==============*/
- dulint d) /*!< in: dulint */
-{
- return(d.low);
-}
-
-/*******************************************************//**
-Converts a dulint (a struct of 2 ulints) to ib_int64_t, which is a 64-bit
-integer type.
-@return value in ib_int64_t type */
-UNIV_INLINE
-ib_int64_t
-ut_conv_dulint_to_longlong(
-/*=======================*/
- dulint d) /*!< in: dulint */
-{
- return((ib_int64_t)d.low
- + (((ib_int64_t)d.high) << 32));
-}
-
-/*******************************************************//**
-Tests if a dulint is zero.
-@return TRUE if zero */
-UNIV_INLINE
-ibool
-ut_dulint_is_zero(
-/*==============*/
- dulint a) /*!< in: dulint */
-{
- if ((a.low == 0) && (a.high == 0)) {
-
- return(TRUE);
- }
-
- return(FALSE);
-}
-
-/*******************************************************//**
-Compares two dulints.
-@return -1 if a < b, 0 if a == b, 1 if a > b */
-UNIV_INLINE
-int
-ut_dulint_cmp(
-/*==========*/
- dulint a, /*!< in: dulint */
- dulint b) /*!< in: dulint */
-{
- if (a.high > b.high) {
- return(1);
- } else if (a.high < b.high) {
- return(-1);
- } else if (a.low > b.low) {
- return(1);
- } else if (a.low < b.low) {
- return(-1);
- } else {
- return(0);
- }
-}
-
-/*******************************************************//**
-Calculates the max of two dulints.
-@return max(a, b) */
-UNIV_INLINE
-dulint
-ut_dulint_get_max(
-/*==============*/
- dulint a, /*!< in: dulint */
- dulint b) /*!< in: dulint */
-{
- if (ut_dulint_cmp(a, b) > 0) {
-
- return(a);
- }
-
- return(b);
-}
-
-/*******************************************************//**
-Calculates the min of two dulints.
-@return min(a, b) */
-UNIV_INLINE
-dulint
-ut_dulint_get_min(
-/*==============*/
- dulint a, /*!< in: dulint */
- dulint b) /*!< in: dulint */
-{
- if (ut_dulint_cmp(a, b) > 0) {
-
- return(b);
- }
-
- return(a);
-}
-
-/*******************************************************//**
-Adds a ulint to a dulint.
-@return sum a + b */
-UNIV_INLINE
-dulint
-ut_dulint_add(
-/*==========*/
- dulint a, /*!< in: dulint */
- ulint b) /*!< in: ulint */
-{
- if (0xFFFFFFFFUL - b >= a.low) {
- a.low += b;
-
- return(a);
- }
-
- a.low = a.low - (0xFFFFFFFFUL - b) - 1;
-
- a.high++;
-
- return(a);
-}
-
-/*******************************************************//**
-Subtracts a ulint from a dulint.
-@return a - b */
-UNIV_INLINE
-dulint
-ut_dulint_subtract(
-/*===============*/
- dulint a, /*!< in: dulint */
- ulint b) /*!< in: ulint, b <= a */
-{
- if (a.low >= b) {
- a.low -= b;
-
- return(a);
- }
-
- b -= a.low + 1;
-
- a.low = 0xFFFFFFFFUL - b;
-
- ut_ad(a.high > 0);
-
- a.high--;
-
- return(a);
-}
-
-/*******************************************************//**
-Subtracts a dulint from another. NOTE that the difference must be positive
-and smaller that 4G.
-@return a - b */
-UNIV_INLINE
-ulint
-ut_dulint_minus(
-/*============*/
- dulint a, /*!< in: dulint; NOTE a must be >= b and at most
- 2 to power 32 - 1 greater */
- dulint b) /*!< in: dulint */
-{
- ulint diff;
-
- if (a.high == b.high) {
- ut_ad(a.low >= b.low);
-
- return(a.low - b.low);
- }
-
- ut_ad(a.high == b.high + 1);
-
- diff = (ulint)(0xFFFFFFFFUL - b.low);
- diff += 1 + a.low;
-
- ut_ad(diff > a.low);
-
- return(diff);
-}
-
-/********************************************************//**
-Rounds a dulint downward to a multiple of a power of 2.
-@return rounded value */
-UNIV_INLINE
-dulint
-ut_dulint_align_down(
-/*=================*/
- dulint n, /*!< in: number to be rounded */
- ulint align_no) /*!< in: align by this number which must be a
- power of 2 */
-{
- ulint low, high;
-
- ut_ad(align_no > 0);
- ut_ad(((align_no - 1) & align_no) == 0);
-
- low = ut_dulint_get_low(n);
- high = ut_dulint_get_high(n);
-
- low = low & ~(align_no - 1);
-
- return(ut_dulint_create(high, low));
-}
-
-/********************************************************//**
-Rounds a dulint upward to a multiple of a power of 2.
-@return rounded value */
-UNIV_INLINE
-dulint
-ut_dulint_align_up(
-/*===============*/
- dulint n, /*!< in: number to be rounded */
- ulint align_no) /*!< in: align by this number which must be a
- power of 2 */
-{
- return(ut_dulint_align_down(ut_dulint_add(n, align_no - 1), align_no));
+ ut_ad(high <= ULINT32_MASK);
+ ut_ad(low <= ULINT32_MASK);
+ return(((ib_uint64_t) high) << 32 | low);
}
/********************************************************//**
-Rounds ib_uint64_t downward to a multiple of a power of 2.
+Rounds a 64-bit integer downward to a multiple of a power of 2.
@return rounded value */
UNIV_INLINE
ib_uint64_t
diff --git a/storage/xtradb/include/ut0dbg.h b/storage/xtradb/include/ut0dbg.h
index 78b525c38ab..07730176d81 100644
--- a/storage/xtradb/include/ut0dbg.h
+++ b/storage/xtradb/include/ut0dbg.h
@@ -50,33 +50,23 @@ UNIV_INTERN
void
ut_dbg_assertion_failed(
/*====================*/
- const char* expr, /*!< in: the failed assertion */
- const char* file, /*!< in: source file containing the assertion */
- ulint line); /*!< in: line number of the assertion */
-
-#ifdef __NETWARE__
-/** Flag for ignoring further assertion failures. This is set to TRUE
-when on NetWare there happens an InnoDB assertion failure or other
-fatal error condition that requires an immediate shutdown. */
-extern ibool panic_shutdown;
-/* Abort the execution. */
-void ut_dbg_panic(void);
-# define UT_DBG_PANIC ut_dbg_panic()
-/* Stop threads in ut_a(). */
-# define UT_DBG_STOP do {} while (0) /* We do not do this on NetWare */
-#else /* __NETWARE__ */
-# if defined(__WIN__) || defined(__INTEL_COMPILER)
-# undef UT_DBG_USE_ABORT
-# elif defined(__GNUC__) && (__GNUC__ > 2)
-# define UT_DBG_USE_ABORT
-# endif
-
-# ifndef UT_DBG_USE_ABORT
+ const char* expr, /*!< in: the failed assertion */
+ const char* file, /*!< in: source file containing the assertion */
+ ulint line) /*!< in: line number of the assertion */
+ UNIV_COLD __attribute__((nonnull(2)));
+
+#if defined(__WIN__) || defined(__INTEL_COMPILER)
+# undef UT_DBG_USE_ABORT
+#elif defined(__GNUC__) && (__GNUC__ > 2)
+# define UT_DBG_USE_ABORT
+#endif
+
+#ifndef UT_DBG_USE_ABORT
/** A null pointer that will be dereferenced to trigger a memory trap */
extern ulint* ut_dbg_null_ptr;
-# endif
+#endif
-# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
+#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
/** If this is set to TRUE by ut_dbg_assertion_failed(), all threads
will stop at the next ut_a() or ut_ad(). */
extern ibool ut_dbg_stop_threads;
@@ -89,24 +79,23 @@ ut_dbg_stop_thread(
/*===============*/
const char* file,
ulint line);
-# endif
+#endif
-# ifdef UT_DBG_USE_ABORT
+#ifdef UT_DBG_USE_ABORT
/** Abort the execution. */
-# define UT_DBG_PANIC abort()
+# define UT_DBG_PANIC abort()
/** Stop threads (null operation) */
-# define UT_DBG_STOP do {} while (0)
-# else /* UT_DBG_USE_ABORT */
+# define UT_DBG_STOP do {} while (0)
+#else /* UT_DBG_USE_ABORT */
/** Abort the execution. */
-# define UT_DBG_PANIC \
+# define UT_DBG_PANIC \
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL
/** Stop threads in ut_a(). */
-# define UT_DBG_STOP do \
+# define UT_DBG_STOP do \
if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \
ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \
} while (0)
-# endif /* UT_DBG_USE_ABORT */
-#endif /* __NETWARE__ */
+#endif /* UT_DBG_USE_ABORT */
/** Abort execution if EXPR does not evaluate to nonzero.
@param EXPR assertion expression that should hold */
diff --git a/storage/xtradb/include/ut0lst.h b/storage/xtradb/include/ut0lst.h
index 245dfc226c3..49756bc9f13 100644
--- a/storage/xtradb/include/ut0lst.h
+++ b/storage/xtradb/include/ut0lst.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. 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
@@ -110,7 +110,7 @@ Adds the node as the last element in a two-way linked list.
*/
#define UT_LIST_ADD_LAST(NAME, BASE, N)\
{\
- ut_ad(N);\
+ ut_ad(N != NULL);\
((BASE).count)++;\
((N)->NAME).prev = (BASE).end;\
((N)->NAME).next = NULL;\
@@ -257,48 +257,5 @@ do { \
ut_a(ut_list_node_313 == NULL); \
} while (0)
-/********************************************************************//**
-Align nodes with moving location.
-@param NAME the name of the list
-@param TYPE node type
-@param BASE base node (not a pointer to it)
-@param OFFSET offset moved */
-#define UT_LIST_OFFSET(NAME, TYPE, BASE, FADDR, FOFFSET, BOFFSET) \
-do { \
- ulint ut_list_i_313; \
- TYPE* ut_list_node_313; \
- \
- if ((BASE).start) \
- (BASE).start = (void*)((byte*)((BASE).start) \
- + (((void*)((BASE).start) > (void*)FADDR)?FOFFSET:BOFFSET));\
- if ((BASE).end) \
- (BASE).end = (void*)((byte*)((BASE).end) \
- + (((void*)((BASE).end) > (void*)FADDR)?FOFFSET:BOFFSET));\
- \
- ut_list_node_313 = (BASE).start; \
- \
- for (ut_list_i_313 = (BASE).count; ut_list_i_313--; ) { \
- ut_a(ut_list_node_313); \
- if ((ut_list_node_313->NAME).prev) \
- (ut_list_node_313->NAME).prev = (void*)((byte*)((ut_list_node_313->NAME).prev)\
- + (((void*)((ut_list_node_313->NAME).prev) > (void*)FADDR)?FOFFSET:BOFFSET));\
- if ((ut_list_node_313->NAME).next) \
- (ut_list_node_313->NAME).next = (void*)((byte*)((ut_list_node_313->NAME).next)\
- + (((void*)((ut_list_node_313->NAME).next)> (void*)FADDR)?FOFFSET:BOFFSET));\
- ut_list_node_313 = (ut_list_node_313->NAME).next; \
- } \
- \
- ut_a(ut_list_node_313 == NULL); \
- \
- ut_list_node_313 = (BASE).end; \
- \
- for (ut_list_i_313 = (BASE).count; ut_list_i_313--; ) { \
- ut_a(ut_list_node_313); \
- ut_list_node_313 = (ut_list_node_313->NAME).prev; \
- } \
- \
- ut_a(ut_list_node_313 == NULL); \
-} while (0)
-
#endif
diff --git a/storage/xtradb/include/ut0mem.h b/storage/xtradb/include/ut0mem.h
index f14606be966..57dfb08f41c 100644
--- a/storage/xtradb/include/ut0mem.h
+++ b/storage/xtradb/include/ut0mem.h
@@ -119,7 +119,7 @@ UNIV_INTERN
void
ut_free(
/*====*/
- void* ptr); /*!< in, own: memory block */
+ void* ptr); /*!< in, own: memory block, can be NULL */
#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Implements realloc. This is needed by /pars/lexyy.c. Otherwise, you should not
diff --git a/storage/xtradb/include/ut0rbt.h b/storage/xtradb/include/ut0rbt.h
index 6fd050acfe7..e26b637ae13 100644
--- a/storage/xtradb/include/ut0rbt.h
+++ b/storage/xtradb/include/ut0rbt.h
@@ -1,5 +1,12 @@
-/*****************************************************************************
-Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
+/***************************************************************************//**
+
+Copyright (c) 2007, 2010, Innobase Oy. All Rights Reserved.
+
+Portions of this file contain modifications contributed and copyrighted by
+Sun Microsystems, Inc. Those modifications are gratefully acknowledged and
+are described briefly in the InnoDB documentation. The contributions by
+Sun Microsystems are incorporated with their permission, and subject to the
+conditions contained in the file COPYING.Sun_Microsystems.
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
@@ -14,13 +21,12 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-
-/*******************************************************************//**
+/******************************************************************//**
@file include/ut0rbt.h
-Red-Black tree implementation.
+Various utilities
Created 2007-03-20 Sunny Bains
-************************************************************************/
+*******************************************************/
#ifndef INNOBASE_UT0RBT_H
#define INNOBASE_UT0RBT_H
@@ -52,7 +58,7 @@ typedef struct ib_rbt_bound_struct ib_rbt_bound_t;
typedef void (*ib_rbt_print_node)(const ib_rbt_node_t* node);
typedef int (*ib_rbt_compare)(const void* p1, const void* p2);
-/* Red black tree color types */
+/** Red black tree color types */
enum ib_rbt_color_enum {
IB_RBT_RED,
IB_RBT_BLACK
@@ -60,7 +66,7 @@ enum ib_rbt_color_enum {
typedef enum ib_rbt_color_enum ib_rbt_color_t;
-/* Red black tree node */
+/** Red black tree node */
struct ib_rbt_node_struct {
ib_rbt_color_t color; /* color of this node */
@@ -71,7 +77,7 @@ struct ib_rbt_node_struct {
char value[1]; /* Data value */
};
-/* Red black tree instance.*/
+/** Red black tree instance.*/
struct ib_rbt_struct {
ib_rbt_node_t* nil; /* Black colored node that is
used as a sentinel. This is
@@ -87,7 +93,7 @@ struct ib_rbt_struct {
ulint sizeof_value; /* Sizeof the item in bytes */
};
-/* The result of searching for a key in the tree, this is useful for
+/** The result of searching for a key in the tree, this is useful for
a speedy lookup and insert if key doesn't exist.*/
struct ib_rbt_bound_struct {
const ib_rbt_node_t*
@@ -110,131 +116,132 @@ struct ib_rbt_bound_struct {
/* Compare a key with the node value (t is tree, k is key, n is node)*/
#define rbt_compare(t, k, n) (t->compare(k, n->value))
-/****************************************************************//**
+/**********************************************************************//**
Free an instance of a red black tree */
UNIV_INTERN
void
rbt_free(
/*=====*/
- ib_rbt_t* tree); /*!< in: rb tree to free */
-/****************************************************************//**
+ ib_rbt_t* tree); /*!< in: rb tree to free */
+/**********************************************************************//**
Create an instance of a red black tree
@return rb tree instance */
UNIV_INTERN
ib_rbt_t*
rbt_create(
/*=======*/
- size_t sizeof_value, /*!< in: size in bytes */
- ib_rbt_compare compare); /*!< in: comparator */
-/****************************************************************//**
-Delete a node from the red black tree, identified by key.
-@return TRUE if success FALSE if not found */
+ size_t sizeof_value, /*!< in: size in bytes */
+ ib_rbt_compare compare); /*!< in: comparator */
+/**********************************************************************//**
+Delete a node from the red black tree, identified by key */
UNIV_INTERN
ibool
rbt_delete(
/*=======*/
- ib_rbt_t* tree, /*!< in: rb tree */
- const void* key); /*!< in: key to delete */
-/****************************************************************//**
-Remove a node from the rb tree, the node is not free'd, that is the
-callers responsibility.
+ /* in: TRUE on success */
+ ib_rbt_t* tree, /* in: rb tree */
+ const void* key); /* in: key to delete */
+/**********************************************************************//**
+Remove a node from the red black tree, NOTE: This function will not delete
+the node instance, THAT IS THE CALLERS RESPONSIBILITY.
@return the deleted node with the const. */
UNIV_INTERN
ib_rbt_node_t*
rbt_remove_node(
/*============*/
- ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_t* tree, /*!< in: rb tree */
const ib_rbt_node_t*
- node); /*!< in: node to delete, this
- is a fudge and declared const
- because the caller has access
- only to const nodes.*/
-/****************************************************************//**
-Find a matching node in the rb tree.
+ node); /*!< in: node to delete, this
+ is a fudge and declared const
+ because the caller has access
+ only to const nodes.*/
+/**********************************************************************//**
+Return a node from the red black tree, identified by
+key, NULL if not found
@return node if found else return NULL */
UNIV_INTERN
const ib_rbt_node_t*
rbt_lookup(
/*=======*/
- const ib_rbt_t* tree, /*!< in: rb tree to search */
- const void* key); /*!< in: key to lookup */
-/****************************************************************//**
-Generic insert of a value in the rb tree.
+ const ib_rbt_t* tree, /*!< in: rb tree to search */
+ const void* key); /*!< in: key to lookup */
+/**********************************************************************//**
+Add data to the red black tree, identified by key (no dups yet!)
@return inserted node */
UNIV_INTERN
const ib_rbt_node_t*
rbt_insert(
/*=======*/
- ib_rbt_t* tree, /*!< in: rb tree */
- const void* key, /*!< in: key for ordering */
- const void* value); /*!< in: data that will be
- copied to the node.*/
-/****************************************************************//**
+ ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key, /*!< in: key for ordering */
+ const void* value); /*!< in: data that will be
+ copied to the node.*/
+/**********************************************************************//**
Add a new node to the tree, useful for data that is pre-sorted.
@return appended node */
UNIV_INTERN
const ib_rbt_node_t*
rbt_add_node(
/*=========*/
- ib_rbt_t* tree, /*!< in: rb tree */
- ib_rbt_bound_t* parent, /*!< in: parent */
- const void* value); /*!< in: this value is copied
- to the node */
-/****************************************************************//**
+ ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: parent */
+ const void* value); /*!< in: this value is copied
+ to the node */
+/**********************************************************************//**
Return the left most data node in the tree
@return left most node */
UNIV_INTERN
const ib_rbt_node_t*
rbt_first(
/*======*/
- const ib_rbt_t* tree); /*!< in: rb tree */
-/****************************************************************//**
+ const ib_rbt_t* tree); /*!< in: rb tree */
+/**********************************************************************//**
Return the right most data node in the tree
@return right most node */
UNIV_INTERN
const ib_rbt_node_t*
rbt_last(
/*=====*/
- const ib_rbt_t* tree); /*!< in: rb tree */
-/****************************************************************//**
+ const ib_rbt_t* tree); /*!< in: rb tree */
+/**********************************************************************//**
Return the next node from current.
@return successor node to current that is passed in. */
UNIV_INTERN
const ib_rbt_node_t*
rbt_next(
/*=====*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- const ib_rbt_node_t* /*!< in: current node */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* /* in: current node */
current);
-/****************************************************************//**
+/**********************************************************************//**
Return the prev node from current.
@return precedessor node to current that is passed in */
UNIV_INTERN
const ib_rbt_node_t*
rbt_prev(
/*=====*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- const ib_rbt_node_t* /*!< in: current node */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* /* in: current node */
current);
-/****************************************************************//**
+/**********************************************************************//**
Find the node that has the lowest key that is >= key.
@return node that satisfies the lower bound constraint or NULL */
UNIV_INTERN
const ib_rbt_node_t*
rbt_lower_bound(
/*============*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- const void* key); /*!< in: key to search */
-/****************************************************************//**
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key); /*!< in: key to search */
+/**********************************************************************//**
Find the node that has the greatest key that is <= key.
@return node that satisifies the upper bound constraint or NULL */
UNIV_INTERN
const ib_rbt_node_t*
rbt_upper_bound(
/*============*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- const void* key); /*!< in: key to search */
-/****************************************************************//**
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key); /*!< in: key to search */
+/**********************************************************************//**
Search for the key, a node will be retuned in parent.last, whether it
was found or not. If not found then parent.last will contain the
parent node for the possibly new key otherwise the matching node.
@@ -243,10 +250,10 @@ UNIV_INTERN
int
rbt_search(
/*=======*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- ib_rbt_bound_t* parent, /*!< in: search bounds */
- const void* key); /*!< in: key to search */
-/****************************************************************//**
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: search bounds */
+ const void* key); /*!< in: key to search */
+/**********************************************************************//**
Search for the key, a node will be retuned in parent.last, whether it
was found or not. If not found then parent.last will contain the
parent node for the possibly new key otherwise the matching node.
@@ -255,27 +262,27 @@ UNIV_INTERN
int
rbt_search_cmp(
/*===========*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- ib_rbt_bound_t* parent, /*!< in: search bounds */
- const void* key, /*!< in: key to search */
- ib_rbt_compare compare); /*!< in: comparator */
-/****************************************************************//**
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: search bounds */
+ const void* key, /*!< in: key to search */
+ ib_rbt_compare compare); /*!< in: comparator */
+/**********************************************************************//**
Clear the tree, deletes (and free's) all the nodes. */
UNIV_INTERN
void
rbt_clear(
/*======*/
- ib_rbt_t* tree); /*!< in: rb tree */
-/****************************************************************//**
+ ib_rbt_t* tree); /*!< in: rb tree */
+/**********************************************************************//**
Merge the node from dst into src. Return the number of nodes merged.
@return no. of recs merged */
UNIV_INTERN
ulint
rbt_merge_uniq(
/*===========*/
- ib_rbt_t* dst, /*!< in: dst rb tree */
- const ib_rbt_t* src); /*!< in: src rb tree */
-/****************************************************************//**
+ ib_rbt_t* dst, /*!< in: dst rb tree */
+ const ib_rbt_t* src); /*!< in: src rb tree */
+/**********************************************************************//**
Merge the node from dst into src. Return the number of nodes merged.
Delete the nodes from src after copying node to dst. As a side effect
the duplicates will be left untouched in the src, since we don't support
@@ -286,9 +293,9 @@ UNIV_INTERN
ulint
rbt_merge_uniq_destructive(
/*=======================*/
- ib_rbt_t* dst, /*!< in: dst rb tree */
- ib_rbt_t* src); /*!< in: src rb tree */
-/****************************************************************//**
+ ib_rbt_t* dst, /*!< in: dst rb tree */
+ ib_rbt_t* src); /*!< in: src rb tree */
+/**********************************************************************//**
Verify the integrity of the RB tree. For debugging. 0 failure else height
of tree (in count of black nodes).
@return TRUE if OK FALSE if tree invalid. */
@@ -296,14 +303,14 @@ UNIV_INTERN
ibool
rbt_validate(
/*=========*/
- const ib_rbt_t* tree); /*!< in: tree to validate */
-/****************************************************************//**
+ const ib_rbt_t* tree); /*!< in: tree to validate */
+/**********************************************************************//**
Iterate over the tree in depth first order. */
UNIV_INTERN
void
rbt_print(
/*======*/
- const ib_rbt_t* tree, /*!< in: tree to traverse */
- ib_rbt_print_node print); /*!< in: print function */
+ const ib_rbt_t* tree, /*!< in: tree to traverse */
+ ib_rbt_print_node print); /*!< in: print function */
#endif /* INNOBASE_UT0RBT_H */
diff --git a/storage/xtradb/include/ut0rnd.h b/storage/xtradb/include/ut0rnd.h
index ad55df40abc..9c53101198d 100644
--- a/storage/xtradb/include/ut0rnd.h
+++ b/storage/xtradb/include/ut0rnd.h
@@ -97,13 +97,13 @@ ut_fold_ulint_pair(
ulint n2) /*!< in: ulint */
__attribute__((const));
/*************************************************************//**
-Folds a dulint.
+Folds a 64-bit integer.
@return folded value */
UNIV_INLINE
ulint
-ut_fold_dulint(
-/*===========*/
- dulint d) /*!< in: dulint */
+ut_fold_ull(
+/*========*/
+ ib_uint64_t d) /*!< in: 64-bit integer */
__attribute__((const));
/*************************************************************//**
Folds a character string ending in the null character.
diff --git a/storage/xtradb/include/ut0rnd.ic b/storage/xtradb/include/ut0rnd.ic
index c2043660efd..2c8c959d804 100644
--- a/storage/xtradb/include/ut0rnd.ic
+++ b/storage/xtradb/include/ut0rnd.ic
@@ -85,9 +85,6 @@ ut_rnd_gen_ulint(void)
/*==================*/
{
ulint rnd;
- ulint n_bits;
-
- n_bits = 8 * sizeof(ulint);
ut_rnd_ulint_counter = UT_RND1 * ut_rnd_ulint_counter + UT_RND2;
@@ -173,16 +170,16 @@ ut_fold_ulint_pair(
}
/*************************************************************//**
-Folds a dulint.
+Folds a 64-bit integer.
@return folded value */
UNIV_INLINE
ulint
-ut_fold_dulint(
-/*===========*/
- dulint d) /*!< in: dulint */
+ut_fold_ull(
+/*========*/
+ ib_uint64_t d) /*!< in: 64-bit integer */
{
- return(ut_fold_ulint_pair(ut_dulint_get_low(d),
- ut_dulint_get_high(d)));
+ return(ut_fold_ulint_pair((ulint) d & ULINT32_MASK,
+ (ulint) (d >> 32)));
}
/*************************************************************//**
diff --git a/storage/xtradb/include/ut0ut.h b/storage/xtradb/include/ut0ut.h
index 197b8401428..cad39e9a34f 100644
--- a/storage/xtradb/include/ut0ut.h
+++ b/storage/xtradb/include/ut0ut.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Sun Microsystems, Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -35,6 +35,8 @@ Created 1/20/1994 Heikki Tuuri
#include "univ.i"
+#include "db0err.h"
+
#ifndef UNIV_HOTBACKUP
# include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
#endif /* UNIV_HOTBACKUP */
@@ -53,24 +55,24 @@ Created 1/20/1994 Heikki Tuuri
typedef time_t ib_time_t;
#ifndef UNIV_HOTBACKUP
-#if defined(HAVE_IB_PAUSE_INSTRUCTION)
-# ifdef WIN32
- /* In the Win32 API, the x86 PAUSE instruction is executed by calling
- the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
- independent way by using YieldProcessor.*/
-# define UT_RELAX_CPU() YieldProcessor()
-# else
- /* According to the gcc info page, asm volatile means that the
- instruction has important side-effects and must not be removed.
- Also asm volatile may trigger a memory barrier (spilling all registers
- to memory). */
-# define UT_RELAX_CPU() __asm__ __volatile__ ("pause")
-# endif
+#if defined(HAVE_PAUSE_INSTRUCTION)
+ /* According to the gcc info page, asm volatile means that the
+ instruction has important side-effects and must not be removed.
+ Also asm volatile may trigger a memory barrier (spilling all registers
+ to memory). */
+# define UT_RELAX_CPU() __asm__ __volatile__ ("pause")
+#elif defined(HAVE_FAKE_PAUSE_INSTRUCTION)
+# define UT_RELAX_CPU() __asm__ __volatile__ ("rep; nop")
#elif defined(HAVE_ATOMIC_BUILTINS)
# define UT_RELAX_CPU() do { \
volatile lint volatile_var; \
os_compare_and_swap_lint(&volatile_var, 0, 1); \
} while (0)
+#elif defined(HAVE_WINDOWS_ATOMICS)
+ /* In the Win32 API, the x86 PAUSE instruction is executed by calling
+ the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
+ independent way by using YieldProcessor. */
+# define UT_RELAX_CPU() YieldProcessor()
#else
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
#endif
@@ -273,7 +275,8 @@ UNIV_INTERN
void
ut_print_timestamp(
/*===============*/
- FILE* file); /*!< in: file where to print */
+ FILE* file) /*!< in: file where to print */
+ UNIV_COLD __attribute__((nonnull));
/**********************************************************//**
Sprintfs a timestamp to a buffer, 13..14 chars plus terminating NUL. */
UNIV_INTERN
@@ -395,6 +398,16 @@ a limited buffer. */
# define ut_snprintf snprintf
#endif /* __WIN__ */
+/*************************************************************//**
+Convert an error number to a human readable text message. The
+returned string is static and should not be freed or modified.
+@return string, describing the error */
+UNIV_INTERN
+const char*
+ut_strerr(
+/*======*/
+ enum db_err num); /*!< in: error number */
+
#ifndef UNIV_NONINL
#include "ut0ut.ic"
#endif
diff --git a/storage/xtradb/include/ut0vec.h b/storage/xtradb/include/ut0vec.h
index a770f671cfc..0f8b955b098 100644
--- a/storage/xtradb/include/ut0vec.h
+++ b/storage/xtradb/include/ut0vec.h
@@ -94,6 +94,25 @@ ib_vector_get(
ulint n); /*!< in: element index to get */
/****************************************************************//**
+Get last element. The vector must not be empty.
+@return last element */
+UNIV_INLINE
+void*
+ib_vector_get_last(
+/*===============*/
+ ib_vector_t* vec); /*!< in: vector */
+
+/****************************************************************//**
+Set the n'th element. */
+UNIV_INLINE
+void
+ib_vector_set(
+/*==========*/
+ ib_vector_t* vec, /*!< in/out: vector */
+ ulint n, /*!< in: element index to set */
+ void* elem); /*!< in: data element */
+
+/****************************************************************//**
Remove the last element from the vector. */
UNIV_INLINE
void*
diff --git a/storage/xtradb/include/ut0vec.ic b/storage/xtradb/include/ut0vec.ic
index 02e881f9bca..34c858868ce 100644
--- a/storage/xtradb/include/ut0vec.ic
+++ b/storage/xtradb/include/ut0vec.ic
@@ -51,6 +51,35 @@ ib_vector_get(
}
/****************************************************************//**
+Get last element. The vector must not be empty.
+@return last element */
+UNIV_INLINE
+void*
+ib_vector_get_last(
+/*===============*/
+ ib_vector_t* vec) /*!< in: vector */
+{
+ ut_a(vec->used > 0);
+
+ return(vec->data[vec->used - 1]);
+}
+
+/****************************************************************//**
+Set the n'th element. */
+UNIV_INLINE
+void
+ib_vector_set(
+/*==========*/
+ ib_vector_t* vec, /*!< in/out: vector */
+ ulint n, /*!< in: element index to set */
+ void* elem) /*!< in: data element */
+{
+ ut_a(n < vec->used);
+
+ vec->data[n] = elem;
+}
+
+/****************************************************************//**
Remove the last element from the vector.
@return last vector element */
UNIV_INLINE
diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c
index 1ded67d9147..0fcbee32454 100644
--- a/storage/xtradb/lock/lock0lock.c
+++ b/storage/xtradb/lock/lock0lock.c
@@ -359,10 +359,8 @@ static
ibool
lock_rec_validate_page(
/*===================*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no);/*!< in: page number */
+ const buf_block_t* block) /*!< in: buffer block */
+ __attribute__((nonnull, warn_unused_result));
#endif /* UNIV_DEBUG */
/* The lock system */
@@ -468,7 +466,7 @@ lock_check_trx_id_sanity(
/* A sanity check: the trx_id in rec must be smaller than the global
trx id counter */
- if (ut_dulint_cmp(trx_id, trx_sys->max_trx_id) >= 0) {
+ if (UNIV_UNLIKELY(trx_id >= trx_sys->max_trx_id)) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: transaction id associated"
" with record\n",
@@ -481,8 +479,7 @@ lock_check_trx_id_sanity(
" global trx id counter " TRX_ID_FMT "!\n"
"InnoDB: The table is corrupt. You have to do"
" dump + drop + reimport.\n",
- TRX_ID_PREP_PRINTF(trx_id),
- TRX_ID_PREP_PRINTF(trx_sys->max_trx_id));
+ (ullint) trx_id, (ullint) trx_sys->max_trx_id);
is_ok = FALSE;
}
@@ -556,9 +553,9 @@ lock_sec_rec_cons_read_sees(
}
max_trx_id = page_get_max_trx_id(page_align(rec));
- ut_ad(!ut_dulint_is_zero(max_trx_id));
+ ut_ad(max_trx_id);
- return(ut_dulint_cmp(max_trx_id, view->up_limit_id) < 0);
+ return(max_trx_id < view->up_limit_id);
}
/*********************************************************************//**
@@ -572,6 +569,7 @@ lock_sys_create(
lock_sys = mem_alloc(sizeof(lock_sys_t));
lock_sys->rec_hash = hash_create(n_cells);
+ lock_sys->rec_num = 0;
/* hash_create_mutexes(lock_sys->rec_hash, 2, SYNC_REC_LOCK); */
@@ -1101,10 +1099,10 @@ lock_rec_reset_nth_bit(
Gets the first or next record lock on a page.
@return next lock, NULL if none exists */
UNIV_INLINE
-lock_t*
-lock_rec_get_next_on_page(
-/*======================*/
- lock_t* lock) /*!< in: a record lock */
+const lock_t*
+lock_rec_get_next_on_page_const(
+/*============================*/
+ const lock_t* lock) /*!< in: a record lock */
{
ulint space;
ulint page_no;
@@ -1134,6 +1132,18 @@ lock_rec_get_next_on_page(
}
/*********************************************************************//**
+Gets the first or next record lock on a page.
+@return next lock, NULL if none exists */
+UNIV_INLINE
+lock_t*
+lock_rec_get_next_on_page(
+/*======================*/
+ lock_t* lock) /*!< in: a record lock */
+{
+ return((lock_t*) lock_rec_get_next_on_page_const(lock));
+}
+
+/*********************************************************************//**
Gets the first record lock on a page, where the page is identified by its
file address.
@return first lock, NULL if none exists */
@@ -1594,8 +1604,7 @@ lock_sec_rec_some_has_impl_off_kernel(
max trx id to the log, and therefore during recovery, this value
for a page may be incorrect. */
- if (!(ut_dulint_cmp(page_get_max_trx_id(page),
- trx_list_get_min_trx_id()) >= 0)
+ if (page_get_max_trx_id(page) < trx_list_get_min_trx_id()
&& !recv_recovery_is_on()) {
return(NULL);
@@ -1624,7 +1633,7 @@ UNIV_INTERN
ulint
lock_number_of_rows_locked(
/*=======================*/
- trx_t* trx) /*!< in: transaction */
+ const trx_t* trx) /*!< in: transaction */
{
lock_t* lock;
ulint n_records = 0;
@@ -1721,6 +1730,7 @@ lock_rec_create(
HASH_INSERT(lock_t, hash, lock_sys->rec_hash,
lock_rec_fold(space, page_no), lock);
+ lock_sys->rec_num++;
if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) {
lock_set_lock_and_trx_wait(lock, trx);
@@ -1826,8 +1836,8 @@ lock_rec_enqueue_waiting(
#ifdef UNIV_DEBUG
if (lock_print_waits) {
- fprintf(stderr, "Lock wait for trx %lu in index ",
- (ulong) ut_dulint_get_low(trx->id));
+ fprintf(stderr, "Lock wait for trx " TRX_ID_FMT " in index ",
+ (ullint) trx->id);
ut_print_name(stderr, trx, FALSE, index->name);
}
#endif /* UNIV_DEBUG */
@@ -2199,8 +2209,8 @@ lock_grant(
#ifdef UNIV_DEBUG
if (lock_print_waits) {
- fprintf(stderr, "Lock wait for trx %lu ends\n",
- (ulong) ut_dulint_get_low(lock->trx->id));
+ fprintf(stderr, "Lock wait for trx " TRX_ID_FMT " ends\n",
+ (ullint) lock->trx->id);
}
#endif /* UNIV_DEBUG */
@@ -2267,6 +2277,7 @@ lock_rec_dequeue_from_page(
HASH_DELETE(lock_t, hash, lock_sys->rec_hash,
lock_rec_fold(space, page_no), in_lock);
+ lock_sys->rec_num--;
UT_LIST_REMOVE(trx_locks, trx->trx_locks, in_lock);
@@ -2310,6 +2321,7 @@ lock_rec_discard(
HASH_DELETE(lock_t, hash, lock_sys->rec_hash,
lock_rec_fold(space, page_no), in_lock);
+ lock_sys->rec_num--;
UT_LIST_REMOVE(trx_locks, trx->trx_locks, in_lock);
}
@@ -2653,9 +2665,7 @@ lock_move_reorganize_page(
mem_heap_free(heap);
#ifdef UNIV_DEBUG_LOCK_VALIDATE
- ut_ad(lock_rec_validate_page(buf_block_get_space(block),
- buf_block_get_zip_size(block),
- buf_block_get_page_no(block)));
+ ut_ad(lock_rec_validate_page(block));
#endif
}
@@ -2743,12 +2753,8 @@ lock_move_rec_list_end(
lock_mutex_exit_kernel();
#ifdef UNIV_DEBUG_LOCK_VALIDATE
- ut_ad(lock_rec_validate_page(buf_block_get_space(block),
- buf_block_get_zip_size(block),
- buf_block_get_page_no(block)));
- ut_ad(lock_rec_validate_page(buf_block_get_space(new_block),
- buf_block_get_zip_size(block),
- buf_block_get_page_no(new_block)));
+ ut_ad(lock_rec_validate_page(block));
+ ut_ad(lock_rec_validate_page(new_block));
#endif
}
@@ -2856,9 +2862,7 @@ lock_move_rec_list_start(
lock_mutex_exit_kernel();
#ifdef UNIV_DEBUG_LOCK_VALIDATE
- ut_ad(lock_rec_validate_page(buf_block_get_space(block),
- buf_block_get_zip_size(block),
- buf_block_get_page_no(block)));
+ ut_ad(lock_rec_validate_page(block));
#endif
}
@@ -3493,8 +3497,7 @@ lock_deadlock_recursive(
}
#endif /* UNIV_DEBUG */
- if (trx_weight_cmp(wait_lock->trx,
- start) >= 0) {
+ if (trx_weight_ge(wait_lock->trx, start)) {
/* Our recursion starting point
transaction is 'smaller', let us
choose 'start' as the victim and roll
@@ -3632,6 +3635,80 @@ lock_table_create(
}
/*************************************************************//**
+Pops autoinc lock requests from the transaction's autoinc_locks. We
+handle the case where there are gaps in the array and they need to
+be popped off the stack. */
+UNIV_INLINE
+void
+lock_table_pop_autoinc_locks(
+/*=========================*/
+ trx_t* trx) /*!< in/out: transaction that owns the AUTOINC locks */
+{
+ ut_ad(mutex_own(&kernel_mutex));
+ ut_ad(!ib_vector_is_empty(trx->autoinc_locks));
+
+ /* Skip any gaps, gaps are NULL lock entries in the
+ trx->autoinc_locks vector. */
+
+ do {
+ ib_vector_pop(trx->autoinc_locks);
+
+ if (ib_vector_is_empty(trx->autoinc_locks)) {
+ return;
+ }
+
+ } while (ib_vector_get_last(trx->autoinc_locks) == NULL);
+}
+
+/*************************************************************//**
+Removes an autoinc lock request from the transaction's autoinc_locks. */
+UNIV_INLINE
+void
+lock_table_remove_autoinc_lock(
+/*===========================*/
+ lock_t* lock, /*!< in: table lock */
+ trx_t* trx) /*!< in/out: transaction that owns the lock */
+{
+ lock_t* autoinc_lock;
+ lint i = ib_vector_size(trx->autoinc_locks) - 1;
+
+ ut_ad(mutex_own(&kernel_mutex));
+ ut_ad(lock_get_mode(lock) == LOCK_AUTO_INC);
+ ut_ad(lock_get_type_low(lock) & LOCK_TABLE);
+ ut_ad(!ib_vector_is_empty(trx->autoinc_locks));
+
+ /* With stored functions and procedures the user may drop
+ a table within the same "statement". This special case has
+ to be handled by deleting only those AUTOINC locks that were
+ held by the table being dropped. */
+
+ autoinc_lock = ib_vector_get(trx->autoinc_locks, i);
+
+ /* This is the default fast case. */
+
+ if (autoinc_lock == lock) {
+ lock_table_pop_autoinc_locks(trx);
+ } else {
+ /* The last element should never be NULL */
+ ut_a(autoinc_lock != NULL);
+
+ /* Handle freeing the locks from within the stack. */
+
+ while (--i >= 0) {
+ autoinc_lock = ib_vector_get(trx->autoinc_locks, i);
+
+ if (UNIV_LIKELY(autoinc_lock == lock)) {
+ ib_vector_set(trx->autoinc_locks, i, NULL);
+ return;
+ }
+ }
+
+ /* Must find the autoinc lock. */
+ ut_error;
+ }
+}
+
+/*************************************************************//**
Removes a table lock request from the queue and the trx list of locks;
this is a low-level function which does NOT check if waiting requests
can now be granted. */
@@ -3670,10 +3747,8 @@ lock_table_remove_low(
if (!lock_get_wait(lock)
&& !ib_vector_is_empty(trx->autoinc_locks)) {
- lock_t* autoinc_lock;
- autoinc_lock = ib_vector_pop(trx->autoinc_locks);
- ut_a(autoinc_lock == lock);
+ lock_table_remove_autoinc_lock(lock, trx);
}
ut_a(table->n_waiting_or_granted_auto_inc_locks > 0);
@@ -3777,17 +3852,18 @@ Checks if other transactions have an incompatible mode lock request in
the lock queue.
@return lock or NULL */
UNIV_INLINE
-lock_t*
+const lock_t*
lock_table_other_has_incompatible(
/*==============================*/
- trx_t* trx, /*!< in: transaction, or NULL if all
- transactions should be included */
- ulint wait, /*!< in: LOCK_WAIT if also waiting locks are
- taken into account, or 0 if not */
- dict_table_t* table, /*!< in: table */
- enum lock_mode mode) /*!< in: lock mode */
+ const trx_t* trx, /*!< in: transaction, or NULL if all
+ transactions should be included */
+ ulint wait, /*!< in: LOCK_WAIT if also
+ waiting locks are taken into
+ account, or 0 if not */
+ const dict_table_t* table, /*!< in: table */
+ enum lock_mode mode) /*!< in: lock mode */
{
- lock_t* lock;
+ const lock_t* lock;
ut_ad(mutex_own(&kernel_mutex));
@@ -3878,10 +3954,10 @@ static
ibool
lock_table_has_to_wait_in_queue(
/*============================*/
- lock_t* wait_lock) /*!< in: waiting table lock */
+ const lock_t* wait_lock) /*!< in: waiting table lock */
{
- dict_table_t* table;
- lock_t* lock;
+ const dict_table_t* table;
+ const lock_t* lock;
ut_ad(mutex_own(&kernel_mutex));
ut_ad(lock_get_wait(wait_lock));
@@ -4036,7 +4112,7 @@ lock_release_off_kernel(
ut_ad(lock_get_type_low(lock) & LOCK_TABLE);
if (lock_get_mode(lock) != LOCK_IS
- && !ut_dulint_is_zero(trx->undo_no)) {
+ && trx->undo_no != 0) {
/* The trx may have modified the table. We
block the use of the MySQL query cache for
@@ -4235,8 +4311,7 @@ lock_table_print(
fputs("TABLE LOCK table ", file);
ut_print_name(file, lock->trx, TRUE,
lock->un_member.tab_lock.table->name);
- fprintf(file, " trx id " TRX_ID_FMT,
- TRX_ID_PREP_PRINTF(lock->trx->id));
+ fprintf(file, " trx id " TRX_ID_FMT, (ullint) lock->trx->id);
if (lock_get_mode(lock) == LOCK_S) {
fputs(" lock mode S", file);
@@ -4289,8 +4364,7 @@ lock_rec_print(
(ulong) space, (ulong) page_no,
(ulong) lock_rec_get_n_bits(lock));
dict_index_name_print(file, lock->trx, lock->index);
- fprintf(file, " trx id " TRX_ID_FMT,
- TRX_ID_PREP_PRINTF(lock->trx->id));
+ fprintf(file, " trx id " TRX_ID_FMT, (ullint) lock->trx->id);
if (lock_get_mode(lock) == LOCK_S) {
fputs(" lock mode S", file);
@@ -4427,13 +4501,13 @@ lock_print_info_summary(
"------------\n", file);
fprintf(file, "Trx id counter " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(trx_sys->max_trx_id));
+ (ullint) trx_sys->max_trx_id);
fprintf(file,
"Purge done for trx's n:o < " TRX_ID_FMT
" undo n:o < " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(purge_sys->purge_trx_no),
- TRX_ID_PREP_PRINTF(purge_sys->purge_undo_no));
+ (ullint) purge_sys->purge_trx_no,
+ (ullint) purge_sys->purge_undo_no);
fprintf(file,
"History list length %lu\n",
@@ -4510,10 +4584,8 @@ loop:
"Trx read view will not see trx with"
" id >= " TRX_ID_FMT
", sees < " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(
- trx->read_view->low_limit_id),
- TRX_ID_PREP_PRINTF(
- trx->read_view->up_limit_id));
+ (ullint) trx->read_view->low_limit_id,
+ (ullint) trx->read_view->up_limit_id);
}
if (trx->que_state == TRX_QUE_LOCK_WAIT) {
@@ -4627,9 +4699,9 @@ static
ibool
lock_table_queue_validate(
/*======================*/
- dict_table_t* table) /*!< in: table */
+ const dict_table_t* table) /*!< in: table */
{
- lock_t* lock;
+ const lock_t* lock;
ut_ad(mutex_own(&kernel_mutex));
@@ -4665,7 +4737,7 @@ lock_rec_queue_validate(
/*====================*/
const buf_block_t* block, /*!< in: buffer block containing rec */
const rec_t* rec, /*!< in: record to look at */
- dict_index_t* index, /*!< in: index, or NULL if not known */
+ const dict_index_t* index, /*!< in: index, or NULL if not known */
const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
{
trx_t* impl_trx;
@@ -4814,46 +4886,37 @@ static
ibool
lock_rec_validate_page(
/*===================*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no)/*!< in: page number */
+ const buf_block_t* block) /*!< in: buffer block */
{
- dict_index_t* index;
- buf_block_t* block;
- const page_t* page;
- lock_t* lock;
+ const lock_t* lock;
const rec_t* rec;
ulint nth_lock = 0;
ulint nth_bit = 0;
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(!mutex_own(&kernel_mutex));
-
- mtr_start(&mtr);
-
- ut_ad(zip_size != ULINT_UNDEFINED);
- block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, &mtr);
- buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
-
- page = block->frame;
+ ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
lock_mutex_enter_kernel();
loop:
- lock = lock_rec_get_first_on_page_addr(space, page_no);
+ lock = lock_rec_get_first_on_page_addr(buf_block_get_space(block),
+ buf_block_get_page_no(block));
if (!lock) {
goto function_exit;
}
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
+ ut_a(!block->page.file_page_was_freed);
+#endif
+
for (i = 0; i < nth_lock; i++) {
- lock = lock_rec_get_next_on_page(lock);
+ lock = lock_rec_get_next_on_page_const(lock);
if (!lock) {
goto function_exit;
@@ -4876,16 +4939,15 @@ loop:
if (i == 1 || lock_rec_get_nth_bit(lock, i)) {
- index = lock->index;
- rec = page_find_rec_with_heap_no(page, i);
+ rec = page_find_rec_with_heap_no(block->frame, i);
ut_a(rec);
- offsets = rec_get_offsets(rec, index, offsets,
+ offsets = rec_get_offsets(rec, lock->index, offsets,
ULINT_UNDEFINED, &heap);
-
+#if 0
fprintf(stderr,
- "Validating %lu %lu\n",
- (ulong) space, (ulong) page_no);
-
+ "Validating %u %u\n",
+ block->page.space, block->page.offset);
+#endif
lock_mutex_exit_kernel();
/* If this thread is holding the file space
@@ -4893,7 +4955,8 @@ loop:
check WILL break the latching order and may
cause a deadlock of threads. */
- lock_rec_queue_validate(block, rec, index, offsets);
+ lock_rec_queue_validate(block, rec, lock->index,
+ offsets);
lock_mutex_enter_kernel();
@@ -4911,8 +4974,6 @@ loop:
function_exit:
lock_mutex_exit_kernel();
- mtr_commit(&mtr);
-
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -4927,12 +4988,9 @@ ibool
lock_validate(void)
/*===============*/
{
- lock_t* lock;
- trx_t* trx;
- dulint limit;
- ulint space;
- ulint page_no;
- ulint i;
+ const lock_t* lock;
+ const trx_t* trx;
+ ulint i;
lock_mutex_enter_kernel();
@@ -4956,20 +5014,26 @@ lock_validate(void)
for (i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) {
- limit = ut_dulint_zero;
+ ulint space;
+ ulint page_no;
+ ib_uint64_t limit = 0;
for (;;) {
+ mtr_t mtr;
+ buf_block_t* block;
+
lock = HASH_GET_FIRST(lock_sys->rec_hash, i);
while (lock) {
+ ib_uint64_t space_page;
ut_a(trx_in_trx_list(lock->trx));
space = lock->un_member.rec_lock.space;
page_no = lock->un_member.rec_lock.page_no;
- if (ut_dulint_cmp(
- ut_dulint_create(space, page_no),
- limit) >= 0) {
+ space_page = ut_ull_create(space, page_no);
+
+ if (space_page >= limit) {
break;
}
@@ -4983,13 +5047,26 @@ lock_validate(void)
lock_mutex_exit_kernel();
- lock_rec_validate_page(space,
- fil_space_get_zip_size(space),
- page_no);
+ /* The lock and the block that it is referring
+ to may be freed at this point. We pass
+ BUF_GET_POSSIBLY_FREED to skip a debug check.
+ If the lock exists in lock_rec_validate_page()
+ we assert !block->page.file_page_was_freed. */
- lock_mutex_enter_kernel();
+ mtr_start(&mtr);
+ block = buf_page_get_gen(
+ space, fil_space_get_zip_size(space),
+ page_no, RW_X_LATCH, NULL,
+ BUF_GET_POSSIBLY_FREED,
+ __FILE__, __LINE__, &mtr);
+ buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
+
+ ut_ad(lock_rec_validate_page(block));
+ mtr_commit(&mtr);
+
+ limit++;
- limit = ut_dulint_create(space, page_no + 1);
+ lock_mutex_enter_kernel();
}
}
@@ -5363,8 +5440,7 @@ lock_sec_rec_read_check_and_lock(
if the max trx id for the page >= min trx id for the trx list or a
database recovery is running. */
- if (((ut_dulint_cmp(page_get_max_trx_id(block->frame),
- trx_list_get_min_trx_id()) >= 0)
+ if ((page_get_max_trx_id(block->frame) >= trx_list_get_min_trx_id()
|| recv_recovery_is_on())
&& !page_rec_is_supremum(rec)) {
@@ -5587,12 +5663,12 @@ lock_get_type(
Gets the id of the transaction owning a lock.
@return transaction id */
UNIV_INTERN
-ullint
+trx_id_t
lock_get_trx_id(
/*============*/
const lock_t* lock) /*!< in: lock */
{
- return(trx_get_id(lock->trx));
+ return(lock->trx->id);
}
/*******************************************************************//**
@@ -5686,7 +5762,7 @@ lock_get_table(
Gets the id of the table on which the lock is.
@return id of the table */
UNIV_INTERN
-ullint
+table_id_t
lock_get_table_id(
/*==============*/
const lock_t* lock) /*!< in: lock */
@@ -5695,7 +5771,7 @@ lock_get_table_id(
table = lock_get_table(lock);
- return((ullint)ut_conv_dulint_to_longlong(table->id));
+ return(table->id);
}
/*******************************************************************//**
diff --git a/storage/xtradb/log/log0log.c b/storage/xtradb/log/log0log.c
index b9f19aeff31..80449e1c23a 100644
--- a/storage/xtradb/log/log0log.c
+++ b/storage/xtradb/log/log0log.c
@@ -48,6 +48,7 @@ Created 12/9/1995 Heikki Tuuri
#include "srv0start.h"
#include "trx0sys.h"
#include "trx0trx.h"
+#include "ha_prototypes.h"
/*
General philosophy of InnoDB redo-logs:
@@ -82,6 +83,18 @@ UNIV_INTERN ulint log_fsp_current_free_limit = 0;
/* Global log system variable */
UNIV_INTERN log_t* log_sys = NULL;
+#ifdef UNIV_PFS_RWLOCK
+UNIV_INTERN mysql_pfs_key_t checkpoint_lock_key;
+# ifdef UNIV_LOG_ARCHIVE
+UNIV_INTERN mysql_pfs_key_t archive_lock_key;
+# endif
+#endif /* UNIV_PFS_RWLOCK */
+
+#ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t log_sys_mutex_key;
+UNIV_INTERN mysql_pfs_key_t log_flush_order_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
#ifdef UNIV_DEBUG
UNIV_INTERN ibool log_do_write = TRUE;
#endif /* UNIV_DEBUG */
@@ -785,7 +798,11 @@ log_init(void)
{
log_sys = mem_alloc(sizeof(log_t));
- mutex_create(&log_sys->mutex, SYNC_LOG);
+ mutex_create(log_sys_mutex_key, &log_sys->mutex, SYNC_LOG);
+
+ mutex_create(log_flush_order_mutex_key,
+ &log_sys->log_flush_order_mutex,
+ SYNC_LOG_FLUSH_ORDER);
mutex_enter(&(log_sys->mutex));
@@ -841,7 +858,8 @@ log_init(void)
log_sys->last_checkpoint_lsn = log_sys->lsn;
log_sys->n_pending_checkpoint_writes = 0;
- rw_lock_create(&log_sys->checkpoint_lock, SYNC_NO_ORDER_CHECK);
+ rw_lock_create(checkpoint_lock_key, &log_sys->checkpoint_lock,
+ SYNC_NO_ORDER_CHECK);
log_sys->checkpoint_buf_ptr = mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE);
log_sys->checkpoint_buf = ut_align(log_sys->checkpoint_buf_ptr,
@@ -857,7 +875,8 @@ log_init(void)
log_sys->n_pending_archive_ios = 0;
- rw_lock_create(&log_sys->archive_lock, SYNC_NO_ORDER_CHECK);
+ rw_lock_create(archive_lock_key, &log_sys->archive_lock,
+ SYNC_NO_ORDER_CHECK);
log_sys->archive_buf = NULL;
@@ -1114,7 +1133,7 @@ log_io_complete(
&& srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT
&& srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
- fil_flush(group->space_id);
+ fil_flush(group->space_id, FALSE);
}
#ifdef UNIV_DEBUG
@@ -1135,9 +1154,9 @@ log_io_complete(
if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
&& srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT
&& srv_unix_file_flush_method != SRV_UNIX_NOSYNC
- && srv_flush_log_at_trx_commit != 2) {
+ && thd_flush_log_at_trx_commit(NULL) != 2) {
- fil_flush(group->space_id);
+ fil_flush(group->space_id, FALSE);
}
mutex_enter(&(log_sys->mutex));
@@ -1179,11 +1198,14 @@ log_group_file_header_flush(
buf = *(group->file_header_bufs + nth_file);
mach_write_to_4(buf + LOG_GROUP_ID, group->id);
- mach_write_ull(buf + LOG_FILE_START_LSN, start_lsn);
+ mach_write_to_8(buf + LOG_FILE_START_LSN, start_lsn);
/* Wipe over possible label of ibbackup --restore */
memcpy(buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, " ", 4);
+ mach_write_to_4(buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE,
+ srv_log_block_size);
+
dest_offset = nth_file * group->file_size;
#ifdef UNIV_DEBUG
@@ -1525,7 +1547,7 @@ loop:
group = UT_LIST_GET_FIRST(log_sys->log_groups);
- fil_flush(group->space_id);
+ fil_flush(group->space_id, FALSE);
log_sys->flushed_to_disk_lsn = log_sys->write_lsn;
}
@@ -1669,10 +1691,10 @@ log_preflush_pool_modified_pages(
recv_apply_hashed_log_recs(TRUE);
}
- n_pages = buf_flush_batch(BUF_FLUSH_LIST, ULINT_MAX, new_oldest);
+ n_pages = buf_flush_list(ULINT_MAX, new_oldest);
if (sync) {
- buf_flush_wait_batch_end(BUF_FLUSH_LIST);
+ buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
}
if (n_pages == ULINT_UNDEFINED) {
@@ -1777,14 +1799,12 @@ log_group_checkpoint(
ulint i;
ut_ad(mutex_own(&(log_sys->mutex)));
-#if LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE
-# error "LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE"
-#endif
+ ut_a(LOG_CHECKPOINT_SIZE <= OS_FILE_LOG_BLOCK_SIZE);
buf = group->checkpoint_buf;
- mach_write_ull(buf + LOG_CHECKPOINT_NO, log_sys->next_checkpoint_no);
- mach_write_ull(buf + LOG_CHECKPOINT_LSN, log_sys->next_checkpoint_lsn);
+ mach_write_to_8(buf + LOG_CHECKPOINT_NO, log_sys->next_checkpoint_no);
+ mach_write_to_8(buf + LOG_CHECKPOINT_LSN, log_sys->next_checkpoint_lsn);
mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET,
log_group_calc_lsn_offset(
@@ -1805,9 +1825,9 @@ log_group_checkpoint(
}
}
- mach_write_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN, archived_lsn);
+ mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN, archived_lsn);
#else /* UNIV_LOG_ARCHIVE */
- mach_write_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN,
+ mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN,
(ib_uint64_t)log_group_calc_lsn_offset(
log_sys->next_checkpoint_lsn, group));
#endif /* UNIV_LOG_ARCHIVE */
@@ -1901,7 +1921,7 @@ log_reset_first_header_and_checkpoint(
ib_uint64_t lsn;
mach_write_to_4(hdr_buf + LOG_GROUP_ID, 0);
- mach_write_ull(hdr_buf + LOG_FILE_START_LSN, start);
+ mach_write_to_8(hdr_buf + LOG_FILE_START_LSN, start);
lsn = start + LOG_BLOCK_HDR_SIZE;
@@ -1913,15 +1933,15 @@ log_reset_first_header_and_checkpoint(
+ (sizeof "ibbackup ") - 1));
buf = hdr_buf + LOG_CHECKPOINT_1;
- mach_write_ull(buf + LOG_CHECKPOINT_NO, 0);
- mach_write_ull(buf + LOG_CHECKPOINT_LSN, lsn);
+ mach_write_to_8(buf + LOG_CHECKPOINT_NO, 0);
+ mach_write_to_8(buf + LOG_CHECKPOINT_LSN, lsn);
mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET,
LOG_FILE_HDR_SIZE + LOG_BLOCK_HDR_SIZE);
mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, 2 * 1024 * 1024);
- mach_write_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN, IB_ULONGLONG_MAX);
+ mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN, IB_ULONGLONG_MAX);
fold = ut_fold_binary(buf, LOG_CHECKPOINT_CHECKSUM_1);
mach_write_to_4(buf + LOG_CHECKPOINT_CHECKSUM_1, fold);
@@ -2289,7 +2309,7 @@ log_group_archive_file_header_write(
buf = *(group->archive_file_header_bufs + nth_file);
mach_write_to_4(buf + LOG_GROUP_ID, group->id);
- mach_write_ull(buf + LOG_FILE_START_LSN, start_lsn);
+ mach_write_to_8(buf + LOG_FILE_START_LSN, start_lsn);
mach_write_to_4(buf + LOG_FILE_NO, file_no);
mach_write_to_4(buf + LOG_FILE_ARCH_COMPLETED, FALSE);
@@ -2325,7 +2345,7 @@ log_group_archive_completed_header_write(
buf = *(group->archive_file_header_bufs + nth_file);
mach_write_to_4(buf + LOG_FILE_ARCH_COMPLETED, TRUE);
- mach_write_ull(buf + LOG_FILE_END_LSN, end_lsn);
+ mach_write_to_8(buf + LOG_FILE_END_LSN, end_lsn);
dest_offset = nth_file * group->file_size + LOG_FILE_ARCH_COMPLETED;
@@ -2389,13 +2409,15 @@ loop:
log_archived_file_name_gen(name, group->id,
group->archived_file_no + n_files);
- file_handle = os_file_create(name, open_mode, OS_FILE_AIO,
+ file_handle = os_file_create(innodb_file_log_key,
+ name, open_mode,
+ OS_FILE_AIO,
OS_DATA_FILE, &ret);
if (!ret && (open_mode == OS_FILE_CREATE)) {
file_handle = os_file_create(
- name, OS_FILE_OPEN, OS_FILE_AIO,
- OS_DATA_FILE, &ret);
+ innodb_file_log_key, name, OS_FILE_OPEN,
+ OS_FILE_AIO, OS_DATA_FILE, &ret);
}
if (!ret) {
@@ -2622,7 +2644,7 @@ log_io_complete_archive(void)
mutex_exit(&(log_sys->mutex));
- fil_flush(group->archive_space_id);
+ fil_flush(group->archive_space_id, TRUE);
mutex_enter(&(log_sys->mutex));
@@ -3093,6 +3115,7 @@ logs_empty_and_mark_files_at_shutdown(void)
{
ib_uint64_t lsn;
ulint arch_log_no;
+ ibool server_busy;
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
@@ -3108,93 +3131,86 @@ loop:
mutex_enter(&kernel_mutex);
- /* We need the monitor threads to stop before we proceed with a
- normal shutdown. In case of very fast shutdown, however, we can
- proceed without waiting for monitor threads. */
+ /* We need the monitor threads to stop before we proceed with
+ a shutdown. */
- if (srv_fast_shutdown < 2
- && (srv_error_monitor_active
- || srv_lock_timeout_active || srv_monitor_active)) {
+ if (srv_error_monitor_active
+ || srv_lock_timeout_active
+ || srv_monitor_active) {
mutex_exit(&kernel_mutex);
- goto loop;
- }
-
- /* Check that there are no longer transactions. We need this wait even
- for the 'very fast' shutdown, because the InnoDB layer may have
- committed or prepared transactions and we don't want to lose them. */
-
- if (trx_n_mysql_transactions > 0
- || UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
-
- mutex_exit(&kernel_mutex);
+ os_event_set(srv_error_event);
+ os_event_set(srv_monitor_event);
+ os_event_set(srv_timeout_event);
goto loop;
}
- if (srv_fast_shutdown == 2) {
- /* In this fastest shutdown we do not flush the buffer pool:
- it is essentially a 'crash' of the InnoDB server. Make sure
- that the log is all flushed to disk, so that we can recover
- all committed transactions in a crash recovery. We must not
- write the lsn stamps to the data files, since at a startup
- InnoDB deduces from the stamps if the previous shutdown was
- clean. */
-
- log_buffer_flush_to_disk();
+ /* Check that there are no longer transactions, except for
+ PREPARED ones. We need this wait even for the 'very fast'
+ shutdown, because the InnoDB layer may have committed or
+ prepared transactions and we don't want to lose them. */
- return; /* We SKIP ALL THE REST !! */
- }
-
- /* Check that the master thread is suspended */
-
- if (srv_n_threads_active[SRV_MASTER] != 0) {
-
- mutex_exit(&kernel_mutex);
+ server_busy = trx_n_mysql_transactions > 0
+ || UT_LIST_GET_LEN(trx_sys->trx_list) > trx_n_prepared;
+ mutex_exit(&kernel_mutex);
+ if (server_busy || srv_is_any_background_thread_active()) {
goto loop;
}
- /* Check that the purge threads ended */
- if (srv_use_purge_thread
- && (srv_n_threads_active[SRV_PURGE] != 0
- || srv_n_threads_active[SRV_PURGE_WORKER] != 0)) {
-
- mutex_exit(&kernel_mutex);
+ mutex_enter(&log_sys->mutex);
+ server_busy = log_sys->n_pending_checkpoint_writes
+#ifdef UNIV_LOG_ARCHIVE
+ || log_sys->n_pending_archive_ios
+#endif /* UNIV_LOG_ARCHIVE */
+ || log_sys->n_pending_writes;
+ mutex_exit(&log_sys->mutex);
+ if (server_busy || !buf_pool_check_no_pending_io()) {
goto loop;
}
- mutex_exit(&kernel_mutex);
-
- mutex_enter(&(log_sys->mutex));
-
- if (log_sys->n_pending_checkpoint_writes
#ifdef UNIV_LOG_ARCHIVE
- || log_sys->n_pending_archive_ios
+ log_archive_all();
#endif /* UNIV_LOG_ARCHIVE */
- || log_sys->n_pending_writes) {
-
- mutex_exit(&(log_sys->mutex));
-
- goto loop;
- }
+ if (srv_fast_shutdown == 2) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: MySQL has requested a very fast shutdown"
+ " without flushing "
+ "the InnoDB buffer pool to data files."
+ " At the next mysqld startup "
+ "InnoDB will do a crash recovery!\n");
+
+ /* In this fastest shutdown we do not flush the buffer
+ pool: it is essentially a 'crash' of the InnoDB
+ server. Make sure that the log is all flushed to disk,
+ so that we can recover all committed transactions in a
+ crash recovery. We must not write the lsn stamps to
+ the data files, since at a startup InnoDB deduces from
+ the stamps if the previous shutdown was clean. */
- mutex_exit(&(log_sys->mutex));
+ log_buffer_flush_to_disk();
- if (!buf_pool_check_no_pending_io()) {
+ /* Check that the background threads stay suspended */
+ if (srv_is_any_background_thread_active()) {
+ fprintf(stderr,
+ "InnoDB: Warning: some background thread"
+ " woke up during shutdown\n");
+ goto loop;
+ }
- goto loop;
+ srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
+ fil_close_all_files();
+ ut_a(!srv_is_any_background_thread_active());
+ return;
}
-#ifdef UNIV_LOG_ARCHIVE
- log_archive_all();
-#endif /* UNIV_LOG_ARCHIVE */
-
log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
- mutex_enter(&(log_sys->mutex));
+ mutex_enter(&log_sys->mutex);
lsn = log_sys->lsn;
@@ -3205,7 +3221,7 @@ loop:
#endif /* UNIV_LOG_ARCHIVE */
) {
- mutex_exit(&(log_sys->mutex));
+ mutex_exit(&log_sys->mutex);
goto loop;
}
@@ -3223,20 +3239,16 @@ loop:
log_archive_close_groups(TRUE);
#endif /* UNIV_LOG_ARCHIVE */
- mutex_exit(&(log_sys->mutex));
+ mutex_exit(&log_sys->mutex);
- mutex_enter(&kernel_mutex);
- /* Check that the master thread has stayed suspended */
- if (srv_n_threads_active[SRV_MASTER] != 0) {
+ /* Check that the background threads stay suspended */
+ if (srv_is_any_background_thread_active()) {
fprintf(stderr,
- "InnoDB: Warning: the master thread woke up"
+ "InnoDB: Warning: some background thread woke up"
" during shutdown\n");
- mutex_exit(&kernel_mutex);
-
goto loop;
}
- mutex_exit(&kernel_mutex);
fil_flush_file_spaces(FIL_TABLESPACE);
fil_flush_file_spaces(FIL_LOG);
@@ -3254,7 +3266,8 @@ loop:
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
/* Make some checks that the server really is quiet */
- ut_a(srv_n_threads_active[SRV_MASTER] == 0);
+ ut_a(!srv_is_any_background_thread_active());
+
ut_a(buf_all_freed());
ut_a(lsn == log_sys->lsn);
@@ -3275,7 +3288,8 @@ loop:
fil_close_all_files();
/* Make some checks that the server really is quiet */
- ut_a(srv_n_threads_active[SRV_MASTER] == 0);
+ ut_a(!srv_is_any_background_thread_active());
+
ut_a(buf_all_freed());
ut_a(lsn == log_sys->lsn);
}
@@ -3316,9 +3330,9 @@ log_check_log_recs(
ut_memcpy(scan_buf, start, end - start);
- recv_scan_log_recs((buf_pool->curr_size
- - recv_n_pool_free_frames) * UNIV_PAGE_SIZE,
- FALSE, scan_buf, end - start,
+ recv_scan_log_recs((buf_pool_get_n_pages()
+ - (recv_n_pool_free_frames * srv_buf_pool_instances))
+ * UNIV_PAGE_SIZE, FALSE, scan_buf, end - start,
ut_uint64_align_down(buf_start_lsn,
OS_FILE_LOG_BLOCK_SIZE),
&contiguous_lsn, &scanned_lsn);
@@ -3378,11 +3392,11 @@ log_print(
"Checkpoint age target %lu\n"
"Modified age %lu\n"
"Checkpoint age %lu\n",
- (ulong) log_sys->max_checkpoint_age,
- (ulong) log_max_checkpoint_age_async(),
- (ulong) (log_sys->lsn -
- log_buf_pool_get_oldest_modification()),
- (ulong) (log_sys->lsn - log_sys->last_checkpoint_lsn));
+ (ulong) log_sys->max_checkpoint_age,
+ (ulong) log_max_checkpoint_age_async(),
+ (ulong) (log_sys->lsn -
+ log_buf_pool_get_oldest_modification()),
+ (ulong) (log_sys->lsn - log_sys->last_checkpoint_lsn));
current_time = time(NULL);
diff --git a/storage/xtradb/log/log0recv.c b/storage/xtradb/log/log0recv.c
index 200b3b088a7..e0952a1ed0b 100644
--- a/storage/xtradb/log/log0recv.c
+++ b/storage/xtradb/log/log0recv.c
@@ -148,6 +148,14 @@ is bigger than the lsn we are able to scan up to, that is an indication that
the recovery failed and the database may be corrupt. */
UNIV_INTERN ib_uint64_t recv_max_page_lsn;
+#ifdef UNIV_PFS_THREAD
+UNIV_INTERN mysql_pfs_key_t trx_rollback_clean_thread_key;
+#endif /* UNIV_PFS_THREAD */
+
+#ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t recv_sys_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
/* prototypes */
#ifndef UNIV_HOTBACKUP
@@ -175,7 +183,7 @@ recv_sys_create(void)
recv_sys = mem_alloc(sizeof(*recv_sys));
memset(recv_sys, 0x0, sizeof(*recv_sys));
- mutex_create(&recv_sys->mutex, SYNC_RECV);
+ mutex_create(recv_sys_mutex_key, &recv_sys->mutex, SYNC_RECV);
recv_sys->heap = NULL;
recv_sys->addr_hash = NULL;
@@ -299,12 +307,14 @@ recv_sys_init(
return;
}
+#ifndef UNIV_HOTBACKUP
/* Initialize red-black tree for fast insertions into the
flush_list during recovery process.
As this initialization is done while holding the buffer pool
mutex we perform it before acquiring recv_sys->mutex. */
#ifndef UNIV_HOTBACKUP
buf_flush_init_flush_rbt();
+#endif /* !UNIV_HOTBACKUP */
mutex_enter(&(recv_sys->mutex));
@@ -567,10 +577,8 @@ recv_synchronize_groups(
ib_uint64_t start_lsn;
ib_uint64_t end_lsn;
ib_uint64_t recovered_lsn;
- ib_uint64_t limit_lsn;
recovered_lsn = recv_sys->recovered_lsn;
- limit_lsn = recv_sys->limit_lsn;
/* Read the last recovered log block to the recovery system buffer:
the block is always incomplete */
@@ -702,14 +710,14 @@ recv_find_max_checkpoint(
group->state = LOG_GROUP_OK;
- group->lsn = mach_read_ull(
+ group->lsn = mach_read_from_8(
buf + LOG_CHECKPOINT_LSN);
#ifdef UNIV_LOG_ARCHIVE
#error "UNIV_LOG_ARCHIVE could not be enabled"
#endif
{
- ib_uint64_t tmp_lsn_offset = mach_read_ull(
+ ib_uint64_t tmp_lsn_offset = mach_read_from_8(
buf + LOG_CHECKPOINT_ARCHIVED_LSN);
if (sizeof(ulint) != 4
&& tmp_lsn_offset != IB_ULONGLONG_MAX) {
@@ -720,7 +728,7 @@ recv_find_max_checkpoint(
}
}
- checkpoint_no = mach_read_ull(
+ checkpoint_no = mach_read_from_8(
buf + LOG_CHECKPOINT_NO);
#ifdef UNIV_DEBUG
@@ -790,14 +798,14 @@ recv_read_cp_info_for_backup(
cp_buf = hdr + LOG_CHECKPOINT_1;
if (recv_check_cp_is_consistent(cp_buf)) {
- max_cp_no = mach_read_ull(cp_buf + LOG_CHECKPOINT_NO);
+ max_cp_no = mach_read_from_8(cp_buf + LOG_CHECKPOINT_NO);
max_cp = LOG_CHECKPOINT_1;
}
cp_buf = hdr + LOG_CHECKPOINT_2;
if (recv_check_cp_is_consistent(cp_buf)) {
- if (mach_read_ull(cp_buf + LOG_CHECKPOINT_NO) > max_cp_no) {
+ if (mach_read_from_8(cp_buf + LOG_CHECKPOINT_NO) > max_cp_no) {
max_cp = LOG_CHECKPOINT_2;
}
}
@@ -808,7 +816,7 @@ recv_read_cp_info_for_backup(
cp_buf = hdr + max_cp;
- *lsn = mach_read_ull(cp_buf + LOG_CHECKPOINT_LSN);
+ *lsn = mach_read_from_8(cp_buf + LOG_CHECKPOINT_LSN);
*offset = mach_read_from_4(cp_buf + LOG_CHECKPOINT_OFFSET);
/* If the user is running a pre-3.23.50 version of InnoDB, its
@@ -828,9 +836,9 @@ recv_read_cp_info_for_backup(
/* fprintf(stderr, "fsp limit %lu MB\n", *fsp_limit); */
- *cp_no = mach_read_ull(cp_buf + LOG_CHECKPOINT_NO);
+ *cp_no = mach_read_from_8(cp_buf + LOG_CHECKPOINT_NO);
- *first_header_lsn = mach_read_ull(hdr + LOG_FILE_START_LSN);
+ *first_header_lsn = mach_read_from_8(hdr + LOG_FILE_START_LSN);
return(TRUE);
}
@@ -1569,7 +1577,7 @@ recv_recover_page_func(
#endif /* !UNIV_HOTBACKUP */
/* Read the newest modification lsn from the page */
- page_lsn = mach_read_ull(page + FIL_PAGE_LSN);
+ page_lsn = mach_read_from_8(page + FIL_PAGE_LSN);
page_lsn_orig = page_lsn;
#ifndef UNIV_HOTBACKUP
@@ -1667,14 +1675,14 @@ recv_recover_page_func(
}
end_lsn = recv->start_lsn + recv->len;
- mach_write_ull(FIL_PAGE_LSN + page, end_lsn);
- mach_write_ull(UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM
- + page, end_lsn);
+ mach_write_to_8(FIL_PAGE_LSN + page, end_lsn);
+ mach_write_to_8(UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM
+ + page, end_lsn);
if (page_zip) {
- mach_write_ull(FIL_PAGE_LSN
- + page_zip->data, end_lsn);
+ mach_write_to_8(FIL_PAGE_LSN
+ + page_zip->data, end_lsn);
}
}
@@ -1712,7 +1720,9 @@ recv_recover_page_func(
if (modification_to_page) {
ut_a(block);
+ log_flush_order_mutex_enter();
buf_flush_recv_note_modification(block, start_lsn, end_lsn);
+ log_flush_order_mutex_exit();
}
#endif /* !UNIV_HOTBACKUP */
@@ -1904,11 +1914,10 @@ loop:
mutex_exit(&(recv_sys->mutex));
mutex_exit(&(log_sys->mutex));
- n_pages = buf_flush_batch(BUF_FLUSH_LIST, ULINT_MAX,
- IB_ULONGLONG_MAX);
- ut_a(n_pages != ULINT_UNDEFINED);
-
- buf_flush_wait_batch_end(BUF_FLUSH_LIST);
+ n_pages = buf_flush_list(ULINT_MAX, IB_ULONGLONG_MAX);
+ ut_a(n_pages != ULINT_UNDEFINED);
+
+ buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
buf_pool_invalidate();
@@ -2052,7 +2061,7 @@ recv_apply_log_recs_for_backup(void)
buf_flush_init_for_writing(
block->frame, buf_block_get_page_zip(block),
- mach_read_ull(block->frame + FIL_PAGE_LSN));
+ mach_read_from_8(block->frame + FIL_PAGE_LSN));
if (zip_size) {
error = fil_io(OS_FILE_WRITE, TRUE,
@@ -2262,7 +2271,7 @@ recv_report_corrupt_log(
"InnoDB: far enough in recovery! Please run CHECK TABLE\n"
"InnoDB: on your InnoDB tables to check that they are ok!\n"
"InnoDB: If mysqld crashes after this recovery, look at\n"
- "InnoDB: " REFMAN "forcing-recovery.html\n"
+ "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
fflush(stderr);
@@ -2822,8 +2831,8 @@ recv_scan_log_recs(
recv_parse_log_recs(store_to_hash);
#ifndef UNIV_HOTBACKUP
- if (store_to_hash && mem_heap_get_size(recv_sys->heap)
- > available_memory) {
+ if (store_to_hash
+ && mem_heap_get_size(recv_sys->heap) > available_memory) {
/* Hash table of log records has grown too big:
empty it; FALSE means no ibuf operations
@@ -2875,8 +2884,10 @@ recv_group_scan_log_recs(
group, start_lsn, end_lsn);
finished = recv_scan_log_recs(
- (buf_pool->curr_size - recv_n_pool_free_frames)
- * UNIV_PAGE_SIZE, TRUE, log_sys->buf, RECV_SCAN_SIZE,
+ (buf_pool_get_n_pages()
+ - (recv_n_pool_free_frames * srv_buf_pool_instances))
+ * UNIV_PAGE_SIZE,
+ TRUE, log_sys->buf, RECV_SCAN_SIZE,
start_lsn, contiguous_lsn, group_scanned_lsn);
start_lsn = end_lsn;
}
@@ -2901,7 +2912,6 @@ recv_init_crash_recovery(void)
/*==========================*/
{
ut_a(!recv_needed_recovery);
- ut_a(!srv_buffer_pool_shm_is_reused);
recv_needed_recovery = TRUE;
@@ -2959,12 +2969,15 @@ recv_recovery_from_checkpoint_start_func(
log_group_t* max_cp_group;
log_group_t* up_to_date_group;
ulint max_cp_field;
+ ulint log_hdr_log_block_size;
ib_uint64_t checkpoint_lsn;
ib_uint64_t checkpoint_no;
ib_uint64_t old_scanned_lsn;
ib_uint64_t group_scanned_lsn;
ib_uint64_t contiguous_lsn;
+#ifdef UNIV_LOG_ARCHIVE
ib_uint64_t archived_lsn;
+#endif /* UNIV_LOG_ARCHIVE */
byte* buf;
byte* log_hdr_buf;
byte log_hdr_buf_base[LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE];
@@ -3020,9 +3033,11 @@ recv_recovery_from_checkpoint_start_func(
buf = log_sys->checkpoint_buf;
- checkpoint_lsn = mach_read_ull(buf + LOG_CHECKPOINT_LSN);
- checkpoint_no = mach_read_ull(buf + LOG_CHECKPOINT_NO);
- archived_lsn = mach_read_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN);
+ checkpoint_lsn = mach_read_from_8(buf + LOG_CHECKPOINT_LSN);
+ checkpoint_no = mach_read_from_8(buf + LOG_CHECKPOINT_NO);
+#ifdef UNIV_LOG_ARCHIVE
+ archived_lsn = mach_read_from_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN);
+#endif /* UNIV_LOG_ARCHIVE */
/* Read the first log file header to print a note if this is
a recovery from a restored InnoDB Hot Backup */
@@ -3056,6 +3071,21 @@ recv_recovery_from_checkpoint_start_func(
log_hdr_buf, max_cp_group);
}
+ log_hdr_log_block_size
+ = mach_read_from_4(log_hdr_buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE);
+ if (log_hdr_log_block_size == 0) {
+ /* 0 means default value */
+ log_hdr_log_block_size = 512;
+ }
+ if (log_hdr_log_block_size != srv_log_block_size) {
+ fprintf(stderr,
+ "InnoDB: Error: The block size of ib_logfile (%lu) "
+ "is not equal to innodb_log_block_size.\n"
+ "InnoDB: Error: Suggestion - Recreate log files.\n",
+ log_hdr_log_block_size);
+ return(DB_ERROR);
+ }
+
#ifdef UNIV_LOG_ARCHIVE
group = UT_LIST_GET_FIRST(log_sys->log_groups);
@@ -3329,10 +3359,11 @@ recv_recovery_from_checkpoint_finish(void)
#endif /* UNIV_DEBUG */
if (recv_needed_recovery && srv_recovery_stats) {
+ ulint flush_list_len = 0;
ulint i;
fprintf(stderr,
- "InnoDB: Applying log records was done. Its statistics are followings.\n");
+ "InnoDB: Log records have been applied. The statistics that were gathered follow.\n");
fprintf(stderr,
"============================================================\n"
@@ -3344,6 +3375,12 @@ recv_recovery_from_checkpoint_finish(void)
difftime(time(NULL), recv_sys->stats_recv_start_time),
recv_sys->stats_recv_turns);
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ flush_list_len += UT_LIST_GET_LEN(buf_pool->flush_list);
+ }
fprintf(stderr,
"\n"
"Data page IO statistics\n"
@@ -3354,7 +3391,7 @@ recv_recovery_from_checkpoint_finish(void)
recv_sys->stats_read_requested_pages,
recv_sys->stats_read_io_pages,
recv_sys->stats_write_io_pages,
- UT_LIST_GET_LEN(buf_pool->flush_list));
+ flush_list_len);
fprintf(stderr,
" Grouping IO [times]:\n"
@@ -3577,8 +3614,10 @@ recv_reset_log_files_for_backup(
sprintf(name, "%s%s%lu", log_dir,
ib_logfile_basename, (ulong)i);
- log_file = os_file_create_simple(name, OS_FILE_CREATE,
- OS_FILE_READ_WRITE, &success);
+ log_file = os_file_create_simple(innodb_file_log_key,
+ name, OS_FILE_CREATE,
+ OS_FILE_READ_WRITE,
+ &success);
if (!success) {
fprintf(stderr,
"InnoDB: Cannot create %s. Check that"
@@ -3604,7 +3643,7 @@ recv_reset_log_files_for_backup(
exit(1);
}
- os_file_flush(log_file);
+ os_file_flush(log_file, TRUE);
os_file_close(log_file);
}
@@ -3617,7 +3656,8 @@ recv_reset_log_files_for_backup(
LOG_BLOCK_HDR_SIZE);
sprintf(name, "%s%s%lu", log_dir, ib_logfile_basename, (ulong)0);
- log_file = os_file_create_simple(name, OS_FILE_OPEN,
+ log_file = os_file_create_simple(innodb_file_log_key,
+ name, OS_FILE_OPEN,
OS_FILE_READ_WRITE, &success);
if (!success) {
fprintf(stderr, "InnoDB: Cannot open %s.\n", name);
@@ -3627,7 +3667,7 @@ recv_reset_log_files_for_backup(
os_file_write(name, log_file, buf, 0, 0,
LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
- os_file_flush(log_file);
+ os_file_flush(log_file, TRUE);
os_file_close(log_file);
ut_free(buf);
@@ -3635,6 +3675,7 @@ recv_reset_log_files_for_backup(
#endif /* UNIV_HOTBACKUP */
#ifdef UNIV_LOG_ARCHIVE
+/* Dead code */
/******************************************************//**
Reads from the archive of a log group and performs recovery.
@return TRUE if no more complete consistent archive files */
@@ -3667,7 +3708,8 @@ try_open_again:
log_archived_file_name_gen(name, group->id, group->archived_file_no);
- file_handle = os_file_create(name, OS_FILE_OPEN,
+ file_handle = os_file_create(innodb_file_log_key,
+ name, OS_FILE_OPEN,
OS_FILE_LOG, OS_FILE_AIO, &ret);
if (ret == FALSE) {
@@ -3744,8 +3786,8 @@ ask_again:
return(TRUE);
}
- start_lsn = mach_read_ull(buf + LOG_FILE_START_LSN);
- file_end_lsn = mach_read_ull(buf + LOG_FILE_END_LSN);
+ start_lsn = mach_read_from_8(buf + LOG_FILE_START_LSN);
+ file_end_lsn = mach_read_from_8(buf + LOG_FILE_END_LSN);
if (!recv_sys->scanned_lsn) {
@@ -3799,7 +3841,8 @@ ask_again:
read_offset % UNIV_PAGE_SIZE, len, buf, NULL);
ret = recv_scan_log_recs(
- (buf_pool->n_frames - recv_n_pool_free_frames)
+ (buf_pool_get_n_pages()
+ - (recv_n_pool_free_frames * srv_buf_pool_instances))
* UNIV_PAGE_SIZE, TRUE, buf, len, start_lsn,
&dummy_lsn, &scanned_lsn);
diff --git a/storage/xtradb/mach/mach0data.c b/storage/xtradb/mach/mach0data.c
index e030ce9aadf..647d9e57384 100644
--- a/storage/xtradb/mach/mach0data.c
+++ b/storage/xtradb/mach/mach0data.c
@@ -92,43 +92,3 @@ mach_parse_compressed(
return(ptr + 5);
}
}
-
-/*********************************************************//**
-Reads a dulint in a compressed form if the log record fully contains it.
-@return pointer to end of the stored field, NULL if not complete */
-UNIV_INTERN
-byte*
-mach_dulint_parse_compressed(
-/*=========================*/
- byte* ptr, /*!< in: pointer to buffer from where to read */
- byte* end_ptr,/*!< in: pointer to end of the buffer */
- dulint* val) /*!< out: read value */
-{
- ulint high;
- ulint low;
- ulint size;
-
- ut_ad(ptr && end_ptr && val);
-
- if (end_ptr < ptr + 5) {
-
- return(NULL);
- }
-
- high = mach_read_compressed(ptr);
-
- size = mach_get_compressed_size(high);
-
- ptr += size;
-
- if (end_ptr < ptr + 4) {
-
- return(NULL);
- }
-
- low = mach_read_from_4(ptr);
-
- *val = ut_dulint_create(high, low);
-
- return(ptr + 4);
-}
diff --git a/storage/xtradb/mem/mem0dbg.c b/storage/xtradb/mem/mem0dbg.c
index 1cd2ff15bab..ae43d6097a6 100644
--- a/storage/xtradb/mem/mem0dbg.c
+++ b/storage/xtradb/mem/mem0dbg.c
@@ -24,12 +24,20 @@ but is included in mem0mem.* !
Created 6/9/1994 Heikki Tuuri
*************************************************************************/
+#include "ha_prototypes.h"
+
#ifdef UNIV_MEM_DEBUG
# ifndef UNIV_HOTBACKUP
/* The mutex which protects in the debug version the hash table
containing the list of live memory heaps, and also the global
variables below. */
-UNIV_INTERN mutex_t mem_hash_mutex;
+UNIV_INTERN mutex_t mem_hash_mutex;
+
+#ifdef UNIV_PFS_MUTEX
+/* Key to register mem_hash_mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t mem_hash_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
# endif /* !UNIV_HOTBACKUP */
/* The following variables contain information about the
@@ -149,7 +157,7 @@ mem_init(
/* Initialize the hash table */
ut_a(FALSE == mem_hash_initialized);
- mutex_create(&mem_hash_mutex, SYNC_MEM_HASH);
+ mutex_create(mem_hash_mutex_key, &mem_hash_mutex, SYNC_MEM_HASH);
for (i = 0; i < MEM_HASH_SIZE; i++) {
UT_LIST_INIT(*mem_hash_get_nth_cell(i));
@@ -394,7 +402,7 @@ mem_hash_remove(
fprintf(stderr,
"Memory heap or buffer freed in %s line %lu"
" did not exist.\n",
- file_name, (ulong) line);
+ innobase_basename(file_name), (ulong) line);
ut_error;
}
@@ -413,8 +421,9 @@ mem_hash_remove(
"in %s line %lu and tried to free in %s line %lu.\n"
"Hex dump of 400 bytes around memory heap"
" first block start:\n",
- node->nth_heap, node->file_name, (ulong) node->line,
- file_name, (ulong) line);
+ node->nth_heap,
+ innobase_basename(node->file_name), (ulong) node->line,
+ innobase_basename(file_name), (ulong) line);
ut_print_buf(stderr, (byte*)node->heap - 200, 400);
fputs("\nDump of the mem heap:\n", stderr);
mem_heap_validate_or_print(node->heap, NULL, TRUE, &error,
@@ -757,7 +766,8 @@ mem_validate_no_assert(void)
"Inconsistency in memory heap"
" or buffer created\n"
"in %s line %lu.\n",
- node->file_name, node->line);
+ innobase_basename(node->file_name),
+ node->line);
mutex_exit(&mem_hash_mutex);
@@ -983,7 +993,8 @@ mem_print_info_low(
fprintf(outfile,
"%lu: file %s line %lu of size %lu phys.size %lu"
" with %lu blocks, type %lu\n",
- node->nth_heap, node->file_name, node->line,
+ node->nth_heap,
+ innobase_basename(node->file_name), node->line,
allocated_mem, ph_size, n_blocks,
(node->heap)->type);
next_heap:
diff --git a/storage/xtradb/mem/mem0mem.c b/storage/xtradb/mem/mem0mem.c
index 1dd4db30841..7727760f1cd 100644
--- a/storage/xtradb/mem/mem0mem.c
+++ b/storage/xtradb/mem/mem0mem.c
@@ -347,7 +347,7 @@ mem_heap_create_block(
return(NULL);
}
} else {
- buf_block = buf_block_alloc(0);
+ buf_block = buf_block_alloc(NULL);
}
block = (mem_block_t*) buf_block->frame;
diff --git a/storage/xtradb/mem/mem0pool.c b/storage/xtradb/mem/mem0pool.c
index 3291453eeb5..dc68cf8eb24 100644
--- a/storage/xtradb/mem/mem0pool.c
+++ b/storage/xtradb/mem/mem0pool.c
@@ -115,6 +115,11 @@ struct mem_pool_struct{
/** The common memory pool */
UNIV_INTERN mem_pool_t* mem_comm_pool = NULL;
+#ifdef UNIV_PFS_MUTEX
+/* Key to register mutex in mem_pool_struct with performance schema */
+UNIV_INTERN mysql_pfs_key_t mem_pool_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
/* We use this counter to check that the mem pool mutex does not leak;
this is to track a strange assertion failure reported at
mysql@lists.mysql.com */
@@ -230,7 +235,7 @@ mem_pool_create(
pool->buf = ut_malloc_low(size, FALSE, TRUE);
pool->size = size;
- mutex_create(&pool->mutex, SYNC_MEM_POOL);
+ mutex_create(mem_pool_mutex_key, &pool->mutex, SYNC_MEM_POOL);
/* Initialize the free lists */
diff --git a/storage/xtradb/mtr/mtr0log.c b/storage/xtradb/mtr/mtr0log.c
index d22015a575f..864970cef40 100644
--- a/storage/xtradb/mtr/mtr0log.c
+++ b/storage/xtradb/mtr/mtr0log.c
@@ -133,7 +133,7 @@ mlog_parse_initial_log_record(
}
/********************************************************//**
-Parses a log record written by mlog_write_ulint or mlog_write_dulint.
+Parses a log record written by mlog_write_ulint or mlog_write_ull.
@return parsed record end, NULL if not a complete record or a corrupt record */
UNIV_INTERN
byte*
@@ -145,9 +145,9 @@ mlog_parse_nbytes(
byte* page, /*!< in: page where to apply the log record, or NULL */
void* page_zip)/*!< in/out: compressed page, or NULL */
{
- ulint offset;
- ulint val;
- dulint dval;
+ ulint offset;
+ ulint val;
+ ib_uint64_t dval;
ut_a(type <= MLOG_8BYTES);
ut_a(!page || !page_zip || fil_page_get_type(page) != FIL_PAGE_INDEX);
@@ -167,7 +167,7 @@ mlog_parse_nbytes(
}
if (type == MLOG_8BYTES) {
- ptr = mach_dulint_parse_compressed(ptr, end_ptr, &dval);
+ ptr = mach_ull_parse_compressed(ptr, end_ptr, &dval);
if (ptr == NULL) {
@@ -290,11 +290,11 @@ Writes 8 bytes to a file page buffered in the buffer pool.
Writes the corresponding log record to the mini-transaction log. */
UNIV_INTERN
void
-mlog_write_dulint(
-/*==============*/
- byte* ptr, /*!< in: pointer where to write */
- dulint val, /*!< in: value to write */
- mtr_t* mtr) /*!< in: mini-transaction handle */
+mlog_write_ull(
+/*===========*/
+ byte* ptr, /*!< in: pointer where to write */
+ ib_uint64_t val, /*!< in: value to write */
+ mtr_t* mtr) /*!< in: mini-transaction handle */
{
byte* log_ptr;
@@ -316,7 +316,7 @@ mlog_write_dulint(
mach_write_to_2(log_ptr, page_offset(ptr));
log_ptr += 2;
- log_ptr += mach_dulint_write_compressed(log_ptr, val);
+ log_ptr += mach_ull_write_compressed(log_ptr, val);
mlog_close(mtr, log_ptr);
}
@@ -408,7 +408,7 @@ mlog_parse_string(
ptr += 2;
if (UNIV_UNLIKELY(offset >= UNIV_PAGE_SIZE)
- || UNIV_UNLIKELY(len + offset > UNIV_PAGE_SIZE)) {
+ || UNIV_UNLIKELY(len + offset > UNIV_PAGE_SIZE)) {
recv_sys->found_corrupt_log = TRUE;
return(NULL);
diff --git a/storage/xtradb/mtr/mtr0mtr.c b/storage/xtradb/mtr/mtr0mtr.c
index 34e6d3ffc92..5c946ebd756 100644
--- a/storage/xtradb/mtr/mtr0mtr.c
+++ b/storage/xtradb/mtr/mtr0mtr.c
@@ -30,6 +30,7 @@ Created 11/26/1995 Heikki Tuuri
#endif
#include "buf0buf.h"
+#include "buf0flu.h"
#include "page0types.h"
#include "mtr0log.h"
#include "log0log.h"
@@ -39,7 +40,7 @@ Created 11/26/1995 Heikki Tuuri
# include "log0recv.h"
/*****************************************************************//**
Releases the item in the slot given. */
-UNIV_INLINE
+static
void
mtr_memo_slot_release(
/*==================*/
@@ -49,14 +50,19 @@ mtr_memo_slot_release(
void* object;
ulint type;
- ut_ad(mtr && slot);
+ ut_ad(mtr);
+ ut_ad(slot);
+
+#ifndef UNIV_DEBUG
+ UT_NOT_USED(mtr);
+#endif /* UNIV_DEBUG */
object = slot->object;
type = slot->type;
if (UNIV_LIKELY(object != NULL)) {
if (type <= MTR_MEMO_BUF_FIX) {
- buf_page_release((buf_block_t*)object, type, mtr);
+ buf_page_release((buf_block_t*)object, type);
} else if (type == MTR_MEMO_S_LOCK) {
rw_lock_s_unlock((rw_lock_t*)object);
#ifdef UNIV_DEBUG
@@ -74,13 +80,10 @@ mtr_memo_slot_release(
}
/**********************************************************//**
-Releases the mlocks and other objects stored in an mtr memo. They are released
-in the order opposite to which they were pushed to the memo. NOTE! It is
-essential that the x-rw-lock on a modified buffer page is not released before
-buf_page_note_modification is called for that page! Otherwise, some thread
-might race to modify it, and the flush list sort order on lsn would be
-destroyed. */
-UNIV_INLINE
+Releases the mlocks and other objects stored in an mtr memo.
+They are released in the order opposite to which they were pushed
+to the memo. */
+static
void
mtr_memo_pop_all(
/*=============*/
@@ -106,13 +109,42 @@ mtr_memo_pop_all(
}
}
-UNIV_INLINE
+/*****************************************************************//**
+Releases the item in the slot given. */
+static
void
-mtr_memo_note_modification_all(
-/*===========================*/
- mtr_t* mtr) /* in: mtr */
+mtr_memo_slot_note_modification(
+/*============================*/
+ mtr_t* mtr, /*!< in: mtr */
+ mtr_memo_slot_t* slot) /*!< in: memo slot */
+{
+ ut_ad(mtr);
+ ut_ad(mtr->magic_n == MTR_MAGIC_N);
+ ut_ad(mtr->modifications);
+
+ if (slot->object != NULL && slot->type == MTR_MEMO_PAGE_X_FIX) {
+ buf_block_t* block = (buf_block_t*) slot->object;
+
+#ifdef UNIV_DEBUG
+ ut_ad(log_flush_order_mutex_own());
+#endif /* UNIV_DEBUG */
+ buf_flush_note_modification(block, mtr);
+ }
+}
+
+/**********************************************************//**
+Add the modified pages to the buffer flush list. They are released
+in the order opposite to which they were pushed to the memo. NOTE! It is
+essential that the x-rw-lock on a modified buffer page is not released
+before buf_page_note_modification is called for that page! Otherwise,
+some thread might race to modify it, and the flush list sort order on
+lsn would be destroyed. */
+static
+void
+mtr_memo_note_modifications(
+/*========================*/
+ mtr_t* mtr) /*!< in: mtr */
{
- mtr_memo_slot_t* slot;
dyn_array_t* memo;
ulint offset;
@@ -120,21 +152,17 @@ mtr_memo_note_modification_all(
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_COMMITTING); /* Currently only used in
commit */
- ut_ad(mtr->modifications);
-
- memo = &(mtr->memo);
+ memo = &mtr->memo;
offset = dyn_array_get_data_size(memo);
while (offset > 0) {
+ mtr_memo_slot_t* slot;
+
offset -= sizeof(mtr_memo_slot_t);
slot = dyn_array_get_element(memo, offset);
- if (UNIV_LIKELY(slot->object != NULL) &&
- slot->type == MTR_MEMO_PAGE_X_FIX) {
- buf_flush_note_modification(
- (buf_block_t*)slot->object, mtr);
- }
+ mtr_memo_slot_note_modification(mtr, slot);
}
}
@@ -170,7 +198,9 @@ mtr_log_reserve_and_write(
&mtr->start_lsn);
if (mtr->end_lsn) {
- return;
+ /* Success. We have the log mutex.
+ Add pages to flush list and exit */
+ goto func_exit;
}
}
@@ -194,6 +224,20 @@ mtr_log_reserve_and_write(
}
mtr->end_lsn = log_close();
+
+func_exit:
+ log_flush_order_mutex_enter();
+
+ /* It is now safe to release the log mutex because the
+ flush_order mutex will ensure that we are the first one
+ to insert into the flush list. */
+ log_release();
+
+ if (mtr->modifications) {
+ mtr_memo_note_modifications(mtr);
+ }
+
+ log_flush_order_mutex_exit();
}
#endif /* !UNIV_HOTBACKUP */
@@ -205,46 +249,37 @@ mtr_commit(
/*=======*/
mtr_t* mtr) /*!< in: mini-transaction */
{
-#ifndef UNIV_HOTBACKUP
- ibool write_log;
-#endif /* !UNIV_HOTBACKUP */
-
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE);
+ ut_ad(!mtr->inside_ibuf);
ut_d(mtr->state = MTR_COMMITTING);
#ifndef UNIV_HOTBACKUP
/* This is a dirty read, for debugging. */
ut_ad(!recv_no_log_write);
- write_log = mtr->modifications && mtr->n_log_recs;
- if (write_log) {
+ if (mtr->modifications && mtr->n_log_recs) {
mtr_log_reserve_and_write(mtr);
-
- mtr_memo_note_modification_all(mtr);
- }
-
- /* We first update the modification info to buffer pages, and only
- after that release the log mutex: this guarantees that when the log
- mutex is free, all buffer pages contain an up-to-date info of their
- modifications. This fact is used in making a checkpoint when we look
- at the oldest modification of any page in the buffer pool. It is also
- required when we insert modified buffer pages in to the flush list
- which must be sorted on oldest_modification. */
-
- if (write_log) {
- log_release();
}
- /* All unlocking has been moved here, after log_sys mutex release. */
mtr_memo_pop_all(mtr);
-
#endif /* !UNIV_HOTBACKUP */
- ut_d(mtr->state = MTR_COMMITTED);
dyn_array_free(&(mtr->memo));
dyn_array_free(&(mtr->log));
+#ifdef UNIV_DEBUG_VALGRIND
+ /* Declare everything uninitialized except
+ mtr->start_lsn, mtr->end_lsn and mtr->state. */
+ {
+ ib_uint64_t start_lsn = mtr->start_lsn;
+ ib_uint64_t end_lsn = mtr->end_lsn;
+ UNIV_MEM_INVALID(mtr, sizeof *mtr);
+ mtr->start_lsn = start_lsn;
+ mtr->end_lsn = end_lsn;
+ }
+#endif /* UNIV_DEBUG_VALGRIND */
+ ut_d(mtr->state = MTR_COMMITTED);
}
#ifndef UNIV_HOTBACKUP
@@ -278,6 +313,10 @@ mtr_rollback_to_savepoint(
slot = dyn_array_get_element(memo, offset);
ut_ad(slot->type != MTR_MEMO_MODIFY);
+
+ /* We do not call mtr_memo_slot_note_modification()
+ because there MUST be no changes made to the buffer
+ pages after the savepoint */
mtr_memo_slot_release(mtr, slot);
}
}
@@ -304,24 +343,26 @@ mtr_memo_release(
offset = dyn_array_get_data_size(memo);
+ log_flush_order_mutex_enter();
while (offset > 0) {
offset -= sizeof(mtr_memo_slot_t);
slot = dyn_array_get_element(memo, offset);
- if ((object == slot->object) && (type == slot->type)) {
- if (mtr->modifications &&
- UNIV_LIKELY(slot->object != NULL) &&
- slot->type == MTR_MEMO_PAGE_X_FIX) {
- buf_flush_note_modification(
- (buf_block_t*)slot->object, mtr);
- }
+ if (object == slot->object && type == slot->type) {
+
+ /* We cannot release a page that has been written
+ to in the middle of a mini-transaction. */
+
+ ut_ad(!(mtr->modifications
+ && slot->type == MTR_MEMO_PAGE_X_FIX));
mtr_memo_slot_release(mtr, slot);
break;
}
}
+ log_flush_order_mutex_exit();
}
#endif /* !UNIV_HOTBACKUP */
@@ -350,23 +391,6 @@ mtr_read_ulint(
}
}
-/********************************************************//**
-Reads 8 bytes from a file page buffered in the buffer pool.
-@return value read */
-UNIV_INTERN
-dulint
-mtr_read_dulint(
-/*============*/
- const byte* ptr, /*!< in: pointer from where to read */
- mtr_t* mtr __attribute__((unused)))
- /*!< in: mini-transaction handle */
-{
- ut_ad(mtr->state == MTR_ACTIVE);
- ut_ad(mtr_memo_contains_page(mtr, ptr, MTR_MEMO_PAGE_S_FIX)
- || mtr_memo_contains_page(mtr, ptr, MTR_MEMO_PAGE_X_FIX));
- return(mach_read_from_8(ptr));
-}
-
#ifdef UNIV_DEBUG
# ifndef UNIV_HOTBACKUP
/**********************************************************//**
diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c
index 48d796c38e1..835210140f8 100644
--- a/storage/xtradb/os/os0file.c
+++ b/storage/xtradb/os/os0file.c
@@ -33,6 +33,11 @@ Created 10/21/1995 Heikki Tuuri
*******************************************************/
#include "os0file.h"
+
+#ifdef UNIV_NONINL
+#include "os0file.ic"
+#endif
+
#include "ut0mem.h"
#include "srv0srv.h"
#include "srv0start.h"
@@ -53,6 +58,10 @@ Created 10/21/1995 Heikki Tuuri
# endif /* __WIN__ */
#endif /* !UNIV_HOTBACKUP */
+#if defined(LINUX_NATIVE_AIO)
+#include <libaio.h>
+#endif
+
/* This specifies the file permissions InnoDB uses when it creates files in
Unix; the value of os_innodb_umask is initialized in ha_innodb.cc to
my_umask */
@@ -74,9 +83,7 @@ UNIV_INTERN ibool os_do_not_call_flush_at_each_write = FALSE;
/* We do not call os_file_flush in every os_file_write. */
#endif /* UNIV_DO_FLUSH */
-#ifdef UNIV_HOTBACKUP
-# define os_aio_use_native_aio FALSE
-#else /* UNIV_HOTBACKUP */
+#ifndef UNIV_HOTBACKUP
/* We use these mutexes to protect lseek + file i/o operation, if the
OS does not provide an atomic pread or pwrite, or similar */
#define OS_FILE_N_SEEK_MUTEXES 16
@@ -85,36 +92,69 @@ UNIV_INTERN os_mutex_t os_file_seek_mutexes[OS_FILE_N_SEEK_MUTEXES];
/* In simulated aio, merge at most this many consecutive i/os */
#define OS_AIO_MERGE_N_CONSECUTIVE 64
-/** If this flag is TRUE, then we will use the native aio of the
-OS (provided we compiled Innobase with it in), otherwise we will
-use simulated aio we build below with threads */
-
-UNIV_INTERN ibool os_aio_use_native_aio = FALSE;
+/**********************************************************************
+
+InnoDB AIO Implementation:
+=========================
+
+We support native AIO for windows and linux. For rest of the platforms
+we simulate AIO by special io-threads servicing the IO-requests.
+
+Simulated AIO:
+==============
+
+In platforms where we 'simulate' AIO following is a rough explanation
+of the high level design.
+There are four io-threads (for ibuf, log, read, write).
+All synchronous IO requests are serviced by the calling thread using
+os_file_write/os_file_read. The Asynchronous requests are queued up
+in an array (there are four such arrays) by the calling thread.
+Later these requests are picked up by the io-thread and are serviced
+synchronously.
+
+Windows native AIO:
+==================
+
+If srv_use_native_aio is not set then windows follow the same
+code as simulated AIO. If the flag is set then native AIO interface
+is used. On windows, one of the limitation is that if a file is opened
+for AIO no synchronous IO can be done on it. Therefore we have an
+extra fifth array to queue up synchronous IO requests.
+There are innodb_file_io_threads helper threads. These threads work
+on the four arrays mentioned above in Simulated AIO. No thread is
+required for the sync array.
+If a synchronous IO request is made, it is first queued in the sync
+array. Then the calling thread itself waits on the request, thus
+making the call synchronous.
+If an AIO request is made the calling thread not only queues it in the
+array but also submits the requests. The helper thread then collects
+the completed IO request and calls completion routine on it.
+
+Linux native AIO:
+=================
+
+If we have libaio installed on the system and innodb_use_native_aio
+is set to TRUE we follow the code path of native AIO, otherwise we
+do simulated AIO.
+There are innodb_file_io_threads helper threads. These threads work
+on the four arrays mentioned above in Simulated AIO.
+If a synchronous IO request is made, it is handled by calling
+os_file_write/os_file_read.
+If an AIO request is made the calling thread not only queues it in the
+array but also submits the requests. The helper thread then collects
+the completed IO request and calls completion routine on it.
+
+**********************************************************************/
/** Flag: enable debug printout for asynchronous i/o */
UNIV_INTERN ibool os_aio_print_debug = FALSE;
-/* State for the state of an IO request in simulated AIO.
- Protocol for simulated aio:
- client requests IO: find slot with reserved = FALSE. Add entry with
- status = OS_AIO_NOT_ISSUED.
- IO thread wakes: find adjacent slots with reserved = TRUE and status =
- OS_AIO_NOT_ISSUED. Change status for slots to
- OS_AIO_ISSUED.
- IO operation completes: set status for slots to OS_AIO_DONE. set status
- for the first slot to OS_AIO_CLAIMED and return
- result for that slot.
- When there are multiple read and write threads, they all compete to execute
- the requests in the array (os_aio_array_t). This avoids the need to load
- balance requests at the time the request is made at the cost of waking all
- threads when a request is available.
-*/
-typedef enum {
- OS_AIO_NOT_ISSUED, /* Available to be processed by an IO thread. */
- OS_AIO_ISSUED, /* Being processed by an IO thread. */
- OS_AIO_DONE, /* Request processed. */
- OS_AIO_CLAIMED /* Result being returned to client. */
-} os_aio_status;
+#ifdef UNIV_PFS_IO
+/* Keys to register InnoDB I/O with performance schema */
+UNIV_INTERN mysql_pfs_key_t innodb_file_data_key;
+UNIV_INTERN mysql_pfs_key_t innodb_file_log_key;
+UNIV_INTERN mysql_pfs_key_t innodb_file_temp_key;
+#endif /* UNIV_PFS_IO */
/** The asynchronous i/o array slot structure */
typedef struct os_aio_slot_struct os_aio_slot_t;
@@ -125,8 +165,6 @@ struct os_aio_slot_struct{
ulint pos; /*!< index of the slot in the aio
array */
ibool reserved; /*!< TRUE if this slot is reserved */
- os_aio_status status; /* Status for current request. Valid when reserved
- is TRUE. Used only in simulated aio. */
time_t reservation_time;/*!< time when reserved */
ulint len; /*!< length of the block to read or
write */
@@ -137,21 +175,26 @@ struct os_aio_slot_struct{
ulint offset_high; /*!< 32 high bits of file offset */
os_file_t file; /*!< file where to read or write */
const char* name; /*!< file name or path */
-// ibool io_already_done;/*!< used only in simulated aio:
-// TRUE if the physical i/o already
-// made and only the slot message
-// needs to be passed to the caller
-// of os_aio_simulated_handle */
+ ibool io_already_done;/*!< used only in simulated aio:
+ TRUE if the physical i/o already
+ made and only the slot message
+ needs to be passed to the caller
+ of os_aio_simulated_handle */
+ ulint space_id;
fil_node_t* message1; /*!< message which is given by the */
void* message2; /*!< the requester of an aio operation
and which can be used to identify
which pending aio operation was
completed */
#ifdef WIN_ASYNC_IO
- os_event_t event; /*!< event object we need in the
+ HANDLE handle; /*!< handle object we need in the
OVERLAPPED struct */
OVERLAPPED control; /*!< Windows control block for the
aio request */
+#elif defined(LINUX_NATIVE_AIO)
+ struct iocb control; /* Linux control block for aio */
+ int n_bytes; /* bytes written/read. */
+ int ret; /* AIO return code */
#endif
};
@@ -177,12 +220,16 @@ struct os_aio_array_struct{
array of pending aio requests. A
thread can wait separately for any one
of the segments. */
+ ulint cur_seg;/*!< We reserve IO requests in round
+ robin fashion to different segments.
+ This points to the segment that is to
+ be used to service next IO request. */
ulint n_reserved;
/*!< Number of reserved slots in the
aio array outside the ibuf segment */
os_aio_slot_t* slots; /*!< Pointer to the slots in the array */
#ifdef __WIN__
- os_native_event_t* native_events;
+ HANDLE* handles;
/*!< Pointer to an array of OS native
event handles where we copied the
handles from slots, in the same
@@ -190,17 +237,33 @@ struct os_aio_array_struct{
WaitForMultipleObjects; used only in
Windows */
#endif
+
+#if defined(LINUX_NATIVE_AIO)
+ io_context_t* aio_ctx;
+ /* completion queue for IO. There is
+ one such queue per segment. Each thread
+ will work on one ctx exclusively. */
+ struct io_event* aio_events;
+ /* The array to collect completed IOs.
+ There is one such event for each
+ possible pending IO. The size of the
+ array is equal to n_slots. */
+#endif
};
-/** Array of events used in simulated aio */
-static os_event_t* os_aio_segment_wait_events = NULL;
+#if defined(LINUX_NATIVE_AIO)
+/** timeout for each io_getevents() call = 500ms. */
+#define OS_AIO_REAP_TIMEOUT (500000000UL)
+
+/** time to sleep, in microseconds if io_setup() returns EAGAIN. */
+#define OS_AIO_IO_SETUP_RETRY_SLEEP (500000UL)
-/* Number for the first global segment for reading. */
-const ulint os_aio_first_read_segment = 2;
+/** number of attempts before giving up on io_setup(). */
+#define OS_AIO_IO_SETUP_RETRY_ATTEMPTS 5
+#endif
-/* Number for the first global segment for writing. Set to
-2 + os_aio_read_write_threads. */
-ulint os_aio_first_write_segment = 0;
+/** Array of events used in simulated aio */
+static os_event_t* os_aio_segment_wait_events = NULL;
/** The aio arrays for non-ibuf i/o and ibuf i/o, as well as sync aio. These
are NULL when the module has not yet been initialized. @{ */
@@ -211,19 +274,13 @@ static os_aio_array_t* os_aio_log_array = NULL; /*!< Redo log */
static os_aio_array_t* os_aio_sync_array = NULL; /*!< Synchronous I/O */
/* @} */
-/* Per thread buffer used for merged IO requests. Used by
-os_aio_simulated_handle so that a buffer doesn't have to be allocated
-for each request. */
-static byte* os_aio_thread_buffer[SRV_MAX_N_IO_THREADS];
-static ulint os_aio_thread_buffer_size[SRV_MAX_N_IO_THREADS];
-
/** Number of asynchronous I/O segments. Set by os_aio_init(). */
static ulint os_aio_n_segments = ULINT_UNDEFINED;
/** If the following is TRUE, read i/o handler threads try to
wait until a batch of new read requests have been posted */
-static volatile ibool os_aio_recommend_sleep_for_read_threads = FALSE;
-#endif /* UNIV_HOTBACKUP */
+static ibool os_aio_recommend_sleep_for_read_threads = FALSE;
+#endif /* !UNIV_HOTBACKUP */
UNIV_INTERN ulint os_n_file_reads = 0;
UNIV_INTERN ulint os_bytes_read_since_printout = 0;
@@ -249,15 +306,45 @@ UNIV_INTERN ulint os_n_pending_writes = 0;
/** Number of pending read operations */
UNIV_INTERN ulint os_n_pending_reads = 0;
+#ifdef UNIV_DEBUG
+/**********************************************************************//**
+Validates the consistency the aio system some of the time.
+@return TRUE if ok or the check was skipped */
+UNIV_INTERN
+ibool
+os_aio_validate_skip(void)
+/*======================*/
+{
+/** Try os_aio_validate() every this many times */
+# define OS_AIO_VALIDATE_SKIP 13
+
+ /** The os_aio_validate() call skip counter.
+ Use a signed type because of the race condition below. */
+ static int os_aio_validate_count = OS_AIO_VALIDATE_SKIP;
+
+ /* There is a race condition below, but it does not matter,
+ because this call is only for heuristic purposes. We want to
+ reduce the call frequency of the costly os_aio_validate()
+ check in debug builds. */
+ if (--os_aio_validate_count > 0) {
+ return(TRUE);
+ }
+
+ os_aio_validate_count = OS_AIO_VALIDATE_SKIP;
+ return(os_aio_validate());
+}
+#endif /* UNIV_DEBUG */
+
+#ifdef __WIN__
/***********************************************************************//**
Gets the operating system version. Currently works only on Windows.
-@return OS_WIN95, OS_WIN31, OS_WINNT, OS_WIN2000 */
+@return OS_WIN95, OS_WIN31, OS_WINNT, OS_WIN2000, OS_WINXP, OS_WINVISTA,
+OS_WIN7. */
UNIV_INTERN
ulint
os_get_os_version(void)
/*===================*/
{
-#ifdef __WIN__
OSVERSIONINFO os_info;
os_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -269,21 +356,25 @@ os_get_os_version(void)
} else if (os_info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
return(OS_WIN95);
} else if (os_info.dwPlatformId == VER_PLATFORM_WIN32_NT) {
- if (os_info.dwMajorVersion <= 4) {
- return(OS_WINNT);
- } else {
- return(OS_WIN2000);
+ switch (os_info.dwMajorVersion) {
+ case 3:
+ case 4:
+ return OS_WINNT;
+ case 5:
+ return (os_info.dwMinorVersion == 0) ? OS_WIN2000
+ : OS_WINXP;
+ case 6:
+ return (os_info.dwMinorVersion == 0) ? OS_WINVISTA
+ : OS_WIN7;
+ default:
+ return OS_WIN7;
}
} else {
ut_error;
return(0);
}
-#else
- ut_error;
-
- return(0);
-#endif
}
+#endif /* __WIN__ */
/***********************************************************************//**
Retrieves the last error number if an error occurs in a file io function.
@@ -429,17 +520,29 @@ os_file_get_last_error(
fflush(stderr);
- if (err == ENOSPC) {
+ switch (err) {
+ case ENOSPC:
return(OS_FILE_DISK_FULL);
- } else if (err == ENOENT) {
+ case ENOENT:
return(OS_FILE_NOT_FOUND);
- } else if (err == EEXIST) {
+ case EEXIST:
return(OS_FILE_ALREADY_EXISTS);
- } else if (err == EXDEV || err == ENOTDIR || err == EISDIR) {
+ case EXDEV:
+ case ENOTDIR:
+ case EISDIR:
return(OS_FILE_PATH_ERROR);
- } else {
- return(100 + err);
+ case EAGAIN:
+ if (srv_use_native_aio) {
+ return(OS_FILE_AIO_RESOURCES_RESERVED);
+ }
+ break;
+ case EINTR:
+ if (srv_use_native_aio) {
+ return(OS_FILE_AIO_INTERRUPTED);
+ }
+ break;
}
+ return(100 + err);
#endif
}
@@ -489,6 +592,9 @@ os_file_handle_error_cond_exit(
} else if (err == OS_FILE_AIO_RESOURCES_RESERVED) {
return(TRUE);
+ } else if (err == OS_FILE_AIO_INTERRUPTED) {
+
+ return(TRUE);
} else if (err == OS_FILE_ALREADY_EXISTS
|| err == OS_FILE_PATH_ERROR) {
@@ -555,7 +661,7 @@ os_file_handle_error_no_exit(
#undef USE_FILE_LOCK
#define USE_FILE_LOCK
-#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__)
+#if defined(UNIV_HOTBACKUP) || defined(__WIN__)
/* InnoDB Hot Backup does not lock the data files.
* On Windows, mandatory locking is used.
*/
@@ -605,45 +711,37 @@ os_io_init_simple(void)
{
ulint i;
- os_file_count_mutex = os_mutex_create(NULL);
+ os_file_count_mutex = os_mutex_create();
for (i = 0; i < OS_FILE_N_SEEK_MUTEXES; i++) {
- os_file_seek_mutexes[i] = os_mutex_create(NULL);
+ os_file_seek_mutexes[i] = os_mutex_create();
}
}
/***********************************************************************//**
Creates a temporary file. This function is like tmpfile(3), but
the temporary file is created in the MySQL temporary directory.
-On Netware, this function is like tmpfile(3), because the C run-time
-library of Netware does not expose the delete-on-close flag.
@return temporary file handle, or NULL on error */
UNIV_INTERN
FILE*
os_file_create_tmpfile(void)
/*========================*/
{
-#ifdef __NETWARE__
- FILE* file = tmpfile();
-#else /* __NETWARE__ */
FILE* file = NULL;
int fd = innobase_mysql_tmpfile();
if (fd >= 0) {
file = fdopen(fd, "w+b");
}
-#endif /* __NETWARE__ */
if (!file) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: unable to create temporary file;"
" errno: %d\n", errno);
-#ifndef __NETWARE__
if (fd >= 0) {
close(fd);
}
-#endif /* !__NETWARE__ */
}
return(file);
@@ -964,13 +1062,15 @@ os_file_create_directory(
}
/****************************************************************//**
+NOTE! Use the corresponding macro os_file_create_simple(), not directly
+this function!
A simple function to open or create a file.
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INTERN
os_file_t
-os_file_create_simple(
-/*==================*/
+os_file_create_simple_func(
+/*=======================*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file is
@@ -1105,13 +1205,15 @@ try_again:
}
/****************************************************************//**
+NOTE! Use the corresponding macro
+os_file_create_simple_no_error_handling(), not directly this function!
A simple function to open or create a file.
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INTERN
os_file_t
-os_file_create_simple_no_error_handling(
-/*====================================*/
+os_file_create_simple_no_error_handling_func(
+/*=========================================*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file
@@ -1222,10 +1324,12 @@ UNIV_INTERN
void
os_file_set_nocache(
/*================*/
- int fd, /*!< in: file descriptor to alter */
- const char* file_name, /*!< in: file name, used in the
- diagnostic message */
- const char* operation_name) /*!< in: "open" or "create"; used in the
+ int fd /*!< in: file descriptor to alter */
+ __attribute__((unused)),
+ const char* file_name /*!< in: used in the diagnostic message */
+ __attribute__((unused)),
+ const char* operation_name __attribute__((unused)))
+ /*!< in: "open" or "create"; used in the
diagnostic message */
{
/* some versions of Solaris may not have DIRECTIO_ON */
@@ -1260,13 +1364,15 @@ os_file_set_nocache(
}
/****************************************************************//**
+NOTE! Use the corresponding macro os_file_create(), not directly
+this function!
Opens an existing file or creates a new.
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INTERN
os_file_t
-os_file_create(
-/*===========*/
+os_file_create_func(
+/*================*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file
@@ -1316,13 +1422,13 @@ try_again:
buffering of writes in the OS */
attributes = 0;
#ifdef WIN_ASYNC_IO
- if (os_aio_use_native_aio) {
+ if (srv_use_native_aio) {
attributes = attributes | FILE_FLAG_OVERLAPPED;
}
#endif
#ifdef UNIV_NON_BUFFERED_IO
# ifndef UNIV_HOTBACKUP
- if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
+ if (type == OS_LOG_FILE && thd_flush_log_at_trx_commit(NULL) == 2) {
/* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every
commit, but only once per second */
@@ -1338,7 +1444,7 @@ try_again:
attributes = 0;
#ifdef UNIV_NON_BUFFERED_IO
# ifndef UNIV_HOTBACKUP
- if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
+ if (type == OS_LOG_FILE && thd_flush_log_at_trx_commit(NULL) == 2) {
/* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every
commit, but only once per second */
@@ -1407,8 +1513,6 @@ try_again:
int create_flag;
ibool retry;
const char* mode_str = NULL;
- const char* type_str = NULL;
- const char* purpose_str = NULL;
try_again:
ut_a(name);
@@ -1428,26 +1532,9 @@ try_again:
ut_error;
}
- if (type == OS_LOG_FILE) {
- type_str = "LOG";
- } else if (type == OS_DATA_FILE) {
- type_str = "DATA";
- } else {
- ut_error;
- }
+ ut_a(type == OS_LOG_FILE || type == OS_DATA_FILE);
+ ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL);
- if (purpose == OS_FILE_AIO) {
- purpose_str = "AIO";
- } else if (purpose == OS_FILE_NORMAL) {
- purpose_str = "NORMAL";
- } else {
- ut_error;
- }
-
-#if 0
- fprintf(stderr, "Opening file %s, mode %s, type %s, purpose %s\n",
- name, mode_str, type_str, purpose_str);
-#endif
#ifdef O_SYNC
/* We let O_SYNC only affect log files; note that we map O_DSYNC to
O_SYNC because the datasync options seemed to corrupt files in 2001
@@ -1664,13 +1751,14 @@ loop:
}
/***********************************************************************//**
+NOTE! Use the corresponding macro os_file_rename(), not directly this function!
Renames a file (can also move it to another directory). It is safest that the
file is closed before calling this function.
@return TRUE if success */
UNIV_INTERN
ibool
-os_file_rename(
-/*===========*/
+os_file_rename_func(
+/*================*/
const char* oldpath,/*!< in: old file path as a null-terminated
string */
const char* newpath)/*!< in: new file path */
@@ -1703,13 +1791,14 @@ os_file_rename(
}
/***********************************************************************//**
+NOTE! Use the corresponding macro os_file_close(), not directly this function!
Closes a file handle. In case of error, error number can be retrieved with
os_file_get_last_error.
@return TRUE if success */
UNIV_INTERN
ibool
-os_file_close(
-/*==========*/
+os_file_close_func(
+/*===============*/
os_file_t file) /*!< in, own: handle to a file */
{
#ifdef __WIN__
@@ -1928,7 +2017,7 @@ os_file_set_size(
ut_free(buf2);
- ret = os_file_flush(file);
+ ret = os_file_flush(file, TRUE);
if (ret) {
return(TRUE);
@@ -1966,7 +2055,8 @@ static
int
os_file_fsync(
/*==========*/
- os_file_t file) /*!< in: handle to a file */
+ os_file_t file, /*!< in: handle to a file */
+ ibool metadata)
{
int ret;
int failures;
@@ -1975,7 +2065,16 @@ os_file_fsync(
failures = 0;
do {
+#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
+ if (metadata) {
+ ret = fsync(file);
+ } else {
+ ret = fdatasync(file);
+ }
+#else
+ (void) metadata;
ret = fsync(file);
+#endif
os_n_fsyncs++;
@@ -1994,6 +2093,9 @@ os_file_fsync(
failures++;
retry = TRUE;
+ } else if (ret == -1 && errno == EINTR) {
+ /* Handle signal interruptions correctly */
+ retry = TRUE;
} else {
retry = FALSE;
@@ -2005,13 +2107,15 @@ os_file_fsync(
#endif /* !__WIN__ */
/***********************************************************************//**
+NOTE! Use the corresponding macro os_file_flush(), not directly this function!
Flushes the write buffers of a given file to the disk.
@return TRUE if success */
UNIV_INTERN
ibool
-os_file_flush(
-/*==========*/
- os_file_t file) /*!< in, own: handle to a file */
+os_file_flush_func(
+/*===============*/
+ os_file_t file, /*!< in, own: handle to a file */
+ ibool metadata)
{
#ifdef __WIN__
BOOL ret;
@@ -2061,18 +2165,18 @@ os_file_flush(
/* If we are not on an operating system that supports this,
then fall back to a plain fsync. */
- ret = os_file_fsync(file);
+ ret = os_file_fsync(file, metadata);
} else {
ret = fcntl(file, F_FULLFSYNC, NULL);
if (ret) {
/* If we are not on a file system that supports this,
then fall back to a plain fsync. */
- ret = os_file_fsync(file);
+ ret = os_file_fsync(file, metadata);
}
}
#else
- ret = os_file_fsync(file);
+ ret = os_file_fsync(file, metadata);
#endif
if (ret == 0) {
@@ -2106,12 +2210,9 @@ os_file_flush(
/*******************************************************************//**
Does a synchronous read operation in Posix.
@return number of bytes read, -1 if error */
-#define os_file_pread(file, buf, n, offset, offset_high) \
- _os_file_pread(file, buf, n, offset, offset_high, NULL);
-
static
ssize_t
-_os_file_pread(
+os_file_pread(
/*==========*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
@@ -2125,6 +2226,7 @@ _os_file_pread(
off_t offs;
#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
ssize_t n_bytes;
+ ssize_t n_read;
#endif /* HAVE_PREAD && !HAVE_BROKEN_PREAD */
ulint sec;
ulint ms;
@@ -2165,7 +2267,18 @@ _os_file_pread(
os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex);
- n_bytes = pread(file, buf, (ssize_t)n, offs);
+ /* Handle signal interruptions correctly */
+ for (n_bytes = 0; n_bytes < (ssize_t) n; ) {
+ n_read = pread(file, buf, (ssize_t)n, offs);
+ if (n_read > 0) {
+ n_bytes += n_read;
+ offs += n_read;
+ } else if (n_read == -1 && errno == EINTR) {
+ continue;
+ } else {
+ break;
+ }
+ }
os_mutex_enter(os_file_count_mutex);
os_file_n_pending_preads--;
@@ -2184,6 +2297,7 @@ _os_file_pread(
{
off_t ret_offset;
ssize_t ret;
+ ssize_t n_read;
#ifndef UNIV_HOTBACKUP
ulint i;
#endif /* !UNIV_HOTBACKUP */
@@ -2204,7 +2318,17 @@ _os_file_pread(
if (ret_offset < 0) {
ret = -1;
} else {
- ret = read(file, buf, (ssize_t)n);
+ /* Handle signal interruptions correctly */
+ for (ret = 0; ret < (ssize_t) n; ) {
+ n_read = read(file, buf, (ssize_t)n);
+ if (n_read > 0) {
+ ret += n_read;
+ } else if (n_read == -1 && errno == EINTR) {
+ continue;
+ } else {
+ break;
+ }
+ }
}
#ifndef UNIV_HOTBACKUP
@@ -2243,6 +2367,7 @@ os_file_pwrite(
offset */
{
ssize_t ret;
+ ssize_t n_written;
off_t offs;
ut_a((offset & 0xFFFFFFFFUL) == offset);
@@ -2270,7 +2395,18 @@ os_file_pwrite(
os_n_pending_writes++;
os_mutex_exit(os_file_count_mutex);
- ret = pwrite(file, buf, (ssize_t)n, offs);
+ /* Handle signal interruptions correctly */
+ for (ret = 0; ret < (ssize_t) n; ) {
+ n_written = pwrite(file, buf, (ssize_t)n, offs);
+ if (n_written > 0) {
+ ret += n_written;
+ offs += n_written;
+ } else if (n_written == -1 && errno == EINTR) {
+ continue;
+ } else {
+ break;
+ }
+ }
os_mutex_enter(os_file_count_mutex);
os_file_n_pending_pwrites--;
@@ -2286,7 +2422,7 @@ os_file_pwrite(
the OS crashes, a database page is only partially
physically written to disk. */
- ut_a(TRUE == os_file_flush(file));
+ ut_a(TRUE == os_file_flush(file, TRUE));
}
# endif /* UNIV_DO_FLUSH */
@@ -2317,7 +2453,17 @@ os_file_pwrite(
goto func_exit;
}
- ret = write(file, buf, (ssize_t)n);
+ /* Handle signal interruptions correctly */
+ for (ret = 0; ret < (ssize_t) n; ) {
+ n_written = write(file, buf, (ssize_t)n);
+ if (n_written > 0) {
+ ret += n_written;
+ } else if (n_written == -1 && errno == EINTR) {
+ continue;
+ } else {
+ break;
+ }
+ }
# ifdef UNIV_DO_FLUSH
if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
@@ -2328,7 +2474,7 @@ os_file_pwrite(
the OS crashes, a database page is only partially
physically written to disk. */
- ut_a(TRUE == os_file_flush(file));
+ ut_a(TRUE == os_file_flush(file, TRUE));
}
# endif /* UNIV_DO_FLUSH */
@@ -2348,12 +2494,14 @@ func_exit:
#endif
/*******************************************************************//**
+NOTE! Use the corresponding macro os_file_read(), not directly this
+function!
Requests a synchronous positioned read operation.
@return TRUE if request was successful, FALSE if fail */
UNIV_INTERN
ibool
-_os_file_read(
-/*=========*/
+os_file_read_func(
+/*==============*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
ulint offset, /*!< in: least significant 32 bits of file
@@ -2374,7 +2522,10 @@ _os_file_read(
ulint i;
#endif /* !UNIV_HOTBACKUP */
+ /* On 64-bit Windows, ulint is 64 bits. But offset and n should be
+ no more than 32 bits. */
ut_a((offset & 0xFFFFFFFFUL) == offset);
+ ut_a((n & 0xFFFFFFFFUL) == n);
os_n_file_reads++;
os_bytes_read_since_printout += n;
@@ -2433,7 +2584,7 @@ try_again:
os_bytes_read_since_printout += n;
try_again:
- ret = _os_file_pread(file, buf, n, offset, offset_high, trx);
+ ret = os_file_pread(file, buf, n, offset, offset_high, trx);
if ((ulint)ret == n) {
@@ -2472,13 +2623,15 @@ error_handling:
}
/*******************************************************************//**
+NOTE! Use the corresponding macro os_file_read_no_error_handling(),
+not directly this function!
Requests a synchronous positioned read operation. This function does not do
any error handling. In case of error it returns FALSE.
@return TRUE if request was successful, FALSE if fail */
UNIV_INTERN
ibool
-os_file_read_no_error_handling(
-/*===========================*/
+os_file_read_no_error_handling_func(
+/*================================*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
ulint offset, /*!< in: least significant 32 bits of file
@@ -2498,7 +2651,10 @@ os_file_read_no_error_handling(
ulint i;
#endif /* !UNIV_HOTBACKUP */
+ /* On 64-bit Windows, ulint is 64 bits. But offset and n should be
+ no more than 32 bits. */
ut_a((offset & 0xFFFFFFFFUL) == offset);
+ ut_a((n & 0xFFFFFFFFUL) == n);
os_n_file_reads++;
os_bytes_read_since_printout += n;
@@ -2557,7 +2713,7 @@ try_again:
os_bytes_read_since_printout += n;
try_again:
- ret = os_file_pread(file, buf, n, offset, offset_high);
+ ret = os_file_pread(file, buf, n, offset, offset_high, NULL);
if ((ulint)ret == n) {
@@ -2600,12 +2756,14 @@ os_file_read_string(
}
/*******************************************************************//**
+NOTE! Use the corresponding macro os_file_write(), not directly
+this function!
Requests a synchronous write operation.
@return TRUE if request was successful, FALSE if fail */
UNIV_INTERN
ibool
-os_file_write(
-/*==========*/
+os_file_write_func(
+/*===============*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
os_file_t file, /*!< in: handle to a file */
@@ -2628,7 +2786,10 @@ os_file_write(
ulint i;
#endif /* !UNIV_HOTBACKUP */
- ut_a((offset & 0xFFFFFFFF) == offset);
+ /* On 64-bit Windows, ulint is 64 bits. But offset and n should be
+ no more than 32 bits. */
+ ut_a((offset & 0xFFFFFFFFUL) == offset);
+ ut_a((n & 0xFFFFFFFFUL) == n);
os_n_file_writes++;
@@ -2686,7 +2847,7 @@ retry:
# ifdef UNIV_DO_FLUSH
if (!os_do_not_call_flush_at_each_write) {
- ut_a(TRUE == os_file_flush(file));
+ ut_a(TRUE == os_file_flush(file, TRUE));
}
# endif /* UNIV_DO_FLUSH */
@@ -3064,15 +3225,106 @@ os_aio_array_get_nth_slot(
return((array->slots) + index);
}
-/************************************************************************//**
-Creates an aio wait array.
-@return own: aio array */
+#if defined(LINUX_NATIVE_AIO)
+/******************************************************************//**
+Creates an io_context for native linux AIO.
+@return TRUE on success. */
+static
+ibool
+os_aio_linux_create_io_ctx(
+/*=======================*/
+ ulint max_events, /*!< in: number of events. */
+ io_context_t* io_ctx) /*!< out: io_ctx to initialize. */
+{
+ int ret;
+ ulint retries = 0;
+
+retry:
+ memset(io_ctx, 0x0, sizeof(*io_ctx));
+
+ /* Initialize the io_ctx. Tell it how many pending
+ IO requests this context will handle. */
+
+ ret = io_setup(max_events, io_ctx);
+ if (ret == 0) {
+#if defined(UNIV_AIO_DEBUG)
+ fprintf(stderr,
+ "InnoDB: Linux native AIO:"
+ " initialized io_ctx for segment\n");
+#endif
+ /* Success. Return now. */
+ return(TRUE);
+ }
+
+ /* If we hit EAGAIN we'll make a few attempts before failing. */
+
+ switch (ret) {
+ case -EAGAIN:
+ if (retries == 0) {
+ /* First time around. */
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Warning: io_setup() failed"
+ " with EAGAIN. Will make %d attempts"
+ " before giving up.\n",
+ OS_AIO_IO_SETUP_RETRY_ATTEMPTS);
+ }
+
+ if (retries < OS_AIO_IO_SETUP_RETRY_ATTEMPTS) {
+ ++retries;
+ fprintf(stderr,
+ "InnoDB: Warning: io_setup() attempt"
+ " %lu failed.\n",
+ retries);
+ os_thread_sleep(OS_AIO_IO_SETUP_RETRY_SLEEP);
+ goto retry;
+ }
+
+ /* Have tried enough. Better call it a day. */
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: io_setup() failed"
+ " with EAGAIN after %d attempts.\n",
+ OS_AIO_IO_SETUP_RETRY_ATTEMPTS);
+ break;
+
+ case -ENOSYS:
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: Linux Native AIO interface"
+ " is not supported on this platform. Please"
+ " check your OS documentation and install"
+ " appropriate binary of InnoDB.\n");
+
+ break;
+
+ default:
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: Linux Native AIO setup"
+ " returned following error[%d]\n", -ret);
+ break;
+ }
+
+ fprintf(stderr,
+ "InnoDB: You can disable Linux Native AIO by"
+ " setting innodb_native_aio = off in my.cnf\n");
+ return(FALSE);
+}
+#endif /* LINUX_NATIVE_AIO */
+
+/******************************************************************//**
+Creates an aio wait array. Note that we return NULL in case of failure.
+We don't care about freeing memory here because we assume that a
+failure will result in server refusing to start up.
+@return own: aio array, NULL on failure */
static
os_aio_array_t*
os_aio_array_create(
/*================*/
- ulint n, /*!< in: maximum number of pending aio operations
- allowed; n must be divisible by n_segments */
+ ulint n, /*!< in: maximum number of pending aio
+ operations allowed; n must be
+ divisible by n_segments */
ulint n_segments) /*!< in: number of segments in the aio array */
{
os_aio_array_t* array;
@@ -3080,13 +3332,15 @@ os_aio_array_create(
os_aio_slot_t* slot;
#ifdef WIN_ASYNC_IO
OVERLAPPED* over;
+#elif defined(LINUX_NATIVE_AIO)
+ struct io_event* io_event = NULL;
#endif
ut_a(n > 0);
ut_a(n_segments > 0);
array = ut_malloc(sizeof(os_aio_array_t));
- array->mutex = os_mutex_create(NULL);
+ array->mutex = os_mutex_create();
array->not_full = os_event_create(NULL);
array->is_empty = os_event_create(NULL);
@@ -3095,23 +3349,66 @@ os_aio_array_create(
array->n_slots = n;
array->n_segments = n_segments;
array->n_reserved = 0;
+ array->cur_seg = 0;
array->slots = ut_malloc(n * sizeof(os_aio_slot_t));
#ifdef __WIN__
- array->native_events = ut_malloc(n * sizeof(os_native_event_t));
+ array->handles = ut_malloc(n * sizeof(HANDLE));
#endif
+
+#if defined(LINUX_NATIVE_AIO)
+ array->aio_ctx = NULL;
+ array->aio_events = NULL;
+
+ /* If we are not using native aio interface then skip this
+ part of initialization. */
+ if (!srv_use_native_aio) {
+ goto skip_native_aio;
+ }
+
+ /* Initialize the io_context array. One io_context
+ per segment in the array. */
+
+ array->aio_ctx = ut_malloc(n_segments *
+ sizeof(*array->aio_ctx));
+ for (i = 0; i < n_segments; ++i) {
+ if (!os_aio_linux_create_io_ctx(n/n_segments,
+ &array->aio_ctx[i])) {
+ /* If something bad happened during aio setup
+ we should call it a day and return right away.
+ We don't care about any leaks because a failure
+ to initialize the io subsystem means that the
+ server (or atleast the innodb storage engine)
+ is not going to startup. */
+ return(NULL);
+ }
+ }
+
+ /* Initialize the event array. One event per slot. */
+ io_event = ut_malloc(n * sizeof(*io_event));
+ memset(io_event, 0x0, sizeof(*io_event) * n);
+ array->aio_events = io_event;
+
+skip_native_aio:
+#endif /* LINUX_NATIVE_AIO */
for (i = 0; i < n; i++) {
slot = os_aio_array_get_nth_slot(array, i);
slot->pos = i;
slot->reserved = FALSE;
#ifdef WIN_ASYNC_IO
- slot->event = os_event_create(NULL);
+ slot->handle = CreateEvent(NULL,TRUE, FALSE, NULL);
over = &(slot->control);
- over->hEvent = slot->event->handle;
+ over->hEvent = slot->handle;
+
+ *((array->handles) + i) = over->hEvent;
- *((array->native_events) + i) = over->hEvent;
+#elif defined(LINUX_NATIVE_AIO)
+
+ memset(&slot->control, 0x0, sizeof(slot->control));
+ slot->n_bytes = 0;
+ slot->ret = 0;
#endif
}
@@ -3131,17 +3428,24 @@ os_aio_array_free(
for (i = 0; i < array->n_slots; i++) {
os_aio_slot_t* slot = os_aio_array_get_nth_slot(array, i);
- os_event_free(slot->event);
+ CloseHandle(slot->handle);
}
#endif /* WIN_ASYNC_IO */
#ifdef __WIN__
- ut_free(array->native_events);
+ ut_free(array->handles);
#endif /* __WIN__ */
os_mutex_free(array->mutex);
os_event_free(array->not_full);
os_event_free(array->is_empty);
+#if defined(LINUX_NATIVE_AIO)
+ if (srv_use_native_aio) {
+ ut_free(array->aio_events);
+ ut_free(array->aio_ctx);
+ }
+#endif /* LINUX_NATIVE_AIO */
+
ut_free(array->slots);
ut_free(array);
}
@@ -3154,7 +3458,7 @@ respectively. The caller must create an i/o handler thread for each
segment in these arrays. This function also creates the sync array.
No i/o handler thread needs to be created for that */
UNIV_INTERN
-void
+ibool
os_aio_init(
/*========*/
ulint n_per_seg, /*<! in: maximum number of pending aio
@@ -3173,37 +3477,52 @@ os_aio_init(
for (i = 0; i < n_segments; i++) {
srv_set_io_thread_op_info(i, "not started yet");
- os_aio_thread_buffer[i] = 0;
- os_aio_thread_buffer_size[i] = 0;
}
/* fprintf(stderr, "Array n per seg %lu\n", n_per_seg); */
- os_aio_first_write_segment = os_aio_first_read_segment + n_read_segs;
os_aio_ibuf_array = os_aio_array_create(n_per_seg, 1);
+ if (os_aio_ibuf_array == NULL) {
+ goto err_exit;
+ }
srv_io_thread_function[0] = "insert buffer thread";
os_aio_log_array = os_aio_array_create(n_per_seg, 1);
+ if (os_aio_log_array == NULL) {
+ goto err_exit;
+ }
srv_io_thread_function[1] = "log thread";
- os_aio_read_array = os_aio_array_create(n_per_seg,
+ os_aio_read_array = os_aio_array_create(n_read_segs * n_per_seg,
n_read_segs);
+ if (os_aio_read_array == NULL) {
+ goto err_exit;
+ }
+
for (i = 2; i < 2 + n_read_segs; i++) {
ut_a(i < SRV_MAX_N_IO_THREADS);
srv_io_thread_function[i] = "read thread";
}
- os_aio_write_array = os_aio_array_create(n_per_seg,
+ os_aio_write_array = os_aio_array_create(n_write_segs * n_per_seg,
n_write_segs);
+ if (os_aio_write_array == NULL) {
+ goto err_exit;
+ }
+
for (i = 2 + n_read_segs; i < n_segments; i++) {
ut_a(i < SRV_MAX_N_IO_THREADS);
srv_io_thread_function[i] = "write thread";
}
os_aio_sync_array = os_aio_array_create(n_slots_sync, 1);
+ if (os_aio_sync_array == NULL) {
+ goto err_exit;
+ }
+
os_aio_n_segments = n_segments;
@@ -3217,6 +3536,11 @@ os_aio_init(
os_last_printout = time(NULL);
+ return(TRUE);
+
+err_exit:
+ return(FALSE);
+
}
/***********************************************************************
@@ -3262,7 +3586,7 @@ os_aio_array_wake_win_aio_at_shutdown(
for (i = 0; i < array->n_slots; i++) {
- os_event_set((array->slots + i)->event);
+ SetEvent((array->slots + i)->handle);
}
}
#endif
@@ -3283,6 +3607,19 @@ os_aio_wake_all_threads_at_shutdown(void)
os_aio_array_wake_win_aio_at_shutdown(os_aio_write_array);
os_aio_array_wake_win_aio_at_shutdown(os_aio_ibuf_array);
os_aio_array_wake_win_aio_at_shutdown(os_aio_log_array);
+
+#elif defined(LINUX_NATIVE_AIO)
+
+ /* When using native AIO interface the io helper threads
+ wait on io_getevents with a timeout value of 500ms. At
+ each wake up these threads check the server status.
+ No need to do anything to wake them up. */
+
+ if (srv_use_native_aio) {
+ return;
+ }
+ /* Fall through to simulated AIO handler wakeup if we are
+ not using native AIO. */
#endif
/* This loop wakes up all simulated ai/o threads */
@@ -3399,16 +3736,27 @@ os_aio_array_reserve_slot(
ulint offset_high, /*!< in: most significant 32 bits of
offset */
ulint len, /*!< in: length of the block to read or write */
- trx_t* trx)
+ ulint space_id)
{
- os_aio_slot_t* slot;
+ os_aio_slot_t* slot = NULL;
#ifdef WIN_ASYNC_IO
OVERLAPPED* control;
+
+#elif defined(LINUX_NATIVE_AIO)
+
+ struct iocb* iocb;
+ off_t aio_offset;
+
#endif
ulint i;
+ ulint counter;
ulint slots_per_seg;
ulint local_seg;
+#ifdef WIN_ASYNC_IO
+ ut_a((len & 0xFFFFFFFFUL) == len);
+#endif
+
/* No need of a mutex. Only reading constant fields */
slots_per_seg = array->n_slots / array->n_segments;
@@ -3424,7 +3772,7 @@ loop:
if (array->n_reserved == array->n_slots) {
os_mutex_exit(array->mutex);
- if (!os_aio_use_native_aio) {
+ if (!srv_use_native_aio) {
/* If the handler threads are suspended, wake them
so that we get more slots */
@@ -3436,17 +3784,13 @@ loop:
goto loop;
}
- /* First try to find a slot in the preferred local segment */
- for (i = local_seg * slots_per_seg; i < array->n_slots; i++) {
- slot = os_aio_array_get_nth_slot(array, i);
-
- if (slot->reserved == FALSE) {
- goto found;
- }
- }
+ /* We start our search for an available slot from our preferred
+ local segment and do a full scan of the array. We are
+ guaranteed to find a slot in full scan. */
+ for (i = local_seg * slots_per_seg, counter = 0;
+ counter < array->n_slots; i++, counter++) {
- /* Fall back to a full scan. We are guaranteed to find a slot */
- for (i = 0;; i++) {
+ i %= array->n_slots;
slot = os_aio_array_get_nth_slot(array, i);
if (slot->reserved == FALSE) {
@@ -3454,6 +3798,9 @@ loop:
}
}
+ /* We MUST always be able to get hold of a reserved slot. */
+ ut_error;
+
found:
ut_a(slot->reserved == FALSE);
array->n_reserved++;
@@ -3477,16 +3824,50 @@ found:
slot->buf = buf;
slot->offset = offset;
slot->offset_high = offset_high;
-// slot->io_already_done = FALSE;
- slot->status = OS_AIO_NOT_ISSUED;
+ slot->io_already_done = FALSE;
+ slot->space_id = space_id;
#ifdef WIN_ASYNC_IO
control = &(slot->control);
control->Offset = (DWORD)offset;
control->OffsetHigh = (DWORD)offset_high;
- os_event_reset(slot->event);
-#endif
+ ResetEvent(slot->handle);
+
+#elif defined(LINUX_NATIVE_AIO)
+
+ /* If we are not using native AIO skip this part. */
+ if (!srv_use_native_aio) {
+ goto skip_native_aio;
+ }
+
+ /* Check if we are dealing with 64 bit arch.
+ If not then make sure that offset fits in 32 bits. */
+ if (sizeof(aio_offset) == 8) {
+ aio_offset = offset_high;
+ aio_offset <<= 32;
+ aio_offset += offset;
+ } else {
+ ut_a(offset_high == 0);
+ aio_offset = offset;
+ }
+
+ iocb = &slot->control;
+
+ if (type == OS_FILE_READ) {
+ io_prep_pread(iocb, file, buf, len, aio_offset);
+ } else {
+ ut_a(type == OS_FILE_WRITE);
+ io_prep_pwrite(iocb, file, buf, len, aio_offset);
+ }
+
+ iocb->data = (void*)slot;
+ slot->n_bytes = 0;
+ slot->ret = 0;
+ /*fprintf(stderr, "Filled up Linux native iocb.\n");*/
+
+skip_native_aio:
+#endif /* LINUX_NATIVE_AIO */
os_mutex_exit(array->mutex);
return(slot);
@@ -3509,7 +3890,6 @@ os_aio_array_free_slot(
ut_ad(slot->reserved);
slot->reserved = FALSE;
- slot->status = OS_AIO_NOT_ISSUED;
array->n_reserved--;
@@ -3522,7 +3902,23 @@ os_aio_array_free_slot(
}
#ifdef WIN_ASYNC_IO
- os_event_reset(slot->event);
+
+ ResetEvent(slot->handle);
+
+#elif defined(LINUX_NATIVE_AIO)
+
+ if (srv_use_native_aio) {
+ memset(&slot->control, 0x0, sizeof(slot->control));
+ slot->n_bytes = 0;
+ slot->ret = 0;
+ /*fprintf(stderr, "Freed up Linux native slot.\n");*/
+ } else {
+ /* These fields should not be used if we are not
+ using native AIO. */
+ ut_ad(slot->n_bytes == 0);
+ ut_ad(slot->ret == 0);
+ }
+
#endif
os_mutex_exit(array->mutex);
}
@@ -3542,22 +3938,20 @@ os_aio_simulated_wake_handler_thread(
ulint n;
ulint i;
- ut_ad(!os_aio_use_native_aio);
+ ut_ad(!srv_use_native_aio);
segment = os_aio_get_array_and_local_segment(&array, global_segment);
- n = array->n_slots;
+ n = array->n_slots / array->n_segments;
/* Look through n slots after the segment * n'th slot */
os_mutex_enter(array->mutex);
for (i = 0; i < n; i++) {
- slot = os_aio_array_get_nth_slot(array, i);
+ slot = os_aio_array_get_nth_slot(array, i + segment * n);
- if (slot->reserved &&
- (slot->status == OS_AIO_NOT_ISSUED ||
- slot->status == OS_AIO_DONE)) {
+ if (slot->reserved) {
/* Found an i/o request */
break;
@@ -3567,25 +3961,7 @@ os_aio_simulated_wake_handler_thread(
os_mutex_exit(array->mutex);
if (i < n) {
- if (array == os_aio_ibuf_array) {
- os_event_set(os_aio_segment_wait_events[0]);
-
- } else if (array == os_aio_log_array) {
- os_event_set(os_aio_segment_wait_events[1]);
-
- } else if (array == os_aio_read_array) {
- ulint x;
- for (x = os_aio_first_read_segment; x < os_aio_first_write_segment; x++)
- os_event_set(os_aio_segment_wait_events[x]);
-
- } else if (array == os_aio_write_array) {
- ulint x;
- for (x = os_aio_first_write_segment; x < os_aio_n_segments; x++)
- os_event_set(os_aio_segment_wait_events[x]);
-
- } else {
- ut_a(0);
- }
+ os_event_set(os_aio_segment_wait_events[global_segment]);
}
}
@@ -3596,7 +3972,9 @@ void
os_aio_simulated_wake_handler_threads(void)
/*=======================================*/
{
- if (os_aio_use_native_aio) {
+ ulint i;
+
+ if (srv_use_native_aio) {
/* We do not use simulated aio: do nothing */
return;
@@ -3604,10 +3982,9 @@ os_aio_simulated_wake_handler_threads(void)
os_aio_recommend_sleep_for_read_threads = FALSE;
- os_aio_simulated_wake_handler_thread(0);
- os_aio_simulated_wake_handler_thread(1);
- os_aio_simulated_wake_handler_thread(os_aio_first_read_segment);
- os_aio_simulated_wake_handler_thread(os_aio_first_write_segment);
+ for (i = 0; i < os_aio_n_segments; i++) {
+ os_aio_simulated_wake_handler_thread(i);
+ }
}
/**********************************************************************//**
@@ -3629,7 +4006,7 @@ readahead requests. */
os_aio_array_t* array;
ulint g;
- if (os_aio_use_native_aio) {
+ if (srv_use_native_aio) {
/* We do not use simulated aio: do nothing */
return;
@@ -3648,13 +4025,62 @@ readahead requests. */
#endif /* __WIN__ */
}
+#if defined(LINUX_NATIVE_AIO)
/*******************************************************************//**
+Dispatch an AIO request to the kernel.
+@return TRUE on success. */
+static
+ibool
+os_aio_linux_dispatch(
+/*==================*/
+ os_aio_array_t* array, /*!< in: io request array. */
+ os_aio_slot_t* slot) /*!< in: an already reserved slot. */
+{
+ int ret;
+ ulint io_ctx_index;
+ struct iocb* iocb;
+
+ ut_ad(slot != NULL);
+ ut_ad(array);
+
+ ut_a(slot->reserved);
+
+ /* Find out what we are going to work with.
+ The iocb struct is directly in the slot.
+ The io_context is one per segment. */
+
+ iocb = &slot->control;
+ io_ctx_index = (slot->pos * array->n_segments) / array->n_slots;
+
+ ret = io_submit(array->aio_ctx[io_ctx_index], 1, &iocb);
+
+#if defined(UNIV_AIO_DEBUG)
+ fprintf(stderr,
+ "io_submit[%c] ret[%d]: slot[%p] ctx[%p] seg[%lu]\n",
+ (slot->type == OS_FILE_WRITE) ? 'w' : 'r', ret, slot,
+ array->aio_ctx[io_ctx_index], (ulong)io_ctx_index);
+#endif
+
+ /* io_submit returns number of successfully
+ queued requests or -errno. */
+ if (UNIV_UNLIKELY(ret != 1)) {
+ errno = -ret;
+ return(FALSE);
+ }
+
+ return(TRUE);
+}
+#endif /* LINUX_NATIVE_AIO */
+
+
+/*******************************************************************//**
+NOTE! Use the corresponding macro os_aio(), not directly this function!
Requests an asynchronous i/o operation.
@return TRUE if request was queued successfully, FALSE if fail */
UNIV_INTERN
ibool
-os_aio(
-/*===*/
+os_aio_func(
+/*========*/
ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE */
ulint mode, /*!< in: OS_AIO_NORMAL, ..., possibly ORed
to OS_AIO_SIMULATED_WAKE_LATER: the
@@ -3687,6 +4113,7 @@ os_aio(
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
+ ulint space_id,
trx_t* trx)
{
os_aio_array_t* array;
@@ -3698,8 +4125,7 @@ os_aio(
struct fil_node_struct * dummy_mess1;
void* dummy_mess2;
ulint dummy_type;
-#endif
- ulint err = 0;
+#endif /* WIN_ASYNC_IO */
ibool retry;
ulint wake_later;
@@ -3708,41 +4134,51 @@ os_aio(
ut_ad(n > 0);
ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0);
- ut_ad(os_aio_validate());
+ ut_ad(os_aio_validate_skip());
+#ifdef WIN_ASYNC_IO
+ ut_ad((n & 0xFFFFFFFFUL) == n);
+#endif
wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER;
mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER);
if (mode == OS_AIO_SYNC
#ifdef WIN_ASYNC_IO
- && !os_aio_use_native_aio
-#endif
+ && !srv_use_native_aio
+#endif /* WIN_ASYNC_IO */
) {
/* This is actually an ordinary synchronous read or write:
no need to use an i/o-handler thread. NOTE that if we use
Windows async i/o, Windows does not allow us to use
ordinary synchronous os_file_read etc. on the same file,
therefore we have built a special mechanism for synchronous
- wait in the Windows case. */
+ wait in the Windows case.
+ Also note that the Performance Schema instrumentation has
+ been performed by current os_aio_func()'s wrapper function
+ pfs_os_aio_func(). So we would no longer need to call
+ Performance Schema instrumented os_file_read() and
+ os_file_write(). Instead, we should use os_file_read_func()
+ and os_file_write_func() */
if (type == OS_FILE_READ) {
- return(_os_file_read(file, buf, offset,
+ return(os_file_read_trx(file, buf, offset,
offset_high, n, trx));
}
ut_a(type == OS_FILE_WRITE);
- return(os_file_write(name, file, buf, offset, offset_high, n));
+ return(os_file_write_func(name, file, buf, offset,
+ offset_high, n));
}
try_again:
- if (mode == OS_AIO_NORMAL) {
- if (type == OS_FILE_READ) {
- array = os_aio_read_array;
- } else {
- array = os_aio_write_array;
- }
- } else if (mode == OS_AIO_IBUF) {
+ switch (mode) {
+ case OS_AIO_NORMAL:
+ array = (type == OS_FILE_READ)
+ ? os_aio_read_array
+ : os_aio_write_array;
+ break;
+ case OS_AIO_IBUF:
ut_ad(type == OS_FILE_READ);
/* Reduce probability of deadlock bugs in connection with ibuf:
do not let the ibuf i/o handler sleep */
@@ -3750,14 +4186,21 @@ try_again:
wake_later = FALSE;
array = os_aio_ibuf_array;
- } else if (mode == OS_AIO_LOG) {
-
+ break;
+ case OS_AIO_LOG:
array = os_aio_log_array;
- } else if (mode == OS_AIO_SYNC) {
+ break;
+ case OS_AIO_SYNC:
array = os_aio_sync_array;
- } else {
- array = NULL; /* Eliminate compiler warning */
+
+#if defined(LINUX_NATIVE_AIO)
+ /* In Linux native AIO we don't use sync IO array. */
+ ut_a(!srv_use_native_aio);
+#endif /* LINUX_NATIVE_AIO */
+ break;
+ default:
ut_error;
+ array = NULL; /* Eliminate compiler warning */
}
if (trx && type == OS_FILE_READ)
@@ -3766,15 +4209,19 @@ try_again:
trx->io_read += n;
}
slot = os_aio_array_reserve_slot(type, array, message1, message2, file,
- name, buf, offset, offset_high, n, trx);
+ name, buf, offset, offset_high, n, space_id);
if (type == OS_FILE_READ) {
- if (os_aio_use_native_aio) {
-#ifdef WIN_ASYNC_IO
+ if (srv_use_native_aio) {
os_n_file_reads++;
- os_bytes_read_since_printout += len;
-
+ os_bytes_read_since_printout += n;
+#ifdef WIN_ASYNC_IO
ret = ReadFile(file, buf, (DWORD)n, &len,
&(slot->control));
+
+#elif defined(LINUX_NATIVE_AIO)
+ if (!os_aio_linux_dispatch(array, slot)) {
+ goto err_exit;
+ }
#endif
} else {
if (!wake_later) {
@@ -3784,11 +4231,16 @@ try_again:
}
}
} else if (type == OS_FILE_WRITE) {
- if (os_aio_use_native_aio) {
-#ifdef WIN_ASYNC_IO
+ if (srv_use_native_aio) {
os_n_file_writes++;
+#ifdef WIN_ASYNC_IO
ret = WriteFile(file, buf, (DWORD)n, &len,
&(slot->control));
+
+#elif defined(LINUX_NATIVE_AIO)
+ if (!os_aio_linux_dispatch(array, slot)) {
+ goto err_exit;
+ }
#endif
} else {
if (!wake_later) {
@@ -3802,7 +4254,7 @@ try_again:
}
#ifdef WIN_ASYNC_IO
- if (os_aio_use_native_aio) {
+ if (srv_use_native_aio) {
if ((ret && len == n)
|| (!ret && GetLastError() == ERROR_IO_PENDING)) {
/* aio was queued successfully! */
@@ -3825,15 +4277,15 @@ try_again:
return(TRUE);
}
- err = 1; /* Fall through the next if */
- }
-#endif
- if (err == 0) {
- /* aio was queued successfully! */
-
- return(TRUE);
+ goto err_exit;
}
+#endif /* WIN_ASYNC_IO */
+ /* aio was queued successfully! */
+ return(TRUE);
+#if defined LINUX_NATIVE_AIO || defined WIN_ASYNC_IO
+err_exit:
+#endif /* LINUX_NATIVE_AIO || WIN_ASYNC_IO */
os_aio_array_free_slot(array, slot);
retry = os_file_handle_error(name,
@@ -3876,7 +4328,8 @@ os_aio_windows_handle(
parameters are valid and can be used to
restart the operation, for example */
void** message2,
- ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */
+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
+ ulint* space_id)
{
ulint orig_seg = segment;
os_aio_array_t* array;
@@ -3898,24 +4351,49 @@ os_aio_windows_handle(
/* NOTE! We only access constant fields in os_aio_array. Therefore
we do not have to acquire the protecting mutex yet */
- ut_ad(os_aio_validate());
+ ut_ad(os_aio_validate_skip());
ut_ad(segment < array->n_segments);
- n = array->n_slots;
+ n = array->n_slots / array->n_segments;
if (array == os_aio_sync_array) {
- os_event_wait(os_aio_array_get_nth_slot(array, pos)->event);
+ WaitForSingleObject(
+ os_aio_array_get_nth_slot(array, pos)->handle,
+ INFINITE);
i = pos;
} else {
srv_set_io_thread_op_info(orig_seg, "wait Windows aio");
- i = os_event_wait_multiple(n,
- (array->native_events)
- );
+ i = WaitForMultipleObjects((DWORD) n,
+ array->handles + segment * n,
+ FALSE,
+ INFINITE);
+ }
+
+ if (srv_recovery_stats && recv_recovery_is_on() && n_consecutive) {
+ mutex_enter(&(recv_sys->mutex));
+ if (slot->type == OS_FILE_READ) {
+ recv_sys->stats_read_io_pages += n_consecutive;
+ recv_sys->stats_read_io_consecutive[n_consecutive - 1]++;
+ } else if (slot->type == OS_FILE_WRITE) {
+ recv_sys->stats_write_io_pages += n_consecutive;
+ recv_sys->stats_write_io_consecutive[n_consecutive - 1]++;
+ }
+ mutex_exit(&(recv_sys->mutex));
}
os_mutex_enter(array->mutex);
- slot = os_aio_array_get_nth_slot(array, i);
+ if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS
+ && array->n_reserved == 0) {
+ *message1 = NULL;
+ *message2 = NULL;
+ os_mutex_exit(array->mutex);
+ return(TRUE);
+ }
+
+ ut_a(i >= WAIT_OBJECT_0 && i <= WAIT_OBJECT_0 + n);
+
+ slot = os_aio_array_get_nth_slot(array, i + segment * n);
ut_a(slot->reserved);
@@ -3930,6 +4408,7 @@ os_aio_windows_handle(
*message2 = slot->message2;
*type = slot->type;
+ *space_id = slot->space_id;
if (ret && len == slot->len) {
ret_val = TRUE;
@@ -3937,7 +4416,9 @@ os_aio_windows_handle(
#ifdef UNIV_DO_FLUSH
if (slot->type == OS_FILE_WRITE
&& !os_do_not_call_flush_at_each_write) {
- ut_a(TRUE == os_file_flush(slot->file));
+ if (!os_file_flush(slot->file, TRUE)) {
+ ut_error;
+ }
}
#endif /* UNIV_DO_FLUSH */
} else if (os_file_handle_error(slot->name, "Windows aio")) {
@@ -3954,16 +4435,30 @@ os_aio_windows_handle(
/* retry failed read/write operation synchronously.
No need to hold array->mutex. */
+#ifdef UNIV_PFS_IO
+ /* This read/write does not go through os_file_read
+ and os_file_write APIs, need to register with
+ performance schema explicitly here. */
+ struct PSI_file_locker* locker = NULL;
+ register_pfs_file_io_begin(locker, slot->file, slot->len,
+ (slot->type == OS_FILE_WRITE)
+ ? PSI_FILE_WRITE
+ : PSI_FILE_READ,
+ __FILE__, __LINE__);
+#endif
+
+ ut_a((slot->len & 0xFFFFFFFFUL) == slot->len);
+
switch (slot->type) {
case OS_FILE_WRITE:
ret = WriteFile(slot->file, slot->buf,
- slot->len, &len,
+ (DWORD) slot->len, &len,
&(slot->control));
break;
case OS_FILE_READ:
ret = ReadFile(slot->file, slot->buf,
- slot->len, &len,
+ (DWORD) slot->len, &len,
&(slot->control));
break;
@@ -3971,6 +4466,10 @@ os_aio_windows_handle(
ut_error;
}
+#ifdef UNIV_PFS_IO
+ register_pfs_file_io_end(locker, len);
+#endif
+
if (!ret && GetLastError() == ERROR_IO_PENDING) {
/* aio was queued successfully!
We want a synchronous i/o operation on a
@@ -3992,6 +4491,261 @@ os_aio_windows_handle(
}
#endif
+#if defined(LINUX_NATIVE_AIO)
+/******************************************************************//**
+This function is only used in Linux native asynchronous i/o. This is
+called from within the io-thread. If there are no completed IO requests
+in the slot array, the thread calls this function to collect more
+requests from the kernel.
+The io-thread waits on io_getevents(), which is a blocking call, with
+a timeout value. Unless the system is very heavy loaded, keeping the
+io-thread very busy, the io-thread will spend most of its time waiting
+in this function.
+The io-thread also exits in this function. It checks server status at
+each wakeup and that is why we use timed wait in io_getevents(). */
+static
+void
+os_aio_linux_collect(
+/*=================*/
+ os_aio_array_t* array, /*!< in/out: slot array. */
+ ulint segment, /*!< in: local segment no. */
+ ulint seg_size) /*!< in: segment size. */
+{
+ int i;
+ int ret;
+ ulint start_pos;
+ ulint end_pos;
+ struct timespec timeout;
+ struct io_event* events;
+ struct io_context* io_ctx;
+
+ /* sanity checks. */
+ ut_ad(array != NULL);
+ ut_ad(seg_size > 0);
+ ut_ad(segment < array->n_segments);
+
+ /* Which part of event array we are going to work on. */
+ events = &array->aio_events[segment * seg_size];
+
+ /* Which io_context we are going to use. */
+ io_ctx = array->aio_ctx[segment];
+
+ /* Starting point of the segment we will be working on. */
+ start_pos = segment * seg_size;
+
+ /* End point. */
+ end_pos = start_pos + seg_size;
+
+retry:
+
+ /* Initialize the events. The timeout value is arbitrary.
+ We probably need to experiment with it a little. */
+ memset(events, 0, sizeof(*events) * seg_size);
+ timeout.tv_sec = 0;
+ timeout.tv_nsec = OS_AIO_REAP_TIMEOUT;
+
+ ret = io_getevents(io_ctx, 1, seg_size, events, &timeout);
+
+ if (ret > 0) {
+ for (i = 0; i < ret; i++) {
+ os_aio_slot_t* slot;
+ struct iocb* control;
+
+ control = (struct iocb *)events[i].obj;
+ ut_a(control != NULL);
+
+ slot = (os_aio_slot_t *) control->data;
+
+ /* Some sanity checks. */
+ ut_a(slot != NULL);
+ ut_a(slot->reserved);
+
+#if defined(UNIV_AIO_DEBUG)
+ fprintf(stderr,
+ "io_getevents[%c]: slot[%p] ctx[%p]"
+ " seg[%lu]\n",
+ (slot->type == OS_FILE_WRITE) ? 'w' : 'r',
+ slot, io_ctx, segment);
+#endif
+
+ /* We are not scribbling previous segment. */
+ ut_a(slot->pos >= start_pos);
+
+ /* We have not overstepped to next segment. */
+ ut_a(slot->pos < end_pos);
+
+ /* Mark this request as completed. The error handling
+ will be done in the calling function. */
+ os_mutex_enter(array->mutex);
+ slot->n_bytes = events[i].res;
+ slot->ret = events[i].res2;
+ slot->io_already_done = TRUE;
+ os_mutex_exit(array->mutex);
+ }
+ return;
+ }
+
+ if (UNIV_UNLIKELY(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS)) {
+ return;
+ }
+
+ /* This error handling is for any error in collecting the
+ IO requests. The errors, if any, for any particular IO
+ request are simply passed on to the calling routine. */
+
+ switch (ret) {
+ case -EAGAIN:
+ /* Not enough resources! Try again. */
+ case -EINTR:
+ /* Interrupted! I have tested the behaviour in case of an
+ interrupt. If we have some completed IOs available then
+ the return code will be the number of IOs. We get EINTR only
+ if there are no completed IOs and we have been interrupted. */
+ case 0:
+ /* No pending request! Go back and check again. */
+ goto retry;
+ }
+
+ /* All other errors should cause a trap for now. */
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: unexpected ret_code[%d] from io_getevents()!\n",
+ ret);
+ ut_error;
+}
+
+/**********************************************************************//**
+This function is only used in Linux native asynchronous i/o.
+Waits for an aio operation to complete. This function is used to wait for
+the completed requests. The aio array of pending requests is divided
+into segments. The thread specifies which segment or slot it wants to wait
+for. NOTE: this function will also take care of freeing the aio slot,
+therefore no other thread is allowed to do the freeing!
+@return TRUE if the IO was successful */
+UNIV_INTERN
+ibool
+os_aio_linux_handle(
+/*================*/
+ ulint global_seg, /*!< in: segment number in the aio array
+ to wait for; segment 0 is the ibuf
+ i/o thread, segment 1 is log i/o thread,
+ then follow the non-ibuf read threads,
+ and the last are the non-ibuf write
+ threads. */
+ fil_node_t**message1, /*!< out: the messages passed with the */
+ void** message2, /*!< aio request; note that in case the
+ aio operation failed, these output
+ parameters are valid and can be used to
+ restart the operation. */
+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
+ ulint* space_id)
+{
+ ulint segment;
+ os_aio_array_t* array;
+ os_aio_slot_t* slot;
+ ulint n;
+ ulint i;
+ ibool ret = FALSE;
+
+ /* Should never be doing Sync IO here. */
+ ut_a(global_seg != ULINT_UNDEFINED);
+
+ /* Find the array and the local segment. */
+ segment = os_aio_get_array_and_local_segment(&array, global_seg);
+ n = array->n_slots / array->n_segments;
+
+ /* Loop until we have found a completed request. */
+ for (;;) {
+ ibool any_reserved = FALSE;
+ os_mutex_enter(array->mutex);
+ for (i = 0; i < n; ++i) {
+ slot = os_aio_array_get_nth_slot(
+ array, i + segment * n);
+ if (!slot->reserved) {
+ continue;
+ } else if (slot->io_already_done) {
+ /* Something for us to work on. */
+ goto found;
+ } else {
+ any_reserved = TRUE;
+ }
+ }
+
+ os_mutex_exit(array->mutex);
+
+ /* There is no completed request.
+ If there is no pending request at all,
+ and the system is being shut down, exit. */
+ if (UNIV_UNLIKELY
+ (!any_reserved
+ && srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS)) {
+ *message1 = NULL;
+ *message2 = NULL;
+ return(TRUE);
+ }
+
+ /* Wait for some request. Note that we return
+ from wait iff we have found a request. */
+
+ srv_set_io_thread_op_info(global_seg,
+ "waiting for completed aio requests");
+ os_aio_linux_collect(array, segment, n);
+ }
+
+found:
+ /* Note that it may be that there are more then one completed
+ IO requests. We process them one at a time. We may have a case
+ here to improve the performance slightly by dealing with all
+ requests in one sweep. */
+ srv_set_io_thread_op_info(global_seg,
+ "processing completed aio requests");
+
+ /* Ensure that we are scribbling only our segment. */
+ ut_a(i < n);
+
+ ut_ad(slot != NULL);
+ ut_ad(slot->reserved);
+ ut_ad(slot->io_already_done);
+
+ *message1 = slot->message1;
+ *message2 = slot->message2;
+
+ *type = slot->type;
+ *space_id = slot->space_id;
+
+ if ((slot->ret == 0) && (slot->n_bytes == (long)slot->len)) {
+ ret = TRUE;
+
+#ifdef UNIV_DO_FLUSH
+ if (slot->type == OS_FILE_WRITE
+ && !os_do_not_call_flush_at_each_write)
+ && !os_file_flush(slot->file, TRUE) {
+ ut_error;
+ }
+#endif /* UNIV_DO_FLUSH */
+ } else {
+ errno = -slot->ret;
+
+ /* os_file_handle_error does tell us if we should retry
+ this IO. As it stands now, we don't do this retry when
+ reaping requests from a different context than
+ the dispatcher. This non-retry logic is the same for
+ windows and linux native AIO.
+ We should probably look into this to transparently
+ re-submit the IO. */
+ os_file_handle_error(slot->name, "Linux aio");
+
+ ret = FALSE;
+ }
+
+ os_mutex_exit(array->mutex);
+
+ os_aio_array_free_slot(array, slot);
+
+ return(ret);
+}
+#endif /* LINUX_NATIVE_AIO */
+
/**********************************************************************//**
Does simulated aio. This function should be called by an i/o-handler
thread.
@@ -4011,28 +4765,26 @@ os_aio_simulated_handle(
parameters are valid and can be used to
restart the operation, for example */
void** message2,
- ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */
+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
+ ulint* space_id)
{
os_aio_array_t* array;
ulint segment;
os_aio_slot_t* slot;
os_aio_slot_t* slot2;
os_aio_slot_t* consecutive_ios[OS_AIO_MERGE_N_CONSECUTIVE];
- os_aio_slot_t* lowest_request;
- os_aio_slot_t* oldest_request;
ulint n_consecutive;
ulint total_len;
ulint offs;
ulint lowest_offset;
- ulint oldest_offset;
ulint biggest_age;
ulint age;
byte* combined_buf;
byte* combined_buf2;
ibool ret;
+ ibool any_reserved;
ulint n;
ulint i;
- time_t now;
/* Fix compiler warning */
*consecutive_ios = NULL;
@@ -4045,10 +4797,10 @@ restart:
srv_set_io_thread_op_info(global_segment,
"looking for i/o requests (a)");
- ut_ad(os_aio_validate());
+ ut_ad(os_aio_validate_skip());
ut_ad(segment < array->n_segments);
- n = array->n_slots;
+ n = array->n_slots / array->n_segments;
/* Look through n slots after the segment * n'th slot */
@@ -4061,18 +4813,21 @@ restart:
goto recommended_sleep;
}
- os_mutex_enter(array->mutex);
-
srv_set_io_thread_op_info(global_segment,
"looking for i/o requests (b)");
/* Check if there is a slot for which the i/o has already been
done */
+ any_reserved = FALSE;
+
+ os_mutex_enter(array->mutex);
for (i = 0; i < n; i++) {
- slot = os_aio_array_get_nth_slot(array, i);
+ slot = os_aio_array_get_nth_slot(array, i + segment * n);
- if (slot->reserved && slot->status == OS_AIO_DONE) {
+ if (!slot->reserved) {
+ continue;
+ } else if (slot->io_already_done) {
if (os_aio_print_debug) {
fprintf(stderr,
@@ -4084,9 +4839,23 @@ restart:
ret = TRUE;
goto slot_io_done;
+ } else {
+ any_reserved = TRUE;
}
}
+ /* There is no completed request.
+ If there is no pending request at all,
+ and the system is being shut down, exit. */
+ if (UNIV_UNLIKELY
+ (!any_reserved
+ && srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS)) {
+ os_mutex_exit(array->mutex);
+ *message1 = NULL;
+ *message2 = NULL;
+ return(TRUE);
+ }
+
n_consecutive = 0;
/* If there are at least 2 seconds old requests, then pick the oldest
@@ -4094,57 +4863,72 @@ restart:
then pick the one at the lowest offset. */
biggest_age = 0;
- now = time(NULL);
- oldest_request = lowest_request = NULL;
- oldest_offset = lowest_offset = ULINT_MAX;
+ lowest_offset = ULINT_MAX;
- /* Find the oldest request and the request with the smallest offset */
for (i = 0; i < n; i++) {
- slot = os_aio_array_get_nth_slot(array, i);
+ slot = os_aio_array_get_nth_slot(array, i + segment * n);
- if (slot->reserved && slot->status == OS_AIO_NOT_ISSUED) {
- age = (ulint)difftime(now, slot->reservation_time);
+ if (slot->reserved) {
+ age = (ulint)difftime(time(NULL),
+ slot->reservation_time);
if ((age >= 2 && age > biggest_age)
|| (age >= 2 && age == biggest_age
- && slot->offset < oldest_offset)) {
+ && slot->offset < lowest_offset)) {
/* Found an i/o request */
+ consecutive_ios[0] = slot;
+
+ n_consecutive = 1;
+
biggest_age = age;
- oldest_request = slot;
- oldest_offset = slot->offset;
+ lowest_offset = slot->offset;
}
+ }
+ }
+
+ if (n_consecutive == 0) {
+ /* There were no old requests. Look for an i/o request at the
+ lowest offset in the array (we ignore the high 32 bits of the
+ offset in these heuristics) */
+
+ lowest_offset = ULINT_MAX;
+
+ for (i = 0; i < n; i++) {
+ slot = os_aio_array_get_nth_slot(array,
+ i + segment * n);
+
+ if (slot->reserved && slot->offset < lowest_offset) {
- /* Look for an i/o request at the lowest offset in the array
- * (we ignore the high 32 bits of the offset) */
- if (slot->offset < lowest_offset) {
/* Found an i/o request */
- lowest_request = slot;
+ consecutive_ios[0] = slot;
+
+ n_consecutive = 1;
+
lowest_offset = slot->offset;
}
}
}
- if (!lowest_request && !oldest_request) {
+ if (n_consecutive == 0) {
/* No i/o requested at the moment */
goto wait_for_io;
}
- if (oldest_request) {
- slot = oldest_request;
- } else {
- slot = lowest_request;
- }
- consecutive_ios[0] = slot;
- n_consecutive = 1;
+ /* if n_consecutive != 0, then we have assigned
+ something valid to consecutive_ios[0] */
+ ut_ad(n_consecutive != 0);
+ ut_ad(consecutive_ios[0] != NULL);
+
+ slot = consecutive_ios[0];
/* Check if there are several consecutive blocks to read or write */
consecutive_loop:
for (i = 0; i < n; i++) {
- slot2 = os_aio_array_get_nth_slot(array, i);
+ slot2 = os_aio_array_get_nth_slot(array, i + segment * n);
if (slot2->reserved && slot2 != slot
&& slot2->offset == slot->offset + slot->len
@@ -4152,8 +4936,7 @@ consecutive_loop:
&& slot->offset + slot->len > slot->offset
&& slot2->offset_high == slot->offset_high
&& slot2->type == slot->type
- && slot2->file == slot->file
- && slot2->status == OS_AIO_NOT_ISSUED) {
+ && slot2->file == slot->file) {
/* Found a consecutive i/o request */
@@ -4182,8 +4965,6 @@ consecutive_loop:
for (i = 0; i < n_consecutive; i++) {
total_len += consecutive_ios[i]->len;
- ut_a(consecutive_ios[i]->status == OS_AIO_NOT_ISSUED);
- consecutive_ios[i]->status = OS_AIO_ISSUED;
}
if (n_consecutive == 1) {
@@ -4191,14 +4972,7 @@ consecutive_loop:
combined_buf = slot->buf;
combined_buf2 = NULL;
} else {
- if ((total_len + UNIV_PAGE_SIZE) > os_aio_thread_buffer_size[global_segment]) {
- if (os_aio_thread_buffer[global_segment])
- ut_free(os_aio_thread_buffer[global_segment]);
-
- os_aio_thread_buffer[global_segment] = ut_malloc(total_len + UNIV_PAGE_SIZE);
- os_aio_thread_buffer_size[global_segment] = total_len + UNIV_PAGE_SIZE;
- }
- combined_buf2 = os_aio_thread_buffer[global_segment];
+ combined_buf2 = ut_malloc(total_len + UNIV_PAGE_SIZE);
ut_a(combined_buf2);
@@ -4209,9 +4983,6 @@ consecutive_loop:
this assumes that there is just one i/o-handler thread serving
a single segment of slots! */
- ut_a(slot->reserved);
- ut_a(slot->status == OS_AIO_ISSUED);
-
os_mutex_exit(array->mutex);
if (slot->type == OS_FILE_WRITE && n_consecutive > 1) {
@@ -4267,16 +5038,8 @@ consecutive_loop:
}
}
- if (srv_recovery_stats && recv_recovery_is_on() && n_consecutive) {
- mutex_enter(&(recv_sys->mutex));
- if (slot->type == OS_FILE_READ) {
- recv_sys->stats_read_io_pages += n_consecutive;
- recv_sys->stats_read_io_consecutive[n_consecutive - 1]++;
- } else if (slot->type == OS_FILE_WRITE) {
- recv_sys->stats_write_io_pages += n_consecutive;
- recv_sys->stats_write_io_consecutive[n_consecutive - 1]++;
- }
- mutex_exit(&(recv_sys->mutex));
+ if (combined_buf2) {
+ ut_free(combined_buf2);
}
os_mutex_enter(array->mutex);
@@ -4284,8 +5047,7 @@ consecutive_loop:
/* Mark the i/os done in slots */
for (i = 0; i < n_consecutive; i++) {
- ut_a(consecutive_ios[i]->status == OS_AIO_ISSUED);
- consecutive_ios[i]->status = OS_AIO_DONE;
+ consecutive_ios[i]->io_already_done = TRUE;
}
/* We return the messages for the first slot now, and if there were
@@ -4295,13 +5057,12 @@ consecutive_loop:
slot_io_done:
ut_a(slot->reserved);
- ut_a(slot->status == OS_AIO_DONE);
- slot->status = OS_AIO_CLAIMED;
*message1 = slot->message1;
*message2 = slot->message2;
*type = slot->type;
+ *space_id = slot->space_id;
os_mutex_exit(array->mutex);
@@ -4388,6 +5149,40 @@ os_aio_validate(void)
}
/**********************************************************************//**
+Prints pending IO requests per segment of an aio array.
+We probably don't need per segment statistics but they can help us
+during development phase to see if the IO requests are being
+distributed as expected. */
+static
+void
+os_aio_print_segment_info(
+/*======================*/
+ FILE* file, /*!< in: file where to print */
+ ulint* n_seg, /*!< in: pending IO array */
+ os_aio_array_t* array) /*!< in: array to process */
+{
+ ulint i;
+
+ ut_ad(array);
+ ut_ad(n_seg);
+ ut_ad(array->n_segments > 0);
+
+ if (array->n_segments == 1) {
+ return;
+ }
+
+ fprintf(file, " [");
+ for (i = 0; i < array->n_segments; i++) {
+ if (i != 0) {
+ fprintf(file, ", ");
+ }
+
+ fprintf(file, "%lu", n_seg[i]);
+ }
+ fprintf(file, "] ");
+}
+
+/**********************************************************************//**
Prints info of the aio arrays. */
UNIV_INTERN
void
@@ -4398,6 +5193,7 @@ os_aio_print(
os_aio_array_t* array;
os_aio_slot_t* slot;
ulint n_reserved;
+ ulint n_res_seg[SRV_MAX_N_IO_THREADS];
time_t current_time;
double time_elapsed;
double avg_bytes_read;
@@ -4430,11 +5226,17 @@ loop:
n_reserved = 0;
+ memset(n_res_seg, 0x0, sizeof(n_res_seg));
+
for (i = 0; i < array->n_slots; i++) {
+ ulint seg_no;
+
slot = os_aio_array_get_nth_slot(array, i);
+ seg_no = (i * array->n_segments) / array->n_slots;
if (slot->reserved) {
n_reserved++;
+ n_res_seg[seg_no]++;
#if 0
fprintf(stderr, "Reserved slot, messages %p %p\n",
(void*) slot->message1,
@@ -4448,6 +5250,8 @@ loop:
fprintf(file, " %lu", (ulong) n_reserved);
+ os_aio_print_segment_info(file, n_res_seg, array);
+
os_mutex_exit(array->mutex);
if (array == os_aio_read_array) {
diff --git a/storage/xtradb/os/os0proc.c b/storage/xtradb/os/os0proc.c
index 4567d96b6f4..0f56a608f38 100644
--- a/storage/xtradb/os/os0proc.c
+++ b/storage/xtradb/os/os0proc.c
@@ -145,7 +145,7 @@ skip:
os_fast_mutex_unlock(&ut_list_mutex);
UNIV_MEM_ALLOC(ptr, size);
}
-#elif defined __NETWARE__ || !defined OS_MAP_ANON
+#elif !defined OS_MAP_ANON
size = *n;
ptr = ut_malloc_low(size, TRUE, FALSE);
#else
@@ -213,7 +213,7 @@ os_mem_free_large(
os_fast_mutex_unlock(&ut_list_mutex);
UNIV_MEM_FREE(ptr, size);
}
-#elif defined __NETWARE__ || !defined OS_MAP_ANON
+#elif !defined OS_MAP_ANON
ut_free(ptr);
#else
if (munmap(ptr, size)) {
@@ -229,173 +229,3 @@ os_mem_free_large(
}
#endif
}
-
-/****************************************************************//**
-Allocates or attaches and reuses shared memory segment.
-The content is not cleared automatically.
-@return allocated memory */
-UNIV_INTERN
-void*
-os_shm_alloc(
-/*=========*/
- ulint* n, /*!< in/out: number of bytes */
- uint key,
- ibool* is_new)
-{
- void* ptr;
-#if defined HAVE_SYS_IPC_H && HAVE_SYS_SHM_H
- ulint size;
- int shmid;
-
- *is_new = FALSE;
- fprintf(stderr,
- "InnoDB: The shared memory segment containing the buffer pool is: key %#x (%d).\n",
- key, key);
-# if defined HAVE_LARGE_PAGES && defined UNIV_LINUX
- if (!os_use_large_pages || !os_large_page_size) {
- goto skip;
- }
-
- /* Align block size to os_large_page_size */
- ut_ad(ut_is_2pow(os_large_page_size));
- size = ut_2pow_round(*n + (os_large_page_size - 1),
- os_large_page_size);
-
- shmid = shmget((key_t)key, (size_t)size,
- IPC_CREAT | IPC_EXCL | SHM_HUGETLB | SHM_R | SHM_W);
- if (shmid < 0) {
- if (errno == EEXIST) {
- fprintf(stderr,
- "InnoDB: HugeTLB: The shared memory segment exists.\n");
- shmid = shmget((key_t)key, (size_t)size,
- SHM_HUGETLB | SHM_R | SHM_W);
- if (shmid < 0) {
- fprintf(stderr,
- "InnoDB: HugeTLB: Warning: Failed to allocate %lu bytes. (reuse) errno %d\n",
- size, errno);
- goto skip;
- } else {
- fprintf(stderr,
- "InnoDB: HugeTLB: The existent shared memory segment is used.\n");
- }
- } else {
- fprintf(stderr,
- "InnoDB: HugeTLB: Warning: Failed to allocate %lu bytes. (new) errno %d\n",
- size, errno);
- goto skip;
- }
- } else {
- *is_new = TRUE;
- fprintf(stderr,
- "InnoDB: HugeTLB: A new shared memory segment has been created .\n");
- }
-
- ptr = shmat(shmid, NULL, 0);
- if (ptr == (void *)-1) {
- fprintf(stderr,
- "InnoDB: HugeTLB: Warning: Failed to attach shared memory segment, errno %d\n",
- errno);
- ptr = NULL;
- }
-
- if (ptr) {
- *n = size;
- os_fast_mutex_lock(&ut_list_mutex);
- ut_total_allocated_memory += size;
- os_fast_mutex_unlock(&ut_list_mutex);
- UNIV_MEM_ALLOC(ptr, size);
- return(ptr);
- }
-skip:
- *is_new = FALSE;
-# endif /* HAVE_LARGE_PAGES && defined UNIV_LINUX */
-# ifdef HAVE_GETPAGESIZE
- size = getpagesize();
-# else
- size = UNIV_PAGE_SIZE;
-# endif
- /* Align block size to system page size */
- ut_ad(ut_is_2pow(size));
- size = *n = ut_2pow_round(*n + (size - 1), size);
-
- shmid = shmget((key_t)key, (size_t)size,
- IPC_CREAT | IPC_EXCL | SHM_R | SHM_W);
- if (shmid < 0) {
- if (errno == EEXIST) {
- fprintf(stderr,
- "InnoDB: A shared memory segment containing the buffer pool seems to already exist.\n");
- shmid = shmget((key_t)key, (size_t)size,
- SHM_R | SHM_W);
- if (shmid < 0) {
- fprintf(stderr,
- "InnoDB: Warning: Failed to allocate %lu bytes. (reuse) errno %d\n",
- size, errno);
- ptr = NULL;
- goto end;
- } else {
- fprintf(stderr,
- "InnoDB: The existent shared memory segment is used.\n");
- }
- } else {
- fprintf(stderr,
- "InnoDB: Warning: Failed to allocate %lu bytes. (new) errno %d\n",
- size, errno);
- ptr = NULL;
- goto end;
- }
- } else {
- *is_new = TRUE;
- fprintf(stderr,
- "InnoDB: A new shared memory segment has been created.\n");
- }
-
- ptr = shmat(shmid, NULL, 0);
- if (ptr == (void *)-1) {
- fprintf(stderr,
- "InnoDB: Warning: Failed to attach shared memory segment, errno %d\n",
- errno);
- ptr = NULL;
- }
-
- if (ptr) {
- *n = size;
- os_fast_mutex_lock(&ut_list_mutex);
- ut_total_allocated_memory += size;
- os_fast_mutex_unlock(&ut_list_mutex);
- UNIV_MEM_ALLOC(ptr, size);
- }
-end:
-#else /* HAVE_SYS_IPC_H && HAVE_SYS_SHM_H */
- fprintf(stderr, "InnoDB: shared memory segment is not supported.\n");
- ptr = NULL;
-#endif /* HAVE_SYS_IPC_H && HAVE_SYS_SHM_H */
- return(ptr);
-}
-
-/****************************************************************//**
-Detach shared memory segment. */
-UNIV_INTERN
-void
-os_shm_free(
-/*========*/
- void *ptr, /*!< in: pointer returned by
- os_shm_alloc() */
- ulint size) /*!< in: size returned by
- os_shm_alloc() */
-{
- os_fast_mutex_lock(&ut_list_mutex);
- ut_a(ut_total_allocated_memory >= size);
- os_fast_mutex_unlock(&ut_list_mutex);
-
-#if defined HAVE_SYS_IPC_H && HAVE_SYS_SHM_H
- if (!shmdt(ptr)) {
- os_fast_mutex_lock(&ut_list_mutex);
- ut_a(ut_total_allocated_memory >= size);
- ut_total_allocated_memory -= size;
- os_fast_mutex_unlock(&ut_list_mutex);
- UNIV_MEM_FREE(ptr, size);
- }
-#else /* HAVE_SYS_IPC_H && HAVE_SYS_SHM_H */
- fprintf(stderr, "InnoDB: shared memory segment is not supported.\n");
-#endif /* HAVE_SYS_IPC_H && HAVE_SYS_SHM_H */
-}
diff --git a/storage/xtradb/os/os0sync.c b/storage/xtradb/os/os0sync.c
index f9ab58c2ee4..41a19843812 100644
--- a/storage/xtradb/os/os0sync.c
+++ b/storage/xtradb/os/os0sync.c
@@ -31,13 +31,11 @@ Created 9/6/1995 Heikki Tuuri
#ifdef __WIN__
#include <windows.h>
-#else
-#include <sys/time.h>
-#include <time.h>
#endif
#include "ut0mem.h"
#include "srv0start.h"
+#include "srv0srv.h"
/* Type definition for an operating system mutex struct */
struct os_mutex_struct{
@@ -74,11 +72,227 @@ 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;
+
/* Because a mutex is embedded inside an event and there is an
event embedded inside a mutex, on free, this generates a recursive call.
This version of the free event function doesn't acquire the global lock */
static void os_event_free_internal(os_event_t event);
+/* On Windows (Vista and later), load function pointers for condition
+variable handling. Those functions are not available in prior versions,
+so we have to use them via runtime loading, as long as we support XP. */
+static void os_cond_module_init(void);
+
+#ifdef __WIN__
+/* Prototypes and function pointers for condition variable functions */
+typedef VOID (WINAPI* InitializeConditionVariableProc)
+ (PCONDITION_VARIABLE ConditionVariable);
+static InitializeConditionVariableProc initialize_condition_variable;
+
+typedef BOOL (WINAPI* SleepConditionVariableCSProc)
+ (PCONDITION_VARIABLE ConditionVariable,
+ PCRITICAL_SECTION CriticalSection,
+ DWORD dwMilliseconds);
+static SleepConditionVariableCSProc sleep_condition_variable;
+
+typedef VOID (WINAPI* WakeAllConditionVariableProc)
+ (PCONDITION_VARIABLE ConditionVariable);
+static WakeAllConditionVariableProc wake_all_condition_variable;
+
+typedef VOID (WINAPI* WakeConditionVariableProc)
+ (PCONDITION_VARIABLE ConditionVariable);
+static WakeConditionVariableProc wake_condition_variable;
+#endif
+
+/*********************************************************//**
+Initialitze condition variable */
+UNIV_INLINE
+void
+os_cond_init(
+/*=========*/
+ os_cond_t* cond) /*!< in: condition variable. */
+{
+ ut_a(cond);
+
+#ifdef __WIN__
+ ut_a(initialize_condition_variable != NULL);
+ initialize_condition_variable(cond);
+#else
+ ut_a(pthread_cond_init(cond, NULL) == 0);
+#endif
+}
+
+/*********************************************************//**
+Do a timed wait on condition variable.
+@return TRUE if timed out, FALSE otherwise */
+UNIV_INLINE
+ibool
+os_cond_wait_timed(
+/*===============*/
+ os_cond_t* cond, /*!< in: condition variable. */
+ os_fast_mutex_t* mutex, /*!< in: fast mutex */
+#ifndef __WIN__
+ const struct timespec* abstime /*!< in: timeout */
+#else
+ DWORD time_in_ms /*!< in: timeout in
+ milliseconds*/
+#endif /* !__WIN__ */
+)
+{
+#ifdef __WIN__
+ BOOL ret;
+ DWORD err;
+
+ ut_a(sleep_condition_variable != NULL);
+
+ ret = sleep_condition_variable(cond, mutex, time_in_ms);
+
+ if (!ret) {
+ err = GetLastError();
+ /* From http://msdn.microsoft.com/en-us/library/ms686301%28VS.85%29.aspx,
+ "Condition variables are subject to spurious wakeups
+ (those not associated with an explicit wake) and stolen wakeups
+ (another thread manages to run before the woken thread)."
+ Check for both types of timeouts.
+ Conditions are checked by the caller.*/
+ if ((err == WAIT_TIMEOUT) || (err == ERROR_TIMEOUT)) {
+ return(TRUE);
+ }
+ }
+
+ ut_a(ret);
+
+ return(FALSE);
+#else
+ int ret;
+
+ ret = pthread_cond_timedwait(cond, mutex, abstime);
+
+ switch (ret) {
+ case 0:
+ case ETIMEDOUT:
+ /* We play it safe by checking for EINTR even though
+ according to the POSIX documentation it can't return EINTR. */
+ case EINTR:
+ break;
+
+ default:
+ fprintf(stderr, " InnoDB: pthread_cond_timedwait() returned: "
+ "%d: abstime={%lu,%lu}\n",
+ ret, (ulong) abstime->tv_sec, (ulong) abstime->tv_nsec);
+ ut_error;
+ }
+
+ return(ret == ETIMEDOUT);
+#endif
+}
+/*********************************************************//**
+Wait on condition variable */
+UNIV_INLINE
+void
+os_cond_wait(
+/*=========*/
+ os_cond_t* cond, /*!< in: condition variable. */
+ os_fast_mutex_t* mutex) /*!< in: fast mutex */
+{
+ ut_a(cond);
+ ut_a(mutex);
+
+#ifdef __WIN__
+ ut_a(sleep_condition_variable != NULL);
+ ut_a(sleep_condition_variable(cond, mutex, INFINITE));
+#else
+ ut_a(pthread_cond_wait(cond, mutex) == 0);
+#endif
+}
+
+/*********************************************************//**
+Wakes all threads waiting for condition variable */
+UNIV_INLINE
+void
+os_cond_broadcast(
+/*==============*/
+ os_cond_t* cond) /*!< in: condition variable. */
+{
+ ut_a(cond);
+
+#ifdef __WIN__
+ ut_a(wake_all_condition_variable != NULL);
+ wake_all_condition_variable(cond);
+#else
+ ut_a(pthread_cond_broadcast(cond) == 0);
+#endif
+}
+
+/*********************************************************//**
+Wakes one thread waiting for condition variable */
+UNIV_INLINE
+void
+os_cond_signal(
+/*==========*/
+ os_cond_t* cond) /*!< in: condition variable. */
+{
+ ut_a(cond);
+
+#ifdef __WIN__
+ ut_a(wake_condition_variable != NULL);
+ wake_condition_variable(cond);
+#else
+ ut_a(pthread_cond_signal(cond) == 0);
+#endif
+}
+
+/*********************************************************//**
+Destroys condition variable */
+UNIV_INLINE
+void
+os_cond_destroy(
+/*============*/
+ os_cond_t* cond) /*!< in: condition variable. */
+{
+#ifdef __WIN__
+ /* Do nothing */
+#else
+ ut_a(pthread_cond_destroy(cond) == 0);
+#endif
+}
+
+/*********************************************************//**
+On Windows (Vista and later), load function pointers for condition variable
+handling. Those functions are not available in prior versions, so we have to
+use them via runtime loading, as long as we support XP. */
+static
+void
+os_cond_module_init(void)
+/*=====================*/
+{
+#ifdef __WIN__
+ HMODULE h_dll;
+
+ if (!srv_use_native_conditions)
+ return;
+
+ h_dll = GetModuleHandle("kernel32");
+
+ initialize_condition_variable = (InitializeConditionVariableProc)
+ GetProcAddress(h_dll, "InitializeConditionVariable");
+ sleep_condition_variable = (SleepConditionVariableCSProc)
+ GetProcAddress(h_dll, "SleepConditionVariableCS");
+ wake_all_condition_variable = (WakeAllConditionVariableProc)
+ GetProcAddress(h_dll, "WakeAllConditionVariable");
+ wake_condition_variable = (WakeConditionVariableProc)
+ GetProcAddress(h_dll, "WakeConditionVariable");
+
+ /* When using native condition variables, check function pointers */
+ ut_a(initialize_condition_variable);
+ ut_a(sleep_condition_variable);
+ ut_a(wake_all_condition_variable);
+ ut_a(wake_condition_variable);
+#endif
+}
+
/*********************************************************//**
Initializes global event and OS 'slow' mutex lists. */
UNIV_INTERN
@@ -92,7 +306,10 @@ os_sync_init(void)
os_sync_mutex = NULL;
os_sync_mutex_inited = FALSE;
- os_sync_mutex = os_mutex_create(NULL);
+ /* Now for Windows only */
+ os_cond_module_init();
+
+ os_sync_mutex = os_mutex_create();
os_sync_mutex_inited = TRUE;
}
@@ -146,42 +363,45 @@ os_event_create(
const char* name) /*!< in: the name of the event, if NULL
the event is created without a name */
{
-#ifdef __WIN__
- os_event_t event;
-
- event = ut_malloc(sizeof(struct os_event_struct));
-
- event->handle = CreateEvent(NULL, /* No security attributes */
- TRUE, /* Manual reset */
- FALSE, /* Initial state nonsignaled */
- (LPCTSTR) name);
- if (!event->handle) {
- fprintf(stderr,
- "InnoDB: Could not create a Windows event semaphore;"
- " Windows error %lu\n",
- (ulong) GetLastError());
- }
-#else /* Unix */
os_event_t event;
- UT_NOT_USED(name);
+#ifdef __WIN__
+ if(!srv_use_native_conditions) {
+
+ event = ut_malloc(sizeof(struct os_event_struct));
+
+ event->handle = CreateEvent(NULL,
+ TRUE,
+ FALSE,
+ (LPCTSTR) name);
+ if (!event->handle) {
+ fprintf(stderr,
+ "InnoDB: Could not create a Windows event"
+ " semaphore; Windows error %lu\n",
+ (ulong) GetLastError());
+ }
+ } else /* Windows with condition variables */
+#endif
+
+ {
+ UT_NOT_USED(name);
- event = ut_malloc(sizeof(struct os_event_struct));
+ event = ut_malloc(sizeof(struct os_event_struct));
- os_fast_mutex_init(&(event->os_mutex));
+ os_fast_mutex_init(&(event->os_mutex));
- ut_a(0 == pthread_cond_init(&(event->cond_var), NULL));
+ os_cond_init(&(event->cond_var));
- event->is_set = FALSE;
+ event->is_set = FALSE;
- /* We return this value in os_event_reset(), which can then be
- be used to pass to the os_event_wait_low(). The value of zero
- is reserved in os_event_wait_low() for the case when the
- caller does not want to pass any signal_count value. To
- distinguish between the two cases we initialize signal_count
- to 1 here. */
- event->signal_count = 1;
-#endif /* __WIN__ */
+ /* We return this value in os_event_reset(), which can then be
+ be used to pass to the os_event_wait_low(). The value of zero
+ is reserved in os_event_wait_low() for the case when the
+ caller does not want to pass any signal_count value. To
+ distinguish between the two cases we initialize signal_count
+ to 1 here. */
+ event->signal_count = 1;
+ }
/* The os_sync_mutex can be NULL because during startup an event
can be created [ because it's embedded in the mutex/rwlock ] before
@@ -211,10 +431,15 @@ os_event_set(
/*=========*/
os_event_t event) /*!< in: event to set */
{
-#ifdef __WIN__
ut_a(event);
- ut_a(SetEvent(event->handle));
-#else
+
+#ifdef __WIN__
+ if (!srv_use_native_conditions) {
+ ut_a(SetEvent(event->handle));
+ return;
+ }
+#endif
+
ut_a(event);
os_fast_mutex_lock(&(event->os_mutex));
@@ -224,11 +449,10 @@ os_event_set(
} else {
event->is_set = TRUE;
event->signal_count += 1;
- ut_a(0 == pthread_cond_broadcast(&(event->cond_var)));
+ os_cond_broadcast(&(event->cond_var));
}
os_fast_mutex_unlock(&(event->os_mutex));
-#endif
}
/**********************************************************//**
@@ -247,12 +471,14 @@ os_event_reset(
{
ib_int64_t ret = 0;
-#ifdef __WIN__
ut_a(event);
- ut_a(ResetEvent(event->handle));
-#else
- ut_a(event);
+#ifdef __WIN__
+ if(!srv_use_native_conditions) {
+ ut_a(ResetEvent(event->handle));
+ return(0);
+ }
+#endif
os_fast_mutex_lock(&(event->os_mutex));
@@ -264,7 +490,6 @@ os_event_reset(
ret = event->signal_count;
os_fast_mutex_unlock(&(event->os_mutex));
-#endif
return(ret);
}
@@ -277,19 +502,21 @@ os_event_free_internal(
os_event_t event) /*!< in: event to free */
{
#ifdef __WIN__
- ut_a(event);
+ if(!srv_use_native_conditions) {
+ ut_a(event);
+ ut_a(CloseHandle(event->handle));
+ } else
+#endif
+ {
+ ut_a(event);
- ut_a(CloseHandle(event->handle));
-#else
- ut_a(event);
+ /* This is to avoid freeing the mutex twice */
+ os_fast_mutex_free(&(event->os_mutex));
- /* This is to avoid freeing the mutex twice */
- os_fast_mutex_free(&(event->os_mutex));
+ os_cond_destroy(&(event->cond_var));
+ }
- ut_a(0 == pthread_cond_destroy(&(event->cond_var)));
-#endif
/* Remove from the list of events */
-
UT_LIST_REMOVE(os_event_list, os_event_list, event);
os_event_count--;
@@ -306,18 +533,19 @@ os_event_free(
os_event_t event) /*!< in: event to free */
{
-#ifdef __WIN__
ut_a(event);
+#ifdef __WIN__
+ if(!srv_use_native_conditions){
+ ut_a(CloseHandle(event->handle));
+ } else /*Windows with condition variables */
+#endif
+ {
+ os_fast_mutex_free(&(event->os_mutex));
- ut_a(CloseHandle(event->handle));
-#else
- ut_a(event);
+ os_cond_destroy(&(event->cond_var));
+ }
- os_fast_mutex_free(&(event->os_mutex));
- ut_a(0 == pthread_cond_destroy(&(event->cond_var)));
-#endif
/* Remove from the list of events */
-
os_mutex_enter(os_sync_mutex);
UT_LIST_REMOVE(os_event_list, os_event_list, event);
@@ -330,10 +558,7 @@ os_event_free(
}
/**********************************************************//**
-Waits for an event object until it is in the signaled state. If
-srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS this also exits the
-waiting thread when the event becomes signaled (or immediately if the
-event is already in the signaled state).
+Waits for an event object until it is in the signaled state.
Typically, if the event has been signalled after the os_event_reset()
we'll return immediately because event->is_set == TRUE.
@@ -359,53 +584,36 @@ os_event_wait_low(
os_event_reset(). */
{
#ifdef __WIN__
- DWORD err;
-
- ut_a(event);
+ if(!srv_use_native_conditions) {
+ DWORD err;
- UT_NOT_USED(reset_sig_count);
+ ut_a(event);
- /* Specify an infinite time limit for waiting */
- err = WaitForSingleObject(event->handle, INFINITE);
+ UT_NOT_USED(reset_sig_count);
- ut_a(err == WAIT_OBJECT_0);
+ /* Specify an infinite wait */
+ err = WaitForSingleObject(event->handle, INFINITE);
- if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
- os_thread_exit(NULL);
+ ut_a(err == WAIT_OBJECT_0);
+ return;
}
-#else
- ib_int64_t old_signal_count;
+#endif
- os_fast_mutex_lock(&(event->os_mutex));
+ os_fast_mutex_lock(&event->os_mutex);
- if (reset_sig_count) {
- old_signal_count = reset_sig_count;
- } else {
- old_signal_count = event->signal_count;
+ if (!reset_sig_count) {
+ reset_sig_count = event->signal_count;
}
- for (;;) {
- if (event->is_set == TRUE
- || event->signal_count != old_signal_count) {
-
- os_fast_mutex_unlock(&(event->os_mutex));
-
- if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
-
- os_thread_exit(NULL);
- }
- /* Ok, we may return */
-
- return;
- }
-
- pthread_cond_wait(&(event->cond_var), &(event->os_mutex));
+ while (!event->is_set && event->signal_count == reset_sig_count) {
+ os_cond_wait(&(event->cond_var), &(event->os_mutex));
/* Solaris manual said that spurious wakeups may occur: we
have to check if the event really has been signaled after
we came here to wait */
}
-#endif
+
+ os_fast_mutex_unlock(&event->os_mutex);
}
/**********************************************************//**
@@ -414,112 +622,112 @@ a timeout is exceeded.
@return 0 if success, OS_SYNC_TIME_EXCEEDED if timeout was exceeded */
UNIV_INTERN
ulint
-os_event_wait_time(
-/*===============*/
- os_event_t event, /*!< in: event to wait */
- ulint wtime) /*!< in: timeout in microseconds, or
- OS_SYNC_INFINITE_TIME */
+os_event_wait_time_low(
+/*===================*/
+ os_event_t event, /*!< in: event to wait */
+ ulint time_in_usec, /*!< in: timeout in
+ microseconds, or
+ OS_SYNC_INFINITE_TIME */
+ ib_int64_t reset_sig_count) /*!< in: zero or the value
+ returned by previous call of
+ os_event_reset(). */
+
{
+ ibool timed_out = FALSE;
+
#ifdef __WIN__
- DWORD err;
+ DWORD time_in_ms;
- ut_a(event);
+ if (!srv_use_native_conditions) {
+ DWORD err;
- if (wtime != OS_SYNC_INFINITE_TIME) {
- err = WaitForSingleObject(event->handle, (DWORD) wtime / 1000);
- } else {
- err = WaitForSingleObject(event->handle, INFINITE);
- }
+ ut_a(event);
- if (err == WAIT_OBJECT_0) {
+ if (time_in_usec != OS_SYNC_INFINITE_TIME) {
+ time_in_ms = time_in_usec / 1000;
+ err = WaitForSingleObject(event->handle, time_in_ms);
+ } else {
+ err = WaitForSingleObject(event->handle, INFINITE);
+ }
- return(0);
- } else if (err == WAIT_TIMEOUT) {
+ if (err == WAIT_OBJECT_0) {
+ return(0);
+ } else if ((err == WAIT_TIMEOUT) || (err == ERROR_TIMEOUT)) {
+ return(OS_SYNC_TIME_EXCEEDED);
+ }
- return(OS_SYNC_TIME_EXCEEDED);
- } else {
ut_error;
- return(1000000); /* dummy value to eliminate compiler warn. */
+ /* Dummy value to eliminate compiler warning. */
+ return(42);
+ } else {
+ ut_a(sleep_condition_variable != NULL);
+
+ if (time_in_usec != OS_SYNC_INFINITE_TIME) {
+ time_in_ms = time_in_usec / 1000;
+ } else {
+ time_in_ms = INFINITE;
+ }
}
#else
- int err;
- int ret = 0;
- ulint tmp;
- ib_int64_t old_count;
- struct timeval tv_start;
- struct timespec timeout;
-
- if (wtime == OS_SYNC_INFINITE_TIME) {
- os_event_wait(event);
- return 0;
- }
+ struct timespec abstime;
- /* Compute the absolute point in time at which to time out. */
- gettimeofday(&tv_start, NULL);
- tmp = tv_start.tv_usec + wtime;
- timeout.tv_sec = tv_start.tv_sec + (tmp / 1000000);
- timeout.tv_nsec = (tmp % 1000000) * 1000;
+ if (time_in_usec != OS_SYNC_INFINITE_TIME) {
+ struct timeval tv;
+ int ret;
+ ulint sec;
+ ulint usec;
- os_fast_mutex_lock(&(event->os_mutex));
- old_count = event->signal_count;
+ ret = ut_usectime(&sec, &usec);
+ ut_a(ret == 0);
- for (;;) {
- if (event->is_set == TRUE || event->signal_count != old_count)
- break;
+ tv.tv_sec = sec;
+ tv.tv_usec = usec;
- err = pthread_cond_timedwait(&(event->cond_var),
- &(event->os_mutex), &timeout);
- if (err == ETIMEDOUT) {
- ret = OS_SYNC_TIME_EXCEEDED;
- break;
+ tv.tv_usec += time_in_usec;
+
+ if ((ulint) tv.tv_usec >= MICROSECS_IN_A_SECOND) {
+ tv.tv_sec += time_in_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;
+ } else {
+ abstime.tv_nsec = 999999999;
+ abstime.tv_sec = (time_t) ULINT_MAX;
}
- os_fast_mutex_unlock(&(event->os_mutex));
+ ut_a(abstime.tv_nsec <= 999999999);
- if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
+#endif /* __WIN__ */
+
+ os_fast_mutex_lock(&event->os_mutex);
- os_thread_exit(NULL);
+ if (!reset_sig_count) {
+ reset_sig_count = event->signal_count;
}
- return ret;
-#endif
-}
+ do {
+ if (event->is_set || event->signal_count != reset_sig_count) {
-#ifdef __WIN__
-/**********************************************************//**
-Waits for any event in an OS native event array. Returns if even a single
-one is signaled or becomes signaled.
-@return index of the event which was signaled */
-UNIV_INTERN
-ulint
-os_event_wait_multiple(
-/*===================*/
- ulint n, /*!< in: number of events in the
- array */
- os_native_event_t* native_event_array)
- /*!< in: pointer to an array of event
- handles */
-{
- DWORD index;
+ break;
+ }
- ut_a(native_event_array);
- ut_a(n > 0);
+ timed_out = os_cond_wait_timed(
+ &event->cond_var, &event->os_mutex,
+#ifndef __WIN__
+ &abstime
+#else
+ time_in_ms
+#endif /* !__WIN__ */
+ );
- index = WaitForMultipleObjects((DWORD) n, native_event_array,
- FALSE, /* Wait for any 1 event */
- INFINITE); /* Infinite wait time
- limit */
- ut_a(index >= WAIT_OBJECT_0); /* NOTE: Pointless comparison */
- ut_a(index < WAIT_OBJECT_0 + n);
+ } while (!timed_out);
- if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
- os_thread_exit(NULL);
- }
+ os_fast_mutex_unlock(&event->os_mutex);
- return(index - WAIT_OBJECT_0);
+ return(timed_out ? OS_SYNC_TIME_EXCEEDED : 0);
}
-#endif
/*********************************************************//**
Creates an operating system mutex semaphore. Because these are slow, the
@@ -527,29 +735,15 @@ mutex semaphore of InnoDB itself (mutex_t) should be used where possible.
@return the mutex handle */
UNIV_INTERN
os_mutex_t
-os_mutex_create(
-/*============*/
- const char* name) /*!< in: the name of the mutex, if NULL
- the mutex is created without a name */
+os_mutex_create(void)
+/*=================*/
{
-#ifdef __WIN__
- HANDLE mutex;
- os_mutex_t mutex_str;
-
- mutex = CreateMutex(NULL, /* No security attributes */
- FALSE, /* Initial state: no owner */
- (LPCTSTR) name);
- ut_a(mutex);
-#else
os_fast_mutex_t* mutex;
os_mutex_t mutex_str;
- UT_NOT_USED(name);
-
mutex = ut_malloc(sizeof(os_fast_mutex_t));
os_fast_mutex_init(mutex);
-#endif
mutex_str = ut_malloc(sizeof(os_mutex_str_t));
mutex_str->handle = mutex;
@@ -580,25 +774,11 @@ os_mutex_enter(
/*===========*/
os_mutex_t mutex) /*!< in: mutex to acquire */
{
-#ifdef __WIN__
- DWORD err;
-
- ut_a(mutex);
-
- /* Specify infinite time limit for waiting */
- err = WaitForSingleObject(mutex->handle, INFINITE);
-
- ut_a(err == WAIT_OBJECT_0);
-
- (mutex->count)++;
- ut_a(mutex->count == 1);
-#else
os_fast_mutex_lock(mutex->handle);
(mutex->count)++;
ut_a(mutex->count == 1);
-#endif
}
/**********************************************************//**
@@ -614,11 +794,7 @@ os_mutex_exit(
ut_a(mutex->count == 1);
(mutex->count)--;
-#ifdef __WIN__
- ut_a(ReleaseMutex(mutex->handle));
-#else
os_fast_mutex_unlock(mutex->handle);
-#endif
}
/**********************************************************//**
@@ -647,15 +823,9 @@ os_mutex_free(
os_mutex_exit(os_sync_mutex);
}
-#ifdef __WIN__
- ut_a(CloseHandle(mutex->handle));
-
- ut_free(mutex);
-#else
os_fast_mutex_free(mutex->handle);
ut_free(mutex->handle);
ut_free(mutex);
-#endif
}
/*********************************************************//**
diff --git a/storage/xtradb/os/os0thread.c b/storage/xtradb/os/os0thread.c
index e41c1163371..12b6805d98e 100644
--- a/storage/xtradb/os/os0thread.c
+++ b/storage/xtradb/os/os0thread.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. 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
@@ -133,15 +133,6 @@ os_thread_create(
0, /* thread runs immediately */
&win_thread_id);
- if (srv_set_thread_priorities) {
-
- /* Set created thread priority the same as a normal query
- in MYSQL: we try to prevent starvation of threads by
- assigning same priority QUERY_PRIOR to all */
-
- ut_a(SetThreadPriority(thread, srv_query_thread_priority));
- }
-
if (thread_id) {
*thread_id = win_thread_id;
}
@@ -172,16 +163,6 @@ os_thread_create(
exit(1);
}
#endif
-#ifdef __NETWARE__
- ret = pthread_attr_setstacksize(&attr,
- (size_t) NW_THD_STACKSIZE);
- if (ret) {
- fprintf(stderr,
- "InnoDB: Error: pthread_attr_setstacksize"
- " returned %d\n", ret);
- exit(1);
- }
-#endif
os_mutex_enter(os_sync_mutex);
os_thread_count++;
os_mutex_exit(os_sync_mutex);
@@ -200,7 +181,6 @@ os_thread_create(
#ifndef UNIV_HPUX10
pthread_attr_destroy(&attr);
#endif
-
if (thread_id) {
*thread_id = pthread;
}
@@ -222,6 +202,11 @@ os_thread_exit(
fprintf(stderr, "Thread exits, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
#endif
+
+#ifdef UNIV_PFS_THREAD
+ pfs_delete_thread();
+#endif
+
os_mutex_enter(os_sync_mutex);
os_thread_count--;
os_mutex_exit(os_sync_mutex);
@@ -235,21 +220,6 @@ os_thread_exit(
}
/*****************************************************************//**
-Returns handle to the current thread.
-@return current thread handle */
-UNIV_INTERN
-os_thread_t
-os_thread_get_curr(void)
-/*====================*/
-{
-#ifdef __WIN__
- return(GetCurrentThread());
-#else
- return(pthread_self());
-#endif
-}
-
-/*****************************************************************//**
Advises the os to give up remainder of the thread's time slice. */
UNIV_INTERN
void
@@ -257,7 +227,7 @@ os_thread_yield(void)
/*=================*/
{
#if defined(__WIN__)
- Sleep(0);
+ SwitchToThread();
#elif (defined(HAVE_SCHED_YIELD) && defined(HAVE_SCHED_H))
sched_yield();
#elif defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
@@ -280,8 +250,6 @@ os_thread_sleep(
{
#ifdef __WIN__
Sleep((DWORD) tm / 1000);
-#elif defined(__NETWARE__)
- delay(tm / 1000);
#else
struct timeval t;
@@ -291,81 +259,3 @@ os_thread_sleep(
select(0, NULL, NULL, NULL, &t);
#endif
}
-
-#ifndef UNIV_HOTBACKUP
-/******************************************************************//**
-Sets a thread priority. */
-UNIV_INTERN
-void
-os_thread_set_priority(
-/*===================*/
- os_thread_t handle, /*!< in: OS handle to the thread */
- ulint pri) /*!< in: priority */
-{
-#ifdef __WIN__
- int os_pri;
-
- if (pri == OS_THREAD_PRIORITY_BACKGROUND) {
- os_pri = THREAD_PRIORITY_BELOW_NORMAL;
- } else if (pri == OS_THREAD_PRIORITY_NORMAL) {
- os_pri = THREAD_PRIORITY_NORMAL;
- } else if (pri == OS_THREAD_PRIORITY_ABOVE_NORMAL) {
- os_pri = THREAD_PRIORITY_HIGHEST;
- } else {
- ut_error;
- }
-
- ut_a(SetThreadPriority(handle, os_pri));
-#else
- UT_NOT_USED(handle);
- UT_NOT_USED(pri);
-#endif
-}
-
-/******************************************************************//**
-Gets a thread priority.
-@return priority */
-UNIV_INTERN
-ulint
-os_thread_get_priority(
-/*===================*/
- os_thread_t handle __attribute__((unused)))
- /*!< in: OS handle to the thread */
-{
-#ifdef __WIN__
- int os_pri;
- ulint pri;
-
- os_pri = GetThreadPriority(handle);
-
- if (os_pri == THREAD_PRIORITY_BELOW_NORMAL) {
- pri = OS_THREAD_PRIORITY_BACKGROUND;
- } else if (os_pri == THREAD_PRIORITY_NORMAL) {
- pri = OS_THREAD_PRIORITY_NORMAL;
- } else if (os_pri == THREAD_PRIORITY_HIGHEST) {
- pri = OS_THREAD_PRIORITY_ABOVE_NORMAL;
- } else {
- ut_error;
- }
-
- return(pri);
-#else
- return(0);
-#endif
-}
-
-/******************************************************************//**
-Gets the last operating system error code for the calling thread.
-@return last error on Windows, 0 otherwise */
-UNIV_INTERN
-ulint
-os_thread_get_last_error(void)
-/*==========================*/
-{
-#ifdef __WIN__
- return(GetLastError());
-#else
- return(0);
-#endif
-}
-#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/page/page0cur.c b/storage/xtradb/page/page0cur.c
index fa3d2532deb..936762b986a 100644
--- a/storage/xtradb/page/page0cur.c
+++ b/storage/xtradb/page/page0cur.c
@@ -564,74 +564,6 @@ page_cur_open_on_rnd_user_rec(
} while (rnd--);
}
-UNIV_INTERN
-void
-page_cur_open_on_nth_user_rec(
-/*==========================*/
- buf_block_t* block, /*!< in: page */
- page_cur_t* cursor, /*!< out: page cursor */
- ulint nth)
-{
- ulint n_recs = page_get_n_recs(buf_block_get_frame(block));
-
- page_cur_set_before_first(block, cursor);
-
- if (UNIV_UNLIKELY(n_recs == 0)) {
-
- return;
- }
-
- nth--;
-
- if (nth >= n_recs) {
- nth = n_recs - 1;
- }
-
- do {
- page_cur_move_to_next(cursor);
- } while (nth--);
-}
-
-UNIV_INTERN
-ibool
-page_cur_open_on_rnd_user_rec_after_nth(
-/*==========================*/
- buf_block_t* block, /*!< in: page */
- page_cur_t* cursor, /*!< out: page cursor */
- ulint nth)
-{
- ulint rnd;
- ulint n_recs = page_get_n_recs(buf_block_get_frame(block));
- ibool ret;
-
- page_cur_set_before_first(block, cursor);
-
- if (UNIV_UNLIKELY(n_recs == 0)) {
-
- return (FALSE);
- }
-
- nth--;
-
- if (nth >= n_recs) {
- nth = n_recs - 1;
- }
-
- rnd = (ulint) (nth + page_cur_lcg_prng() % (n_recs - nth));
-
- if (rnd == nth) {
- ret = TRUE;
- } else {
- ret = FALSE;
- }
-
- do {
- page_cur_move_to_next(cursor);
- } while (rnd--);
-
- return (ret);
-}
-
/***********************************************************//**
Writes the log record of a record insert on a page. */
static
@@ -1217,6 +1149,8 @@ use_heap:
current_rec, index, mtr);
}
+ btr_blob_dbg_add_rec(insert_rec, index, offsets, "insert");
+
return(insert_rec);
}
@@ -1263,10 +1197,12 @@ page_cur_insert_rec_zip_reorg(
}
/* Out of space: restore the page */
+ btr_blob_dbg_remove(page, index, "insert_zip_fail");
if (!page_zip_decompress(page_zip, page, FALSE)) {
ut_error; /* Memory corrupted? */
}
ut_ad(page_validate(page, index));
+ btr_blob_dbg_add(page, index, "insert_zip_fail");
return(NULL);
}
@@ -1558,6 +1494,8 @@ use_heap:
page_zip_write_rec(page_zip, insert_rec, index, offsets, 1);
+ btr_blob_dbg_add_rec(insert_rec, index, offsets, "insert_zip_ok");
+
/* 9. Write log record of the insert */
if (UNIV_LIKELY(mtr != NULL)) {
page_cur_insert_rec_write_log(insert_rec, rec_size,
@@ -1765,6 +1703,9 @@ page_copy_rec_list_end_to_created_page(
heap_top += rec_size;
+ rec_offs_make_valid(insert_rec, index, offsets);
+ btr_blob_dbg_add_rec(insert_rec, index, offsets, "copy_end");
+
page_cur_insert_rec_write_log(insert_rec, rec_size, prev_rec,
index, mtr);
prev_rec = insert_rec;
@@ -2012,6 +1953,7 @@ page_cur_delete_rec(
page_dir_slot_set_n_owned(cur_dir_slot, page_zip, cur_n_owned - 1);
/* 6. Free the memory occupied by the record */
+ btr_blob_dbg_remove_rec(current_rec, index, offsets, "delete");
page_mem_free(page, page_zip, current_rec, index, offsets);
/* 7. Now we have decremented the number of owned records of the slot.
diff --git a/storage/xtradb/page/page0page.c b/storage/xtradb/page/page0page.c
index 10008f9ac25..17f6c6bbc36 100644
--- a/storage/xtradb/page/page0page.c
+++ b/storage/xtradb/page/page0page.c
@@ -166,11 +166,11 @@ static
ibool
page_dir_slot_check(
/*================*/
- page_dir_slot_t* slot) /*!< in: slot */
+ const page_dir_slot_t* slot) /*!< in: slot */
{
- page_t* page;
- ulint n_slots;
- ulint n_owned;
+ const page_t* page;
+ ulint n_slots;
+ ulint n_owned;
ut_a(slot);
@@ -218,7 +218,7 @@ page_set_max_trx_id(
const ibool is_hashed = block->is_hashed;
if (is_hashed) {
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(block->index->id));
}
ut_ad(!mtr || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
@@ -235,8 +235,8 @@ page_set_max_trx_id(
8, mtr);
#ifndef UNIV_HOTBACKUP
} else if (mtr) {
- mlog_write_dulint(page + (PAGE_HEADER + PAGE_MAX_TRX_ID),
- trx_id, mtr);
+ mlog_write_ull(page + (PAGE_HEADER + PAGE_MAX_TRX_ID),
+ trx_id, mtr);
#endif /* !UNIV_HOTBACKUP */
} else {
mach_write_to_8(page + (PAGE_HEADER + PAGE_MAX_TRX_ID), trx_id);
@@ -244,7 +244,7 @@ page_set_max_trx_id(
#ifndef UNIV_HOTBACKUP
if (is_hashed) {
- rw_lock_x_unlock(&btr_search_latch);
+ rw_lock_x_unlock(btr_search_get_latch(block->index->id));
}
#endif /* !UNIV_HOTBACKUP */
}
@@ -457,7 +457,7 @@ page_create_low(
page_header_set_field(page, NULL, PAGE_DIRECTION, PAGE_NO_DIRECTION);
page_header_set_field(page, NULL, PAGE_N_DIRECTION, 0);
page_header_set_field(page, NULL, PAGE_N_RECS, 0);
- page_set_max_trx_id(block, NULL, ut_dulint_zero, NULL);
+ page_set_max_trx_id(block, NULL, 0, NULL);
memset(heap_top, 0, UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START
- page_offset(heap_top));
@@ -685,12 +685,16 @@ page_copy_rec_list_end(
if (UNIV_UNLIKELY
(!page_zip_reorganize(new_block, index, mtr))) {
+ btr_blob_dbg_remove(new_page, index,
+ "copy_end_reorg_fail");
if (UNIV_UNLIKELY
(!page_zip_decompress(new_page_zip,
new_page, FALSE))) {
ut_error;
}
ut_ad(page_validate(new_page, index));
+ btr_blob_dbg_add(new_page, index,
+ "copy_end_reorg_fail");
return(NULL);
} else {
/* The page was reorganized:
@@ -803,12 +807,16 @@ page_copy_rec_list_start(
if (UNIV_UNLIKELY
(!page_zip_reorganize(new_block, index, mtr))) {
+ btr_blob_dbg_remove(new_page, index,
+ "copy_start_reorg_fail");
if (UNIV_UNLIKELY
(!page_zip_decompress(new_page_zip,
new_page, FALSE))) {
ut_error;
}
ut_ad(page_validate(new_page, index));
+ btr_blob_dbg_add(new_page, index,
+ "copy_start_reorg_fail");
return(NULL);
} else {
/* The page was reorganized:
@@ -1080,6 +1088,9 @@ page_delete_rec_list_end(
/* Remove the record chain segment from the record chain */
page_rec_set_next(prev_rec, page_get_supremum_rec(page));
+ btr_blob_dbg_op(page, rec, index, "delete_end",
+ btr_blob_dbg_remove_rec);
+
/* Catenate the deleted chain segment to the page free list */
page_rec_set_next(last_rec, page_header_get_ptr(page, PAGE_FREE));
@@ -1242,28 +1253,6 @@ page_move_rec_list_start(
return(TRUE);
}
-
-/***********************************************************************//**
-This is a low-level operation which is used in a database index creation
-to update the page number of a created B-tree to a data dictionary record. */
-UNIV_INTERN
-void
-page_rec_write_index_page_no(
-/*=========================*/
- rec_t* rec, /*!< in: record to update */
- ulint i, /*!< in: index of the field to update */
- ulint page_no,/*!< in: value to write */
- mtr_t* mtr) /*!< in: mtr */
-{
- byte* data;
- ulint len;
-
- data = rec_get_nth_field_old(rec, i, &len);
-
- ut_ad(len == 4);
-
- mlog_write_ulint(data, page_no, MLOG_4BYTES, mtr);
-}
#endif /* !UNIV_HOTBACKUP */
/**************************************************************//**
@@ -1792,12 +1781,12 @@ UNIV_INTERN
ibool
page_rec_validate(
/*==============*/
- rec_t* rec, /*!< in: physical record */
+ const rec_t* rec, /*!< in: physical record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
{
- ulint n_owned;
- ulint heap_no;
- page_t* page;
+ ulint n_owned;
+ ulint heap_no;
+ const page_t* page;
page = page_align(rec);
ut_a(!page_is_comp(page) == !rec_offs_comp(offsets));
@@ -1878,16 +1867,16 @@ UNIV_INTERN
ibool
page_simple_validate_old(
/*=====================*/
- page_t* page) /*!< in: old-style index page */
+ const page_t* page) /*!< in: index page in ROW_FORMAT=REDUNDANT */
{
- page_dir_slot_t* slot;
- ulint slot_no;
- ulint n_slots;
- rec_t* rec;
- byte* rec_heap_top;
- ulint count;
- ulint own_count;
- ibool ret = FALSE;
+ const page_dir_slot_t* slot;
+ ulint slot_no;
+ ulint n_slots;
+ const rec_t* rec;
+ const byte* rec_heap_top;
+ ulint count;
+ ulint own_count;
+ ibool ret = FALSE;
ut_a(!page_is_comp(page));
@@ -2000,7 +1989,7 @@ page_simple_validate_old(
goto func_exit;
}
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
own_count++;
}
@@ -2061,7 +2050,7 @@ page_simple_validate_old(
goto func_exit;
}
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
}
if (UNIV_UNLIKELY(page_dir_get_n_heap(page) != count + 1)) {
@@ -2088,16 +2077,16 @@ UNIV_INTERN
ibool
page_simple_validate_new(
/*=====================*/
- page_t* page) /*!< in: new-style index page */
+ const page_t* page) /*!< in: index page in ROW_FORMAT!=REDUNDANT */
{
- page_dir_slot_t* slot;
- ulint slot_no;
- ulint n_slots;
- rec_t* rec;
- byte* rec_heap_top;
- ulint count;
- ulint own_count;
- ibool ret = FALSE;
+ const page_dir_slot_t* slot;
+ ulint slot_no;
+ ulint n_slots;
+ const rec_t* rec;
+ const byte* rec_heap_top;
+ ulint count;
+ ulint own_count;
+ ibool ret = FALSE;
ut_a(page_is_comp(page));
@@ -2210,7 +2199,7 @@ page_simple_validate_new(
goto func_exit;
}
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
own_count++;
}
@@ -2272,7 +2261,7 @@ page_simple_validate_new(
goto func_exit;
}
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
}
if (UNIV_UNLIKELY(page_dir_get_n_heap(page) != count + 1)) {
@@ -2297,26 +2286,26 @@ UNIV_INTERN
ibool
page_validate(
/*==========*/
- page_t* page, /*!< in: index page */
+ const page_t* page, /*!< in: index page */
dict_index_t* index) /*!< in: data dictionary index containing
the page record type definition */
{
- page_dir_slot_t*slot;
- mem_heap_t* heap;
- byte* buf;
- ulint count;
- ulint own_count;
- ulint rec_own_count;
- ulint slot_no;
- ulint data_size;
- rec_t* rec;
- rec_t* old_rec = NULL;
- ulint offs;
- ulint n_slots;
- ibool ret = FALSE;
- ulint i;
- ulint* offsets = NULL;
- ulint* old_offsets = NULL;
+ const page_dir_slot_t* slot;
+ mem_heap_t* heap;
+ byte* buf;
+ ulint count;
+ ulint own_count;
+ ulint rec_own_count;
+ ulint slot_no;
+ ulint data_size;
+ const rec_t* rec;
+ const rec_t* old_rec = NULL;
+ ulint offs;
+ ulint n_slots;
+ ibool ret = FALSE;
+ ulint i;
+ ulint* offsets = NULL;
+ ulint* old_offsets = NULL;
if (UNIV_UNLIKELY((ibool) !!page_is_comp(page)
!= dict_table_is_comp(index->table))) {
@@ -2471,7 +2460,7 @@ page_validate(
count++;
own_count++;
old_rec = rec;
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
/* set old_offsets to offsets; recycle offsets */
{
@@ -2545,7 +2534,7 @@ n_owned_zero:
buf[offs + i] = 1;
}
- rec = page_rec_get_next(rec);
+ rec = page_rec_get_next_const(rec);
}
if (UNIV_UNLIKELY(page_dir_get_n_heap(page) != count + 1)) {
diff --git a/storage/xtradb/page/page0zip.c b/storage/xtradb/page/page0zip.c
index a94d2d54417..b81cba4826a 100644
--- a/storage/xtradb/page/page0zip.c
+++ b/storage/xtradb/page/page0zip.c
@@ -464,7 +464,7 @@ page_zip_fields_encode(
if (fixed_sum && UNIV_UNLIKELY
(fixed_sum + field->fixed_len
- > DICT_MAX_INDEX_COL_LEN)) {
+ > DICT_MAX_FIXED_COL_LEN)) {
/* Write out the length of the
preceding non-nullable fields,
to avoid exceeding the maximum
@@ -653,13 +653,13 @@ page_zip_dir_encode(
Allocate memory for zlib. */
static
void*
-page_zip_malloc(
+page_zip_zalloc(
/*============*/
void* opaque, /*!< in/out: memory heap */
uInt items, /*!< in: number of items to allocate */
uInt size) /*!< in: size of an item in bytes */
{
- return(mem_heap_alloc(opaque, items * size));
+ return(mem_heap_zalloc(opaque, items * size));
}
/**********************************************************************//**
@@ -684,7 +684,7 @@ page_zip_set_alloc(
{
z_stream* strm = stream;
- strm->zalloc = page_zip_malloc;
+ strm->zalloc = page_zip_zalloc;
strm->zfree = page_zip_free;
strm->opaque = heap;
}
@@ -2916,19 +2916,18 @@ zlib_error:
page_zip_set_alloc(&d_stream, heap);
- if (UNIV_UNLIKELY(inflateInit2(&d_stream, UNIV_PAGE_SIZE_SHIFT)
- != Z_OK)) {
- ut_error;
- }
-
d_stream.next_in = page_zip->data + PAGE_DATA;
/* Subtract the space reserved for
the page header and the end marker of the modification log. */
d_stream.avail_in = page_zip_get_size(page_zip) - (PAGE_DATA + 1);
-
d_stream.next_out = page + PAGE_ZIP_START;
d_stream.avail_out = UNIV_PAGE_SIZE - PAGE_ZIP_START;
+ if (UNIV_UNLIKELY(inflateInit2(&d_stream, UNIV_PAGE_SIZE_SHIFT)
+ != Z_OK)) {
+ ut_error;
+ }
+
/* Decode the zlib header and the index information. */
if (UNIV_UNLIKELY(inflate(&d_stream, Z_BLOCK) != Z_OK)) {
@@ -4426,6 +4425,7 @@ page_zip_reorganize(
dict_index_t* index, /*!< in: index of the B-tree node */
mtr_t* mtr) /*!< in: mini-transaction */
{
+ buf_pool_t* buf_pool = buf_pool_from_block(block);
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
page_t* page = buf_block_get_frame(block);
buf_block_t* temp_block;
@@ -4443,8 +4443,8 @@ page_zip_reorganize(
log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
#ifndef UNIV_HOTBACKUP
- temp_block = buf_block_alloc(0);
- btr_search_drop_page_hash_index(block);
+ temp_block = buf_block_alloc(buf_pool);
+ btr_search_drop_page_hash_index(block, index);
block->check_index_page_at_flush = TRUE;
#else /* !UNIV_HOTBACKUP */
ut_ad(block == back_block1);
@@ -4455,6 +4455,8 @@ page_zip_reorganize(
/* Copy the old page to temporary space */
buf_frame_copy(temp_page, page);
+ btr_blob_dbg_remove(page, index, "zip_reorg");
+
/* Recreate the page: note that global data on page (possible
segment headers, next page-field, etc.) is preserved intact */
@@ -4471,7 +4473,7 @@ page_zip_reorganize(
/* Copy max trx id to recreated page */
trx_id_t max_trx_id = page_get_max_trx_id(temp_page);
page_set_max_trx_id(block, NULL, max_trx_id, NULL);
- ut_ad(!ut_dulint_is_zero(max_trx_id));
+ ut_ad(max_trx_id != 0);
}
/* Restore logging. */
@@ -4513,7 +4515,7 @@ page_zip_copy_recs(
mtr_t* mtr) /*!< in: mini-transaction */
{
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
- ut_ad(mtr_memo_contains_page(mtr, (page_t*) src, MTR_MEMO_PAGE_X_FIX));
+ ut_ad(mtr_memo_contains_page(mtr, src, MTR_MEMO_PAGE_X_FIX));
ut_ad(!dict_index_is_ibuf(index));
#ifdef UNIV_ZIP_DEBUG
/* The B-tree operations that call this function may set
@@ -4531,7 +4533,7 @@ page_zip_copy_recs(
/* The PAGE_MAX_TRX_ID must be set on leaf pages of secondary
indexes. It does not matter on other pages. */
ut_a(dict_index_is_clust(index) || !page_is_leaf(src)
- || !ut_dulint_is_zero(page_get_max_trx_id(src)));
+ || page_get_max_trx_id(src));
UNIV_MEM_ASSERT_W(page, UNIV_PAGE_SIZE);
UNIV_MEM_ASSERT_W(page_zip->data, page_zip_get_size(page_zip));
@@ -4583,6 +4585,7 @@ page_zip_copy_recs(
#ifdef UNIV_ZIP_DEBUG
ut_a(page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
+ btr_blob_dbg_add(page, index, "page_zip_copy_recs");
page_zip_compress_write_log(page_zip, page, index, mtr);
}
diff --git a/storage/xtradb/pars/pars0pars.c b/storage/xtradb/pars/pars0pars.c
index 9faf36d00a8..ef107f2896f 100644
--- a/storage/xtradb/pars/pars0pars.c
+++ b/storage/xtradb/pars/pars0pars.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. 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
@@ -2038,11 +2038,11 @@ except that the buffer is dynamically allocated from the info struct's
heap. */
UNIV_INTERN
void
-pars_info_add_dulint_literal(
-/*=========================*/
+pars_info_add_ull_literal(
+/*======================*/
pars_info_t* info, /*!< in: info struct */
const char* name, /*!< in: name */
- dulint val) /*!< in: value */
+ ib_uint64_t val) /*!< in: value */
{
byte* buf = mem_heap_alloc(info->heap, 8);
diff --git a/storage/xtradb/que/que0que.c b/storage/xtradb/que/que0que.c
index 5c85a04d139..d704e0cd1fc 100644
--- a/storage/xtradb/que/que0que.c
+++ b/storage/xtradb/que/que0que.c
@@ -29,7 +29,6 @@ Created 5/27/1996 Heikki Tuuri
#include "que0que.ic"
#endif
-#include "srv0que.h"
#include "usr0sess.h"
#include "trx0trx.h"
#include "trx0roll.h"
@@ -1298,18 +1297,13 @@ que_run_threads_low(
que_thr_t* thr) /*!< in: query thread */
{
que_thr_t* next_thr;
- ulint cumul_resource;
ulint loop_count;
ut_ad(thr->state == QUE_THR_RUNNING);
ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
ut_ad(!mutex_own(&kernel_mutex));
- /* cumul_resource counts how much resources the OS thread (NOT the
- query thread) has spent in this function */
-
loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK;
- cumul_resource = 0;
loop:
/* Check that there is enough space in the log to accommodate
possible log entries by this query step; if the operation can touch
diff --git a/storage/xtradb/read/read0read.c b/storage/xtradb/read/read0read.c
index 85adae4ddff..f049dd21e8d 100644
--- a/storage/xtradb/read/read0read.c
+++ b/storage/xtradb/read/read0read.c
@@ -168,8 +168,7 @@ read_view_t*
read_view_oldest_copy_or_open_new(
/*==============================*/
trx_id_t cr_trx_id, /*!< in: trx_id of creating
- transaction, or ut_dulint_zero
- used in purge */
+ transaction, or 0 used in purge */
mem_heap_t* heap) /*!< in: memory heap from which
allocated */
{
@@ -191,7 +190,7 @@ read_view_oldest_copy_or_open_new(
n = old_view->n_trx_ids;
- if (!ut_dulint_is_zero(old_view->creator_trx_id)) {
+ if (old_view->creator_trx_id) {
n++;
} else {
needs_insert = FALSE;
@@ -206,9 +205,8 @@ read_view_oldest_copy_or_open_new(
while (i < n) {
if (needs_insert
&& (i >= old_view->n_trx_ids
- || ut_dulint_cmp(old_view->creator_trx_id,
- read_view_get_nth_trx_id(old_view, i))
- > 0)) {
+ || old_view->creator_trx_id
+ > read_view_get_nth_trx_id(old_view, i))) {
read_view_set_nth_trx_id(view_copy, i,
old_view->creator_trx_id);
@@ -252,8 +250,7 @@ read_view_t*
read_view_open_now(
/*===============*/
trx_id_t cr_trx_id, /*!< in: trx_id of creating
- transaction, or ut_dulint_zero
- used in purge */
+ transaction, or 0 used in purge */
mem_heap_t* heap) /*!< in: memory heap from which
allocated */
{
@@ -267,7 +264,7 @@ read_view_open_now(
view->creator_trx_id = cr_trx_id;
view->type = VIEW_NORMAL;
- view->undo_no = ut_dulint_zero;
+ view->undo_no = 0;
/* No future transactions should be visible in the view */
@@ -280,7 +277,7 @@ read_view_open_now(
/* No active transaction should be visible, except cr_trx */
while (trx) {
- if (ut_dulint_cmp(trx->id, cr_trx_id) != 0
+ if (trx->id != cr_trx_id
&& (trx->conc_state == TRX_ACTIVE
|| trx->conc_state == TRX_PREPARED)) {
@@ -292,9 +289,9 @@ read_view_open_now(
trx_sys->max_trx_id can still be active, if it is
in the middle of its commit! Note that when a
transaction starts, we initialize trx->no to
- ut_dulint_max. */
+ IB_ULONGLONG_MAX. */
- if (ut_dulint_cmp(view->low_limit_no, trx->no) > 0) {
+ if (view->low_limit_no > trx->no) {
view->low_limit_no = trx->no;
}
@@ -360,38 +357,36 @@ UNIV_INTERN
void
read_view_print(
/*============*/
+ FILE* file,
const read_view_t* view) /*!< in: read view */
{
ulint n_ids;
ulint i;
if (view->type == VIEW_HIGH_GRANULARITY) {
- fprintf(stderr,
- "High-granularity read view undo_n:o %lu %lu\n",
- (ulong) ut_dulint_get_high(view->undo_no),
- (ulong) ut_dulint_get_low(view->undo_no));
+ fprintf(file,
+ "High-granularity read view undo_n:o %llu\n",
+ (ullint) view->undo_no);
} else {
- fprintf(stderr, "Normal read view\n");
+ fprintf(file, "Normal read view\n");
}
- fprintf(stderr, "Read view low limit trx n:o %lu %lu\n",
- (ulong) ut_dulint_get_high(view->low_limit_no),
- (ulong) ut_dulint_get_low(view->low_limit_no));
+ fprintf(file, "Read view low limit trx n:o " TRX_ID_FMT "\n",
+ (ullint) view->low_limit_no);
- fprintf(stderr, "Read view up limit trx id " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(view->up_limit_id));
+ fprintf(file, "Read view up limit trx id " TRX_ID_FMT "\n",
+ (ullint) view->up_limit_id);
- fprintf(stderr, "Read view low limit trx id " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(view->low_limit_id));
+ fprintf(file, "Read view low limit trx id " TRX_ID_FMT "\n",
+ (ullint) view->low_limit_id);
- fprintf(stderr, "Read view individually stored trx ids:\n");
+ fprintf(file, "Read view individually stored trx ids:\n");
n_ids = view->n_trx_ids;
for (i = 0; i < n_ids; i++) {
- fprintf(stderr, "Read view trx id " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(
- read_view_get_nth_trx_id(view, i)));
+ fprintf(file, "Read view trx id " TRX_ID_FMT "\n",
+ (ullint) read_view_get_nth_trx_id(view, i));
}
}
@@ -460,9 +455,9 @@ read_cursor_view_create_for_mysql(
trx_sys->max_trx_id can still be active, if it is
in the middle of its commit! Note that when a
transaction starts, we initialize trx->no to
- ut_dulint_max. */
+ IB_ULONGLONG_MAX. */
- if (ut_dulint_cmp(view->low_limit_no, trx->no) > 0) {
+ if (view->low_limit_no > trx->no) {
view->low_limit_no = trx->no;
}
diff --git a/storage/xtradb/rem/rem0cmp.c b/storage/xtradb/rem/rem0cmp.c
index 8ee434f85da..04d2c15437b 100644
--- a/storage/xtradb/rem/rem0cmp.c
+++ b/storage/xtradb/rem/rem0cmp.c
@@ -862,15 +862,18 @@ cmp_rec_rec_with_match(
const ulint* offsets1,/*!< in: rec_get_offsets(rec1, index) */
const ulint* offsets2,/*!< in: rec_get_offsets(rec2, index) */
dict_index_t* index, /*!< in: data dictionary index */
+ ibool nulls_unequal,
+ /* in: TRUE if this is for index statistics
+ cardinality estimation, and innodb_stats_method
+ is "nulls_unequal" or "nulls_ignored" */
ulint* matched_fields, /*!< in/out: number of already completely
matched fields; when the function returns,
contains the value the for current
comparison */
- ulint* matched_bytes, /*!< in/out: number of already matched
+ ulint* matched_bytes) /*!< in/out: number of already matched
bytes within the first field not completely
matched; when the function returns, contains
the value for the current comparison */
- ulint stats_method)
{
ulint rec1_n_fields; /* the number of fields in rec */
ulint rec1_f_len; /* length of current field in rec */
@@ -962,13 +965,13 @@ cmp_rec_rec_with_match(
|| rec2_f_len == UNIV_SQL_NULL) {
if (rec1_f_len == rec2_f_len) {
-
- if (stats_method == SRV_STATS_METHOD_NULLS_EQUAL) {
- goto next_field;
- } else {
+ /* This is limited to stats collection,
+ cannot use it for regular search */
+ if (nulls_unequal) {
ret = -1;
+ } else {
+ goto next_field;
}
-
} else if (rec2_f_len == UNIV_SQL_NULL) {
/* We define the SQL null to be the
diff --git a/storage/xtradb/rem/rem0rec.c b/storage/xtradb/rem/rem0rec.c
index 37ba8ca2ffe..5a96e608ab5 100644
--- a/storage/xtradb/rem/rem0rec.c
+++ b/storage/xtradb/rem/rem0rec.c
@@ -1174,7 +1174,7 @@ rec_convert_dtuple_to_rec_comp(
} else if (dfield_is_ext(field)) {
ut_ad(ifield->col->len >= 256
|| ifield->col->mtype == DATA_BLOB);
- ut_ad(len <= REC_MAX_INDEX_COL_LEN
+ ut_ad(len <= REC_ANTELOPE_MAX_INDEX_COL_LEN
+ BTR_EXTERN_FIELD_REF_SIZE);
*lens-- = (byte) (len >> 8) | 0xc0;
*lens-- = (byte) len;
@@ -1749,9 +1749,9 @@ UNIV_INTERN
void
rec_print(
/*======*/
- FILE* file, /*!< in: file where to print */
- const rec_t* rec, /*!< in: physical record */
- dict_index_t* index) /*!< in: record descriptor */
+ FILE* file, /*!< in: file where to print */
+ const rec_t* rec, /*!< in: physical record */
+ const dict_index_t* index) /*!< in: record descriptor */
{
ut_ad(index);
diff --git a/storage/xtradb/row/row0ext.c b/storage/xtradb/row/row0ext.c
index 7320f5b1dca..07e970cf485 100644
--- a/storage/xtradb/row/row0ext.c
+++ b/storage/xtradb/row/row0ext.c
@@ -44,8 +44,9 @@ row_ext_cache_fill(
{
const byte* field = dfield_get_data(dfield);
ulint f_len = dfield_get_len(dfield);
- byte* buf = ext->buf + i * REC_MAX_INDEX_COL_LEN;
+ byte* buf = ext->buf + i * ext->max_len;
+ ut_ad(ext->max_len > 0);
ut_ad(i < ext->n_ext);
ut_ad(dfield_is_ext(dfield));
ut_a(f_len >= BTR_EXTERN_FIELD_REF_SIZE);
@@ -56,14 +57,14 @@ row_ext_cache_fill(
/* The BLOB pointer is not set: we cannot fetch it */
ext->len[i] = 0;
} else {
- /* Fetch at most REC_MAX_INDEX_COL_LEN of the column.
+ /* Fetch at most ext->max_len of the column.
The column should be non-empty. However,
trx_rollback_or_clean_all_recovered() may try to
access a half-deleted BLOB if the server previously
crashed during the execution of
btr_free_externally_stored_field(). */
ext->len[i] = btr_copy_externally_stored_field_prefix(
- buf, REC_MAX_INDEX_COL_LEN, zip_size, field, f_len);
+ buf, ext->max_len, zip_size, field, f_len);
}
}
@@ -79,16 +80,18 @@ row_ext_create(
in the InnoDB table object, as reported by
dict_col_get_no(); NOT relative to the records
in the clustered index */
+ ulint flags, /*!< in: table->flags */
const dtuple_t* tuple, /*!< in: data tuple containing the field
references of the externally stored
columns; must be indexed by col_no;
the clustered index record must be
covered by a lock or a page latch
to prevent deletion (rollback or purge). */
- ulint zip_size,/*!< compressed page size in bytes, or 0 */
mem_heap_t* heap) /*!< in: heap where created */
{
ulint i;
+ ulint zip_size = dict_table_flags_to_zip_size(flags);
+
row_ext_t* ret = mem_heap_alloc(heap, (sizeof *ret)
+ (n_ext - 1) * sizeof ret->len);
@@ -97,10 +100,12 @@ row_ext_create(
ret->n_ext = n_ext;
ret->ext = ext;
- ret->buf = mem_heap_alloc(heap, n_ext * REC_MAX_INDEX_COL_LEN);
+ ret->max_len = DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(flags);
+
+ ret->buf = mem_heap_alloc(heap, n_ext * ret->max_len);
#ifdef UNIV_DEBUG
- memset(ret->buf, 0xaa, n_ext * REC_MAX_INDEX_COL_LEN);
- UNIV_MEM_ALLOC(ret->buf, n_ext * REC_MAX_INDEX_COL_LEN);
+ memset(ret->buf, 0xaa, n_ext * ret->max_len);
+ UNIV_MEM_ALLOC(ret->buf, n_ext * ret->max_len);
#endif
/* Fetch the BLOB prefixes */
diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c
index d4925e46f97..b4e66a16b5f 100644
--- a/storage/xtradb/row/row0ins.c
+++ b/storage/xtradb/row/row0ins.c
@@ -87,7 +87,7 @@ ins_node_create(
node->select = NULL;
- node->trx_id = ut_dulint_zero;
+ node->trx_id = 0;
node->entry_sys_heap = mem_heap_create(128);
@@ -207,7 +207,7 @@ ins_node_set_new_row(
/* As we allocated a new trx id buf, the trx id should be written
there again: */
- node->trx_id = ut_dulint_zero;
+ node->trx_id = 0;
}
/*******************************************************************//**
@@ -515,8 +515,7 @@ row_ins_cascade_calc_update_vec(
if (!dfield_is_null(&ufield->new_val)
&& dtype_get_at_most_n_mbchars(
- col->prtype,
- col->mbminlen, col->mbmaxlen,
+ col->prtype, col->mbminmaxlen,
col->len,
ufield_len,
dfield_get_data(&ufield->new_val))
@@ -539,49 +538,37 @@ row_ins_cascade_calc_update_vec(
if (min_size > ufield_len) {
- char* pad_start;
- const char* pad_end;
- char* padded_data
- = mem_heap_alloc(
- heap, min_size);
- pad_start = padded_data + ufield_len;
- pad_end = padded_data + min_size;
+ byte* pad;
+ ulint pad_len;
+ byte* padded_data;
+ ulint mbminlen;
+
+ padded_data = mem_heap_alloc(
+ heap, min_size);
+
+ pad = padded_data + ufield_len;
+ pad_len = min_size - ufield_len;
memcpy(padded_data,
dfield_get_data(&ufield
->new_val),
- dfield_get_len(&ufield
- ->new_val));
+ ufield_len);
- switch (UNIV_EXPECT(col->mbminlen,1)) {
- default:
- ut_error;
- return(ULINT_UNDEFINED);
- case 1:
- if (UNIV_UNLIKELY
- (dtype_get_charset_coll(
- col->prtype)
- == DATA_MYSQL_BINARY_CHARSET_COLL)) {
- /* Do not pad BINARY
- columns. */
- return(ULINT_UNDEFINED);
- }
+ mbminlen = dict_col_get_mbminlen(col);
+
+ ut_ad(!(ufield_len % mbminlen));
+ ut_ad(!(min_size % mbminlen));
- /* space=0x20 */
- memset(pad_start, 0x20,
- pad_end - pad_start);
- break;
- case 2:
- /* space=0x0020 */
- ut_a(!(ufield_len % 2));
- ut_a(!(min_size % 2));
- do {
- *pad_start++ = 0x00;
- *pad_start++ = 0x20;
- } while (pad_start < pad_end);
- break;
+ if (mbminlen == 1
+ && dtype_get_charset_coll(
+ col->prtype)
+ == DATA_MYSQL_BINARY_CHARSET_COLL) {
+ /* Do not pad BINARY columns */
+ return(ULINT_UNDEFINED);
}
+ row_mysql_pad_col(mbminlen,
+ pad, pad_len);
dfield_set_data(&ufield->new_val,
padded_data, min_size);
}
@@ -1544,7 +1531,7 @@ row_ins_check_foreign_constraints(
if (foreign->foreign_index == index) {
if (foreign->referenced_table == NULL) {
- dict_table_get(foreign->referenced_table_name,
+ dict_table_get(foreign->referenced_table_name_lookup,
FALSE);
}
@@ -1787,7 +1774,7 @@ ulint
row_ins_duplicate_error_in_clust(
/*=============================*/
btr_cur_t* cursor, /*!< in: B-tree cursor */
- dtuple_t* entry, /*!< in: entry to insert */
+ const dtuple_t* entry, /*!< in: entry to insert */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in: mtr */
{
@@ -1983,12 +1970,12 @@ row_ins_index_entry_low(
depending on whether we wish optimistic or
pessimistic descent down the index tree */
dict_index_t* index, /*!< in: index */
- dtuple_t* entry, /*!< in: index entry to insert */
+ dtuple_t* entry, /*!< in/out: index entry to insert */
ulint n_ext, /*!< in: number of externally stored columns */
que_thr_t* thr) /*!< in: query thread */
{
btr_cur_t cursor;
- ulint ignore_sec_unique = 0;
+ ulint search_mode;
ulint modify = 0; /* remove warning */
rec_t* insert_rec;
rec_t* rec;
@@ -2008,24 +1995,31 @@ row_ins_index_entry_low(
the function will return in both low_match and up_match of the
cursor sensible values */
- if (!(thr_get_trx(thr)->check_unique_secondary)) {
- ignore_sec_unique = BTR_IGNORE_SEC_UNIQUE;
+ if (dict_index_is_clust(index)) {
+ search_mode = mode;
+ } else if (!(thr_get_trx(thr)->check_unique_secondary)) {
+ search_mode = mode | BTR_INSERT | BTR_IGNORE_SEC_UNIQUE;
+ } else {
+ search_mode = mode | BTR_INSERT;
}
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
- mode | BTR_INSERT | ignore_sec_unique,
+ search_mode,
&cursor, 0, __FILE__, __LINE__, &mtr);
if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
/* The insertion was made to the insert buffer already during
the search: we are done */
+ ut_ad(search_mode & BTR_INSERT);
err = DB_SUCCESS;
goto function_exit;
}
#ifdef UNIV_DEBUG
+ if (!srv_use_sys_stats_table
+ || index != UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes))
{
page_t* page = btr_cur_get_page(&cursor);
rec_t* first_rec = page_rec_get_next(
@@ -2136,7 +2130,7 @@ function_exit:
err = btr_store_big_rec_extern_fields(
index, btr_cur_get_block(&cursor),
- rec, offsets, big_rec, &mtr);
+ rec, offsets, &mtr, FALSE, big_rec);
if (modify) {
dtuple_big_rec_free(big_rec);
@@ -2164,9 +2158,10 @@ ulint
row_ins_index_entry(
/*================*/
dict_index_t* index, /*!< in: index */
- dtuple_t* entry, /*!< in: index entry to insert */
+ dtuple_t* entry, /*!< in/out: index entry to insert */
ulint n_ext, /*!< in: number of externally stored columns */
- ibool foreign,/*!< in: TRUE=check foreign key constraints */
+ ibool foreign,/*!< in: TRUE=check foreign key constraints
+ (foreign=FALSE only during CREATE INDEX) */
que_thr_t* thr) /*!< in: query thread */
{
ulint err;
@@ -2233,7 +2228,7 @@ row_ins_index_entry_set_vals(
= dict_field_get_col(ind_field);
len = dtype_get_at_most_n_mbchars(
- col->prtype, col->mbminlen, col->mbmaxlen,
+ col->prtype, col->mbminmaxlen,
ind_field->prefix_len,
len, dfield_get_data(row_field));
@@ -2280,7 +2275,7 @@ row_ins_alloc_row_id_step(
/*======================*/
ins_node_t* node) /*!< in: row insert node */
{
- dulint row_id;
+ row_id_t row_id;
ut_ad(node->state == INS_NODE_ALLOC_ROW_ID);
@@ -2467,7 +2462,7 @@ row_ins_step(
/* It may be that the current session has not yet started
its transaction, or it has been committed: */
- if (UT_DULINT_EQ(trx->id, node->trx_id)) {
+ if (trx->id == node->trx_id) {
/* No need to do IX-locking */
goto same_trx;
diff --git a/storage/xtradb/row/row0merge.c b/storage/xtradb/row/row0merge.c
index 1e1d19f28c8..7d4716cb623 100644
--- a/storage/xtradb/row/row0merge.c
+++ b/storage/xtradb/row/row0merge.c
@@ -57,6 +57,11 @@ Completed by Sunny Bains and Marko Makela
#include "ut0sort.h"
#include "handler0alter.h"
+/* Ignore posix_fadvise() on those platforms where it does not exist */
+#if defined __WIN__
+# define posix_fadvise(fd, offset, len, advice) /* nothing */
+#endif /* __WIN__ */
+
#ifdef UNIV_DEBUG
/** Set these in order ot enable debug printout. */
/* @{ */
@@ -269,6 +274,7 @@ row_merge_buf_add(
const dict_index_t* index;
dfield_t* entry;
dfield_t* field;
+ const dict_field_t* ifield;
if (buf->n_tuples >= buf->max_tuples) {
return(FALSE);
@@ -287,14 +293,14 @@ row_merge_buf_add(
data_size = 0;
extra_size = UT_BITS_IN_BYTES(index->n_nullable);
- for (i = 0; i < n_fields; i++, field++) {
- const dict_field_t* ifield;
+ ifield = dict_index_get_nth_field(index, 0);
+
+ for (i = 0; i < n_fields; i++, field++, ifield++) {
const dict_col_t* col;
ulint col_no;
const dfield_t* row_field;
ulint len;
- ifield = dict_index_get_nth_field(index, i);
col = ifield->col;
col_no = dict_col_get_no(col);
row_field = dtuple_get_nth_field(row, col_no);
@@ -332,7 +338,7 @@ row_merge_buf_add(
if (ifield->prefix_len) {
len = dtype_get_at_most_n_mbchars(
col->prtype,
- col->mbminlen, col->mbmaxlen,
+ col->mbminmaxlen,
ifield->prefix_len,
len, dfield_get_data(field));
dfield_set_len(field, len);
@@ -690,7 +696,9 @@ ibool
row_merge_read(
/*===========*/
int fd, /*!< in: file descriptor */
- ulint offset, /*!< in: offset where to read */
+ ulint offset, /*!< in: offset where to read
+ in number of row_merge_block_t
+ elements */
row_merge_block_t* buf) /*!< out: data */
{
ib_uint64_t ofs = ((ib_uint64_t) offset) * sizeof *buf;
@@ -707,6 +715,11 @@ row_merge_read(
(ulint) (ofs & 0xFFFFFFFF),
(ulint) (ofs >> 32),
sizeof *buf);
+#ifdef POSIX_FADV_DONTNEED
+ /* Each block is read exactly once. Free up the file cache. */
+ posix_fadvise(fd, ofs, sizeof *buf, POSIX_FADV_DONTNEED);
+#endif /* POSIX_FADV_DONTNEED */
+
if (UNIV_UNLIKELY(!success)) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -724,13 +737,18 @@ ibool
row_merge_write(
/*============*/
int fd, /*!< in: file descriptor */
- ulint offset, /*!< in: offset where to read
- in number of row_merge_block_t
- elements */
+ ulint offset, /*!< in: offset where to write,
+ in number of row_merge_block_t elements */
const void* buf) /*!< in: data */
{
- ib_uint64_t ofs = ((ib_uint64_t) offset)
- * sizeof(row_merge_block_t);
+ size_t buf_len = sizeof(row_merge_block_t);
+ ib_uint64_t ofs = buf_len * (ib_uint64_t) offset;
+ ibool ret;
+
+ ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf,
+ (ulint) (ofs & 0xFFFFFFFF),
+ (ulint) (ofs >> 32),
+ buf_len);
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
@@ -739,10 +757,13 @@ row_merge_write(
}
#endif /* UNIV_DEBUG */
- return(UNIV_LIKELY(os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf,
- (ulint) (ofs & 0xFFFFFFFF),
- (ulint) (ofs >> 32),
- sizeof(row_merge_block_t))));
+#ifdef POSIX_FADV_DONTNEED
+ /* The block will be needed on the next merge pass,
+ but it can be evicted from the file cache meanwhile. */
+ posix_fadvise(fd, ofs, buf_len, POSIX_FADV_DONTNEED);
+#endif /* POSIX_FADV_DONTNEED */
+
+ return(UNIV_LIKELY(ret));
}
/********************************************************************//**
@@ -1585,49 +1606,48 @@ row_merge(
const dict_index_t* index, /*!< in: index being created */
merge_file_t* file, /*!< in/out: file containing
index entries */
+ ulint* half, /*!< in/out: half the file */
row_merge_block_t* block, /*!< in/out: 3 buffers */
int* tmpfd, /*!< in/out: temporary file handle */
- struct TABLE* table, /*!< in/out: MySQL table, for
+ struct TABLE* table) /*!< in/out: MySQL table, for
reporting erroneous key value
if applicable */
- ulint* num_run,/*!< in/out: Number of runs remain
- to be merged */
- ulint* run_offset) /*!< in/out: Array contains the
- first offset number for each merge
- run */
{
ulint foffs0; /*!< first input offset */
ulint foffs1; /*!< second input offset */
ulint error; /*!< error code */
merge_file_t of; /*!< output file */
- const ulint ihalf = run_offset[*num_run / 2];
+ const ulint ihalf = *half;
/*!< half the input file */
- ulint n_run = 0;
- /*!< num of runs generated from this merge */
+ ulint ohalf; /*!< half the output file */
UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]);
-
ut_ad(ihalf < file->offset);
of.fd = *tmpfd;
of.offset = 0;
of.n_rec = 0;
+#ifdef POSIX_FADV_SEQUENTIAL
+ /* The input file will be read sequentially, starting from the
+ beginning and the middle. In Linux, the POSIX_FADV_SEQUENTIAL
+ affects the entire file. Each block will be read exactly once. */
+ posix_fadvise(file->fd, 0, 0,
+ POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE);
+#endif /* POSIX_FADV_SEQUENTIAL */
+
/* Merge blocks to the output file. */
+ ohalf = 0;
foffs0 = 0;
foffs1 = ihalf;
- UNIV_MEM_INVALID(run_offset, *num_run * sizeof *run_offset);
-
for (; foffs0 < ihalf && foffs1 < file->offset; foffs0++, foffs1++) {
+ ulint ahalf; /*!< arithmetic half the input file */
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
return(DB_INTERRUPTED);
}
- /* Remember the offset number for this run */
- run_offset[n_run++] = of.offset;
-
error = row_merge_blocks(index, file, block,
&foffs0, &foffs1, &of, table);
@@ -1635,6 +1655,21 @@ row_merge(
return(error);
}
+ /* Record the offset of the output file when
+ approximately half the output has been generated. In
+ this way, the next invocation of row_merge() will
+ spend most of the time in this loop. The initial
+ estimate is ohalf==0. */
+ ahalf = file->offset / 2;
+ ut_ad(ohalf <= of.offset);
+
+ /* Improve the estimate until reaching half the input
+ file size, or we can not get any closer to it. All
+ comparands should be non-negative when !(ohalf < ahalf)
+ because ohalf <= of.offset. */
+ if (ohalf < ahalf || of.offset - ahalf < ohalf - ahalf) {
+ ohalf = of.offset;
+ }
}
/* Copy the last blocks, if there are any. */
@@ -1644,9 +1679,6 @@ row_merge(
return(DB_INTERRUPTED);
}
- /* Remember the offset number for this run */
- run_offset[n_run++] = of.offset;
-
if (!row_merge_blocks_copy(index, file, block, &foffs0, &of)) {
return(DB_CORRUPTION);
}
@@ -1659,9 +1691,6 @@ row_merge(
return(DB_INTERRUPTED);
}
- /* Remember the offset number for this run */
- run_offset[n_run++] = of.offset;
-
if (!row_merge_blocks_copy(index, file, block, &foffs1, &of)) {
return(DB_CORRUPTION);
}
@@ -1673,23 +1702,10 @@ row_merge(
return(DB_CORRUPTION);
}
- ut_ad(n_run <= *num_run);
-
- *num_run = n_run;
-
- /* Each run can contain one or more offsets. As merge goes on,
- the number of runs (to merge) will reduce until we have one
- single run. So the number of runs will always be smaller than
- the number of offsets in file */
- ut_ad((*num_run) <= file->offset);
-
- /* The number of offsets in output file is always equal or
- smaller than input file */
- ut_ad(of.offset <= file->offset);
-
/* Swap file descriptors for the next pass. */
*tmpfd = file->fd;
*file = of;
+ *half = ohalf;
UNIV_MEM_INVALID(block[0], 3 * sizeof block[0]);
@@ -1714,44 +1730,27 @@ row_merge_sort(
if applicable */
{
ulint half = file->offset / 2;
- ulint num_runs;
- ulint* run_offset;
- ulint error = DB_SUCCESS;
-
- /* Record the number of merge runs we need to perform */
- num_runs = file->offset;
-
- /* If num_runs are less than 1, nothing to merge */
- if (num_runs <= 1) {
- return(error);
- }
-
- /* "run_offset" records each run's first offset number */
- run_offset = (ulint*) mem_alloc(file->offset * sizeof(ulint));
-
- /* This tells row_merge() where to start for the first round
- of merge. */
- run_offset[half] = half;
/* The file should always contain at least one byte (the end
of file marker). Thus, it must be at least one block. */
ut_ad(file->offset > 0);
- /* Merge the runs until we have one big run */
do {
- error = row_merge(trx, index, file, block, tmpfd,
- table, &num_runs, run_offset);
+ ulint error;
- UNIV_MEM_ASSERT_RW(run_offset, num_runs * sizeof *run_offset);
+ error = row_merge(trx, index, file, &half,
+ block, tmpfd, table);
if (error != DB_SUCCESS) {
- break;
+ return(error);
}
- } while (num_runs > 1);
- mem_free(run_offset);
+ /* half > 0 should hold except when the file consists
+ of one block. No need to merge further then. */
+ ut_ad(half > 0 || file->offset == 1);
+ } while (half < file->offset && half > 0);
- return(error);
+ return(DB_SUCCESS);
}
/*************************************************************//**
@@ -1937,7 +1936,6 @@ row_merge_lock_table(
sel_node_t* node;
ut_ad(trx);
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_ad(mode == LOCK_X || mode == LOCK_S);
heap = mem_heap_create(512);
@@ -2038,7 +2036,7 @@ row_merge_drop_index(
ut_ad(index && table && trx);
- pars_info_add_dulint_literal(info, "indexid", index->id);
+ pars_info_add_ull_literal(info, "indexid", index->id);
trx_start_if_not_started(trx);
trx->op_info = "dropping index";
@@ -2052,7 +2050,7 @@ row_merge_drop_index(
/* Replace this index with another equivalent index for all
foreign key constraints on this table where this index is used */
- dict_table_replace_index_in_foreign_list(table, index);
+ dict_table_replace_index_in_foreign_list(table, index, trx);
dict_index_remove_from_cache(table, index);
trx->op_info = "";
@@ -2108,7 +2106,7 @@ row_merge_drop_temp_indexes(void)
const rec_t* rec;
const byte* field;
ulint len;
- dulint table_id;
+ table_id_t table_id;
dict_table_t* table;
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
@@ -2168,6 +2166,33 @@ row_merge_drop_temp_indexes(void)
}
/*********************************************************************//**
+Creates temperary merge files, and if UNIV_PFS_IO defined, register
+the file descriptor with Performance Schema.
+@return File descriptor */
+UNIV_INLINE
+int
+row_merge_file_create_low(void)
+/*===========================*/
+{
+ int fd;
+#ifdef UNIV_PFS_IO
+ /* This temp file open does not go through normal
+ file APIs, add instrumentation to register with
+ performance schema */
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+ register_pfs_file_open_begin(&state, locker, innodb_file_temp_key,
+ PSI_FILE_OPEN,
+ "Innodb Merge Temp File",
+ __FILE__, __LINE__);
+#endif
+ fd = innobase_mysql_tmpfile();
+#ifdef UNIV_PFS_IO
+ register_pfs_file_open_end(locker, fd);
+#endif
+ return(fd);
+}
+/*********************************************************************//**
Create a merge file. */
static
void
@@ -2175,12 +2200,33 @@ row_merge_file_create(
/*==================*/
merge_file_t* merge_file) /*!< out: merge file structure */
{
- merge_file->fd = innobase_mysql_tmpfile();
+ merge_file->fd = row_merge_file_create_low();
merge_file->offset = 0;
merge_file->n_rec = 0;
}
/*********************************************************************//**
+Destroy a merge file. And de-register the file from Performance Schema
+if UNIV_PFS_IO is defined. */
+UNIV_INLINE
+void
+row_merge_file_destroy_low(
+/*=======================*/
+ int fd) /*!< in: merge file descriptor */
+{
+#ifdef UNIV_PFS_IO
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+ register_pfs_file_io_begin(&state, locker,
+ fd, 0, PSI_FILE_CLOSE,
+ __FILE__, __LINE__);
+#endif
+ close(fd);
+#ifdef UNIV_PFS_IO
+ register_pfs_file_io_end(locker, 0);
+#endif
+}
+/*********************************************************************//**
Destroy a merge file. */
static
void
@@ -2189,7 +2235,7 @@ row_merge_file_destroy(
merge_file_t* merge_file) /*!< out: merge file structure */
{
if (merge_file->fd != -1) {
- close(merge_file->fd);
+ row_merge_file_destroy_low(merge_file->fd);
merge_file->fd = -1;
}
}
@@ -2313,7 +2359,7 @@ row_merge_rename_indexes(
trx->op_info = "renaming indexes";
- pars_info_add_dulint_literal(info, "tableid", table->id);
+ pars_info_add_ull_literal(info, "tableid", table->id);
err = que_eval_sql(info, rename_indexes, FALSE, trx);
@@ -2350,9 +2396,8 @@ row_merge_rename_tables(
{
ulint err = DB_ERROR;
pars_info_t* info;
- char old_name[MAX_TABLE_NAME_LEN + 1];
+ char old_name[MAX_FULL_NAME_LEN + 1];
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_ad(old_table != new_table);
ut_ad(mutex_own(&dict_sys->mutex));
@@ -2365,7 +2410,7 @@ row_merge_rename_tables(
ut_print_timestamp(stderr);
fprintf(stderr, "InnoDB: too long table name: '%s', "
"max length is %d\n", old_table->name,
- MAX_TABLE_NAME_LEN);
+ MAX_FULL_NAME_LEN);
ut_error;
}
@@ -2501,8 +2546,7 @@ row_merge_create_index(
/* Note the id of the transaction that created this
index, we use it to restrict readers from accessing
this index, to ensure read consistency. */
- index->trx_id = (ib_uint64_t)
- ut_conv_dulint_to_longlong(trx->id);
+ index->trx_id = trx->id;
} else {
index = NULL;
}
@@ -2519,10 +2563,8 @@ row_merge_is_index_usable(
const trx_t* trx, /*!< in: transaction */
const dict_index_t* index) /*!< in: index to check */
{
- return(!trx->read_view || read_view_sees_trx_id(
- trx->read_view,
- ut_dulint_create((ulint) (index->trx_id >> 32),
- (ulint) index->trx_id & 0xFFFFFFFF)));
+ return(!trx->read_view
+ || read_view_sees_trx_id(trx->read_view, index->trx_id));
}
/*********************************************************************//**
@@ -2589,7 +2631,7 @@ row_merge_build_indexes(
row_merge_file_create(&merge_files[i]);
}
- tmpfd = innobase_mysql_tmpfile();
+ tmpfd = row_merge_file_create_low();
/* Reset the MySQL row buffer that is used when reporting
duplicate keys. */
@@ -2631,7 +2673,7 @@ row_merge_build_indexes(
}
func_exit:
- close(tmpfd);
+ row_merge_file_destroy_low(tmpfd);
for (i = 0; i < n_indexes; i++) {
row_merge_file_destroy(&merge_files[i]);
diff --git a/storage/xtradb/row/row0mysql.c b/storage/xtradb/row/row0mysql.c
index 56754404b65..836189e0eb8 100644
--- a/storage/xtradb/row/row0mysql.c
+++ b/storage/xtradb/row/row0mysql.c
@@ -52,6 +52,7 @@ Created 9/17/2000 Heikki Tuuri
#include "btr0sea.h"
#include "fil0fil.h"
#include "ibuf0ibuf.h"
+#include "ha_prototypes.h"
/** Provide optional 4.x backwards compatibility for 5.0 and above */
UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
@@ -267,6 +268,49 @@ row_mysql_read_blob_ref(
}
/**************************************************************//**
+Pad a column with spaces. */
+UNIV_INTERN
+void
+row_mysql_pad_col(
+/*==============*/
+ ulint mbminlen, /*!< in: minimum size of a character,
+ in bytes */
+ byte* pad, /*!< out: padded buffer */
+ ulint len) /*!< in: number of bytes to pad */
+{
+ const byte* pad_end;
+
+ switch (UNIV_EXPECT(mbminlen, 1)) {
+ default:
+ ut_error;
+ case 1:
+ /* space=0x20 */
+ memset(pad, 0x20, len);
+ break;
+ case 2:
+ /* space=0x0020 */
+ pad_end = pad + len;
+ ut_a(!(len % 2));
+ do {
+ *pad++ = 0x00;
+ *pad++ = 0x20;
+ } while (pad < pad_end);
+ break;
+ case 4:
+ /* space=0x00000020 */
+ pad_end = pad + len;
+ ut_a(!(len % 4));
+ do {
+ *pad++ = 0x00;
+ *pad++ = 0x00;
+ *pad++ = 0x00;
+ *pad++ = 0x20;
+ } while (pad < pad_end);
+ break;
+ }
+}
+
+/**************************************************************//**
Stores a non-SQL-NULL field given in the MySQL format in the InnoDB format.
The counterpart of this function is row_sel_field_store_in_mysql_format() in
row0sel.c.
@@ -358,12 +402,28 @@ row_mysql_store_col_in_innobase_format(
/* Remove trailing spaces from old style VARCHAR
columns. */
- /* Handle UCS2 strings differently. */
+ /* Handle Unicode strings differently. */
ulint mbminlen = dtype_get_mbminlen(dtype);
ptr = mysql_data;
- if (mbminlen == 2) {
+ switch (mbminlen) {
+ default:
+ ut_error;
+ case 4:
+ /* space=0x00000020 */
+ /* Trim "half-chars", just in case. */
+ col_len &= ~3;
+
+ while (col_len >= 4
+ && ptr[col_len - 4] == 0x00
+ && ptr[col_len - 3] == 0x00
+ && ptr[col_len - 2] == 0x00
+ && ptr[col_len - 1] == 0x20) {
+ col_len -= 4;
+ }
+ break;
+ case 2:
/* space=0x0020 */
/* Trim "half-chars", just in case. */
col_len &= ~1;
@@ -372,8 +432,8 @@ row_mysql_store_col_in_innobase_format(
&& ptr[col_len - 1] == 0x20) {
col_len -= 2;
}
- } else {
- ut_a(mbminlen == 1);
+ break;
+ case 1:
/* space=0x20 */
while (col_len > 0
&& ptr[col_len - 1] == 0x20) {
@@ -445,7 +505,7 @@ row_mysql_convert_row_to_innobase(
row is used, as row may contain
pointers to this record! */
{
- mysql_row_templ_t* templ;
+ const mysql_row_templ_t*templ;
dfield_t* dfield;
ulint i;
@@ -574,7 +634,7 @@ handle_new_error:
"InnoDB: If the mysqld server crashes"
" after the startup or when\n"
"InnoDB: you dump the tables, look at\n"
- "InnoDB: " REFMAN "forcing-recovery.html"
+ "InnoDB: " REFMAN "forcing-innodb-recovery.html"
" for help.\n", stderr);
break;
case DB_FOREIGN_EXCEED_MAX_CASCADE:
@@ -875,7 +935,8 @@ row_update_statistics_if_needed(
if (counter > 2000000000
|| ((ib_int64_t)counter > 16 + table->stat_n_rows / 16)) {
- dict_update_statistics(table, TRUE);
+ dict_update_statistics(table, FALSE /* update even if stats
+ are initialized */, TRUE);
}
}
@@ -920,7 +981,6 @@ row_lock_table_autoinc_for_mysql(
ibool was_lock_wait;
ut_ad(trx);
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
/* If we already hold an AUTOINC lock on the table then do nothing.
Note: We peek at the value of the current owner without acquiring
@@ -1000,7 +1060,6 @@ row_lock_table_for_mysql(
ibool was_lock_wait;
ut_ad(trx);
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
trx->op_info = "setting table lock";
@@ -1074,7 +1133,6 @@ row_insert_for_mysql(
ins_node_t* node = prebuilt->ins_node;
ut_ad(trx);
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
if (prebuilt->table->ibd_file_missing) {
ut_print_timestamp(stderr);
@@ -1135,7 +1193,7 @@ row_insert_for_mysql(
thr = que_fork_get_first_thr(prebuilt->ins_graph);
- if (!prebuilt->mysql_has_locked) {
+ if (!prebuilt->mysql_has_locked && !(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) {
fprintf(stderr, "InnoDB: Error: row_insert_for_mysql is called without ha_innobase::external_lock()\n");
if (trx->mysql_thd != NULL) {
innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
@@ -1315,7 +1373,6 @@ row_update_for_mysql(
trx_t* trx = prebuilt->trx;
ut_ad(prebuilt && trx);
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
UT_NOT_USED(mysql_rec);
if (prebuilt->table->ibd_file_missing) {
@@ -1444,7 +1501,12 @@ run_again:
srv_n_rows_updated++;
}
- row_update_statistics_if_needed(prebuilt->table);
+ /* We update table statistics only if it is a DELETE or UPDATE
+ that changes indexed columns, UPDATEs that change only non-indexed
+ columns would not affect statistics. */
+ if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
+ row_update_statistics_if_needed(prebuilt->table);
+ }
trx->op_info = "";
@@ -1478,7 +1540,6 @@ row_unlock_for_mysql(
trx_t* trx = prebuilt->trx;
ut_ad(prebuilt && trx);
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
if (UNIV_UNLIKELY
(!srv_locks_unsafe_for_binlog
@@ -1554,7 +1615,7 @@ row_unlock_for_mysql(
}
}
- if (ut_dulint_cmp(rec_trx_id, trx->id) != 0) {
+ if (rec_trx_id != trx->id) {
/* We did not update the record: unlock it */
rec = btr_pcur_get_rec(pcur);
@@ -1599,6 +1660,9 @@ row_update_cascade_for_mysql(
trx = thr_get_trx(thr);
+ /* Increment fk_cascade_depth to record the recursive call depth on
+ a single update/delete that affects multiple tables chained
+ together with foreign key relations. */
thr->fk_cascade_depth++;
if (thr->fk_cascade_depth > FK_MAX_CASCADE_DEL) {
@@ -1610,6 +1674,12 @@ run_again:
row_upd_step(thr);
+ /* The recursive call for cascading update/delete happens
+ in above row_upd_step(), reset the counter once we come
+ out of the recursive call, so it does not accumulate for
+ different row deletes */
+ thr->fk_cascade_depth = 0;
+
err = trx->error_state;
/* Note that the cascade node is a subnode of another InnoDB
@@ -1771,7 +1841,6 @@ row_create_table_for_mysql(
ulint table_name_len;
ulint err;
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
@@ -1876,15 +1945,13 @@ err_exit:
err = trx->error_state;
- if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
+ switch (err) {
+ case DB_SUCCESS:
+ break;
+ case DB_OUT_OF_FILE_SPACE:
trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, NULL);
- /* TO DO: free table? The code below will dereference
- table->name, though. */
- }
- switch (err) {
- case DB_OUT_OF_FILE_SPACE:
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: cannot create table ",
stderr);
@@ -1899,9 +1966,13 @@ err_exit:
break;
case DB_DUPLICATE_KEY:
+ default:
/* We may also get err == DB_ERROR if the .ibd file for the
table already exists */
+ trx->error_state = DB_SUCCESS;
+ trx_general_rollback_for_mysql(trx, NULL);
+ dict_mem_table_free(table);
break;
}
@@ -1938,12 +2009,12 @@ row_create_index_for_mysql(
ulint i;
ulint len;
char* table_name;
+ dict_table_t* table;
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mutex_own(&(dict_sys->mutex)));
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
trx->op_info = "creating index";
@@ -1952,6 +2023,8 @@ row_create_index_for_mysql(
que_run_threads()) and thus index->table_name is not available. */
table_name = mem_strdup(index->table_name);
+ table = dict_table_get_low(table_name);
+
trx_start_if_not_started(trx);
/* Check that the same column does not appear twice in the index.
@@ -1984,7 +2057,7 @@ row_create_index_for_mysql(
}
/* Check also that prefix_len and actual length
- < DICT_MAX_INDEX_COL_LEN */
+ is less than that from DICT_MAX_FIELD_LEN_BY_FORMAT() */
len = dict_index_get_nth_field(index, i)->prefix_len;
@@ -1992,8 +2065,9 @@ row_create_index_for_mysql(
len = ut_max(len, field_lengths[i]);
}
- if (len >= DICT_MAX_INDEX_COL_LEN) {
- err = DB_TOO_BIG_RECORD;
+ /* Column or prefix length exceeds maximum column length */
+ if (len > (ulint) DICT_MAX_FIELD_LEN_BY_FORMAT(table)) {
+ err = DB_TOO_BIG_INDEX_COL;
goto error_handling;
}
@@ -2018,6 +2092,7 @@ row_create_index_for_mysql(
que_graph_free((que_t*) que_node_get_parent(thr));
error_handling:
+
if (err != DB_SUCCESS) {
/* We have special error handling here */
@@ -2053,7 +2128,7 @@ row_insert_stats_for_mysql(
que_thr_t* thr;
ulint err;
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
+ //ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
trx->op_info = "try to insert rows to SYS_STATS";
@@ -2079,6 +2154,32 @@ row_insert_stats_for_mysql(
}
/*********************************************************************//**
+*/
+UNIV_INTERN
+int
+row_delete_stats_for_mysql(
+/*=============================*/
+ dict_index_t* index,
+ trx_t* trx)
+{
+ pars_info_t* info = pars_info_create();
+
+ trx->op_info = "delete rows from SYS_STATS";
+
+ trx_start_if_not_started(trx);
+ trx->error_state = DB_SUCCESS;
+
+ pars_info_add_ull_literal(info, "indexid", index->id);
+
+ return((int) que_eval_sql(info,
+ "PROCEDURE DELETE_STATISTICS_PROC () IS\n"
+ "BEGIN\n"
+ "DELETE FROM SYS_STATS WHERE INDEX_ID = :indexid;\n"
+ "END;\n"
+ , TRUE, trx));
+}
+
+/*********************************************************************//**
Scans a table create SQL string and adds to the data dictionary
the foreign key constraints declared in the string. This function
should be called after the indexes for a table have been created.
@@ -2350,7 +2451,7 @@ row_discard_tablespace_for_mysql(
trx_t* trx) /*!< in: transaction handle */
{
dict_foreign_t* foreign;
- dulint new_id;
+ table_id_t new_id;
dict_table_t* table;
ibool success;
ulint err;
@@ -2385,8 +2486,6 @@ row_discard_tablespace_for_mysql(
table->n_foreign_key_checks_running > 0, we do not allow the
discard. We also reserve the data dictionary latch. */
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
-
trx->op_info = "discarding tablespace";
trx_start_if_not_started(trx);
@@ -2472,7 +2571,7 @@ row_discard_tablespace_for_mysql(
info = pars_info_create();
pars_info_add_str_literal(info, "table_name", name);
- pars_info_add_dulint_literal(info, "new_id", new_id);
+ pars_info_add_ull_literal(info, "new_id", new_id);
err = que_eval_sql(info,
"PROCEDURE DISCARD_TABLESPACE_PROC () IS\n"
@@ -2545,14 +2644,17 @@ row_import_tablespace_for_mysql(
ib_uint64_t current_lsn;
ulint err = DB_SUCCESS;
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
-
trx_start_if_not_started(trx);
trx->op_info = "importing tablespace";
current_lsn = log_get_lsn();
+ /* Enlarge the fatal lock wait timeout during import. */
+ mutex_enter(&kernel_mutex);
+ srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
+ mutex_exit(&kernel_mutex);
+
/* It is possible, though very improbable, that the lsn's in the
tablespace to be imported have risen above the current system lsn, if
a lengthy purge, ibuf merge, or rollback was performed on a backup
@@ -2664,6 +2766,11 @@ funct_exit:
trx->op_info = "";
+ /* Restore the fatal semaphore wait timeout */
+ mutex_enter(&kernel_mutex);
+ srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
+ mutex_exit(&kernel_mutex);
+
return((int) err);
}
@@ -2686,7 +2793,7 @@ row_truncate_table_for_mysql(
dict_index_t* sys_index;
btr_pcur_t pcur;
mtr_t mtr;
- dulint new_id;
+ table_id_t new_id;
ulint recreate_space = 0;
pars_info_t* info = NULL;
@@ -2730,7 +2837,6 @@ row_truncate_table_for_mysql(
redo log records on the truncated tablespace, we will assign
a new tablespace identifier to the truncated tablespace. */
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_ad(table);
if (srv_created_new_raw) {
@@ -2816,15 +2922,6 @@ row_truncate_table_for_mysql(
trx->table_id = table->id;
- /* Lock all index trees for this table, as we will
- truncate the table/index and possibly change their metadata.
- All DML/DDL are blocked by table level lock, with
- a few exceptions such as queries into information schema
- about the table, MySQL could try to access index stats
- for this kind of query, we need to use index locks to
- sync up */
- dict_table_x_lock_indexes(table);
-
if (table->space && !table->dir_path_of_temp_table) {
/* Discard and create the single-table tablespace. */
ulint space = table->space;
@@ -2837,6 +2934,11 @@ row_truncate_table_for_mysql(
dict_hdr_get_new_id(NULL, NULL, &space);
+ /* Lock all index trees for this table. We must
+ do so after dict_hdr_get_new_id() to preserve
+ the latch order */
+ dict_table_x_lock_indexes(table);
+
if (space == ULINT_UNDEFINED
|| fil_create_new_single_table_tablespace(
space, table->name, FALSE, flags,
@@ -2870,6 +2972,15 @@ row_truncate_table_for_mysql(
FIL_IBD_FILE_INITIAL_SIZE, &mtr);
mtr_commit(&mtr);
}
+ } else {
+ /* Lock all index trees for this table, as we will
+ truncate the table/index and possibly change their metadata.
+ All DML/DDL are blocked by table level lock, with
+ a few exceptions such as queries into information schema
+ about the table, MySQL could try to access index stats
+ for this kind of query, we need to use index locks to
+ sync up */
+ dict_table_x_lock_indexes(table);
}
/* scan SYS_INDEXES for all indexes of the table */
@@ -2922,7 +3033,7 @@ row_truncate_table_for_mysql(
rec = btr_pcur_get_rec(&pcur);
if (root_page_no != FIL_NULL) {
- page_rec_write_index_page_no(
+ page_rec_write_field(
rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
root_page_no, &mtr);
/* We will need to commit and restart the
@@ -2954,8 +3065,8 @@ next_rec:
info = pars_info_create();
pars_info_add_int4_literal(info, "space", (lint) table->space);
- pars_info_add_dulint_literal(info, "old_id", table->id);
- pars_info_add_dulint_literal(info, "new_id", new_id);
+ pars_info_add_ull_literal(info, "old_id", table->id);
+ pars_info_add_ull_literal(info, "new_id", new_id);
err = que_eval_sql(info,
"PROCEDURE RENUMBER_TABLESPACE_PROC () IS\n"
@@ -2988,12 +3099,12 @@ next_rec:
dict_table_change_id_in_cache(table, new_id);
}
- /* MySQL calls ha_innobase::reset_auto_increment() which does
- the same thing. */
+ /* Reset auto-increment. */
dict_table_autoinc_lock(table);
dict_table_autoinc_initialize(table, 1);
dict_table_autoinc_unlock(table);
- dict_update_statistics(table, TRUE);
+ dict_update_statistics(table, FALSE /* update even if stats are
+ initialized */, TRUE);
trx_commit_for_mysql(trx);
@@ -3101,7 +3212,7 @@ row_drop_table_for_mysql(
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
- table = dict_table_get_low(name);
+ table = dict_table_get_low_ignore_err(name, DICT_ERR_IGNORE_INDEX_ROOT);
if (!table) {
err = DB_TABLE_NOT_FOUND;
@@ -3134,7 +3245,7 @@ check_next_foreign:
if (foreign && trx->check_foreigns
&& !(drop_db && dict_tables_have_same_db(
- name, foreign->foreign_table_name))) {
+ name, foreign->foreign_table_name_lookup))) {
FILE* ef = dict_foreign_err_file;
/* We only allow dropping a referenced table if
@@ -3338,7 +3449,7 @@ check_next_foreign:
dict_table_remove_from_cache(table);
- if (dict_load_table(name) != NULL) {
+ if (dict_load_table(name, TRUE, DICT_ERR_IGNORE_NONE) != NULL) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: not able to remove table ",
stderr);
@@ -3484,7 +3595,7 @@ row_mysql_drop_temp_tables(void)
btr_pcur_store_position(&pcur, &mtr);
btr_pcur_commit_specify_mtr(&pcur, &mtr);
- table = dict_load_table(table_name);
+ table = dict_load_table(table_name, TRUE, DICT_ERR_IGNORE_NONE);
if (table) {
row_drop_table_for_mysql(table_name, trx, FALSE);
@@ -3578,7 +3689,6 @@ row_drop_database_for_mysql(
int err = DB_SUCCESS;
ulint namelen = strlen(name);
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_a(name != NULL);
ut_a(name[namelen - 1] == '/');
@@ -3748,7 +3858,6 @@ row_rename_table_for_mysql(
ibool old_is_tmp, new_is_tmp;
pars_info_t* info = NULL;
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_a(old_name != NULL);
ut_a(new_name != NULL);
diff --git a/storage/xtradb/row/row0purge.c b/storage/xtradb/row/row0purge.c
index 835af990672..83e7c9e4857 100644
--- a/storage/xtradb/row/row0purge.c
+++ b/storage/xtradb/row/row0purge.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2010, Innobase Oy. 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
@@ -151,10 +151,9 @@ row_purge_remove_clust_if_poss_low(
rec = btr_pcur_get_rec(pcur);
- if (0 != ut_dulint_cmp(node->roll_ptr, row_get_rec_roll_ptr(
- rec, index, rec_get_offsets(
- rec, index, offsets_,
- ULINT_UNDEFINED, &heap)))) {
+ if (node->roll_ptr != row_get_rec_roll_ptr(
+ rec, index, rec_get_offsets(rec, index, offsets_,
+ ULINT_UNDEFINED, &heap))) {
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -226,33 +225,71 @@ retry:
}
/***********************************************************//**
-Removes a secondary index entry if possible.
+Determines if it is possible to remove a secondary index entry.
+Removal is possible if the secondary index entry does not refer to any
+not delete marked version of a clustered index record where DB_TRX_ID
+is newer than the purge view.
+
+NOTE: This function should only be called by the purge thread, only
+while holding a latch on the leaf page of the secondary index entry
+(or keeping the buffer pool watch on the page). It is possible that
+this function first returns TRUE and then FALSE, if a user transaction
+inserts a record that the secondary index entry would refer to.
+However, in that case, the user transaction would also re-insert the
+secondary index entry after purge has removed it and released the leaf
+page latch.
+@return TRUE if the secondary index record can be purged */
+UNIV_INTERN
+ibool
+row_purge_poss_sec(
+/*===============*/
+ purge_node_t* node, /*!< in/out: row purge node */
+ dict_index_t* index, /*!< in: secondary index */
+ const dtuple_t* entry) /*!< in: secondary index entry */
+{
+ ibool can_delete;
+ mtr_t mtr;
+
+ ut_ad(!dict_index_is_clust(index));
+ mtr_start(&mtr);
+
+ can_delete = !row_purge_reposition_pcur(BTR_SEARCH_LEAF, node, &mtr)
+ || !row_vers_old_has_index_entry(TRUE,
+ btr_pcur_get_rec(&node->pcur),
+ &mtr, index, entry);
+
+ btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
+
+ return(can_delete);
+}
+
+/***************************************************************
+Removes a secondary index entry if possible, by modifying the
+index tree. Does not try to buffer the delete.
@return TRUE if success or if not found */
static
ibool
-row_purge_remove_sec_if_poss_low(
-/*=============================*/
+row_purge_remove_sec_if_poss_tree(
+/*==============================*/
purge_node_t* node, /*!< in: row purge node */
dict_index_t* index, /*!< in: index */
- const dtuple_t* entry, /*!< in: index entry */
- ulint mode) /*!< in: latch mode BTR_MODIFY_LEAF or
- BTR_MODIFY_TREE */
+ const dtuple_t* entry) /*!< in: index entry */
{
- btr_pcur_t pcur;
- btr_cur_t* btr_cur;
- ibool success;
- ibool old_has = 0; /* remove warning */
- ibool found;
- ulint err;
- mtr_t mtr;
- mtr_t mtr_vers;
+ btr_pcur_t pcur;
+ btr_cur_t* btr_cur;
+ ibool success = TRUE;
+ ulint err;
+ mtr_t mtr;
+ enum row_search_result search_result;
log_free_check();
mtr_start(&mtr);
- found = row_search_index_entry(index, entry, mode, &pcur, &mtr);
+ search_result = row_search_index_entry(index, entry, BTR_MODIFY_TREE,
+ &pcur, &mtr);
- if (!found) {
+ switch (search_result) {
+ case ROW_NOT_FOUND:
/* Not found. This is a legitimate condition. In a
rollback, InnoDB will remove secondary recs that would
be purged anyway. Then the actual purge will not find
@@ -265,11 +302,15 @@ row_purge_remove_sec_if_poss_low(
/* fputs("PURGE:........sec entry not found\n", stderr); */
/* dtuple_print(stderr, entry); */
-
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
-
- return(TRUE);
+ goto func_exit;
+ case ROW_FOUND:
+ break;
+ case ROW_BUFFERED:
+ case ROW_NOT_DELETED_REF:
+ /* These are invalid outcomes, because the mode passed
+ to row_search_index_entry() did not include any of the
+ flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */
+ ut_error;
}
btr_cur = btr_pcur_get_btr_cur(&pcur);
@@ -278,38 +319,102 @@ row_purge_remove_sec_if_poss_low(
which cannot be purged yet, requires its existence. If some requires,
we should do nothing. */
- mtr_start(&mtr_vers);
-
- success = row_purge_reposition_pcur(BTR_SEARCH_LEAF, node, &mtr_vers);
+ if (row_purge_poss_sec(node, index, entry)) {
+ /* Remove the index record, which should have been
+ marked for deletion. */
+ ut_ad(REC_INFO_DELETED_FLAG
+ & rec_get_info_bits(btr_cur_get_rec(btr_cur),
+ dict_table_is_comp(index->table)));
- if (success) {
- old_has = row_vers_old_has_index_entry(
- TRUE, btr_pcur_get_rec(&(node->pcur)),
- &mtr_vers, index, entry);
- }
-
- btr_pcur_commit_specify_mtr(&(node->pcur), &mtr_vers);
-
- if (!success || !old_has) {
- /* Remove the index record */
-
- if (mode == BTR_MODIFY_LEAF) {
- success = btr_cur_optimistic_delete(btr_cur, &mtr);
- } else {
- ut_ad(mode == BTR_MODIFY_TREE);
- btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
- RB_NONE, &mtr);
- success = err == DB_SUCCESS;
- ut_a(success || err == DB_OUT_OF_FILE_SPACE);
+ btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
+ RB_NONE, &mtr);
+ switch (UNIV_EXPECT(err, DB_SUCCESS)) {
+ case DB_SUCCESS:
+ break;
+ case DB_OUT_OF_FILE_SPACE:
+ success = FALSE;
+ break;
+ default:
+ ut_error;
}
}
+func_exit:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
return(success);
}
+/***************************************************************
+Removes a secondary index entry without modifying the index tree,
+if possible.
+@return TRUE if success or if not found */
+static
+ibool
+row_purge_remove_sec_if_poss_leaf(
+/*==============================*/
+ purge_node_t* node, /*!< in: row purge node */
+ dict_index_t* index, /*!< in: index */
+ const dtuple_t* entry) /*!< in: index entry */
+{
+ mtr_t mtr;
+ btr_pcur_t pcur;
+ enum row_search_result search_result;
+
+ log_free_check();
+
+ mtr_start(&mtr);
+
+ /* Set the purge node for the call to row_purge_poss_sec(). */
+ pcur.btr_cur.purge_node = node;
+ /* Set the query thread, so that ibuf_insert_low() will be
+ able to invoke thd_get_trx(). */
+ pcur.btr_cur.thr = que_node_get_parent(node);
+
+ search_result = row_search_index_entry(
+ index, entry, BTR_MODIFY_LEAF | BTR_DELETE, &pcur, &mtr);
+
+ switch (search_result) {
+ ibool success;
+ case ROW_FOUND:
+ /* Before attempting to purge a record, check
+ if it is safe to do so. */
+ if (row_purge_poss_sec(node, index, entry)) {
+ btr_cur_t* btr_cur = btr_pcur_get_btr_cur(&pcur);
+
+ /* Only delete-marked records should be purged. */
+ ut_ad(REC_INFO_DELETED_FLAG
+ & rec_get_info_bits(
+ btr_cur_get_rec(btr_cur),
+ dict_table_is_comp(index->table)));
+
+ if (!btr_cur_optimistic_delete(btr_cur, &mtr)) {
+
+ /* The index entry could not be deleted. */
+ success = FALSE;
+ goto func_exit;
+ }
+ }
+ /* fall through (the index entry is still needed,
+ or the deletion succeeded) */
+ case ROW_NOT_DELETED_REF:
+ /* The index entry is still needed. */
+ case ROW_BUFFERED:
+ /* The deletion was buffered. */
+ case ROW_NOT_FOUND:
+ /* The index entry does not exist, nothing to do. */
+ success = TRUE;
+ func_exit:
+ btr_pcur_close(&pcur);
+ mtr_commit(&mtr);
+ return(success);
+ }
+
+ ut_error;
+ return(FALSE);
+}
+
/***********************************************************//**
Removes a secondary index entry if possible. */
UNIV_INLINE
@@ -325,15 +430,12 @@ row_purge_remove_sec_if_poss(
/* fputs("Purge: Removing secondary record\n", stderr); */
- success = row_purge_remove_sec_if_poss_low(node, index, entry,
- BTR_MODIFY_LEAF);
- if (success) {
+ if (row_purge_remove_sec_if_poss_leaf(node, index, entry)) {
return;
}
retry:
- success = row_purge_remove_sec_if_poss_low(node, index, entry,
- BTR_MODIFY_TREE);
+ success = row_purge_remove_sec_if_poss_tree(node, index, entry);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
and restart with more file space */
@@ -387,8 +489,11 @@ Purges an update of an existing record. Also purges an update of a delete
marked record if that record contained an externally stored field. */
static
void
-row_purge_upd_exist_or_extern(
-/*==========================*/
+row_purge_upd_exist_or_extern_func(
+/*===============================*/
+#ifdef UNIV_DEBUG
+ const que_thr_t*thr, /*!< in: query thread */
+#endif /* UNIV_DEBUG */
purge_node_t* node) /*!< in: row purge node */
{
mem_heap_t* heap;
@@ -413,8 +518,8 @@ row_purge_upd_exist_or_extern(
while (node->index != NULL) {
index = node->index;
- if (row_upd_changes_ord_field_binary(NULL, node->index,
- node->update)) {
+ if (row_upd_changes_ord_field_binary(node->index, node->update,
+ thr, NULL, NULL)) {
/* Build the older version of the index entry */
entry = row_build_index_entry(node->row, NULL,
index, heap);
@@ -496,6 +601,14 @@ skip_secondaries:
}
}
+#ifdef UNIV_DEBUG
+# define row_purge_upd_exist_or_extern(thr,node) \
+ row_purge_upd_exist_or_extern_func(thr,node)
+#else /* UNIV_DEBUG */
+# define row_purge_upd_exist_or_extern(thr,node) \
+ row_purge_upd_exist_or_extern_func(node)
+#endif /* UNIV_DEBUG */
+
/***********************************************************//**
Parses the row reference and other info in a modify undo log record.
@return TRUE if purge operation required: NOTE that then the CALLER
@@ -514,7 +627,7 @@ row_purge_parse_undo_rec(
byte* ptr;
trx_t* trx;
undo_no_t undo_no;
- dulint table_id;
+ table_id_t table_id;
trx_id_t trx_id;
roll_ptr_t roll_ptr;
ulint info_bits;
@@ -602,47 +715,32 @@ err_exit:
/***********************************************************//**
Fetches an undo log record and does the purge for the recorded operation.
If none left, or the current purge completed, returns the control to the
-parent node, which is always a query thread node.
-@return DB_SUCCESS if operation successfully completed, else error code */
-static
-ulint
+parent node, which is always a query thread node. */
+static __attribute__((nonnull))
+void
row_purge(
/*======*/
purge_node_t* node, /*!< in: row purge node */
que_thr_t* thr) /*!< in: query thread */
{
- roll_ptr_t roll_ptr;
- ibool purge_needed;
ibool updated_extern;
- trx_t* trx;
-
- ut_ad(node && thr);
- trx = thr_get_trx(thr);
+ ut_ad(node);
+ ut_ad(thr);
- node->undo_rec = trx_purge_fetch_next_rec(&roll_ptr,
- &(node->reservation),
+ node->undo_rec = trx_purge_fetch_next_rec(&node->roll_ptr,
+ &node->reservation,
node->heap);
if (!node->undo_rec) {
/* Purge completed for this query thread */
thr->run_node = que_node_get_parent(node);
- return(DB_SUCCESS);
- }
-
- node->roll_ptr = roll_ptr;
-
- if (node->undo_rec == &trx_purge_dummy_rec) {
- purge_needed = FALSE;
- } else {
- purge_needed = row_purge_parse_undo_rec(node, &updated_extern,
- thr);
- /* If purge_needed == TRUE, we must also remember to unfreeze
- data dictionary! */
+ return;
}
- if (purge_needed) {
+ if (node->undo_rec != &trx_purge_dummy_rec
+ && row_purge_parse_undo_rec(node, &updated_extern, thr)) {
node->found_clust = FALSE;
node->index = dict_table_get_next_index(
@@ -654,14 +752,14 @@ row_purge(
} else if (updated_extern
|| node->rec_type == TRX_UNDO_UPD_EXIST_REC) {
- row_purge_upd_exist_or_extern(node);
+ row_purge_upd_exist_or_extern(thr, node);
}
if (node->found_clust) {
btr_pcur_close(&(node->pcur));
}
- row_mysql_unfreeze_data_dictionary(trx);
+ row_mysql_unfreeze_data_dictionary(thr_get_trx(thr));
}
/* Do some cleanup */
@@ -669,8 +767,6 @@ row_purge(
mem_heap_empty(node->heap);
thr->run_node = node;
-
- return(DB_SUCCESS);
}
/***********************************************************//**
@@ -684,7 +780,6 @@ row_purge_step(
que_thr_t* thr) /*!< in: query thread */
{
purge_node_t* node;
- ulint err;
ut_ad(thr);
@@ -692,9 +787,7 @@ row_purge_step(
ut_ad(que_node_get_type(node) == QUE_NODE_PURGE);
- err = row_purge(node, thr);
-
- ut_ad(err == DB_SUCCESS);
+ row_purge(node, thr);
return(thr);
}
diff --git a/storage/xtradb/row/row0row.c b/storage/xtradb/row/row0row.c
index 8e806a14a98..2882af00f30 100644
--- a/storage/xtradb/row/row0row.c
+++ b/storage/xtradb/row/row0row.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Oracle and/or its affiliates. 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
@@ -47,35 +47,6 @@ Created 4/20/1996 Heikki Tuuri
#include "read0read.h"
#include "ut0mem.h"
-/*********************************************************************//**
-Gets the offset of trx id field, in bytes relative to the origin of
-a clustered index record.
-@return offset of DATA_TRX_ID */
-UNIV_INTERN
-ulint
-row_get_trx_id_offset(
-/*==================*/
- const rec_t* rec __attribute__((unused)),
- /*!< in: record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
-{
- ulint pos;
- ulint offset;
- ulint len;
-
- ut_ad(dict_index_is_clust(index));
- ut_ad(rec_offs_validate(rec, index, offsets));
-
- pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
-
- offset = rec_get_nth_field_offs(offsets, pos, &len);
-
- ut_ad(len == DATA_TRX_ID_LEN);
-
- return(offset);
-}
-
/*****************************************************************//**
When an insert or purge to a table is performed, this function builds
the entry to be inserted into or purged from an index on the table.
@@ -151,12 +122,10 @@ row_build_index_entry(
} else if (dfield_is_ext(dfield)) {
ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
len -= BTR_EXTERN_FIELD_REF_SIZE;
- ut_a(ind_field->prefix_len <= len
- || dict_index_is_clust(index));
}
len = dtype_get_at_most_n_mbchars(
- col->prtype, col->mbminlen, col->mbmaxlen,
+ col->prtype, col->mbminmaxlen,
ind_field->prefix_len, len, dfield_get_data(dfield));
dfield_set_len(dfield, len);
}
@@ -231,6 +200,14 @@ row_build(
ut_ad(rec_offs_validate(rec, index, offsets));
}
+#if 0 && defined UNIV_BLOB_NULL_DEBUG
+ /* This one can fail in trx_rollback_active() if
+ the server crashed during an insert before the
+ btr_store_big_rec_extern_fields() did mtr_commit()
+ all BLOB pointers to the clustered index record. */
+ ut_a(!rec_offs_any_null_extern(rec, offsets));
+#endif /* 0 && UNIV_BLOB_NULL_DEBUG */
+
if (type != ROW_COPY_POINTERS) {
/* Take a copy of rec to heap */
buf = mem_heap_alloc(heap, rec_offs_size(offsets));
@@ -301,8 +278,7 @@ row_build(
ut_ad(dict_table_get_format(index->table)
< DICT_TF_FORMAT_ZIP);
} else if (j) {
- *ext = row_ext_create(j, ext_cols, row,
- dict_table_zip_size(index->table),
+ *ext = row_ext_create(j, ext_cols, index->table->flags, row,
heap);
} else {
*ext = NULL;
@@ -347,6 +323,14 @@ row_rec_to_index_entry_low(
rec_len = rec_offs_n_fields(offsets);
+ if (srv_use_sys_stats_table
+ && index == UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes)) {
+ if (rec_len < dict_index_get_n_fields(index)) {
+ /* the new record should be extended */
+ rec_len = dict_index_get_n_fields(index);
+ }
+ }
+
entry = dtuple_create(heap, rec_len);
dtuple_set_n_fields_cmp(entry,
@@ -358,6 +342,14 @@ row_rec_to_index_entry_low(
for (i = 0; i < rec_len; i++) {
dfield = dtuple_get_nth_field(entry, i);
+
+ if (srv_use_sys_stats_table
+ && index == UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes)
+ && i >= rec_offs_n_fields(offsets)) {
+ dfield_set_null(dfield);
+ continue;
+ }
+
field = rec_get_nth_field(rec, offsets, i, &len);
dfield_set_data(dfield, field, len);
@@ -415,6 +407,10 @@ row_rec_to_index_entry(
rec = rec_copy(buf, rec, offsets);
/* Avoid a debug assertion in rec_offs_validate(). */
rec_offs_make_valid(rec, index, offsets);
+#ifdef UNIV_BLOB_NULL_DEBUG
+ } else {
+ ut_a(!rec_offs_any_null_extern(rec, offsets));
+#endif /* UNIV_BLOB_NULL_DEBUG */
}
entry = row_rec_to_index_entry_low(rec, index, offsets, n_ext, heap);
@@ -520,8 +516,7 @@ row_build_row_ref(
dfield_set_len(dfield,
dtype_get_at_most_n_mbchars(
dtype->prtype,
- dtype->mbminlen,
- dtype->mbmaxlen,
+ dtype->mbminmaxlen,
clust_col_prefix_len,
len, (char*) field));
}
@@ -635,8 +630,7 @@ notfound:
dfield_set_len(dfield,
dtype_get_at_most_n_mbchars(
dtype->prtype,
- dtype->mbminlen,
- dtype->mbmaxlen,
+ dtype->mbminmaxlen,
clust_col_prefix_len,
len, (char*) field));
}
@@ -736,9 +730,9 @@ row_get_clust_rec(
/***************************************************************//**
Searches an index record.
-@return TRUE if found */
+@return whether the record was found or buffered */
UNIV_INTERN
-ibool
+enum row_search_result
row_search_index_entry(
/*===================*/
dict_index_t* index, /*!< in: index */
@@ -755,13 +749,38 @@ row_search_index_entry(
ut_ad(dtuple_check_typed(entry));
btr_pcur_open(index, entry, PAGE_CUR_LE, mode, pcur, mtr);
+
+ switch (btr_pcur_get_btr_cur(pcur)->flag) {
+ case BTR_CUR_DELETE_REF:
+ ut_a(mode & BTR_DELETE);
+ return(ROW_NOT_DELETED_REF);
+
+ case BTR_CUR_DEL_MARK_IBUF:
+ case BTR_CUR_DELETE_IBUF:
+ case BTR_CUR_INSERT_TO_IBUF:
+ return(ROW_BUFFERED);
+
+ case BTR_CUR_HASH:
+ case BTR_CUR_HASH_FAIL:
+ case BTR_CUR_BINARY:
+ break;
+ }
+
low_match = btr_pcur_get_low_match(pcur);
rec = btr_pcur_get_rec(pcur);
n_fields = dtuple_get_n_fields(entry);
- return(!page_rec_is_infimum(rec) && low_match == n_fields);
+ if (page_rec_is_infimum(rec)) {
+
+ return(ROW_NOT_FOUND);
+ } else if (low_match != n_fields) {
+
+ return(ROW_NOT_FOUND);
+ }
+
+ return(ROW_FOUND);
}
#include <my_sys.h>
diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c
index 2839d935167..fe8f33b7b4d 100644
--- a/storage/xtradb/row/row0sel.c
+++ b/storage/xtradb/row/row0sel.c
@@ -88,10 +88,8 @@ row_sel_sec_rec_is_for_blob(
/*========================*/
ulint mtype, /*!< in: main type */
ulint prtype, /*!< in: precise type */
- ulint mbminlen, /*!< in: minimum length of a
- multi-byte character */
- ulint mbmaxlen, /*!< in: maximum length of a
- multi-byte character */
+ ulint mbminmaxlen, /*!< in: minimum and maximum length of
+ a multi-byte character */
const byte* clust_field, /*!< in: the locally stored part of
the clustered index column, including
the BLOB pointer; the clustered
@@ -101,12 +99,26 @@ row_sel_sec_rec_is_for_blob(
ulint clust_len, /*!< in: length of clust_field */
const byte* sec_field, /*!< in: column in secondary index */
ulint sec_len, /*!< in: length of sec_field */
- ulint zip_size) /*!< in: compressed page size, or 0 */
+ dict_table_t* table) /*!< in: table */
{
ulint len;
- byte buf[DICT_MAX_INDEX_COL_LEN];
+ byte buf[REC_VERSION_56_MAX_INDEX_COL_LEN];
+ ulint zip_size = dict_table_flags_to_zip_size(table->flags);
+ ulint max_prefix_len = DICT_MAX_FIELD_LEN_BY_FORMAT(table);
+
+ ut_a(clust_len >= BTR_EXTERN_FIELD_REF_SIZE);
+
+ if (UNIV_UNLIKELY
+ (!memcmp(clust_field + clust_len - BTR_EXTERN_FIELD_REF_SIZE,
+ field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE))) {
+ /* The externally stored field was not written yet.
+ This record should only be seen by
+ recv_recovery_rollback_active() or any
+ TRX_ISO_READ_UNCOMMITTED transactions. */
+ return(FALSE);
+ }
- len = btr_copy_externally_stored_field_prefix(buf, sizeof buf,
+ len = btr_copy_externally_stored_field_prefix(buf, max_prefix_len,
zip_size,
clust_field, clust_len);
@@ -119,7 +131,7 @@ row_sel_sec_rec_is_for_blob(
return(FALSE);
}
- len = dtype_get_at_most_n_mbchars(prtype, mbminlen, mbmaxlen,
+ len = dtype_get_at_most_n_mbchars(prtype, mbminmaxlen,
sec_len, len, (const char*) buf);
return(!cmp_data_data(mtype, prtype, buf, len, sec_field, sec_len));
@@ -202,18 +214,17 @@ row_sel_sec_rec_is_for_clust_rec(
}
len = dtype_get_at_most_n_mbchars(
- col->prtype, col->mbminlen, col->mbmaxlen,
+ col->prtype, col->mbminmaxlen,
ifield->prefix_len, len, (char*) clust_field);
if (rec_offs_nth_extern(clust_offs, clust_pos)
&& len < sec_len) {
if (!row_sel_sec_rec_is_for_blob(
col->mtype, col->prtype,
- col->mbminlen, col->mbmaxlen,
+ col->mbminmaxlen,
clust_field, clust_len,
sec_field, sec_len,
- dict_table_zip_size(
- clust_index->table))) {
+ clust_index->table)) {
goto inequal;
}
@@ -1200,7 +1211,7 @@ row_sel_try_search_shortcut(
ut_ad(plan->unique_search);
ut_ad(!plan->must_get_clust);
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
+ ut_ad(rw_lock_own(btr_search_get_latch(index->id), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
row_sel_open_pcur(plan, TRUE, mtr);
@@ -1371,10 +1382,10 @@ table_loop:
&& !plan->must_get_clust
&& !plan->table->big_rows) {
if (!search_latch_locked) {
- rw_lock_s_lock(&btr_search_latch);
+ rw_lock_s_lock(btr_search_get_latch(index->id));
search_latch_locked = TRUE;
- } else if (rw_lock_get_writer(&btr_search_latch) == RW_LOCK_WAIT_EX) {
+ } else if (rw_lock_get_writer(btr_search_get_latch(index->id)) == RW_LOCK_WAIT_EX) {
/* There is an x-latch request waiting: release the
s-latch for a moment; as an s-latch here is often
@@ -1383,8 +1394,8 @@ table_loop:
from acquiring an s-latch for a long time, lowering
performance significantly in multiprocessors. */
- rw_lock_s_unlock(&btr_search_latch);
- rw_lock_s_lock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
+ rw_lock_s_lock(btr_search_get_latch(index->id));
}
found_flag = row_sel_try_search_shortcut(node, plan, &mtr);
@@ -1407,7 +1418,7 @@ table_loop:
}
if (search_latch_locked) {
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
search_latch_locked = FALSE;
}
@@ -1941,7 +1952,7 @@ stop_for_a_while:
mtr_commit(&mtr);
#ifdef UNIV_SYNC_DEBUG
- ut_ad(sync_thread_levels_empty_gen(TRUE));
+ ut_ad(sync_thread_levels_empty_except_dict());
#endif /* UNIV_SYNC_DEBUG */
err = DB_SUCCESS;
goto func_exit;
@@ -1961,7 +1972,7 @@ commit_mtr_for_a_while:
mtr_has_extra_clust_latch = FALSE;
#ifdef UNIV_SYNC_DEBUG
- ut_ad(sync_thread_levels_empty_gen(TRUE));
+ ut_ad(sync_thread_levels_empty_except_dict());
#endif /* UNIV_SYNC_DEBUG */
goto table_loop;
@@ -1978,12 +1989,12 @@ lock_wait_or_error:
mtr_commit(&mtr);
#ifdef UNIV_SYNC_DEBUG
- ut_ad(sync_thread_levels_empty_gen(TRUE));
+ ut_ad(sync_thread_levels_empty_except_dict());
#endif /* UNIV_SYNC_DEBUG */
func_exit:
if (search_latch_locked) {
- rw_lock_s_unlock(&btr_search_latch);
+ rw_lock_s_unlock(btr_search_get_latch(index->id));
}
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -2527,13 +2538,13 @@ row_sel_field_store_in_mysql_format(
ulint len) /*!< in: length of the data */
{
byte* ptr;
- byte* field_end;
- byte* pad_ptr;
ut_ad(len != UNIV_SQL_NULL);
UNIV_MEM_ASSERT_RW(data, len);
switch (templ->type) {
+ const byte* field_end;
+ byte* pad;
case DATA_INT:
/* Convert integer data from Innobase to a little-endian
format, sign bit restored to normal */
@@ -2577,38 +2588,32 @@ row_sel_field_store_in_mysql_format(
unused end of a >= 5.0.3 true VARCHAR column, just in case
MySQL expects its contents to be deterministic. */
- pad_ptr = dest + len;
+ pad = dest + len;
ut_ad(templ->mbminlen <= templ->mbmaxlen);
- /* We handle UCS2 charset strings differently. */
- if (templ->mbminlen == 2) {
- /* A space char is two bytes, 0x0020 in UCS2 */
+ /* We treat some Unicode charset strings specially. */
+ switch (templ->mbminlen) {
+ case 4:
+ /* InnoDB should never have stripped partial
+ UTF-32 characters. */
+ ut_a(!(len & 3));
+ break;
+ case 2:
+ /* A space char is two bytes,
+ 0x0020 in UCS2 and UTF-16 */
- if (len & 1) {
+ if (UNIV_UNLIKELY(len & 1)) {
/* A 0x20 has been stripped from the column.
Pad it back. */
- if (pad_ptr < field_end) {
- *pad_ptr = 0x20;
- pad_ptr++;
+ if (pad < field_end) {
+ *pad++ = 0x20;
}
}
-
- /* Pad the rest of the string with 0x0020 */
-
- while (pad_ptr < field_end) {
- *pad_ptr = 0x00;
- pad_ptr++;
- *pad_ptr = 0x20;
- pad_ptr++;
- }
- } else {
- ut_ad(templ->mbminlen == 1);
- /* space=0x20 */
-
- memset(pad_ptr, 0x20, field_end - pad_ptr);
}
+
+ row_mysql_pad_col(templ->mbminlen, pad, field_end - pad);
break;
case DATA_BLOB:
@@ -2633,9 +2638,9 @@ row_sel_field_store_in_mysql_format(
|| !(templ->mysql_col_len % templ->mbmaxlen));
ut_ad(len * templ->mbmaxlen >= templ->mysql_col_len);
- if (templ->mbminlen != templ->mbmaxlen) {
+ if (templ->mbminlen == 1 && templ->mbmaxlen != 1) {
/* Pad with spaces. This undoes the stripping
- done in row0mysql.ic, function
+ done in row0mysql.c, function
row_mysql_store_col_in_innobase_format(). */
memset(dest + len, 0x20, templ->mysql_col_len - len);
@@ -2675,45 +2680,41 @@ row_sel_store_mysql_rec(
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct */
const rec_t* rec, /*!< in: Innobase record in the index
which was described in prebuilt's
- template; must be protected by
- a page latch */
- const ulint* offsets, /* in: array returned by
- rec_get_offsets() */
+ template, or in the clustered index;
+ must be protected by a page latch */
+ ibool rec_clust, /*!< in: TRUE if rec is in the
+ clustered index instead of
+ prebuilt->index */
+ const ulint* offsets, /*!< in: array returned by
+ rec_get_offsets(rec) */
ulint start_field_no, /* in: start from this field */
ulint end_field_no) /* in: end at this field */
{
- mysql_row_templ_t* templ;
- mem_heap_t* extern_field_heap = NULL;
- mem_heap_t* heap;
- const byte* data;
- ulint len;
- ulint i;
+ mem_heap_t* extern_field_heap = NULL;
+ mem_heap_t* heap;
+ ulint i;
ut_ad(prebuilt->mysql_template);
ut_ad(prebuilt->default_rec);
ut_ad(rec_offs_validate(rec, NULL, offsets));
+ ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) {
mem_heap_free(prebuilt->blob_heap);
prebuilt->blob_heap = NULL;
}
-// psergey@askmonty.org: don't take the following:
-#if 0
- /* init null bytes with default values as they might be
-
- left uninitialized in some cases and these uninited bytes
- might be copied into mysql record buffer that leads to
- valgrind warnings */
- memcpy(mysql_rec, prebuilt->default_rec, prebuilt->null_bitmap_len);
-#endif
-
for (i = start_field_no; i < end_field_no /* prebuilt->n_template */ ; i++) {
- templ = prebuilt->mysql_template + i;
+ const mysql_row_templ_t*templ = prebuilt->mysql_template + i;
+ const byte* data;
+ ulint len;
+ ulint field_no;
- if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets,
- templ->rec_field_no))) {
+ field_no = rec_clust
+ ? templ->clust_rec_field_no : templ->rec_field_no;
+
+ if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets, field_no))) {
/* Copy an externally stored field to the temporary
heap */
@@ -2741,7 +2742,7 @@ row_sel_store_mysql_rec(
data = btr_rec_copy_externally_stored_field(
rec, offsets,
dict_table_zip_size(prebuilt->table),
- templ->rec_field_no, &len, heap);
+ field_no, &len, heap);
if (UNIV_UNLIKELY(!data)) {
/* The externally stored field
@@ -2762,8 +2763,7 @@ row_sel_store_mysql_rec(
} else {
/* Field is stored in the row. */
- data = rec_get_nth_field(rec, offsets,
- templ->rec_field_no, &len);
+ data = rec_get_nth_field(rec, offsets, field_no, &len);
if (UNIV_UNLIKELY(templ->type == DATA_BLOB)
&& len != UNIV_SQL_NULL) {
@@ -3125,7 +3125,7 @@ row_sel_pop_cached_row_for_mysql(
row_prebuilt_t* prebuilt) /*!< in: prebuilt struct */
{
ulint i;
- mysql_row_templ_t* templ;
+ const mysql_row_templ_t*templ;
byte* cached_rec;
ut_ad(prebuilt->n_fetch_cached > 0);
ut_ad(prebuilt->mysql_prefix_len <= prebuilt->mysql_row_len);
@@ -3186,9 +3186,14 @@ ibool
row_sel_push_cache_row_for_mysql(
/*=============================*/
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct */
- const rec_t* rec, /*!< in: record to push; must
- be protected by a page latch */
- const ulint* offsets, /* in: rec_get_offsets() */
+ const rec_t* rec, /*!< in: record to push, in the index
+ which was described in prebuilt's
+ template, or in the clustered index;
+ must be protected by a page latch */
+ ibool rec_clust, /*!< in: TRUE if rec is in the
+ clustered index instead of
+ prebuilt->index */
+ const ulint* offsets, /*!< in: rec_get_offsets(rec) */
ulint start_field_no, /* in: start from this field */
byte* remainder_buf) /* in: if start_field_no !=0,
where to take prev fields */
@@ -3198,6 +3203,7 @@ row_sel_push_cache_row_for_mysql(
ut_ad(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE);
ut_ad(rec_offs_validate(rec, NULL, offsets));
+ ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
ut_a(!prebuilt->templ_contains_blob);
if (prebuilt->fetch_cache[0] == NULL) {
@@ -3227,7 +3233,7 @@ row_sel_push_cache_row_for_mysql(
prebuilt->fetch_cache[
prebuilt->n_fetch_cached],
prebuilt,
- rec,
+ rec, rec_clust,
offsets,
start_field_no,
prebuilt->n_template))) {
@@ -3391,6 +3397,8 @@ row_search_for_mysql(
/* if the returned record was locked and we did a semi-consistent
read (fetch the newest committed version), then this is set to
TRUE */
+ ulint i;
+ ulint should_release;
#ifdef UNIV_SEARCH_DEBUG
ulint cnt = 0;
#endif /* UNIV_SEARCH_DEBUG */
@@ -3401,13 +3409,13 @@ row_search_for_mysql(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
ibool some_fields_in_buffer;
- ibool problematic_use = FALSE;
+ ibool table_lock_waited = FALSE;
+ ibool problematic_use = FALSE;
ibool get_clust_rec = 0;
rec_offs_init(offsets_);
ut_ad(index && pcur && search_tuple);
- ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
if (UNIV_UNLIKELY(prebuilt->table->ibd_file_missing)) {
ut_print_timestamp(stderr);
@@ -3424,11 +3432,17 @@ row_search_for_mysql(
"InnoDB: how you can resolve the problem.\n",
prebuilt->table->name);
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
return(DB_ERROR);
}
if (UNIV_UNLIKELY(!prebuilt->index_usable)) {
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
return(DB_MISSING_HISTORY);
}
@@ -3477,18 +3491,33 @@ row_search_for_mysql(
/* PHASE 0: Release a possible s-latch we are holding on the
adaptive hash index latch if there is someone waiting behind */
- if (UNIV_UNLIKELY(rw_lock_get_writer(&btr_search_latch) != RW_LOCK_NOT_LOCKED)
- && trx->has_search_latch) {
+ should_release = 0;
+ for (i = 0; i < btr_search_index_num; i++) {
+ /* we should check all latches (fix Bug#791030) */
+ if (rw_lock_get_writer(btr_search_latch_part[i])
+ != RW_LOCK_NOT_LOCKED) {
+ should_release |= ((ulint)1 << i);
+ }
+ }
+
+ if (should_release) {
/* There is an x-latch request on the adaptive hash index:
release the s-latch to reduce starvation and wait for
BTR_SEA_TIMEOUT rounds before trying to keep it again over
calls from MySQL */
- rw_lock_s_unlock(&btr_search_latch);
- trx->has_search_latch = FALSE;
+ for (i = 0; i < btr_search_index_num; i++) {
+ /* we should release all s-latches (fix Bug#791030) */
+ if (trx->has_search_latch & ((ulint)1 << i)) {
+ rw_lock_s_unlock(btr_search_latch_part[i]);
+ trx->has_search_latch &= (~((ulint)1 << i));
+ }
+ }
+ if (!trx->has_search_latch) {
trx->search_latch_timeout = BTR_SEA_TIMEOUT;
+ }
}
/* Reset the new record lock info if srv_locks_unsafe_for_binlog
@@ -3639,9 +3668,28 @@ row_search_for_mysql(
hash index semaphore! */
#ifndef UNIV_SEARCH_DEBUG
- if (!trx->has_search_latch) {
- rw_lock_s_lock(&btr_search_latch);
- trx->has_search_latch = TRUE;
+ if (!(trx->has_search_latch
+ & ((ulint)1 << (index->id % btr_search_index_num)))) {
+ if (trx->has_search_latch
+ < ((ulint)1 << (index->id % btr_search_index_num))) {
+ rw_lock_s_lock(btr_search_get_latch(index->id));
+ trx->has_search_latch |=
+ ((ulint)1 << (index->id % btr_search_index_num));
+ } else {
+ /* should re-lock to obay latch-order */
+ for (i = 0; i < btr_search_index_num; i++) {
+ if (trx->has_search_latch & ((ulint)1 << i)) {
+ rw_lock_s_unlock(btr_search_latch_part[i]);
+ }
+ }
+ trx->has_search_latch |=
+ ((ulint)1 << (index->id % btr_search_index_num));
+ for (i = 0; i < btr_search_index_num; i++) {
+ if (trx->has_search_latch & ((ulint)1 << i)) {
+ rw_lock_s_lock(btr_search_latch_part[i]);
+ }
+ }
+ }
}
#endif
switch (row_sel_try_search_shortcut_for_mysql(
@@ -3660,7 +3708,7 @@ row_search_for_mysql(
ut_ad(!rec_get_deleted_flag(rec, comp));
if (!row_sel_store_mysql_rec(buf, prebuilt,
- rec, offsets, 0,
+ rec, FALSE, offsets, 0,
prebuilt->n_template)) {
/* Only fresh inserts may contain
incomplete externally stored
@@ -3702,7 +3750,11 @@ release_search_latch_if_needed:
trx->search_latch_timeout--;
- rw_lock_s_unlock(&btr_search_latch);
+ for (i = 0; i < btr_search_index_num; i++) {
+ if (trx->has_search_latch & ((ulint)1 << i)) {
+ rw_lock_s_unlock(btr_search_latch_part[i]);
+ }
+ }
trx->has_search_latch = FALSE;
}
@@ -3726,7 +3778,12 @@ release_search_latch_if_needed:
/* PHASE 3: Open or restore index cursor position */
if (trx->has_search_latch) {
- rw_lock_s_unlock(&btr_search_latch);
+
+ for (i = 0; i < btr_search_index_num; i++) {
+ if (trx->has_search_latch & ((ulint)1 << i)) {
+ rw_lock_s_unlock(btr_search_latch_part[i]);
+ }
+ }
trx->has_search_latch = FALSE;
}
@@ -3767,6 +3824,67 @@ release_search_latch_if_needed:
clust_index = dict_table_get_first_index(index->table);
+ /* Do some start-of-statement preparations */
+
+ if (!prebuilt->mysql_has_locked) {
+ if (!(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) {
+ fprintf(stderr, "InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock()\n");
+ if (trx->mysql_thd != NULL) {
+ innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
+ }
+ }
+ problematic_use = TRUE;
+ }
+retry_check:
+
+ if (!prebuilt->sql_stat_start) {
+ /* No need to set an intention lock or assign a read view */
+
+ if (trx->read_view == NULL
+ && prebuilt->select_lock_type == LOCK_NONE) {
+
+ fputs("InnoDB: Error: MySQL is trying to"
+ " perform a consistent read\n"
+ "InnoDB: but the read view is not assigned!\n",
+ stderr);
+ if (problematic_use) {
+ fprintf(stderr, "InnoDB: It may be caused by calling "
+ "without ha_innobase::external_lock()\n"
+ "InnoDB: For the first-aid, avoiding the crash. "
+ "But it should be fixed ASAP.\n");
+ if (prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT)
+ && trx->mysql_thd != NULL) {
+ innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
+ }
+ prebuilt->sql_stat_start = TRUE;
+ goto retry_check;
+ }
+ trx_print(stderr, trx, 600);
+ fputc('\n', stderr);
+ ut_error;
+ }
+ } else if (prebuilt->select_lock_type == LOCK_NONE) {
+ /* This is a consistent read */
+ /* Assign a read view for the query */
+
+ trx_assign_read_view(trx);
+ prebuilt->sql_stat_start = FALSE;
+ } else {
+wait_table_again:
+ err = lock_table(0, index->table,
+ prebuilt->select_lock_type == LOCK_S
+ ? LOCK_IS : LOCK_IX, thr);
+
+ if (err != DB_SUCCESS) {
+
+ table_lock_waited = TRUE;
+ goto lock_table_wait;
+ }
+ prebuilt->sql_stat_start = FALSE;
+ }
+
+ /* Open or restore index cursor position */
+
if (UNIV_LIKELY(direction != 0)) {
ibool need_to_process = sel_restore_position_for_mysql(
&same_user_rec, BTR_SEARCH_LEAF,
@@ -3842,59 +3960,6 @@ release_search_latch_if_needed:
}
}
- if (!prebuilt->mysql_has_locked) {
- fprintf(stderr, "InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock()\n");
- if (trx->mysql_thd != NULL) {
- innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
- }
- problematic_use = TRUE;
- }
-retry_check:
-
- if (!prebuilt->sql_stat_start) {
- /* No need to set an intention lock or assign a read view */
-
- if (trx->read_view == NULL
- && prebuilt->select_lock_type == LOCK_NONE) {
-
- fputs("InnoDB: Error: MySQL is trying to"
- " perform a consistent read\n"
- "InnoDB: but the read view is not assigned!\n",
- stderr);
- if (problematic_use) {
- fprintf(stderr, "InnoDB: It may be caused by calling "
- "without ha_innobase::external_lock()\n"
- "InnoDB: For the first-aid, avoiding the crash. "
- "But it should be fixed ASAP.\n");
- prebuilt->sql_stat_start = TRUE;
- goto retry_check;
- }
- trx_print(stderr, trx, 600);
- fputc('\n', stderr);
- ut_a(0);
- }
- } else if (prebuilt->select_lock_type == LOCK_NONE) {
- /* This is a consistent read */
- /* Assign a read view for the query */
-
- trx_assign_read_view(trx);
- prebuilt->sql_stat_start = FALSE;
- } else {
- ulint lock_mode;
- if (prebuilt->select_lock_type == LOCK_S) {
- lock_mode = LOCK_IS;
- } else {
- lock_mode = LOCK_IX;
- }
- err = lock_table(0, index->table, lock_mode, thr);
-
- if (err != DB_SUCCESS) {
-
- goto lock_wait_or_error;
- }
- prebuilt->sql_stat_start = FALSE;
- }
-
rec_loop:
/*-------------------------------------------------------------*/
/* PHASE 4: Look for matching records in a loop */
@@ -3984,7 +4049,13 @@ rec_loop:
if (UNIV_UNLIKELY(next_offs >= UNIV_PAGE_SIZE - PAGE_DIR)) {
wrong_offs:
- if (srv_force_recovery == 0 || moves_up == FALSE) {
+ if (srv_pass_corrupt_table && !trx_sys_sys_space(index->table->space)) {
+ index->table->is_corrupt = TRUE;
+ fil_space_set_corrupt(index->table->space);
+ }
+
+ if ((srv_force_recovery == 0 || moves_up == FALSE)
+ && srv_pass_corrupt_table <= 1) {
ut_print_timestamp(stderr);
buf_page_print(page_align(rec), 0);
fprintf(stderr,
@@ -4035,7 +4106,8 @@ wrong_offs:
offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
- if (UNIV_UNLIKELY(srv_force_recovery > 0)) {
+ if (UNIV_UNLIKELY(srv_force_recovery > 0)
+ || (srv_pass_corrupt_table == 2 && index->table->is_corrupt)) {
if (!rec_validate(rec, offsets)
|| !btr_index_rec_validate(rec, index, FALSE)) {
fprintf(stderr,
@@ -4317,7 +4389,6 @@ no_gap_lock:
is necessary, because we can only get the undo
information via the clustered index record. */
- ut_ad(index != clust_index);
ut_ad(!dict_index_is_clust(index));
if (!lock_sec_rec_cons_read_sees(
@@ -4372,10 +4443,18 @@ no_gap_lock:
idx_cond_check:
if (prebuilt->idx_cond_func) {
int res;
+ ibool ib_res;
ut_ad(prebuilt->template_type != ROW_MYSQL_DUMMY_TEMPLATE);
offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
- row_sel_store_mysql_rec(buf, prebuilt, rec,
+ ib_res= row_sel_store_mysql_rec(buf, prebuilt, rec, FALSE,
offsets, 0, prebuilt->n_index_fields);
+ /*
+ The above call will fail and return FALSE when requested to
+ store an "externally stored column" (afaiu, a blob). Index
+ Condition Pushdown is not supported for indexes with blob
+ columns, so we should never get this error.
+ */
+ ut_ad(ib_res);
res= prebuilt->idx_cond_func(prebuilt->idx_cond_func_arg);
if (res == 0)
goto next_rec;
@@ -4450,26 +4529,10 @@ idx_cond_check:
goto next_rec;
}
- if (prebuilt->need_to_access_clustered) {
-
- result_rec = clust_rec;
-
- ut_ad(rec_offs_validate(result_rec, clust_index,
- offsets));
- } else {
- /* We used 'offsets' for the clust rec, recalculate
- them for 'rec' */
- offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
- result_rec = rec;
- }
-
- /* result_rec can legitimately be delete-marked
- now that it has been established that it points to a
- clustered index record that exists in the read view. */
+ result_rec = clust_rec;
+ ut_ad(rec_offs_validate(result_rec, clust_index, offsets));
} else {
result_rec = rec;
- ut_ad(!rec_get_deleted_flag(rec, comp));
}
/* We found a qualifying record 'result_rec'. At this point,
@@ -4478,6 +4541,7 @@ idx_cond_check:
ut_ad(rec_offs_validate(result_rec,
result_rec != rec ? clust_index : index,
offsets));
+ ut_ad(!rec_get_deleted_flag(result_rec, comp));
/* At this point, the clustered index record is protected
by a page latch that was acquired when pcur was positioned.
@@ -4504,6 +4568,7 @@ idx_cond_check:
&& prebuilt->idx_cond_func);
if (!row_sel_push_cache_row_for_mysql(prebuilt, result_rec,
+ result_rec != rec,
offsets,
some_fields_in_buffer?
prebuilt->n_index_fields : 0,
@@ -4524,15 +4589,32 @@ idx_cond_check:
goto next_rec;
} else {
- if (prebuilt->template_type == ROW_MYSQL_DUMMY_TEMPLATE) {
+ if (UNIV_UNLIKELY
+ (prebuilt->template_type == ROW_MYSQL_DUMMY_TEMPLATE)) {
+ /* CHECK TABLE: fetch the row */
+
+ if (result_rec != rec
+ && !prebuilt->need_to_access_clustered) {
+ /* We used 'offsets' for the clust
+ rec, recalculate them for 'rec' */
+ offsets = rec_get_offsets(rec, index, offsets,
+ ULINT_UNDEFINED,
+ &heap);
+ result_rec = rec;
+ }
+
memcpy(buf + 4, result_rec
- rec_offs_extra_size(offsets),
rec_offs_size(offsets));
mach_write_to_4(buf,
rec_offs_extra_size(offsets) + 4);
} else {
+ /* Returning a row to MySQL */
+
if (!row_sel_store_mysql_rec(buf, prebuilt,
- result_rec, offsets,
+ result_rec,
+ result_rec != rec,
+ offsets,
prebuilt->idx_cond_func?
prebuilt->n_index_fields: 0,
prebuilt->n_template)) {
@@ -4658,6 +4740,7 @@ lock_wait_or_error:
btr_pcur_store_position(pcur, &mtr);
+lock_table_wait:
mtr_commit(&mtr);
mtr_has_extra_clust_latch = FALSE;
@@ -4675,6 +4758,14 @@ lock_wait_or_error:
thr->lock_state = QUE_THR_LOCK_NOLOCK;
mtr_start(&mtr);
+ /* Table lock waited, go try to obtain table lock
+ again */
+ if (table_lock_waited) {
+ table_lock_waited = FALSE;
+
+ goto wait_table_again;
+ }
+
sel_restore_position_for_mysql(&same_user_rec,
BTR_SEARCH_LEAF, pcur,
moves_up, &mtr);
@@ -4756,6 +4847,10 @@ func_exit:
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
}
}
+
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
return(err);
}
@@ -4793,8 +4888,7 @@ row_search_check_if_query_cache_permitted(
IX type locks actually would require ret = FALSE. */
if (UT_LIST_GET_LEN(table->locks) == 0
- && ut_dulint_cmp(trx->id,
- table->query_cache_inv_trx_id) >= 0) {
+ && trx->id >= table->query_cache_inv_trx_id) {
ret = TRUE;
diff --git a/storage/xtradb/row/row0uins.c b/storage/xtradb/row/row0uins.c
index 930a5cf13b6..d25afed3840 100644
--- a/storage/xtradb/row/row0uins.c
+++ b/storage/xtradb/row/row0uins.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2010, Innobase Oy. 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
@@ -78,7 +78,7 @@ row_undo_ins_remove_clust_rec(
&mtr);
ut_a(success);
- if (ut_dulint_cmp(node->table->id, DICT_INDEXES_ID) == 0) {
+ if (node->table->id == DICT_INDEXES_ID) {
ut_ad(node->trx->dict_operation_lock_mode == RW_X_LATCH);
/* Drop the index tree associated with the row in
@@ -155,36 +155,38 @@ row_undo_ins_remove_sec_low(
dict_index_t* index, /*!< in: index */
dtuple_t* entry) /*!< in: index entry to remove */
{
- btr_pcur_t pcur;
- btr_cur_t* btr_cur;
- ibool found;
- ibool success;
- ulint err;
- mtr_t mtr;
+ btr_pcur_t pcur;
+ btr_cur_t* btr_cur;
+ ulint err;
+ mtr_t mtr;
+ enum row_search_result search_result;
mtr_start(&mtr);
- found = row_search_index_entry(index, entry, mode, &pcur, &mtr);
-
btr_cur = btr_pcur_get_btr_cur(&pcur);
- if (!found) {
- /* Not found */
-
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
-
- return(DB_SUCCESS);
+ ut_ad(mode == BTR_MODIFY_TREE || mode == BTR_MODIFY_LEAF);
+
+ search_result = row_search_index_entry(index, entry, mode,
+ &pcur, &mtr);
+
+ switch (search_result) {
+ case ROW_NOT_FOUND:
+ err = DB_SUCCESS;
+ goto func_exit;
+ case ROW_FOUND:
+ break;
+ case ROW_BUFFERED:
+ case ROW_NOT_DELETED_REF:
+ /* These are invalid outcomes, because the mode passed
+ to row_search_index_entry() did not include any of the
+ flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */
+ ut_error;
}
if (mode == BTR_MODIFY_LEAF) {
- success = btr_cur_optimistic_delete(btr_cur, &mtr);
-
- if (success) {
- err = DB_SUCCESS;
- } else {
- err = DB_FAIL;
- }
+ err = btr_cur_optimistic_delete(btr_cur, &mtr)
+ ? DB_SUCCESS : DB_FAIL;
} else {
ut_ad(mode == BTR_MODIFY_TREE);
@@ -197,7 +199,7 @@ row_undo_ins_remove_sec_low(
btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
RB_NORMAL, &mtr);
}
-
+func_exit:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -258,7 +260,7 @@ row_undo_ins_parse_undo_rec(
dict_index_t* clust_index;
byte* ptr;
undo_no_t undo_no;
- dulint table_id;
+ table_id_t table_id;
ulint type;
ulint dummy;
ibool dummy_extern;
diff --git a/storage/xtradb/row/row0umod.c b/storage/xtradb/row/row0umod.c
index 8464b0f95cc..2188fdeff49 100644
--- a/storage/xtradb/row/row0umod.c
+++ b/storage/xtradb/row/row0umod.c
@@ -85,9 +85,9 @@ row_undo_mod_undo_also_prev_vers(
trx = node->trx;
- if (0 != ut_dulint_cmp(node->new_trx_id, trx->id)) {
+ if (node->new_trx_id != trx->id) {
- *undo_no = ut_dulint_zero;
+ *undo_no = 0;
return(FALSE);
}
@@ -95,7 +95,7 @@ row_undo_mod_undo_also_prev_vers(
*undo_no = trx_undo_rec_get_undo_no(undo_rec);
- return(ut_dulint_cmp(trx->roll_limit, *undo_no) <= 0);
+ return(trx->roll_limit <= *undo_no);
}
/***********************************************************//**
@@ -114,12 +114,17 @@ row_undo_mod_clust_low(
btr_pcur_t* pcur;
btr_cur_t* btr_cur;
ulint err;
+#ifdef UNIV_DEBUG
ibool success;
+#endif /* UNIV_DEBUG */
pcur = &(node->pcur);
btr_cur = btr_pcur_get_btr_cur(pcur);
- success = btr_pcur_restore_position(mode, pcur, mtr);
+#ifdef UNIV_DEBUG
+ success =
+#endif /* UNIV_DEBUG */
+ btr_pcur_restore_position(mode, pcur, mtr);
ut_ad(success);
@@ -168,40 +173,26 @@ row_undo_mod_remove_clust_low(
mtr_t* mtr, /*!< in: mtr */
ulint mode) /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */
{
- btr_pcur_t* pcur;
btr_cur_t* btr_cur;
ulint err;
- ibool success;
ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC);
- pcur = &(node->pcur);
- btr_cur = btr_pcur_get_btr_cur(pcur);
- success = btr_pcur_restore_position(mode, pcur, mtr);
+ /* Find out if the record has been purged already
+ or if we can remove it. */
- if (!success) {
+ if (!btr_pcur_restore_position(mode, &node->pcur, mtr)
+ || row_vers_must_preserve_del_marked(node->new_trx_id, mtr)) {
return(DB_SUCCESS);
}
- /* Find out if we can remove the whole clustered index record */
-
- if (node->rec_type == TRX_UNDO_UPD_DEL_REC
- && !row_vers_must_preserve_del_marked(node->new_trx_id, mtr)) {
-
- /* Ok, we can remove */
- } else {
- return(DB_SUCCESS);
- }
+ btr_cur = btr_pcur_get_btr_cur(&node->pcur);
if (mode == BTR_MODIFY_LEAF) {
- success = btr_cur_optimistic_delete(btr_cur, mtr);
-
- if (success) {
- err = DB_SUCCESS;
- } else {
- err = DB_FAIL;
- }
+ err = btr_cur_optimistic_delete(btr_cur, mtr)
+ ? DB_SUCCESS
+ : DB_FAIL;
} else {
ut_ad(mode == BTR_MODIFY_TREE);
@@ -326,23 +317,27 @@ row_undo_mod_del_mark_or_remove_sec_low(
ulint mode) /*!< in: latch mode BTR_MODIFY_LEAF or
BTR_MODIFY_TREE */
{
- ibool found;
- btr_pcur_t pcur;
- btr_cur_t* btr_cur;
- ibool success;
- ibool old_has;
- ulint err;
- mtr_t mtr;
- mtr_t mtr_vers;
+ btr_pcur_t pcur;
+ btr_cur_t* btr_cur;
+ ibool success;
+ ibool old_has;
+ ulint err;
+ mtr_t mtr;
+ mtr_t mtr_vers;
+ enum row_search_result search_result;
log_free_check();
mtr_start(&mtr);
- found = row_search_index_entry(index, entry, mode, &pcur, &mtr);
-
btr_cur = btr_pcur_get_btr_cur(&pcur);
- if (!found) {
+ ut_ad(mode == BTR_MODIFY_TREE || mode == BTR_MODIFY_LEAF);
+
+ search_result = row_search_index_entry(index, entry, mode,
+ &pcur, &mtr);
+
+ switch (UNIV_EXPECT(search_result, ROW_FOUND)) {
+ case ROW_NOT_FOUND:
/* In crash recovery, the secondary index record may
be missing if the UPDATE did not have time to insert
the secondary index records before the crash. When we
@@ -353,10 +348,16 @@ row_undo_mod_del_mark_or_remove_sec_low(
before it has inserted all updated secondary index
records, then the undo will not find those records. */
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
-
- return(DB_SUCCESS);
+ err = DB_SUCCESS;
+ goto func_exit;
+ case ROW_FOUND:
+ break;
+ case ROW_BUFFERED:
+ case ROW_NOT_DELETED_REF:
+ /* These are invalid outcomes, because the mode passed
+ to row_search_index_entry() did not include any of the
+ flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */
+ ut_error;
}
/* We should remove the index record if no prior version of the row,
@@ -406,6 +407,8 @@ row_undo_mod_del_mark_or_remove_sec_low(
}
btr_pcur_commit_specify_mtr(&(node->pcur), &mtr_vers);
+
+func_exit:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -460,13 +463,15 @@ row_undo_mod_del_unmark_sec_and_undo_update(
dict_index_t* index, /*!< in: index */
const dtuple_t* entry) /*!< in: index entry */
{
- mem_heap_t* heap;
- btr_pcur_t pcur;
- upd_t* update;
- ulint err = DB_SUCCESS;
- big_rec_t* dummy_big_rec;
- mtr_t mtr;
- trx_t* trx = thr_get_trx(thr);
+ mem_heap_t* heap;
+ btr_pcur_t pcur;
+ btr_cur_t* btr_cur;
+ upd_t* update;
+ ulint err = DB_SUCCESS;
+ big_rec_t* dummy_big_rec;
+ mtr_t mtr;
+ trx_t* trx = thr_get_trx(thr);
+ enum row_search_result search_result;
/* Ignore indexes that are being created. */
if (UNIV_UNLIKELY(*index->name == TEMP_INDEX_PREFIX)) {
@@ -477,8 +482,19 @@ row_undo_mod_del_unmark_sec_and_undo_update(
log_free_check();
mtr_start(&mtr);
- if (UNIV_UNLIKELY(!row_search_index_entry(index, entry,
- mode, &pcur, &mtr))) {
+ ut_ad(mode == BTR_MODIFY_TREE || mode == BTR_MODIFY_LEAF);
+
+ search_result = row_search_index_entry(index, entry, mode,
+ &pcur, &mtr);
+
+ switch (search_result) {
+ case ROW_BUFFERED:
+ case ROW_NOT_DELETED_REF:
+ /* These are invalid outcomes, because the mode passed
+ to row_search_index_entry() did not include any of the
+ flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */
+ ut_error;
+ case ROW_NOT_FOUND:
fputs("InnoDB: error in sec index entry del undo in\n"
"InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index);
@@ -493,9 +509,9 @@ row_undo_mod_del_unmark_sec_and_undo_update(
fputs("\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
- } else {
- btr_cur_t* btr_cur = btr_pcur_get_btr_cur(&pcur);
-
+ break;
+ case ROW_FOUND:
+ btr_cur = btr_pcur_get_btr_cur(&pcur);
err = btr_cur_del_mark_set_sec_rec(BTR_NO_LOCKING_FLAG,
btr_cur, FALSE, thr, &mtr);
ut_a(err == DB_SUCCESS);
@@ -663,19 +679,19 @@ row_undo_mod_upd_exist_sec(
while (node->index != NULL) {
index = node->index;
- if (row_upd_changes_ord_field_binary(node->row, node->index,
- node->update)) {
+ if (row_upd_changes_ord_field_binary(node->index, node->update,
+ thr,
+ node->row, node->ext)) {
/* Build the newest version of the index entry */
entry = row_build_index_entry(node->row, node->ext,
index, heap);
if (UNIV_UNLIKELY(!entry)) {
/* The server must have crashed in
- row_upd_clust_rec_by_insert(), in
- row_ins_index_entry_low() before
- btr_store_big_rec_extern_fields()
- has written the externally stored columns
- (BLOBs) of the new clustered index entry. */
+ row_upd_clust_rec_by_insert() before
+ the updated externally stored columns (BLOBs)
+ of the new clustered index entry were
+ written. */
/* The table must be in DYNAMIC or COMPRESSED
format. REDUNDANT and COMPACT formats
@@ -765,7 +781,7 @@ row_undo_mod_parse_undo_rec(
dict_index_t* clust_index;
byte* ptr;
undo_no_t undo_no;
- dulint table_id;
+ table_id_t table_id;
trx_id_t trx_id;
roll_ptr_t roll_ptr;
ulint info_bits;
diff --git a/storage/xtradb/row/row0undo.c b/storage/xtradb/row/row0undo.c
index fd28a4f6520..09970b7fe21 100644
--- a/storage/xtradb/row/row0undo.c
+++ b/storage/xtradb/row/row0undo.c
@@ -185,9 +185,8 @@ row_undo_search_clust_to_pcur(
offsets = rec_get_offsets(rec, clust_index, offsets,
ULINT_UNDEFINED, &heap);
- if (!found || 0 != ut_dulint_cmp(node->roll_ptr,
- row_get_rec_roll_ptr(rec, clust_index,
- offsets))) {
+ if (!found || node->roll_ptr
+ != row_get_rec_roll_ptr(rec, clust_index, offsets)) {
/* We must remove the reservation on the undo log record
BEFORE releasing the latch on the clustered index page: this
diff --git a/storage/xtradb/row/row0upd.c b/storage/xtradb/row/row0upd.c
index 04c3139fcc7..01fb44f42de 100644
--- a/storage/xtradb/row/row0upd.c
+++ b/storage/xtradb/row/row0upd.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. 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
@@ -238,7 +238,7 @@ row_upd_check_references_constraints(
foreign->n_fields))) {
if (foreign->foreign_table == NULL) {
- dict_table_get(foreign->foreign_table_name,
+ dict_table_get(foreign->foreign_table_name_lookup,
FALSE);
}
@@ -371,13 +371,13 @@ UNIV_INTERN
void
row_upd_index_entry_sys_field(
/*==========================*/
- const dtuple_t* entry, /*!< in: index entry, where the memory buffers
- for sys fields are already allocated:
+ dtuple_t* entry, /*!< in/out: index entry, where the memory
+ buffers for sys fields are already allocated:
the function just copies the new values to
them */
dict_index_t* index, /*!< in: clustered index */
ulint type, /*!< in: DATA_TRX_ID or DATA_ROLL_PTR */
- dulint val) /*!< in: value to write */
+ ib_uint64_t val) /*!< in: value to write */
{
dfield_t* dfield;
byte* field;
@@ -439,6 +439,12 @@ row_upd_changes_field_size_or_external(
0);
}
+ if (srv_use_sys_stats_table
+ && index == UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes)
+ && upd_field->field_no >= rec_offs_n_fields(offsets)) {
+ return(TRUE);
+ }
+
old_len = rec_offs_nth_size(offsets, upd_field->field_no);
if (rec_offs_comp(offsets)
@@ -466,8 +472,11 @@ row_upd_changes_field_size_or_external(
#endif /* !UNIV_HOTBACKUP */
/***********************************************************//**
-Replaces the new column values stored in the update vector to the record
-given. No field size changes are allowed. */
+Replaces the new column values stored in the update vector to the
+record given. No field size changes are allowed. This function is
+usually invoked on a clustered index. The only use case for a
+secondary index is row_ins_sec_index_entry_by_modify() or its
+counterpart in ibuf_insert_to_index_page(). */
UNIV_INTERN
void
row_upd_rec_in_place(
@@ -495,14 +504,49 @@ row_upd_rec_in_place(
n_fields = upd_get_n_fields(update);
for (i = 0; i < n_fields; i++) {
+#ifdef UNIV_BLOB_DEBUG
+ btr_blob_dbg_t b;
+ const byte* field_ref = NULL;
+#endif /* UNIV_BLOB_DEBUG */
+
upd_field = upd_get_nth_field(update, i);
new_val = &(upd_field->new_val);
ut_ad(!dfield_is_ext(new_val) ==
!rec_offs_nth_extern(offsets, upd_field->field_no));
+#ifdef UNIV_BLOB_DEBUG
+ if (dfield_is_ext(new_val)) {
+ ulint len;
+ field_ref = rec_get_nth_field(rec, offsets, i, &len);
+ ut_a(len != UNIV_SQL_NULL);
+ ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
+ field_ref += len - BTR_EXTERN_FIELD_REF_SIZE;
+
+ b.ref_page_no = page_get_page_no(page_align(rec));
+ b.ref_heap_no = page_rec_get_heap_no(rec);
+ b.ref_field_no = i;
+ b.blob_page_no = mach_read_from_4(
+ field_ref + BTR_EXTERN_PAGE_NO);
+ ut_a(b.ref_field_no >= index->n_uniq);
+ btr_blob_dbg_rbt_delete(index, &b, "upd_in_place");
+ }
+#endif /* UNIV_BLOB_DEBUG */
rec_set_nth_field(rec, offsets, upd_field->field_no,
dfield_get_data(new_val),
dfield_get_len(new_val));
+
+#ifdef UNIV_BLOB_DEBUG
+ if (dfield_is_ext(new_val)) {
+ b.blob_page_no = mach_read_from_4(
+ field_ref + BTR_EXTERN_PAGE_NO);
+ b.always_owner = b.owner = !(field_ref[BTR_EXTERN_LEN]
+ & BTR_EXTERN_OWNER_FLAG);
+ b.del = rec_get_deleted_flag(
+ rec, rec_offs_comp(offsets));
+
+ btr_blob_dbg_rbt_insert(index, &b, "upd_in_place");
+ }
+#endif /* UNIV_BLOB_DEBUG */
}
if (UNIV_LIKELY_NULL(page_zip)) {
@@ -536,7 +580,7 @@ row_upd_write_sys_vals_to_log(
trx_write_roll_ptr(log_ptr, roll_ptr);
log_ptr += DATA_ROLL_PTR_LEN;
- log_ptr += mach_dulint_write_compressed(log_ptr, trx->id);
+ log_ptr += mach_ull_write_compressed(log_ptr, trx->id);
return(log_ptr);
}
@@ -570,7 +614,7 @@ row_upd_parse_sys_vals(
*roll_ptr = trx_read_roll_ptr(ptr);
ptr += DATA_ROLL_PTR_LEN;
- ptr = mach_dulint_parse_compressed(ptr, end_ptr, trx_id);
+ ptr = mach_ull_parse_compressed(ptr, end_ptr, trx_id);
return(ptr);
}
@@ -841,6 +885,18 @@ row_upd_build_difference_binary(
for (i = 0; i < dtuple_get_n_fields(entry); i++) {
+ if (srv_use_sys_stats_table
+ && index == UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes)
+ && i >= rec_offs_n_fields(offsets)) {
+ dfield = dtuple_get_nth_field(entry, i);
+
+ upd_field = upd_get_nth_field(update, n_diff);
+ dfield_copy(&(upd_field->new_val), dfield);
+ upd_field_set_field_no(upd_field, i, index, trx);
+ n_diff++;
+ goto skip_compare;
+ }
+
data = rec_get_nth_field(rec, offsets, i, &len);
dfield = dtuple_get_nth_field(entry, i);
@@ -949,7 +1005,7 @@ row_upd_index_replace_new_col_val(
}
len = dtype_get_at_most_n_mbchars(col->prtype,
- col->mbminlen, col->mbmaxlen,
+ col->mbminmaxlen,
field->prefix_len, len,
(const char*) data);
@@ -1173,8 +1229,8 @@ row_upd_replace(
}
if (n_ext_cols) {
- *ext = row_ext_create(n_ext_cols, ext_cols, row,
- dict_table_zip_size(table), heap);
+ *ext = row_ext_create(n_ext_cols, ext_cols, table->flags, row,
+ heap);
} else {
*ext = NULL;
}
@@ -1189,26 +1245,33 @@ NOTE: we compare the fields as binary strings!
@return TRUE if update vector changes an ordering field in the index record */
UNIV_INTERN
ibool
-row_upd_changes_ord_field_binary(
-/*=============================*/
+row_upd_changes_ord_field_binary_func(
+/*==================================*/
+ dict_index_t* index, /*!< in: index of the record */
+ const upd_t* update, /*!< in: update vector for the row; NOTE: the
+ field numbers in this MUST be clustered index
+ positions! */
+#ifdef UNIV_DEBUG
+ const que_thr_t*thr, /*!< in: query thread */
+#endif /* UNIV_DEBUG */
const dtuple_t* row, /*!< in: old value of row, or NULL if the
row and the data values in update are not
known when this function is called, e.g., at
compile time */
- dict_index_t* index, /*!< in: index of the record */
- const upd_t* update) /*!< in: update vector for the row; NOTE: the
- field numbers in this MUST be clustered index
- positions! */
+ const row_ext_t*ext) /*!< NULL, or prefixes of the externally
+ stored columns in the old row */
{
- ulint n_unique;
- ulint n_upd_fields;
- ulint i, j;
- dict_index_t* clust_index;
+ ulint n_unique;
+ ulint i;
+ const dict_index_t* clust_index;
- ut_ad(update && index);
+ ut_ad(index);
+ ut_ad(update);
+ ut_ad(thr);
+ ut_ad(thr->graph);
+ ut_ad(thr->graph->trx);
n_unique = dict_index_get_n_unique(index);
- n_upd_fields = upd_get_n_fields(update);
clust_index = dict_table_get_first_index(index->table);
@@ -1216,33 +1279,81 @@ row_upd_changes_ord_field_binary(
const dict_field_t* ind_field;
const dict_col_t* col;
- ulint col_pos;
ulint col_no;
+ const upd_field_t* upd_field;
+ const dfield_t* dfield;
+ dfield_t dfield_ext;
+ ulint dfield_len;
+ const byte* buf;
ind_field = dict_index_get_nth_field(index, i);
col = dict_field_get_col(ind_field);
- col_pos = dict_col_get_clust_pos(col, clust_index);
col_no = dict_col_get_no(col);
- for (j = 0; j < n_upd_fields; j++) {
+ upd_field = upd_get_field_by_field_no(
+ update, dict_col_get_clust_pos(col, clust_index));
- const upd_field_t* upd_field
- = upd_get_nth_field(update, j);
+ if (upd_field == NULL) {
+ continue;
+ }
- /* Note that if the index field is a column prefix
- then it may be that row does not contain an externally
- stored part of the column value, and we cannot compare
- the datas */
+ if (row == NULL) {
+ ut_ad(ext == NULL);
+ return(TRUE);
+ }
- if (col_pos == upd_field->field_no
- && (row == NULL
- || ind_field->prefix_len > 0
- || !dfield_datas_are_binary_equal(
- dtuple_get_nth_field(row, col_no),
- &(upd_field->new_val)))) {
+ dfield = dtuple_get_nth_field(row, col_no);
- return(TRUE);
+ /* This treatment of column prefix indexes is loosely
+ based on row_build_index_entry(). */
+
+ if (UNIV_LIKELY(ind_field->prefix_len == 0)
+ || dfield_is_null(dfield)) {
+ /* do nothing special */
+ } else if (UNIV_LIKELY_NULL(ext)) {
+ /* Silence a compiler warning without
+ silencing a Valgrind error. */
+ dfield_len = 0;
+ UNIV_MEM_INVALID(&dfield_len, sizeof dfield_len);
+ /* See if the column is stored externally. */
+ buf = row_ext_lookup(ext, col_no, &dfield_len);
+
+ ut_ad(col->ord_part);
+
+ if (UNIV_LIKELY_NULL(buf)) {
+ if (UNIV_UNLIKELY(buf == field_ref_zero)) {
+ /* The externally stored field
+ was not written yet. This
+ record should only be seen by
+ recv_recovery_rollback_active(),
+ when the server had crashed before
+ storing the field. */
+ ut_ad(thr->graph->trx->is_recovered);
+ ut_ad(trx_is_recv(thr->graph->trx));
+ return(TRUE);
+ }
+
+ goto copy_dfield;
}
+ } else if (dfield_is_ext(dfield)) {
+ dfield_len = dfield_get_len(dfield);
+ ut_a(dfield_len > BTR_EXTERN_FIELD_REF_SIZE);
+ dfield_len -= BTR_EXTERN_FIELD_REF_SIZE;
+ ut_a(dict_index_is_clust(index)
+ || ind_field->prefix_len <= dfield_len);
+ buf = dfield_get_data(dfield);
+copy_dfield:
+ ut_a(dfield_len > 0);
+ dfield_copy(&dfield_ext, dfield);
+ dfield_set_data(&dfield_ext, buf, dfield_len);
+ dfield = &dfield_ext;
+ }
+
+ if (!dfield_datas_are_binary_equal(
+ dfield, &upd_field->new_val,
+ ind_field->prefix_len)) {
+
+ return(TRUE);
}
}
@@ -1326,7 +1437,7 @@ row_upd_changes_first_fields_binary(
if (col_pos == upd_field->field_no
&& !dfield_datas_are_binary_equal(
dtuple_get_nth_field(entry, i),
- &(upd_field->new_val))) {
+ &upd_field->new_val, 0)) {
return(TRUE);
}
@@ -1456,21 +1567,22 @@ row_upd_sec_index_entry(
upd_node_t* node, /*!< in: row update node */
que_thr_t* thr) /*!< in: query thread */
{
- ibool check_ref;
- ibool found;
- dict_index_t* index;
- dtuple_t* entry;
- btr_pcur_t pcur;
- btr_cur_t* btr_cur;
- mem_heap_t* heap;
- rec_t* rec;
- ulint err = DB_SUCCESS;
- mtr_t mtr;
- trx_t* trx = thr_get_trx(thr);
+ mtr_t mtr;
+ const rec_t* rec;
+ btr_pcur_t pcur;
+ mem_heap_t* heap;
+ dtuple_t* entry;
+ dict_index_t* index;
+ btr_cur_t* btr_cur;
+ ibool referenced;
+ ulint err = DB_SUCCESS;
+ trx_t* trx = thr_get_trx(thr);
+ ulint mode = BTR_MODIFY_LEAF;
+ enum row_search_result search_result;
index = node->index;
- check_ref = row_upd_index_is_referenced(index, trx);
+ referenced = row_upd_index_is_referenced(index, trx);
heap = mem_heap_create(1024);
@@ -1480,13 +1592,33 @@ row_upd_sec_index_entry(
mtr_start(&mtr);
- found = row_search_index_entry(index, entry, BTR_MODIFY_LEAF, &pcur,
- &mtr);
+ /* Set the query thread, so that ibuf_insert_low() will be
+ able to invoke thd_get_trx(). */
+ btr_pcur_get_btr_cur(&pcur)->thr = thr;
+
+ /* We can only try to use the insert/delete buffer to buffer
+ delete-mark operations if the index we're modifying has no foreign
+ key constraints referring to it. */
+ if (!referenced) {
+ mode |= BTR_DELETE_MARK;
+ }
+
+ search_result = row_search_index_entry(index, entry, mode,
+ &pcur, &mtr);
+
btr_cur = btr_pcur_get_btr_cur(&pcur);
rec = btr_cur_get_rec(btr_cur);
- if (UNIV_UNLIKELY(!found)) {
+ switch (search_result) {
+ case ROW_NOT_DELETED_REF: /* should only occur for BTR_DELETE */
+ ut_error;
+ break;
+ case ROW_BUFFERED:
+ /* Entry was delete marked already. */
+ break;
+
+ case ROW_NOT_FOUND:
fputs("InnoDB: error in sec index entry update in\n"
"InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index);
@@ -1503,20 +1635,26 @@ row_upd_sec_index_entry(
fputs("\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
- } else {
+ break;
+ case ROW_FOUND:
/* Delete mark the old index record; it can already be
delete marked if we return after a lock wait in
row_ins_index_entry below */
- if (!rec_get_deleted_flag(rec,
- dict_table_is_comp(index->table))) {
- err = btr_cur_del_mark_set_sec_rec(0, btr_cur, TRUE,
- thr, &mtr);
- if (err == DB_SUCCESS && check_ref) {
+ if (!rec_get_deleted_flag(
+ rec, dict_table_is_comp(index->table))) {
+
+ err = btr_cur_del_mark_set_sec_rec(
+ 0, btr_cur, TRUE, thr, &mtr);
+
+ if (err == DB_SUCCESS && referenced) {
+
+ ulint* offsets;
+
+ offsets = rec_get_offsets(
+ rec, index, NULL, ULINT_UNDEFINED,
+ &heap);
- ulint* offsets = rec_get_offsets(
- rec, index, NULL,
- ULINT_UNDEFINED, &heap);
/* NOTE that the following call loses
the position of pcur ! */
err = row_upd_check_references_constraints(
@@ -1524,6 +1662,7 @@ row_upd_sec_index_entry(
index, offsets, thr, &mtr);
}
}
+ break;
}
btr_pcur_close(&pcur);
@@ -1565,14 +1704,99 @@ row_upd_sec_step(
ut_ad(!dict_index_is_clust(node->index));
if (node->state == UPD_NODE_UPDATE_ALL_SEC
- || row_upd_changes_ord_field_binary(node->row, node->index,
- node->update)) {
+ || row_upd_changes_ord_field_binary(node->index, node->update,
+ thr, node->row, node->ext)) {
return(row_upd_sec_index_entry(node, thr));
}
return(DB_SUCCESS);
}
+#ifdef UNIV_DEBUG
+# define row_upd_clust_rec_by_insert_inherit(rec,offsets,entry,update) \
+ row_upd_clust_rec_by_insert_inherit_func(rec,offsets,entry,update)
+#else /* UNIV_DEBUG */
+# define row_upd_clust_rec_by_insert_inherit(rec,offsets,entry,update) \
+ row_upd_clust_rec_by_insert_inherit_func(entry,update)
+#endif /* UNIV_DEBUG */
+/*******************************************************************//**
+Mark non-updated off-page columns inherited when the primary key is
+updated. We must mark them as inherited in entry, so that they are not
+freed in a rollback. A limited version of this function used to be
+called btr_cur_mark_dtuple_inherited_extern().
+@return TRUE if any columns were inherited */
+static __attribute__((warn_unused_result))
+ibool
+row_upd_clust_rec_by_insert_inherit_func(
+/*=====================================*/
+#ifdef UNIV_DEBUG
+ const rec_t* rec, /*!< in: old record, or NULL */
+ const ulint* offsets,/*!< in: rec_get_offsets(rec), or NULL */
+#endif /* UNIV_DEBUG */
+ dtuple_t* entry, /*!< in/out: updated entry to be
+ inserted into the clustered index */
+ const upd_t* update) /*!< in: update vector */
+{
+ ibool inherit = FALSE;
+ ulint i;
+
+ ut_ad(!rec == !offsets);
+ ut_ad(!rec || rec_offs_any_extern(offsets));
+
+ for (i = 0; i < dtuple_get_n_fields(entry); i++) {
+ dfield_t* dfield = dtuple_get_nth_field(entry, i);
+ byte* data;
+ ulint len;
+
+ ut_ad(!offsets
+ || !rec_offs_nth_extern(offsets, i)
+ == !dfield_is_ext(dfield)
+ || upd_get_field_by_field_no(update, i));
+ if (!dfield_is_ext(dfield)
+ || upd_get_field_by_field_no(update, i)) {
+ continue;
+ }
+
+#ifdef UNIV_DEBUG
+ if (UNIV_LIKELY(rec != NULL)) {
+ const byte* rec_data
+ = rec_get_nth_field(rec, offsets, i, &len);
+ ut_ad(len == dfield_get_len(dfield));
+ ut_ad(len != UNIV_SQL_NULL);
+ ut_ad(len >= BTR_EXTERN_FIELD_REF_SIZE);
+
+ rec_data += len - BTR_EXTERN_FIELD_REF_SIZE;
+
+ /* The pointer must not be zero. */
+ ut_ad(memcmp(rec_data, field_ref_zero,
+ BTR_EXTERN_FIELD_REF_SIZE));
+ /* The BLOB must be owned. */
+ ut_ad(!(rec_data[BTR_EXTERN_LEN]
+ & BTR_EXTERN_OWNER_FLAG));
+ }
+#endif /* UNIV_DEBUG */
+
+ len = dfield_get_len(dfield);
+ ut_a(len != UNIV_SQL_NULL);
+ ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
+ data = dfield_get_data(dfield);
+ data += len - BTR_EXTERN_FIELD_REF_SIZE;
+ /* The pointer must not be zero. */
+ ut_a(memcmp(data, field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE));
+ /* The BLOB must be owned. */
+ ut_a(!(data[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG));
+
+ data[BTR_EXTERN_LEN] |= BTR_EXTERN_INHERITED_FLAG;
+ /* The BTR_EXTERN_INHERITED_FLAG only matters in
+ rollback. Purge will always free the extern fields of
+ a delete-marked row. */
+
+ inherit = TRUE;
+ }
+
+ return(inherit);
+}
+
/***********************************************************//**
Marks the clustered index record deleted and inserts the updated version
of the record to the index. This function should be used when the ordering
@@ -1584,21 +1808,23 @@ static
ulint
row_upd_clust_rec_by_insert(
/*========================*/
- upd_node_t* node, /*!< in: row update node */
+ upd_node_t* node, /*!< in/out: row update node */
dict_index_t* index, /*!< in: clustered index of the record */
que_thr_t* thr, /*!< in: query thread */
- ibool check_ref,/*!< in: TRUE if index may be referenced in
+ ibool referenced,/*!< in: TRUE if index may be referenced in
a foreign key constraint */
- mtr_t* mtr) /*!< in: mtr; gets committed here */
+ mtr_t* mtr) /*!< in/out: mtr; gets committed here */
{
- mem_heap_t* heap = NULL;
+ mem_heap_t* heap;
btr_pcur_t* pcur;
btr_cur_t* btr_cur;
trx_t* trx;
dict_table_t* table;
dtuple_t* entry;
ulint err;
- ibool change_ownership = FALSE;
+ ibool change_ownership = FALSE;
+ rec_t* rec;
+ ulint* offsets = NULL;
ut_ad(node);
ut_ad(dict_index_is_clust(index));
@@ -1608,77 +1834,114 @@ row_upd_clust_rec_by_insert(
pcur = node->pcur;
btr_cur = btr_pcur_get_btr_cur(pcur);
- if (node->state != UPD_NODE_INSERT_CLUSTERED) {
- rec_t* rec;
- dict_index_t* index;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets;
- rec_offs_init(offsets_);
+ heap = mem_heap_create(1000);
+
+ entry = row_build_index_entry(node->upd_row, node->upd_ext,
+ index, heap);
+ ut_a(entry);
+
+ row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id);
+
+ switch (node->state) {
+ default:
+ ut_error;
+ case UPD_NODE_INSERT_BLOB:
+ /* A lock wait occurred in row_ins_index_entry() in
+ the previous invocation of this function. Mark the
+ off-page columns in the entry inherited. */
+
+ change_ownership = row_upd_clust_rec_by_insert_inherit(
+ NULL, NULL, entry, node->update);
+ ut_a(change_ownership);
+ /* fall through */
+ case UPD_NODE_INSERT_CLUSTERED:
+ /* A lock wait occurred in row_ins_index_entry() in
+ the previous invocation of this function. */
+ break;
+ case UPD_NODE_UPDATE_CLUSTERED:
+ /* This is the first invocation of the function where
+ we update the primary key. Delete-mark the old record
+ in the clustered index and prepare to insert a new entry. */
+ rec = btr_cur_get_rec(btr_cur);
+ offsets = rec_get_offsets(rec, index, NULL,
+ ULINT_UNDEFINED, &heap);
+ ut_ad(page_rec_is_user_rec(rec));
- err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG,
- btr_cur, TRUE, thr, mtr);
+ err = btr_cur_del_mark_set_clust_rec(
+ BTR_NO_LOCKING_FLAG, btr_cur_get_block(btr_cur),
+ rec, index, offsets, TRUE, thr, mtr);
if (err != DB_SUCCESS) {
+err_exit:
mtr_commit(mtr);
+ mem_heap_free(heap);
return(err);
}
- /* Mark as not-owned the externally stored fields which the new
- row inherits from the delete marked record: purge should not
- free those externally stored fields even if the delete marked
- record is removed from the index tree, or updated. */
+ /* If the the new row inherits externally stored
+ fields (off-page columns a.k.a. BLOBs) from the
+ delete-marked old record, mark them disowned by the
+ old record and owned by the new entry. */
- rec = btr_cur_get_rec(btr_cur);
- index = dict_table_get_first_index(table);
- offsets = rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &heap);
- change_ownership = btr_cur_mark_extern_inherited_fields(
- btr_cur_get_page_zip(btr_cur), rec, index, offsets,
- node->update, mtr);
- if (check_ref) {
+ if (rec_offs_any_extern(offsets)) {
+ change_ownership = row_upd_clust_rec_by_insert_inherit(
+ rec, offsets, entry, node->update);
+
+ if (change_ownership) {
+ btr_pcur_store_position(pcur, mtr);
+ }
+ }
+
+ if (referenced) {
/* NOTE that the following call loses
the position of pcur ! */
+
err = row_upd_check_references_constraints(
node, pcur, table, index, offsets, thr, mtr);
+
if (err != DB_SUCCESS) {
- mtr_commit(mtr);
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
- return(err);
+ goto err_exit;
}
}
}
mtr_commit(mtr);
- if (!heap) {
- heap = mem_heap_create(500);
- }
- node->state = UPD_NODE_INSERT_CLUSTERED;
+ err = row_ins_index_entry(index, entry,
+ node->upd_ext ? node->upd_ext->n_ext : 0,
+ TRUE, thr);
+ node->state = change_ownership
+ ? UPD_NODE_INSERT_BLOB
+ : UPD_NODE_INSERT_CLUSTERED;
- entry = row_build_index_entry(node->upd_row, node->upd_ext,
- index, heap);
- ut_a(entry);
+ if (err == DB_SUCCESS && change_ownership) {
+ /* Mark the non-updated fields disowned by the old record. */
- row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id);
+ /* NOTE: this transaction has an x-lock on the record
+ and therefore other transactions cannot modify the
+ record when we have no latch on the page. In addition,
+ we assume that other query threads of the same
+ transaction do not modify the record in the meantime.
+ Therefore we can assert that the restoration of the
+ cursor succeeds. */
- if (change_ownership) {
- /* If we return from a lock wait, for example, we may have
- extern fields marked as not-owned in entry (marked in the
- if-branch above). We must unmark them, take the ownership
- back. */
+ mtr_start(mtr);
- btr_cur_unmark_dtuple_extern_fields(entry);
+ if (!btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr)) {
+ ut_error;
+ }
- /* We must mark non-updated extern fields in entry as
- inherited, so that a possible rollback will not free them. */
+ rec = btr_cur_get_rec(btr_cur);
+ offsets = rec_get_offsets(rec, index, offsets,
+ ULINT_UNDEFINED, &heap);
+ ut_ad(page_rec_is_user_rec(rec));
+
+ btr_cur_disown_inherited_fields(
+ btr_cur_get_page_zip(btr_cur),
+ rec, index, offsets, node->update, mtr);
- btr_cur_mark_dtuple_inherited_extern(entry, node->update);
+ mtr_commit(mtr);
}
- err = row_ins_index_entry(index, entry,
- node->upd_ext ? node->upd_ext->n_ext : 0,
- TRUE, thr);
mem_heap_free(heap);
return(err);
@@ -1772,7 +2035,7 @@ row_upd_clust_rec(
index, btr_cur_get_block(btr_cur), rec,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),
- big_rec, mtr);
+ mtr, TRUE, big_rec);
mtr_commit(mtr);
}
@@ -1799,7 +2062,8 @@ row_upd_del_mark_clust_rec(
ulint* offsets,/*!< in/out: rec_get_offsets() for the
record under the cursor */
que_thr_t* thr, /*!< in: query thread */
- ibool check_ref,/*!< in: TRUE if index may be referenced in
+ ibool referenced,
+ /*!< in: TRUE if index may be referenced in
a foreign key constraint */
mtr_t* mtr) /*!< in: mtr; gets committed here */
{
@@ -1822,15 +2086,14 @@ row_upd_del_mark_clust_rec(
/* Mark the clustered index record deleted; we do not have to check
locks, because we assume that we have an x-lock on the record */
- err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG,
- btr_cur, TRUE, thr, mtr);
- if (err == DB_SUCCESS && check_ref) {
+ err = btr_cur_del_mark_set_clust_rec(
+ BTR_NO_LOCKING_FLAG, btr_cur_get_block(btr_cur),
+ btr_cur_get_rec(btr_cur), index, offsets, TRUE, thr, mtr);
+ if (err == DB_SUCCESS && referenced) {
/* NOTE that the following call loses the position of pcur ! */
- err = row_upd_check_references_constraints(node,
- pcur, index->table,
- index, offsets,
- thr, mtr);
+ err = row_upd_check_references_constraints(
+ node, pcur, index->table, index, offsets, thr, mtr);
}
mtr_commit(mtr);
@@ -1852,7 +2115,6 @@ row_upd_clust_step(
dict_index_t* index;
btr_pcur_t* pcur;
ibool success;
- ibool check_ref;
ulint err;
mtr_t* mtr;
mtr_t mtr_buf;
@@ -1860,11 +2122,12 @@ row_upd_clust_step(
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets;
+ ibool referenced;
rec_offs_init(offsets_);
index = dict_table_get_first_index(node->table);
- check_ref = row_upd_index_is_referenced(index, thr_get_trx(thr));
+ referenced = row_upd_index_is_referenced(index, thr_get_trx(thr));
pcur = node->pcur;
@@ -1897,8 +2160,7 @@ row_upd_clust_step(
then we have to free the file segments of the index tree associated
with the index */
- if (node->is_delete
- && ut_dulint_cmp(node->table->id, DICT_INDEXES_ID) == 0) {
+ if (node->is_delete && node->table->id == DICT_INDEXES_ID) {
dict_drop_index_tree(btr_pcur_get_rec(pcur), mtr);
@@ -1934,8 +2196,9 @@ row_upd_clust_step(
/* NOTE: the following function calls will also commit mtr */
if (node->is_delete) {
- err = row_upd_del_mark_clust_rec(node, index, offsets,
- thr, check_ref, mtr);
+ err = row_upd_del_mark_clust_rec(
+ node, index, offsets, thr, referenced, mtr);
+
if (err == DB_SUCCESS) {
node->state = UPD_NODE_UPDATE_ALL_SEC;
node->index = dict_table_get_next_index(index);
@@ -1970,7 +2233,8 @@ exit_func:
row_upd_store_row(node);
- if (row_upd_changes_ord_field_binary(node->row, index, node->update)) {
+ if (row_upd_changes_ord_field_binary(index, node->update, thr,
+ node->row, node->ext)) {
/* Update causes an ordering field (ordering fields within
the B-tree) of the clustered index record to change: perform
@@ -1983,8 +2247,9 @@ exit_func:
choosing records to update. MySQL solves now the problem
externally! */
- err = row_upd_clust_rec_by_insert(node, index, thr, check_ref,
- mtr);
+ err = row_upd_clust_rec_by_insert(
+ node, index, thr, referenced, mtr);
+
if (err != DB_SUCCESS) {
return(err);
@@ -2039,7 +2304,8 @@ row_upd(
}
if (node->state == UPD_NODE_UPDATE_CLUSTERED
- || node->state == UPD_NODE_INSERT_CLUSTERED) {
+ || node->state == UPD_NODE_INSERT_CLUSTERED
+ || node->state == UPD_NODE_INSERT_BLOB) {
log_free_check();
err = row_upd_clust_step(node, thr);
diff --git a/storage/xtradb/row/row0vers.c b/storage/xtradb/row/row0vers.c
index a4fbb5289aa..5fd7d082194 100644
--- a/storage/xtradb/row/row0vers.c
+++ b/storage/xtradb/row/row0vers.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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
@@ -71,7 +71,9 @@ row_vers_impl_x_locked_off_kernel(
warning */
trx_t* trx;
ulint rec_del;
+#ifdef UNIV_DEBUG
ulint err;
+#endif /* UNIV_DEBUG */
mtr_t mtr;
ulint comp;
@@ -169,9 +171,12 @@ row_vers_impl_x_locked_off_kernel(
heap2 = heap;
heap = mem_heap_create(1024);
- err = trx_undo_prev_version_build(clust_rec, &mtr, version,
- clust_index, clust_offsets,
- heap, &prev_version);
+#ifdef UNIV_DEBUG
+ err =
+#endif /* UNIV_DEBUG */
+ trx_undo_prev_version_build(clust_rec, &mtr, version,
+ clust_index, clust_offsets,
+ heap, &prev_version);
mem_heap_free(heap2); /* free version and clust_offsets */
if (prev_version == NULL) {
@@ -209,7 +214,7 @@ row_vers_impl_x_locked_off_kernel(
prev_trx_id must have already committed for the trx_id
to be able to modify the row. Therefore, prev_trx_id
cannot hold any implicit lock. */
- if (vers_del && 0 != ut_dulint_cmp(trx_id, prev_trx_id)) {
+ if (vers_del && trx_id != prev_trx_id) {
mutex_enter(&kernel_mutex);
break;
@@ -280,7 +285,7 @@ row_vers_impl_x_locked_off_kernel(
break;
}
- if (0 != ut_dulint_cmp(trx_id, prev_trx_id)) {
+ if (trx_id != prev_trx_id) {
/* The versions modified by the trx_id transaction end
to prev_version: no implicit x-lock */
@@ -533,7 +538,7 @@ row_vers_build_for_consistent_read(
undo_no of the record is < undo_no in the view. */
if (view->type == VIEW_HIGH_GRANULARITY
- && ut_dulint_cmp(view->creator_trx_id, trx_id) == 0) {
+ && view->creator_trx_id == trx_id) {
roll_ptr = row_get_rec_roll_ptr(version, index,
*offsets);
@@ -541,10 +546,15 @@ row_vers_build_for_consistent_read(
undo_no = trx_undo_rec_get_undo_no(undo_rec);
mem_heap_empty(heap);
- if (ut_dulint_cmp(view->undo_no, undo_no) > 0) {
+ if (view->undo_no > undo_no) {
/* The view already sees this version: we can
copy it to in_heap and return */
+#ifdef UNIV_BLOB_NULL_DEBUG
+ ut_a(!rec_offs_any_null_extern(
+ version, *offsets));
+#endif /* UNIV_BLOB_NULL_DEBUG */
+
buf = mem_heap_alloc(in_heap,
rec_offs_size(*offsets));
*old_vers = rec_copy(buf, version, *offsets);
@@ -578,6 +588,10 @@ row_vers_build_for_consistent_read(
*offsets = rec_get_offsets(prev_version, index, *offsets,
ULINT_UNDEFINED, offset_heap);
+#ifdef UNIV_BLOB_NULL_DEBUG
+ ut_a(!rec_offs_any_null_extern(prev_version, *offsets));
+#endif /* UNIV_BLOB_NULL_DEBUG */
+
trx_id = row_get_rec_trx_id(prev_version, index, *offsets);
if (read_view_sees_trx_id(view, trx_id)) {
@@ -632,7 +646,7 @@ row_vers_build_for_semi_consistent_read(
mem_heap_t* heap = NULL;
byte* buf;
ulint err;
- trx_id_t rec_trx_id = ut_dulint_zero;
+ trx_id_t rec_trx_id = 0;
ut_ad(dict_index_is_clust(index));
ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
@@ -664,15 +678,23 @@ row_vers_build_for_semi_consistent_read(
mutex_enter(&kernel_mutex);
version_trx = trx_get_on_id(version_trx_id);
+ if (version_trx
+ && (version_trx->conc_state == TRX_COMMITTED_IN_MEMORY
+ || version_trx->conc_state == TRX_NOT_STARTED)) {
+
+ version_trx = NULL;
+ }
mutex_exit(&kernel_mutex);
- if (!version_trx
- || version_trx->conc_state == TRX_NOT_STARTED
- || version_trx->conc_state == TRX_COMMITTED_IN_MEMORY) {
+ if (!version_trx) {
/* We found a version that belongs to a
committed transaction: return it. */
+#ifdef UNIV_BLOB_NULL_DEBUG
+ ut_a(!rec_offs_any_null_extern(version, *offsets));
+#endif /* UNIV_BLOB_NULL_DEBUG */
+
if (rec == version) {
*old_vers = rec;
err = DB_SUCCESS;
@@ -684,7 +706,7 @@ row_vers_build_for_semi_consistent_read(
rolled back and the transaction is removed from
the global list of transactions. */
- if (!ut_dulint_cmp(rec_trx_id, version_trx_id)) {
+ if (rec_trx_id == version_trx_id) {
/* The transaction was committed while
we searched for earlier versions.
Return the current version as a
@@ -730,6 +752,9 @@ row_vers_build_for_semi_consistent_read(
version = prev_version;
*offsets = rec_get_offsets(version, index, *offsets,
ULINT_UNDEFINED, offset_heap);
+#ifdef UNIV_BLOB_NULL_DEBUG
+ ut_a(!rec_offs_any_null_extern(version, *offsets));
+#endif /* UNIV_BLOB_NULL_DEBUG */
}/* for (;;) */
if (heap) {
diff --git a/storage/xtradb/scripts/install_innodb_plugins.sql b/storage/xtradb/scripts/install_innodb_plugins.sql
deleted file mode 100644
index 5a555a652f7..00000000000
--- a/storage/xtradb/scripts/install_innodb_plugins.sql
+++ /dev/null
@@ -1,17 +0,0 @@
--- execute these to install InnoDB if it is built as a dynamic plugin
-INSTALL PLUGIN innodb SONAME 'ha_innodb.so';
-INSTALL PLUGIN innodb_trx SONAME 'ha_innodb.so';
-INSTALL PLUGIN innodb_locks SONAME 'ha_innodb.so';
-INSTALL PLUGIN innodb_lock_waits SONAME 'ha_innodb.so';
-INSTALL PLUGIN innodb_cmp SONAME 'ha_innodb.so';
-INSTALL PLUGIN innodb_cmp_reset SONAME 'ha_innodb.so';
-INSTALL PLUGIN innodb_cmpmem SONAME 'ha_innodb.so';
-INSTALL PLUGIN innodb_cmpmem_reset SONAME 'ha_innodb.so';
-INSTALL PLUGIN XTRADB_ENHANCEMENTS SONAME 'ha_innodb.so';
-INSTALL PLUGIN INNODB_BUFFER_POOL_PAGES SONAME 'ha_innodb.so';
-INSTALL PLUGIN INNODB_BUFFER_POOL_PAGES_BLOB SONAME 'ha_innodb.so';
-INSTALL PLUGIN INNODB_BUFFER_POOL_PAGES_INDEX SONAME 'ha_innodb.so';
-INSTALL PLUGIN innodb_rseg SONAME 'ha_innodb.so';
-INSTALL PLUGIN innodb_table_stats SONAME 'ha_innodb.so';
-INSTALL PLUGIN innodb_index_stats SONAME 'ha_innodb.so';
-INSTALL PLUGIN xtradb_admin_command SONAME 'ha_innodb.so';
diff --git a/storage/xtradb/scripts/install_innodb_plugins_win.sql b/storage/xtradb/scripts/install_innodb_plugins_win.sql
deleted file mode 100644
index 7cda3335694..00000000000
--- a/storage/xtradb/scripts/install_innodb_plugins_win.sql
+++ /dev/null
@@ -1,17 +0,0 @@
--- execute these to install InnoDB if it is built as a dynamic plugin
-INSTALL PLUGIN innodb SONAME 'ha_innodb.dll';
-INSTALL PLUGIN innodb_trx SONAME 'ha_innodb.dll';
-INSTALL PLUGIN innodb_locks SONAME 'ha_innodb.dll';
-INSTALL PLUGIN innodb_lock_waits SONAME 'ha_innodb.dll';
-INSTALL PLUGIN innodb_cmp SONAME 'ha_innodb.dll';
-INSTALL PLUGIN innodb_cmp_reset SONAME 'ha_innodb.dll';
-INSTALL PLUGIN innodb_cmpmem SONAME 'ha_innodb.dll';
-INSTALL PLUGIN innodb_cmpmem_reset SONAME 'ha_innodb.dll';
-INSTALL PLUGIN XTRADB_ENHANCEMENTS SONAME 'ha_innodb.dll';
-INSTALL PLUGIN INNODB_BUFFER_POOL_PAGES SONAME 'ha_innodb.dll';
-INSTALL PLUGIN INNODB_BUFFER_POOL_PAGES_BLOB SONAME 'ha_innodb.dll';
-INSTALL PLUGIN INNODB_BUFFER_POOL_PAGES_INDEX SONAME 'ha_innodb.dll';
-INSTALL PLUGIN innodb_rseg SONAME 'ha_innodb.dll';
-INSTALL PLUGIN innodb_table_stats SONAME 'ha_innodb.dll';
-INSTALL PLUGIN innodb_index_stats SONAME 'ha_innodb.dll';
-INSTALL PLUGIN xtradb_admin_command SONAME 'ha_innodb.dll';
diff --git a/storage/xtradb/srv/srv0que.c b/storage/xtradb/srv/srv0que.c
deleted file mode 100644
index fc50a86a55c..00000000000
--- a/storage/xtradb/srv/srv0que.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 1996, 2009, Innobase Oy. 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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file srv/srv0que.c
-Server query execution
-
-Created 6/5/1996 Heikki Tuuri
-*******************************************************/
-
-#include "srv0que.h"
-
-#include "srv0srv.h"
-#include "sync0sync.h"
-#include "os0thread.h"
-#include "usr0sess.h"
-#include "que0que.h"
-
-/**********************************************************************//**
-Enqueues a task to server task queue and releases a worker thread, if there
-is a suspended one. */
-UNIV_INTERN
-void
-srv_que_task_enqueue_low(
-/*=====================*/
- que_thr_t* thr) /*!< in: query thread */
-{
- ut_ad(thr);
- ut_ad(mutex_own(&kernel_mutex));
-
- UT_LIST_ADD_LAST(queue, srv_sys->tasks, thr);
-
- srv_release_threads(SRV_WORKER, 1);
-}
diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c
index 43799aab196..f6482813c2a 100644
--- a/storage/xtradb/srv/srv0srv.c
+++ b/storage/xtradb/srv/srv0srv.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
@@ -66,9 +66,7 @@ Created 10/8/1995 Heikki Tuuri
#include "mem0mem.h"
#include "mem0pool.h"
#include "sync0sync.h"
-#include "thr0loc.h"
#include "que0que.h"
-#include "srv0que.h"
#include "log0recv.h"
#include "pars0pars.h"
#include "usr0sess.h"
@@ -85,14 +83,13 @@ Created 10/8/1995 Heikki Tuuri
#include "ha_prototypes.h"
#include "trx0i_s.h"
#include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
+#include "read0read.h"
+#include "mysql/plugin.h"
+#include "mysql/service_thd_wait.h"
/* prototypes for new functions added to ha_innodb.cc */
ibool innobase_get_slow_log();
-/* This is set to TRUE if the MySQL user has set it in MySQL; currently
-affects only FOREIGN KEY definition parsing */
-UNIV_INTERN ibool srv_lower_case_table_names = FALSE;
-
/* The following counter is incremented whenever there is some user activity
in the server */
UNIV_INTERN ulint srv_activity_count = 0;
@@ -131,7 +128,7 @@ UNIV_INTERN ulint srv_file_format = 0;
/** Whether to check file format during startup. A value of
DICT_TF_FORMAT_MAX + 1 means no checking ie. FALSE. The default is to
set it to the highest format we support. */
-UNIV_INTERN ulint srv_check_file_format_at_startup = DICT_TF_FORMAT_MAX;
+UNIV_INTERN ulint srv_max_file_format_at_startup = DICT_TF_FORMAT_MAX;
#if DICT_TF_FORMAT_51
# error "DICT_TF_FORMAT_51 must be 0!"
@@ -140,6 +137,27 @@ UNIV_INTERN ulint srv_check_file_format_at_startup = DICT_TF_FORMAT_MAX;
on duplicate key checking and foreign key checking */
UNIV_INTERN ibool srv_locks_unsafe_for_binlog = FALSE;
+/* If this flag is TRUE, then we will use the native aio of the
+OS (provided we compiled Innobase with it in), otherwise we will
+use simulated aio we build below with threads.
+Currently we support native aio on windows and linux */
+UNIV_INTERN my_bool srv_use_native_aio = TRUE;
+
+#ifdef __WIN__
+/* Windows native condition variables. We use runtime loading / function
+pointers, because they are not available on Windows Server 2003 and
+Windows XP/2000.
+
+We use condition for events on Windows if possible, even if os_event
+resembles Windows kernel event object well API-wise. The reason is
+performance, kernel objects are heavyweights and WaitForSingleObject() is a
+performance killer causing calling thread to context switch. Besides, Innodb
+is preallocating large number (often millions) of os_events. With kernel event
+objects it takes a big chunk out of non-paged pool, which is better suited
+for tasks like IO than for storing idle event objects. */
+UNIV_INTERN ibool srv_use_native_conditions = FALSE;
+#endif /* __WIN__ */
+
UNIV_INTERN ulint srv_n_data_files = 0;
UNIV_INTERN char** srv_data_file_names = NULL;
/* size in database pages */
@@ -147,12 +165,8 @@ UNIV_INTERN ulint* srv_data_file_sizes = NULL;
UNIV_INTERN char* srv_doublewrite_file = NULL;
-UNIV_INTERN ibool srv_extra_undoslots = FALSE;
-
UNIV_INTERN ibool srv_recovery_stats = FALSE;
-UNIV_INTERN ulint srv_use_purge_thread = 0;
-
/* if TRUE, then we auto-extend the last data file */
UNIV_INTERN ibool srv_auto_extend_last_data_file = FALSE;
/* if != 0, this tells the max size auto-extending may increase the
@@ -176,7 +190,8 @@ UNIV_INTERN ulint srv_n_log_files = ULINT_MAX;
UNIV_INTERN ulint srv_log_file_size = ULINT_MAX;
/* size in database pages */
UNIV_INTERN ulint srv_log_buffer_size = ULINT_MAX;
-UNIV_INTERN ulong srv_flush_log_at_trx_commit = 1;
+//UNIV_INTERN ulong srv_flush_log_at_trx_commit = 1;
+UNIV_INTERN char srv_use_global_flush_log_at_trx_commit = TRUE;
/* Try to flush dirty pages so as to avoid IO bursts at
the checkpoints. */
@@ -203,6 +218,8 @@ UNIV_INTERN const byte* srv_latin1_ordering;
UNIV_INTERN my_bool srv_use_sys_malloc = TRUE;
/* requested size in kilobytes */
UNIV_INTERN ulint srv_buf_pool_size = ULINT_MAX;
+/* requested number of buffer pool instances */
+UNIV_INTERN ulint srv_buf_pool_instances = 1;
/* previously requested size */
UNIV_INTERN ulint srv_buf_pool_old_size;
/* current size in kilobytes */
@@ -211,11 +228,6 @@ UNIV_INTERN ulint srv_buf_pool_curr_size = 0;
UNIV_INTERN ulint srv_mem_pool_size = ULINT_MAX;
UNIV_INTERN ulint srv_lock_table_size = ULINT_MAX;
-/* key value for shm */
-UNIV_INTERN uint srv_buffer_pool_shm_key = 0;
-UNIV_INTERN ibool srv_buffer_pool_shm_is_reused = FALSE;
-UNIV_INTERN ibool srv_buffer_pool_shm_checksum = TRUE;
-
/* This parameter is deprecated. Use srv_n_io_[read|write]_threads
instead. */
UNIV_INTERN ulint srv_n_file_io_threads = ULINT_MAX;
@@ -226,6 +238,9 @@ UNIV_INTERN ulint srv_n_write_io_threads = ULINT_MAX;
UNIV_INTERN ulint srv_page_size_shift = 0;
UNIV_INTERN ulint srv_page_size = 0;
+/* The log block size */
+UNIV_INTERN ulint srv_log_block_size = 0;
+
/* User settable value of the number of pages that must be present
in the buffer cache and accessed sequentially for InnoDB to trigger a
readahead request. */
@@ -263,9 +278,23 @@ that during a time of heavy update/insert activity. */
UNIV_INTERN ulong srv_max_buf_pool_modified_pct = 75;
+/* the number of purge threads to use from the worker pool (currently 0 or 1).*/
+UNIV_INTERN ulong srv_n_purge_threads = 0;
+
+/* the number of pages to purge in one batch */
+UNIV_INTERN ulong srv_purge_batch_size = 20;
+
+/* the number of rollback segments to use */
+UNIV_INTERN ulong srv_rollback_segments = TRX_SYS_N_RSEGS;
+
/* variable counts amount of data read in total (in bytes) */
UNIV_INTERN ulint srv_data_read = 0;
+/* Internal setting for "innodb_stats_method". Decides how InnoDB treats
+NULL value when collecting statistics. By default, it is set to
+SRV_STATS_NULLS_EQUAL(0), ie. all NULL value are treated equal */
+ulong srv_innodb_stats_method = SRV_STATS_NULLS_EQUAL;
+
/* here we count the amount of data written in total (in bytes) */
UNIV_INTERN ulint srv_data_written = 0;
@@ -304,6 +333,7 @@ UNIV_INTERN ulint srv_buf_pool_wait_free = 0;
/* variable to count the number of pages that were written from buffer
pool to the disk */
UNIV_INTERN ulint srv_buf_pool_flushed = 0;
+UNIV_INTERN ulint buf_lru_flush_page_count = 0;
/** Number of buffer pool reads that led to the
reading of a disk page */
@@ -385,8 +415,7 @@ UNIV_INTERN ibool srv_innodb_status = FALSE;
/* When estimating number of different key values in an index, sample
this many index pages */
UNIV_INTERN unsigned long long srv_stats_sample_pages = 8;
-UNIV_INTERN ulong srv_stats_method = 0;
-UNIV_INTERN ulong srv_stats_auto_update = 1;
+UNIV_INTERN ulint srv_stats_auto_update = 1;
UNIV_INTERN ulint srv_stats_update_need_lock = 1;
UNIV_INTERN ibool srv_use_sys_stats_table = FALSE;
@@ -394,9 +423,6 @@ UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
UNIV_INTERN ibool srv_use_checksums = TRUE;
UNIV_INTERN ibool srv_fast_checksum = FALSE;
-UNIV_INTERN ibool srv_set_thread_priorities = TRUE;
-UNIV_INTERN int srv_query_thread_priority = 0;
-
UNIV_INTERN ulong srv_replication_delay = 0;
UNIV_INTERN long long srv_ibuf_max_size = 0;
@@ -405,17 +431,18 @@ UNIV_INTERN ulong srv_ibuf_accel_rate = 100;
#define PCT_IBUF_IO(pct) ((ulint) (srv_io_capacity * srv_ibuf_accel_rate * ((double) pct / 10000.0)))
UNIV_INTERN ulint srv_checkpoint_age_target = 0;
-UNIV_INTERN ulong srv_flush_neighbor_pages = 1; /* 0:disable 1:enable */
+UNIV_INTERN ulint srv_flush_neighbor_pages = 1; /* 0:disable 1:enable */
+
+UNIV_INTERN ulint srv_enable_unsafe_group_commit = 0; /* 0:disable 1:enable */
+UNIV_INTERN ulint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */
+UNIV_INTERN ulint srv_adaptive_flushing_method = 0; /* 0: native 1: estimate 2: keep_average */
-UNIV_INTERN ulong srv_enable_unsafe_group_commit = 0; /* 0:disable 1:enable */
-UNIV_INTERN ulong srv_read_ahead = 3; /* 1: random 2: linear 3: Both */
-UNIV_INTERN ulong srv_adaptive_checkpoint = 0; /* 0: none 1: reflex 2: estimate */
+UNIV_INTERN ulint srv_expand_import = 0; /* 0:disable 1:enable */
+UNIV_INTERN ulong srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
-UNIV_INTERN ulong srv_expand_import = 0; /* 0:disable 1:enable */
-UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
+UNIV_INTERN ulint srv_dict_size_limit = 0;
-UNIV_INTERN ulong srv_extra_rsegments = 0; /* extra rseg for users */
-UNIV_INTERN ulong srv_dict_size_limit = 0;
+UNIV_INTERN ulint srv_lazy_drop_table = 0;
/*-------------------------------------------*/
UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
@@ -440,12 +467,14 @@ static ulint srv_n_rows_inserted_old = 0;
static ulint srv_n_rows_updated_old = 0;
static ulint srv_n_rows_deleted_old = 0;
static ulint srv_n_rows_read_old = 0;
-UNIV_INTERN ulint srv_n_lock_deadlock_count = 0;
+
+UNIV_INTERN ulint srv_n_lock_deadlock_count = 0;
UNIV_INTERN ulint srv_n_lock_wait_count = 0;
UNIV_INTERN ulint srv_n_lock_wait_current_count = 0;
UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0;
UNIV_INTERN ulint srv_n_lock_max_wait_time = 0;
+UNIV_INTERN ulint srv_truncated_status_writes = 0;
/*
Set the following to 0 if you want InnoDB to write messages on
@@ -469,6 +498,20 @@ UNIV_INTERN mutex_t srv_innodb_monitor_mutex;
/* Mutex for locking srv_monitor_file */
UNIV_INTERN mutex_t srv_monitor_file_mutex;
+
+#ifdef UNIV_PFS_MUTEX
+/* Key to register kernel_mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t kernel_mutex_key;
+/* Key to register srv_innodb_monitor_mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t srv_innodb_monitor_mutex_key;
+/* Key to register srv_monitor_file_mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t srv_monitor_file_mutex_key;
+/* Key to register srv_dict_tmpfile_mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t srv_dict_tmpfile_mutex_key;
+/* Key to register the mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t srv_misc_tmpfile_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
/* Temporary file for innodb monitor output */
UNIV_INTERN FILE* srv_monitor_file;
/* Mutex for locking srv_dict_tmpfile.
@@ -685,9 +728,7 @@ Unix.*/
/* Thread slot in the thread table */
struct srv_slot_struct{
- os_thread_id_t id; /*!< thread id */
- os_thread_t handle; /*!< thread handle */
- unsigned type:3; /*!< thread type: user, utility etc. */
+ unsigned type:1; /*!< thread type: user, utility etc. */
unsigned in_use:1; /*!< TRUE if this slot is in use */
unsigned suspended:1; /*!< TRUE if the thread is waiting
for the event of this slot */
@@ -702,6 +743,12 @@ struct srv_slot_struct{
/* Table for MySQL threads where they will be suspended to wait for locks */
UNIV_INTERN srv_slot_t* srv_mysql_table = NULL;
+UNIV_INTERN os_event_t srv_timeout_event;
+
+UNIV_INTERN os_event_t srv_monitor_event;
+
+UNIV_INTERN os_event_t srv_error_event;
+
UNIV_INTERN os_event_t srv_lock_timeout_thread_event;
UNIV_INTERN os_event_t srv_purge_thread_event;
@@ -738,6 +785,16 @@ are indexed by the type of the thread. */
UNIV_INTERN ulint srv_n_threads_active[SRV_MASTER + 1];
UNIV_INTERN ulint srv_n_threads[SRV_MASTER + 1];
+/*********************************************************************//**
+Asynchronous purge thread.
+@return a dummy parameter */
+UNIV_INTERN
+os_thread_ret_t
+srv_purge_thread(
+/*=============*/
+ void* arg __attribute__((unused))); /*!< in: a dummy parameter
+ required by os_thread_create */
+
/***********************************************************************
Prints counters for work done by srv_master_thread. */
static
@@ -780,6 +837,7 @@ srv_table_get_nth_slot(
/*===================*/
ulint index) /*!< in: index of the slot */
{
+ ut_ad(mutex_own(&kernel_mutex));
ut_a(index < OS_THREAD_MAX_N);
return(srv_sys->threads + index);
@@ -798,7 +856,7 @@ srv_get_n_threads(void)
mutex_enter(&kernel_mutex);
- for (i = SRV_COM; i < SRV_MASTER + 1; i++) {
+ for (i = 0; i < SRV_MASTER + 1; i++) {
n_threads += srv_n_threads[i];
}
@@ -808,13 +866,46 @@ srv_get_n_threads(void)
return(n_threads);
}
+#ifdef UNIV_DEBUG
/*********************************************************************//**
-Reserves a slot in the thread table for the current thread. Also creates the
-thread local storage struct for the current thread. NOTE! The server mutex
-has to be reserved by the caller!
-@return reserved slot index */
+Validates the type of a thread table slot.
+@return TRUE if ok */
static
-ulint
+ibool
+srv_thread_type_validate(
+/*=====================*/
+ enum srv_thread_type type) /*!< in: thread type */
+{
+ switch (type) {
+ case SRV_WORKER:
+ case SRV_MASTER:
+ return(TRUE);
+ }
+ ut_error;
+ return(FALSE);
+}
+#endif /* UNIV_DEBUG */
+
+/*********************************************************************//**
+Gets the type of a thread table slot.
+@return thread type */
+static
+enum srv_thread_type
+srv_slot_get_type(
+/*==============*/
+ const srv_slot_t* slot) /*!< in: thread slot */
+{
+ enum srv_thread_type type = (enum srv_thread_type) slot->type;
+ ut_ad(srv_thread_type_validate(type));
+ return(type);
+}
+
+/*********************************************************************//**
+Reserves a slot in the thread table for the current thread.
+NOTE! The server mutex has to be reserved by the caller!
+@return reserved slot */
+static
+srv_slot_t*
srv_table_reserve_slot(
/*===================*/
enum srv_thread_type type) /*!< in: type of the thread */
@@ -822,8 +913,8 @@ srv_table_reserve_slot(
srv_slot_t* slot;
ulint i;
- ut_a(type > 0);
- ut_a(type <= SRV_MASTER);
+ ut_ad(srv_thread_type_validate(type));
+ ut_ad(mutex_own(&kernel_mutex));
i = 0;
slot = srv_table_get_nth_slot(i);
@@ -833,53 +924,37 @@ srv_table_reserve_slot(
slot = srv_table_get_nth_slot(i);
}
- ut_a(slot->in_use == FALSE);
-
slot->in_use = TRUE;
slot->suspended = FALSE;
slot->type = type;
- slot->id = os_thread_get_curr_id();
- slot->handle = os_thread_get_curr();
-
- thr_local_create();
-
- thr_local_set_slot_no(os_thread_get_curr_id(), i);
+ ut_ad(srv_slot_get_type(slot) == type);
- return(i);
+ return(slot);
}
/*********************************************************************//**
Suspends the calling thread to wait for the event in its thread slot.
-NOTE! The server mutex has to be reserved by the caller!
-@return event for the calling thread to wait */
+NOTE! The server mutex has to be reserved by the caller! */
static
-os_event_t
-srv_suspend_thread(void)
-/*====================*/
+void
+srv_suspend_thread(
+/*===============*/
+ srv_slot_t* slot) /*!< in/out: thread slot */
{
- srv_slot_t* slot;
- os_event_t event;
- ulint slot_no;
enum srv_thread_type type;
ut_ad(mutex_own(&kernel_mutex));
-
- slot_no = thr_local_get_slot_no(os_thread_get_curr_id());
+ ut_ad(slot->in_use);
+ ut_ad(!slot->suspended);
if (srv_print_thread_releases) {
fprintf(stderr,
"Suspending thread %lu to slot %lu\n",
- (ulong) os_thread_get_curr_id(), (ulong) slot_no);
+ (ulong) os_thread_get_curr_id(),
+ (ulong) (slot - srv_sys->threads));
}
- slot = srv_table_get_nth_slot(slot_no);
-
- type = slot->type;
-
- ut_ad(type >= SRV_WORKER);
- ut_ad(type <= SRV_MASTER);
-
- event = slot->event;
+ type = srv_slot_get_type(slot);
slot->suspended = TRUE;
@@ -887,9 +962,7 @@ srv_suspend_thread(void)
srv_n_threads_active[type]--;
- os_event_reset(event);
-
- return(event);
+ os_event_reset(slot->event);
}
/*********************************************************************//**
@@ -908,8 +981,7 @@ srv_release_threads(
ulint i;
ulint count = 0;
- ut_ad(type >= SRV_WORKER);
- ut_ad(type <= SRV_MASTER);
+ ut_ad(srv_thread_type_validate(type));
ut_ad(n > 0);
ut_ad(mutex_own(&kernel_mutex));
@@ -917,7 +989,8 @@ srv_release_threads(
slot = srv_table_get_nth_slot(i);
- if (slot->in_use && slot->type == type && slot->suspended) {
+ if (slot->in_use && slot->suspended
+ && srv_slot_get_type(slot) == type) {
slot->suspended = FALSE;
@@ -927,10 +1000,9 @@ srv_release_threads(
if (srv_print_thread_releases) {
fprintf(stderr,
- "Releasing thread %lu type %lu"
+ "Releasing thread type %lu"
" from slot %lu\n",
- (ulong) slot->id, (ulong) type,
- (ulong) i);
+ (ulong) type, (ulong) i);
}
count++;
@@ -945,31 +1017,35 @@ srv_release_threads(
}
/*********************************************************************//**
-Returns the calling thread type.
-@return SRV_COM, ... */
+Check whether thread type has reserved a slot. Return the first slot that
+is found. This works because we currently have only 1 thread of each type.
+@return slot number or ULINT_UNDEFINED if not found*/
UNIV_INTERN
-enum srv_thread_type
-srv_get_thread_type(void)
-/*=====================*/
+ulint
+srv_thread_has_reserved_slot(
+/*=========================*/
+ enum srv_thread_type type) /*!< in: thread type to check */
{
- ulint slot_no;
- srv_slot_t* slot;
- enum srv_thread_type type;
+ ulint i;
+ ulint slot_no = ULINT_UNDEFINED;
+ ut_ad(srv_thread_type_validate(type));
mutex_enter(&kernel_mutex);
- slot_no = thr_local_get_slot_no(os_thread_get_curr_id());
-
- slot = srv_table_get_nth_slot(slot_no);
+ for (i = 0; i < OS_THREAD_MAX_N; i++) {
+ srv_slot_t* slot;
- type = slot->type;
+ slot = srv_table_get_nth_slot(i);
- ut_ad(type >= SRV_WORKER);
- ut_ad(type <= SRV_MASTER);
+ if (slot->in_use && slot->type == type) {
+ slot_no = i;
+ break;
+ }
+ }
mutex_exit(&kernel_mutex);
- return(type);
+ return(slot_no);
}
/*********************************************************************//**
@@ -986,30 +1062,33 @@ srv_init(void)
srv_sys = mem_alloc(sizeof(srv_sys_t));
kernel_mutex_temp = mem_alloc(sizeof(mutex_t));
- mutex_create(&kernel_mutex, SYNC_KERNEL);
+ mutex_create(kernel_mutex_key, &kernel_mutex, SYNC_KERNEL);
- mutex_create(&srv_innodb_monitor_mutex, SYNC_NO_ORDER_CHECK);
+ mutex_create(srv_innodb_monitor_mutex_key,
+ &srv_innodb_monitor_mutex, SYNC_NO_ORDER_CHECK);
- srv_sys->threads = mem_alloc(OS_THREAD_MAX_N * sizeof(srv_slot_t));
+ srv_sys->threads = mem_zalloc(OS_THREAD_MAX_N * sizeof(srv_slot_t));
for (i = 0; i < OS_THREAD_MAX_N; i++) {
- slot = srv_table_get_nth_slot(i);
- slot->in_use = FALSE;
- slot->type=0; /* Avoid purify errors */
+ slot = srv_sys->threads + i;
slot->event = os_event_create(NULL);
ut_a(slot->event);
}
- srv_mysql_table = mem_alloc(OS_THREAD_MAX_N * sizeof(srv_slot_t));
+ srv_mysql_table = mem_zalloc(OS_THREAD_MAX_N * sizeof(srv_slot_t));
for (i = 0; i < OS_THREAD_MAX_N; i++) {
slot = srv_mysql_table + i;
- slot->in_use = FALSE;
- slot->type = 0;
slot->event = os_event_create(NULL);
ut_a(slot->event);
}
+ srv_error_event = os_event_create(NULL);
+
+ srv_timeout_event = os_event_create(NULL);
+
+ srv_monitor_event = os_event_create(NULL);
+
srv_lock_timeout_thread_event = os_event_create(NULL);
srv_purge_thread_event = os_event_create(NULL);
@@ -1087,7 +1166,6 @@ srv_general_init(void)
os_sync_init();
sync_init();
mem_init(srv_mem_pool_size);
- thr_local_init();
}
/*======================= InnoDB Server FIFO queue =======================*/
@@ -1182,6 +1260,10 @@ srv_conc_enter_innodb(
ulint sec;
ulint ms;
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
+
if (trx->mysql_thd != NULL
&& thd_is_replication_slave_thread(trx->mysql_thd)) {
@@ -1313,6 +1395,11 @@ retry:
/* Go to wait for the event; when a thread leaves InnoDB it will
release this thread */
+ ut_ad(!trx->has_search_latch);
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
+
if (innobase_get_slow_log() && trx->take_stats) {
ut_usectime(&sec, &ms);
start_time = (ib_uint64_t)sec * 1000000 + ms;
@@ -1322,7 +1409,9 @@ retry:
trx->op_info = "waiting in InnoDB queue";
+ thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK);
os_event_wait(slot->event);
+ thd_wait_end(trx->mysql_thd);
trx->op_info = "";
@@ -1359,6 +1448,10 @@ srv_conc_force_enter_innodb(
trx_t* trx) /*!< in: transaction object associated with the
thread */
{
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
+
if (UNIV_LIKELY(!srv_thread_concurrency)) {
return;
@@ -1445,6 +1538,10 @@ srv_conc_force_exit_innodb(
if (slot != NULL) {
os_event_set(slot->event);
}
+
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
}
/*********************************************************************//**
@@ -1456,6 +1553,10 @@ srv_conc_exit_innodb(
trx_t* trx) /*!< in: transaction object associated with the
thread */
{
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
+
if (trx->n_tickets_to_enter_innodb > 0) {
/* We will pretend the thread is still inside InnoDB though it
now leaves the InnoDB engine. In this way we save
@@ -1553,7 +1654,7 @@ srv_table_reserve_slot_for_mysql(void)
while (slot->in_use) {
i++;
- if (i >= OS_THREAD_MAX_N) {
+ if (UNIV_UNLIKELY(i >= OS_THREAD_MAX_N)) {
ut_print_timestamp(stderr);
@@ -1572,10 +1673,9 @@ srv_table_reserve_slot_for_mysql(void)
slot = srv_mysql_table + i;
fprintf(stderr,
- "Slot %lu: thread id %lu, type %lu,"
+ "Slot %lu: thread type %lu,"
" in use %lu, susp %lu, time %lu\n",
(ulong) i,
- (ulong) os_thread_pf(slot->id),
(ulong) slot->type,
(ulong) slot->in_use,
(ulong) slot->suspended,
@@ -1592,8 +1692,6 @@ srv_table_reserve_slot_for_mysql(void)
ut_a(slot->in_use == FALSE);
slot->in_use = TRUE;
- slot->id = os_thread_get_curr_id();
- slot->handle = os_thread_get_curr();
return(slot);
}
@@ -1680,17 +1778,6 @@ srv_suspend_mysql_thread(
mutex_exit(&kernel_mutex);
- if (trx->declared_to_be_inside_innodb) {
-
- was_declared_inside_innodb = TRUE;
-
- /* We must declare this OS thread to exit InnoDB, since a
- possible other thread holding a lock which this thread waits
- for must be allowed to enter, sooner or later */
-
- srv_conc_force_exit_innodb(trx);
- }
-
had_dict_lock = trx->dict_operation_lock_mode;
switch (had_dict_lock) {
@@ -1699,6 +1786,18 @@ srv_suspend_mysql_thread(
row_mysql_unfreeze_data_dictionary(trx);
break;
case RW_X_LATCH:
+ /* There should never be a lock wait when the
+ dictionary latch is reserved in X mode. Dictionary
+ transactions should only acquire locks on dictionary
+ tables, not other tables. All access to dictionary
+ tables should be covered by dictionary
+ transactions. */
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: Error: dict X latch held in "
+ "srv_suspend_mysql_thread\n", stderr);
+ /* This should never occur. This incorrect handling
+ was added in the early development of
+ ha_innobase::add_index() in InnoDB Plugin 1.0. */
/* Release fast index creation latch */
row_mysql_unlock_data_dictionary(trx);
break;
@@ -1706,9 +1805,33 @@ srv_suspend_mysql_thread(
ut_a(trx->dict_operation_lock_mode == 0);
+ if (trx->declared_to_be_inside_innodb) {
+
+ was_declared_inside_innodb = TRUE;
+
+ /* We must declare this OS thread to exit InnoDB, since a
+ possible other thread holding a lock which this thread waits
+ for must be allowed to enter, sooner or later */
+
+ srv_conc_force_exit_innodb(trx);
+ }
+
/* Suspend this thread and wait for the event. */
+ thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_LOCK);
os_event_wait(event);
+ thd_wait_end(trx->mysql_thd);
+
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+#endif /* UNIV_SYNC_DEBUG */
+
+ if (was_declared_inside_innodb) {
+
+ /* Return back inside InnoDB */
+
+ srv_conc_force_enter_innodb(trx);
+ }
/* After resuming, reacquire the data dictionary latch if
necessary. */
@@ -1718,17 +1841,13 @@ srv_suspend_mysql_thread(
row_mysql_freeze_data_dictionary(trx);
break;
case RW_X_LATCH:
+ /* This should never occur. This incorrect handling
+ was added in the early development of
+ ha_innobase::add_index() in InnoDB Plugin 1.0. */
row_mysql_lock_data_dictionary(trx);
break;
}
- if (was_declared_inside_innodb) {
-
- /* Return back inside InnoDB */
-
- srv_conc_force_enter_innodb(trx);
- }
-
mutex_enter(&kernel_mutex);
/* Release the slot for others to use */
@@ -1754,6 +1873,9 @@ srv_suspend_mysql_thread(
start_time != -1 && finish_time != -1) {
srv_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 (trx->was_chosen_as_deadlock_victim) {
@@ -1831,7 +1953,7 @@ srv_refresh_innodb_monitor_stats(void)
log_refresh_stats();
- buf_refresh_io_stats();
+ buf_refresh_io_stats_all();
srv_n_rows_inserted_old = srv_n_rows_inserted;
srv_n_rows_updated_old = srv_n_rows_updated;
@@ -1926,7 +2048,9 @@ srv_printf_innodb_monitor(
"-------------------------------------\n", file);
ibuf_print(file);
- ha_print_info(file, btr_search_sys->hash_index);
+ for (i = 0; i < btr_search_index_num; i++) {
+ ha_print_info(file, btr_search_get_hash_index((index_id_t)i));
+ }
fprintf(file,
"%.2f hash searches/s, %.2f non-hash searches/s\n",
@@ -1951,14 +2075,15 @@ srv_printf_innodb_monitor(
ut_total_allocated_memory,
mem_pool_get_reserved(mem_comm_pool));
/* Calcurate reserved memories */
- if (btr_search_sys && btr_search_sys->hash_index->heap) {
- btr_search_sys_subtotal = mem_heap_get_size(btr_search_sys->hash_index->heap);
+ if (btr_search_sys && btr_search_sys->hash_index[0]->heap) {
+ btr_search_sys_subtotal = mem_heap_get_size(btr_search_sys->hash_index[0]->heap);
} else {
btr_search_sys_subtotal = 0;
- for (i=0; i < btr_search_sys->hash_index->n_mutexes; i++) {
- btr_search_sys_subtotal += mem_heap_get_size(btr_search_sys->hash_index->heaps[i]);
+ for (i=0; i < btr_search_sys->hash_index[0]->n_mutexes; i++) {
+ btr_search_sys_subtotal += mem_heap_get_size(btr_search_sys->hash_index[0]->heaps[i]);
}
}
+ btr_search_sys_subtotal *= btr_search_index_num;
lock_sys_subtotal = 0;
if (trx_sys) {
@@ -1977,21 +2102,20 @@ srv_printf_innodb_monitor(
fprintf(file,
"Internal hash tables (constant factor + variable factor)\n"
" Adaptive hash index %lu \t(%lu + %lu)\n"
- " Page hash %lu\n"
+ " Page hash %lu (buffer pool 0 only)\n"
" Dictionary cache %lu \t(%lu + %lu)\n"
" File system %lu \t(%lu + %lu)\n"
" Lock system %lu \t(%lu + %lu)\n"
- " Recovery system %lu \t(%lu + %lu)\n"
- " Threads %lu \t(%lu + %lu)\n",
+ " Recovery system %lu \t(%lu + %lu)\n",
(ulong) (btr_search_sys
- ? (btr_search_sys->hash_index->n_cells * sizeof(hash_cell_t)) : 0)
+ ? (btr_search_sys->hash_index[0]->n_cells * btr_search_index_num * sizeof(hash_cell_t)) : 0)
+ btr_search_sys_subtotal,
(ulong) (btr_search_sys
- ? (btr_search_sys->hash_index->n_cells * sizeof(hash_cell_t)) : 0),
+ ? (btr_search_sys->hash_index[0]->n_cells * btr_search_index_num * sizeof(hash_cell_t)) : 0),
(ulong) btr_search_sys_subtotal,
- (ulong) (buf_pool->page_hash->n_cells * sizeof(hash_cell_t)),
+ (ulong) (buf_pool_from_array(0)->page_hash->n_cells * sizeof(hash_cell_t)),
(ulong) (dict_sys ? ((dict_sys->table_hash->n_cells
+ dict_sys->table_id_hash->n_cells
@@ -2017,12 +2141,7 @@ srv_printf_innodb_monitor(
+ recv_sys_subtotal),
(ulong) ((recv_sys && recv_sys->addr_hash)
? (recv_sys->addr_hash->n_cells * sizeof(hash_cell_t)) : 0),
- (ulong) recv_sys_subtotal,
-
- (ulong) (thr_local_hash_cells() * sizeof(hash_cell_t)
- + thr_local_hash_nodes()),
- (ulong) (thr_local_hash_cells() * sizeof(hash_cell_t)),
- (ulong) thr_local_hash_nodes());
+ (ulong) recv_sys_subtotal);
fprintf(file, "Dictionary memory allocated " ULINTPF "\n",
dict_sys->size);
@@ -2039,6 +2158,16 @@ srv_printf_innodb_monitor(
fprintf(file, "%lu read views open inside InnoDB\n",
UT_LIST_GET_LEN(trx_sys->view_list));
+ if (UT_LIST_GET_LEN(trx_sys->view_list)) {
+ read_view_t* view = UT_LIST_GET_LAST(trx_sys->view_list);
+
+ if (view) {
+ fprintf(file, "---OLDEST VIEW---\n");
+ read_view_print(file, view);
+ fprintf(file, "-----------------\n");
+ }
+ }
+
n_reserved = fil_space_get_n_reserved_extents(0);
if (n_reserved > 0) {
fprintf(file,
@@ -2123,8 +2252,53 @@ void
srv_export_innodb_status(void)
/*==========================*/
{
+ buf_pool_stat_t stat;
+ ulint LRU_len;
+ ulint free_len;
+ ulint flush_list_len;
+ ulint mem_adaptive_hash, mem_dictionary;
+ read_view_t* oldest_view;
+ ulint i;
+
+ buf_get_total_stat(&stat);
+ buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
+
+ if (btr_search_sys && btr_search_sys->hash_index[0]->heap) {
+ mem_adaptive_hash = mem_heap_get_size(btr_search_sys->hash_index[0]->heap);
+ } else {
+ mem_adaptive_hash = 0;
+ for (i=0; i < btr_search_sys->hash_index[0]->n_mutexes; i++) {
+ mem_adaptive_hash += mem_heap_get_size(btr_search_sys->hash_index[0]->heaps[i]);
+ }
+ }
+ mem_adaptive_hash *= btr_search_index_num;
+ if (btr_search_sys) {
+ mem_adaptive_hash += (btr_search_sys->hash_index[0]->n_cells * btr_search_index_num * sizeof(hash_cell_t));
+ }
+
+ mem_dictionary = (dict_sys ? ((dict_sys->table_hash->n_cells
+ + dict_sys->table_id_hash->n_cells
+ ) * sizeof(hash_cell_t)
+ + dict_sys->size) : 0);
+
mutex_enter(&srv_innodb_monitor_mutex);
+ export_vars.innodb_adaptive_hash_cells = 0;
+ export_vars.innodb_adaptive_hash_heap_buffers = 0;
+ for (i = 0; i < btr_search_index_num; i++) {
+ hash_table_t* table = btr_search_get_hash_index((index_id_t)i);
+
+ export_vars.innodb_adaptive_hash_cells
+ += hash_get_n_cells(table);
+ export_vars.innodb_adaptive_hash_heap_buffers
+ += (UT_LIST_GET_LEN(table->heap->base) - 1);
+ }
+ export_vars.innodb_adaptive_hash_hash_searches
+ = btr_cur_n_sea;
+ export_vars.innodb_adaptive_hash_non_hash_searches
+ = btr_cur_n_non_sea;
+ export_vars.innodb_background_log_sync
+ = srv_log_writes_and_flush;
export_vars.innodb_data_pending_reads
= os_n_pending_reads;
export_vars.innodb_data_pending_writes
@@ -2138,33 +2312,115 @@ srv_export_innodb_status(void)
export_vars.innodb_data_writes = os_n_file_writes;
export_vars.innodb_data_written = srv_data_written;
export_vars.innodb_dict_tables= (dict_sys ? UT_LIST_GET_LEN(dict_sys->table_LRU) : 0);
- export_vars.innodb_buffer_pool_read_requests = buf_pool->stat.n_page_gets;
+ export_vars.innodb_buffer_pool_read_requests = stat.n_page_gets;
export_vars.innodb_buffer_pool_write_requests
= srv_buf_pool_write_requests;
export_vars.innodb_buffer_pool_wait_free = srv_buf_pool_wait_free;
export_vars.innodb_buffer_pool_pages_flushed = srv_buf_pool_flushed;
+ export_vars.innodb_buffer_pool_pages_LRU_flushed = buf_lru_flush_page_count;
export_vars.innodb_buffer_pool_reads = srv_buf_pool_reads;
export_vars.innodb_buffer_pool_read_ahead
- = buf_pool->stat.n_ra_pages_read;
+ = stat.n_ra_pages_read;
export_vars.innodb_buffer_pool_read_ahead_evicted
- = buf_pool->stat.n_ra_pages_evicted;
- export_vars.innodb_buffer_pool_pages_data
- = UT_LIST_GET_LEN(buf_pool->LRU);
- export_vars.innodb_buffer_pool_pages_dirty
- = UT_LIST_GET_LEN(buf_pool->flush_list);
- export_vars.innodb_buffer_pool_pages_free
- = UT_LIST_GET_LEN(buf_pool->free);
- export_vars.innodb_deadlocks
- = srv_n_lock_deadlock_count;
+ = stat.n_ra_pages_evicted;
+ export_vars.innodb_buffer_pool_pages_data = LRU_len;
+ export_vars.innodb_buffer_pool_pages_dirty = flush_list_len;
+ export_vars.innodb_buffer_pool_pages_free = free_len;
+ export_vars.innodb_deadlocks = srv_n_lock_deadlock_count;
#ifdef UNIV_DEBUG
export_vars.innodb_buffer_pool_pages_latched
= buf_get_latched_pages_number();
#endif /* UNIV_DEBUG */
- export_vars.innodb_buffer_pool_pages_total = buf_pool->curr_size;
+ export_vars.innodb_buffer_pool_pages_total = buf_pool_get_n_pages();
+
+ export_vars.innodb_buffer_pool_pages_misc
+ = buf_pool_get_n_pages() - LRU_len - free_len;
+
+ export_vars.innodb_buffer_pool_pages_made_young
+ = stat.n_pages_made_young;
+ export_vars.innodb_buffer_pool_pages_made_not_young
+ = stat.n_pages_not_made_young;
+ export_vars.innodb_buffer_pool_pages_old = 0;
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool = buf_pool_from_array(i);
+ export_vars.innodb_buffer_pool_pages_old
+ += buf_pool->LRU_old_len;
+ }
+ export_vars.innodb_checkpoint_age
+ = (log_sys->lsn - log_sys->last_checkpoint_lsn);
+ export_vars.innodb_checkpoint_max_age
+ = log_sys->max_checkpoint_age;
+ export_vars.innodb_checkpoint_target_age
+ = srv_checkpoint_age_target
+ ? ut_min(log_sys->max_checkpoint_age_async, srv_checkpoint_age_target)
+ : log_sys->max_checkpoint_age_async;
+ export_vars.innodb_history_list_length
+ = trx_sys->rseg_history_len;
+ ibuf_export_ibuf_status(
+ &export_vars.innodb_ibuf_size,
+ &export_vars.innodb_ibuf_free_list,
+ &export_vars.innodb_ibuf_segment_size,
+ &export_vars.innodb_ibuf_merges,
+ &export_vars.innodb_ibuf_merged_inserts,
+ &export_vars.innodb_ibuf_merged_delete_marks,
+ &export_vars.innodb_ibuf_merged_deletes,
+ &export_vars.innodb_ibuf_discarded_inserts,
+ &export_vars.innodb_ibuf_discarded_delete_marks,
+ &export_vars.innodb_ibuf_discarded_deletes);
+ export_vars.innodb_lsn_current
+ = log_sys->lsn;
+ export_vars.innodb_lsn_flushed
+ = log_sys->flushed_to_disk_lsn;
+ export_vars.innodb_lsn_last_checkpoint
+ = log_sys->last_checkpoint_lsn;
+ export_vars.innodb_master_thread_1_second_loops
+ = srv_main_1_second_loops;
+ export_vars.innodb_master_thread_10_second_loops
+ = srv_main_10_second_loops;
+ export_vars.innodb_master_thread_background_loops
+ = srv_main_background_loops;
+ export_vars.innodb_master_thread_main_flush_loops
+ = srv_main_flush_loops;
+ export_vars.innodb_master_thread_sleeps
+ = srv_main_sleeps;
+ export_vars.innodb_max_trx_id
+ = trx_sys->max_trx_id;
+ export_vars.innodb_mem_adaptive_hash
+ = mem_adaptive_hash;
+ export_vars.innodb_mem_dictionary
+ = mem_dictionary;
+ export_vars.innodb_mem_total
+ = ut_total_allocated_memory;
+ export_vars.innodb_mutex_os_waits
+ = mutex_os_wait_count;
+ export_vars.innodb_mutex_spin_rounds
+ = mutex_spin_round_count;
+ export_vars.innodb_mutex_spin_waits
+ = mutex_spin_wait_count;
+ export_vars.innodb_s_lock_os_waits
+ = rw_s_os_wait_count;
+ export_vars.innodb_s_lock_spin_rounds
+ = rw_s_spin_round_count;
+ export_vars.innodb_s_lock_spin_waits
+ = rw_s_spin_wait_count;
+ export_vars.innodb_x_lock_os_waits
+ = rw_x_os_wait_count;
+ export_vars.innodb_x_lock_spin_rounds
+ = rw_x_spin_round_count;
+ export_vars.innodb_x_lock_spin_waits
+ = rw_x_spin_wait_count;
+
+ oldest_view = UT_LIST_GET_LAST(trx_sys->view_list);
+ export_vars.innodb_oldest_view_low_limit_trx_id
+ = oldest_view ? oldest_view->low_limit_id : 0;
+
+ export_vars.innodb_purge_trx_id
+ = purge_sys->purge_trx_no;
+ export_vars.innodb_purge_undo_no
+ = purge_sys->purge_undo_no;
+ export_vars.innodb_current_row_locks
+ = lock_sys->rec_num;
- export_vars.innodb_buffer_pool_pages_misc = buf_pool->curr_size
- - UT_LIST_GET_LEN(buf_pool->LRU)
- - UT_LIST_GET_LEN(buf_pool->free);
#ifdef HAVE_ATOMIC_BUILTINS
export_vars.innodb_have_atomic_builtins = 1;
#else
@@ -2180,9 +2436,9 @@ srv_export_innodb_status(void)
export_vars.innodb_log_writes = srv_log_writes;
export_vars.innodb_dblwr_pages_written = srv_dblwr_pages_written;
export_vars.innodb_dblwr_writes = srv_dblwr_writes;
- export_vars.innodb_pages_created = buf_pool->stat.n_pages_created;
- export_vars.innodb_pages_read = buf_pool->stat.n_pages_read;
- export_vars.innodb_pages_written = buf_pool->stat.n_pages_written;
+ export_vars.innodb_pages_created = stat.n_pages_created;
+ export_vars.innodb_pages_read = stat.n_pages_read;
+ export_vars.innodb_pages_written = stat.n_pages_written;
export_vars.innodb_row_lock_waits = srv_n_lock_wait_count;
export_vars.innodb_row_lock_current_waits
= srv_n_lock_wait_current_count;
@@ -2199,6 +2455,7 @@ srv_export_innodb_status(void)
export_vars.innodb_rows_inserted = srv_n_rows_inserted;
export_vars.innodb_rows_updated = srv_n_rows_updated;
export_vars.innodb_rows_deleted = srv_n_rows_deleted;
+ export_vars.innodb_truncated_status_writes = srv_truncated_status_writes;
mutex_exit(&srv_innodb_monitor_mutex);
}
@@ -2214,6 +2471,7 @@ srv_monitor_thread(
/*!< in: a dummy parameter required by
os_thread_create */
{
+ ib_int64_t sig_count;
double time_elapsed;
time_t current_time;
time_t last_table_monitor_time;
@@ -2226,27 +2484,34 @@ srv_monitor_thread(
fprintf(stderr, "Lock timeout thread starts, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
#endif
+
+#ifdef UNIV_PFS_THREAD
+ pfs_register_thread(srv_monitor_thread_key);
+#endif
+
UT_NOT_USED(arg);
- srv_last_monitor_time = time(NULL);
- last_table_monitor_time = time(NULL);
- last_tablespace_monitor_time = time(NULL);
- last_monitor_time = time(NULL);
+ srv_last_monitor_time = ut_time();
+ last_table_monitor_time = ut_time();
+ last_tablespace_monitor_time = ut_time();
+ last_monitor_time = ut_time();
mutex_skipped = 0;
last_srv_print_monitor = srv_print_innodb_monitor;
loop:
srv_monitor_active = TRUE;
/* Wake up every 5 seconds to see if we need to print
- monitor information. */
+ monitor information or if signalled at shutdown. */
- os_thread_sleep(5000000);
+ sig_count = os_event_reset(srv_monitor_event);
- current_time = time(NULL);
+ os_event_wait_time_low(srv_monitor_event, 5000000, sig_count);
+
+ current_time = ut_time();
time_elapsed = difftime(current_time, last_monitor_time);
if (time_elapsed > 15) {
- last_monitor_time = time(NULL);
+ last_monitor_time = ut_time();
if (srv_print_innodb_monitor) {
/* Reset mutex_skipped counter everytime
@@ -2290,7 +2555,7 @@ loop:
if (srv_print_innodb_tablespace_monitor
&& difftime(current_time,
last_tablespace_monitor_time) > 60) {
- last_tablespace_monitor_time = time(NULL);
+ last_tablespace_monitor_time = ut_time();
fputs("========================"
"========================\n",
@@ -2316,7 +2581,7 @@ loop:
if (srv_print_innodb_table_monitor
&& difftime(current_time, last_table_monitor_time) > 60) {
- last_table_monitor_time = time(NULL);
+ last_table_monitor_time = ut_time();
fputs("===========================================\n",
stderr);
@@ -2376,12 +2641,20 @@ srv_lock_timeout_thread(
ibool some_waits;
double wait_time;
ulint i;
+ ib_int64_t sig_count;
+
+#ifdef UNIV_PFS_THREAD
+ pfs_register_thread(srv_lock_timeout_thread_key);
+#endif
loop:
+
/* When someone is waiting for a lock, we wake up every second
and check if a timeout has passed for a lock wait */
- os_thread_sleep(1000000);
+ sig_count = os_event_reset(srv_timeout_event);
+
+ os_event_wait_time_low(srv_timeout_event, 1000000, sig_count);
srv_lock_timeout_active = TRUE;
@@ -2476,6 +2749,13 @@ srv_error_monitor_thread(
ulint fatal_cnt = 0;
ib_uint64_t old_lsn;
ib_uint64_t new_lsn;
+ ib_int64_t sig_count;
+ /* longest waiting thread for a semaphore */
+ os_thread_id_t waiter = os_thread_get_curr_id();
+ os_thread_id_t old_waiter = waiter;
+ /* the semaphore that is being waited for */
+ const void* sema = NULL;
+ const void* old_sema = NULL;
old_lsn = srv_start_lsn;
@@ -2483,6 +2763,11 @@ srv_error_monitor_thread(
fprintf(stderr, "Error monitor thread starts, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
#endif
+
+#ifdef UNIV_PFS_THREAD
+ pfs_register_thread(srv_error_monitor_thread_key);
+#endif
+
loop:
srv_error_monitor_active = TRUE;
@@ -2524,7 +2809,8 @@ loop:
sync_arr_wake_threads_if_sema_free();
- if (sync_array_print_long_waits()) {
+ if (sync_array_print_long_waits(&waiter, &sema)
+ && sema == old_sema && os_thread_eq(waiter, old_waiter)) {
fatal_cnt++;
if (fatal_cnt > 10) {
@@ -2539,6 +2825,8 @@ loop:
}
} else {
fatal_cnt = 0;
+ old_waiter = waiter;
+ old_sema = sema;
}
/* Flush stderr so that a database user gets the output
@@ -2546,7 +2834,9 @@ loop:
fflush(stderr);
- os_thread_sleep(1000000);
+ sig_count = os_event_reset(srv_error_event);
+
+ os_event_wait_time_low(srv_error_event, 1000000, sig_count);
if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) {
@@ -2580,7 +2870,7 @@ srv_LRU_dump_restore_thread(
time_t time_elapsed;
#ifdef UNIV_DEBUG_THREAD_CREATION
- fprintf(stderr, "LRU dump/restore thread starts, id %lu\n",
+ fprintf(stderr, "The LRU dump/restore thread has started, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
#endif
@@ -2613,12 +2903,37 @@ exit_func:
OS_THREAD_DUMMY_RETURN;
}
+/**********************************************************************//**
+Check whether any background thread is active.
+@return FALSE if all are are suspended or have exited. */
+UNIV_INTERN
+ibool
+srv_is_any_background_thread_active(void)
+/*=====================================*/
+{
+ ulint i;
+ ibool ret = FALSE;
+
+ mutex_enter(&kernel_mutex);
+
+ for (i = 0; i <= SRV_MASTER; ++i) {
+ if (srv_n_threads_active[i] != 0) {
+ ret = TRUE;
+ break;
+ }
+ }
+
+ mutex_exit(&kernel_mutex);
+
+ return(ret);
+}
+
/*******************************************************************//**
Tells the InnoDB server that there has been activity in the database
and wakes up the master thread if it is suspended (not sleeping). Used
in the MySQL interface. Note that there is a small chance that the master
-thread stays suspended (we do not protect our operation with the kernel
-mutex, for performace reasons). */
+thread stays suspended (we do not protect our operation with the
+srv_sys_t->mutex, for performance reasons). */
UNIV_INTERN
void
srv_active_wake_master_thread(void)
@@ -2637,6 +2952,30 @@ srv_active_wake_master_thread(void)
}
/*******************************************************************//**
+Tells the purge thread that there has been activity in the database
+and wakes up the purge thread if it is suspended (not sleeping). Note
+that there is a small chance that the purge thread stays suspended
+(we do not protect our operation with the kernel mutex, for
+performace reasons). */
+UNIV_INTERN
+void
+srv_wake_purge_thread_if_not_active(void)
+/*=====================================*/
+{
+ ut_ad(!mutex_own(&kernel_mutex));
+
+ if (srv_n_purge_threads > 0
+ && srv_n_threads_active[SRV_WORKER] == 0) {
+
+ mutex_enter(&kernel_mutex);
+
+ srv_release_threads(SRV_WORKER, 1);
+
+ mutex_exit(&kernel_mutex);
+ }
+}
+
+/*******************************************************************//**
Wakes up the master thread if it is suspended or being suspended. */
UNIV_INTERN
void
@@ -2652,6 +2991,25 @@ srv_wake_master_thread(void)
mutex_exit(&kernel_mutex);
}
+/*******************************************************************//**
+Wakes up the purge thread if it's not already awake. */
+UNIV_INTERN
+void
+srv_wake_purge_thread(void)
+/*=======================*/
+{
+ ut_ad(!mutex_own(&kernel_mutex));
+
+ if (srv_n_purge_threads > 0) {
+
+ mutex_enter(&kernel_mutex);
+
+ srv_release_threads(SRV_WORKER, 1);
+
+ mutex_exit(&kernel_mutex);
+ }
+}
+
/**********************************************************************
The master thread is tasked to ensure that flush of log file happens
once every second in the background. This is to ensure that not more
@@ -2672,6 +3030,34 @@ srv_sync_log_buffer_in_background(void)
}
}
+/********************************************************************//**
+Do a full purge, reconfigure the purge sub-system if a dynamic
+change is detected. */
+static
+void
+srv_master_do_purge(void)
+/*=====================*/
+{
+ ulint n_pages_purged;
+
+ ut_ad(!mutex_own(&kernel_mutex));
+
+ ut_a(srv_n_purge_threads == 0);
+
+ do {
+ /* Check for shutdown and change in purge config. */
+ if (srv_fast_shutdown && srv_shutdown_state > 0) {
+ /* Nothing to purge. */
+ n_pages_purged = 0;
+ } else {
+ n_pages_purged = trx_purge(srv_purge_batch_size);
+ }
+
+ srv_sync_log_buffer_in_background();
+
+ } while (n_pages_purged > 0);
+}
+
/*********************************************************************//**
The master thread controlling the server.
@return a dummy parameter */
@@ -2683,19 +3069,30 @@ srv_master_thread(
/*!< in: a dummy parameter required by
os_thread_create */
{
- os_event_t event;
+ buf_pool_stat_t buf_stat;
+ srv_slot_t* slot;
ulint old_activity_count;
ulint n_pages_purged = 0;
ulint n_bytes_merged;
ulint n_pages_flushed;
+ ulint n_pages_flushed_prev = 0;
ulint n_bytes_archived;
ulint n_tables_to_drop;
ulint n_ios;
ulint n_ios_old;
ulint n_ios_very_old;
ulint n_pend_ios;
+ ulint next_itr_time;
+ ulint prev_adaptive_flushing_method = ULINT_UNDEFINED;
+ ulint inner_loop = 0;
ibool skip_sleep = FALSE;
ulint i;
+ struct t_prev_flush_info_struct {
+ ulint count;
+ unsigned space:32;
+ unsigned offset:32;
+ ib_uint64_t oldest_modification;
+ } prev_flush_info[MAX_BUFFER_POOLS];
ib_uint64_t lsn_old;
@@ -2705,13 +3102,18 @@ srv_master_thread(
fprintf(stderr, "Master thread starts, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
#endif
+
+#ifdef UNIV_PFS_THREAD
+ pfs_register_thread(srv_master_thread_key);
+#endif
+
srv_main_thread_process_no = os_proc_get_number();
srv_main_thread_id = os_thread_pf(os_thread_get_curr_id());
-
mutex_enter(&kernel_mutex);
- srv_table_reserve_slot(SRV_MASTER);
+ slot = srv_table_reserve_slot(SRV_MASTER);
+
srv_n_threads_active[SRV_MASTER]++;
mutex_exit(&kernel_mutex);
@@ -2726,8 +3128,9 @@ loop:
srv_main_thread_op_info = "reserving kernel mutex";
- n_ios_very_old = log_sys->n_log_ios + buf_pool->stat.n_pages_read
- + buf_pool->stat.n_pages_written;
+ buf_get_total_stat(&buf_stat);
+ n_ios_very_old = log_sys->n_log_ios + buf_stat.n_pages_read
+ + buf_stat.n_pages_written;
mutex_enter(&kernel_mutex);
/* Store the user activity counter at the start of this loop */
@@ -2744,17 +3147,50 @@ loop:
when there is database activity */
srv_last_log_flush_time = time(NULL);
+
+ /* Sleep for 1 second on entrying the for loop below the first time. */
+ next_itr_time = ut_time_ms() + 1000;
+
skip_sleep = FALSE;
for (i = 0; i < 10; i++) {
- n_ios_old = log_sys->n_log_ios + buf_pool->stat.n_pages_read
- + buf_pool->stat.n_pages_written;
+ ulint cur_time = ut_time_ms();
+
+ n_pages_flushed = 0; /* initialize */
+
+ /* ALTER TABLE in MySQL requires on Unix that the table handler
+ can drop tables lazily after there no longer are SELECT
+ queries to them. */
+
+ srv_main_thread_op_info = "doing background drop tables";
+
+ row_drop_tables_for_mysql_in_background();
+
+ srv_main_thread_op_info = "";
+
+ if (srv_fast_shutdown && srv_shutdown_state > 0) {
+
+ goto background_loop;
+ }
+
+ buf_get_total_stat(&buf_stat);
+
+ n_ios_old = log_sys->n_log_ios + buf_stat.n_pages_read
+ + buf_stat.n_pages_written;
+
srv_main_thread_op_info = "sleeping";
srv_main_1_second_loops++;
if (!skip_sleep) {
-
- os_thread_sleep(1000000);
+ if (next_itr_time > cur_time
+ && srv_shutdown_state == SRV_SHUTDOWN_NONE) {
+
+ /* Get sleep interval in micro seconds. We use
+ ut_min() to avoid long sleep in case of
+ wrap around. */
+ os_thread_sleep(ut_min(1000000,
+ (next_itr_time - cur_time)
+ * 1000));
srv_main_sleeps++;
/*
@@ -2771,22 +3207,11 @@ loop:
*/
}
- skip_sleep = FALSE;
+ /* Each iteration should happen at 1 second interval. */
+ next_itr_time = ut_time_ms() + 1000;
+ } /* if (!skip_sleep) */
- /* ALTER TABLE in MySQL requires on Unix that the table handler
- can drop tables lazily after there no longer are SELECT
- queries to them. */
-
- srv_main_thread_op_info = "doing background drop tables";
-
- row_drop_tables_for_mysql_in_background();
-
- srv_main_thread_op_info = "";
-
- if (srv_fast_shutdown && srv_shutdown_state > 0) {
-
- goto background_loop;
- }
+ skip_sleep = FALSE;
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
@@ -2795,13 +3220,14 @@ loop:
log_free_check();
/* If i/os during one second sleep were less than 5% of
- capacity, we assume that there is free disk i/o capacity
- available, and it makes sense to do an insert buffer merge. */
+ capacity, we assume that there is free disk i/o capacity
+ available, and it makes sense to do an insert buffer merge. */
+ buf_get_total_stat(&buf_stat);
n_pend_ios = buf_get_n_pending_ios()
+ log_sys->n_pending_writes;
- n_ios = log_sys->n_log_ios + buf_pool->stat.n_pages_read
- + buf_pool->stat.n_pages_written;
+ n_ios = log_sys->n_log_ios + buf_stat.n_pages_read
+ + buf_stat.n_pages_written;
if (n_pend_ios < SRV_PEND_IO_THRESHOLD
&& (n_ios - n_ios_old < SRV_RECENT_IO_ACTIVITY)) {
srv_main_thread_op_info = "doing insert buffer merge";
@@ -2819,21 +3245,14 @@ loop:
srv_main_thread_op_info =
"flushing buffer pool pages";
- n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST,
- PCT_IO(100),
- IB_ULONGLONG_MAX);
-
- /* If we had to do the flush, it may have taken
- even more than 1 second, and also, there may be more
- to flush. Do not sleep 1 second during the next
- iteration of this loop. */
-
- skip_sleep = TRUE;
+ n_pages_flushed = buf_flush_list(
+ PCT_IO(100), IB_ULONGLONG_MAX);
mutex_enter(&(log_sys->mutex));
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
- } else if (srv_adaptive_flushing) {
+ prev_adaptive_flushing_method = ULINT_UNDEFINED;
+ } else if (srv_adaptive_flushing && srv_adaptive_flushing_method == 0) {
/* Try to keep the rate of flushing of dirty
pages such that redo log generation does not
@@ -2845,63 +3264,16 @@ loop:
"flushing buffer pool pages";
n_flush = ut_min(PCT_IO(100), n_flush);
n_pages_flushed =
- buf_flush_batch(
- BUF_FLUSH_LIST,
+ buf_flush_list(
n_flush,
IB_ULONGLONG_MAX);
-
- if (n_flush == PCT_IO(100)) {
- skip_sleep = TRUE;
- }
}
mutex_enter(&(log_sys->mutex));
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
- } else if (srv_adaptive_checkpoint == 1) {
- /* adaptive_flushing option is prior to adaptive_checkpoint option, for now */
-
- /* Try to keep modified age not to exceed
- max_checkpoint_age * 7/8 line */
-
- mutex_enter(&(log_sys->mutex));
- lsn_old = log_sys->lsn;
- oldest_lsn = buf_pool_get_oldest_modification();
- if (oldest_lsn == 0) {
-
- mutex_exit(&(log_sys->mutex));
-
- } else {
- if ((log_sys->lsn - oldest_lsn)
- > (log_sys->max_checkpoint_age) - ((log_sys->max_checkpoint_age) / 8)) {
- /* LOG_POOL_PREFLUSH_RATIO_ASYNC is exceeded. */
- /* We should not flush from here. */
- mutex_exit(&(log_sys->mutex));
- } else if ((log_sys->lsn - oldest_lsn)
- > (log_sys->max_checkpoint_age) - ((log_sys->max_checkpoint_age) / 4)) {
-
- /* 2nd defence line (max_checkpoint_age * 3/4) */
-
- mutex_exit(&(log_sys->mutex));
-
- n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(100),
- IB_ULONGLONG_MAX);
- skip_sleep = TRUE;
- } else if ((log_sys->lsn - oldest_lsn)
- > (log_sys->max_checkpoint_age)/2 ) {
-
- /* 1st defence line (max_checkpoint_age * 1/2) */
-
- mutex_exit(&(log_sys->mutex));
-
- n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(10),
- IB_ULONGLONG_MAX);
- skip_sleep = TRUE;
- } else {
- mutex_exit(&(log_sys->mutex));
- }
- }
- } else if (srv_adaptive_checkpoint == 2) {
+ prev_adaptive_flushing_method = ULINT_UNDEFINED;
+ } else if (srv_adaptive_flushing && srv_adaptive_flushing_method == 1) {
/* Try to keep modified age not to exceed
max_checkpoint_age * 7/8 line */
@@ -2926,34 +3298,42 @@ loop:
/* defence line (max_checkpoint_age * 1/2) */
ib_uint64_t lsn = log_sys->lsn;
- ib_uint64_t level, bpl;
- buf_page_t* bpage;
+ ib_uint64_t level, bpl;
+ buf_page_t* bpage;
+ ulint j;
mutex_exit(&(log_sys->mutex));
- mutex_enter(&flush_list_mutex);
+ bpl = 0;
- level = 0;
- bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
+ for (j = 0; j < srv_buf_pool_instances; j++) {
+ buf_pool_t* buf_pool;
+ ulint n_blocks;
- while (bpage != NULL) {
- ib_uint64_t oldest_modification = bpage->oldest_modification;
- if (oldest_modification != 0) {
- level += log_sys->max_checkpoint_age
- - (lsn - oldest_modification);
+ buf_pool = buf_pool_from_array(j);
+
+ /* The scanning flush_list is optimistic here */
+
+ level = 0;
+ n_blocks = 0;
+ bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
+
+ while (bpage != NULL) {
+ ib_uint64_t oldest_modification = bpage->oldest_modification;
+ if (oldest_modification != 0) {
+ level += log_sys->max_checkpoint_age
+ - (lsn - oldest_modification);
+ }
+ bpage = UT_LIST_GET_NEXT(flush_list, bpage);
+ n_blocks++;
}
- bpage = UT_LIST_GET_NEXT(flush_list, bpage);
- }
- if (level) {
- bpl = ((ib_uint64_t) UT_LIST_GET_LEN(buf_pool->flush_list)
- * UT_LIST_GET_LEN(buf_pool->flush_list)
- * (lsn - lsn_old)) / level;
- } else {
- bpl = 0;
- }
+ if (level) {
+ bpl += ((ib_uint64_t) n_blocks * n_blocks
+ * (lsn - lsn_old)) / level;
+ }
- mutex_exit(&flush_list_mutex);
+ }
if (!srv_use_doublewrite_buf) {
/* flush is faster than when doublewrite */
@@ -2962,8 +3342,7 @@ loop:
if (bpl) {
retry_flush_batch:
- n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST,
- (ulint) bpl,
+ n_pages_flushed = buf_flush_list(bpl,
oldest_lsn + (lsn - lsn_old));
if (n_pages_flushed == ULINT_UNDEFINED) {
os_thread_sleep(5000);
@@ -2983,11 +3362,130 @@ retry_flush_batch:
mutex_exit(&(log_sys->mutex));
}
}
+ prev_adaptive_flushing_method = 1;
+ } else if (srv_adaptive_flushing && srv_adaptive_flushing_method == 2) {
+ buf_pool_t* buf_pool;
+ buf_page_t* bpage;
+ ib_uint64_t lsn;
+ ulint j;
+
+ mutex_enter(&(log_sys->mutex));
+ oldest_lsn = buf_pool_get_oldest_modification();
+ lsn = log_sys->lsn;
+ mutex_exit(&(log_sys->mutex));
+
+ /* upper loop/sec. (x10) */
+ next_itr_time -= 900; /* 1000 - 900 == 100 */
+ inner_loop++;
+ if (inner_loop < 10) {
+ i--;
+ } else {
+ inner_loop = 0;
+ }
+
+ if (prev_adaptive_flushing_method == 2) {
+ lint n_flush;
+ lint blocks_sum;
+ ulint new_blocks_sum, flushed_blocks_sum;
+
+ blocks_sum = new_blocks_sum = flushed_blocks_sum = 0;
+
+ /* prev_flush_info[j] should be the previous loop's */
+ for (j = 0; j < srv_buf_pool_instances; j++) {
+ lint blocks_num, new_blocks_num, flushed_blocks_num;
+ ibool found;
+
+ buf_pool = buf_pool_from_array(j);
+
+ blocks_num = UT_LIST_GET_LEN(buf_pool->flush_list);
+ bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
+ new_blocks_num = 0;
+
+ found = FALSE;
+ while (bpage != NULL) {
+ if (prev_flush_info[j].space == bpage->space
+ && prev_flush_info[j].offset == bpage->offset
+ && prev_flush_info[j].oldest_modification
+ == bpage->oldest_modification) {
+ found = TRUE;
+ break;
+ }
+ bpage = UT_LIST_GET_NEXT(flush_list, bpage);
+ new_blocks_num++;
+ }
+ if (!found) {
+ new_blocks_num = blocks_num;
+ }
+
+ flushed_blocks_num = new_blocks_num + prev_flush_info[j].count
+ - blocks_num;
+ if (flushed_blocks_num < 0) {
+ flushed_blocks_num = 0;
+ }
+
+ bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
+
+ prev_flush_info[j].count = UT_LIST_GET_LEN(buf_pool->flush_list);
+ if (bpage) {
+ prev_flush_info[j].space = bpage->space;
+ prev_flush_info[j].offset = bpage->offset;
+ prev_flush_info[j].oldest_modification = bpage->oldest_modification;
+ } else {
+ prev_flush_info[j].space = 0;
+ prev_flush_info[j].offset = 0;
+ prev_flush_info[j].oldest_modification = 0;
+ }
+ new_blocks_sum += new_blocks_num;
+ flushed_blocks_sum += flushed_blocks_num;
+ blocks_sum += blocks_num;
+ }
+
+ n_flush = blocks_sum * (lsn - lsn_old) / log_sys->max_modified_age_async;
+ if (flushed_blocks_sum > n_pages_flushed_prev) {
+ n_flush -= (flushed_blocks_sum - n_pages_flushed_prev);
+ }
+
+ if (n_flush > 0) {
+ n_flush++;
+ n_pages_flushed = buf_flush_list(n_flush, oldest_lsn + (lsn - lsn_old));
+ } else {
+ n_pages_flushed = 0;
+ }
+ } else {
+ /* store previous first pages of the flush_list */
+ for (j = 0; j < srv_buf_pool_instances; j++) {
+ buf_pool = buf_pool_from_array(j);
+
+ bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
+
+ prev_flush_info[j].count = UT_LIST_GET_LEN(buf_pool->flush_list);
+ if (bpage) {
+ prev_flush_info[j].space = bpage->space;
+ prev_flush_info[j].offset = bpage->offset;
+ prev_flush_info[j].oldest_modification = bpage->oldest_modification;
+ } else {
+ prev_flush_info[j].space = 0;
+ prev_flush_info[j].offset = 0;
+ prev_flush_info[j].oldest_modification = 0;
+ }
+ }
+ n_pages_flushed = 0;
+ }
+
+ lsn_old = lsn;
+ prev_adaptive_flushing_method = 2;
} else {
mutex_enter(&(log_sys->mutex));
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
+ prev_adaptive_flushing_method = ULINT_UNDEFINED;
+ }
+
+ if (n_pages_flushed == ULINT_UNDEFINED) {
+ n_pages_flushed_prev = 0;
+ } else {
+ n_pages_flushed_prev = n_pages_flushed;
}
if (srv_activity_count == old_activity_count) {
@@ -3016,17 +3514,17 @@ retry_flush_batch:
loop above requests writes for that case. The writes done here
are not required, and may be disabled. */
+ buf_get_total_stat(&buf_stat);
n_pend_ios = buf_get_n_pending_ios() + log_sys->n_pending_writes;
- n_ios = log_sys->n_log_ios + buf_pool->stat.n_pages_read
- + buf_pool->stat.n_pages_written;
+ n_ios = log_sys->n_log_ios + buf_stat.n_pages_read
+ + buf_stat.n_pages_written;
srv_main_10_second_loops++;
if (n_pend_ios < SRV_PEND_IO_THRESHOLD
&& (n_ios - n_ios_very_old < SRV_PAST_IO_ACTIVITY)) {
srv_main_thread_op_info = "flushing buffer pool pages";
- buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(100),
- IB_ULONGLONG_MAX);
+ buf_flush_list(PCT_IO(100), IB_ULONGLONG_MAX);
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
@@ -3041,23 +3539,15 @@ retry_flush_batch:
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
- if (!srv_use_purge_thread) {
- /* We run a full purge every 10 seconds, even if the server
- were active */
- do {
+ if (srv_n_purge_threads == 0) {
+ srv_main_thread_op_info = "master purging";
+
+ srv_master_do_purge();
if (srv_fast_shutdown && srv_shutdown_state > 0) {
goto background_loop;
}
-
- srv_main_thread_op_info = "purging";
- n_pages_purged = trx_purge();
-
- /* Flush logs if needed */
- srv_sync_log_buffer_in_background();
-
- } while (n_pages_purged);
}
srv_main_thread_op_info = "flushing buffer pool pages";
@@ -3070,17 +3560,15 @@ retry_flush_batch:
(> 70 %), we assume we can afford reserving the disk(s) for
the time it requires to flush 100 pages */
- n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST,
- PCT_IO(100),
- IB_ULONGLONG_MAX);
+ n_pages_flushed = buf_flush_list(
+ PCT_IO(100), IB_ULONGLONG_MAX);
} else {
/* Otherwise, we only flush a small number of pages so that
we do not unnecessarily use much disk i/o capacity from
other work */
- n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST,
- PCT_IO(10),
- IB_ULONGLONG_MAX);
+ n_pages_flushed = buf_flush_list(
+ PCT_IO(10), IB_ULONGLONG_MAX);
}
srv_main_thread_op_info = "making checkpoint";
@@ -3124,26 +3612,15 @@ background_loop:
MySQL tries to drop a table while there are still open handles
to it and we had to put it to the background drop queue.) */
- os_thread_sleep(100000);
- }
-
- if (!srv_use_purge_thread) {
- srv_main_thread_op_info = "purging";
-
- /* Run a full purge */
- do {
- if (srv_fast_shutdown && srv_shutdown_state > 0) {
-
- break;
+ if (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
+ os_thread_sleep(100000);
}
+ }
- srv_main_thread_op_info = "purging";
- n_pages_purged = trx_purge();
+ if (srv_n_purge_threads == 0) {
+ srv_main_thread_op_info = "master purging";
- /* Flush logs if needed */
- srv_sync_log_buffer_in_background();
-
- } while (n_pages_purged);
+ srv_master_do_purge();
}
srv_main_thread_op_info = "reserving kernel mutex";
@@ -3162,7 +3639,7 @@ background_loop:
} else {
/* This should do an amount of IO similar to the number of
dirty pages that will be flushed in the call to
- buf_flush_batch below. Otherwise, the system favors
+ buf_flush_list below. Otherwise, the system favors
clean pages over cleanup throughput. */
n_bytes_merged = ibuf_contract_for_n_pages(FALSE,
PCT_IBUF_IO(100));
@@ -3181,9 +3658,8 @@ flush_loop:
srv_main_thread_op_info = "flushing buffer pool pages";
srv_main_flush_loops++;
if (srv_fast_shutdown < 2) {
- n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST,
- PCT_IO(100),
- IB_ULONGLONG_MAX);
+ n_pages_flushed = buf_flush_list(
+ PCT_IO(100), IB_ULONGLONG_MAX);
} else {
/* In the fastest shutdown we do not flush the buffer pool
to data files: we set n_pages_flushed to 0 artificially. */
@@ -3201,7 +3677,7 @@ flush_loop:
mutex_exit(&kernel_mutex);
srv_main_thread_op_info = "waiting for buffer pool flush to end";
- buf_flush_wait_batch_end(BUF_FLUSH_LIST);
+ buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
@@ -3271,7 +3747,7 @@ suspend_thread:
goto loop;
}
- event = srv_suspend_thread();
+ srv_suspend_thread(slot);
mutex_exit(&kernel_mutex);
@@ -3281,12 +3757,9 @@ suspend_thread:
manual also mentions this string in several places. */
srv_main_thread_op_info = "waiting for server activity";
- os_event_wait(event);
+ os_event_wait(slot->event);
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
- /* This is only extra safety, the thread should exit
- already when the event wait ends */
-
os_thread_exit(NULL);
}
@@ -3294,147 +3767,145 @@ suspend_thread:
main thread goes back to loop. */
goto loop;
-
- OS_THREAD_DUMMY_RETURN; /* Not reached, avoid compiler warning */
}
-/*************************************************************************
-A thread which is devoted to purge, for take over the master thread's
-purging */
+/*********************************************************************//**
+Asynchronous purge thread.
+@return a dummy parameter */
UNIV_INTERN
os_thread_ret_t
srv_purge_thread(
/*=============*/
- void* arg __attribute__((unused)))
- /* in: a dummy parameter required by os_thread_create */
+ void* arg __attribute__((unused))) /*!< in: a dummy parameter
+ required by os_thread_create */
{
- ulint n_pages_purged;
- ulint n_pages_purged_sum = 1; /* dummy */
- ulint history_len;
- ulint sleep_ms= 10000; /* initial: 10 sec. */
- ibool can_be_last = FALSE;
+ srv_slot_t* slot;
+ ulint retries = 0;
+ ulint n_total_purged = ULINT_UNDEFINED;
+ ulint next_itr_time;
+
+ ut_a(srv_n_purge_threads == 1);
+
+#ifdef UNIV_PFS_THREAD
+ pfs_register_thread(srv_purge_thread_key);
+#endif /* UNIV_PFS_THREAD */
#ifdef UNIV_DEBUG_THREAD_CREATION
- fprintf(stderr, "Purge thread starts, id %lu\n",
+ fprintf(stderr, "InnoDB: Purge thread running, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
-#endif
+#endif /* UNIV_DEBUG_THREAD_CREATION */
mutex_enter(&kernel_mutex);
- srv_table_reserve_slot(SRV_PURGE);
- srv_n_threads_active[SRV_PURGE]++;
+
+ slot = srv_table_reserve_slot(SRV_WORKER);
+
+ ++srv_n_threads_active[SRV_WORKER];
+
mutex_exit(&kernel_mutex);
-loop:
- if (srv_shutdown_state > 0) {
- if (srv_fast_shutdown) {
- /* someone other should wait the end of the workers */
- goto exit_func;
- }
+ next_itr_time = ut_time_ms();
- mutex_enter(&kernel_mutex);
- if (srv_n_threads_active[SRV_PURGE_WORKER]) {
- can_be_last = FALSE;
- } else {
- can_be_last = TRUE;
- }
- mutex_exit(&kernel_mutex);
+ while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) {
- sleep_ms = 10;
- os_event_reset(srv_purge_thread_event);
- }
+ ulint n_pages_purged = 0;
+ ulint cur_time;
- os_event_wait_time(srv_purge_thread_event, sleep_ms * 1000);
+ /* If there are very few records to purge or the last
+ purge didn't purge any records then wait for activity.
+ We peek at the history len without holding any mutex
+ because in the worst case we will end up waiting for
+ the next purge event. */
+ if (trx_sys->rseg_history_len < srv_purge_batch_size
+ || (n_total_purged == 0
+ && retries >= TRX_SYS_N_RSEGS)) {
- history_len = trx_sys->rseg_history_len;
- if (history_len > 1000)
- sleep_ms /= 10;
- if (sleep_ms < 10)
- sleep_ms = 10;
+ mutex_enter(&kernel_mutex);
- n_pages_purged_sum = 0;
+ srv_suspend_thread(slot);
- do {
- if (srv_fast_shutdown && srv_shutdown_state > 0) {
- goto exit_func;
+ mutex_exit(&kernel_mutex);
+
+ os_event_wait(slot->event);
+
+ retries = 0;
}
- n_pages_purged = trx_purge();
- n_pages_purged_sum += n_pages_purged;
- } while (n_pages_purged);
- if (srv_shutdown_state > 0 && can_be_last) {
- /* the last trx_purge() is executed without workers */
- goto exit_func;
- }
+ /* Check for shutdown and whether we should do purge at all. */
+ if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND
+ || srv_shutdown_state != 0
+ || srv_fast_shutdown) {
- if (n_pages_purged_sum) {
- srv_active_wake_master_thread();
- }
+ break;
+ }
- if (n_pages_purged_sum == 0)
- sleep_ms *= 10;
- if (sleep_ms > 10000)
- sleep_ms = 10000;
+ if (n_total_purged == 0 && retries <= TRX_SYS_N_RSEGS) {
+ ++retries;
+ } else if (n_total_purged > 0) {
+ retries = 0;
+ n_total_purged = 0;
+ }
- goto loop;
+ /* Purge until there are no more records to purge and there is
+ no change in configuration or server state. */
+ do {
+ n_pages_purged = trx_purge(srv_purge_batch_size);
-exit_func:
- trx_purge_worker_wake(); /* It may not make sense. for safety only */
+ n_total_purged += n_pages_purged;
- /* wake master thread to flush the pages */
- srv_wake_master_thread();
+ } while (n_pages_purged > 0 && !srv_fast_shutdown);
+
+ srv_sync_log_buffer_in_background();
+
+ cur_time = ut_time_ms();
+ os_event_reset(srv_purge_thread_event);
+ if (next_itr_time > cur_time) {
+ os_event_wait_time(srv_purge_thread_event,
+ ut_min(1000000,
+ (next_itr_time - cur_time)
+ * 1000));
+ next_itr_time = ut_time_ms() + 1000;
+ } else {
+ next_itr_time = cur_time + 1000;
+ }
+ }
mutex_enter(&kernel_mutex);
- srv_n_threads_active[SRV_PURGE]--;
- mutex_exit(&kernel_mutex);
- os_thread_exit(NULL);
- OS_THREAD_DUMMY_RETURN;
-}
+ /* Decrement the active count. */
+ srv_suspend_thread(slot);
-/*************************************************************************
-A thread which is devoted to purge, for take over the master thread's
-purging */
-UNIV_INTERN
-os_thread_ret_t
-srv_purge_worker_thread(
-/*====================*/
- void* arg)
-{
- ulint worker_id; /* index for array */
+ slot->in_use = FALSE;
- worker_id = *((ulint*)arg);
+ mutex_exit(&kernel_mutex);
#ifdef UNIV_DEBUG_THREAD_CREATION
- fprintf(stderr, "Purge worker thread starts, id %lu\n",
+ fprintf(stderr, "InnoDB: Purge thread exiting, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
-#endif
- mutex_enter(&kernel_mutex);
- srv_table_reserve_slot(SRV_PURGE_WORKER);
- srv_n_threads_active[SRV_PURGE_WORKER]++;
- mutex_exit(&kernel_mutex);
+#endif /* UNIV_DEBUG_THREAD_CREATION */
-loop:
- /* purge worker threads only works when srv_shutdown_state==0 */
- /* for safety and exactness. */
- if (srv_shutdown_state > 0) {
- goto exit_func;
- }
+ /* We count the number of threads in os_thread_exit(). A created
+ thread should always use that to exit and not use return() to exit. */
+ os_thread_exit(NULL);
+
+ OS_THREAD_DUMMY_RETURN; /* Not reached, avoid compiler warning */
+}
- trx_purge_worker_wait();
+/**********************************************************************//**
+Enqueues a task to server task queue and releases a worker thread, if there
+is a suspended one. */
+UNIV_INTERN
+void
+srv_que_task_enqueue_low(
+/*=====================*/
+ que_thr_t* thr) /*!< in: query thread */
+{
+ ut_ad(thr);
- if (srv_shutdown_state > 0) {
- goto exit_func;
- }
+ mutex_enter(&kernel_mutex);
- trx_purge_worker(worker_id);
+ UT_LIST_ADD_LAST(queue, srv_sys->tasks, thr);
- goto loop;
+ srv_release_threads(SRV_WORKER, 1);
-exit_func:
- mutex_enter(&kernel_mutex);
- srv_n_threads_active[SRV_PURGE_WORKER]--;
mutex_exit(&kernel_mutex);
- os_thread_exit(NULL);
-
- OS_THREAD_DUMMY_RETURN;
}
diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c
index b36faf2d2d7..71364cb5ded 100644
--- a/storage/xtradb/srv/srv0start.c
+++ b/storage/xtradb/srv/srv0start.c
@@ -85,7 +85,6 @@ Created 2/16/1996 Heikki Tuuri
# include "row0row.h"
# include "row0mysql.h"
# include "btr0pcur.h"
-# include "thr0loc.h"
# include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
# include "zlib.h" /* for ZLIB_VERSION */
@@ -120,15 +119,10 @@ UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE;
/** Files comprising the system tablespace */
static os_file_t files[1000];
-/** Mutex protecting the ios count */
-static mutex_t ios_mutex;
-/** Count of I/O operations in io_handler_thread() */
-static ulint ios;
-
/** io_handler_thread parameters for thread identification */
-static ulint n[SRV_MAX_N_IO_THREADS + 7 + 64];
+static ulint n[SRV_MAX_N_IO_THREADS + 7];
/** io_handler_thread identifiers */
-static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 7 + 64];
+static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 7];
/** We use this mutex to test the return value of pthread_mutex_trylock
on successful locking. HP-UX does NOT return 0, though Linux et al do. */
@@ -142,6 +136,15 @@ static char* srv_monitor_file_name;
#define SRV_N_PENDING_IOS_PER_THREAD OS_AIO_N_PENDING_IOS_PER_THREAD
#define SRV_MAX_N_PENDING_SYNC_IOS 100
+#ifdef UNIV_PFS_THREAD
+/* Keys to register InnoDB threads with performance schema */
+UNIV_INTERN mysql_pfs_key_t io_handler_thread_key;
+UNIV_INTERN mysql_pfs_key_t srv_lock_timeout_thread_key;
+UNIV_INTERN mysql_pfs_key_t srv_error_monitor_thread_key;
+UNIV_INTERN mysql_pfs_key_t srv_monitor_thread_key;
+UNIV_INTERN mysql_pfs_key_t srv_master_thread_key;
+UNIV_INTERN mysql_pfs_key_t srv_purge_thread_key;
+#endif /* UNIV_PFS_THREAD */
/*********************************************************************//**
Convert a numeric string that optionally ends in G or M, to a number
@@ -463,7 +466,6 @@ io_handler_thread(
the aio array */
{
ulint segment;
- ulint i;
segment = *((ulint*)arg);
@@ -471,15 +473,14 @@ io_handler_thread(
fprintf(stderr, "Io handler thread %lu starts, id %lu\n", segment,
os_thread_pf(os_thread_get_curr_id()));
#endif
- for (i = 0;; i++) {
- fil_aio_wait(segment);
- mutex_enter(&ios_mutex);
- ios++;
- mutex_exit(&ios_mutex);
- }
+#ifdef UNIV_PFS_THREAD
+ pfs_register_thread(io_handler_thread_key);
+#endif /* UNIV_PFS_THREAD */
- thr_local_free(os_thread_get_curr_id());
+ while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) {
+ fil_aio_wait(segment);
+ }
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit.
@@ -584,7 +585,8 @@ open_or_create_log_file(
sprintf(name + dirnamelen, "%s%lu", "ib_logfile", (ulong) i);
- files[i] = os_file_create(name, OS_FILE_CREATE, OS_FILE_NORMAL,
+ files[i] = os_file_create(innodb_file_log_key, name,
+ OS_FILE_CREATE, OS_FILE_NORMAL,
OS_LOG_FILE, &ret);
if (ret == FALSE) {
if (os_file_get_last_error(FALSE) != OS_FILE_ALREADY_EXISTS
@@ -602,7 +604,8 @@ open_or_create_log_file(
return(DB_ERROR);
}
- files[i] = os_file_create(name, OS_FILE_OPEN, OS_FILE_AIO,
+ files[i] = os_file_create(innodb_file_log_key, name,
+ OS_FILE_OPEN, OS_FILE_AIO,
OS_LOG_FILE, &ret);
if (!ret) {
fprintf(stderr,
@@ -769,7 +772,8 @@ open_or_create_data_files(
/* First we try to create the file: if it already
exists, ret will get value FALSE */
- files[i] = os_file_create(name, OS_FILE_CREATE,
+ files[i] = os_file_create(innodb_file_data_key,
+ name, OS_FILE_CREATE,
OS_FILE_NORMAL,
OS_DATA_FILE, &ret);
@@ -796,7 +800,8 @@ open_or_create_data_files(
srv_start_raw_disk_in_use = TRUE;
srv_created_new_raw = TRUE;
- files[i] = os_file_create(name, OS_FILE_OPEN_RAW,
+ files[i] = os_file_create(innodb_file_data_key,
+ name, OS_FILE_OPEN_RAW,
OS_FILE_NORMAL,
OS_DATA_FILE, &ret);
if (!ret) {
@@ -829,14 +834,17 @@ open_or_create_data_files(
if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
files[i] = os_file_create(
+ innodb_file_data_key,
name, OS_FILE_OPEN_RAW,
OS_FILE_NORMAL, OS_DATA_FILE, &ret);
} else if (i == 0) {
files[i] = os_file_create(
+ innodb_file_data_key,
name, OS_FILE_OPEN_RETRY,
OS_FILE_NORMAL, OS_DATA_FILE, &ret);
} else {
files[i] = os_file_create(
+ innodb_file_data_key,
name, OS_FILE_OPEN, OS_FILE_NORMAL,
OS_DATA_FILE, &ret);
}
@@ -983,17 +991,17 @@ skip_size_check:
srv_normalize_path_for_win(srv_doublewrite_file);
fprintf(stderr,
- "InnoDB: Notice: innodb_doublewrite_file is specified.\n"
- "InnoDB: This is for expert only. Don't use if you don't understand what is it 'WELL'.\n"
- "InnoDB: ### Don't specify older file than the last checkpoint ###\n"
- "InnoDB: otherwise the older doublewrite buffer will break your data during recovery!\n");
+ "InnoDB: Note: The innodb_doublewrite_file option has been specified.\n"
+ "InnoDB: This option is for experts only. Don't use it unless you understand WELL what it is.\n"
+ "InnoDB: ### Don't specify a file older than the last checkpoint. ###\n"
+ "InnoDB: Otherwise, the older doublewrite buffer will break your data during recovery!\n");
strcpy(name, srv_doublewrite_file);
/* First we try to create the file: if it already
exists, ret will get value FALSE */
- files[i] = os_file_create(name, OS_FILE_CREATE,
+ files[i] = os_file_create(innodb_file_data_key, name, OS_FILE_CREATE,
OS_FILE_NORMAL,
OS_DATA_FILE, &ret);
@@ -1017,7 +1025,7 @@ skip_size_check:
if (ret == FALSE) {
/* We open the data file */
- files[i] = os_file_create(
+ files[i] = os_file_create(innodb_file_data_key,
name, OS_FILE_OPEN, OS_FILE_NORMAL,
OS_DATA_FILE, &ret);
@@ -1067,12 +1075,12 @@ skip_size_check:
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Doublewrite buffer file %s did not"
- " exist: new to be created\n",
+ " exist. It will be be created.\n",
name);
if (*create_new_db == FALSE) {
fprintf(stderr,
- "InnoDB: Warning: Previous version's ibdata files may cause crash.\n"
+ "InnoDB: Notice: Previous version's ibdata files may cause crash.\n"
" If you use that, please use the ibdata files of this version.\n");
}
@@ -1113,10 +1121,6 @@ skip_size_check:
i++;
}
- ios = 0;
-
- mutex_create(&ios_mutex, SYNC_NO_ORDER_CHECK);
-
return(DB_SUCCESS);
}
@@ -1129,7 +1133,6 @@ int
innobase_start_or_create_for_mysql(void)
/*====================================*/
{
- buf_pool_t* ret;
ibool create_new_db;
ibool create_new_doublewrite_file;
ibool log_file_created;
@@ -1161,26 +1164,35 @@ innobase_start_or_create_for_mysql(void)
on Mac OS X 10.3 or later. */
struct utsname utsname;
if (uname(&utsname)) {
- fputs("InnoDB: cannot determine Mac OS X version!\n", stderr);
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: cannot determine Mac OS X version!\n", stderr);
} else {
srv_have_fullfsync = strcmp(utsname.release, "7.") >= 0;
}
if (!srv_have_fullfsync) {
- fputs("InnoDB: On Mac OS X, fsync() may be"
- " broken on internal drives,\n"
- "InnoDB: making transactions unsafe!\n", stderr);
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: On Mac OS X, fsync() may be "
+ "broken on internal drives,\n", stderr);
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: making transactions unsafe!\n", stderr);
}
# endif /* F_FULLFSYNC */
#endif /* HAVE_DARWIN_THREADS */
if (sizeof(ulint) != sizeof(void*)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: size of InnoDB's ulint is %lu, "
+ "but size of void*\n", (ulong) sizeof(ulint));
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Error: size of InnoDB's ulint is %lu,"
- " but size of void* is %lu.\n"
- "InnoDB: The sizes should be the same"
- " so that on a 64-bit platform you can\n"
- "InnoDB: allocate more than 4 GB of memory.",
- (ulong)sizeof(ulint), (ulong)sizeof(void*));
+ " InnoDB: is %lu. The sizes should be the same "
+ "so that on a 64-bit\n",
+ (ulong) sizeof(void*));
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: platforms you can allocate more than 4 GB "
+ "of memory.\n");
}
/* System tables are created in tablespace 0. Thus, we must
@@ -1189,53 +1201,74 @@ innobase_start_or_create_for_mysql(void)
innodb_file_per_table) until this function has returned. */
srv_file_per_table = FALSE;
#ifdef UNIV_DEBUG
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
+ " InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_IBUF_DEBUG
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
+ " InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n");
# ifdef UNIV_IBUF_COUNT_DEBUG
- "InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
- "InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on "
+ "!!!!!!!!!\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n");
# endif
- );
#endif
+#ifdef UNIV_BLOB_DEBUG
+ fprintf(stderr,
+ "InnoDB: !!!!!!!! UNIV_BLOB_DEBUG switched on !!!!!!!!!\n"
+ "InnoDB: Server restart may fail with UNIV_BLOB_DEBUG\n");
+#endif /* UNIV_BLOB_DEBUG */
+
#ifdef UNIV_SYNC_DEBUG
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
+ " InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_SEARCH_DEBUG
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n");
+ " InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_LOG_LSN_DEBUG
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n");
+ " InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n");
#endif /* UNIV_LOG_LSN_DEBUG */
#ifdef UNIV_MEM_DEBUG
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
+ " InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
#endif
if (UNIV_LIKELY(srv_use_sys_malloc)) {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: The InnoDB memory heap is disabled\n");
+ " InnoDB: The InnoDB memory heap is disabled\n");
}
- fputs("InnoDB: " IB_ATOMICS_STARTUP_MSG
- "\nInnoDB: Compressed tables use zlib " ZLIB_VERSION
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: " IB_ATOMICS_STARTUP_MSG "\n", stderr);
+
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: Compressed tables use zlib " ZLIB_VERSION
#ifdef UNIV_ZIP_DEBUG
" with validation"
#endif /* UNIV_ZIP_DEBUG */
+ "\n" , stderr);
#ifdef UNIV_ZIP_COPY
- " and extra copying"
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: and extra copying\n", stderr);
#endif /* UNIV_ZIP_COPY */
- "\n" , stderr);
/* Since InnoDB does not currently clean up all its internal data
structures in MySQL Embedded Server Library server_end(), we
@@ -1243,13 +1276,17 @@ innobase_start_or_create_for_mysql(void)
second time during the process lifetime. */
if (srv_start_has_been_called) {
- fprintf(stderr,
- "InnoDB: Error: startup called second time"
- " during the process lifetime.\n"
- "InnoDB: In the MySQL Embedded Server Library"
- " you cannot call server_init()\n"
- "InnoDB: more than once during"
- " the process lifetime.\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Error: startup called second time "
+ "during the process\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: lifetime. In the MySQL Embedded "
+ "Server Library you\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: cannot call server_init() more "
+ "than once during the\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: process lifetime.\n");
}
srv_start_has_been_called = TRUE;
@@ -1261,7 +1298,6 @@ innobase_start_or_create_for_mysql(void)
srv_is_being_started = TRUE;
srv_startup_is_before_trx_rollback_phase = TRUE;
- os_aio_use_native_aio = FALSE;
#ifdef __WIN__
switch (os_get_os_version()) {
@@ -1273,19 +1309,37 @@ innobase_start_or_create_for_mysql(void)
but when run in conjunction with InnoDB Hot Backup, it seemed
to corrupt the data files. */
- os_aio_use_native_aio = FALSE;
+ srv_use_native_aio = FALSE;
+ break;
+
+ case OS_WIN2000:
+ case OS_WINXP:
+ /* On 2000 and XP, async IO is available. */
+ srv_use_native_aio = TRUE;
break;
+
default:
- /* On Win 2000 and XP use async i/o */
- //os_aio_use_native_aio = TRUE;
- os_aio_use_native_aio = FALSE;
- fprintf(stderr,
- "InnoDB: Windows native async i/o is disabled as default.\n"
- "InnoDB: It is not applicable for the current"
- " multi io threads implementation.\n");
+ /* Vista and later have both async IO and condition variables */
+ srv_use_native_aio = TRUE;
+ srv_use_native_conditions = TRUE;
break;
}
+
+#elif defined(LINUX_NATIVE_AIO)
+
+ if (srv_use_native_aio) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Using Linux native AIO\n");
+ }
+#else
+ /* Currently native AIO is supported only on windows and linux
+ and that also when the support is compiled in. In all other
+ cases, we ignore the setting of innodb_use_native_aio. */
+ srv_use_native_aio = FALSE;
+
#endif
+
if (srv_file_flush_method_str == NULL) {
/* These are the default options */
@@ -1313,25 +1367,20 @@ innobase_start_or_create_for_mysql(void)
#else
} else if (0 == ut_strcmp(srv_file_flush_method_str, "normal")) {
srv_win_file_flush_method = SRV_WIN_IO_NORMAL;
- os_aio_use_native_aio = FALSE;
+ srv_use_native_aio = FALSE;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "unbuffered")) {
srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
- os_aio_use_native_aio = FALSE;
+ srv_use_native_aio = FALSE;
} else if (0 == ut_strcmp(srv_file_flush_method_str,
"async_unbuffered")) {
srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
- os_aio_use_native_aio = TRUE;
- srv_n_read_io_threads = srv_n_write_io_threads = 1;
- fprintf(stderr,
- "InnoDB: 'async_unbuffered' was detected as innodb_flush_method.\n"
- "InnoDB: Windows native async i/o is enabled.\n"
- "InnoDB: And io threads are restricted.\n");
#endif
} else {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Unrecognized value %s for"
+ " InnoDB: Unrecognized value %s for"
" innodb_flush_method\n",
srv_file_flush_method_str);
return(DB_ERROR);
@@ -1345,28 +1394,23 @@ innobase_start_or_create_for_mysql(void)
maximum number of threads that can wait in the 'srv_conc array' for
their time to enter InnoDB. */
-#if defined(__NETWARE__)
-
- /* Create less event semaphores because Win 98/ME had
- difficulty creating 40000 event semaphores. Comment from
- Novell, Inc.: also, these just take a lot of memory on
- NetWare. */
- srv_max_n_threads = 1000;
-#else
if (srv_buf_pool_size >= 1000 * 1024 * 1024) {
/* If buffer pool is less than 1000 MB,
- assume fewer threads. */
+ assume fewer threads. Also use only one
+ buffer pool instance */
srv_max_n_threads = 50000;
} else if (srv_buf_pool_size >= 8 * 1024 * 1024) {
+ srv_buf_pool_instances = 1;
srv_max_n_threads = 10000;
} else {
+ srv_buf_pool_instances = 1;
srv_max_n_threads = 1000; /* saves several MB of memory,
especially in 64-bit
computers */
}
-#endif
+
err = srv_boot();
if (err != DB_SUCCESS) {
@@ -1374,7 +1418,8 @@ innobase_start_or_create_for_mysql(void)
return((int) err);
}
- mutex_create(&srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK);
+ mutex_create(srv_monitor_file_mutex_key,
+ &srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK);
if (srv_innodb_status) {
srv_monitor_file_name = mem_alloc(
@@ -1396,14 +1441,16 @@ innobase_start_or_create_for_mysql(void)
}
}
- mutex_create(&srv_dict_tmpfile_mutex, SYNC_DICT_OPERATION);
+ mutex_create(srv_dict_tmpfile_mutex_key,
+ &srv_dict_tmpfile_mutex, SYNC_DICT_OPERATION);
srv_dict_tmpfile = os_file_create_tmpfile();
if (!srv_dict_tmpfile) {
return(DB_ERROR);
}
- mutex_create(&srv_misc_tmpfile_mutex, SYNC_ANY_LATCH);
+ mutex_create(srv_misc_tmpfile_mutex_key,
+ &srv_misc_tmpfile_mutex, SYNC_ANY_LATCH);
srv_misc_tmpfile = os_file_create_tmpfile();
if (!srv_misc_tmpfile) {
@@ -1414,7 +1461,8 @@ innobase_start_or_create_for_mysql(void)
we'll emit a message telling the user that this parameter
is now deprecated. */
if (srv_n_file_io_threads != 4) {
- fprintf(stderr, "InnoDB: Warning:"
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Warning:"
" innodb_file_io_threads is deprecated."
" Please use innodb_read_io_threads and"
" innodb_write_io_threads instead\n");
@@ -1426,13 +1474,16 @@ innobase_start_or_create_for_mysql(void)
ut_a(srv_n_file_io_threads <= SRV_MAX_N_IO_THREADS);
- /* TODO: Investigate if SRV_N_PENDING_IOS_PER_THREAD (32) limit
- still applies to windows. */
- if (!os_aio_use_native_aio) {
- io_limit = 8 * SRV_N_PENDING_IOS_PER_THREAD;
- } else {
+ io_limit = 8 * SRV_N_PENDING_IOS_PER_THREAD;
+
+ /* On Windows when using native aio the number of aio requests
+ that a thread can handle at a given time is limited to 32
+ i.e.: SRV_N_PENDING_IOS_PER_THREAD */
+# ifdef __WIN__
+ if (srv_use_native_aio) {
io_limit = SRV_N_PENDING_IOS_PER_THREAD;
}
+# endif /* __WIN__ */
os_aio_init(io_limit,
srv_n_read_io_threads,
@@ -1442,11 +1493,31 @@ innobase_start_or_create_for_mysql(void)
fil_init(srv_file_per_table ? 50000 : 5000,
srv_max_n_open_files);
- ret = buf_pool_init();
+ /* Print time to initialize the buffer pool */
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Initializing buffer pool, size =");
+
+ if (srv_buf_pool_size >= 1024 * 1024 * 1024) {
+ fprintf(stderr,
+ " %.1fG\n",
+ ((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
+ } else {
+ fprintf(stderr,
+ " %.1fM\n",
+ ((double) srv_buf_pool_size) / (1024 * 1024));
+ }
+
+ err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_instances);
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Completed initialization of buffer pool\n");
- if (ret == NULL) {
+ if (err != DB_SUCCESS) {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Fatal error: cannot allocate the memory"
+ " InnoDB: Fatal error: cannot allocate memory"
" for the buffer pool\n");
return(DB_ERROR);
@@ -1458,7 +1529,8 @@ innobase_start_or_create_for_mysql(void)
if (srv_buf_pool_size <= 5 * 1024 * 1024) {
- fprintf(stderr, "InnoDB: Warning: Small buffer pool size "
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Warning: Small buffer pool size "
"(%luM), the flst_validate() debug function "
"can cause a deadlock if the buffer pool fills up.\n",
srv_buf_pool_size / 1024 / 1024);
@@ -1480,10 +1552,10 @@ innobase_start_or_create_for_mysql(void)
#ifdef UNIV_LOG_ARCHIVE
if (0 != ut_strcmp(srv_log_group_home_dirs[0], srv_arch_dir)) {
- fprintf(stderr,
- "InnoDB: Error: you must set the log group"
- " home dir in my.cnf the\n"
- "InnoDB: same as log arch dir.\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Error: you must set the log group home dir in my.cnf\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: the same as log arch dir.\n");
return(DB_ERROR);
}
@@ -1492,8 +1564,9 @@ innobase_start_or_create_for_mysql(void)
if (sizeof(ulint) == 4
&& srv_n_log_files * srv_log_file_size
>= ((ulint)1 << (32 - UNIV_PAGE_SIZE_SHIFT))) {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Error: combined size of log files"
+ " InnoDB: Error: combined size of log files"
" must be < 4 GB on 32-bit systems\n");
return(DB_ERROR);
@@ -1504,10 +1577,13 @@ innobase_start_or_create_for_mysql(void)
for (i = 0; i < srv_n_data_files; i++) {
#ifndef __WIN__
if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= ((ulint)1 << (32 - UNIV_PAGE_SIZE_SHIFT))) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: file size must be < 4 GB"
+ " with this MySQL binary\n");
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Error: file size must be < 4 GB"
- " with this MySQL binary\n"
- "InnoDB: and operating system combination,"
+ " InnoDB: and operating system combination,"
" in some OS's < 2 GB\n");
return(DB_ERROR);
@@ -1517,8 +1593,9 @@ innobase_start_or_create_for_mysql(void)
}
if (sum_of_new_sizes < 10485760 / UNIV_PAGE_SIZE) {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Error: tablespace size must be"
+ " InnoDB: Error: tablespace size must be"
" at least 10 MB\n");
return(DB_ERROR);
@@ -1532,19 +1609,32 @@ innobase_start_or_create_for_mysql(void)
&min_flushed_lsn, &max_flushed_lsn,
&sum_of_new_sizes);
if (err != DB_SUCCESS) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Could not open or create data files.\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: If you tried to add new data files,"
+ " and it failed here,\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: you should now edit innodb_data_file_path"
+ " in my.cnf back\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: to what it was, and remove the"
+ " new ibdata files InnoDB created\n");
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Could not open or create data files.\n"
- "InnoDB: If you tried to add new data files,"
- " and it failed here,\n"
- "InnoDB: you should now edit innodb_data_file_path"
- " in my.cnf back\n"
- "InnoDB: to what it was, and remove the"
- " new ibdata files InnoDB created\n"
- "InnoDB: in this failed attempt. InnoDB only wrote"
- " those files full of\n"
- "InnoDB: zeros, but did not yet use them in any way."
- " But be careful: do not\n"
- "InnoDB: remove old data files"
+ " InnoDB: in this failed attempt. InnoDB only wrote"
+ " those files full of\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: zeros, but did not yet use them in any way."
+ " But be careful: do not\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: remove old data files"
" which contain your precious data!\n");
return((int) err);
@@ -1570,18 +1660,29 @@ innobase_start_or_create_for_mysql(void)
}
if ((log_opened && create_new_db)
|| (log_opened && log_created)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: all log files must be"
+ " created at the same time.\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: All log files must be"
+ " created also in database creation.\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: If you want bigger or smaller"
+ " log files, shut down the\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: database and make sure there"
+ " were no errors in shutdown.\n");
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Error: all log files must be"
- " created at the same time.\n"
- "InnoDB: All log files must be"
- " created also in database creation.\n"
- "InnoDB: If you want bigger or smaller"
- " log files, shut down the\n"
- "InnoDB: database and make sure there"
- " were no errors in shutdown.\n"
- "InnoDB: Then delete the existing log files."
- " Edit the .cnf file\n"
- "InnoDB: and start the database again.\n");
+ " InnoDB: Then delete the existing log files."
+ " Edit the .cnf file\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: and start the database again.\n");
return(DB_ERROR);
}
@@ -1602,27 +1703,41 @@ innobase_start_or_create_for_mysql(void)
|| max_arch_log_no != min_arch_log_no
#endif /* UNIV_LOG_ARCHIVE */
) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Cannot initialize created"
+ " log files because\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: data files were not in sync"
+ " with each other\n");
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Cannot initialize created"
- " log files because\n"
- "InnoDB: data files were not in sync"
- " with each other\n"
- "InnoDB: or the data files are corrupt.\n");
+ " InnoDB: or the data files are corrupt.\n");
return(DB_ERROR);
}
if (max_flushed_lsn < (ib_uint64_t) 1000) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Cannot initialize created"
+ " log files because\n");
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Cannot initialize created"
- " log files because\n"
- "InnoDB: data files are corrupt,"
- " or new data files were\n"
- "InnoDB: created when the database"
- " was started previous\n"
- "InnoDB: time but the database"
- " was not shut down\n"
- "InnoDB: normally after that.\n");
+ " InnoDB: data files are corrupt,"
+ " or new data files were\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: created when the database"
+ " was started previous\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: time but the database"
+ " was not shut down\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: normally after that.\n");
return(DB_ERROR);
}
@@ -1642,36 +1757,36 @@ innobase_start_or_create_for_mysql(void)
trx_sys_file_format_init();
- if (create_new_doublewrite_file) {
- mtr_start(&mtr);
- fsp_header_init(TRX_DOUBLEWRITE_SPACE, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9, &mtr);
- mtr_commit(&mtr);
-
- trx_sys_dummy_create(TRX_DOUBLEWRITE_SPACE);
- }
-
if (create_new_db) {
mtr_start(&mtr);
+
fsp_header_init(0, sum_of_new_sizes, &mtr);
mtr_commit(&mtr);
+ /* To maintain backward compatibility we create only
+ the first rollback segment before the double write buffer.
+ All the remaining rollback segments will be created later,
+ after the double write buffer has been created. */
trx_sys_create();
- dict_create();
- srv_startup_is_before_trx_rollback_phase = FALSE;
- if (trx_doublewrite == NULL) {
- /* Create the doublewrite buffer here to avoid assertion error
- about page_no of doublewrite_buf */
- trx_sys_create_doublewrite_buf();
+ if (create_new_doublewrite_file) {
+ mtr_start(&mtr);
+ fsp_header_init(TRX_DOUBLEWRITE_SPACE, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9, &mtr);
+ mtr_commit(&mtr);
+
+ trx_sys_dummy_create(TRX_DOUBLEWRITE_SPACE);
}
- if (srv_extra_rsegments)
- trx_sys_create_extra_rseg(srv_extra_rsegments);
+ dict_create();
+
+ srv_startup_is_before_trx_rollback_phase = FALSE;
+
#ifdef UNIV_LOG_ARCHIVE
} else if (srv_archive_recovery) {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Starting archive"
+ " InnoDB: Starting archive"
" recovery from a backup...\n");
err = recv_recovery_from_archive_start(
min_flushed_lsn, srv_archive_recovery_limit_lsn,
@@ -1684,7 +1799,9 @@ innobase_start_or_create_for_mysql(void)
in any disk i/o, first call dict_boot */
dict_boot();
+
trx_sys_init_at_db_start();
+
srv_startup_is_before_trx_rollback_phase = FALSE;
/* Initialize the fsp free limit global variable in the log
@@ -1694,6 +1811,13 @@ innobase_start_or_create_for_mysql(void)
recv_recovery_from_archive_finish();
#endif /* UNIV_LOG_ARCHIVE */
} else {
+ char* save_srv_doublewrite_file = NULL;
+
+ if (create_new_doublewrite_file) {
+ /* doublewrite_file cannot be used for recovery yet. */
+ save_srv_doublewrite_file = srv_doublewrite_file;
+ srv_doublewrite_file = NULL;
+ }
/* Check if we support the max format that is stamped
on the system tablespace.
@@ -1708,7 +1832,7 @@ innobase_start_or_create_for_mysql(void)
consistent state, this is REQUIRED for the recovery
process to work. */
err = trx_sys_file_format_max_check(
- srv_check_file_format_at_startup);
+ srv_max_file_format_at_startup);
if (err != DB_SUCCESS) {
return(err);
@@ -1719,8 +1843,6 @@ innobase_start_or_create_for_mysql(void)
Note that this is not as heavy weight as it seems. At
this point there will be only ONE page in the buf_LRU
and there must be no page in the buf_flush list. */
- /* buffer_pool_shm should not be reused when recovery was needed. */
- if (!srv_buffer_pool_shm_is_reused)
buf_pool_invalidate();
/* We always try to do a recovery, even if the database had
@@ -1782,6 +1904,17 @@ innobase_start_or_create_for_mysql(void)
we have finished the recovery process so that the
image of TRX_SYS_PAGE_NO is not stale. */
trx_sys_file_format_tag_init();
+
+ if (create_new_doublewrite_file) {
+ /* restore the value */
+ srv_doublewrite_file = save_srv_doublewrite_file;
+
+ mtr_start(&mtr);
+ fsp_header_init(TRX_DOUBLEWRITE_SPACE, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9, &mtr);
+ mtr_commit(&mtr);
+
+ trx_sys_dummy_create(TRX_DOUBLEWRITE_SPACE);
+ }
}
if (!create_new_db && sum_of_new_sizes > 0) {
@@ -1823,6 +1956,27 @@ innobase_start_or_create_for_mysql(void)
/* fprintf(stderr, "Max allowed record size %lu\n",
page_get_free_space_of_empty() / 2); */
+ if (trx_doublewrite == NULL) {
+ /* Create the doublewrite buffer to a new tablespace */
+
+ trx_sys_create_doublewrite_buf();
+ }
+
+ /* Here the double write buffer has already been created and so
+ any new rollback segments will be allocated after the double
+ write buffer. The default segment should already exist.
+ We create the new segments only if it's a new database or
+ the database was shutdown cleanly. */
+
+ /* Note: When creating the extra rollback segments during an upgrade
+ we violate the latching order, even if the change buffer is empty.
+ We make an exception in sync0sync.c and check srv_is_being_started
+ for that violation. It cannot create a deadlock because we are still
+ running in single threaded mode essentially. Only the IO threads
+ should be running at this stage. */
+
+ trx_sys_create_rsegs(TRX_SYS_N_RSEGS - 1);
+
/* Create the thread which watches the timeouts for lock waits */
os_thread_create(&srv_lock_timeout_thread, NULL,
thread_ids + 2 + SRV_MAX_N_IO_THREADS);
@@ -1841,12 +1995,6 @@ innobase_start_or_create_for_mysql(void)
srv_is_being_started = FALSE;
- if (trx_doublewrite == NULL) {
- /* Create the doublewrite buffer to a new tablespace */
-
- trx_sys_create_doublewrite_buf();
- }
-
err = dict_create_or_check_foreign_constraint_tables();
if (err != DB_SUCCESS) {
@@ -1859,19 +2007,33 @@ innobase_start_or_create_for_mysql(void)
os_thread_create(&srv_master_thread, NULL, thread_ids
+ (1 + SRV_MAX_N_IO_THREADS));
- if (srv_use_purge_thread) {
- ulint i;
+ /* Currently we allow only a single purge thread. */
+ ut_a(srv_n_purge_threads == 0 || srv_n_purge_threads == 1);
- os_thread_create(&srv_purge_thread, NULL, thread_ids
- + (6 + SRV_MAX_N_IO_THREADS));
+ /* If the user has requested a separate purge thread then
+ start the purge thread. */
+ if (srv_n_purge_threads == 1) {
+ os_thread_create(&srv_purge_thread, NULL, NULL);
+ }
+
+ /* Wait for the purge and master thread to startup. */
- for (i = 0; i < srv_use_purge_thread - 1; i++) {
- n[7 + i + SRV_MAX_N_IO_THREADS] = i; /* using as index for arrays in purge_sys */
- os_thread_create(&srv_purge_worker_thread,
- n + (7 + i + SRV_MAX_N_IO_THREADS),
- thread_ids + (7 + i + SRV_MAX_N_IO_THREADS));
+ while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
+ if (srv_thread_has_reserved_slot(SRV_MASTER) == ULINT_UNDEFINED
+ || (srv_n_purge_threads == 1
+ && srv_thread_has_reserved_slot(SRV_WORKER)
+ == ULINT_UNDEFINED)) {
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: "
+ "Waiting for the background threads to "
+ "start\n");
+ os_thread_sleep(1000000);
+ } else {
+ break;
}
}
+
#ifdef UNIV_DEBUG
/* buf_debug_prints = TRUE; */
#endif /* UNIV_DEBUG */
@@ -1886,11 +2048,14 @@ innobase_start_or_create_for_mysql(void)
if (!srv_auto_extend_last_data_file
&& sum_of_data_file_sizes != tablespace_size_in_header) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: tablespace size"
+ " stored in header is %lu pages, but\n",
+ (ulong) tablespace_size_in_header);
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Error: tablespace size"
- " stored in header is %lu pages, but\n"
"InnoDB: the sum of data file sizes is %lu pages\n",
- (ulong) tablespace_size_in_header,
(ulong) sum_of_data_file_sizes);
if (srv_force_recovery == 0
@@ -1898,16 +2063,25 @@ innobase_start_or_create_for_mysql(void)
/* This is a fatal error, the tail of a tablespace is
missing */
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Cannot start InnoDB."
- " The tail of the system tablespace is\n"
- "InnoDB: missing. Have you edited"
- " innodb_data_file_path in my.cnf in an\n"
- "InnoDB: inappropriate way, removing"
- " ibdata files from there?\n"
- "InnoDB: You can set innodb_force_recovery=1"
- " in my.cnf to force\n"
- "InnoDB: a startup if you are trying"
+ " InnoDB: Cannot start InnoDB."
+ " The tail of the system tablespace is\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: missing. Have you edited"
+ " innodb_data_file_path in my.cnf in an\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: inappropriate way, removing"
+ " ibdata files from there?\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: You can set innodb_force_recovery=1"
+ " in my.cnf to force\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: a startup if you are trying"
" to recover a badly corrupt database.\n");
return(DB_ERROR);
@@ -1917,26 +2091,38 @@ innobase_start_or_create_for_mysql(void)
if (srv_auto_extend_last_data_file
&& sum_of_data_file_sizes < tablespace_size_in_header) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: tablespace size stored in header"
+ " is %lu pages, but\n",
+ (ulong) tablespace_size_in_header);
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Error: tablespace size stored in header"
- " is %lu pages, but\n"
- "InnoDB: the sum of data file sizes"
+ " InnoDB: the sum of data file sizes"
" is only %lu pages\n",
- (ulong) tablespace_size_in_header,
(ulong) sum_of_data_file_sizes);
if (srv_force_recovery == 0) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Cannot start InnoDB. The tail of"
+ " the system tablespace is\n");
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Cannot start InnoDB. The tail of"
- " the system tablespace is\n"
- "InnoDB: missing. Have you edited"
- " innodb_data_file_path in my.cnf in an\n"
- "InnoDB: inappropriate way, removing"
- " ibdata files from there?\n"
- "InnoDB: You can set innodb_force_recovery=1"
- " in my.cnf to force\n"
- "InnoDB: a startup if you are trying to"
+ " InnoDB: missing. Have you edited"
+ " innodb_data_file_path in my.cnf in an\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: inappropriate way, removing"
+ " ibdata files from there?\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: You can set innodb_force_recovery=1"
+ " in my.cnf to force\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: a startup if you are trying to"
" recover a badly corrupt database.\n");
return(DB_ERROR);
@@ -1947,10 +2133,13 @@ innobase_start_or_create_for_mysql(void)
os_fast_mutex_init(&srv_os_test_mutex);
if (0 != os_fast_mutex_trylock(&srv_os_test_mutex)) {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Error: pthread_mutex_trylock returns"
- " an unexpected value on\n"
- "InnoDB: success! Cannot continue.\n");
+ " InnoDB: Error: pthread_mutex_trylock returns"
+ " an unexpected value on\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: success! Cannot continue.\n");
exit(1);
}
@@ -1965,8 +2154,8 @@ innobase_start_or_create_for_mysql(void)
if (!srv_file_per_table_original_value
&& srv_pass_corrupt_table) {
fprintf(stderr, "InnoDB: Warning:"
- " innodb_file_per_table is diabled."
- " So innodb_pass_corrupt_table doesn't make sence\n");
+ " The option innodb_file_per_table is disabled,"
+ " so using the option innodb_pass_corrupt_table doesn't make sense.\n");
}
if (srv_print_verbose_log) {
@@ -1978,8 +2167,9 @@ innobase_start_or_create_for_mysql(void)
}
if (srv_force_recovery > 0) {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: !!! innodb_force_recovery"
+ " InnoDB: !!! innodb_force_recovery"
" is set to %lu !!!\n",
(ulong) srv_force_recovery);
}
@@ -2000,12 +2190,17 @@ innobase_start_or_create_for_mysql(void)
4.1.1. It is essential that the insert buffer is emptied
here! */
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: You are upgrading to an"
+ " InnoDB version which allows multiple\n");
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: You are upgrading to an"
- " InnoDB version which allows multiple\n"
- "InnoDB: tablespaces. Wait that purge"
- " and insert buffer merge run to\n"
- "InnoDB: completion...\n");
+ " InnoDB: tablespaces. Wait that purge"
+ " and insert buffer merge run to\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: completion...\n");
for (;;) {
os_thread_sleep(1000000);
@@ -2017,21 +2212,29 @@ innobase_start_or_create_for_mysql(void)
break;
}
}
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Full purge and insert buffer merge"
+ " InnoDB: Full purge and insert buffer merge"
" completed.\n");
trx_sys_mark_upgraded_to_multiple_tablespaces();
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: You have now successfully upgraded"
- " to the multiple tablespaces\n"
- "InnoDB: format. You should NOT DOWNGRADE"
- " to an earlier version of\n"
- "InnoDB: InnoDB! But if you absolutely need to"
- " downgrade, see\n"
- "InnoDB: " REFMAN "multiple-tablespaces.html\n"
- "InnoDB: for instructions.\n");
+ " InnoDB: You have now successfully upgraded"
+ " to the multiple tablespaces\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: format. You should NOT DOWNGRADE"
+ " to an earlier version of\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: InnoDB! But if you absolutely need to"
+ " downgrade, see\n");
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: " REFMAN "multiple-tablespaces.html\n"
+ " InnoDB: for instructions.\n");
}
if (srv_force_recovery == 0) {
@@ -2059,9 +2262,6 @@ innobase_shutdown_for_mysql(void)
/*=============================*/
{
ulint i;
-#ifdef __NETWARE__
- extern ibool panic_shutdown;
-#endif
if (!srv_was_started) {
if (srv_is_being_started) {
ut_print_timestamp(stderr);
@@ -2079,21 +2279,7 @@ innobase_shutdown_for_mysql(void)
The step 1 is the real InnoDB shutdown. The remaining steps 2 - ...
just free data structures after the shutdown. */
-
- if (srv_fast_shutdown == 2) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: MySQL has requested a very fast shutdown"
- " without flushing "
- "the InnoDB buffer pool to data files."
- " At the next mysqld startup "
- "InnoDB will do a crash recovery!\n");
- }
-
-#ifdef __NETWARE__
- if (!panic_shutdown)
-#endif
- logs_empty_and_mark_files_at_shutdown();
+ logs_empty_and_mark_files_at_shutdown();
if (srv_conc_n_threads != 0) {
fprintf(stderr,
@@ -2107,17 +2293,9 @@ innobase_shutdown_for_mysql(void)
srv_shutdown_state = SRV_SHUTDOWN_EXIT_THREADS;
- /* In a 'very fast' shutdown, we do not need to wait for these threads
- to die; all which counts is that we flushed the log; a 'very fast'
- shutdown is essentially a crash. */
-
- if (srv_fast_shutdown == 2) {
- return(DB_SUCCESS);
- }
-
/* All threads end up waiting for certain events. Put those events
- to the signaled state. Then the threads will exit themselves in
- os_thread_event_wait(). */
+ to the signaled state. Then the threads will exit themselves after
+ os_event_wait(). */
for (i = 0; i < 1000; i++) {
/* NOTE: IF YOU CREATE THREADS IN INNODB, YOU MUST EXIT THEM
@@ -2132,7 +2310,10 @@ innobase_shutdown_for_mysql(void)
/* c. We wake the master thread so that it exits */
srv_wake_master_thread();
- /* d. Exit the i/o threads */
+ /* d. We wake the purge thread so that it exits */
+ srv_wake_purge_thread();
+
+ /* e. Exit the i/o threads */
os_aio_wake_all_threads_at_shutdown();
@@ -2191,7 +2372,6 @@ innobase_shutdown_for_mysql(void)
ibuf_close();
log_shutdown();
lock_sys_close();
- thr_local_close();
trx_sys_file_format_close();
trx_sys_close();
@@ -2216,7 +2396,7 @@ innobase_shutdown_for_mysql(void)
pars_lexer_close();
log_mem_free();
- buf_pool_free();
+ buf_pool_free(srv_buf_pool_instances);
mem_close();
/* ut_free_all_mem() frees all allocated memory not freed yet
@@ -2257,12 +2437,4 @@ innobase_shutdown_for_mysql(void)
return((int) DB_SUCCESS);
}
-
-#ifdef __NETWARE__
-void set_panic_flag_for_netware()
-{
- extern ibool panic_shutdown;
- panic_shutdown = TRUE;
-}
-#endif /* __NETWARE__ */
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/sync/sync0arr.c b/storage/xtradb/sync/sync0arr.c
index 223e1715944..b47c32f5bbf 100644
--- a/storage/xtradb/sync/sync0arr.c
+++ b/storage/xtradb/sync/sync0arr.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -40,6 +40,7 @@ Created 9/5/1995 Heikki Tuuri
#include "os0sync.h"
#include "os0file.h"
#include "srv0srv.h"
+#include "ha_prototypes.h"
/*
WAIT ARRAY
@@ -138,6 +139,11 @@ struct sync_array_struct {
since creation of the array */
};
+#ifdef UNIV_PFS_MUTEX
+/* Key to register the mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t syn_arr_mutex_key;
+#endif
+
#ifdef UNIV_SYNC_DEBUG
/******************************************************************//**
This function is called only in the debug version. Detects a deadlock
@@ -245,9 +251,10 @@ sync_array_create(
/* Then create the mutex to protect the wait array complex */
if (protection == SYNC_ARRAY_OS_MUTEX) {
- arr->os_mutex = os_mutex_create(NULL);
+ arr->os_mutex = os_mutex_create();
} else if (protection == SYNC_ARRAY_MUTEX) {
- mutex_create(&arr->mutex, SYNC_NO_ORDER_CHECK);
+ mutex_create(syn_arr_mutex_key,
+ &arr->mutex, SYNC_NO_ORDER_CHECK);
} else {
ut_error;
}
@@ -472,8 +479,8 @@ sync_array_cell_print(
fprintf(file,
"--Thread %lu has waited at %s line %lu"
" for %#.5g seconds the semaphore:\n",
- (ulong) os_thread_pf(cell->thread), cell->file,
- (ulong) cell->line,
+ (ulong) os_thread_pf(cell->thread),
+ innobase_basename(cell->file), (ulong) cell->line,
difftime(time(NULL), cell->reservation_time));
if (type == SYNC_MUTEX) {
@@ -526,7 +533,7 @@ sync_array_cell_print(
(ulong) rw_lock_get_reader_count(rwlock),
(ulong) rwlock->waiters,
rwlock->lock_word,
- rwlock->last_s_file_name,
+ innobase_basename(rwlock->last_s_file_name),
(ulong) rwlock->last_s_line,
rwlock->last_x_file_name,
(ulong) rwlock->last_x_line);
@@ -583,9 +590,6 @@ sync_array_deadlock_step(
ulint depth) /*!< in: recursion depth */
{
sync_cell_t* new;
- ibool ret;
-
- depth++;
if (pass != 0) {
/* If pass != 0, then we do not know which threads are
@@ -597,7 +601,7 @@ sync_array_deadlock_step(
new = sync_array_find_thread(arr, thread);
- if (new == start) {
+ if (UNIV_UNLIKELY(new == start)) {
/* Stop running of other threads */
ut_dbg_stop_threads = TRUE;
@@ -609,11 +613,7 @@ sync_array_deadlock_step(
return(TRUE);
} else if (new) {
- ret = sync_array_detect_deadlock(arr, start, new, depth);
-
- if (ret) {
- return(TRUE);
- }
+ return(sync_array_detect_deadlock(arr, start, new, depth + 1));
}
return(FALSE);
}
@@ -714,7 +714,7 @@ print:
fprintf(stderr, "rw-lock %p ",
(void*) lock);
sync_array_cell_print(stderr, cell);
- rw_lock_debug_print(debug);
+ rw_lock_debug_print(stderr, debug);
return(TRUE);
}
}
@@ -913,8 +913,10 @@ Prints warnings of long semaphore waits to stderr.
@return TRUE if fatal semaphore wait threshold was exceeded */
UNIV_INTERN
ibool
-sync_array_print_long_waits(void)
-/*=============================*/
+sync_array_print_long_waits(
+/*========================*/
+ os_thread_id_t* waiter, /*!< out: longest waiting thread */
+ const void** sema) /*!< out: longest-waited-for semaphore */
{
sync_cell_t* cell;
ibool old_val;
@@ -922,24 +924,52 @@ sync_array_print_long_waits(void)
ulint i;
ulint fatal_timeout = srv_fatal_semaphore_wait_threshold;
ibool fatal = FALSE;
+ double longest_diff = 0;
+
+#ifdef UNIV_DEBUG_VALGRIND
+ /* Increase the timeouts if running under valgrind because it executes
+ extremely slowly. UNIV_DEBUG_VALGRIND does not necessary mean that
+ we are running under valgrind but we have no better way to tell.
+ See Bug#58432 innodb.innodb_bug56143 fails under valgrind
+ for an example */
+# define SYNC_ARRAY_TIMEOUT 2400
+ fatal_timeout *= 10;
+#else
+# define SYNC_ARRAY_TIMEOUT 240
+#endif
for (i = 0; i < sync_primary_wait_array->n_cells; i++) {
+ double diff;
+ void* wait_object;
+
cell = sync_array_get_nth_cell(sync_primary_wait_array, i);
- if (cell->wait_object != NULL && cell->waiting
- && difftime(time(NULL), cell->reservation_time) > 240) {
+ wait_object = cell->wait_object;
+
+ if (wait_object == NULL || !cell->waiting) {
+
+ continue;
+ }
+
+ diff = difftime(time(NULL), cell->reservation_time);
+
+ if (diff > SYNC_ARRAY_TIMEOUT) {
fputs("InnoDB: Warning: a long semaphore wait:\n",
stderr);
sync_array_cell_print(stderr, cell);
noticed = TRUE;
}
- if (cell->wait_object != NULL && cell->waiting
- && difftime(time(NULL), cell->reservation_time)
- > fatal_timeout) {
+ if (diff > fatal_timeout) {
fatal = TRUE;
}
+
+ if (diff > longest_diff) {
+ longest_diff = diff;
+ *sema = wait_object;
+ *waiter = cell->thread;
+ }
}
if (noticed) {
@@ -970,6 +1000,8 @@ sync_array_print_long_waits(void)
" to the standard error stream\n");
}
+#undef SYNC_ARRAY_TIMEOUT
+
return(fatal);
}
diff --git a/storage/xtradb/sync/sync0rw.c b/storage/xtradb/sync/sync0rw.c
index 9e10f6e943b..e561ae319a5 100644
--- a/storage/xtradb/sync/sync0rw.c
+++ b/storage/xtradb/sync/sync0rw.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -39,6 +39,7 @@ Created 9/11/1995 Heikki Tuuri
#include "mem0mem.h"
#include "srv0srv.h"
#include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
+#include "ha_prototypes.h"
/*
IMPLEMENTATION OF THE RW_LOCK
@@ -168,12 +169,22 @@ UNIV_INTERN ib_int64_t rw_x_exit_count = 0;
UNIV_INTERN rw_lock_list_t rw_lock_list;
UNIV_INTERN mutex_t rw_lock_list_mutex;
+#ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t rw_lock_list_mutex_key;
+UNIV_INTERN mysql_pfs_key_t rw_lock_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
#ifdef UNIV_SYNC_DEBUG
/* The global mutex which protects debug info lists of all rw-locks.
To modify the debug info list of an rw-lock, this mutex has to be
acquired in addition to the mutex protecting the lock. */
UNIV_INTERN mutex_t rw_lock_debug_mutex;
+
+# ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t rw_lock_debug_mutex_key;
+# endif
+
/* If deadlock detection does not get immediately the mutex,
it may wait for this event */
UNIV_INTERN os_event_t rw_lock_debug_event;
@@ -231,16 +242,17 @@ rw_lock_create_func(
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
-#endif /* UNIV_DEBUG */
- const char* cmutex_name, /*!< in: mutex name */
const char* cfile_name, /*!< in: file name where created */
- ulint cline) /*!< in: file line where created */
+ ulint cline, /*!< in: file line where created */
+#endif /* UNIV_DEBUG */
+ const char* cmutex_name) /*!< in: mutex name */
{
/* If this is the very first time a synchronization object is
created, then the following call initializes the sync system. */
#ifndef INNODB_RW_LOCKS_USE_ATOMICS
- mutex_create(rw_lock_get_mutex(lock), SYNC_NO_ORDER_CHECK);
+ mutex_create(rw_lock_mutex_key, rw_lock_get_mutex(lock),
+ SYNC_NO_ORDER_CHECK);
ut_d(lock->mutex.cfile_name = cfile_name);
ut_d(lock->mutex.cline = cline);
@@ -261,6 +273,9 @@ rw_lock_create_func(
contains garbage at initialization and cannot be used for
recursive x-locking. */
lock->recursive = FALSE;
+ /* Silence Valgrind when UNIV_DEBUG_VALGRIND is not enabled. */
+ memset((void*) &lock->writer_thread, 0, sizeof lock->writer_thread);
+ UNIV_MEM_INVALID(&lock->writer_thread, sizeof lock->writer_thread);
#ifdef UNIV_SYNC_DEBUG
UT_LIST_INIT(lock->debug_list);
@@ -296,8 +311,8 @@ the rw-lock is freed. Removes an rw-lock object from the global list. The
rw-lock is checked to be in the non-locked state. */
UNIV_INTERN
void
-rw_lock_free(
-/*=========*/
+rw_lock_free_func(
+/*==============*/
rw_lock_t* lock) /*!< in: rw-lock */
{
ut_ad(rw_lock_validate(lock));
@@ -335,10 +350,13 @@ rw_lock_validate(
/*=============*/
rw_lock_t* lock) /*!< in: rw-lock */
{
+ ulint waiters;
+ lint lock_word;
+
ut_a(lock);
- ulint waiters = rw_lock_get_waiters(lock);
- lint lock_word = lock->lock_word;
+ waiters = rw_lock_get_waiters(lock);
+ lock_word = lock->lock_word;
ut_ad(lock->magic_n == RW_LOCK_MAGIC_N);
ut_a(waiters == 0 || waiters == 1);
@@ -602,7 +620,7 @@ rw_lock_x_lock_func(
{
ulint index; /*!< index of the reserved wait cell */
ulint i; /*!< spin round count */
- ibool spinning = FALSE;
+ ibool spinning = FALSE;
ut_ad(rw_lock_validate(lock));
@@ -921,7 +939,7 @@ rw_lock_list_print_info(
info = UT_LIST_GET_FIRST(lock->debug_list);
while (info != NULL) {
- rw_lock_debug_print(info);
+ rw_lock_debug_print(file, info);
info = UT_LIST_GET_NEXT(list, info);
}
}
@@ -969,7 +987,7 @@ rw_lock_print(
info = UT_LIST_GET_FIRST(lock->debug_list);
while (info != NULL) {
- rw_lock_debug_print(info);
+ rw_lock_debug_print(stderr, info);
info = UT_LIST_GET_NEXT(list, info);
}
}
@@ -981,28 +999,29 @@ UNIV_INTERN
void
rw_lock_debug_print(
/*================*/
+ FILE* f, /*!< in: output stream */
rw_lock_debug_t* info) /*!< in: debug struct */
{
ulint rwt;
rwt = info->lock_type;
- fprintf(stderr, "Locked: thread %ld file %s line %ld ",
+ fprintf(f, "Locked: thread %lu file %s line %lu ",
(ulong) os_thread_pf(info->thread_id), info->file_name,
(ulong) info->line);
if (rwt == RW_LOCK_SHARED) {
- fputs("S-LOCK", stderr);
+ fputs("S-LOCK", f);
} else if (rwt == RW_LOCK_EX) {
- fputs("X-LOCK", stderr);
+ fputs("X-LOCK", f);
} else if (rwt == RW_LOCK_WAIT_EX) {
- fputs("WAIT X-LOCK", stderr);
+ fputs("WAIT X-LOCK", f);
} else {
ut_error;
}
if (info->pass != 0) {
- fprintf(stderr, " pass value %lu", (ulong) info->pass);
+ fprintf(f, " pass value %lu", (ulong) info->pass);
}
- putc('\n', stderr);
+ putc('\n', f);
}
/***************************************************************//**
diff --git a/storage/xtradb/sync/sync0sync.c b/storage/xtradb/sync/sync0sync.c
index 225f28df78e..4b35d6db177 100644
--- a/storage/xtradb/sync/sync0sync.c
+++ b/storage/xtradb/sync/sync0sync.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2011, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -40,6 +40,10 @@ Created 9/5/1995 Heikki Tuuri
#include "srv0srv.h"
#include "buf0types.h"
#include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
+#ifdef UNIV_SYNC_DEBUG
+# include "srv0start.h" /* srv_is_being_started */
+#endif /* UNIV_SYNC_DEBUG */
+#include "ha_prototypes.h"
/*
REASONS FOR IMPLEMENTING THE SPIN LOCK MUTEX
@@ -167,13 +171,13 @@ Q.E.D. */
/** The number of iterations in the mutex_spin_wait() spin loop.
Intended for performance monitoring. */
-static ib_int64_t mutex_spin_round_count = 0;
+UNIV_INTERN ib_int64_t mutex_spin_round_count = 0;
/** The number of mutex_spin_wait() calls. Intended for
performance monitoring. */
-static ib_int64_t mutex_spin_wait_count = 0;
+UNIV_INTERN ib_int64_t mutex_spin_wait_count = 0;
/** The number of OS waits in mutex_spin_wait(). Intended for
performance monitoring. */
-static ib_int64_t mutex_os_wait_count = 0;
+UNIV_INTERN ib_int64_t mutex_os_wait_count = 0;
/** The number of mutex_exit() calls. Intended for performance
monitoring. */
UNIV_INTERN ib_int64_t mutex_exit_count = 0;
@@ -185,12 +189,12 @@ UNIV_INTERN sync_array_t* sync_primary_wait_array;
/** This variable is set to TRUE when sync_init is called */
UNIV_INTERN ibool sync_initialized = FALSE;
+#ifdef UNIV_SYNC_DEBUG
/** An acquired mutex or rw-lock and its level in the latching order */
typedef struct sync_level_struct sync_level_t;
/** Mutexes or rw-locks held by a thread */
typedef struct sync_thread_struct sync_thread_t;
-#ifdef UNIV_SYNC_DEBUG
/** The latch levels currently owned by threads are stored in this data
structure; the size of this array is OS_THREAD_MAX_N */
@@ -198,6 +202,10 @@ UNIV_INTERN sync_thread_t* sync_thread_level_arrays;
/** Mutex protecting sync_thread_level_arrays */
UNIV_INTERN mutex_t sync_thread_mutex;
+
+# ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t sync_thread_mutex_key;
+# endif /* UNIV_PFS_MUTEX */
#endif /* UNIV_SYNC_DEBUG */
/** Global list of database mutexes (not OS mutexes) created. */
@@ -206,27 +214,50 @@ UNIV_INTERN ut_list_base_node_t mutex_list;
/** Mutex protecting the mutex_list variable */
UNIV_INTERN mutex_t mutex_list_mutex;
+#ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t mutex_list_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
#ifdef UNIV_SYNC_DEBUG
/** Latching order checks start when this is set TRUE */
UNIV_INTERN ibool sync_order_checks_on = FALSE;
-#endif /* UNIV_SYNC_DEBUG */
+
+/** Number of slots reserved for each OS thread in the sync level array */
+static const ulint SYNC_THREAD_N_LEVELS = 10000;
+
+typedef struct sync_arr_struct sync_arr_t;
+
+/** Array for tracking sync levels per thread. */
+struct sync_arr_struct {
+ ulint in_use; /*!< Number of active cells */
+ ulint n_elems; /*!< Number of elements in the array */
+ ulint max_elems; /*!< Maximum elements */
+ ulint next_free; /*!< ULINT_UNDEFINED or index of next
+ free slot */
+ sync_level_t* elems; /*!< Array elements */
+};
/** Mutexes or rw-locks held by a thread */
struct sync_thread_struct{
- os_thread_id_t id; /*!< OS thread id */
- sync_level_t* levels; /*!< level array for this thread; if
- this is NULL this slot is unused */
+ os_thread_id_t id; /*!< OS thread id */
+ sync_arr_t* levels; /*!< level array for this thread; if
+ this is NULL this slot is unused */
};
-/** Number of slots reserved for each OS thread in the sync level array */
-#define SYNC_THREAD_N_LEVELS 10000
-
/** An acquired mutex or rw-lock and its level in the latching order */
struct sync_level_struct{
- void* latch; /*!< pointer to a mutex or an rw-lock; NULL means that
- the slot is empty */
- ulint level; /*!< level of the latch in the latching order */
+ void* latch; /*!< pointer to a mutex or an
+ rw-lock; NULL means that
+ the slot is empty */
+ ulint level; /*!< level of the latch in the
+ latching order. This field is
+ overloaded to serve as a node in a
+ linked list of free nodes too. When
+ latch == NULL then this will contain
+ the ordinal value of the next free
+ element */
};
+#endif /* UNIV_SYNC_DEBUG */
/******************************************************************//**
Creates, or rather, initializes a mutex object in a specified memory
@@ -238,14 +269,14 @@ void
mutex_create_func(
/*==============*/
mutex_t* mutex, /*!< in: pointer to memory */
- const char* cmutex_name, /*!< in: mutex name */
#ifdef UNIV_DEBUG
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
-#endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
- ulint cline) /*!< in: file line where created */
+ ulint cline, /*!< in: file line where created */
+#endif /* UNIV_DEBUG */
+ const char* cmutex_name) /*!< in: mutex name */
{
#if defined(HAVE_ATOMIC_BUILTINS)
mutex_reset_lock_word(mutex);
@@ -304,13 +335,14 @@ mutex_create_func(
}
/******************************************************************//**
+NOTE! Use the corresponding macro mutex_free(), not directly this function!
Calling this function is obligatory only if the memory buffer containing
the mutex is freed. Removes a mutex object from the mutex list. The mutex
is checked to be in the reset state. */
UNIV_INTERN
void
-mutex_free(
-/*=======*/
+mutex_free_func(
+/*============*/
mutex_t* mutex) /*!< in: mutex */
{
ut_ad(mutex_validate(mutex));
@@ -745,27 +777,28 @@ mutex_n_reserved(void)
/*==================*/
{
mutex_t* mutex;
- ulint count = 0;
+ ulint count = 0;
mutex_enter(&mutex_list_mutex);
- mutex = UT_LIST_GET_FIRST(mutex_list);
+ for (mutex = UT_LIST_GET_FIRST(mutex_list);
+ mutex != NULL;
+ mutex = UT_LIST_GET_NEXT(list, mutex)) {
- while (mutex != NULL) {
if (mutex_get_lock_word(mutex) != 0) {
count++;
}
-
- mutex = UT_LIST_GET_NEXT(list, mutex);
}
mutex_exit(&mutex_list_mutex);
ut_a(count >= 1);
- return(count - 1); /* Subtract one, because this function itself
- was holding one mutex (mutex_list_mutex) */
+ /* Subtract one, because this function itself was holding
+ one mutex (mutex_list_mutex) */
+
+ return(count - 1);
}
/******************************************************************//**
@@ -781,20 +814,6 @@ sync_all_freed(void)
}
/******************************************************************//**
-Gets the value in the nth slot in the thread level arrays.
-@return pointer to thread slot */
-static
-sync_thread_t*
-sync_thread_level_arrays_get_nth(
-/*=============================*/
- ulint n) /*!< in: slot number */
-{
- ut_ad(n < OS_THREAD_MAX_N);
-
- return(sync_thread_level_arrays + n);
-}
-
-/******************************************************************//**
Looks for the thread slot for the calling thread.
@return pointer to thread slot, NULL if not found */
static
@@ -803,15 +822,15 @@ sync_thread_level_arrays_find_slot(void)
/*====================================*/
{
- sync_thread_t* slot;
- os_thread_id_t id;
ulint i;
+ os_thread_id_t id;
id = os_thread_get_curr_id();
for (i = 0; i < OS_THREAD_MAX_N; i++) {
+ sync_thread_t* slot;
- slot = sync_thread_level_arrays_get_nth(i);
+ slot = &sync_thread_level_arrays[i];
if (slot->levels && os_thread_eq(slot->id, id)) {
@@ -831,12 +850,12 @@ sync_thread_level_arrays_find_free(void)
/*====================================*/
{
- sync_thread_t* slot;
ulint i;
for (i = 0; i < OS_THREAD_MAX_N; i++) {
+ sync_thread_t* slot;
- slot = sync_thread_level_arrays_get_nth(i);
+ slot = &sync_thread_level_arrays[i];
if (slot->levels == NULL) {
@@ -848,19 +867,44 @@ sync_thread_level_arrays_find_free(void)
}
/******************************************************************//**
-Gets the value in the nth slot in the thread level array.
-@return pointer to level slot */
+Print warning. */
static
-sync_level_t*
-sync_thread_levels_get_nth(
-/*=======================*/
- sync_level_t* arr, /*!< in: pointer to level array for an OS
- thread */
- ulint n) /*!< in: slot number */
+void
+sync_print_warning(
+/*===============*/
+ const sync_level_t* slot) /*!< in: slot for which to
+ print warning */
{
- ut_ad(n < SYNC_THREAD_N_LEVELS);
+ mutex_t* mutex;
- return(arr + n);
+ mutex = slot->latch;
+
+ if (mutex->magic_n == MUTEX_MAGIC_N) {
+ fprintf(stderr,
+ "Mutex '%s'\n",
+ mutex->cmutex_name);
+
+ if (mutex_get_lock_word(mutex) != 0) {
+ ulint line;
+ const char* file_name;
+ os_thread_id_t thread_id;
+
+ mutex_get_debug_info(
+ mutex, &file_name, &line, &thread_id);
+
+ fprintf(stderr,
+ "InnoDB: Locked mutex:"
+ " addr %p thread %ld file %s line %ld\n",
+ (void*) mutex, os_thread_pf(thread_id),
+ file_name, (ulong) line);
+ } else {
+ fputs("Not locked\n", stderr);
+ }
+ } else {
+ rw_lock_t* lock = slot->latch;
+
+ rw_lock_print(lock);
+ }
}
/******************************************************************//**
@@ -871,68 +915,29 @@ static
ibool
sync_thread_levels_g(
/*=================*/
- sync_level_t* arr, /*!< in: pointer to level array for an OS
+ sync_arr_t* arr, /*!< in: pointer to level array for an OS
thread */
ulint limit, /*!< in: level limit */
ulint warn) /*!< in: TRUE=display a diagnostic message */
{
- sync_level_t* slot;
- rw_lock_t* lock;
- mutex_t* mutex;
ulint i;
- for (i = 0; i < SYNC_THREAD_N_LEVELS; i++) {
-
- slot = sync_thread_levels_get_nth(arr, i);
-
- if (slot->latch != NULL) {
- if (slot->level <= limit) {
-
- if (!warn) {
-
- return(FALSE);
- }
+ for (i = 0; i < arr->n_elems; i++) {
+ const sync_level_t* slot;
- lock = slot->latch;
- mutex = slot->latch;
+ slot = &arr->elems[i];
+ if (slot->latch != NULL && slot->level <= limit) {
+ if (warn) {
fprintf(stderr,
"InnoDB: sync levels should be"
" > %lu but a level is %lu\n",
(ulong) limit, (ulong) slot->level);
- if (mutex->magic_n == MUTEX_MAGIC_N) {
- fprintf(stderr,
- "Mutex '%s'\n",
- mutex->cmutex_name);
-
- if (mutex_get_lock_word(mutex) != 0) {
- const char* file_name;
- ulint line;
- os_thread_id_t thread_id;
-
- mutex_get_debug_info(
- mutex, &file_name,
- &line, &thread_id);
-
- fprintf(stderr,
- "InnoDB: Locked mutex:"
- " addr %p thread %ld"
- " file %s line %ld\n",
- (void*) mutex,
- os_thread_pf(
- thread_id),
- file_name,
- (ulong) line);
- } else {
- fputs("Not locked\n", stderr);
- }
- } else {
- rw_lock_print(lock);
- }
-
- return(FALSE);
+ sync_print_warning(slot);
}
+
+ return(FALSE);
}
}
@@ -941,31 +946,29 @@ sync_thread_levels_g(
/******************************************************************//**
Checks if the level value is stored in the level array.
-@return TRUE if stored */
+@return slot if found or NULL */
static
-ibool
+const sync_level_t*
sync_thread_levels_contain(
/*=======================*/
- sync_level_t* arr, /*!< in: pointer to level array for an OS
+ sync_arr_t* arr, /*!< in: pointer to level array for an OS
thread */
ulint level) /*!< in: level */
{
- sync_level_t* slot;
ulint i;
- for (i = 0; i < SYNC_THREAD_N_LEVELS; i++) {
+ for (i = 0; i < arr->n_elems; i++) {
+ const sync_level_t* slot;
- slot = sync_thread_levels_get_nth(arr, i);
+ slot = &arr->elems[i];
- if (slot->latch != NULL) {
- if (slot->level == level) {
+ if (slot->latch != NULL && slot->level == level) {
- return(TRUE);
- }
+ return(slot);
}
}
- return(FALSE);
+ return(NULL);
}
/******************************************************************//**
@@ -979,10 +982,9 @@ sync_thread_levels_contains(
ulint level) /*!< in: latching order level
(SYNC_DICT, ...)*/
{
- sync_level_t* arr;
- sync_thread_t* thread_slot;
- sync_level_t* slot;
ulint i;
+ sync_arr_t* arr;
+ sync_thread_t* thread_slot;
if (!sync_order_checks_on) {
@@ -1002,9 +1004,10 @@ sync_thread_levels_contains(
arr = thread_slot->levels;
- for (i = 0; i < SYNC_THREAD_N_LEVELS; i++) {
+ for (i = 0; i < arr->n_elems; i++) {
+ sync_level_t* slot;
- slot = sync_thread_levels_get_nth(arr, i);
+ slot = &arr->elems[i];
if (slot->latch != NULL && slot->level == level) {
@@ -1026,14 +1029,11 @@ void*
sync_thread_levels_nonempty_gen(
/*============================*/
ibool dict_mutex_allowed) /*!< in: TRUE if dictionary mutex is
- allowed to be owned by the thread,
- also purge_is_running mutex is
- allowed */
+ allowed to be owned by the thread */
{
- sync_level_t* arr;
- sync_thread_t* thread_slot;
- sync_level_t* slot;
ulint i;
+ sync_arr_t* arr;
+ sync_thread_t* thread_slot;
if (!sync_order_checks_on) {
@@ -1053,9 +1053,10 @@ sync_thread_levels_nonempty_gen(
arr = thread_slot->levels;
- for (i = 0; i < SYNC_THREAD_N_LEVELS; i++) {
+ for (i = 0; i < arr->n_elems; ++i) {
+ const sync_level_t* slot;
- slot = sync_thread_levels_get_nth(arr, i);
+ slot = &arr->elems[i];
if (slot->latch != NULL
&& (!dict_mutex_allowed
@@ -1075,14 +1076,61 @@ sync_thread_levels_nonempty_gen(
}
/******************************************************************//**
-Checks that the level array for the current thread is empty.
-@return TRUE if empty */
+Checks if the level array for the current thread is empty,
+except for the btr_search_latch.
+@return a latch, or NULL if empty except the exceptions specified below */
UNIV_INTERN
-ibool
-sync_thread_levels_empty(void)
-/*==========================*/
+void*
+sync_thread_levels_nonempty_trx(
+/*============================*/
+ ibool has_search_latch)
+ /*!< in: TRUE if and only if the thread
+ is supposed to hold btr_search_latch */
{
- return(sync_thread_levels_empty_gen(FALSE));
+ ulint i;
+ sync_arr_t* arr;
+ sync_thread_t* thread_slot;
+
+ if (!sync_order_checks_on) {
+
+ return(NULL);
+ }
+
+ ut_a(!has_search_latch
+ || sync_thread_levels_contains(SYNC_SEARCH_SYS));
+
+ mutex_enter(&sync_thread_mutex);
+
+ thread_slot = sync_thread_level_arrays_find_slot();
+
+ if (thread_slot == NULL) {
+
+ mutex_exit(&sync_thread_mutex);
+
+ return(NULL);
+ }
+
+ arr = thread_slot->levels;
+
+ for (i = 0; i < arr->n_elems; ++i) {
+ const sync_level_t* slot;
+
+ slot = &arr->elems[i];
+
+ if (slot->latch != NULL
+ && (!has_search_latch
+ || slot->level != SYNC_SEARCH_SYS)) {
+
+ mutex_exit(&sync_thread_mutex);
+ ut_error;
+
+ return(slot->latch);
+ }
+ }
+
+ mutex_exit(&sync_thread_mutex);
+
+ return(NULL);
}
/******************************************************************//**
@@ -1097,10 +1145,10 @@ sync_thread_add_level(
ulint level) /*!< in: level in the latching order; if
SYNC_LEVEL_VARYING, nothing is done */
{
- sync_level_t* array;
+ ulint i;
sync_level_t* slot;
+ sync_arr_t* array;
sync_thread_t* thread_slot;
- ulint i;
if (!sync_order_checks_on) {
@@ -1125,20 +1173,23 @@ sync_thread_add_level(
thread_slot = sync_thread_level_arrays_find_slot();
if (thread_slot == NULL) {
- /* We have to allocate the level array for a new thread */
- array = ut_malloc(sizeof(sync_level_t) * SYNC_THREAD_N_LEVELS);
+ ulint sz;
- thread_slot = sync_thread_level_arrays_find_free();
+ sz = sizeof(*array)
+ + (sizeof(*array->elems) * SYNC_THREAD_N_LEVELS);
- thread_slot->id = os_thread_get_curr_id();
- thread_slot->levels = array;
+ /* We have to allocate the level array for a new thread */
+ array = calloc(sz, sizeof(char));
+ ut_a(array != NULL);
- for (i = 0; i < SYNC_THREAD_N_LEVELS; i++) {
+ array->next_free = ULINT_UNDEFINED;
+ array->max_elems = SYNC_THREAD_N_LEVELS;
+ array->elems = (sync_level_t*) &array[1];
- slot = sync_thread_levels_get_nth(array, i);
+ thread_slot = sync_thread_level_arrays_find_free();
- slot->latch = NULL;
- }
+ thread_slot->levels = array;
+ thread_slot->id = os_thread_get_curr_id();
}
array = thread_slot->levels;
@@ -1154,24 +1205,24 @@ sync_thread_add_level(
case SYNC_TREE_NODE_FROM_HASH:
/* Do no order checking */
break;
+ case SYNC_TRX_SYS_HEADER:
+ if (srv_is_being_started) {
+ /* This is violated during trx_sys_create_rsegs()
+ when creating additional rollback segments when
+ upgrading in innobase_start_or_create_for_mysql(). */
+ break;
+ }
case SYNC_MEM_POOL:
case SYNC_MEM_HASH:
case SYNC_RECV:
case SYNC_WORK_QUEUE:
case SYNC_LOG:
+ case SYNC_LOG_FLUSH_ORDER:
case SYNC_THR_LOCAL:
case SYNC_ANY_LATCH:
- case SYNC_TRX_SYS_HEADER:
+ case SYNC_OUTER_ANY_LATCH:
case SYNC_FILE_FORMAT_TAG:
case SYNC_DOUBLEWRITE:
- case SYNC_BUF_LRU_LIST:
- case SYNC_BUF_FLUSH_LIST:
- case SYNC_BUF_PAGE_HASH:
- case SYNC_BUF_FREE_LIST:
- case SYNC_BUF_ZIP_FREE:
- case SYNC_BUF_ZIP_HASH:
- case SYNC_BUF_POOL:
- case SYNC_SEARCH_SYS:
case SYNC_SEARCH_SYS_CONF:
case SYNC_TRX_LOCK_HEAP:
case SYNC_KERNEL:
@@ -1179,7 +1230,7 @@ sync_thread_add_level(
case SYNC_RSEG:
case SYNC_TRX_UNDO:
case SYNC_PURGE_LATCH:
- case SYNC_PURGE_SYS:
+ case SYNC_PURGE_QUEUE:
case SYNC_DICT_AUTOINC_MUTEX:
case SYNC_DICT_OPERATION:
case SYNC_DICT_HEADER:
@@ -1192,13 +1243,32 @@ sync_thread_add_level(
ut_error;
}
break;
+ case SYNC_SEARCH_SYS:
+ case SYNC_BUF_LRU_LIST:
+ case SYNC_BUF_FLUSH_LIST:
+ case SYNC_BUF_PAGE_HASH:
+ case SYNC_BUF_FREE_LIST:
+ case SYNC_BUF_ZIP_FREE:
+ case SYNC_BUF_ZIP_HASH:
+ case SYNC_BUF_POOL:
+ /* We can have multiple mutexes of this type therefore we
+ can only check whether the greater than condition holds. */
+ if (!sync_thread_levels_g(array, level-1, TRUE)) {
+ fprintf(stderr,
+ "InnoDB: sync_thread_levels_g(array, %lu)"
+ " does not hold!\n", level-1);
+ ut_error;
+ }
+ break;
+
case SYNC_BUF_BLOCK:
/* Either the thread must own the buffer pool mutex
- (buf_pool_mutex), or it is allowed to latch only ONE
- buffer block (block->mutex or buf_pool_zip_mutex). */
+ (buf_pool->mutex), or it is allowed to latch only ONE
+ buffer block (block->mutex or buf_pool->zip_mutex). */
if (!sync_thread_levels_g(array, level, FALSE)) {
ut_a(sync_thread_levels_g(array, level - 1, TRUE));
- ut_a(sync_thread_levels_contain(array, SYNC_BUF_LRU_LIST));
+ /* the exact rule is not fixed yet, for now */
+ //ut_a(sync_thread_levels_contain(array, SYNC_BUF_LRU_LIST));
}
break;
case SYNC_REC_LOCK:
@@ -1218,8 +1288,12 @@ sync_thread_add_level(
ut_a(sync_thread_levels_g(array, SYNC_IBUF_BITMAP - 1,
TRUE));
} else {
- ut_a(sync_thread_levels_g(array, SYNC_IBUF_BITMAP,
- TRUE));
+ /* This is violated during trx_sys_create_rsegs()
+ when creating additional rollback segments when
+ upgrading in innobase_start_or_create_for_mysql(). */
+ ut_a(srv_is_being_started
+ || sync_thread_levels_g(array, SYNC_IBUF_BITMAP,
+ TRUE));
}
break;
case SYNC_FSP_PAGE:
@@ -1230,10 +1304,16 @@ sync_thread_add_level(
|| sync_thread_levels_g(array, SYNC_FSP, TRUE));
break;
case SYNC_TRX_UNDO_PAGE:
+ /* Purge is allowed to read in as many UNDO pages as it likes,
+ there was a bogus rule here earlier that forced the caller to
+ acquire the purge_sys_t::mutex. The purge mutex did not really
+ protect anything because it was only ever acquired by the
+ single purge thread. The purge thread can read the UNDO pages
+ without any covering mutex. */
+
ut_a(sync_thread_levels_contain(array, SYNC_TRX_UNDO)
|| sync_thread_levels_contain(array, SYNC_RSEG)
- || sync_thread_levels_contain(array, SYNC_PURGE_SYS)
- || sync_thread_levels_g(array, SYNC_TRX_UNDO_PAGE, TRUE));
+ || sync_thread_levels_g(array, level - 1, TRUE));
break;
case SYNC_RSEG_HEADER:
ut_a(sync_thread_levels_contain(array, SYNC_RSEG));
@@ -1286,19 +1366,26 @@ sync_thread_add_level(
ut_error;
}
- for (i = 0; i < SYNC_THREAD_N_LEVELS; i++) {
+ if (array->next_free == ULINT_UNDEFINED) {
+ ut_a(array->n_elems < array->max_elems);
- slot = sync_thread_levels_get_nth(array, i);
+ i = array->n_elems++;
+ } else {
+ i = array->next_free;
+ array->next_free = array->elems[i].level;
+ }
- if (slot->latch == NULL) {
- slot->latch = latch;
- slot->level = level;
+ ut_a(i < array->n_elems);
+ ut_a(i != ULINT_UNDEFINED);
- break;
- }
- }
+ ++array->in_use;
+
+ slot = &array->elems[i];
- ut_a(i < SYNC_THREAD_N_LEVELS);
+ ut_a(slot->latch == NULL);
+
+ slot->latch = latch;
+ slot->level = level;
mutex_exit(&sync_thread_mutex);
}
@@ -1314,8 +1401,7 @@ sync_thread_reset_level(
/*====================*/
void* latch) /*!< in: pointer to a mutex or an rw-lock */
{
- sync_level_t* array;
- sync_level_t* slot;
+ sync_arr_t* array;
sync_thread_t* thread_slot;
ulint i;
@@ -1346,17 +1432,37 @@ sync_thread_reset_level(
array = thread_slot->levels;
- for (i = 0; i < SYNC_THREAD_N_LEVELS; i++) {
+ for (i = 0; i < array->n_elems; i++) {
+ sync_level_t* slot;
+
+ slot = &array->elems[i];
- slot = sync_thread_levels_get_nth(array, i);
+ if (slot->latch != latch) {
+ continue;
+ }
- if (slot->latch == latch) {
- slot->latch = NULL;
+ slot->latch = NULL;
- mutex_exit(&sync_thread_mutex);
+ /* Update the free slot list. See comment in sync_level_t
+ for the level field. */
+ slot->level = array->next_free;
+ array->next_free = i;
- return(TRUE);
+ ut_a(array->in_use >= 1);
+ --array->in_use;
+
+ /* If all cells are idle then reset the free
+ list. The assumption is that this will save
+ time when we need to scan up to n_elems. */
+
+ if (array->in_use == 0) {
+ array->n_elems = 0;
+ array->next_free = ULINT_UNDEFINED;
}
+
+ mutex_exit(&sync_thread_mutex);
+
+ return(TRUE);
}
if (((mutex_t*) latch)->magic_n != MUTEX_MAGIC_N) {
@@ -1386,11 +1492,6 @@ void
sync_init(void)
/*===========*/
{
-#ifdef UNIV_SYNC_DEBUG
- sync_thread_t* thread_slot;
- ulint i;
-#endif /* UNIV_SYNC_DEBUG */
-
ut_a(sync_initialized == FALSE);
sync_initialized = TRUE;
@@ -1404,35 +1505,64 @@ sync_init(void)
/* Create the thread latch level array where the latch levels
are stored for each OS thread */
- sync_thread_level_arrays = ut_malloc(OS_THREAD_MAX_N
- * sizeof(sync_thread_t));
- for (i = 0; i < OS_THREAD_MAX_N; i++) {
+ sync_thread_level_arrays = calloc(
+ sizeof(sync_thread_t), OS_THREAD_MAX_N);
+ ut_a(sync_thread_level_arrays != NULL);
- thread_slot = sync_thread_level_arrays_get_nth(i);
- thread_slot->levels = NULL;
- }
#endif /* UNIV_SYNC_DEBUG */
/* Init the mutex list and create the mutex to protect it. */
UT_LIST_INIT(mutex_list);
- mutex_create(&mutex_list_mutex, SYNC_NO_ORDER_CHECK);
+ mutex_create(mutex_list_mutex_key, &mutex_list_mutex,
+ SYNC_NO_ORDER_CHECK);
#ifdef UNIV_SYNC_DEBUG
- mutex_create(&sync_thread_mutex, SYNC_NO_ORDER_CHECK);
+ mutex_create(sync_thread_mutex_key, &sync_thread_mutex,
+ SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
/* Init the rw-lock list and create the mutex to protect it. */
UT_LIST_INIT(rw_lock_list);
- mutex_create(&rw_lock_list_mutex, SYNC_NO_ORDER_CHECK);
+ mutex_create(rw_lock_list_mutex_key, &rw_lock_list_mutex,
+ SYNC_NO_ORDER_CHECK);
#ifdef UNIV_SYNC_DEBUG
- mutex_create(&rw_lock_debug_mutex, SYNC_NO_ORDER_CHECK);
+ mutex_create(rw_lock_debug_mutex_key, &rw_lock_debug_mutex,
+ SYNC_NO_ORDER_CHECK);
rw_lock_debug_event = os_event_create(NULL);
rw_lock_debug_waiters = FALSE;
#endif /* UNIV_SYNC_DEBUG */
}
+#ifdef UNIV_SYNC_DEBUG
+/******************************************************************//**
+Frees all debug memory. */
+static
+void
+sync_thread_level_arrays_free(void)
+/*===============================*/
+
+{
+ ulint i;
+
+ for (i = 0; i < OS_THREAD_MAX_N; i++) {
+ sync_thread_t* slot;
+
+ slot = &sync_thread_level_arrays[i];
+
+ /* If this slot was allocated then free the slot memory too. */
+ if (slot->levels != NULL) {
+ free(slot->levels);
+ slot->levels = NULL;
+ }
+ }
+
+ free(sync_thread_level_arrays);
+ sync_thread_level_arrays = NULL;
+}
+#endif /* UNIV_SYNC_DEBUG */
+
/******************************************************************//**
Frees the resources in InnoDB's own synchronization data structures. Use
os_sync_free() after calling this. */
@@ -1445,17 +1575,20 @@ sync_close(void)
sync_array_free(sync_primary_wait_array);
- mutex = UT_LIST_GET_FIRST(mutex_list);
+ for (mutex = UT_LIST_GET_FIRST(mutex_list);
+ mutex != NULL;
+ /* No op */) {
- while (mutex) {
#ifdef UNIV_MEM_DEBUG
if (mutex == &mem_hash_mutex) {
mutex = UT_LIST_GET_NEXT(list, mutex);
continue;
}
#endif /* UNIV_MEM_DEBUG */
+
mutex_free(mutex);
- mutex = UT_LIST_GET_FIRST(mutex_list);
+
+ mutex = UT_LIST_GET_FIRST(mutex_list);
}
mutex_free(&mutex_list_mutex);
@@ -1464,6 +1597,8 @@ sync_close(void)
/* Switch latching order checks on in sync0sync.c */
sync_order_checks_on = FALSE;
+
+ sync_thread_level_arrays_free();
#endif /* UNIV_SYNC_DEBUG */
sync_initialized = FALSE;
@@ -1484,14 +1619,16 @@ sync_print_wait_info(
fprintf(file,
"Mutex spin waits %llu, rounds %llu, OS waits %llu\n"
- "RW-shared spins %llu, OS waits %llu;"
- " RW-excl spins %llu, OS waits %llu\n",
+ "RW-shared spins %llu, rounds %llu, OS waits %llu\n"
+ "RW-excl spins %llu, rounds %llu, OS waits %llu\n",
mutex_spin_wait_count,
mutex_spin_round_count,
mutex_os_wait_count,
rw_s_spin_wait_count,
+ rw_s_spin_round_count,
rw_s_os_wait_count,
rw_x_spin_wait_count,
+ rw_x_spin_round_count,
rw_x_os_wait_count);
fprintf(file,
diff --git a/storage/xtradb/thr/thr0loc.c b/storage/xtradb/thr/thr0loc.c
deleted file mode 100644
index 5b9e83be920..00000000000
--- a/storage/xtradb/thr/thr0loc.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. 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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file thr/thr0loc.c
-The thread local storage
-
-Created 10/5/1995 Heikki Tuuri
-*******************************************************/
-
-#include "thr0loc.h"
-#ifdef UNIV_NONINL
-#include "thr0loc.ic"
-#endif
-
-#include "sync0sync.h"
-#include "hash0hash.h"
-#include "mem0mem.h"
-#include "srv0srv.h"
-
-/*
- IMPLEMENTATION OF THREAD LOCAL STORAGE
- ======================================
-
-The threads sometimes need private data which depends on the thread id.
-This is implemented as a hash table, where the hash value is calculated
-from the thread id, to prepare for a large number of threads. The hash table
-is protected by a mutex. If you need modify the program and put new data to
-the thread local storage, just add it to struct thr_local_struct in the
-header file. */
-
-/** Mutex protecting thr_local_hash */
-static mutex_t thr_local_mutex;
-
-/** The hash table. The module is not yet initialized when it is NULL. */
-static hash_table_t* thr_local_hash = NULL;
-ulint thr_local_hash_n_nodes = 0;
-
-/** Thread local data */
-typedef struct thr_local_struct thr_local_t;
-
-/** @brief Thread local data.
-The private data for each thread should be put to
-the structure below and the accessor functions written
-for the field. */
-struct thr_local_struct{
- os_thread_id_t id; /*!< id of the thread which owns this struct */
- os_thread_t handle; /*!< operating system handle to the thread */
- ulint slot_no;/*!< the index of the slot in the thread table
- for this thread */
- ibool in_ibuf;/*!< TRUE if the thread is doing an ibuf
- operation */
- hash_node_t hash; /*!< hash chain node */
- ulint magic_n;/*!< magic number (THR_LOCAL_MAGIC_N) */
-};
-
-/** The value of thr_local_struct::magic_n */
-#define THR_LOCAL_MAGIC_N 1231234
-
-/*******************************************************************//**
-Returns the local storage struct for a thread.
-@return local storage */
-static
-thr_local_t*
-thr_local_get(
-/*==========*/
- os_thread_id_t id) /*!< in: thread id of the thread */
-{
- thr_local_t* local;
-
-try_again:
- ut_ad(thr_local_hash);
- ut_ad(mutex_own(&thr_local_mutex));
-
- /* Look for the local struct in the hash table */
-
- local = NULL;
-
- HASH_SEARCH(hash, thr_local_hash, os_thread_pf(id),
- thr_local_t*, local,, os_thread_eq(local->id, id));
- if (local == NULL) {
- mutex_exit(&thr_local_mutex);
-
- thr_local_create();
-
- mutex_enter(&thr_local_mutex);
-
- goto try_again;
- }
-
- ut_ad(local->magic_n == THR_LOCAL_MAGIC_N);
-
- return(local);
-}
-
-/*******************************************************************//**
-Gets the slot number in the thread table of a thread.
-@return slot number */
-UNIV_INTERN
-ulint
-thr_local_get_slot_no(
-/*==================*/
- os_thread_id_t id) /*!< in: thread id of the thread */
-{
- ulint slot_no;
- thr_local_t* local;
-
- mutex_enter(&thr_local_mutex);
-
- local = thr_local_get(id);
-
- slot_no = local->slot_no;
-
- mutex_exit(&thr_local_mutex);
-
- return(slot_no);
-}
-
-/*******************************************************************//**
-Sets the slot number in the thread table of a thread. */
-UNIV_INTERN
-void
-thr_local_set_slot_no(
-/*==================*/
- os_thread_id_t id, /*!< in: thread id of the thread */
- ulint slot_no)/*!< in: slot number */
-{
- thr_local_t* local;
-
- mutex_enter(&thr_local_mutex);
-
- local = thr_local_get(id);
-
- local->slot_no = slot_no;
-
- mutex_exit(&thr_local_mutex);
-}
-
-/*******************************************************************//**
-Returns pointer to the 'in_ibuf' field within the current thread local
-storage.
-@return pointer to the in_ibuf field */
-UNIV_INTERN
-ibool*
-thr_local_get_in_ibuf_field(void)
-/*=============================*/
-{
- thr_local_t* local;
-
- mutex_enter(&thr_local_mutex);
-
- local = thr_local_get(os_thread_get_curr_id());
-
- mutex_exit(&thr_local_mutex);
-
- return(&(local->in_ibuf));
-}
-
-/*******************************************************************//**
-Creates a local storage struct for the calling new thread. */
-UNIV_INTERN
-void
-thr_local_create(void)
-/*==================*/
-{
- thr_local_t* local;
-
- if (thr_local_hash == NULL) {
- thr_local_init();
- }
-
- local = mem_alloc(sizeof(thr_local_t));
-
- local->id = os_thread_get_curr_id();
- local->handle = os_thread_get_curr();
- local->magic_n = THR_LOCAL_MAGIC_N;
-
- local->in_ibuf = FALSE;
-
- mutex_enter(&thr_local_mutex);
-
- HASH_INSERT(thr_local_t, hash, thr_local_hash,
- os_thread_pf(os_thread_get_curr_id()),
- local);
-
- thr_local_hash_n_nodes++;
- mutex_exit(&thr_local_mutex);
-}
-
-/*******************************************************************//**
-Frees the local storage struct for the specified thread. */
-UNIV_INTERN
-void
-thr_local_free(
-/*===========*/
- os_thread_id_t id) /*!< in: thread id */
-{
- thr_local_t* local;
-
- mutex_enter(&thr_local_mutex);
-
- /* Look for the local struct in the hash table */
-
- HASH_SEARCH(hash, thr_local_hash, os_thread_pf(id),
- thr_local_t*, local,, os_thread_eq(local->id, id));
- if (local == NULL) {
- mutex_exit(&thr_local_mutex);
-
- return;
- }
-
- HASH_DELETE(thr_local_t, hash, thr_local_hash,
- os_thread_pf(id), local);
- thr_local_hash_n_nodes--;
-
- mutex_exit(&thr_local_mutex);
-
- ut_a(local->magic_n == THR_LOCAL_MAGIC_N);
-
- mem_free(local);
-}
-
-/****************************************************************//**
-Initializes the thread local storage module. */
-UNIV_INTERN
-void
-thr_local_init(void)
-/*================*/
-{
-
- ut_a(thr_local_hash == NULL);
-
- thr_local_hash = hash_create(OS_THREAD_MAX_N + 100);
-
- mutex_create(&thr_local_mutex, SYNC_THR_LOCAL);
-}
-
-/********************************************************************
-Close the thread local storage module. */
-UNIV_INTERN
-void
-thr_local_close(void)
-/*=================*/
-{
- ulint i;
-
- ut_a(thr_local_hash != NULL);
-
- /* Free the hash elements. We don't remove them from the table
- because we are going to destroy the table anyway. */
- for (i = 0; i < hash_get_n_cells(thr_local_hash); i++) {
- thr_local_t* local;
-
- local = HASH_GET_FIRST(thr_local_hash, i);
-
- while (local) {
- thr_local_t* prev_local = local;
-
- local = HASH_GET_NEXT(hash, prev_local);
- ut_a(prev_local->magic_n == THR_LOCAL_MAGIC_N);
- mem_free(prev_local);
- }
- }
-
- hash_table_free(thr_local_hash);
- thr_local_hash = NULL;
-}
-
-/*************************************************************************
-Return local hash table informations. */
-
-ulint
-thr_local_hash_cells(void)
-/*======================*/
-{
- if (thr_local_hash) {
- return (thr_local_hash->n_cells);
- } else {
- return 0;
- }
-}
-
-ulint
-thr_local_hash_nodes(void)
-/*======================*/
-{
- if (thr_local_hash) {
- return (thr_local_hash_n_nodes
- * (sizeof(thr_local_t) + MEM_BLOCK_HEADER_SIZE));
- } else {
- return 0;
- }
-}
diff --git a/storage/xtradb/trx/trx0i_s.c b/storage/xtradb/trx/trx0i_s.c
index 5bc8302d0c0..c18b747da6d 100644
--- a/storage/xtradb/trx/trx0i_s.c
+++ b/storage/xtradb/trx/trx0i_s.c
@@ -38,8 +38,6 @@ Created July 17, 2007 Vasil Dimov
#include <mysql/plugin.h>
-#include "mysql_addons.h"
-
#include "buf0buf.h"
#include "dict0dict.h"
#include "ha0storage.h"
@@ -193,6 +191,15 @@ INFORMATION SCHEMA tables is fetched and later retrieved by the C++
code in handler/i_s.cc. */
UNIV_INTERN trx_i_s_cache_t* trx_i_s_cache = &trx_i_s_cache_static;
+/* Key to register the lock/mutex with performance schema */
+#ifdef UNIV_PFS_RWLOCK
+UNIV_INTERN mysql_pfs_key_t trx_i_s_cache_lock_key;
+#endif /* UNIV_PFS_RWLOCK */
+
+#ifdef UNIV_PFS_MUTEX
+UNIV_INTERN mysql_pfs_key_t cache_last_read_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
/*******************************************************************//**
For a record lock that is in waiting state retrieves the only bit that
is set, for a table lock returns ULINT_UNDEFINED.
@@ -408,6 +415,42 @@ table_cache_create_empty_row(
return(row);
}
+#ifdef UNIV_DEBUG
+/*******************************************************************//**
+Validates a row in the locks cache.
+@return TRUE if valid */
+static
+ibool
+i_s_locks_row_validate(
+/*===================*/
+ const i_s_locks_row_t* row) /*!< in: row to validate */
+{
+ ut_ad(row->lock_trx_id != 0);
+ ut_ad(row->lock_mode != NULL);
+ ut_ad(row->lock_type != NULL);
+ ut_ad(row->lock_table != NULL);
+ ut_ad(row->lock_table_id != 0);
+
+ if (row->lock_space == ULINT_UNDEFINED) {
+ /* table lock */
+ ut_ad(!strcmp("TABLE", row->lock_type));
+ ut_ad(row->lock_index == NULL);
+ ut_ad(row->lock_data == NULL);
+ ut_ad(row->lock_page == ULINT_UNDEFINED);
+ ut_ad(row->lock_rec == ULINT_UNDEFINED);
+ } else {
+ /* record lock */
+ ut_ad(!strcmp("RECORD", row->lock_type));
+ ut_ad(row->lock_index != NULL);
+ /* row->lock_data == NULL if buf_page_try_get() == NULL */
+ ut_ad(row->lock_page != ULINT_UNDEFINED);
+ ut_ad(row->lock_rec != ULINT_UNDEFINED);
+ }
+
+ return(TRUE);
+}
+#endif /* UNIV_DEBUG */
+
/*******************************************************************//**
Fills i_s_trx_row_t object.
If memory can not be allocated then FALSE is returned.
@@ -431,26 +474,26 @@ fill_trx_row(
{
const char* stmt;
size_t stmt_len;
+ const char* s;
- row->trx_id = trx_get_id(trx);
+ ut_ad(mutex_own(&kernel_mutex));
+
+ row->trx_id = trx->id;
row->trx_started = (ib_time_t) 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
+ || i_s_locks_row_validate(requested_lock_row));
if (trx->wait_lock != NULL) {
-
ut_a(requested_lock_row != NULL);
-
- row->requested_lock_row = requested_lock_row;
row->trx_wait_started = (ib_time_t) trx->wait_started;
} else {
-
ut_a(requested_lock_row == NULL);
-
- row->requested_lock_row = NULL;
row->trx_wait_started = 0;
}
- row->trx_weight = (ullint) ut_conv_dulint_to_longlong(TRX_WEIGHT(trx));
+ row->trx_weight = (ullint) TRX_WEIGHT(trx);
if (trx->mysql_thd == NULL) {
/* For internal transactions e.g., purge and transactions
@@ -458,14 +501,13 @@ fill_trx_row(
thread data structure. */
row->trx_mysql_thread_id = 0;
row->trx_query = NULL;
- return(TRUE);
+ goto thd_done;
}
row->trx_mysql_thread_id = thd_get_thread_id(trx->mysql_thd);
stmt = innobase_get_stmt(trx->mysql_thd, &stmt_len);
if (stmt != NULL) {
-
char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
if (stmt_len > TRX_I_S_TRX_QUERY_MAX_LEN) {
@@ -476,9 +518,11 @@ fill_trx_row(
query[stmt_len] = '\0';
row->trx_query = ha_storage_put_memlim(
- cache->storage, stmt, stmt_len + 1,
+ cache->storage, query, stmt_len + 1,
MAX_ALLOWED_FOR_STORAGE(cache));
+ row->trx_query_cs = innobase_get_charset(trx->mysql_thd);
+
if (row->trx_query == NULL) {
return(FALSE);
@@ -488,6 +532,79 @@ fill_trx_row(
row->trx_query = NULL;
}
+thd_done:
+ s = trx->op_info;
+
+ if (s != NULL && s[0] != '\0') {
+
+ TRX_I_S_STRING_COPY(s, row->trx_operation_state,
+ TRX_I_S_TRX_OP_STATE_MAX_LEN, cache);
+
+ if (row->trx_operation_state == NULL) {
+
+ return(FALSE);
+ }
+ } else {
+
+ row->trx_operation_state = NULL;
+ }
+
+ row->trx_tables_in_use = trx->n_mysql_tables_in_use;
+
+ row->trx_tables_locked = trx->mysql_n_tables_locked;
+
+ row->trx_lock_structs = UT_LIST_GET_LEN(trx->trx_locks);
+
+ row->trx_lock_memory_bytes = mem_heap_get_size(trx->lock_heap);
+
+ row->trx_rows_locked = lock_number_of_rows_locked(trx);
+
+ row->trx_rows_modified = trx->undo_no;
+
+ row->trx_concurrency_tickets = trx->n_tickets_to_enter_innodb;
+
+ switch (trx->isolation_level) {
+ case TRX_ISO_READ_UNCOMMITTED:
+ row->trx_isolation_level = "READ UNCOMMITTED";
+ break;
+ case TRX_ISO_READ_COMMITTED:
+ row->trx_isolation_level = "READ COMMITTED";
+ break;
+ case TRX_ISO_REPEATABLE_READ:
+ row->trx_isolation_level = "REPEATABLE READ";
+ break;
+ case TRX_ISO_SERIALIZABLE:
+ row->trx_isolation_level = "SERIALIZABLE";
+ break;
+ /* Should not happen as TRX_ISO_READ_COMMITTED is default */
+ default:
+ row->trx_isolation_level = "UNKNOWN";
+ }
+
+ row->trx_unique_checks = (ibool) trx->check_unique_secondary;
+
+ row->trx_foreign_key_checks = (ibool) trx->check_foreigns;
+
+ s = trx->detailed_error;
+
+ if (s != NULL && s[0] != '\0') {
+
+ TRX_I_S_STRING_COPY(s,
+ row->trx_foreign_key_error,
+ TRX_I_S_TRX_FK_ERROR_MAX_LEN, cache);
+
+ if (row->trx_foreign_key_error == NULL) {
+
+ return(FALSE);
+ }
+ } else {
+ row->trx_foreign_key_error = NULL;
+ }
+
+ row->trx_has_search_latch = (ibool) trx->has_search_latch;
+
+ row->trx_search_latch_timeout = trx->search_latch_timeout;
+
return(TRUE);
}
@@ -729,6 +846,7 @@ fill_locks_row(
row->lock_table_id = lock_get_table_id(lock);
row->hash_chain.value = row;
+ ut_ad(i_s_locks_row_validate(row));
return(TRUE);
}
@@ -749,6 +867,9 @@ fill_lock_waits_row(
relevant blocking lock
row in innodb_locks */
{
+ ut_ad(i_s_locks_row_validate(requested_lock_row));
+ ut_ad(i_s_locks_row_validate(blocking_lock_row));
+
row->requested_lock_row = requested_lock_row;
row->blocking_lock_row = blocking_lock_row;
@@ -820,6 +941,7 @@ locks_row_eq_lock(
or ULINT_UNDEFINED if the lock
is a table lock */
{
+ ut_ad(i_s_locks_row_validate(row));
#ifdef TEST_NO_LOCKS_ROW_IS_EVER_EQUAL_TO_LOCK_T
return(0);
#else
@@ -877,7 +999,7 @@ search_innodb_locks(
/* auxiliary variable */
hash_chain,
/* assertion on every traversed item */
- ,
+ ut_ad(i_s_locks_row_validate(hash_chain->value)),
/* this determines if we have found the lock */
locks_row_eq_lock(hash_chain->value, lock, heap_no));
@@ -917,6 +1039,7 @@ add_lock_to_cache(
dst_row = search_innodb_locks(cache, lock, heap_no);
if (dst_row != NULL) {
+ ut_ad(i_s_locks_row_validate(dst_row));
return(dst_row);
}
#endif
@@ -954,6 +1077,7 @@ add_lock_to_cache(
} /* for()-loop */
#endif
+ ut_ad(i_s_locks_row_validate(dst_row));
return(dst_row);
}
@@ -1251,11 +1375,13 @@ trx_i_s_cache_init(
release trx_i_s_cache_t::last_read_mutex
release trx_i_s_cache_t::rw_lock */
- rw_lock_create(&cache->rw_lock, SYNC_TRX_I_S_RWLOCK);
+ rw_lock_create(trx_i_s_cache_lock_key, &cache->rw_lock,
+ SYNC_TRX_I_S_RWLOCK);
cache->last_read = 0;
- mutex_create(&cache->last_read_mutex, SYNC_TRX_I_S_LAST_READ);
+ mutex_create(cache_last_read_mutex_key,
+ &cache->last_read_mutex, SYNC_TRX_I_S_LAST_READ);
table_cache_init(&cache->innodb_trx, sizeof(i_s_trx_row_t));
table_cache_init(&cache->innodb_locks, sizeof(i_s_locks_row_t));
diff --git a/storage/xtradb/trx/trx0purge.c b/storage/xtradb/trx/trx0purge.c
index 1c317665878..eb4fa80fa40 100644
--- a/storage/xtradb/trx/trx0purge.c
+++ b/storage/xtradb/trx/trx0purge.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Innobase Oy. 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
@@ -41,7 +41,7 @@ Created 3/26/1996 Heikki Tuuri
#include "row0purge.h"
#include "row0upd.h"
#include "trx0rec.h"
-#include "srv0que.h"
+#include "srv0srv.h"
#include "os0thread.h"
/** The global data structure coordinating a purge */
@@ -51,6 +51,16 @@ UNIV_INTERN trx_purge_t* purge_sys = NULL;
which needs no purge */
UNIV_INTERN trx_undo_rec_t trx_purge_dummy_rec;
+#ifdef UNIV_PFS_RWLOCK
+/* Key to register trx_purge_latch with performance schema */
+UNIV_INTERN mysql_pfs_key_t trx_purge_latch_key;
+#endif /* UNIV_PFS_RWLOCK */
+
+#ifdef UNIV_PFS_MUTEX
+/* Key to register purge_sys_bh_mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t purge_sys_bh_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
/*****************************************************************//**
Checks if trx_id is >= purge_view: then it is guaranteed that its update
undo log still exists in the system.
@@ -135,47 +145,44 @@ void
trx_purge_arr_get_biggest(
/*======================*/
trx_undo_arr_t* arr, /*!< in: purge array */
- trx_id_t* trx_no, /*!< out: transaction number: ut_dulint_zero
+ trx_id_t* trx_no, /*!< out: transaction number: 0
if array is empty */
undo_no_t* undo_no)/*!< out: undo number */
{
trx_undo_inf_t* cell;
trx_id_t pair_trx_no;
undo_no_t pair_undo_no;
- int trx_cmp;
- ulint n_used;
ulint i;
ulint n;
- n = 0;
- n_used = arr->n_used;
- pair_trx_no = ut_dulint_zero;
- pair_undo_no = ut_dulint_zero;
+ n = arr->n_used;
+ pair_trx_no = 0;
+ pair_undo_no = 0;
- for (i = 0;; i++) {
- cell = trx_undo_arr_get_nth_info(arr, i);
+ if (n) {
+ for (i = 0;; i++) {
+ cell = trx_undo_arr_get_nth_info(arr, i);
- if (cell->in_use) {
- n++;
- trx_cmp = ut_dulint_cmp(cell->trx_no, pair_trx_no);
+ if (!cell->in_use) {
+ continue;
+ }
- if ((trx_cmp > 0)
- || ((trx_cmp == 0)
- && (ut_dulint_cmp(cell->undo_no,
- pair_undo_no) >= 0))) {
+ if ((cell->trx_no > pair_trx_no)
+ || ((cell->trx_no == pair_trx_no)
+ && cell->undo_no >= pair_undo_no)) {
pair_trx_no = cell->trx_no;
pair_undo_no = cell->undo_no;
}
- }
- if (n == n_used) {
- *trx_no = pair_trx_no;
- *undo_no = pair_undo_no;
-
- return;
+ if (!--n) {
+ break;
+ }
}
}
+
+ *trx_no = pair_trx_no;
+ *undo_no = pair_undo_no;
}
/****************************************************************//**
@@ -184,9 +191,8 @@ this query graph.
@return own: the query graph */
static
que_t*
-trx_purge_graph_build(
+trx_purge_graph_build(void)
/*=======================*/
- trx_t* trx)
{
mem_heap_t* heap;
que_fork_t* fork;
@@ -195,7 +201,7 @@ trx_purge_graph_build(
heap = mem_heap_create(512);
fork = que_fork_create(NULL, NULL, QUE_FORK_PURGE, heap);
- fork->trx = trx;
+ fork->trx = purge_sys->trx;
thr = que_thr_create(fork, heap);
@@ -213,24 +219,30 @@ Creates the global purge system control structure and inits the history
mutex. */
UNIV_INTERN
void
-trx_purge_sys_create(void)
-/*======================*/
+trx_purge_sys_create(
+/*=================*/
+ ib_bh_t* ib_bh) /*!< in, own: UNDO log min binary heap */
{
ut_ad(mutex_own(&kernel_mutex));
- purge_sys = mem_alloc(sizeof(trx_purge_t));
+ purge_sys = mem_zalloc(sizeof(trx_purge_t));
+ /* Take ownership of ib_bh, we are responsible for freeing it. */
+ purge_sys->ib_bh = ib_bh;
purge_sys->state = TRX_STOP_PURGE;
purge_sys->n_pages_handled = 0;
- purge_sys->purge_trx_no = ut_dulint_zero;
- purge_sys->purge_undo_no = ut_dulint_zero;
+ purge_sys->purge_trx_no = 0;
+ purge_sys->purge_undo_no = 0;
purge_sys->next_stored = FALSE;
- rw_lock_create(&purge_sys->latch, SYNC_PURGE_LATCH);
+ rw_lock_create(trx_purge_latch_key,
+ &purge_sys->latch, SYNC_PURGE_LATCH);
- mutex_create(&purge_sys->mutex, SYNC_PURGE_SYS);
+ mutex_create(
+ purge_sys_bh_mutex_key, &purge_sys->bh_mutex,
+ SYNC_PURGE_QUEUE);
purge_sys->heap = mem_heap_create(256);
@@ -244,35 +256,10 @@ trx_purge_sys_create(void)
ut_a(trx_start_low(purge_sys->trx, ULINT_UNDEFINED));
- purge_sys->query = trx_purge_graph_build(purge_sys->trx);
+ purge_sys->query = trx_purge_graph_build();
- purge_sys->view = read_view_oldest_copy_or_open_new(ut_dulint_zero,
+ purge_sys->view = read_view_oldest_copy_or_open_new(0,
purge_sys->heap);
-
- purge_sys->n_worker = 0;
- if (srv_use_purge_thread > 1) {
- /* Use worker threads */
- ulint i;
-
- purge_sys->n_worker = srv_use_purge_thread - 1;
-
- purge_sys->sess_arr = mem_alloc(sizeof(sess_t*) * purge_sys->n_worker);
- purge_sys->trx_arr = mem_alloc(sizeof(trx_t*) * purge_sys->n_worker);
- purge_sys->query_arr = mem_alloc(sizeof(que_t*) * purge_sys->n_worker);
-
- purge_sys->worker_event = os_event_create(NULL);
- os_event_reset(purge_sys->worker_event);
-
- for (i = 0; i < purge_sys->n_worker; i++) {
- purge_sys->sess_arr[i] = sess_open();
-
- purge_sys->trx_arr[i] = purge_sys->sess_arr[i]->trx;
- purge_sys->trx_arr[i]->is_purge = 1;
- ut_a(trx_start_low(purge_sys->trx_arr[i], ULINT_UNDEFINED));
-
- purge_sys->query_arr[i] = trx_purge_graph_build(purge_sys->trx_arr[i]);
- }
- }
}
/************************************************************************
@@ -305,9 +292,12 @@ trx_purge_sys_close(void)
trx_undo_arr_free(purge_sys->arr);
rw_lock_free(&purge_sys->latch);
- mutex_free(&purge_sys->mutex);
+ mutex_free(&purge_sys->bh_mutex);
mem_heap_free(purge_sys->heap);
+
+ ib_bh_free(purge_sys->ib_bh);
+
mem_free(purge_sys);
purge_sys = NULL;
@@ -328,32 +318,31 @@ trx_purge_add_update_undo_to_history(
mtr_t* mtr) /*!< in: mtr */
{
trx_undo_t* undo;
- trx_rseg_t* rseg;
trx_rsegf_t* rseg_header;
- trx_usegf_t* seg_header;
trx_ulogf_t* undo_header;
- trx_upagef_t* page_header;
- ulint hist_size;
undo = trx->update_undo;
ut_ad(undo);
- rseg = undo->rseg;
+ ut_ad(mutex_own(&undo->rseg->mutex));
- ut_ad(mutex_own(&(rseg->mutex)));
-
- rseg_header = trx_rsegf_get(rseg->space, rseg->zip_size,
- rseg->page_no, mtr);
+ rseg_header = trx_rsegf_get(
+ undo->rseg->space, undo->rseg->zip_size, undo->rseg->page_no,
+ mtr);
undo_header = undo_page + undo->hdr_offset;
- seg_header = undo_page + TRX_UNDO_SEG_HDR;
- page_header = undo_page + TRX_UNDO_PAGE_HDR;
+ /* Add the log as the first in the history list */
if (undo->state != TRX_UNDO_CACHED) {
+ ulint hist_size;
+#ifdef UNIV_DEBUG
+ trx_usegf_t* seg_header = undo_page + TRX_UNDO_SEG_HDR;
+#endif /* UNIV_DEBUG */
+
/* The undo log segment will not be reused */
- if (undo->id >= TRX_RSEG_N_SLOTS) {
+ if (UNIV_UNLIKELY(undo->id >= TRX_RSEG_N_SLOTS)) {
fprintf(stderr,
"InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
@@ -362,38 +351,51 @@ trx_purge_add_update_undo_to_history(
trx_rsegf_set_nth_undo(rseg_header, undo->id, FIL_NULL, mtr);
- hist_size = mtr_read_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
- MLOG_4BYTES, mtr);
+ hist_size = mtr_read_ulint(
+ rseg_header + TRX_RSEG_HISTORY_SIZE, MLOG_4BYTES, mtr);
+
ut_ad(undo->size == flst_get_len(
seg_header + TRX_UNDO_PAGE_LIST, mtr));
- mlog_write_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
- hist_size + undo->size, MLOG_4BYTES, mtr);
+ mlog_write_ulint(
+ rseg_header + TRX_RSEG_HISTORY_SIZE,
+ hist_size + undo->size, MLOG_4BYTES, mtr);
}
- /* Add the log as the first in the history list */
- flst_add_first(rseg_header + TRX_RSEG_HISTORY,
- undo_header + TRX_UNDO_HISTORY_NODE, mtr);
- mutex_enter(&kernel_mutex);
- trx_sys->rseg_history_len++;
- mutex_exit(&kernel_mutex);
+ flst_add_first(
+ rseg_header + TRX_RSEG_HISTORY,
+ undo_header + TRX_UNDO_HISTORY_NODE, mtr);
/* Write the trx number to the undo log header */
- mlog_write_dulint(undo_header + TRX_UNDO_TRX_NO, trx->no, mtr);
+
+ mlog_write_ull(undo_header + TRX_UNDO_TRX_NO, trx->no, mtr);
+
/* Write information about delete markings to the undo log header */
if (!undo->del_marks) {
- mlog_write_ulint(undo_header + TRX_UNDO_DEL_MARKS, FALSE,
- MLOG_2BYTES, mtr);
+ mlog_write_ulint(
+ undo_header + TRX_UNDO_DEL_MARKS, FALSE,
+ MLOG_2BYTES, mtr);
}
- if (rseg->last_page_no == FIL_NULL) {
+ if (undo->rseg->last_page_no == FIL_NULL) {
+ undo->rseg->last_trx_no = trx->no;
+ undo->rseg->last_offset = undo->hdr_offset;
+ undo->rseg->last_page_no = undo->hdr_page_no;
+ undo->rseg->last_del_marks = undo->del_marks;
- rseg->last_page_no = undo->hdr_page_no;
- rseg->last_offset = undo->hdr_offset;
- rseg->last_trx_no = trx->no;
- rseg->last_del_marks = undo->del_marks;
+ /* FIXME: Add a bin heap validate function to check that
+ the rseg exists. */
}
+
+ mutex_enter(&kernel_mutex);
+ trx_sys->rseg_history_len++;
+ mutex_exit(&kernel_mutex);
+
+// if (!(trx_sys->rseg_history_len % srv_purge_batch_size)) { /*should wake up always*/
+ /* Inform the purge thread that there is work to do. */
+ srv_wake_purge_thread_if_not_active();
+// }
}
/**********************************************************************//**
@@ -421,7 +423,6 @@ trx_purge_free_segment(
/* fputs("Freeing an update undo log segment\n", stderr); */
- ut_ad(mutex_own(&(purge_sys->mutex)));
loop:
mtr_start(&mtr);
mutex_enter(&(rseg->mutex));
@@ -521,11 +522,9 @@ trx_purge_truncate_rseg_history(
page_t* undo_page;
trx_ulogf_t* log_hdr;
trx_usegf_t* seg_hdr;
- int cmp;
ulint n_removed_logs = 0;
mtr_t mtr;
-
- ut_ad(mutex_own(&(purge_sys->mutex)));
+ trx_id_t undo_trx_no;
mtr_start(&mtr);
mutex_enter(&(rseg->mutex));
@@ -549,15 +548,16 @@ loop:
hdr_addr.page, &mtr);
log_hdr = undo_page + hdr_addr.boffset;
+ undo_trx_no = mach_read_from_8(log_hdr + TRX_UNDO_TRX_NO);
- cmp = ut_dulint_cmp(mach_read_from_8(log_hdr + TRX_UNDO_TRX_NO),
- limit_trx_no);
- if (cmp == 0) {
- trx_undo_truncate_start(rseg, rseg->space, hdr_addr.page,
- hdr_addr.boffset, limit_undo_no);
- }
+ if (undo_trx_no >= limit_trx_no) {
+ if (undo_trx_no == limit_trx_no) {
+ trx_undo_truncate_start(rseg, rseg->space,
+ hdr_addr.page,
+ hdr_addr.boffset,
+ limit_undo_no);
+ }
- if (cmp >= 0) {
mutex_enter(&kernel_mutex);
ut_a(trx_sys->rseg_history_len >= n_removed_logs);
trx_sys->rseg_history_len -= n_removed_logs;
@@ -618,12 +618,10 @@ trx_purge_truncate_history(void)
trx_id_t limit_trx_no;
undo_no_t limit_undo_no;
- ut_ad(mutex_own(&(purge_sys->mutex)));
-
- trx_purge_arr_get_biggest(purge_sys->arr, &limit_trx_no,
- &limit_undo_no);
+ trx_purge_arr_get_biggest(
+ purge_sys->arr, &limit_trx_no, &limit_undo_no);
- if (ut_dulint_is_zero(limit_trx_no)) {
+ if (limit_trx_no == 0) {
limit_trx_no = purge_sys->purge_trx_no;
limit_undo_no = purge_sys->purge_undo_no;
@@ -632,42 +630,36 @@ trx_purge_truncate_history(void)
/* We play safe and set the truncate limit at most to the purge view
low_limit number, though this is not necessary */
- if (ut_dulint_cmp(limit_trx_no, purge_sys->view->low_limit_no) >= 0) {
+ if (limit_trx_no >= purge_sys->view->low_limit_no) {
limit_trx_no = purge_sys->view->low_limit_no;
- limit_undo_no = ut_dulint_zero;
+ limit_undo_no = 0;
}
- ut_ad((ut_dulint_cmp(limit_trx_no,
- purge_sys->view->low_limit_no) <= 0));
+ ut_ad(limit_trx_no <= purge_sys->view->low_limit_no);
- rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
+ for (rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
+ rseg != NULL;
+ rseg = UT_LIST_GET_NEXT(rseg_list, rseg)) {
- while (rseg) {
- trx_purge_truncate_rseg_history(rseg, limit_trx_no,
- limit_undo_no);
- rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
+ trx_purge_truncate_rseg_history(
+ rseg, limit_trx_no, limit_undo_no);
}
}
/********************************************************************//**
Does a truncate if the purge array is empty. NOTE that when this function is
-called, the caller must not have any latches on undo log pages!
-@return TRUE if array empty */
+called, the caller must not have any latches on undo log pages! */
UNIV_INLINE
-ibool
+void
trx_purge_truncate_if_arr_empty(void)
/*=================================*/
{
- ut_ad(mutex_own(&(purge_sys->mutex)));
+ static ulint count;
- if (purge_sys->arr->n_used == 0) {
+ if (!(++count % TRX_SYS_N_RSEGS) && purge_sys->arr->n_used == 0) {
trx_purge_truncate_history();
-
- return(TRUE);
}
-
- return(FALSE);
}
/***********************************************************************//**
@@ -681,28 +673,27 @@ trx_purge_rseg_get_next_history_log(
{
page_t* undo_page;
trx_ulogf_t* log_hdr;
- trx_usegf_t* seg_hdr;
fil_addr_t prev_log_addr;
trx_id_t trx_no;
ibool del_marks;
mtr_t mtr;
-
- ut_ad(mutex_own(&(purge_sys->mutex)));
+ rseg_queue_t rseg_queue;
+ const void* ptr;
mutex_enter(&(rseg->mutex));
ut_a(rseg->last_page_no != FIL_NULL);
- purge_sys->purge_trx_no = ut_dulint_add(rseg->last_trx_no, 1);
- purge_sys->purge_undo_no = ut_dulint_zero;
+ purge_sys->purge_trx_no = rseg->last_trx_no + 1;
+ purge_sys->purge_undo_no = 0;
purge_sys->next_stored = FALSE;
mtr_start(&mtr);
- undo_page = trx_undo_page_get_s_latched(rseg->space, rseg->zip_size,
- rseg->last_page_no, &mtr);
+ undo_page = trx_undo_page_get_s_latched(
+ rseg->space, rseg->zip_size, rseg->last_page_no, &mtr);
+
log_hdr = undo_page + rseg->last_offset;
- seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
/* Increase the purge page count by one for every handled log */
@@ -710,6 +701,7 @@ trx_purge_rseg_get_next_history_log(
prev_log_addr = trx_purge_get_log_from_hist(
flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE, &mtr));
+
if (prev_log_addr.page == FIL_NULL) {
/* No logs left in the history list */
@@ -724,11 +716,11 @@ trx_purge_rseg_get_next_history_log(
on the MySQL mailing list on Nov 9, 2004. The fut0lst.c
file-based list was corrupt. The prev node pointer was
FIL_NULL, even though the list length was over 8 million nodes!
- We assume that purge truncates the history list in moderate
+ We assume that purge truncates the history list in large
size pieces, and if we here reach the head of the list, the
- list cannot be longer than 20 000 undo logs now. */
+ list cannot be longer than 2000 000 undo logs now. */
- if (trx_sys->rseg_history_len > 20000) {
+ if (trx_sys->rseg_history_len > 2000000) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: purge reached the"
@@ -768,106 +760,150 @@ trx_purge_rseg_get_next_history_log(
rseg->last_trx_no = trx_no;
rseg->last_del_marks = del_marks;
+ rseg_queue.rseg = rseg;
+ rseg_queue.trx_no = rseg->last_trx_no;
+
+ /* Purge can also produce events, however these are already ordered
+ in the rollback segment and any user generated event will be greater
+ than the events that Purge produces. ie. Purge can never produce
+ events from an empty rollback segment. */
+
+ mutex_enter(&purge_sys->bh_mutex);
+
+ ptr = ib_bh_push(purge_sys->ib_bh, &rseg_queue);
+ ut_a(ptr != NULL);
+
+ mutex_exit(&purge_sys->bh_mutex);
+
mutex_exit(&(rseg->mutex));
}
/***********************************************************************//**
-Chooses the next undo log to purge and updates the info in purge_sys. This
-function is used to initialize purge_sys when the next record to purge is
-not known, and also to update the purge system info on the next record when
-purge has handled the whole undo log for a transaction. */
+Chooses the rollback segment with the smallest trx_id.
+@return zip_size if log is for a compressed table, ULINT_UNDEFINED if
+ no rollback segments to purge, 0 for non compressed tables. */
static
-void
-trx_purge_choose_next_log(void)
-/*===========================*/
+ulint
+trx_purge_get_rseg_with_min_trx_id(
+/*===============================*/
+ trx_purge_t* purge_sys) /*!< in/out: purge instance */
+
{
- trx_undo_rec_t* rec;
- trx_rseg_t* rseg;
- trx_rseg_t* min_rseg;
- trx_id_t min_trx_no;
- ulint space = 0; /* remove warning (??? bug ???) */
ulint zip_size = 0;
- ulint page_no = 0; /* remove warning (??? bug ???) */
- ulint offset = 0; /* remove warning (??? bug ???) */
- mtr_t mtr;
- ut_ad(mutex_own(&(purge_sys->mutex)));
- ut_ad(purge_sys->next_stored == FALSE);
+ mutex_enter(&purge_sys->bh_mutex);
- rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
+ /* Only purge consumes events from the binary heap, user
+ threads only produce the events. */
- min_trx_no = ut_dulint_max;
+ if (!ib_bh_is_empty(purge_sys->ib_bh)) {
+ trx_rseg_t* rseg;
- min_rseg = NULL;
+ rseg = ((rseg_queue_t*) ib_bh_first(purge_sys->ib_bh))->rseg;
+ ib_bh_pop(purge_sys->ib_bh);
- while (rseg) {
- mutex_enter(&(rseg->mutex));
+ mutex_exit(&purge_sys->bh_mutex);
- if (rseg->last_page_no != FIL_NULL) {
+ purge_sys->rseg = rseg;
+ } else {
+ mutex_exit(&purge_sys->bh_mutex);
- if ((min_rseg == NULL)
- || (ut_dulint_cmp(min_trx_no,
- rseg->last_trx_no) > 0)) {
+ purge_sys->rseg = NULL;
- min_rseg = rseg;
- min_trx_no = rseg->last_trx_no;
- space = rseg->space;
- zip_size = rseg->zip_size;
- ut_a(space == 0); /* We assume in purge of
- externally stored fields
- that space id == 0 */
- page_no = rseg->last_page_no;
- offset = rseg->last_offset;
- }
- }
+ return(ULINT_UNDEFINED);
+ }
- mutex_exit(&(rseg->mutex));
+ ut_a(purge_sys->rseg != NULL);
- rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
- }
+ mutex_enter(&purge_sys->rseg->mutex);
- if (min_rseg == NULL) {
+ ut_a(purge_sys->rseg->last_page_no != FIL_NULL);
- return;
- }
+ /* We assume in purge of externally stored fields
+ that space id == 0 */
+ ut_a(purge_sys->rseg->space == 0);
- mtr_start(&mtr);
+ zip_size = purge_sys->rseg->zip_size;
- if (!min_rseg->last_del_marks) {
- /* No need to purge this log */
+ ut_a(purge_sys->purge_trx_no <= purge_sys->rseg->last_trx_no);
- rec = &trx_purge_dummy_rec;
- } else {
- rec = trx_undo_get_first_rec(space, zip_size, page_no, offset,
- RW_S_LATCH, &mtr);
- if (rec == NULL) {
- /* Undo log empty */
+ purge_sys->purge_trx_no = purge_sys->rseg->last_trx_no;
+
+ purge_sys->hdr_offset = purge_sys->rseg->last_offset;
+
+ purge_sys->hdr_page_no = purge_sys->rseg->last_page_no;
+
+ mutex_exit(&purge_sys->rseg->mutex);
- rec = &trx_purge_dummy_rec;
+ return(zip_size);
+}
+
+/***********************************************************************//**
+Position the purge sys "iterator" on the undo record to use for purging. */
+static
+void
+trx_purge_read_undo_rec(
+/*====================*/
+ trx_purge_t* purge_sys, /*!< in/out: purge instance */
+ ulint zip_size) /*!< in: block size or 0 */
+{
+ ulint page_no;
+ ulint offset = 0;
+ ib_uint64_t undo_no = 0;
+
+ purge_sys->hdr_offset = purge_sys->rseg->last_offset;
+ page_no = purge_sys->hdr_page_no = purge_sys->rseg->last_page_no;
+
+ if (purge_sys->rseg->last_del_marks) {
+ mtr_t mtr;
+ trx_undo_rec_t* undo_rec;
+
+ mtr_start(&mtr);
+
+ undo_rec = trx_undo_get_first_rec(
+ 0 /* System space id */, zip_size,
+ purge_sys->hdr_page_no,
+ purge_sys->hdr_offset, RW_S_LATCH, &mtr);
+
+ if (undo_rec != NULL) {
+ offset = page_offset(undo_rec);
+ undo_no = trx_undo_rec_get_undo_no(undo_rec);
+ page_no = page_get_page_no(page_align(undo_rec));
}
+
+ mtr_commit(&mtr);
}
+ purge_sys->offset = offset;
+ purge_sys->page_no = page_no;
+ purge_sys->purge_undo_no = undo_no;
+
purge_sys->next_stored = TRUE;
- purge_sys->rseg = min_rseg;
+}
+
+/***********************************************************************//**
+Chooses the next undo log to purge and updates the info in purge_sys. This
+function is used to initialize purge_sys when the next record to purge is
+not known, and also to update the purge system info on the next record when
+purge has handled the whole undo log for a transaction. */
+static
+void
+trx_purge_choose_next_log(void)
+/*===========================*/
+{
+ ulint zip_size;
- purge_sys->hdr_page_no = page_no;
- purge_sys->hdr_offset = offset;
+ ut_ad(purge_sys->next_stored == FALSE);
- purge_sys->purge_trx_no = min_trx_no;
+ zip_size = trx_purge_get_rseg_with_min_trx_id(purge_sys);
- if (rec == &trx_purge_dummy_rec) {
+ if (purge_sys->rseg != NULL) {
- purge_sys->purge_undo_no = ut_dulint_zero;
- purge_sys->page_no = page_no;
- purge_sys->offset = 0;
+ trx_purge_read_undo_rec(purge_sys, zip_size);
} else {
- purge_sys->purge_undo_no = trx_undo_rec_get_undo_no(rec);
-
- purge_sys->page_no = page_get_page_no(page_align(rec));
- purge_sys->offset = page_offset(rec);
+ /* There is nothing to do yet. */
+ os_thread_yield();
}
-
- mtr_commit(&mtr);
}
/***********************************************************************//**
@@ -893,7 +929,6 @@ trx_purge_get_next_rec(
ulint cmpl_info;
mtr_t mtr;
- ut_ad(mutex_own(&(purge_sys->mutex)));
ut_ad(purge_sys->next_stored);
space = purge_sys->rseg->space;
@@ -916,8 +951,8 @@ trx_purge_get_next_rec(
mtr_start(&mtr);
- undo_page = trx_undo_page_get_s_latched(space, zip_size,
- page_no, &mtr);
+ undo_page = trx_undo_page_get_s_latched(space, zip_size, page_no, &mtr);
+
rec = undo_page + offset;
rec2 = rec;
@@ -926,9 +961,9 @@ trx_purge_get_next_rec(
/* Try first to find the next record which requires a purge
operation from the same page of the same undo log */
- next_rec = trx_undo_page_get_next_rec(rec2,
- purge_sys->hdr_page_no,
- purge_sys->hdr_offset);
+ next_rec = trx_undo_page_get_next_rec(
+ rec2, purge_sys->hdr_page_no, purge_sys->hdr_offset);
+
if (next_rec == NULL) {
rec2 = trx_undo_get_next_rec(
rec2, purge_sys->hdr_page_no,
@@ -1008,17 +1043,12 @@ trx_purge_fetch_next_rec(
{
trx_undo_rec_t* undo_rec;
- mutex_enter(&(purge_sys->mutex));
if (purge_sys->state == TRX_STOP_PURGE) {
trx_purge_truncate_if_arr_empty();
- mutex_exit(&(purge_sys->mutex));
-
return(NULL);
- }
-
- if (!purge_sys->next_stored) {
+ } else if (!purge_sys->next_stored) {
trx_purge_choose_next_log();
if (!purge_sys->next_stored) {
@@ -1033,8 +1063,6 @@ trx_purge_fetch_next_rec(
(ulong) purge_sys->n_pages_handled);
}
- mutex_exit(&(purge_sys->mutex));
-
return(NULL);
}
}
@@ -1045,44 +1073,35 @@ trx_purge_fetch_next_rec(
trx_purge_truncate_if_arr_empty();
- mutex_exit(&(purge_sys->mutex));
-
return(NULL);
- }
-
- if (ut_dulint_cmp(purge_sys->purge_trx_no,
- purge_sys->view->low_limit_no) >= 0) {
+ } else if (purge_sys->purge_trx_no >= purge_sys->view->low_limit_no) {
purge_sys->state = TRX_STOP_PURGE;
trx_purge_truncate_if_arr_empty();
- mutex_exit(&(purge_sys->mutex));
-
return(NULL);
}
- /* fprintf(stderr, "Thread %lu purging trx %lu undo record %lu\n",
+ /* fprintf(stderr, "Thread %lu purging trx %llu undo record %llu\n",
os_thread_get_curr_id(),
- ut_dulint_get_low(purge_sys->purge_trx_no),
- ut_dulint_get_low(purge_sys->purge_undo_no)); */
+ (ullint) purge_sys->purge_trx_no,
+ (ullint) purge_sys->purge_undo_no); */
- *roll_ptr = trx_undo_build_roll_ptr(FALSE, (purge_sys->rseg)->id,
- purge_sys->page_no,
- purge_sys->offset);
- *cell = trx_purge_arr_store_info(purge_sys->purge_trx_no,
- purge_sys->purge_undo_no);
+ *roll_ptr = trx_undo_build_roll_ptr(
+ FALSE, (purge_sys->rseg)->id, purge_sys->page_no,
+ purge_sys->offset);
- ut_ad(ut_dulint_cmp(purge_sys->purge_trx_no,
- (purge_sys->view)->low_limit_no) < 0);
+ *cell = trx_purge_arr_store_info(
+ purge_sys->purge_trx_no, purge_sys->purge_undo_no);
+
+ ut_ad(purge_sys->purge_trx_no < purge_sys->view->low_limit_no);
/* The following call will advance the stored values of purge_trx_no
and purge_undo_no, therefore we had to store them first */
undo_rec = trx_purge_get_next_rec(heap);
- mutex_exit(&(purge_sys->mutex));
-
return(undo_rec);
}
@@ -1094,15 +1113,7 @@ trx_purge_rec_release(
/*==================*/
trx_undo_inf_t* cell) /*!< in: storage cell */
{
- trx_undo_arr_t* arr;
-
- mutex_enter(&(purge_sys->mutex));
-
- arr = purge_sys->arr;
-
trx_purge_arr_remove_info(cell);
-
- mutex_exit(&(purge_sys->mutex));
}
/*******************************************************************//**
@@ -1110,27 +1121,17 @@ This function runs a purge batch.
@return number of undo log pages handled in the batch */
UNIV_INTERN
ulint
-trx_purge(void)
-/*===========*/
+trx_purge(
+/*======*/
+ ulint limit) /*!< in: the maximum number of records to
+ purge in one batch */
{
que_thr_t* thr;
- /* que_thr_t* thr2; */
ulint old_pages_handled;
- mutex_enter(&(purge_sys->mutex));
-
- if (purge_sys->trx->n_active_thrs > 0) {
-
- mutex_exit(&(purge_sys->mutex));
-
- /* Should not happen */
-
- ut_error;
-
- return(0);
- }
+ ut_a(purge_sys->trx->n_active_thrs == 0);
- rw_lock_x_lock(&(purge_sys->latch));
+ rw_lock_x_lock(&purge_sys->latch);
mutex_enter(&kernel_mutex);
@@ -1163,21 +1164,19 @@ trx_purge(void)
}
}
- purge_sys->view = read_view_oldest_copy_or_open_new(ut_dulint_zero,
- purge_sys->heap);
+ purge_sys->view = read_view_oldest_copy_or_open_new(
+ 0, purge_sys->heap);
+
mutex_exit(&kernel_mutex);
rw_lock_x_unlock(&(purge_sys->latch));
purge_sys->state = TRX_PURGE_ON;
- /* Handle at most 20 undo log pages in one purge batch */
-
- purge_sys->handle_limit = purge_sys->n_pages_handled + 20 * (srv_use_purge_thread + 1);
+ purge_sys->handle_limit = purge_sys->n_pages_handled + limit;
old_pages_handled = purge_sys->n_pages_handled;
- mutex_exit(&(purge_sys->mutex));
mutex_enter(&kernel_mutex);
@@ -1185,18 +1184,8 @@ trx_purge(void)
ut_ad(thr);
- /* thr2 = que_fork_start_command(purge_sys->query);
-
- ut_ad(thr2); */
-
-
mutex_exit(&kernel_mutex);
- if (purge_sys->n_worker)
- os_event_set(purge_sys->worker_event);
-
- /* srv_que_task_enqueue(thr2); */
-
if (srv_print_thread_releases) {
fputs("Starting purge\n", stderr);
@@ -1204,9 +1193,6 @@ trx_purge(void)
que_run_threads(thr);
- if (purge_sys->n_worker)
- os_event_reset(purge_sys->worker_event);
-
if (srv_print_thread_releases) {
fprintf(stderr,
@@ -1217,52 +1203,6 @@ trx_purge(void)
return(purge_sys->n_pages_handled - old_pages_handled);
}
-/**********************************************************************
-This function runs a purge worker batch */
-UNIV_INTERN
-void
-trx_purge_worker(
-/*=============*/
- ulint worker_id)
-{
- que_thr_t* thr;
-
- mutex_enter(&kernel_mutex);
-
- thr = que_fork_start_command(purge_sys->query_arr[worker_id]);
-
- ut_ad(thr);
-
- mutex_exit(&kernel_mutex);
-
- que_run_threads(thr);
-
- if (purge_sys->state == TRX_STOP_PURGE) { /* optimistic */
- os_event_reset(purge_sys->worker_event);
- }
-}
-
-/**********************************************************************
-This function waits the event for worker batch */
-UNIV_INTERN
-void
-trx_purge_worker_wait(void)
-/*=======================*/
-{
- os_event_wait(purge_sys->worker_event);
-}
-
-/**********************************************************************
-This function wakes the waiting worker batch */
-UNIV_INTERN
-void
-trx_purge_worker_wake(void)
-/*=======================*/
-{
- if (purge_sys->n_worker)
- os_event_set(purge_sys->worker_event);
-}
-
/******************************************************************//**
Prints information of the purge system to stderr. */
UNIV_INTERN
@@ -1271,12 +1211,12 @@ trx_purge_sys_print(void)
/*=====================*/
{
fprintf(stderr, "InnoDB: Purge system view:\n");
- read_view_print(purge_sys->view);
+ read_view_print(stderr, purge_sys->view);
fprintf(stderr, "InnoDB: Purge trx n:o " TRX_ID_FMT
", undo n:o " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(purge_sys->purge_trx_no),
- TRX_ID_PREP_PRINTF(purge_sys->purge_undo_no));
+ (ullint) purge_sys->purge_trx_no,
+ (ullint) purge_sys->purge_undo_no);
fprintf(stderr,
"InnoDB: Purge next stored %lu, page_no %lu, offset %lu,\n"
"InnoDB: Purge hdr_page_no %lu, hdr_offset %lu\n",
diff --git a/storage/xtradb/trx/trx0rec.c b/storage/xtradb/trx/trx0rec.c
index f50e10ed756..84687c7195b 100644
--- a/storage/xtradb/trx/trx0rec.c
+++ b/storage/xtradb/trx/trx0rec.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Oracle and/or its affiliates. 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
@@ -242,8 +242,8 @@ trx_undo_page_report_insert(
/* Store first some general parameters to the undo log */
*ptr++ = TRX_UNDO_INSERT_REC;
- ptr += mach_dulint_write_much_compressed(ptr, trx->undo_no);
- ptr += mach_dulint_write_much_compressed(ptr, index->table->id);
+ ptr += mach_ull_write_much_compressed(ptr, trx->undo_no);
+ ptr += mach_ull_write_much_compressed(ptr, index->table->id);
/*----------------------------------------*/
/* Store then the fields required to uniquely determine the record
to be inserted in the clustered index */
@@ -289,7 +289,7 @@ trx_undo_rec_get_pars(
ibool* updated_extern, /*!< out: TRUE if we updated an
externally stored fild */
undo_no_t* undo_no, /*!< out: undo log record number */
- dulint* table_id) /*!< out: table id */
+ table_id_t* table_id) /*!< out: table id */
{
byte* ptr;
ulint type_cmpl;
@@ -309,11 +309,11 @@ trx_undo_rec_get_pars(
*type = type_cmpl & (TRX_UNDO_CMPL_INFO_MULT - 1);
*cmpl_info = type_cmpl / TRX_UNDO_CMPL_INFO_MULT;
- *undo_no = mach_dulint_read_much_compressed(ptr);
- ptr += mach_dulint_get_much_compressed_size(*undo_no);
+ *undo_no = mach_ull_read_much_compressed(ptr);
+ ptr += mach_ull_get_much_compressed_size(*undo_no);
- *table_id = mach_dulint_read_much_compressed(ptr);
- ptr += mach_dulint_get_much_compressed_size(*table_id);
+ *table_id = mach_ull_read_much_compressed(ptr);
+ ptr += mach_ull_get_much_compressed_size(*table_id);
return(ptr);
}
@@ -351,10 +351,10 @@ trx_undo_rec_get_col_val(
ut_ad(*orig_len >= BTR_EXTERN_FIELD_REF_SIZE);
ut_ad(*len > *orig_len);
/* @see dtuple_convert_big_rec() */
- ut_ad(*len >= BTR_EXTERN_FIELD_REF_SIZE * 2);
+ ut_ad(*len >= BTR_EXTERN_FIELD_REF_SIZE);
/* we do not have access to index->table here
ut_ad(dict_table_get_format(index->table) >= DICT_TF_FORMAT_ZIP
- || *len >= REC_MAX_INDEX_COL_LEN
+ || *len >= col->max_prefix
+ BTR_EXTERN_FIELD_REF_SIZE);
*/
@@ -456,9 +456,10 @@ static
byte*
trx_undo_page_fetch_ext(
/*====================*/
- byte* ext_buf, /*!< in: a buffer of
- REC_MAX_INDEX_COL_LEN
- + BTR_EXTERN_FIELD_REF_SIZE */
+ byte* ext_buf, /*!< in: buffer to hold the prefix
+ data and BLOB pointer */
+ ulint prefix_len, /*!< in: prefix size to store
+ in the undo log */
ulint zip_size, /*!< compressed page size in bytes,
or 0 for uncompressed BLOB */
const byte* field, /*!< in: an externally stored column */
@@ -467,7 +468,7 @@ trx_undo_page_fetch_ext(
{
/* Fetch the BLOB. */
ulint ext_len = btr_copy_externally_stored_field_prefix(
- ext_buf, REC_MAX_INDEX_COL_LEN, zip_size, field, *len);
+ ext_buf, prefix_len, zip_size, field, *len);
/* BLOBs should always be nonempty. */
ut_a(ext_len);
/* Append the BLOB pointer to the prefix. */
@@ -488,10 +489,11 @@ trx_undo_page_report_modify_ext(
byte* ptr, /*!< in: undo log position,
at least 15 bytes must be available */
byte* ext_buf, /*!< in: a buffer of
- REC_MAX_INDEX_COL_LEN
- + BTR_EXTERN_FIELD_REF_SIZE,
+ DICT_MAX_FIELD_LEN_BY_FORMAT() size,
or NULL when should not fetch
a longer prefix */
+ ulint prefix_len, /*!< prefix size to store in the
+ undo log */
ulint zip_size, /*!< compressed page size in bytes,
or 0 for uncompressed BLOB */
const byte** field, /*!< in/out: the locally stored part of
@@ -499,6 +501,8 @@ trx_undo_page_report_modify_ext(
ulint* len) /*!< in/out: length of field, in bytes */
{
if (ext_buf) {
+ ut_a(prefix_len > 0);
+
/* If an ordering column is externally stored, we will
have to store a longer prefix of the field. In this
case, write to the log a marker followed by the
@@ -507,7 +511,7 @@ trx_undo_page_report_modify_ext(
ptr += mach_write_compressed(ptr, *len);
- *field = trx_undo_page_fetch_ext(ext_buf, zip_size,
+ *field = trx_undo_page_fetch_ext(ext_buf, prefix_len, zip_size,
*field, len);
ptr += mach_write_compressed(ptr, *len);
@@ -553,7 +557,7 @@ trx_undo_page_report_modify(
ulint i;
trx_id_t trx_id;
ibool ignore_prefix = FALSE;
- byte ext_buf[REC_MAX_INDEX_COL_LEN
+ byte ext_buf[REC_VERSION_56_MAX_INDEX_COL_LEN
+ BTR_EXTERN_FIELD_REF_SIZE];
ut_a(dict_index_is_clust(index));
@@ -598,9 +602,9 @@ trx_undo_page_report_modify(
type_cmpl_ptr = ptr;
*ptr++ = (byte) type_cmpl;
- ptr += mach_dulint_write_much_compressed(ptr, trx->undo_no);
+ ptr += mach_ull_write_much_compressed(ptr, trx->undo_no);
- ptr += mach_dulint_write_much_compressed(ptr, table->id);
+ ptr += mach_ull_write_much_compressed(ptr, table->id);
/*----------------------------------------*/
/* Store the state of the info bits */
@@ -620,16 +624,16 @@ trx_undo_page_report_modify(
by some other trx as it must have committed by now for us to
allow an over-write. */
if (ignore_prefix) {
- ignore_prefix = ut_dulint_cmp(trx_id, trx->id) != 0;
+ ignore_prefix = (trx_id != trx->id);
}
- ptr += mach_dulint_write_compressed(ptr, trx_id);
+ ptr += mach_ull_write_compressed(ptr, trx_id);
field = rec_get_nth_field(rec, offsets,
dict_index_get_sys_col_pos(
index, DATA_ROLL_PTR), &flen);
ut_ad(flen == DATA_ROLL_PTR_LEN);
- ptr += mach_dulint_write_compressed(ptr, trx_read_roll_ptr(field));
+ ptr += mach_ull_write_compressed(ptr, trx_read_roll_ptr(field));
/*----------------------------------------*/
/* Store then the fields required to uniquely determine the
@@ -665,14 +669,27 @@ trx_undo_page_report_modify(
/* Save to the undo log the old values of the columns to be updated. */
if (update) {
+ ulint extended = 0;
+
if (trx_undo_left(undo_page, ptr) < 5) {
return(0);
}
- ptr += mach_write_compressed(ptr, upd_get_n_fields(update));
+ if (srv_use_sys_stats_table
+ && index == UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes)) {
+ for (i = 0; i < upd_get_n_fields(update); i++) {
+ ulint pos = upd_get_nth_field(update, i)->field_no;
+
+ if (pos >= rec_offs_n_fields(offsets)) {
+ extended++;
+ }
+ }
+ }
- for (i = 0; i < upd_get_n_fields(update); i++) {
+ ptr += mach_write_compressed(ptr, upd_get_n_fields(update) - extended);
+
+ for (i = 0; i < upd_get_n_fields(update) - extended; i++) {
ulint pos = upd_get_nth_field(update, i)->field_no;
@@ -693,13 +710,21 @@ trx_undo_page_report_modify(
}
if (rec_offs_nth_extern(offsets, pos)) {
+ const dict_col_t* col
+ = dict_index_get_nth_col(index, pos);
+ ulint prefix_len
+ = dict_max_field_len_store_undo(
+ table, col);
+
+ ut_ad(prefix_len + BTR_EXTERN_FIELD_REF_SIZE
+ <= sizeof ext_buf);
+
ptr = trx_undo_page_report_modify_ext(
ptr,
- dict_index_get_nth_col(index, pos)
- ->ord_part
+ col->ord_part
&& !ignore_prefix
- && flen < REC_MAX_INDEX_COL_LEN
- ? ext_buf : NULL,
+ && flen < REC_ANTELOPE_MAX_INDEX_COL_LEN
+ ? ext_buf : NULL, prefix_len,
dict_table_zip_size(table),
&field, &flen);
@@ -778,11 +803,20 @@ trx_undo_page_report_modify(
&flen);
if (rec_offs_nth_extern(offsets, pos)) {
+ const dict_col_t* col =
+ dict_index_get_nth_col(
+ index, pos);
+ ulint prefix_len =
+ dict_max_field_len_store_undo(
+ table, col);
+
+ ut_a(prefix_len < sizeof ext_buf);
+
ptr = trx_undo_page_report_modify_ext(
ptr,
- flen < REC_MAX_INDEX_COL_LEN
+ flen < REC_ANTELOPE_MAX_INDEX_COL_LEN
&& !ignore_prefix
- ? ext_buf : NULL,
+ ? ext_buf : NULL, prefix_len,
dict_table_zip_size(table),
&field, &flen);
} else {
@@ -848,11 +882,11 @@ trx_undo_update_rec_get_sys_cols(
/* Read the values of the system columns */
- *trx_id = mach_dulint_read_compressed(ptr);
- ptr += mach_dulint_get_compressed_size(*trx_id);
+ *trx_id = mach_ull_read_compressed(ptr);
+ ptr += mach_ull_get_compressed_size(*trx_id);
- *roll_ptr = mach_dulint_read_compressed(ptr);
- ptr += mach_dulint_get_compressed_size(*roll_ptr);
+ *roll_ptr = mach_ull_read_compressed(ptr);
+ ptr += mach_ull_get_compressed_size(*roll_ptr);
return(ptr);
}
@@ -1082,11 +1116,11 @@ trx_undo_rec_get_partial_row(
undo log record. */
if (!ignore_prefix && col->ord_part) {
ut_a(dfield_get_len(dfield)
- >= 2 * BTR_EXTERN_FIELD_REF_SIZE);
+ >= BTR_EXTERN_FIELD_REF_SIZE);
ut_a(dict_table_get_format(index->table)
>= DICT_TF_FORMAT_ZIP
|| dfield_get_len(dfield)
- >= REC_MAX_INDEX_COL_LEN
+ >= REC_ANTELOPE_MAX_INDEX_COL_LEN
+ BTR_EXTERN_FIELD_REF_SIZE);
}
}
@@ -1168,7 +1202,7 @@ trx_undo_report_row_operation(
index, otherwise NULL */
roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the
inserted undo log record,
- ut_dulint_zero if BTR_NO_UNDO_LOG
+ 0 if BTR_NO_UNDO_LOG
flag was specified */
{
trx_t* trx;
@@ -1186,7 +1220,7 @@ trx_undo_report_row_operation(
if (flags & BTR_NO_UNDO_LOG_FLAG) {
- *roll_ptr = ut_dulint_zero;
+ *roll_ptr = 0;
return(DB_SUCCESS);
}
@@ -1284,7 +1318,7 @@ trx_undo_report_row_operation(
undo->top_undo_no = trx->undo_no;
undo->guess_block = undo_block;
- UT_DULINT_INC(trx->undo_no);
+ trx->undo_no++;
mutex_exit(&trx->undo_mutex);
@@ -1433,7 +1467,7 @@ trx_undo_prev_version_build(
trx_id_t rec_trx_id;
ulint type;
undo_no_t undo_no;
- dulint table_id;
+ table_id_t table_id;
trx_id_t trx_id;
roll_ptr_t roll_ptr;
roll_ptr_t old_roll_ptr;
@@ -1523,7 +1557,7 @@ trx_undo_prev_version_build(
roll_ptr, info_bits,
NULL, heap, &update);
- if (ut_dulint_cmp(table_id, index->table->id) != 0) {
+ if (UNIV_UNLIKELY(table_id != index->table->id)) {
ptr = NULL;
fprintf(stderr,
@@ -1544,16 +1578,14 @@ trx_undo_prev_version_build(
fprintf(stderr,
"InnoDB: table %s, index %s, n_uniq %lu\n"
"InnoDB: undo rec address %p, type %lu cmpl_info %lu\n"
- "InnoDB: undo rec table id %lu %lu,"
- " index table id %lu %lu\n"
+ "InnoDB: undo rec table id %llu,"
+ " index table id %llu\n"
"InnoDB: dump of 150 bytes in undo rec: ",
index->table_name, index->name,
(ulong) dict_index_get_n_unique(index),
undo_rec, (ulong) type, (ulong) cmpl_info,
- (ulong) ut_dulint_get_high(table_id),
- (ulong) ut_dulint_get_low(table_id),
- (ulong) ut_dulint_get_high(index->table->id),
- (ulong) ut_dulint_get_low(index->table->id));
+ (ullint) table_id,
+ (ullint) index->table->id);
ut_print_buf(stderr, undo_rec, 150);
fputs("\n"
"InnoDB: index record ", stderr);
@@ -1564,19 +1596,19 @@ trx_undo_prev_version_build(
fprintf(stderr, "\n"
"InnoDB: Record trx id " TRX_ID_FMT
", update rec trx id " TRX_ID_FMT "\n"
- "InnoDB: Roll ptr in rec %lu %lu, in update rec"
- " %lu %lu\n",
- TRX_ID_PREP_PRINTF(rec_trx_id),
- TRX_ID_PREP_PRINTF(trx_id),
- (ulong) ut_dulint_get_high(old_roll_ptr),
- (ulong) ut_dulint_get_low(old_roll_ptr),
- (ulong) ut_dulint_get_high(roll_ptr),
- (ulong) ut_dulint_get_low(roll_ptr));
+ "InnoDB: Roll ptr in rec " TRX_ID_FMT
+ ", in update rec" TRX_ID_FMT "\n",
+ (ullint) rec_trx_id, (ullint) trx_id,
+ (ullint) old_roll_ptr, (ullint) roll_ptr);
trx_purge_sys_print();
return(DB_ERROR);
}
+# ifdef UNIV_BLOB_NULL_DEBUG
+ ut_a(!rec_offs_any_null_extern(rec, offsets));
+# endif /* UNIV_BLOB_NULL_DEBUG */
+
if (row_upd_changes_field_size_or_external(index, offsets, update)) {
ulint n_ext;
diff --git a/storage/xtradb/trx/trx0roll.c b/storage/xtradb/trx/trx0roll.c
index c925478cdf4..b55471959ce 100644
--- a/storage/xtradb/trx/trx0roll.c
+++ b/storage/xtradb/trx/trx0roll.c
@@ -37,7 +37,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0rec.h"
#include "que0que.h"
#include "usr0sess.h"
-#include "srv0que.h"
#include "srv0start.h"
#include "row0undo.h"
#include "row0mysql.h"
@@ -48,12 +47,12 @@ Created 3/26/1996 Heikki Tuuri
rollback */
#define TRX_ROLL_TRUNC_THRESHOLD 1
-/** In crash recovery, the current trx to be rolled back */
-static trx_t* trx_roll_crash_recv_trx = NULL;
+/** In crash recovery, the current trx to be rolled back; NULL otherwise */
+static const trx_t* trx_roll_crash_recv_trx = NULL;
/** In crash recovery we set this to the undo n:o of the current trx to be
rolled back. Then we can print how many % the rollback has progressed. */
-static ib_int64_t trx_roll_max_undo_no;
+static undo_no_t trx_roll_max_undo_no;
/** Auxiliary variable which tells the previous progress % we printed */
static ulint trx_roll_progress_printed_pct;
@@ -444,7 +443,7 @@ trx_rollback_active(
ut_a(thr == que_fork_start_command(fork));
trx_roll_crash_recv_trx = trx;
- trx_roll_max_undo_no = ut_conv_dulint_to_longlong(trx->undo_no);
+ trx_roll_max_undo_no = trx->undo_no;
trx_roll_progress_printed_pct = 0;
rows_to_undo = trx_roll_max_undo_no;
@@ -457,14 +456,10 @@ trx_rollback_active(
fprintf(stderr,
" InnoDB: Rolling back trx with id " TRX_ID_FMT ", %lu%s"
" rows to undo\n",
- TRX_ID_PREP_PRINTF(trx->id),
+ (ullint) trx->id,
(ulong) rows_to_undo, unit);
mutex_exit(&kernel_mutex);
- trx->mysql_thread_id = os_thread_get_curr_id();
-
- trx->mysql_process_no = os_proc_get_number();
-
if (trx_get_dict_operation(trx) != TRX_DICT_OP_NONE) {
row_mysql_lock_data_dictionary(trx);
dictionary_locked = TRUE;
@@ -479,8 +474,9 @@ trx_rollback_active(
mutex_exit(&kernel_mutex);
fprintf(stderr,
- "InnoDB: Waiting for rollback of trx id %lu to end\n",
- (ulong) ut_dulint_get_low(trx->id));
+ "InnoDB: Waiting for rollback of trx id "
+ TRX_ID_FMT " to end\n",
+ (ullint) trx->id);
os_thread_sleep(100000);
mutex_enter(&kernel_mutex);
@@ -489,16 +485,15 @@ trx_rollback_active(
mutex_exit(&kernel_mutex);
if (trx_get_dict_operation(trx) != TRX_DICT_OP_NONE
- && !ut_dulint_is_zero(trx->table_id)) {
+ && trx->table_id != 0) {
/* If the transaction was for a dictionary operation, we
drop the relevant table, if it still exists */
fprintf(stderr,
- "InnoDB: Dropping table with id %lu %lu"
+ "InnoDB: Dropping table with id %llu"
" in recovery if it exists\n",
- (ulong) ut_dulint_get_high(trx->table_id),
- (ulong) ut_dulint_get_low(trx->table_id));
+ (ullint) trx->table_id);
table = dict_table_get_on_id_low(trx->table_id);
@@ -522,7 +517,7 @@ trx_rollback_active(
fprintf(stderr, "\nInnoDB: Rolling back of trx id " TRX_ID_FMT
" completed\n",
- TRX_ID_PREP_PRINTF(trx->id));
+ (ullint) trx->id);
mem_heap_free(heap);
trx_roll_crash_recv_trx = NULL;
@@ -575,7 +570,7 @@ loop:
fprintf(stderr,
"InnoDB: Cleaning up trx with id "
TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(trx->id));
+ (ullint) trx->id);
trx_cleanup_at_db_startup(trx);
goto loop;
@@ -615,6 +610,10 @@ trx_rollback_or_clean_all_recovered(
/*!< in: a dummy parameter required by
os_thread_create */
{
+#ifdef UNIV_PFS_THREAD
+ pfs_register_thread(trx_rollback_clean_thread_key);
+#endif /* UNIV_PFS_THREAD */
+
trx_rollback_or_clean_recovered(TRUE);
/* We count the number of threads in os_thread_exit(). A created
@@ -707,7 +706,7 @@ trx_undo_arr_store_info(
} else {
n++;
- if (0 == ut_dulint_cmp(cell->undo_no, undo_no)) {
+ if (cell->undo_no == undo_no) {
if (stored_here) {
stored_here->in_use = FALSE;
@@ -740,18 +739,13 @@ trx_undo_arr_remove_info(
undo_no_t undo_no)/*!< in: undo number */
{
trx_undo_inf_t* cell;
- ulint n_used;
- ulint n;
ulint i;
- n_used = arr->n_used;
- n = 0;
-
for (i = 0;; i++) {
cell = trx_undo_arr_get_nth_info(arr, i);
if (cell->in_use
- && 0 == ut_dulint_cmp(cell->undo_no, undo_no)) {
+ && cell->undo_no == undo_no) {
cell->in_use = FALSE;
@@ -766,7 +760,7 @@ trx_undo_arr_remove_info(
/*******************************************************************//**
Gets the biggest undo number in an array.
-@return biggest value, ut_dulint_zero if the array is empty */
+@return biggest value, 0 if the array is empty */
static
undo_no_t
trx_undo_arr_get_biggest(
@@ -781,14 +775,14 @@ trx_undo_arr_get_biggest(
n = 0;
n_used = arr->n_used;
- biggest = ut_dulint_zero;
+ biggest = 0;
for (i = 0;; i++) {
cell = trx_undo_arr_get_nth_info(arr, i);
if (cell->in_use) {
n++;
- if (ut_dulint_cmp(cell->undo_no, biggest) > 0) {
+ if (cell->undo_no > biggest) {
biggest = cell->undo_no;
}
@@ -824,9 +818,9 @@ trx_roll_try_truncate(
if (arr->n_used > 0) {
biggest = trx_undo_arr_get_biggest(arr);
- if (ut_dulint_cmp(biggest, limit) >= 0) {
+ if (biggest >= limit) {
- limit = ut_dulint_add(biggest, 1);
+ limit = biggest + 1;
}
}
@@ -862,9 +856,9 @@ trx_roll_pop_top_rec(
undo->top_page_no, mtr);
offset = undo->top_offset;
- /* fprintf(stderr, "Thread %lu undoing trx %lu undo record %lu\n",
- os_thread_get_curr_id(), ut_dulint_get_low(trx->id),
- ut_dulint_get_low(undo->top_undo_no)); */
+ /* fprintf(stderr, "Thread %lu undoing trx " TRX_ID_FMT
+ " undo record " TRX_ID_FMT "\n",
+ os_thread_get_curr_id(), trx->id, undo->top_undo_no); */
prev_rec = trx_undo_get_prev_rec(undo_page + offset,
undo->hdr_page_no, undo->hdr_offset,
@@ -935,15 +929,14 @@ try_again:
undo = upd_undo;
} else if (!upd_undo || upd_undo->empty) {
undo = ins_undo;
- } else if (ut_dulint_cmp(upd_undo->top_undo_no,
- ins_undo->top_undo_no) > 0) {
+ } else if (upd_undo->top_undo_no > ins_undo->top_undo_no) {
undo = upd_undo;
} else {
undo = ins_undo;
}
if (!undo || undo->empty
- || (ut_dulint_cmp(limit, undo->top_undo_no) > 0)) {
+ || limit > undo->top_undo_no) {
if ((trx->undo_no_arr)->n_used == 0) {
/* Rollback is ending */
@@ -975,7 +968,7 @@ try_again:
undo_no = trx_undo_rec_get_undo_no(undo_rec);
- ut_ad(ut_dulint_cmp(ut_dulint_add(undo_no, 1), trx->undo_no) == 0);
+ ut_ad(undo_no + 1 == trx->undo_no);
/* We print rollback progress info if we are in a crash recovery
and the transaction has at least 1000 row operations to undo. */
@@ -983,8 +976,7 @@ try_again:
if (trx == trx_roll_crash_recv_trx && trx_roll_max_undo_no > 1000) {
progress_pct = 100 - (ulint)
- ((ut_conv_dulint_to_longlong(undo_no) * 100)
- / trx_roll_max_undo_no);
+ ((undo_no * 100) / trx_roll_max_undo_no);
if (progress_pct != trx_roll_progress_printed_pct) {
if (trx_roll_progress_printed_pct == 0) {
fprintf(stderr,
@@ -1087,22 +1079,21 @@ trx_rollback(
/* Initialize the rollback field in the transaction */
- if (sig->type == TRX_SIG_TOTAL_ROLLBACK) {
-
- trx->roll_limit = ut_dulint_zero;
-
- } else if (sig->type == TRX_SIG_ROLLBACK_TO_SAVEPT) {
-
+ switch (sig->type) {
+ case TRX_SIG_TOTAL_ROLLBACK:
+ trx->roll_limit = 0;
+ break;
+ case TRX_SIG_ROLLBACK_TO_SAVEPT:
trx->roll_limit = (sig->savept).least_undo_no;
-
- } else if (sig->type == TRX_SIG_ERROR_OCCURRED) {
-
+ break;
+ case TRX_SIG_ERROR_OCCURRED:
trx->roll_limit = trx->last_sql_stat_start.least_undo_no;
- } else {
+ break;
+ default:
ut_error;
}
- ut_a(ut_dulint_cmp(trx->roll_limit, trx->undo_no) <= 0);
+ ut_a(trx->roll_limit <= trx->undo_no);
trx->pages_undone = 0;
@@ -1266,8 +1257,8 @@ trx_finish_rollback_off_kernel(
#ifdef UNIV_DEBUG
if (lock_print_waits) {
- fprintf(stderr, "Trx %lu rollback finished\n",
- (ulong) ut_dulint_get_low(trx->id));
+ fprintf(stderr, "Trx " TRX_ID_FMT " rollback finished\n",
+ (ullint) trx->id);
}
#endif /* UNIV_DEBUG */
diff --git a/storage/xtradb/trx/trx0rseg.c b/storage/xtradb/trx/trx0rseg.c
index 57b5611d624..85beac8afbc 100644
--- a/storage/xtradb/trx/trx0rseg.c
+++ b/storage/xtradb/trx/trx0rseg.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Oracle Corpn. 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
@@ -34,6 +34,11 @@ Created 3/26/1996 Heikki Tuuri
#include "srv0srv.h"
#include "trx0purge.h"
+#ifdef UNIV_PFS_MUTEX
+/* Key to register rseg_mutex_key with performance schema */
+UNIV_INTERN mysql_pfs_key_t rseg_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
/******************************************************************//**
Looks for a rollback segment, based on the rollback segment id.
@return rollback segment */
@@ -45,13 +50,11 @@ trx_rseg_get_on_id(
{
trx_rseg_t* rseg;
- rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
- ut_ad(rseg);
+ ut_a(id < TRX_SYS_N_RSEGS);
- while (rseg->id != id) {
- rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
- ut_ad(rseg);
- }
+ rseg = trx_sys->rseg_array[id];
+
+ ut_a(rseg == NULL || id == rseg->id);
return(rseg);
}
@@ -68,7 +71,7 @@ trx_rseg_header_create(
ulint zip_size, /*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint max_size, /*!< in: max size in pages */
- ulint* slot_no, /*!< out: rseg id == slot number in trx sys */
+ ulint rseg_slot_no, /*!< in: rseg id == slot number in trx sys */
mtr_t* mtr) /*!< in: mtr */
{
ulint page_no;
@@ -81,14 +84,6 @@ trx_rseg_header_create(
ut_ad(mutex_own(&kernel_mutex));
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
MTR_MEMO_X_LOCK));
- sys_header = trx_sysf_get(mtr);
-
- *slot_no = trx_sysf_rseg_find_free(mtr);
-
- if (*slot_no == ULINT_UNDEFINED) {
-
- return(FIL_NULL);
- }
/* Allocate a new file segment for the rollback segment */
block = fseg_create(space, 0,
@@ -122,11 +117,13 @@ trx_rseg_header_create(
trx_rsegf_set_nth_undo(rsegf, i, FIL_NULL, mtr);
}
- /* Add the rollback segment info to the free slot in the trx system
- header */
+ /* Add the rollback segment info to the free slot in
+ the trx system header */
- trx_sysf_rseg_set_space(sys_header, *slot_no, space, mtr);
- trx_sysf_rseg_set_page_no(sys_header, *slot_no, page_no, mtr);
+ sys_header = trx_sysf_get(mtr);
+
+ trx_sysf_rseg_set_space(sys_header, rseg_slot_no, space, mtr);
+ trx_sysf_rseg_set_page_no(sys_header, rseg_slot_no, page_no, mtr);
return(page_no);
}
@@ -184,30 +181,33 @@ static
trx_rseg_t*
trx_rseg_mem_create(
/*================*/
- ulint id, /*!< in: rollback segment id */
- ulint space, /*!< in: space where the segment placed */
- ulint zip_size, /*!< in: compressed page size in bytes
- or 0 for uncompressed pages */
- ulint page_no, /*!< in: page number of the segment header */
- mtr_t* mtr) /*!< in: mtr */
+ ulint id, /*!< in: rollback segment id */
+ ulint space, /*!< in: space where the segment
+ placed */
+ ulint zip_size, /*!< in: compressed page size in bytes
+ or 0 for uncompressed pages */
+ ulint page_no, /*!< in: page number of the segment
+ header */
+ ib_bh_t* ib_bh, /*!< in/out: rseg queue */
+ mtr_t* mtr) /*!< in: mtr */
{
- trx_rsegf_t* rseg_header;
+ ulint len;
trx_rseg_t* rseg;
- trx_ulogf_t* undo_log_hdr;
fil_addr_t node_addr;
+ trx_rsegf_t* rseg_header;
+ trx_ulogf_t* undo_log_hdr;
ulint sum_of_undo_sizes;
- ulint len;
ut_ad(mutex_own(&kernel_mutex));
- rseg = mem_alloc(sizeof(trx_rseg_t));
+ rseg = mem_zalloc(sizeof(trx_rseg_t));
rseg->id = id;
rseg->space = space;
rseg->zip_size = zip_size;
rseg->page_no = page_no;
- mutex_create(&rseg->mutex, SYNC_RSEG);
+ mutex_create(rseg_mutex_key, &rseg->mutex, SYNC_RSEG);
UT_LIST_ADD_LAST(rseg_list, trx_sys->rseg_list, rseg);
@@ -228,6 +228,9 @@ trx_rseg_mem_create(
len = flst_get_len(rseg_header + TRX_RSEG_HISTORY, mtr);
if (len > 0) {
+ const void* ptr;
+ rseg_queue_t rseg_queue;
+
trx_sys->rseg_history_len += len;
node_addr = trx_purge_get_log_from_hist(
@@ -239,10 +242,21 @@ trx_rseg_mem_create(
node_addr.page,
mtr) + node_addr.boffset;
- rseg->last_trx_no = mtr_read_dulint(
- undo_log_hdr + TRX_UNDO_TRX_NO, mtr);
+ rseg->last_trx_no = mach_read_from_8(
+ undo_log_hdr + TRX_UNDO_TRX_NO);
rseg->last_del_marks = mtr_read_ulint(
undo_log_hdr + TRX_UNDO_DEL_MARKS, MLOG_2BYTES, mtr);
+
+ rseg_queue.rseg = rseg;
+ rseg_queue.trx_no = rseg->last_trx_no;
+
+ if (rseg->last_page_no != FIL_NULL) {
+ /* There is no need to cover this operation by the purge
+ mutex because we are still bootstrapping. */
+
+ ptr = ib_bh_push(ib_bh, &rseg_queue);
+ ut_a(ptr != NULL);
+ }
} else {
rseg->last_page_no = FIL_NULL;
}
@@ -250,75 +264,111 @@ trx_rseg_mem_create(
return(rseg);
}
-/*********************************************************************//**
-Creates the memory copies for rollback segments and initializes the
+/********************************************************************
+Creates the memory copies for the rollback segments and initializes the
rseg list and array in trx_sys at a database startup. */
-UNIV_INTERN
+static
void
-trx_rseg_list_and_array_init(
-/*=========================*/
+trx_rseg_create_instance(
+/*=====================*/
trx_sysf_t* sys_header, /*!< in: trx system header */
+ ib_bh_t* ib_bh, /*!< in/out: rseg queue */
mtr_t* mtr) /*!< in: mtr */
{
- ulint i;
- ulint page_no;
- ulint space;
-
- UT_LIST_INIT(trx_sys->rseg_list);
-
- trx_sys->rseg_history_len = 0;
+ ulint i;
for (i = 0; i < TRX_SYS_N_RSEGS; i++) {
+ ulint page_no;
page_no = trx_sysf_rseg_get_page_no(sys_header, i, mtr);
if (page_no == FIL_NULL) {
-
trx_sys_set_nth_rseg(trx_sys, i, NULL);
} else {
- ulint zip_size;
+ ulint space;
+ ulint zip_size;
+ trx_rseg_t* rseg = NULL;
+
+ ut_a(!trx_rseg_get_on_id(i));
space = trx_sysf_rseg_get_space(sys_header, i, mtr);
zip_size = space ? fil_space_get_zip_size(space) : 0;
- trx_rseg_mem_create(i, space, zip_size, page_no, mtr);
+ rseg = trx_rseg_mem_create(
+ i, space, zip_size, page_no, ib_bh, mtr);
+
+ ut_a(rseg->id == i);
}
}
}
-/****************************************************************//**
-Creates a new rollback segment to the database.
-@return the created segment object, NULL if fail */
+/*********************************************************************
+Creates a rollback segment.
+@return pointer to new rollback segment if create successful */
UNIV_INTERN
trx_rseg_t*
-trx_rseg_create(
-/*============*/
- ulint space, /*!< in: space id */
- ulint max_size, /*!< in: max size in pages */
- ulint* id, /*!< out: rseg id */
- mtr_t* mtr) /*!< in: mtr */
+trx_rseg_create(void)
+/*=================*/
{
- ulint flags;
- ulint zip_size;
- ulint page_no;
- trx_rseg_t* rseg;
+ mtr_t mtr;
+ ulint slot_no;
+ trx_rseg_t* rseg = NULL;
+
+ mtr_start(&mtr);
+
+ /* To obey the latching order, acquire the file space
+ x-latch before the kernel mutex. */
+ mtr_x_lock(fil_space_get_latch(TRX_SYS_SPACE, NULL), &mtr);
- mtr_x_lock(fil_space_get_latch(space, &flags), mtr);
- zip_size = dict_table_flags_to_zip_size(flags);
mutex_enter(&kernel_mutex);
- page_no = trx_rseg_header_create(space, zip_size, max_size, id, mtr);
+ slot_no = trx_sysf_rseg_find_free(&mtr);
- if (page_no == FIL_NULL) {
+ if (slot_no != ULINT_UNDEFINED) {
+ ulint space;
+ ulint page_no;
+ ulint zip_size;
+ trx_sysf_t* sys_header;
- mutex_exit(&kernel_mutex);
- return(NULL);
- }
+ page_no = trx_rseg_header_create(
+ TRX_SYS_SPACE, 0, ULINT_MAX, slot_no, &mtr);
+
+ ut_a(page_no != FIL_NULL);
+
+ ut_ad(!trx_rseg_get_on_id(slot_no));
+
+ sys_header = trx_sysf_get(&mtr);
+
+ space = trx_sysf_rseg_get_space(sys_header, slot_no, &mtr);
- rseg = trx_rseg_mem_create(*id, space, zip_size, page_no, mtr);
+ zip_size = space ? fil_space_get_zip_size(space) : 0;
+
+ rseg = trx_rseg_mem_create(
+ slot_no, space, zip_size, page_no,
+ purge_sys->ib_bh, &mtr);
+ }
mutex_exit(&kernel_mutex);
+ mtr_commit(&mtr);
return(rseg);
}
+
+/********************************************************************
+Initialize the rollback instance list. */
+UNIV_INTERN
+void
+trx_rseg_list_and_array_init(
+/*=========================*/
+ trx_sysf_t* sys_header, /*!< in: trx system header */
+ ib_bh_t* ib_bh, /*!< in: rseg queue */
+ mtr_t* mtr) /*!< in: mtr */
+{
+ UT_LIST_INIT(trx_sys->rseg_list);
+
+ trx_sys->rseg_history_len = 0;
+
+ trx_rseg_create_instance(sys_header, ib_bh, mtr);
+}
+
diff --git a/storage/xtradb/trx/trx0sys.c b/storage/xtradb/trx/trx0sys.c
index 11581a3f2ae..548f383742f 100644
--- a/storage/xtradb/trx/trx0sys.c
+++ b/storage/xtradb/trx/trx0sys.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Innobase Oy. 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
@@ -37,6 +37,7 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0rseg.h"
#include "trx0undo.h"
#include "srv0srv.h"
+#include "srv0start.h"
#include "trx0purge.h"
#include "log0log.h"
#include "log0recv.h"
@@ -130,9 +131,15 @@ static const char* file_format_name_map[] = {
static const ulint FILE_FORMAT_NAME_N
= sizeof(file_format_name_map) / sizeof(file_format_name_map[0]);
+#ifdef UNIV_PFS_MUTEX
+/* Key to register the mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t trx_doublewrite_mutex_key;
+UNIV_INTERN mysql_pfs_key_t file_format_max_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
#ifndef UNIV_HOTBACKUP
/** This is used to track the maximum file format id known to InnoDB. It's
-updated via SET GLOBAL innodb_file_format_check = 'x' or when we open
+updated via SET GLOBAL innodb_file_format_max = 'x' or when we open
or create a table. */
static file_format_t file_format_max;
@@ -183,7 +190,8 @@ trx_doublewrite_init(
os_do_not_call_flush_at_each_write = TRUE;
#endif /* UNIV_DO_FLUSH */
- mutex_create(&trx_doublewrite->mutex, SYNC_DOUBLEWRITE);
+ mutex_create(trx_doublewrite_mutex_key,
+ &trx_doublewrite->mutex, SYNC_DOUBLEWRITE);
trx_doublewrite->first_free = 0;
@@ -245,7 +253,9 @@ trx_sys_create_doublewrite_buf(void)
{
buf_block_t* block;
buf_block_t* block2;
+#ifdef UNIV_SYNC_DEBUG
buf_block_t* new_block;
+#endif /* UNIV_SYNC_DEBUG */
byte* doublewrite;
byte* fseg_header;
ulint page_no;
@@ -348,8 +358,11 @@ start_again:
the page position in the tablespace, then the page
has not been written to in doublewrite. */
- new_block = buf_page_get(TRX_SYS_SPACE, 0, page_no,
- RW_X_LATCH, &mtr);
+#ifdef UNIV_SYNC_DEBUG
+ new_block =
+#endif /* UNIV_SYNC_DEBUG */
+ buf_page_get(TRX_SYS_SPACE, 0, page_no,
+ RW_X_LATCH, &mtr);
buf_block_dbg_add_level(new_block,
SYNC_NO_ORDER_CHECK);
@@ -425,17 +438,17 @@ start_again:
} else {
fprintf(stderr,
"InnoDB: Doublewrite buffer not found in the doublewrite file:"
- " creating new\n");
+ " creating new doublewrite buffer.\n");
if (buf_pool_get_curr_size()
< ((2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ FSP_EXTENT_SIZE / 2 + 100)
* UNIV_PAGE_SIZE)) {
fprintf(stderr,
- "InnoDB: Cannot create doublewrite buffer:"
- " you must\n"
+ "InnoDB: Cannot create the doublewrite buffer:"
+ " You must\n"
"InnoDB: increase your buffer pool size.\n"
- "InnoDB: Cannot continue operation.\n");
+ "InnoDB: Cannot continue processing.\n");
exit(1);
}
@@ -451,10 +464,10 @@ start_again:
if (block2 == NULL) {
fprintf(stderr,
- "InnoDB: Cannot create doublewrite buffer:"
- " you must\n"
+ "InnoDB: Cannot create the doublewrite buffer:"
+ " You must\n"
"InnoDB: increase your tablespace size.\n"
- "InnoDB: Cannot continue operation.\n");
+ "InnoDB: Cannot continue processing.\n");
/* We exit without committing the mtr to prevent
its modifications to the database getting to disk */
@@ -473,8 +486,8 @@ start_again:
FSP_UP, &mtr);
if (page_no == FIL_NULL) {
fprintf(stderr,
- "InnoDB: Cannot create doublewrite"
- " buffer: you must\n"
+ "InnoDB: Cannot create the doublewrite"
+ " buffer: You must\n"
"InnoDB: increase your"
" tablespace size.\n"
"InnoDB: Cannot continue operation.\n"
@@ -492,8 +505,11 @@ start_again:
the page position in the tablespace, then the page
has not been written to in doublewrite. */
- new_block = buf_page_get(TRX_DOUBLEWRITE_SPACE, 0, page_no,
- RW_X_LATCH, &mtr);
+#ifdef UNIV_SYNC_DEBUG
+ new_block =
+#endif /* UNIV_SYNC_DEBUG */
+ buf_page_get(TRX_DOUBLEWRITE_SPACE, 0, page_no,
+ RW_X_LATCH, &mtr);
buf_block_dbg_add_level(new_block,
SYNC_NO_ORDER_CHECK);
@@ -826,8 +842,8 @@ trx_sys_flush_max_trx_id(void)
sys_header = trx_sysf_get(&mtr);
- mlog_write_dulint(sys_header + TRX_SYS_TRX_ID_STORE,
- trx_sys->max_trx_id, &mtr);
+ mlog_write_ull(sys_header + TRX_SYS_TRX_ID_STORE,
+ trx_sys->max_trx_id, &mtr);
mtr_commit(&mtr);
}
@@ -855,8 +871,7 @@ trx_sys_update_mysql_binlog_offset(
/* -> To store relay log file information, file_name must fit to the 480 bytes */
file_name = "";
- }
- else {
+ } else {
file_name = file_name_in;
}
@@ -1069,7 +1084,8 @@ trx_sysf_create(
buf_block_t* block;
page_t* page;
ulint page_no;
- ulint i;
+ byte* ptr;
+ ulint len;
ut_ad(mtr);
@@ -1102,37 +1118,60 @@ trx_sysf_create(
sys_header = trx_sysf_get(mtr);
/* Start counting transaction ids from number 1 up */
- mlog_write_dulint(sys_header + TRX_SYS_TRX_ID_STORE,
- ut_dulint_create(0, 1), mtr);
+ mach_write_to_8(sys_header + TRX_SYS_TRX_ID_STORE, 1);
- /* Reset the rollback segment slots */
- for (i = 0; i < TRX_SYS_N_RSEGS; i++) {
+ /* Reset the rollback segment slots. Old versions of InnoDB
+ define TRX_SYS_N_RSEGS as 256 (TRX_SYS_OLD_N_RSEGS) and expect
+ that the whole array is initialized. */
+ ptr = TRX_SYS_RSEGS + sys_header;
+ len = ut_max(TRX_SYS_OLD_N_RSEGS, TRX_SYS_N_RSEGS)
+ * TRX_SYS_RSEG_SLOT_SIZE;
+ memset(ptr, 0xff, len);
+ ptr += len;
+ ut_a(ptr <= page + (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END));
- trx_sysf_rseg_set_space(sys_header, i, ULINT_UNDEFINED, mtr);
- trx_sysf_rseg_set_page_no(sys_header, i, FIL_NULL, mtr);
- }
+ /* Initialize all of the page. This part used to be uninitialized. */
+ memset(ptr, 0, UNIV_PAGE_SIZE - FIL_PAGE_DATA_END + page - ptr);
- /* The remaining area (up to the page trailer) is uninitialized.
- Silence Valgrind warnings about it. */
- UNIV_MEM_VALID(sys_header + (TRX_SYS_RSEGS
- + TRX_SYS_N_RSEGS * TRX_SYS_RSEG_SLOT_SIZE
- + TRX_SYS_RSEG_SPACE),
- (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END
- - (TRX_SYS_RSEGS
- + TRX_SYS_N_RSEGS * TRX_SYS_RSEG_SLOT_SIZE
- + TRX_SYS_RSEG_SPACE))
- + page - sys_header);
+ mlog_log_string(sys_header, UNIV_PAGE_SIZE - FIL_PAGE_DATA_END
+ + page - sys_header, mtr);
/* Create the first rollback segment in the SYSTEM tablespace */
- page_no = trx_rseg_header_create(TRX_SYS_SPACE, 0, ULINT_MAX, &slot_no,
+ slot_no = trx_sysf_rseg_find_free(mtr);
+ page_no = trx_rseg_header_create(TRX_SYS_SPACE, 0, ULINT_MAX, slot_no,
mtr);
ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID);
- ut_a(page_no != FIL_NULL);
+ ut_a(page_no == FSP_FIRST_RSEG_PAGE_NO);
mutex_exit(&kernel_mutex);
}
/*****************************************************************//**
+Compare two trx_rseg_t instances on last_trx_no. */
+static
+int
+trx_rseg_compare_last_trx_no(
+/*=========================*/
+ const void* p1, /*!< in: elem to compare */
+ const void* p2) /*!< in: elem to compare */
+{
+ ib_int64_t cmp;
+
+ const rseg_queue_t* rseg_q1 = (const rseg_queue_t*) p1;
+ const rseg_queue_t* rseg_q2 = (const rseg_queue_t*) p2;
+
+ cmp = rseg_q1->trx_no - rseg_q2->trx_no;
+
+ if (cmp < 0) {
+ return(-1);
+ } else if (cmp > 0) {
+ return(1);
+ }
+
+ return(0);
+}
+
+/*****************************************************************//**
Creates dummy of the file page for the transaction system. */
static
void
@@ -1218,10 +1257,11 @@ trx_sys_init_at_db_start(void)
/*==========================*/
{
trx_sysf_t* sys_header;
- ib_int64_t rows_to_undo = 0;
+ ib_uint64_t rows_to_undo = 0;
const char* unit = "";
trx_t* trx;
mtr_t mtr;
+ ib_bh_t* ib_bh;
mtr_start(&mtr);
@@ -1229,11 +1269,19 @@ trx_sys_init_at_db_start(void)
mutex_enter(&kernel_mutex);
- trx_sys = mem_alloc(sizeof(trx_sys_t));
+ /* We create the min binary heap here and pass ownership to
+ purge when we init the purge sub-system. Purge is responsible
+ for freeing the binary heap. */
+
+ ib_bh = ib_bh_create(
+ trx_rseg_compare_last_trx_no,
+ sizeof(rseg_queue_t), TRX_SYS_N_RSEGS);
+
+ trx_sys = mem_zalloc(sizeof(*trx_sys));
sys_header = trx_sysf_get(&mtr);
- trx_rseg_list_and_array_init(sys_header, &mtr);
+ trx_rseg_list_and_array_init(sys_header, ib_bh, &mtr);
trx_sys->latest_rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
@@ -1244,12 +1292,10 @@ trx_sys_init_at_db_start(void)
to the disk-based header! Thus trx id values will not overlap when
the database is repeatedly started! */
- trx_sys->max_trx_id = ut_dulint_add(
- ut_dulint_align_up(mtr_read_dulint(
- sys_header
- + TRX_SYS_TRX_ID_STORE, &mtr),
- TRX_SYS_TRX_ID_WRITE_MARGIN),
- 2 * TRX_SYS_TRX_ID_WRITE_MARGIN);
+ trx_sys->max_trx_id = 2 * TRX_SYS_TRX_ID_WRITE_MARGIN
+ + ut_uint64_align_up(mach_read_from_8(sys_header
+ + TRX_SYS_TRX_ID_STORE),
+ TRX_SYS_TRX_ID_WRITE_MARGIN);
UT_LIST_INIT(trx_sys->mysql_trx_list);
trx_dummy_sess = sess_open();
@@ -1260,9 +1306,8 @@ trx_sys_init_at_db_start(void)
for (;;) {
- if ( trx->conc_state != TRX_PREPARED) {
- rows_to_undo += ut_conv_dulint_to_longlong(
- trx->undo_no);
+ if (trx->conc_state != TRX_PREPARED) {
+ rows_to_undo += trx->undo_no;
}
trx = UT_LIST_GET_NEXT(trx_list, trx);
@@ -1285,12 +1330,13 @@ trx_sys_init_at_db_start(void)
(ulong) rows_to_undo, unit);
fprintf(stderr, "InnoDB: Trx id counter is " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(trx_sys->max_trx_id));
+ (ullint) trx_sys->max_trx_id);
}
UT_LIST_INIT(trx_sys->view_list);
- trx_purge_sys_create();
+ /* Transfer ownership to purge. */
+ trx_purge_sys_create(ib_bh);
mutex_exit(&kernel_mutex);
@@ -1316,51 +1362,6 @@ trx_sys_create(void)
}
/*****************************************************************//**
-Creates and initializes the dummy transaction system page for tablespace. */
-UNIV_INTERN
-void
-trx_sys_dummy_create(
-/*=================*/
- ulint space)
-{
- mtr_t mtr;
-
- /* This function is only for doublewrite file for now */
- ut_a(space == TRX_DOUBLEWRITE_SPACE);
-
- mtr_start(&mtr);
-
- trx_sysf_dummy_create(space, &mtr);
-
- mtr_commit(&mtr);
-}
-
-/*********************************************************************
-Create extra rollback segments when create_new_db */
-UNIV_INTERN
-void
-trx_sys_create_extra_rseg(
-/*======================*/
- ulint num) /* in: number of extra user rollback segments */
-{
- mtr_t mtr;
- ulint slot_no;
- ulint i;
-
- /* Craete extra rollback segments */
- mtr_start(&mtr);
- for (i = 1; i < num + 1; i++) {
- if(!trx_rseg_create(TRX_SYS_SPACE, ULINT_MAX, &slot_no, &mtr)) {
- fprintf(stderr,
-"InnoDB: Warning: Failed to create extra rollback segments.\n");
- break;
- }
- ut_a(slot_no == i);
- }
- mtr_commit(&mtr);
-}
-
-/*****************************************************************//**
Update the file format tag.
@return always TRUE */
static
@@ -1374,7 +1375,7 @@ trx_sys_file_format_max_write(
mtr_t mtr;
byte* ptr;
buf_block_t* block;
- ulint tag_value_low;
+ ib_uint64_t tag_value;
mtr_start(&mtr);
@@ -1385,17 +1386,13 @@ trx_sys_file_format_max_write(
file_format_max.name = trx_sys_file_format_id_to_name(format_id);
ptr = buf_block_get_frame(block) + TRX_SYS_FILE_FORMAT_TAG;
- tag_value_low = format_id + TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW;
+ tag_value = format_id + TRX_SYS_FILE_FORMAT_TAG_MAGIC_N;
if (name) {
*name = file_format_max.name;
}
- mlog_write_dulint(
- ptr,
- ut_dulint_create(TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH,
- tag_value_low),
- &mtr);
+ mlog_write_ull(ptr, tag_value, &mtr);
mtr_commit(&mtr);
@@ -1413,8 +1410,7 @@ trx_sys_file_format_max_read(void)
mtr_t mtr;
const byte* ptr;
const buf_block_t* block;
- ulint format_id;
- dulint file_format_id;
+ ib_id_t file_format_id;
/* Since this is called during the startup phase it's safe to
read the value without a covering mutex. */
@@ -1428,16 +1424,15 @@ trx_sys_file_format_max_read(void)
mtr_commit(&mtr);
- format_id = file_format_id.low - TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW;
+ file_format_id -= TRX_SYS_FILE_FORMAT_TAG_MAGIC_N;
- if (file_format_id.high != TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH
- || format_id >= FILE_FORMAT_NAME_N) {
+ if (file_format_id >= FILE_FORMAT_NAME_N) {
/* Either it has never been tagged, or garbage in it. */
return(ULINT_UNDEFINED);
}
- return(format_id);
+ return((ulint) file_format_id);
}
/*****************************************************************//**
@@ -1473,12 +1468,12 @@ trx_sys_file_format_max_check(
if (format_id == ULINT_UNDEFINED) {
/* Format ID was not set. Set it to minimum possible
value. */
- format_id = DICT_TF_FORMAT_51;
+ format_id = DICT_TF_FORMAT_MIN;
}
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: highest supported file format is %s.\n",
+ " InnoDB: highest supported file format is %s.\n",
trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX));
if (format_id > DICT_TF_FORMAT_MAX) {
@@ -1487,7 +1482,7 @@ trx_sys_file_format_max_check(
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: %s: the system tablespace is in a file "
+ " InnoDB: %s: the system tablespace is in a file "
"format that this version doesn't support - %s\n",
((max_format_id <= DICT_TF_FORMAT_MAX)
? "Error" : "Warning"),
@@ -1553,7 +1548,7 @@ trx_sys_file_format_tag_init(void)
/* If format_id is not set then set it to the minimum. */
if (format_id == ULINT_UNDEFINED) {
- trx_sys_file_format_max_set(DICT_TF_FORMAT_51, NULL);
+ trx_sys_file_format_max_set(DICT_TF_FORMAT_MIN, NULL);
}
}
@@ -1604,11 +1599,12 @@ void
trx_sys_file_format_init(void)
/*==========================*/
{
- mutex_create(&file_format_max.mutex, SYNC_FILE_FORMAT_TAG);
+ mutex_create(file_format_max_mutex_key,
+ &file_format_max.mutex, SYNC_FILE_FORMAT_TAG);
/* We don't need a mutex here, as this function should only
be called once at start up. */
- file_format_max.id = DICT_TF_FORMAT_51;
+ file_format_max.id = DICT_TF_FORMAT_MIN;
file_format_max.name = trx_sys_file_format_id_to_name(
file_format_max.id);
@@ -1623,6 +1619,60 @@ trx_sys_file_format_close(void)
{
/* Does nothing at the moment */
}
+
+/*****************************************************************//**
+Creates and initializes the dummy transaction system page for tablespace. */
+UNIV_INTERN
+void
+trx_sys_dummy_create(
+/*=================*/
+ ulint space)
+{
+ mtr_t mtr;
+
+ /* This function is only for doublewrite file for now */
+ ut_a(space == TRX_DOUBLEWRITE_SPACE);
+
+ mtr_start(&mtr);
+
+ trx_sysf_dummy_create(space, &mtr);
+
+ mtr_commit(&mtr);
+}
+
+/*********************************************************************
+Creates the rollback segments */
+UNIV_INTERN
+void
+trx_sys_create_rsegs(
+/*=================*/
+ ulint n_rsegs) /*!< number of rollback segments to create */
+{
+ ulint new_rsegs = 0;
+
+ /* Do not create additional rollback segments if
+ innodb_force_recovery has been set and the database
+ was not shutdown cleanly. */
+ if (!srv_force_recovery && !recv_needed_recovery) {
+ ulint i;
+
+ for (i = 0; i < n_rsegs; ++i) {
+
+ if (trx_rseg_create() != NULL) {
+ ++new_rsegs;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (new_rsegs > 0) {
+ fprintf(stderr,
+ "InnoDB: %lu rollback segment(s) active.\n",
+ new_rsegs);
+ }
+}
+
#else /* !UNIV_HOTBACKUP */
/*****************************************************************//**
Prints to stderr the MySQL binlog info in the system header if the
@@ -1694,11 +1744,12 @@ trx_sys_read_file_format_id(
byte buf[UNIV_PAGE_SIZE * 2];
page_t* page = ut_align(buf, UNIV_PAGE_SIZE);
const byte* ptr;
- dulint file_format_id;
+ ib_id_t file_format_id;
*format_id = ULINT_UNDEFINED;
-
+
file = os_file_create_simple_no_error_handling(
+ innodb_file_data_key,
pathname,
OS_FILE_OPEN,
OS_FILE_READ_ONLY,
@@ -1707,9 +1758,9 @@ trx_sys_read_file_format_id(
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
-
+
ut_print_timestamp(stderr);
-
+
fprintf(stderr,
" ibbackup: Error: trying to read system tablespace file format,\n"
" ibbackup: but could not open the tablespace file %s!\n",
@@ -1726,9 +1777,9 @@ trx_sys_read_file_format_id(
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
-
+
ut_print_timestamp(stderr);
-
+
fprintf(stderr,
" ibbackup: Error: trying to read system table space file format,\n"
" ibbackup: but failed to read the tablespace file %s!\n",
@@ -1742,17 +1793,16 @@ trx_sys_read_file_format_id(
/* get the file format from the page */
ptr = page + TRX_SYS_FILE_FORMAT_TAG;
file_format_id = mach_read_from_8(ptr);
+ file_format_id -= TRX_SYS_FILE_FORMAT_TAG_MAGIC_N;
- *format_id = file_format_id.low - TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW;
-
- if (file_format_id.high != TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH
- || *format_id >= FILE_FORMAT_NAME_N) {
+ if (file_format_id >= FILE_FORMAT_NAME_N) {
/* Either it has never been tagged, or garbage in it. */
- *format_id = ULINT_UNDEFINED;
return(TRUE);
}
-
+
+ *format_id = (ulint) file_format_id;
+
return(TRUE);
}
@@ -1777,8 +1827,9 @@ trx_sys_read_pertable_file_format_id(
ib_uint32_t flags;
*format_id = ULINT_UNDEFINED;
-
+
file = os_file_create_simple_no_error_handling(
+ innodb_file_data_key,
pathname,
OS_FILE_OPEN,
OS_FILE_READ_ONLY,
@@ -1864,10 +1915,12 @@ void
trx_sys_close(void)
/*===============*/
{
+ trx_t* trx;
trx_rseg_t* rseg;
read_view_t* view;
ut_ad(trx_sys != NULL);
+ ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS);
/* Check that all read views are closed except read view owned
by a purge. */
@@ -1899,6 +1952,13 @@ trx_sys_close(void)
mem_free(trx_doublewrite);
trx_doublewrite = NULL;
+ /* Only prepared transactions may be left in the system. Free them. */
+ ut_a(UT_LIST_GET_LEN(trx_sys->trx_list) == trx_n_prepared);
+
+ while ((trx = UT_LIST_GET_FIRST(trx_sys->trx_list)) != NULL) {
+ trx_free_prepared(trx);
+ }
+
/* There can't be any active transactions. */
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c
index 9584f0c4c46..2145261c487 100644
--- a/storage/xtradb/trx/trx0trx.c
+++ b/storage/xtradb/trx/trx0trx.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Innobase Oy. 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
@@ -38,10 +38,10 @@ Created 3/26/1996 Heikki Tuuri
#include "usr0sess.h"
#include "read0read.h"
#include "srv0srv.h"
-#include "thr0loc.h"
#include "btr0sea.h"
#include "os0proc.h"
#include "trx0xa.h"
+#include "trx0purge.h"
#include "ha_prototypes.h"
/** Dummy session used currently in MySQL interface */
@@ -50,6 +50,14 @@ UNIV_INTERN sess_t* trx_dummy_sess = NULL;
/** Number of transactions currently allocated for MySQL: protected by
the kernel mutex */
UNIV_INTERN ulint trx_n_mysql_transactions = 0;
+/** Number of transactions currently in the XA PREPARED state: protected by
+the kernel mutex */
+UNIV_INTERN ulint trx_n_prepared = 0;
+
+#ifdef UNIV_PFS_MUTEX
+/* Key to register the mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t trx_undo_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
/*************************************************************//**
Set detailed error message for the transaction. */
@@ -100,17 +108,19 @@ trx_create(
trx->is_purge = 0;
trx->is_recovered = 0;
trx->conc_state = TRX_NOT_STARTED;
- trx->start_time = time(NULL);
+
+ trx->is_registered = 0;
+ trx->owns_prepare_mutex = 0;
+
+ trx->start_time = ut_time();
trx->isolation_level = TRX_ISO_REPEATABLE_READ;
- trx->id = ut_dulint_zero;
- trx->no = ut_dulint_max;
+ trx->id = 0;
+ trx->no = IB_ULONGLONG_MAX;
trx->support_xa = TRUE;
- trx->flush_log_at_trx_commit_session = 3; /* means to use innodb_flush_log_at_trx_commit value */
-
trx->check_foreigns = TRUE;
trx->check_unique_secondary = TRUE;
@@ -118,10 +128,9 @@ trx_create(
trx->must_flush_log_later = FALSE;
trx->dict_operation = TRX_DICT_OP_NONE;
- trx->table_id = ut_dulint_zero;
+ trx->table_id = 0;
trx->mysql_thd = NULL;
- trx->active_trans = 0;
trx->duplicates = 0;
trx->n_mysql_tables_in_use = 0;
@@ -134,12 +143,12 @@ trx_create(
trx->mysql_relay_log_file_name = "";
trx->mysql_relay_log_pos = 0;
- mutex_create(&trx->undo_mutex, SYNC_TRX_UNDO);
+ mutex_create(trx_undo_mutex_key, &trx->undo_mutex, SYNC_TRX_UNDO);
trx->rseg = NULL;
- trx->undo_no = ut_dulint_zero;
- trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
+ trx->undo_no = 0;
+ trx->last_sql_stat_start.least_undo_no = 0;
trx->insert_undo = NULL;
trx->update_undo = NULL;
trx->undo_no_arr = NULL;
@@ -221,10 +230,6 @@ trx_allocate_for_mysql(void)
mutex_exit(&kernel_mutex);
- trx->mysql_thread_id = os_thread_get_curr_id();
-
- trx->mysql_process_no = os_proc_get_number();
-
if (innobase_get_slow_log() && trx->take_stats) {
trx->distinct_page_access_hash = mem_alloc(DPAH_SIZE);
memset(trx->distinct_page_access_hash, 0, DPAH_SIZE);
@@ -260,8 +265,14 @@ trx_search_latch_release_if_reserved(
/*=================================*/
trx_t* trx) /*!< in: transaction */
{
+ ulint i;
+
if (trx->has_search_latch) {
- rw_lock_s_unlock(&btr_search_latch);
+ for (i = 0; i < btr_search_index_num; i++) {
+ if (trx->has_search_latch & ((ulint)1 << i)) {
+ rw_lock_s_unlock(btr_search_latch_part[i]);
+ }
+ }
trx->has_search_latch = FALSE;
}
@@ -354,6 +365,60 @@ trx_free(
}
/********************************************************************//**
+At shutdown, frees a transaction object that is in the PREPARED state. */
+UNIV_INTERN
+void
+trx_free_prepared(
+/*==============*/
+ trx_t* trx) /*!< in, own: trx object */
+{
+ ut_ad(mutex_own(&kernel_mutex));
+ ut_a(trx->conc_state == TRX_PREPARED);
+ ut_a(trx->magic_n == TRX_MAGIC_N);
+
+ /* Prepared transactions are sort of active; they allow
+ ROLLBACK and COMMIT operations. Because the system does not
+ contain any other transactions than prepared transactions at
+ the shutdown stage and because a transaction cannot become
+ PREPARED while holding locks, it is safe to release the locks
+ held by PREPARED transactions here at shutdown.*/
+ lock_release_off_kernel(trx);
+
+ trx_undo_free_prepared(trx);
+
+ mutex_free(&trx->undo_mutex);
+
+ if (trx->undo_no_arr) {
+ trx_undo_arr_free(trx->undo_no_arr);
+ }
+
+ ut_a(UT_LIST_GET_LEN(trx->signals) == 0);
+ ut_a(UT_LIST_GET_LEN(trx->reply_signals) == 0);
+
+ ut_a(trx->wait_lock == NULL);
+ ut_a(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
+
+ ut_a(!trx->has_search_latch);
+
+ ut_a(trx->dict_operation_lock_mode == 0);
+
+ if (trx->lock_heap) {
+ mem_heap_free(trx->lock_heap);
+ }
+
+ if (trx->global_read_view_heap) {
+ mem_heap_free(trx->global_read_view_heap);
+ }
+
+ ut_a(ib_vector_is_empty(trx->autoinc_locks));
+ ib_vector_free(trx->autoinc_locks);
+
+ UT_LIST_REMOVE(trx_list, trx_sys->trx_list, trx);
+
+ mem_free(trx);
+}
+
+/********************************************************************//**
Frees a transaction object for MySQL. */
UNIV_INTERN
void
@@ -419,9 +484,9 @@ trx_list_insert_ordered(
trx2 = UT_LIST_GET_FIRST(trx_sys->trx_list);
while (trx2 != NULL) {
- if (ut_dulint_cmp(trx->id, trx2->id) >= 0) {
+ if (trx->id >= trx2->id) {
- ut_ad(ut_dulint_cmp(trx->id, trx2->id) == 1);
+ ut_ad(trx->id > trx2->id);
break;
}
trx2 = UT_LIST_GET_NEXT(trx_list, trx2);
@@ -490,11 +555,12 @@ trx_lists_init_at_db_start(void)
TRX_ID_FMT
" was in the"
" XA prepared state.\n",
- TRX_ID_PREP_PRINTF(trx->id));
+ (ullint) trx->id);
if (srv_force_recovery == 0) {
trx->conc_state = TRX_PREPARED;
+ trx_n_prepared++;
} else {
fprintf(stderr,
"InnoDB: Since"
@@ -522,9 +588,9 @@ trx_lists_init_at_db_start(void)
trx->conc_state = TRX_ACTIVE;
/* A running transaction always has the number
- field inited to ut_dulint_max */
+ field inited to IB_ULONGLONG_MAX */
- trx->no = ut_dulint_max;
+ trx->no = IB_ULONGLONG_MAX;
}
if (undo->dict_operation) {
@@ -534,8 +600,7 @@ trx_lists_init_at_db_start(void)
}
if (!undo->empty) {
- trx->undo_no = ut_dulint_add(undo->top_undo_no,
- 1);
+ trx->undo_no = undo->top_undo_no + 1;
}
trx_list_insert_ordered(trx);
@@ -566,13 +631,13 @@ trx_lists_init_at_db_start(void)
"InnoDB: Transaction "
TRX_ID_FMT " was in the"
" XA prepared state.\n",
- TRX_ID_PREP_PRINTF(
- trx->id));
+ (ullint) trx->id);
if (srv_force_recovery == 0) {
trx->conc_state
= TRX_PREPARED;
+ trx_n_prepared++;
} else {
fprintf(stderr,
"InnoDB: Since"
@@ -598,9 +663,9 @@ trx_lists_init_at_db_start(void)
/* A running transaction always has
the number field inited to
- ut_dulint_max */
+ IB_ULONGLONG_MAX */
- trx->no = ut_dulint_max;
+ trx->no = IB_ULONGLONG_MAX;
}
trx->rseg = rseg;
@@ -616,11 +681,9 @@ trx_lists_init_at_db_start(void)
trx->update_undo = undo;
if ((!undo->empty)
- && (ut_dulint_cmp(undo->top_undo_no,
- trx->undo_no) >= 0)) {
+ && undo->top_undo_no >= trx->undo_no) {
- trx->undo_no = ut_dulint_add(undo->top_undo_no,
- 1);
+ trx->undo_no = undo->top_undo_no + 1;
}
undo = UT_LIST_GET_NEXT(undo_list, undo);
@@ -632,36 +695,26 @@ trx_lists_init_at_db_start(void)
/******************************************************************//**
Assigns a rollback segment to a transaction in a round-robin fashion.
-Skips the SYSTEM rollback segment if another is available.
-@return assigned rollback segment id */
+@return assigned rollback segment instance */
UNIV_INLINE
-ulint
-trx_assign_rseg(void)
-/*=================*/
+trx_rseg_t*
+trx_assign_rseg(
+/*============*/
+ ulint max_undo_logs) /*!< in: maximum number of UNDO logs to use */
{
- trx_rseg_t* rseg = trx_sys->latest_rseg;
+ trx_rseg_t* rseg = trx_sys->latest_rseg;
ut_ad(mutex_own(&kernel_mutex));
-loop:
- /* Get next rseg in a round-robin fashion */
rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
- if (rseg == NULL) {
+ if (rseg == NULL || rseg->id == max_undo_logs - 1) {
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
}
- /* If it is the SYSTEM rollback segment, and there exist others, skip
- it */
-
- if ((rseg->id == TRX_SYS_SYSTEM_RSEG_ID)
- && (UT_LIST_GET_LEN(trx_sys->rseg_list) > 1)) {
- goto loop;
- }
-
trx_sys->latest_rseg = rseg;
- return(rseg->id);
+ return(rseg);
}
/****************************************************************//**
@@ -682,7 +735,7 @@ trx_start_low(
ut_ad(trx->rseg == NULL);
if (trx->is_purge) {
- trx->id = ut_dulint_zero;
+ trx->id = 0;
trx->conc_state = TRX_ACTIVE;
trx->start_time = time(NULL);
@@ -691,19 +744,16 @@ trx_start_low(
ut_ad(trx->conc_state != TRX_ACTIVE);
- if (rseg_id == ULINT_UNDEFINED) {
-
- rseg_id = trx_assign_rseg();
- }
+ ut_a(rseg_id == ULINT_UNDEFINED);
- rseg = trx_sys_get_nth_rseg(trx_sys, rseg_id);
+ rseg = trx_assign_rseg(srv_rollback_segments);
trx->id = trx_sys_get_new_trx_id();
- /* The initial value for trx->no: ut_dulint_max is used in
+ /* The initial value for trx->no: IB_ULONGLONG_MAX is used in
read_view_open_now: */
- trx->no = ut_dulint_max;
+ trx->no = IB_ULONGLONG_MAX;
trx->rseg = rseg;
@@ -737,9 +787,6 @@ trx_start(
generated by the same transaction, doesn't. */
trx->support_xa = thd_supports_xa(trx->mysql_thd);
- trx->flush_log_at_trx_commit_session =
- thd_flush_log_at_trx_commit_session(trx->mysql_thd);
-
mutex_enter(&kernel_mutex);
ret = trx_start_low(trx, rseg_id);
@@ -750,134 +797,212 @@ trx_start(
}
/****************************************************************//**
-Commits a transaction. */
-UNIV_INTERN
+Set the transaction serialisation number. */
+static
void
-trx_commit_off_kernel(
-/*==================*/
- trx_t* trx) /*!< in: transaction */
+trx_serialisation_number_get(
+/*=========================*/
+ trx_t* trx) /*!< in: transaction */
{
- page_t* update_hdr_page;
- ib_uint64_t lsn = 0;
trx_rseg_t* rseg;
- trx_undo_t* undo;
+
+ rseg = trx->rseg;
+
+ ut_ad(mutex_own(&rseg->mutex));
+
+ mutex_enter(&kernel_mutex);
+
+ trx->no = trx_sys_get_new_trx_id();
+
+ /* If the rollack segment is not empty then the
+ new trx_t::no can't be less than any trx_t::no
+ already in the rollback segment. User threads only
+ produce events when a rollback segment is empty. */
+
+ if (rseg->last_page_no == FIL_NULL) {
+ void* ptr;
+ rseg_queue_t rseg_queue;
+
+ rseg_queue.rseg = rseg;
+ rseg_queue.trx_no = trx->no;
+
+ mutex_enter(&purge_sys->bh_mutex);
+
+ /* This is to reduce the pressure on the kernel mutex,
+ though in reality it should make very little (read no)
+ difference because this code path is only taken when the
+ rbs is empty. */
+
+ mutex_exit(&kernel_mutex);
+
+ ptr = ib_bh_push(purge_sys->ib_bh, &rseg_queue);
+ ut_a(ptr);
+
+ mutex_exit(&purge_sys->bh_mutex);
+ } else {
+ mutex_exit(&kernel_mutex);
+ }
+}
+
+/****************************************************************//**
+Assign the transaction its history serialisation number and write the
+update UNDO log record to the assigned rollback segment.
+@return the LSN of the UNDO log write. */
+static
+ib_uint64_t
+trx_write_serialisation_history(
+/*============================*/
+ trx_t* trx) /*!< in: transaction */
+{
mtr_t mtr;
+ trx_rseg_t* rseg;
trx_sysf_t* sys_header = NULL;
- ut_ad(mutex_own(&kernel_mutex));
-
- trx->must_flush_log_later = FALSE;
+ ut_ad(!mutex_own(&kernel_mutex));
rseg = trx->rseg;
- if (trx->insert_undo != NULL || trx->update_undo != NULL) {
+ mtr_start(&mtr);
- mutex_exit(&kernel_mutex);
+ /* Change the undo log segment states from TRX_UNDO_ACTIVE
+ to some other state: these modifications to the file data
+ structure define the transaction as committed in the file
+ based domain, at the serialization point of the log sequence
+ number lsn obtained below. */
- mtr_start(&mtr);
+ if (trx->update_undo != NULL) {
+ page_t* undo_hdr_page;
+ trx_undo_t* undo = trx->update_undo;
- /* Change the undo log segment states from TRX_UNDO_ACTIVE
- to some other state: these modifications to the file data
- structure define the transaction as committed in the file
- based world, at the serialization point of the log sequence
- number lsn obtained below. */
+ /* We have to hold the rseg mutex because update
+ log headers have to be put to the history list in the
+ (serialisation) order of the UNDO trx number. This is
+ required for the purge in-memory data structures too. */
- mutex_enter(&(rseg->mutex));
+ mutex_enter(&rseg->mutex);
- if (trx->insert_undo != NULL) {
- trx_undo_set_state_at_finish(
- rseg, trx, trx->insert_undo, &mtr);
- }
+ /* Assign the transaction serialisation number and also
+ update the purge min binary heap if this is the first
+ UNDO log being written to the assigned rollback segment. */
- undo = trx->update_undo;
+ trx_serialisation_number_get(trx);
- if (undo) {
- mutex_enter(&kernel_mutex);
- trx->no = trx_sys_get_new_trx_no();
+ /* It is not necessary to obtain trx->undo_mutex here
+ because only a single OS thread is allowed to do the
+ transaction commit for this transaction. */
- mutex_exit(&kernel_mutex);
+ undo_hdr_page = trx_undo_set_state_at_finish(undo, &mtr);
- /* It is not necessary to obtain trx->undo_mutex here
- because only a single OS thread is allowed to do the
- transaction commit for this transaction. */
+ trx_undo_update_cleanup(trx, undo_hdr_page, &mtr);
+ } else {
+ mutex_enter(&rseg->mutex);
+ }
- update_hdr_page = trx_undo_set_state_at_finish(
- rseg, trx, undo, &mtr);
+ if (trx->insert_undo != NULL) {
+ trx_undo_set_state_at_finish(trx->insert_undo, &mtr);
+ }
- /* We have to do the cleanup for the update log while
- holding the rseg mutex because update log headers
- have to be put to the history list in the order of
- the trx number. */
+ mutex_exit(&rseg->mutex);
- trx_undo_update_cleanup(trx, update_hdr_page, &mtr);
+ /* Update the latest MySQL binlog name and offset info
+ in trx sys header if MySQL binlogging is on or the database
+ server is a MySQL replication slave */
+
+ if (trx->mysql_log_file_name
+ && trx->mysql_log_file_name[0] != '\0') {
+ if (!sys_header) {
+ sys_header = trx_sysf_get(&mtr);
}
- mutex_exit(&(rseg->mutex));
+ trx_sys_update_mysql_binlog_offset(
+ sys_header,
+ trx->mysql_log_file_name,
+ trx->mysql_log_offset,
+ TRX_SYS_MYSQL_LOG_INFO, &mtr);
- /* Update the latest MySQL binlog name and offset info
- in trx sys header if MySQL binlogging is on or the database
- server is a MySQL replication slave */
+ trx->mysql_log_file_name = NULL;
+ }
- if (trx->mysql_log_file_name
- && trx->mysql_log_file_name[0] != '\0') {
- if (!sys_header) {
- sys_header = trx_sysf_get(&mtr);
- }
- trx_sys_update_mysql_binlog_offset(
- sys_header,
- trx->mysql_log_file_name,
- trx->mysql_log_offset,
- TRX_SYS_MYSQL_LOG_INFO, &mtr);
- trx->mysql_log_file_name = NULL;
+ if (trx->mysql_master_log_file_name[0] != '\0') {
+ /* This database server is a MySQL replication slave */
+ if (!sys_header) {
+ sys_header = trx_sysf_get(&mtr);
}
- if (trx->mysql_master_log_file_name[0] != '\0') {
- /* This database server is a MySQL replication slave */
- if (!sys_header) {
- sys_header = trx_sysf_get(&mtr);
- }
- trx_sys_update_mysql_binlog_offset(
- sys_header,
- trx->mysql_relay_log_file_name,
- trx->mysql_relay_log_pos,
- TRX_SYS_MYSQL_RELAY_LOG_INFO, &mtr);
- trx_sys_update_mysql_binlog_offset(
- sys_header,
- trx->mysql_master_log_file_name,
- trx->mysql_master_log_pos,
- TRX_SYS_MYSQL_MASTER_LOG_INFO, &mtr);
- trx->mysql_master_log_file_name = "";
- }
+ trx_sys_update_mysql_binlog_offset(
+ sys_header,
+ trx->mysql_relay_log_file_name,
+ trx->mysql_relay_log_pos,
+ TRX_SYS_MYSQL_RELAY_LOG_INFO, &mtr);
+
+ trx_sys_update_mysql_binlog_offset(
+ sys_header,
+ trx->mysql_master_log_file_name,
+ trx->mysql_master_log_pos,
+ TRX_SYS_MYSQL_MASTER_LOG_INFO, &mtr);
+
+ trx->mysql_master_log_file_name = "";
+ }
+
+ /* The following call commits the mini-transaction, making the
+ whole transaction committed in the file-based world, at this
+ log sequence number. The transaction becomes 'durable' when
+ we write the log to disk, but in the logical sense the commit
+ in the file-based data structures (undo logs etc.) happens
+ here.
+
+ NOTE that transaction numbers, which are assigned only to
+ transactions with an update undo log, do not necessarily come
+ in exactly the same order as commit lsn's, if the transactions
+ have different rollback segments. To get exactly the same
+ order we should hold the kernel mutex up to this point,
+ adding to the contention of the kernel mutex. However, if
+ a transaction T2 is able to see modifications made by
+ a transaction T1, T2 will always get a bigger transaction
+ number and a bigger commit lsn than T1. */
+
+ /*--------------*/
+ mtr_commit(&mtr);
+ /*--------------*/
+
+ return(mtr.end_lsn);
+}
- /* The following call commits the mini-transaction, making the
- whole transaction committed in the file-based world, at this
- log sequence number. The transaction becomes 'durable' when
- we write the log to disk, but in the logical sense the commit
- in the file-based data structures (undo logs etc.) happens
- here.
-
- NOTE that transaction numbers, which are assigned only to
- transactions with an update undo log, do not necessarily come
- in exactly the same order as commit lsn's, if the transactions
- have different rollback segments. To get exactly the same
- order we should hold the kernel mutex up to this point,
- adding to the contention of the kernel mutex. However, if
- a transaction T2 is able to see modifications made by
- a transaction T1, T2 will always get a bigger transaction
- number and a bigger commit lsn than T1. */
+/****************************************************************//**
+Commits a transaction. */
+UNIV_INTERN
+void
+trx_commit_off_kernel(
+/*==================*/
+ trx_t* trx) /*!< in: transaction */
+{
+ ib_uint64_t lsn;
- /*--------------*/
- mtr_commit(&mtr);
- /*--------------*/
- lsn = mtr.end_lsn;
+ ut_ad(mutex_own(&kernel_mutex));
+
+ trx->must_flush_log_later = FALSE;
+
+ /* If the transaction made any updates then we need to write the
+ UNDO logs for the updates to the assigned rollback segment. */
+
+ if (trx->insert_undo != NULL || trx->update_undo != NULL) {
+ mutex_exit(&kernel_mutex);
+
+ lsn = trx_write_serialisation_history(trx);
mutex_enter(&kernel_mutex);
+ } else {
+ lsn = 0;
}
- ut_ad(trx->conc_state == TRX_ACTIVE
- || trx->conc_state == TRX_PREPARED);
+ ut_ad(trx->conc_state == TRX_ACTIVE || trx->conc_state == TRX_PREPARED);
ut_ad(mutex_own(&kernel_mutex));
+ if (UNIV_UNLIKELY(trx->conc_state == TRX_PREPARED)) {
+ ut_a(trx_n_prepared > 0);
+ trx_n_prepared--;
+ }
+
/* The following assignment makes the transaction committed in memory
and makes its changes to data visible to other transactions.
NOTE that there is a small discrepancy from the strict formal
@@ -930,10 +1055,10 @@ trx_commit_off_kernel(
trx_undo_insert_cleanup(trx);
}
- if (trx->flush_log_at_trx_commit_session == 3) {
- flush_log_at_trx_commit = srv_flush_log_at_trx_commit;
+ if (srv_use_global_flush_log_at_trx_commit) {
+ flush_log_at_trx_commit = thd_flush_log_at_trx_commit(NULL);
} else {
- flush_log_at_trx_commit = trx->flush_log_at_trx_commit_session;
+ flush_log_at_trx_commit = thd_flush_log_at_trx_commit(trx->mysql_thd);
}
/* NOTE that we could possibly make a group commit more
@@ -1002,8 +1127,8 @@ trx_commit_off_kernel(
trx->conc_state = TRX_NOT_STARTED;
trx->rseg = NULL;
- trx->undo_no = ut_dulint_zero;
- trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
+ trx->undo_no = 0;
+ trx->last_sql_stat_start.least_undo_no = 0;
ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
ut_ad(UT_LIST_GET_LEN(trx->trx_locks) == 0);
@@ -1028,8 +1153,8 @@ trx_cleanup_at_db_startup(
trx->conc_state = TRX_NOT_STARTED;
trx->rseg = NULL;
- trx->undo_no = ut_dulint_zero;
- trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
+ trx->undo_no = 0;
+ trx->last_sql_stat_start.least_undo_no = 0;
UT_LIST_REMOVE(trx_list, trx_sys->trx_list, trx);
}
@@ -1667,10 +1792,10 @@ trx_commit_complete_for_mysql(
trx->op_info = "flushing log";
- if (trx->flush_log_at_trx_commit_session == 3) {
- flush_log_at_trx_commit = srv_flush_log_at_trx_commit;
+ if (srv_use_global_flush_log_at_trx_commit) {
+ flush_log_at_trx_commit = thd_flush_log_at_trx_commit(NULL);
} else {
- flush_log_at_trx_commit = trx->flush_log_at_trx_commit_session;
+ flush_log_at_trx_commit = thd_flush_log_at_trx_commit(trx->mysql_thd);
}
if (!trx->must_flush_log_later) {
@@ -1715,7 +1840,7 @@ trx_mark_sql_stat_end(
ut_a(trx);
if (trx->conc_state == TRX_NOT_STARTED) {
- trx->undo_no = ut_dulint_zero;
+ trx->undo_no = 0;
}
trx->last_sql_stat_start.least_undo_no = trx->undo_no;
@@ -1735,7 +1860,7 @@ trx_print(
{
ibool newline;
- fprintf(f, "TRANSACTION " TRX_ID_FMT, TRX_ID_PREP_PRINTF(trx->id));
+ fprintf(f, "TRANSACTION " TRX_ID_FMT, (ullint) trx->id);
switch (trx->conc_state) {
case TRX_NOT_STARTED:
@@ -1756,12 +1881,6 @@ trx_print(
fprintf(f, " state %lu", (ulong) trx->conc_state);
}
-#ifdef UNIV_LINUX
- fprintf(f, ", process no %lu", trx->mysql_process_no);
-#endif
- fprintf(f, ", OS thread id %lu",
- (ulong) os_thread_pf(trx->mysql_thread_id));
-
if (*trx->op_info) {
putc(' ', f);
fputs(trx->op_info, f);
@@ -1819,10 +1938,10 @@ trx_print(
fputs(", holds adaptive hash latch", f);
}
- if (!ut_dulint_is_zero(trx->undo_no)) {
+ if (trx->undo_no != 0) {
newline = TRUE;
- fprintf(f, ", undo log entries %lu",
- (ulong) ut_dulint_get_low(trx->undo_no));
+ fprintf(f, ", undo log entries %llu",
+ (ullint) trx->undo_no);
}
if (newline) {
@@ -1838,11 +1957,11 @@ trx_print(
Compares the "weight" (or size) of two transactions. Transactions that
have edited non-transactional tables are considered heavier than ones
that have not.
-@return <0, 0 or >0; similar to strcmp(3) */
+@return TRUE if weight(a) >= weight(b) */
UNIV_INTERN
-int
-trx_weight_cmp(
-/*===========*/
+ibool
+trx_weight_ge(
+/*==========*/
const trx_t* a, /*!< in: the first transaction to be compared */
const trx_t* b) /*!< in: the second transaction to be compared */
{
@@ -1853,19 +1972,14 @@ trx_weight_cmp(
not edited non-transactional tables. */
a_notrans_edit = a->mysql_thd != NULL
- && thd_has_edited_nontrans_tables(a->mysql_thd);
+ && thd_has_edited_nontrans_tables(a->mysql_thd);
b_notrans_edit = b->mysql_thd != NULL
- && thd_has_edited_nontrans_tables(b->mysql_thd);
-
- if (a_notrans_edit && !b_notrans_edit) {
-
- return(1);
- }
+ && thd_has_edited_nontrans_tables(b->mysql_thd);
- if (!a_notrans_edit && b_notrans_edit) {
+ if (a_notrans_edit != b_notrans_edit) {
- return(-1);
+ return(a_notrans_edit);
}
/* Either both had edited non-transactional tables or both had
@@ -1876,13 +1990,11 @@ trx_weight_cmp(
fprintf(stderr,
"%s TRX_WEIGHT(a): %lld+%lu, TRX_WEIGHT(b): %lld+%lu\n",
__func__,
- ut_conv_dulint_to_longlong(a->undo_no),
- UT_LIST_GET_LEN(a->trx_locks),
- ut_conv_dulint_to_longlong(b->undo_no),
- UT_LIST_GET_LEN(b->trx_locks));
+ a->undo_no, UT_LIST_GET_LEN(a->trx_locks),
+ b->undo_no, UT_LIST_GET_LEN(b->trx_locks));
#endif
- return(ut_dulint_cmp(TRX_WEIGHT(a), TRX_WEIGHT(b)));
+ return(TRX_WEIGHT(a) >= TRX_WEIGHT(b));
}
/****************************************************************//**
@@ -1893,7 +2005,6 @@ trx_prepare_off_kernel(
/*===================*/
trx_t* trx) /*!< in: transaction */
{
- page_t* update_hdr_page;
trx_rseg_t* rseg;
ib_uint64_t lsn = 0;
mtr_t mtr;
@@ -1926,7 +2037,7 @@ trx_prepare_off_kernel(
}
if (trx->update_undo) {
- update_hdr_page = trx_undo_set_state_at_prepare(
+ trx_undo_set_state_at_prepare(
trx, trx->update_undo, &mtr);
}
@@ -1946,6 +2057,7 @@ trx_prepare_off_kernel(
/*--------------------------------------*/
trx->conc_state = TRX_PREPARED;
+ trx_n_prepared++;
/*--------------------------------------*/
if (lsn) {
@@ -1970,10 +2082,10 @@ trx_prepare_off_kernel(
mutex_exit(&kernel_mutex);
- if (trx->flush_log_at_trx_commit_session == 3) {
- flush_log_at_trx_commit = srv_flush_log_at_trx_commit;
+ if (srv_use_global_flush_log_at_trx_commit) {
+ flush_log_at_trx_commit = thd_flush_log_at_trx_commit(NULL);
} else {
- flush_log_at_trx_commit = trx->flush_log_at_trx_commit_session;
+ flush_log_at_trx_commit = thd_flush_log_at_trx_commit(trx->mysql_thd);
}
if (flush_log_at_trx_commit == 0) {
@@ -2072,14 +2184,13 @@ trx_recover_for_mysql(
fprintf(stderr,
" InnoDB: Transaction " TRX_ID_FMT " in"
" prepared state after recovery\n",
- TRX_ID_PREP_PRINTF(trx->id));
+ (ullint) trx->id);
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Transaction contains changes"
- " to %lu rows\n",
- (ulong) ut_conv_dulint_to_longlong(
- trx->undo_no));
+ " to %llu rows\n",
+ (ullint) trx->undo_no);
count++;
@@ -2107,18 +2218,18 @@ trx_recover_for_mysql(
/*******************************************************************//**
This function is used to find one X/Open XA distributed transaction
which is in the prepared state
-@return trx or NULL */
+@return trx or NULL; on match, the trx->xid will be invalidated */
UNIV_INTERN
trx_t*
trx_get_trx_by_xid(
/*===============*/
- XID* xid) /*!< in: X/Open XA transaction identification */
+ const XID* xid) /*!< in: X/Open XA transaction identifier */
{
trx_t* trx;
if (xid == NULL) {
- return (NULL);
+ return(NULL);
}
mutex_enter(&kernel_mutex);
@@ -2128,13 +2239,20 @@ trx_get_trx_by_xid(
while (trx) {
/* Compare two X/Open XA transaction id's: their
length should be the same and binary comparison
- of gtrid_lenght+bqual_length bytes should be
+ of gtrid_length+bqual_length bytes should be
the same */
- if (xid->gtrid_length == trx->xid.gtrid_length
+ if (trx->is_recovered
+ && trx->conc_state == TRX_PREPARED
+ && xid->gtrid_length == trx->xid.gtrid_length
&& xid->bqual_length == trx->xid.bqual_length
&& memcmp(xid->data, trx->xid.data,
xid->gtrid_length + xid->bqual_length) == 0) {
+
+ /* Invalidate the XID, so that subsequent calls
+ will not find it. */
+ memset(&trx->xid, 0, sizeof(trx->xid));
+ trx->xid.formatID = -1;
break;
}
@@ -2143,14 +2261,5 @@ trx_get_trx_by_xid(
mutex_exit(&kernel_mutex);
- if (trx) {
- if (trx->conc_state != TRX_PREPARED) {
-
- return(NULL);
- }
-
- return(trx);
- } else {
- return(NULL);
- }
+ return(trx);
}
diff --git a/storage/xtradb/trx/trx0undo.c b/storage/xtradb/trx/trx0undo.c
index ec4beb5660a..4cb4b7b79c5 100644
--- a/storage/xtradb/trx/trx0undo.c
+++ b/storage/xtradb/trx/trx0undo.c
@@ -36,6 +36,7 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0rseg.h"
#include "trx0trx.h"
#include "srv0srv.h"
+#include "srv0start.h"
#include "trx0rec.h"
#include "trx0purge.h"
@@ -515,7 +516,7 @@ trx_undo_header_create_log(
{
mlog_write_initial_log_record(undo_page, MLOG_UNDO_HDR_CREATE, mtr);
- mlog_catenate_dulint_compressed(mtr, trx_id);
+ mlog_catenate_ull_compressed(mtr, trx_id);
}
#else /* !UNIV_HOTBACKUP */
# define trx_undo_header_create_log(undo_page,trx_id,mtr) ((void) 0)
@@ -687,7 +688,7 @@ trx_undo_insert_header_reuse_log(
{
mlog_write_initial_log_record(undo_page, MLOG_UNDO_HDR_REUSE, mtr);
- mlog_catenate_dulint_compressed(mtr, trx_id);
+ mlog_catenate_ull_compressed(mtr, trx_id);
}
#else /* !UNIV_HOTBACKUP */
# define trx_undo_insert_header_reuse_log(undo_page,trx_id,mtr) ((void) 0)
@@ -707,8 +708,14 @@ trx_undo_parse_page_header(
mtr_t* mtr) /*!< in: mtr or NULL */
{
trx_id_t trx_id;
+ /* Silence a GCC warning about possibly uninitialized variable
+ when mach_ull_parse_compressed() is not inlined. */
+ ut_d(trx_id = 0);
+ /* Declare the variable uninitialized in Valgrind, so that the
+ above initialization will not mask any bugs. */
+ UNIV_MEM_INVALID(&trx_id, sizeof trx_id);
- ptr = mach_dulint_parse_compressed(ptr, end_ptr, &trx_id);
+ ptr = mach_ull_parse_compressed(ptr, end_ptr, &trx_id);
if (ptr == NULL) {
@@ -1066,14 +1073,11 @@ trx_undo_truncate_end(
ulint last_page_no;
trx_undo_rec_t* rec;
trx_undo_rec_t* trunc_here;
- trx_rseg_t* rseg;
mtr_t mtr;
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(mutex_own(&(trx->rseg->mutex)));
- rseg = trx->rseg;
-
for (;;) {
mtr_start(&mtr);
@@ -1098,8 +1102,7 @@ trx_undo_truncate_end(
break;
}
- if (ut_dulint_cmp(trx_undo_rec_get_undo_no(rec), limit)
- >= 0) {
+ if (trx_undo_rec_get_undo_no(rec) >= limit) {
/* Truncate at least this record off, maybe
more */
trunc_here = rec;
@@ -1152,7 +1155,7 @@ trx_undo_truncate_start(
ut_ad(mutex_own(&(rseg->mutex)));
- if (ut_dulint_is_zero(limit)) {
+ if (!limit) {
return;
}
@@ -1174,7 +1177,7 @@ loop:
last_rec = trx_undo_page_get_last_rec(undo_page, hdr_page_no,
hdr_offset);
- if (ut_dulint_cmp(trx_undo_rec_get_undo_no(last_rec), limit) >= 0) {
+ if (trx_undo_rec_get_undo_no(last_rec) >= limit) {
mtr_commit(&mtr);
@@ -1296,7 +1299,7 @@ trx_undo_mem_create_at_db_start(
undo_header = undo_page + offset;
- trx_id = mtr_read_dulint(undo_header + TRX_UNDO_TRX_ID, mtr);
+ trx_id = mach_read_from_8(undo_header + TRX_UNDO_TRX_ID);
xid_exists = mtr_read_ulint(undo_header + TRX_UNDO_XID_EXISTS,
MLOG_1BYTE, mtr);
@@ -1320,7 +1323,7 @@ trx_undo_mem_create_at_db_start(
undo->dict_operation = mtr_read_ulint(
undo_header + TRX_UNDO_DICT_TRANS, MLOG_1BYTE, mtr);
- undo->table_id = mtr_read_dulint(undo_header + TRX_UNDO_TABLE_ID, mtr);
+ undo->table_id = mach_read_from_8(undo_header + TRX_UNDO_TABLE_ID);
undo->state = state;
undo->size = flst_get_len(seg_header + TRX_UNDO_PAGE_LIST, mtr);
@@ -1398,47 +1401,9 @@ trx_undo_lists_init(
rseg_header = trx_rsegf_get_new(rseg->space, rseg->zip_size,
rseg->page_no, &mtr);
- if (!srv_extra_undoslots) {
- /* uses direct call for avoid "Assertion failure" */
- //page_no = trx_rsegf_get_nth_undo(rseg_header, TRX_RSEG_N_EXTRA_SLOTS - 1, &mtr);
- page_no = mtr_read_ulint(rseg_header + TRX_RSEG_UNDO_SLOTS
- + (TRX_RSEG_N_EXTRA_SLOTS - 1) * TRX_RSEG_SLOT_SIZE,
- MLOG_4BYTES, &mtr);
- if (page_no != 0) {
- /* check extended slots are not used */
- for (i = TRX_RSEG_N_SLOTS; i < TRX_RSEG_N_EXTRA_SLOTS; i++) {
- /* uses direct call for avoid "Assertion failure" */
- page_no = mtr_read_ulint(rseg_header + TRX_RSEG_UNDO_SLOTS
- + i * TRX_RSEG_SLOT_SIZE,
- MLOG_4BYTES, &mtr);
- if (page_no != FIL_NULL) {
- srv_extra_undoslots = TRUE;
- fprintf(stderr,
-"InnoDB: Error: innodb_extra_undoslots option is disabled, but it was enabled before.\n"
-"InnoDB: The datafile is not normal for mysqld and disabled innodb_extra_undoslots.\n"
-"InnoDB: Enable innodb_extra_undoslots if it was enabled before, and\n"
-"InnoDB: ### don't use this datafile with other mysqld or ibbackup! ###\n"
-"InnoDB: Cannot continue operation for the safety. Calling exit(1).\n");
- exit(1);
- }
- }
- fprintf(stderr,
-"InnoDB: Warning: innodb_extra_undoslots option is disabled, but it was enabled before.\n"
-"InnoDB: But extended undo slots seem not used, so continue operation.\n");
- }
- }
-
for (i = 0; i < TRX_RSEG_N_SLOTS; i++) {
page_no = trx_rsegf_get_nth_undo(rseg_header, i, &mtr);
- /* If it was not initialized when the datafile created,
- page_no will be 0 for the extended slots after that */
-
- if (page_no == 0) {
- page_no = FIL_NULL;
- trx_rsegf_set_nth_undo(rseg_header, i, page_no, &mtr);
- }
-
/* In forced recovery: try to avoid operations which look
at database pages; undo logs are rapidly changing data, and
the probability that they are in an inconsistent state is
@@ -1747,7 +1712,7 @@ trx_undo_mark_as_dict_operation(
ut_error;
case TRX_DICT_OP_INDEX:
/* Do not discard the table on recovery. */
- undo->table_id = ut_dulint_zero;
+ undo->table_id = 0;
break;
case TRX_DICT_OP_TABLE:
undo->table_id = trx->table_id;
@@ -1758,8 +1723,8 @@ trx_undo_mark_as_dict_operation(
+ TRX_UNDO_DICT_TRANS,
TRUE, MLOG_1BYTE, mtr);
- mlog_write_dulint(hdr_page + undo->hdr_offset + TRX_UNDO_TABLE_ID,
- undo->table_id, mtr);
+ mlog_write_ull(hdr_page + undo->hdr_offset + TRX_UNDO_TABLE_ID,
+ undo->table_id, mtr);
undo->dict_operation = TRUE;
}
@@ -1834,8 +1799,6 @@ UNIV_INTERN
page_t*
trx_undo_set_state_at_finish(
/*=========================*/
- trx_rseg_t* rseg, /*!< in: rollback segment memory object */
- trx_t* trx __attribute__((unused)), /*!< in: transaction */
trx_undo_t* undo, /*!< in: undo log memory copy */
mtr_t* mtr) /*!< in: mtr */
{
@@ -1844,10 +1807,8 @@ trx_undo_set_state_at_finish(
page_t* undo_page;
ulint state;
- ut_ad(trx);
ut_ad(undo);
ut_ad(mtr);
- ut_ad(mutex_own(&rseg->mutex));
if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
@@ -1866,19 +1827,7 @@ trx_undo_set_state_at_finish(
&& mach_read_from_2(page_hdr + TRX_UNDO_PAGE_FREE)
< TRX_UNDO_PAGE_REUSE_LIMIT) {
- /* This is a heuristic to avoid the problem of all UNDO
- slots ending up in one of the UNDO lists. Previously if
- the server crashed with all the slots in one of the lists,
- transactions that required the slots of a different type
- would fail for lack of slots. */
-
- if (UT_LIST_GET_LEN(rseg->update_undo_list) < 500
- && UT_LIST_GET_LEN(rseg->insert_undo_list) < 500) {
-
- state = TRX_UNDO_CACHED;
- } else {
- state = TRX_UNDO_TO_FREE;
- }
+ state = TRX_UNDO_CACHED;
} else if (undo->type == TRX_UNDO_INSERT) {
@@ -1906,7 +1855,6 @@ trx_undo_set_state_at_prepare(
mtr_t* mtr) /*!< in: mtr */
{
trx_usegf_t* seg_hdr;
- trx_upagef_t* page_hdr;
trx_ulogf_t* undo_header;
page_t* undo_page;
ulint offset;
@@ -1924,7 +1872,6 @@ trx_undo_set_state_at_prepare(
undo->hdr_page_no, mtr);
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
- page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
/*------------------------------*/
undo->state = TRX_UNDO_PREPARED;
@@ -2029,4 +1976,28 @@ trx_undo_insert_cleanup(
mutex_exit(&(rseg->mutex));
}
+
+/********************************************************************//**
+At shutdown, frees the undo logs of a PREPARED transaction. */
+UNIV_INTERN
+void
+trx_undo_free_prepared(
+/*===================*/
+ trx_t* trx) /*!< in/out: PREPARED transaction */
+{
+ ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS);
+
+ if (trx->update_undo) {
+ ut_a(trx->update_undo->state == TRX_UNDO_PREPARED);
+ UT_LIST_REMOVE(undo_list, trx->rseg->update_undo_list,
+ trx->update_undo);
+ trx_undo_mem_free(trx->update_undo);
+ }
+ if (trx->insert_undo) {
+ ut_a(trx->insert_undo->state == TRX_UNDO_PREPARED);
+ UT_LIST_REMOVE(undo_list, trx->rseg->insert_undo_list,
+ trx->insert_undo);
+ trx_undo_mem_free(trx->insert_undo);
+ }
+}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/ut/ut0bh.c b/storage/xtradb/ut/ut0bh.c
new file mode 100644
index 00000000000..ae0b1aff207
--- /dev/null
+++ b/storage/xtradb/ut/ut0bh.c
@@ -0,0 +1,164 @@
+/***************************************************************************//**
+Copyright (c) 2010, 2011, Oracle Corpn. All Rights Reserved.
+
+Portions of this file contain modifications contributed and copyrighted by
+Sun Microsystems, Inc. Those modifications are gratefully acknowledged and
+are described briefly in the InnoDB documentation. The contributions by
+Sun Microsystems are incorporated with their permission, and subject to the
+conditions contained in the file COPYING.Sun_Microsystems.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+
+*****************************************************************************/
+
+/******************************************************************//**
+@file ut/ut0bh.c
+Binary min-heap implementation.
+
+Created 2010-05-28 by Sunny Bains
+*******************************************************/
+
+#include "ut0bh.h"
+#include "ut0mem.h"
+
+#ifdef UNIV_NONINL
+#include "ut0bh.ic"
+#endif
+
+#include <string.h>
+
+/**********************************************************************//**
+Create a binary heap.
+@return a new binary heap */
+UNIV_INTERN
+ib_bh_t*
+ib_bh_create(
+/*=========*/
+ ib_bh_cmp_t compare, /*!< in: comparator */
+ ulint sizeof_elem, /*!< in: size of one element */
+ ulint max_elems) /*!< in: max elements allowed */
+{
+ ulint sz;
+ ib_bh_t* ib_bh;
+
+ sz = sizeof(*ib_bh) + (sizeof_elem * max_elems);
+
+ ib_bh = (ib_bh_t*) ut_malloc(sz);
+ memset(ib_bh, 0x0, sz);
+
+ ib_bh->compare = compare;
+ ib_bh->max_elems = max_elems;
+ ib_bh->sizeof_elem = sizeof_elem;
+
+ return(ib_bh);
+}
+
+/**********************************************************************//**
+Free a binary heap.
+@return a new binary heap */
+UNIV_INTERN
+void
+ib_bh_free(
+/*=======*/
+ ib_bh_t* ib_bh) /*!< in/own: instance */
+{
+ ut_free(ib_bh);
+}
+
+/**********************************************************************//**
+Add an element to the binary heap. Note: The element is copied.
+@return pointer to added element or NULL if full. */
+UNIV_INTERN
+void*
+ib_bh_push(
+/*=======*/
+ ib_bh_t* ib_bh, /*!< in/out: instance */
+ const void* elem) /*!< in: element to add */
+{
+ void* ptr;
+
+ if (ib_bh_is_full(ib_bh)) {
+ return(NULL);
+ } else if (ib_bh_is_empty(ib_bh)) {
+ ++ib_bh->n_elems;
+ return(ib_bh_set(ib_bh, 0, elem));
+ } else {
+ ulint i;
+
+ i = ib_bh->n_elems;
+
+ ++ib_bh->n_elems;
+
+ for (ptr = ib_bh_get(ib_bh, i >> 1);
+ i > 0 && ib_bh->compare(ptr, elem) > 0;
+ i >>= 1, ptr = ib_bh_get(ib_bh, i >> 1)) {
+
+ ib_bh_set(ib_bh, i, ptr);
+ }
+
+ ptr = ib_bh_set(ib_bh, i, elem);
+ }
+
+ return(ptr);
+}
+
+/**********************************************************************//**
+Remove the first element from the binary heap. */
+UNIV_INTERN
+void
+ib_bh_pop(
+/*======*/
+ ib_bh_t* ib_bh) /*!< in/out: instance */
+{
+ byte* ptr;
+ byte* last;
+ ulint parent = 0;
+
+ if (ib_bh_is_empty(ib_bh)) {
+ return;
+ } else if (ib_bh_size(ib_bh) == 1) {
+ --ib_bh->n_elems;
+ return;
+ }
+
+ last = (byte*) ib_bh_last(ib_bh);
+
+ /* Start from the child node */
+ ptr = (byte*) ib_bh_get(ib_bh, 1);
+
+ while (ptr < last) {
+ /* If the "right" child node is < "left" child node */
+ if (ib_bh->compare(ptr + ib_bh->sizeof_elem, ptr) < 0) {
+ ptr += ib_bh->sizeof_elem;
+ }
+
+ if (ib_bh->compare(last, ptr) <= 0) {
+ break;
+ }
+
+ ib_bh_set(ib_bh, parent, ptr);
+
+ parent = (ptr - (byte*) ib_bh_first(ib_bh))
+ / ib_bh->sizeof_elem;
+
+ if ((parent << 1) >= ib_bh_size(ib_bh)) {
+ break;
+ }
+
+ ptr = (byte*) ib_bh_get(ib_bh, parent << 1);
+ }
+
+ --ib_bh->n_elems;
+
+ ib_bh_set(ib_bh, parent, last);
+}
diff --git a/storage/xtradb/ut/ut0byte.c b/storage/xtradb/ut/ut0byte.c
index 4e093f72ce2..535f74b8907 100644
--- a/storage/xtradb/ut/ut0byte.c
+++ b/storage/xtradb/ut/ut0byte.c
@@ -28,28 +28,3 @@ Created 5/11/1994 Heikki Tuuri
#ifdef UNIV_NONINL
#include "ut0byte.ic"
#endif
-
-/** Zero value for a dulint */
-UNIV_INTERN const dulint ut_dulint_zero = {0, 0};
-
-/** Maximum value for a dulint */
-UNIV_INTERN const dulint ut_dulint_max = {0xFFFFFFFFUL, 0xFFFFFFFFUL};
-
-#ifdef notdefined /* unused code */
-#include "ut0sort.h"
-
-/************************************************************//**
-Sort function for dulint arrays. */
-UNIV_INTERN
-void
-ut_dulint_sort(
-/*===========*/
- dulint* arr, /*!< in/out: array to be sorted */
- dulint* aux_arr,/*!< in/out: auxiliary array (same size as arr) */
- ulint low, /*!< in: low bound of sort interval, inclusive */
- ulint high) /*!< in: high bound of sort interval, noninclusive */
-{
- UT_SORT_FUNCTION_BODY(ut_dulint_sort, arr, aux_arr, low, high,
- ut_dulint_cmp);
-}
-#endif /* notdefined */
diff --git a/storage/xtradb/ut/ut0dbg.c b/storage/xtradb/ut/ut0dbg.c
index 4484e6c36de..64fadd76d1c 100644
--- a/storage/xtradb/ut/ut0dbg.c
+++ b/storage/xtradb/ut/ut0dbg.c
@@ -25,6 +25,7 @@ Created 1/30/1994 Heikki Tuuri
#include "univ.i"
#include "ut0dbg.h"
+#include "ha_prototypes.h"
#if defined(__GNUC__) && (__GNUC__ > 2)
#else
@@ -37,12 +38,7 @@ UNIV_INTERN ulint ut_dbg_zero = 0;
will stop at the next ut_a() or ut_ad(). */
UNIV_INTERN ibool ut_dbg_stop_threads = FALSE;
#endif
-#ifdef __NETWARE__
-/** Flag for ignoring further assertion failures. This is set to TRUE
-when on NetWare there happens an InnoDB assertion failure or other
-fatal error condition that requires an immediate shutdown. */
-UNIV_INTERN ibool panic_shutdown = FALSE;
-#elif !defined(UT_DBG_USE_ABORT)
+#ifndef UT_DBG_USE_ABORT
/** A null pointer that will be dereferenced to trigger a memory trap */
UNIV_INTERN ulint* ut_dbg_null_ptr = NULL;
#endif
@@ -60,12 +56,13 @@ ut_dbg_assertion_failed(
ut_print_timestamp(stderr);
#ifdef UNIV_HOTBACKUP
fprintf(stderr, " InnoDB: Assertion failure in file %s line %lu\n",
- file, line);
+ innobase_basename(file), line);
#else /* UNIV_HOTBACKUP */
fprintf(stderr,
" InnoDB: Assertion failure in thread %lu"
" in file %s line %lu\n",
- os_thread_pf(os_thread_get_curr_id()), file, line);
+ os_thread_pf(os_thread_get_curr_id()),
+ innobase_basename(file), line);
#endif /* UNIV_HOTBACKUP */
if (expr) {
fprintf(stderr,
@@ -79,29 +76,14 @@ ut_dbg_assertion_failed(
" or crashes, even\n"
"InnoDB: immediately after the mysqld startup, there may be\n"
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
- "InnoDB: " REFMAN "forcing-recovery.html\n"
+ "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
ut_dbg_stop_threads = TRUE;
#endif
}
-#ifdef __NETWARE__
-/*************************************************************//**
-Shut down MySQL/InnoDB after assertion failure. */
-UNIV_INTERN
-void
-ut_dbg_panic(void)
-/*==============*/
-{
- if (!panic_shutdown) {
- panic_shutdown = TRUE;
- innobase_shutdown_for_mysql();
- }
- exit(1);
-}
-#else /* __NETWARE__ */
-# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
+#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
/*************************************************************//**
Stop a thread after assertion failure. */
UNIV_INTERN
@@ -113,12 +95,12 @@ ut_dbg_stop_thread(
{
#ifndef UNIV_HOTBACKUP
fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
- os_thread_pf(os_thread_get_curr_id()), file, line);
+ os_thread_pf(os_thread_get_curr_id()),
+ innobase_basename(file), line);
os_thread_sleep(1000000000);
#endif /* !UNIV_HOTBACKUP */
}
-# endif
-#endif /* __NETWARE__ */
+#endif
#ifdef UNIV_COMPILE_TEST_FUNCS
diff --git a/storage/xtradb/ut/ut0mem.c b/storage/xtradb/ut/ut0mem.c
index bf55e4273b6..53f15029e1b 100644
--- a/storage/xtradb/ut/ut0mem.c
+++ b/storage/xtradb/ut/ut0mem.c
@@ -179,9 +179,6 @@ retry:
/* Make an intentional seg fault so that we get a stack
trace */
- /* Intentional segfault on NetWare causes an abend. Avoid this
- by graceful exit handling in ut_a(). */
-#if (!defined __NETWARE__)
if (assert_on_error) {
ut_print_timestamp(stderr);
@@ -194,9 +191,6 @@ retry:
} else {
return(NULL);
}
-#else
- ut_a(0);
-#endif
}
if (set_to_zero) {
@@ -296,7 +290,7 @@ UNIV_INTERN
void
ut_free(
/*====*/
- void* ptr) /*!< in, own: memory block */
+ void* ptr) /*!< in, own: memory block, can be NULL */
{
#ifndef UNIV_HOTBACKUP
ut_mem_block_t* block;
diff --git a/storage/xtradb/ut/ut0rbt.c b/storage/xtradb/ut/ut0rbt.c
index 3d7bc91e714..3d7cfa7636f 100644
--- a/storage/xtradb/ut/ut0rbt.c
+++ b/storage/xtradb/ut/ut0rbt.c
@@ -1,6 +1,12 @@
-/*****************************************************************************
+/***************************************************************************//**
-Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2007, 2010, Innobase Oy. All Rights Reserved.
+
+Portions of this file contain modifications contributed and copyrighted by
+Sun Microsystems, Inc. Those modifications are gratefully acknowledged and
+are described briefly in the InnoDB documentation. The contributions by
+Sun Microsystems are incorporated with their permission, and subject to the
+conditions contained in the file COPYING.Sun_Microsystems.
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
@@ -15,17 +21,17 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-
-/*******************************************************************//**
-@file ut/ut0rbt.c
+/********************************************************************//**
Red-Black tree implementation
+(c) 2007 Oracle/Innobase Oy
+
Created 2007-03-20 Sunny Bains
***********************************************************************/
#include "ut0rbt.h"
-/************************************************************************
+/**********************************************************************//**
Definition of a red-black tree
==============================
@@ -41,7 +47,8 @@ red-black properties:
from (3) above, the implication is that on any path from the root
to a leaf, red nodes must not be adjacent.
- However, any number of black nodes may appear in a sequence. */
+ However, any number of black nodes may appear in a sequence.
+ */
#if defined(IB_RBT_TESTING)
#warning "Testing enabled!"
@@ -50,15 +57,15 @@ red-black properties:
#define ROOT(t) (t->root->left)
#define SIZEOF_NODE(t) ((sizeof(ib_rbt_node_t) + t->sizeof_value) - 1)
-/****************************************************************//**
+/**********************************************************************//**
Print out the sub-tree recursively. */
static
void
rbt_print_subtree(
/*==============*/
- const ib_rbt_t* tree, /*!< in: tree to traverse */
- const ib_rbt_node_t* node, /*!< in: node to print */
- ib_rbt_print_node print) /*!< in: print key function */
+ const ib_rbt_t* tree, /*!< in: tree to traverse */
+ const ib_rbt_node_t* node, /*!< in: node to print */
+ ib_rbt_print_node print) /*!< in: print key function */
{
/* FIXME: Doesn't do anything yet */
if (node != tree->nil) {
@@ -68,14 +75,14 @@ rbt_print_subtree(
}
}
-/****************************************************************//**
+/**********************************************************************//**
Verify that the keys are in order.
@return TRUE of OK. FALSE if not ordered */
static
ibool
rbt_check_ordering(
/*===============*/
- const ib_rbt_t* tree) /*!< in: tree to verfify */
+ const ib_rbt_t* tree) /*!< in: tree to verfify */
{
const ib_rbt_node_t* node;
const ib_rbt_node_t* prev = NULL;
@@ -93,7 +100,7 @@ rbt_check_ordering(
return(TRUE);
}
-/****************************************************************//**
+/**********************************************************************//**
Check that every path from the root to the leaves has the same count.
Count is expressed in the number of black nodes.
@return 0 on failure else black height of the subtree */
@@ -101,8 +108,8 @@ static
ibool
rbt_count_black_nodes(
/*==================*/
- const ib_rbt_t* tree, /*!< in: tree to verify */
- const ib_rbt_node_t* node) /*!< in: start of sub-tree */
+ const ib_rbt_t* tree, /*!< in: tree to verify */
+ const ib_rbt_node_t* node) /*!< in: start of sub-tree */
{
ulint result;
@@ -141,15 +148,15 @@ rbt_count_black_nodes(
return(result);
}
-/****************************************************************//**
+/**********************************************************************//**
Turn the node's right child's left sub-tree into node's right sub-tree.
This will also make node's right child it's parent. */
static
void
rbt_rotate_left(
/*============*/
- const ib_rbt_node_t* nil, /*!< in: nil node of the tree */
- ib_rbt_node_t* node) /*!< in: node to rotate */
+ const ib_rbt_node_t* nil, /*!< in: nil node of the tree */
+ ib_rbt_node_t* node) /*!< in: node to rotate */
{
ib_rbt_node_t* right = node->right;
@@ -177,15 +184,15 @@ rbt_rotate_left(
node->parent = right;
}
-/****************************************************************//**
+/**********************************************************************//**
Turn the node's left child's right sub-tree into node's left sub-tree.
This also make node's left child it's parent. */
static
void
rbt_rotate_right(
/*=============*/
- const ib_rbt_node_t* nil, /*!< in: nil node of tree */
- ib_rbt_node_t* node) /*!< in: node to rotate */
+ const ib_rbt_node_t* nil, /*!< in: nil node of tree */
+ ib_rbt_node_t* node) /*!< in: node to rotate */
{
ib_rbt_node_t* left = node->left;
@@ -213,16 +220,15 @@ rbt_rotate_right(
node->parent = left;
}
-/****************************************************************//**
-Append a node to the tree.
-@return inserted node */
+/**********************************************************************//**
+Append a node to the tree. */
static
ib_rbt_node_t*
rbt_tree_add_child(
/*===============*/
- const ib_rbt_t* tree, /*!< in: rbt tree */
- ib_rbt_bound_t* parent, /*!< in: node's parent */
- ib_rbt_node_t* node) /*!< in: node to add */
+ const ib_rbt_t* tree,
+ ib_rbt_bound_t* parent,
+ ib_rbt_node_t* node)
{
/* Cast away the const. */
ib_rbt_node_t* last = (ib_rbt_node_t*) parent->last;
@@ -241,16 +247,15 @@ rbt_tree_add_child(
return(node);
}
-/****************************************************************//**
-Generic binary tree insert
-@return inserted node */
+/**********************************************************************//**
+Generic binary tree insert */
static
ib_rbt_node_t*
rbt_tree_insert(
/*============*/
- ib_rbt_t* tree, /*!< in: rb tree */
- const void* key, /*!< in: key for ordering */
- ib_rbt_node_t* node) /*!< in: node hold the insert value */
+ ib_rbt_t* tree,
+ const void* key,
+ ib_rbt_node_t* node)
{
ib_rbt_bound_t parent;
ib_rbt_node_t* current = ROOT(tree);
@@ -278,14 +283,14 @@ rbt_tree_insert(
return(node);
}
-/****************************************************************//**
+/**********************************************************************//**
Balance a tree after inserting a node. */
static
void
rbt_balance_tree(
/*=============*/
- const ib_rbt_t* tree, /*!< in: tree to balance */
- ib_rbt_node_t* node) /*!< in: node that was inserted */
+ const ib_rbt_t* tree, /*!< in: tree to balance */
+ ib_rbt_node_t* node) /*!< in: node that was inserted */
{
const ib_rbt_node_t* nil = tree->nil;
ib_rbt_node_t* parent = node->parent;
@@ -368,17 +373,17 @@ rbt_balance_tree(
ROOT(tree)->color = IB_RBT_BLACK;
}
-/****************************************************************//**
+/**********************************************************************//**
Find the given node's successor.
@return successor node or NULL if no successor */
static
ib_rbt_node_t*
rbt_find_successor(
/*===============*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- const ib_rbt_node_t* current)/*!< in: this is declared const
- because it can be called via
- rbt_next() */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* current) /*!< in: this is declared const
+ because it can be called via
+ rbt_next() */
{
const ib_rbt_node_t* nil = tree->nil;
ib_rbt_node_t* next = current->right;
@@ -408,7 +413,7 @@ rbt_find_successor(
return(next);
}
-/****************************************************************//**
+/**********************************************************************//**
Find the given node's precedecessor.
@return predecessor node or NULL if no predecesor */
static
@@ -448,15 +453,15 @@ rbt_find_predecessor(
return(prev);
}
-/****************************************************************//**
+/**********************************************************************//**
Replace node with child. After applying transformations eject becomes
an orphan. */
static
void
rbt_eject_node(
/*===========*/
- ib_rbt_node_t* eject, /*!< in: node to eject */
- ib_rbt_node_t* node) /*!< in: node to replace with */
+ ib_rbt_node_t* eject, /*!< in: node to eject */
+ ib_rbt_node_t* node) /*!< in: node to replace with */
{
/* Update the to be ejected node's parent's child pointers. */
if (eject->parent->left == eject) {
@@ -472,14 +477,14 @@ rbt_eject_node(
node->parent = eject->parent;
}
-/****************************************************************//**
+/**********************************************************************//**
Replace a node with another node. */
static
void
rbt_replace_node(
/*=============*/
- ib_rbt_node_t* replace, /*!< in: node to replace */
- ib_rbt_node_t* node) /*!< in: node to replace with */
+ ib_rbt_node_t* replace, /*!< in: node to replace */
+ ib_rbt_node_t* node) /*!< in: node to replace with */
{
ib_rbt_color_t color = node->color;
@@ -499,15 +504,15 @@ rbt_replace_node(
replace->color = color;
}
-/****************************************************************//**
+/**********************************************************************//**
Detach node from the tree replacing it with one of it's children.
@return the child node that now occupies the position of the detached node */
static
ib_rbt_node_t*
rbt_detach_node(
/*============*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- ib_rbt_node_t* node) /*!< in: node to detach */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_node_t* node) /*!< in: node to detach */
{
ib_rbt_node_t* child;
const ib_rbt_node_t* nil = tree->nil;
@@ -542,16 +547,16 @@ rbt_detach_node(
return(child);
}
-/****************************************************************//**
+/**********************************************************************//**
Rebalance the right sub-tree after deletion.
@return node to rebalance if more rebalancing required else NULL */
static
ib_rbt_node_t*
rbt_balance_right(
/*==============*/
- const ib_rbt_node_t* nil, /*!< in: rb tree nil node */
- ib_rbt_node_t* parent, /*!< in: parent node */
- ib_rbt_node_t* sibling)/*!< in: sibling node */
+ const ib_rbt_node_t* nil, /*!< in: rb tree nil node */
+ ib_rbt_node_t* parent, /*!< in: parent node */
+ ib_rbt_node_t* sibling) /*!< in: sibling node */
{
ib_rbt_node_t* node = NULL;
@@ -602,16 +607,16 @@ rbt_balance_right(
return(node);
}
-/****************************************************************//**
+/**********************************************************************//**
Rebalance the left sub-tree after deletion.
@return node to rebalance if more rebalancing required else NULL */
static
ib_rbt_node_t*
rbt_balance_left(
/*=============*/
- const ib_rbt_node_t* nil, /*!< in: rb tree nil node */
- ib_rbt_node_t* parent, /*!< in: parent node */
- ib_rbt_node_t* sibling)/*!< in: sibling node */
+ const ib_rbt_node_t* nil, /*!< in: rb tree nil node */
+ ib_rbt_node_t* parent, /*!< in: parent node */
+ ib_rbt_node_t* sibling) /*!< in: sibling node */
{
ib_rbt_node_t* node = NULL;
@@ -662,14 +667,14 @@ rbt_balance_left(
return(node);
}
-/****************************************************************//**
+/**********************************************************************//**
Delete the node and rebalance the tree if necessary */
static
void
rbt_remove_node_and_rebalance(
/*==========================*/
- ib_rbt_t* tree, /*!< in: rb tree */
- ib_rbt_node_t* node) /*!< in: node to remove */
+ ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_node_t* node) /*!< in: node to remove */
{
/* Detach node and get the node that will be used
as rebalance start. */
@@ -714,14 +719,14 @@ rbt_remove_node_and_rebalance(
--tree->n_nodes;
}
-/****************************************************************//**
+/**********************************************************************//**
Recursively free the nodes. */
static
void
rbt_free_node(
/*==========*/
- ib_rbt_node_t* node, /*!< in: node to free */
- ib_rbt_node_t* nil) /*!< in: rb tree nil node */
+ ib_rbt_node_t* node, /*!< in: node to free */
+ ib_rbt_node_t* nil) /*!< in: rb tree nil node */
{
if (node != nil) {
rbt_free_node(node->left, nil);
@@ -731,28 +736,28 @@ rbt_free_node(
}
}
-/****************************************************************//**
+/**********************************************************************//**
Free all the nodes and free the tree. */
UNIV_INTERN
void
rbt_free(
/*=====*/
- ib_rbt_t* tree) /*!< in: rb tree to free */
+ ib_rbt_t* tree) /*!< in: rb tree to free */
{
rbt_free_node(tree->root, tree->nil);
ut_free(tree->nil);
ut_free(tree);
}
-/****************************************************************//**
+/**********************************************************************//**
Create an instance of a red black tree.
@return an empty rb tree */
UNIV_INTERN
ib_rbt_t*
rbt_create(
/*=======*/
- size_t sizeof_value, /*!< in: sizeof data item */
- ib_rbt_compare compare) /*!< in: fn to compare items */
+ size_t sizeof_value, /*!< in: sizeof data item */
+ ib_rbt_compare compare) /*!< in: fn to compare items */
{
ib_rbt_t* tree;
ib_rbt_node_t* node;
@@ -782,17 +787,17 @@ rbt_create(
return(tree);
}
-/****************************************************************//**
+/**********************************************************************//**
Generic insert of a value in the rb tree.
@return inserted node */
UNIV_INTERN
const ib_rbt_node_t*
rbt_insert(
/*=======*/
- ib_rbt_t* tree, /*!< in: rb tree */
- const void* key, /*!< in: key for ordering */
- const void* value) /*!< in: value of key, this value
- is copied to the node */
+ ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key, /*!< in: key for ordering */
+ const void* value) /*!< in: value of key, this value
+ is copied to the node */
{
ib_rbt_node_t* node;
@@ -811,17 +816,17 @@ rbt_insert(
return(node);
}
-/****************************************************************//**
+/**********************************************************************//**
Add a new node to the tree, useful for data that is pre-sorted.
@return appended node */
UNIV_INTERN
const ib_rbt_node_t*
rbt_add_node(
/*=========*/
- ib_rbt_t* tree, /*!< in: rb tree */
- ib_rbt_bound_t* parent, /*!< in: bounds */
- const void* value) /*!< in: this value is copied
- to the node */
+ ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: bounds */
+ const void* value) /*!< in: this value is copied
+ to the node */
{
ib_rbt_node_t* node;
@@ -849,15 +854,15 @@ rbt_add_node(
return(node);
}
-/****************************************************************//**
+/**********************************************************************//**
Find a matching node in the rb tree.
@return NULL if not found else the node where key was found */
UNIV_INTERN
const ib_rbt_node_t*
rbt_lookup(
/*=======*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- const void* key) /*!< in: key to use for search */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key) /*!< in: key to use for search */
{
const ib_rbt_node_t* current = ROOT(tree);
@@ -877,15 +882,15 @@ rbt_lookup(
return(current != tree->nil ? current : NULL);
}
-/****************************************************************//**
-Delete a node from the red black tree, identified by key.
+/**********************************************************************//**
+Delete a node indentified by key.
@return TRUE if success FALSE if not found */
UNIV_INTERN
ibool
rbt_delete(
/*=======*/
- ib_rbt_t* tree, /*!< in: rb tree */
- const void* key) /*!< in: key to delete */
+ ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key) /*!< in: key to delete */
{
ibool deleted = FALSE;
ib_rbt_node_t* node = (ib_rbt_node_t*) rbt_lookup(tree, key);
@@ -900,7 +905,7 @@ rbt_delete(
return(deleted);
}
-/****************************************************************//**
+/**********************************************************************//**
Remove a node from the rb tree, the node is not free'd, that is the
callers responsibility.
@return deleted node but without the const */
@@ -924,15 +929,15 @@ rbt_remove_node(
return((ib_rbt_node_t*) const_node);
}
-/****************************************************************//**
+/**********************************************************************//**
Find the node that has the lowest key that is >= key.
@return node satisfying the lower bound constraint or NULL */
UNIV_INTERN
const ib_rbt_node_t*
rbt_lower_bound(
/*============*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- const void* key) /*!< in: key to search */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key) /*!< in: key to search */
{
ib_rbt_node_t* lb_node = NULL;
ib_rbt_node_t* current = ROOT(tree);
@@ -958,15 +963,15 @@ rbt_lower_bound(
return(lb_node);
}
-/****************************************************************//**
+/**********************************************************************//**
Find the node that has the greatest key that is <= key.
@return node satisfying the upper bound constraint or NULL */
UNIV_INTERN
const ib_rbt_node_t*
rbt_upper_bound(
/*============*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- const void* key) /*!< in: key to search */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key) /*!< in: key to search */
{
ib_rbt_node_t* ub_node = NULL;
ib_rbt_node_t* current = ROOT(tree);
@@ -992,16 +997,16 @@ rbt_upper_bound(
return(ub_node);
}
-/****************************************************************//**
+/**********************************************************************//**
Find the node that has the greatest key that is <= key.
@return value of result */
UNIV_INTERN
int
rbt_search(
/*=======*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- ib_rbt_bound_t* parent, /*!< in: search bounds */
- const void* key) /*!< in: key to search */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: search bounds */
+ const void* key) /*!< in: key to search */
{
ib_rbt_node_t* current = ROOT(tree);
@@ -1026,7 +1031,7 @@ rbt_search(
return(parent->result);
}
-/****************************************************************//**
+/**********************************************************************//**
Find the node that has the greatest key that is <= key. But use the
supplied comparison function.
@return value of result */
@@ -1034,10 +1039,10 @@ UNIV_INTERN
int
rbt_search_cmp(
/*===========*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- ib_rbt_bound_t* parent, /*!< in: search bounds */
- const void* key, /*!< in: key to search */
- ib_rbt_compare compare) /*!< in: fn to compare items */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: search bounds */
+ const void* key, /*!< in: key to search */
+ ib_rbt_compare compare) /*!< in: fn to compare items */
{
ib_rbt_node_t* current = ROOT(tree);
@@ -1062,14 +1067,14 @@ rbt_search_cmp(
return(parent->result);
}
-/****************************************************************//**
-Get the leftmost node.
+/**********************************************************************//**
Return the left most node in the tree. */
UNIV_INTERN
const ib_rbt_node_t*
rbt_first(
/*======*/
- const ib_rbt_t* tree) /* in: rb tree */
+ /* out leftmost node or NULL */
+ const ib_rbt_t* tree) /* in: rb tree */
{
ib_rbt_node_t* first = NULL;
ib_rbt_node_t* current = ROOT(tree);
@@ -1082,14 +1087,14 @@ rbt_first(
return(first);
}
-/****************************************************************//**
+/**********************************************************************//**
Return the right most node in the tree.
@return the rightmost node or NULL */
UNIV_INTERN
const ib_rbt_node_t*
rbt_last(
/*=====*/
- const ib_rbt_t* tree) /*!< in: rb tree */
+ const ib_rbt_t* tree) /*!< in: rb tree */
{
ib_rbt_node_t* last = NULL;
ib_rbt_node_t* current = ROOT(tree);
@@ -1102,39 +1107,39 @@ rbt_last(
return(last);
}
-/****************************************************************//**
+/**********************************************************************//**
Return the next node.
@return node next from current */
UNIV_INTERN
const ib_rbt_node_t*
rbt_next(
/*=====*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- const ib_rbt_node_t* current)/*!< in: current node */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* current) /*!< in: current node */
{
return(current ? rbt_find_successor(tree, current) : NULL);
}
-/****************************************************************//**
+/**********************************************************************//**
Return the previous node.
@return node prev from current */
UNIV_INTERN
const ib_rbt_node_t*
rbt_prev(
/*=====*/
- const ib_rbt_t* tree, /*!< in: rb tree */
- const ib_rbt_node_t* current)/*!< in: current node */
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* current) /*!< in: current node */
{
return(current ? rbt_find_predecessor(tree, current) : NULL);
}
-/****************************************************************//**
+/**********************************************************************//**
Reset the tree. Delete all the nodes. */
UNIV_INTERN
void
rbt_clear(
/*======*/
- ib_rbt_t* tree) /*!< in: rb tree */
+ ib_rbt_t* tree) /*!< in: rb tree */
{
rbt_free_node(ROOT(tree), tree->nil);
@@ -1142,15 +1147,15 @@ rbt_clear(
tree->root->left = tree->root->right = tree->nil;
}
-/****************************************************************//**
+/**********************************************************************//**
Merge the node from dst into src. Return the number of nodes merged.
@return no. of recs merged */
UNIV_INTERN
ulint
rbt_merge_uniq(
/*===========*/
- ib_rbt_t* dst, /*!< in: dst rb tree */
- const ib_rbt_t* src) /*!< in: src rb tree */
+ ib_rbt_t* dst, /*!< in: dst rb tree */
+ const ib_rbt_t* src) /*!< in: src rb tree */
{
ib_rbt_bound_t parent;
ulint n_merged = 0;
@@ -1171,7 +1176,7 @@ rbt_merge_uniq(
return(n_merged);
}
-/****************************************************************//**
+/**********************************************************************//**
Merge the node from dst into src. Return the number of nodes merged.
Delete the nodes from src after copying node to dst. As a side effect
the duplicates will be left untouched in the src.
@@ -1180,8 +1185,8 @@ UNIV_INTERN
ulint
rbt_merge_uniq_destructive(
/*=======================*/
- ib_rbt_t* dst, /*!< in: dst rb tree */
- ib_rbt_t* src) /*!< in: src rb tree */
+ ib_rbt_t* dst, /*!< in: dst rb tree */
+ ib_rbt_t* src) /*!< in: src rb tree */
{
ib_rbt_bound_t parent;
ib_rbt_node_t* src_node;
@@ -1219,7 +1224,7 @@ rbt_merge_uniq_destructive(
return(rbt_size(dst) - old_size);
}
-/****************************************************************//**
+/**********************************************************************//**
Check that every path from the root to the leaves has the same count and
the tree nodes are in order.
@return TRUE if OK FALSE otherwise */
@@ -1236,14 +1241,14 @@ rbt_validate(
return(FALSE);
}
-/****************************************************************//**
+/**********************************************************************//**
Iterate over the tree in depth first order. */
UNIV_INTERN
void
rbt_print(
/*======*/
- const ib_rbt_t* tree, /*!< in: tree to traverse */
- ib_rbt_print_node print) /*!< in: print function */
+ const ib_rbt_t* tree, /*!< in: tree to traverse */
+ ib_rbt_print_node print) /*!< in: print function */
{
rbt_print_subtree(tree, ROOT(tree), print);
}
diff --git a/storage/xtradb/ut/ut0ut.c b/storage/xtradb/ut/ut0ut.c
index 498873e290a..a9c0d381e16 100644
--- a/storage/xtradb/ut/ut0ut.c
+++ b/storage/xtradb/ut/ut0ut.c
@@ -1,13 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
-Copyright (c) 2009, Sun Microsystems, Inc.
-
-Portions of this file contain modifications contributed and copyrighted by
-Sun Microsystems, Inc. Those modifications are gratefully acknowledged and
-are described briefly in the InnoDB documentation. The contributions by
-Sun Microsystems are incorporated with their permission, and subject to the
-conditions contained in the file COPYING.Sun_Microsystems.
+Copyright (c) 2011, Oracle Corpn. 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
@@ -623,3 +616,115 @@ ut_snprintf(
return(res);
}
#endif /* __WIN__ */
+
+/*************************************************************//**
+Convert an error number to a human readable text message. The
+returned string is static and should not be freed or modified.
+@return string, describing the error */
+UNIV_INTERN
+const char*
+ut_strerr(
+/*======*/
+ enum db_err num) /*!< in: error number */
+{
+ switch (num) {
+ case DB_SUCCESS:
+ return("Success");
+ case DB_SUCCESS_LOCKED_REC:
+ return("Success, record lock created");
+ case DB_ERROR:
+ return("Generic error");
+ case DB_INTERRUPTED:
+ return("Operation interrupted");
+ case DB_OUT_OF_MEMORY:
+ return("Cannot allocate memory");
+ case DB_OUT_OF_FILE_SPACE:
+ return("Out of disk space");
+ case DB_LOCK_WAIT:
+ return("Lock wait");
+ case DB_DEADLOCK:
+ return("Deadlock");
+ case DB_ROLLBACK:
+ return("Rollback");
+ case DB_DUPLICATE_KEY:
+ return("Duplicate key");
+ case DB_QUE_THR_SUSPENDED:
+ return("The queue thread has been suspended");
+ case DB_MISSING_HISTORY:
+ return("Required history data has been deleted");
+ case DB_CLUSTER_NOT_FOUND:
+ return("Cluster not found");
+ case DB_TABLE_NOT_FOUND:
+ return("Table not found");
+ case DB_MUST_GET_MORE_FILE_SPACE:
+ return("More file space needed");
+ case DB_TABLE_IS_BEING_USED:
+ return("Table is being used");
+ case DB_TOO_BIG_RECORD:
+ return("Record too big");
+ case DB_TOO_BIG_INDEX_COL:
+ return("Index columns size too big");
+ case DB_LOCK_WAIT_TIMEOUT:
+ return("Lock wait timeout");
+ case DB_NO_REFERENCED_ROW:
+ return("Referenced key value not found");
+ case DB_ROW_IS_REFERENCED:
+ return("Row is referenced");
+ case DB_CANNOT_ADD_CONSTRAINT:
+ return("Cannot add constraint");
+ case DB_CORRUPTION:
+ return("Data structure corruption");
+ case DB_COL_APPEARS_TWICE_IN_INDEX:
+ return("Column appears twice in index");
+ case DB_CANNOT_DROP_CONSTRAINT:
+ return("Cannot drop constraint");
+ case DB_NO_SAVEPOINT:
+ return("No such savepoint");
+ case DB_TABLESPACE_ALREADY_EXISTS:
+ return("Tablespace already exists");
+ case DB_TABLESPACE_DELETED:
+ return("No such tablespace");
+ case DB_LOCK_TABLE_FULL:
+ return("Lock structs have exhausted the buffer pool");
+ case DB_FOREIGN_DUPLICATE_KEY:
+ return("Foreign key activated with duplicate keys");
+ case DB_FOREIGN_EXCEED_MAX_CASCADE:
+ return("Foreign key cascade delete/update exceeds max depth");
+ case DB_TOO_MANY_CONCURRENT_TRXS:
+ return("Too many concurrent transactions");
+ case DB_UNSUPPORTED:
+ return("Unsupported");
+ case DB_PRIMARY_KEY_IS_NULL:
+ return("Primary key is NULL");
+ case DB_STATS_DO_NOT_EXIST:
+ return("Persistent statistics do not exist");
+ case DB_FAIL:
+ return("Failed, retry may succeed");
+ case DB_OVERFLOW:
+ return("Overflow");
+ case DB_UNDERFLOW:
+ return("Underflow");
+ case DB_STRONG_FAIL:
+ return("Failed, retry will not succeed");
+ case DB_ZIP_OVERFLOW:
+ return("Zip overflow");
+ case DB_RECORD_NOT_FOUND:
+ return("Record not found");
+ case DB_CHILD_NO_INDEX:
+ return("No index on referencing keys in referencing table");
+ case DB_PARENT_NO_INDEX:
+ return("No index on referenced keys in referenced table");
+ case DB_END_OF_INDEX:
+ return("End of index");
+ /* do not add default: in order to produce a warning if new code
+ is added to the enum but not added here */
+ }
+
+ /* we abort here because if unknown error code is given, this could
+ mean that memory corruption has happened and someone's error-code
+ variable has been overwritten with bogus data */
+ ut_error;
+
+ /* NOT REACHED */
+ return("Unknown error");
+}
diff --git a/storage/xtradb/ut/ut0wqueue.c b/storage/xtradb/ut/ut0wqueue.c
index 5220d1e17f4..d32086bdfc4 100644
--- a/storage/xtradb/ut/ut0wqueue.c
+++ b/storage/xtradb/ut/ut0wqueue.c
@@ -35,7 +35,9 @@ ib_wqueue_create(void)
{
ib_wqueue_t* wq = mem_alloc(sizeof(ib_wqueue_t));
- mutex_create(&wq->mutex, SYNC_WORK_QUEUE);
+ /* Function ib_wqueue_create() has not been used anywhere,
+ not necessary to instrument this mutex */
+ mutex_create(PFS_NOT_INSTRUMENTED, &wq->mutex, SYNC_WORK_QUEUE);
wq->items = ib_list_create();
wq->event = os_event_create(NULL);