List:Commits« Previous MessageNext Message »
From:Marc Alff Date:May 11 2010 10:37am
Subject:bzr push into mysql-next-mr branch (marc.alff:3142 to 3143) WL#4674
View as plain text  
 3143 Marc Alff	2010-05-11
      WL#4674 PERFORMANCE_SCHEMA Setup For Actors
      
      Port, continued

    removed:
      mysql-test/suite/perfschema/r/ddl_processlist.result
      mysql-test/suite/perfschema/r/dml_processlist.result
      mysql-test/suite/perfschema/t/ddl_processlist.test
      mysql-test/suite/perfschema/t/dml_processlist.test
      storage/perfschema/table_processlist.cc
      storage/perfschema/table_processlist.h
    added:
      mysql-test/suite/perfschema/r/ddl_threads.result
      mysql-test/suite/perfschema/r/dml_threads.result
      mysql-test/suite/perfschema/t/ddl_threads.test
      mysql-test/suite/perfschema/t/dml_threads.test
      storage/perfschema/pfs_defaults.cc
      storage/perfschema/pfs_defaults.h
      storage/perfschema/table_threads.cc
      storage/perfschema/table_threads.h
    modified:
      mysql-test/suite/perfschema/include/setup_helper.inc
      mysql-test/suite/perfschema/include/start_server_common.inc
      mysql-test/suite/perfschema/r/func_file_io.result
      mysql-test/suite/perfschema/r/information_schema.result
      mysql-test/suite/perfschema/r/misc.result
      mysql-test/suite/perfschema/r/no_threads.result
      mysql-test/suite/perfschema/r/selects.result
      mysql-test/suite/perfschema/r/start_server_no_cond_class.result
      mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
      mysql-test/suite/perfschema/r/start_server_no_file_class.result
      mysql-test/suite/perfschema/r/start_server_no_file_inst.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
      mysql-test/suite/perfschema/r/start_server_no_thread_class.result
      mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
      mysql-test/suite/perfschema/r/start_server_off.result
      mysql-test/suite/perfschema/r/start_server_on.result
      mysql-test/suite/perfschema/t/func_file_io.test
      mysql-test/suite/perfschema/t/misc.test
      mysql-test/suite/perfschema/t/no_threads.test
      mysql-test/suite/perfschema/t/schema.test
      mysql-test/suite/perfschema/t/selects.test
      mysql-test/suite/perfschema/t/start_server_no_thread_class.test
      mysql-test/suite/perfschema/t/start_server_no_thread_inst.test
      scripts/mysql_system_tables.sql
      sql/sys_vars.cc
      storage/perfschema/CMakeLists.txt
      storage/perfschema/Makefile.am
      storage/perfschema/ha_perfschema.cc
      storage/perfschema/ha_perfschema.h
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_engine_table.h
      storage/perfschema/pfs_server.cc
      storage/perfschema/pfs_setup_actor.cc
      storage/perfschema/table_events_waits.cc
      storage/perfschema/table_events_waits_summary.cc
      storage/perfschema/table_file_instances.cc
      storage/perfschema/table_file_summary.cc
      storage/perfschema/table_performance_timers.cc
      storage/perfschema/table_setup_consumers.cc
      storage/perfschema/table_setup_instruments.cc
      storage/perfschema/table_setup_objects.cc
      storage/perfschema/table_setup_timers.cc
      storage/perfschema/table_sync_instances.cc
 3142 Marc Alff	2010-05-07 [merge]
      merge mysql-next-mr --> mysql-next-mr-wl4674

    added:
      mysql-test/include/have_federated_plugin.inc
      mysql-test/suite/engines/funcs/r/comment_index.result
      mysql-test/suite/engines/funcs/r/jp_comment_index.result
      mysql-test/suite/engines/funcs/t/comment_index.test
      mysql-test/suite/engines/funcs/t/jp_comment_index.test
      mysql-test/suite/federated/federated_plugin-master.opt
      mysql-test/suite/federated/federated_plugin.result
      mysql-test/suite/federated/federated_plugin.test
    modified:
      CMakeLists.txt
      cmake/abi_check.cmake
      include/CMakeLists.txt
      include/Makefile.am
      mysql-test/collections/default.experimental
      mysql-test/extra/binlog_tests/blackhole.test
      mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
      mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
      mysql-test/extra/rpl_tests/rpl_insert_id.test
      mysql-test/extra/rpl_tests/rpl_loaddata.test
      mysql-test/extra/rpl_tests/rpl_mixing_engines.test
      mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
      mysql-test/extra/rpl_tests/rpl_stm_000001.test
      mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
      mysql-test/r/archive.result
      mysql-test/r/commit_1innodb.result
      mysql-test/r/ctype_cp932_binlog_stm.result
      mysql-test/r/loadxml.result
      mysql-test/r/null.result
      mysql-test/r/partition_innodb_stmt.result
      mysql-test/r/type_datetime.result
      mysql-test/r/user_var.result
      mysql-test/suite/binlog/r/binlog_innodb.result
      mysql-test/suite/binlog/r/binlog_killed.result
      mysql-test/suite/binlog/r/binlog_multi_engine.result
      mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
      mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result
      mysql-test/suite/binlog/r/binlog_stm_blackhole.result
      mysql-test/suite/binlog/r/binlog_stm_do_db.result
      mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
      mysql-test/suite/binlog/r/binlog_stm_ps.result
      mysql-test/suite/binlog/r/binlog_stm_row.result
      mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
      mysql-test/suite/binlog/r/binlog_tmp_table.result
      mysql-test/suite/binlog/r/binlog_unsafe.result
      mysql-test/suite/binlog/t/binlog_killed.test
      mysql-test/suite/binlog/t/binlog_multi_engine.test
      mysql-test/suite/binlog/t/binlog_statement_insert_delayed.test
      mysql-test/suite/binlog/t/binlog_stm_ps.test
      mysql-test/suite/binlog/t/binlog_stm_row.test
      mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
      mysql-test/suite/binlog/t/binlog_tmp_table.test
      mysql-test/suite/binlog/t/binlog_unsafe.test
      mysql-test/suite/engines/funcs/r/ai_init_insert.result
      mysql-test/suite/engines/funcs/r/comment_column.result
      mysql-test/suite/engines/funcs/r/comment_column2.result
      mysql-test/suite/engines/funcs/r/comment_table.result
      mysql-test/suite/engines/funcs/r/db_alter_character_set.result
      mysql-test/suite/engines/funcs/r/db_alter_character_set_collate.result
      mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result
      mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result
      mysql-test/suite/engines/funcs/r/db_create_character_set.result
      mysql-test/suite/engines/funcs/r/db_create_character_set_collate.result
      mysql-test/suite/engines/funcs/r/db_create_drop.result
      mysql-test/suite/engines/funcs/r/db_create_error.result
      mysql-test/suite/engines/funcs/r/db_create_error_reserved.result
      mysql-test/suite/engines/funcs/r/db_create_if_not_exists.result
      mysql-test/suite/engines/funcs/r/db_drop_error.result
      mysql-test/suite/engines/funcs/r/db_use_error.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_error.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_ignore.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_string_unique_constraint_error.result
      mysql-test/suite/engines/funcs/r/in_string_pk_constraint_error.result
      mysql-test/suite/engines/funcs/r/in_string_unique_constraint_error.result
      mysql-test/suite/engines/funcs/r/jp_comment_column.result
      mysql-test/suite/engines/funcs/r/jp_comment_table.result
      mysql-test/suite/engines/funcs/r/rpl_000015.result
      mysql-test/suite/engines/funcs/r/rpl_change_master.result
      mysql-test/suite/engines/funcs/r/rpl_create_database.result
      mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
      mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result
      mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
      mysql-test/suite/engines/funcs/r/rpl_log_pos.result
      mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result
      mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
      mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
      mysql-test/suite/engines/funcs/r/rpl_server_id1.result
      mysql-test/suite/engines/funcs/r/rpl_server_id2.result
      mysql-test/suite/engines/funcs/r/rpl_slave_status.result
      mysql-test/suite/engines/funcs/r/rpl_sp.result
      mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
      mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
      mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
      mysql-test/suite/engines/funcs/r/rpl_temporary.result
      mysql-test/suite/engines/funcs/r/rpl_trigger.result
      mysql-test/suite/engines/funcs/r/rpl_variables.result
      mysql-test/suite/engines/funcs/t/comment_column.test
      mysql-test/suite/engines/funcs/t/comment_column2.test
      mysql-test/suite/engines/funcs/t/comment_table.test
      mysql-test/suite/engines/funcs/t/disabled.def
      mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_error.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_ignore.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_string_unique_constraint_error.test
      mysql-test/suite/engines/funcs/t/in_string_pk_constraint_error.test
      mysql-test/suite/engines/funcs/t/in_string_unique_constraint_error.test
      mysql-test/suite/engines/funcs/t/jp_comment_column.test
      mysql-test/suite/engines/funcs/t/jp_comment_table.test
      mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test
      mysql-test/suite/engines/funcs/t/rpl_get_lock.test
      mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
      mysql-test/suite/engines/funcs/t/rpl_loadfile.test
      mysql-test/suite/engines/funcs/t/rpl_log_pos.test
      mysql-test/suite/engines/funcs/t/rpl_misc_functions.test
      mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test
      mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
      mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test
      mysql-test/suite/engines/funcs/t/rpl_sp-master.opt
      mysql-test/suite/engines/funcs/t/rpl_sp-slave.opt
      mysql-test/suite/engines/funcs/t/rpl_sp.test
      mysql-test/suite/engines/funcs/t/rpl_sp_effects-master.opt
      mysql-test/suite/engines/funcs/t/rpl_sp_effects-slave.opt
      mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
      mysql-test/suite/engines/funcs/t/rpl_trigger.test
      mysql-test/suite/engines/funcs/t/rpl_variables.test
      mysql-test/suite/engines/iuds/r/delete_decimal.result
      mysql-test/suite/engines/iuds/r/insert_decimal.result
      mysql-test/suite/engines/iuds/r/insert_number.result
      mysql-test/suite/engines/iuds/r/insert_time.result
      mysql-test/suite/engines/iuds/r/insert_year.result
      mysql-test/suite/engines/iuds/r/type_bit_iuds.result
      mysql-test/suite/engines/iuds/r/update_decimal.result
      mysql-test/suite/engines/iuds/r/update_time.result
      mysql-test/suite/engines/iuds/t/disabled.def
      mysql-test/suite/engines/iuds/t/insert_number.test
      mysql-test/suite/engines/iuds/t/type_bit_iuds.test
      mysql-test/suite/ndb/r/ndb_binlog_format.result
      mysql-test/suite/ndb/t/ndb_binlog_format.test
      mysql-test/suite/perfschema/include/binlog_common.inc
      mysql-test/suite/perfschema/include/cleanup_helper.inc
      mysql-test/suite/perfschema/include/privilege.inc
      mysql-test/suite/perfschema/include/setup_helper.inc
      mysql-test/suite/perfschema/include/start_server_common.inc
      mysql-test/suite/perfschema/r/binlog_stmt.result
      mysql-test/suite/perfschema/r/myisam_file_io.result
      mysql-test/suite/perfschema/r/query_cache.result
      mysql-test/suite/perfschema/t/aggregate.test
      mysql-test/suite/perfschema/t/bad_option_1.test
      mysql-test/suite/perfschema/t/bad_option_2.test
      mysql-test/suite/perfschema/t/binlog_mix.test
      mysql-test/suite/perfschema/t/binlog_row.test
      mysql-test/suite/perfschema/t/binlog_stmt.test
      mysql-test/suite/perfschema/t/cnf_option.cnf
      mysql-test/suite/perfschema/t/cnf_option.test
      mysql-test/suite/perfschema/t/column_privilege.test
      mysql-test/suite/perfschema/t/ddl_cond_instances.test
      mysql-test/suite/perfschema/t/ddl_events_waits_current.test
      mysql-test/suite/perfschema/t/ddl_events_waits_history.test
      mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test
      mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test
      mysql-test/suite/perfschema/t/ddl_ews_by_instance.test
      mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test
      mysql-test/suite/perfschema/t/ddl_file_instances.test
      mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test
      mysql-test/suite/perfschema/t/ddl_fs_by_instance.test
      mysql-test/suite/perfschema/t/ddl_mutex_instances.test
      mysql-test/suite/perfschema/t/ddl_performance_timers.test
      mysql-test/suite/perfschema/t/ddl_processlist.test
      mysql-test/suite/perfschema/t/ddl_rwlock_instances.test
      mysql-test/suite/perfschema/t/ddl_setup_consumers.test
      mysql-test/suite/perfschema/t/ddl_setup_instruments.test
      mysql-test/suite/perfschema/t/ddl_setup_objects.test
      mysql-test/suite/perfschema/t/ddl_setup_timers.test
      mysql-test/suite/perfschema/t/disabled.def
      mysql-test/suite/perfschema/t/dml_cond_instances.test
      mysql-test/suite/perfschema/t/dml_events_waits_current.test
      mysql-test/suite/perfschema/t/dml_events_waits_history.test
      mysql-test/suite/perfschema/t/dml_events_waits_history_long.test
      mysql-test/suite/perfschema/t/dml_ews_by_event_name.test
      mysql-test/suite/perfschema/t/dml_ews_by_instance.test
      mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test
      mysql-test/suite/perfschema/t/dml_file_instances.test
      mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test
      mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test
      mysql-test/suite/perfschema/t/dml_mutex_instances.test
      mysql-test/suite/perfschema/t/dml_performance_timers.test
      mysql-test/suite/perfschema/t/dml_processlist.test
      mysql-test/suite/perfschema/t/dml_rwlock_instances.test
      mysql-test/suite/perfschema/t/dml_setup_consumers.test
      mysql-test/suite/perfschema/t/dml_setup_instruments.test
      mysql-test/suite/perfschema/t/dml_setup_objects.test
      mysql-test/suite/perfschema/t/dml_setup_timers.test
      mysql-test/suite/perfschema/t/func_file_io.test
      mysql-test/suite/perfschema/t/func_mutex.test
      mysql-test/suite/perfschema/t/global_read_lock.test
      mysql-test/suite/perfschema/t/information_schema.test
      mysql-test/suite/perfschema/t/myisam_file_io.test
      mysql-test/suite/perfschema/t/no_threads.test
      mysql-test/suite/perfschema/t/one_thread_per_con.test
      mysql-test/suite/perfschema/t/privilege.test
      mysql-test/suite/perfschema/t/query_cache.test
      mysql-test/suite/perfschema/t/read_only.test
      mysql-test/suite/perfschema/t/schema.test
      mysql-test/suite/perfschema/t/selects.test
      mysql-test/suite/perfschema/t/server_init.test
      mysql-test/suite/perfschema/t/start_server_no_cond_class.test
      mysql-test/suite/perfschema/t/start_server_no_cond_inst.test
      mysql-test/suite/perfschema/t/start_server_no_file_class.test
      mysql-test/suite/perfschema/t/start_server_no_file_inst.test
      mysql-test/suite/perfschema/t/start_server_no_mutex_class.test
      mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test
      mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test
      mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test
      mysql-test/suite/perfschema/t/start_server_no_thread_class.test
      mysql-test/suite/perfschema/t/start_server_no_thread_inst.test
      mysql-test/suite/perfschema/t/start_server_off.test
      mysql-test/suite/perfschema/t/start_server_on.test
      mysql-test/suite/perfschema/t/tampered_perfschema_table1.test
      mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
      mysql-test/suite/rpl/r/rpl_blackhole.result
      mysql-test/suite/rpl/r/rpl_concurrency_error.result
      mysql-test/suite/rpl/r/rpl_get_lock.result
      mysql-test/suite/rpl/r/rpl_insert_id.result
      mysql-test/suite/rpl/r/rpl_insert_ignore.result
      mysql-test/suite/rpl/r/rpl_misc_functions.result
      mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
      mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_mysql_upgrade.result
      mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result
      mysql-test/suite/rpl/r/rpl_read_only.result
      mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
      mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
      mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_slow_query_log.result
      mysql-test/suite/rpl/r/rpl_sp.result
      mysql-test/suite/rpl/r/rpl_stm_000001.result
      mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
      mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
      mysql-test/suite/rpl/r/rpl_stm_loadfile.result
      mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
      mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
      mysql-test/suite/rpl/r/rpl_temp_temporary.result
      mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
      mysql-test/suite/rpl/r/rpl_variables_stm.result
      mysql-test/suite/rpl/t/rpl000013.test
      mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test
      mysql-test/suite/rpl/t/rpl_blackhole.test
      mysql-test/suite/rpl/t/rpl_concurrency_error.test
      mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
      mysql-test/suite/rpl/t/rpl_get_lock.test
      mysql-test/suite/rpl/t/rpl_insert.test
      mysql-test/suite/rpl/t/rpl_insert_id.test
      mysql-test/suite/rpl/t/rpl_insert_ignore.test
      mysql-test/suite/rpl/t/rpl_invoked_features.test
      mysql-test/suite/rpl/t/rpl_misc_functions.test
      mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test
      mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
      mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test
      mysql-test/suite/rpl/t/rpl_optimize.test
      mysql-test/suite/rpl/t/rpl_read_only.test
      mysql-test/suite/rpl/t/rpl_semi_sync.test
      mysql-test/suite/rpl/t/rpl_semi_sync_event.test
      mysql-test/suite/rpl/t/rpl_session_var.test
      mysql-test/suite/rpl/t/rpl_slow_query_log.test
      mysql-test/suite/rpl/t/rpl_sp.test
      mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test
      mysql-test/suite/rpl/t/rpl_stm_found_rows.test
      mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test
      mysql-test/suite/rpl/t/rpl_stm_loadfile.test
      mysql-test/suite/rpl/t/rpl_temp_table.test
      mysql-test/suite/rpl/t/rpl_temp_temporary.test
      mysql-test/suite/rpl/t/rpl_temporary.test
      mysql-test/suite/rpl/t/rpl_timezone.test
      mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
      mysql-test/suite/rpl/t/rpl_trigger.test
      mysql-test/suite/rpl/t/rpl_udf.test
      mysql-test/suite/rpl/t/rpl_user_variables.test
      mysql-test/suite/rpl/t/rpl_variables_stm.test
      mysql-test/suite/rpl/t/rpl_view_multi.test
      mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
      mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test
      mysql-test/suite/sys_vars/t/rpl_init_slave_func.test
      mysql-test/t/archive.test
      mysql-test/t/commit_1innodb.test
      mysql-test/t/create_select_tmp.test
      mysql-test/t/ctype_cp932_binlog_stm.test
      mysql-test/t/loadxml.test
      mysql-test/t/lock_sync.test
      mysql-test/t/mysqlbinlog.test
      mysql-test/t/mysqldump.test
      mysql-test/t/query_cache_debug.test
      mysql-test/t/sp_trans.test
      mysql-test/t/type_datetime.test
      mysql-test/t/user_var.test
      sql/CMakeLists.txt
      sql/item.cc
      sql/item_func.h
      sql/log_event.cc
      sql/share/errmsg-utf8.txt
      sql/sp.cc
      sql/sql_class.cc
      sql/sql_load.cc
      storage/federated/Makefile.am
      storage/perfschema/ha_perfschema.cc
      storage/perfschema/pfs.h
      storage/perfschema/pfs_check.cc
      storage/perfschema/pfs_column_values.cc
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_instr_class.h
      storage/perfschema/pfs_server.cc
      storage/perfschema/table_all_instr.cc
      storage/perfschema/table_events_waits.cc
      storage/perfschema/table_events_waits_summary.cc
      storage/perfschema/table_file_instances.cc
      storage/perfschema/table_file_summary.cc
      storage/perfschema/table_performance_timers.cc
      storage/perfschema/table_processlist.cc
      storage/perfschema/table_setup_consumers.cc
      storage/perfschema/table_setup_instruments.cc
      storage/perfschema/table_setup_objects.cc
      storage/perfschema/table_setup_timers.cc
      storage/perfschema/table_sync_instances.cc
      storage/perfschema/unittest/pfs-t.cc
      storage/perfschema/unittest/pfs_instr-oom-t.cc
      storage/perfschema/unittest/pfs_instr-t.cc
      storage/perfschema/unittest/pfs_instr_class-oom-t.cc
      storage/perfschema/unittest/pfs_instr_class-t.cc
      storage/perfschema/unittest/pfs_timer-t.cc
      storage/perfschema/unittest/stub_print_error.h
      unittest/examples/CMakeLists.txt
      unittest/examples/Makefile.am
      unittest/examples/core-t.c
      unittest/examples/no_plan-t.c
      unittest/mysys/Makefile.am
      unittest/mytap/CMakeLists.txt
      unittest/mytap/t/Makefile.am
      unittest/mytap/tap.c
      unittest/mytap/tap.h
=== modified file 'mysql-test/suite/perfschema/include/setup_helper.inc'
--- a/mysql-test/suite/perfschema/include/setup_helper.inc	2010-05-04 06:53:22 +0000
+++ b/mysql-test/suite/perfschema/include/setup_helper.inc	2010-05-11 10:36:37 +0000
@@ -25,18 +25,18 @@ update performance_schema.SETUP_CONSUMER
 
 connect (con1, localhost, root, , );
 
-let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
-  where ID in (select connection_id())`;
+let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
+  where PROCESSLIST_ID = connection_id()`;
 
 connect (con2, localhost, root, , );
 
-let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
-  where ID in (select connection_id())`;
+let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
+  where PROCESSLIST_ID = connection_id()`;
 
 connect (con3, localhost, root, , );
 
-let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
-  where ID in (select connection_id())`;
+let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
+  where PROCESSLIST_ID = connection_id()`;
 
 connection default;
 
@@ -49,6 +49,6 @@ prepare stmt_dump_events from
   where thread_id=? order by event_id;";
 
 prepare stmt_dump_thread from
-  "select name from performance_schema.PROCESSLIST where thread_id=? ;";
+  "select name from performance_schema.THREADS where thread_id=? ;";
 --enable_query_log
 

=== modified file 'mysql-test/suite/perfschema/include/start_server_common.inc'
--- a/mysql-test/suite/perfschema/include/start_server_common.inc	2010-05-04 06:53:22 +0000
+++ b/mysql-test/suite/perfschema/include/start_server_common.inc	2010-05-11 10:36:37 +0000
@@ -37,12 +37,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 --enable_result_log
 
 # This has a stable output, printing the result:

=== removed file 'mysql-test/suite/perfschema/r/ddl_processlist.result'
--- a/mysql-test/suite/perfschema/r/ddl_processlist.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_processlist.result	1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-alter table performance_schema.PROCESSLIST add column foo integer;
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.PROCESSLIST;
-ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.PROCESSLIST ADD INDEX test_index(ID);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.PROCESSLIST(ID);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== added file 'mysql-test/suite/perfschema/r/ddl_threads.result'
--- a/mysql-test/suite/perfschema/r/ddl_threads.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_threads.result	2010-05-11 10:36:37 +0000
@@ -0,0 +1,8 @@
+alter table performance_schema.THREADS add column foo integer;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+truncate table performance_schema.THREADS;
+ERROR HY000: Invalid performance_schema usage.
+ALTER TABLE performance_schema.THREADS ADD INDEX test_index(PROCESSLIST_ID);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(PROCESSLIST_ID);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== removed file 'mysql-test/suite/perfschema/r/dml_processlist.result'
--- a/mysql-test/suite/perfschema/r/dml_processlist.result	2010-03-18 15:35:06 +0000
+++ b/mysql-test/suite/perfschema/r/dml_processlist.result	1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-select * from performance_schema.PROCESSLIST
-where name like 'Thread/%' limit 1;
-THREAD_ID	ID	NAME
-#	#	#
-select * from performance_schema.PROCESSLIST
-where name='FOO';
-THREAD_ID	ID	NAME
-insert into performance_schema.PROCESSLIST
-set name='FOO', thread_id=1, id=2;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-update performance_schema.PROCESSLIST
-set thread_id=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-update performance_schema.PROCESSLIST
-set thread_id=12 where name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-delete from performance_schema.PROCESSLIST
-where id=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-delete from performance_schema.PROCESSLIST;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-LOCK TABLES performance_schema.PROCESSLIST READ;
-ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-UNLOCK TABLES;
-LOCK TABLES performance_schema.PROCESSLIST WRITE;
-ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-UNLOCK TABLES;

=== added file 'mysql-test/suite/perfschema/r/dml_threads.result'
--- a/mysql-test/suite/perfschema/r/dml_threads.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/dml_threads.result	2010-05-11 10:36:37 +0000
@@ -0,0 +1,37 @@
+select * from performance_schema.THREADS
+where name like 'Thread/%' limit 1;
+THREAD_ID	NAME	TYPE	PROCESSLIST_ID	PROCESSLIST_USER	PROCESSLIST_HOST	PROCESSLIST_DB	PROCESSLIST_COMMAND	PROCESSLIST_TIME	PROCESSLIST_STATE	PROCESSLIST_INFO	PARENT_THREAD_ID	ROLE	INSTRUMENTED
+#	#	#	#	#	#	#	#	#	#	#	#	#	#
+select * from performance_schema.THREADS
+where name='FOO';
+THREAD_ID	NAME	TYPE	PROCESSLIST_ID	PROCESSLIST_USER	PROCESSLIST_HOST	PROCESSLIST_DB	PROCESSLIST_COMMAND	PROCESSLIST_TIME	PROCESSLIST_STATE	PROCESSLIST_INFO	PARENT_THREAD_ID	ROLE	INSTRUMENTED
+insert into performance_schema.THREADS
+set name='FOO', thread_id=1, processlist_id=2;
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'THREADS'
+update performance_schema.THREADS
+set thread_id=12;
+ERROR HY000: Invalid performance_schema usage.
+update performance_schema.THREADS
+set thread_id=12 where PROCESSLIST_ID=connection_id();
+ERROR HY000: Invalid performance_schema usage.
+update performance_schema.THREADS
+set instrumented= 'NO' where PROCESSLIST_ID=connection_id();
+select instrumented from performance_schema.THREADS
+where PROCESSLIST_ID=connection_id();
+instrumented
+NO
+update performance_schema.THREADS
+set instrumented= 'YES' where PROCESSLIST_ID=connection_id();
+select instrumented from performance_schema.THREADS
+where PROCESSLIST_ID=connection_id();
+instrumented
+YES
+delete from performance_schema.THREADS
+where id=1;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
+delete from performance_schema.THREADS;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
+LOCK TABLES performance_schema.THREADS READ;
+UNLOCK TABLES;
+LOCK TABLES performance_schema.THREADS WRITE;
+UNLOCK TABLES;

=== modified file 'mysql-test/suite/perfschema/r/func_file_io.result'
--- a/mysql-test/suite/perfschema/r/func_file_io.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/func_file_io.result	2010-05-11 10:36:37 +0000
@@ -1,6 +1,8 @@
 UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES';
 UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
 WHERE name LIKE 'wait/io/file/%';
+update performance_schema.THREADS SET instrumented = 'YES'
+  WHERE PROCESSLIST_ID=connection_id();
 DROP TABLE IF EXISTS t1;
 CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value')
 ENGINE=MyISAM;
@@ -94,24 +96,23 @@ FROM performance_schema.EVENTS_WAITS_SUM
 WHERE COUNT_STAR > 0
 ORDER BY SUM_TIMER_WAIT DESC
 LIMIT 10;
-SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
+SELECT p.processlist_user, SUM(TIMER_WAIT) SUM_WAIT
 # ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
+GROUP BY p.processlist_user
 ORDER BY SUM_WAIT DESC
 LIMIT 20;
 SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
-WHERE p.ID = 1
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
+WHERE p.PROCESSLIST_ID = 1
 GROUP BY h.EVENT_NAME
 HAVING TOTAL_WAIT > 0;
-SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
+SELECT p.processlist_user, h.operation, SUM(NUMBER_OF_BYTES) bytes
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user, h.operation
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
+GROUP BY p.processlist_user, h.operation
 HAVING BYTES > 0
-ORDER BY i.user, h.operation;
+ORDER BY p.processlist_user, h.operation;
+UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';

=== modified file 'mysql-test/suite/perfschema/r/information_schema.result'
--- a/mysql-test/suite/perfschema/r/information_schema.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/information_schema.result	2010-05-11 10:36:37 +0000
@@ -14,12 +14,12 @@ performance_schema	FILE_SUMMARY_BY_EVENT
 performance_schema	FILE_SUMMARY_BY_INSTANCE	def
 performance_schema	MUTEX_INSTANCES	def
 performance_schema	PERFORMANCE_TIMERS	def
-performance_schema	PROCESSLIST	def
 performance_schema	RWLOCK_INSTANCES	def
 performance_schema	SETUP_CONSUMERS	def
 performance_schema	SETUP_INSTRUMENTS	def
 performance_schema	SETUP_OBJECTS	def
 performance_schema	SETUP_TIMERS	def
+performance_schema	THREADS	def
 select upper(TABLE_NAME), TABLE_TYPE, ENGINE
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -36,12 +36,12 @@ FILE_SUMMARY_BY_EVENT_NAME	BASE TABLE	PE
 FILE_SUMMARY_BY_INSTANCE	BASE TABLE	PERFORMANCE_SCHEMA
 MUTEX_INSTANCES	BASE TABLE	PERFORMANCE_SCHEMA
 PERFORMANCE_TIMERS	BASE TABLE	PERFORMANCE_SCHEMA
-PROCESSLIST	BASE TABLE	PERFORMANCE_SCHEMA
 RWLOCK_INSTANCES	BASE TABLE	PERFORMANCE_SCHEMA
 SETUP_CONSUMERS	BASE TABLE	PERFORMANCE_SCHEMA
 SETUP_INSTRUMENTS	BASE TABLE	PERFORMANCE_SCHEMA
 SETUP_OBJECTS	BASE TABLE	PERFORMANCE_SCHEMA
 SETUP_TIMERS	BASE TABLE	PERFORMANCE_SCHEMA
+THREADS	BASE TABLE	PERFORMANCE_SCHEMA
 select upper(TABLE_NAME), VERSION, ROW_FORMAT
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -58,12 +58,12 @@ FILE_SUMMARY_BY_EVENT_NAME	10	Dynamic
 FILE_SUMMARY_BY_INSTANCE	10	Dynamic
 MUTEX_INSTANCES	10	Dynamic
 PERFORMANCE_TIMERS	10	Fixed
-PROCESSLIST	10	Dynamic
 RWLOCK_INSTANCES	10	Dynamic
 SETUP_CONSUMERS	10	Dynamic
 SETUP_INSTRUMENTS	10	Dynamic
 SETUP_OBJECTS	10	Dynamic
 SETUP_TIMERS	10	Dynamic
+THREADS	10	Dynamic
 select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -80,12 +80,12 @@ FILE_SUMMARY_BY_EVENT_NAME	1000	0
 FILE_SUMMARY_BY_INSTANCE	1000	0
 MUTEX_INSTANCES	1000	0
 PERFORMANCE_TIMERS	5	0
-PROCESSLIST	1000	0
 RWLOCK_INSTANCES	1000	0
 SETUP_CONSUMERS	8	0
 SETUP_INSTRUMENTS	1000	0
 SETUP_OBJECTS	1000	0
 SETUP_TIMERS	1	0
+THREADS	1000	0
 select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -102,12 +102,12 @@ FILE_SUMMARY_BY_EVENT_NAME	0	0
 FILE_SUMMARY_BY_INSTANCE	0	0
 MUTEX_INSTANCES	0	0
 PERFORMANCE_TIMERS	0	0
-PROCESSLIST	0	0
 RWLOCK_INSTANCES	0	0
 SETUP_CONSUMERS	0	0
 SETUP_INSTRUMENTS	0	0
 SETUP_OBJECTS	0	0
 SETUP_TIMERS	0	0
+THREADS	0	0
 select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -124,12 +124,12 @@ FILE_SUMMARY_BY_EVENT_NAME	0	0	NULL
 FILE_SUMMARY_BY_INSTANCE	0	0	NULL
 MUTEX_INSTANCES	0	0	NULL
 PERFORMANCE_TIMERS	0	0	NULL
-PROCESSLIST	0	0	NULL
 RWLOCK_INSTANCES	0	0	NULL
 SETUP_CONSUMERS	0	0	NULL
 SETUP_INSTRUMENTS	0	0	NULL
 SETUP_OBJECTS	0	0	NULL
 SETUP_TIMERS	0	0	NULL
+THREADS	0	0	NULL
 select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -146,12 +146,12 @@ FILE_SUMMARY_BY_EVENT_NAME	NULL	NULL	NUL
 FILE_SUMMARY_BY_INSTANCE	NULL	NULL	NULL
 MUTEX_INSTANCES	NULL	NULL	NULL
 PERFORMANCE_TIMERS	NULL	NULL	NULL
-PROCESSLIST	NULL	NULL	NULL
 RWLOCK_INSTANCES	NULL	NULL	NULL
 SETUP_CONSUMERS	NULL	NULL	NULL
 SETUP_INSTRUMENTS	NULL	NULL	NULL
 SETUP_OBJECTS	NULL	NULL	NULL
 SETUP_TIMERS	NULL	NULL	NULL
+THREADS	NULL	NULL	NULL
 select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -168,12 +168,12 @@ FILE_SUMMARY_BY_EVENT_NAME	utf8_general_
 FILE_SUMMARY_BY_INSTANCE	utf8_general_ci	NULL
 MUTEX_INSTANCES	utf8_general_ci	NULL
 PERFORMANCE_TIMERS	utf8_general_ci	NULL
-PROCESSLIST	utf8_general_ci	NULL
 RWLOCK_INSTANCES	utf8_general_ci	NULL
 SETUP_CONSUMERS	utf8_general_ci	NULL
 SETUP_INSTRUMENTS	utf8_general_ci	NULL
 SETUP_OBJECTS	utf8_general_ci	NULL
 SETUP_TIMERS	utf8_general_ci	NULL
+THREADS	utf8_general_ci	NULL
 select upper(TABLE_NAME), TABLE_COMMENT
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -190,9 +190,9 @@ FILE_SUMMARY_BY_EVENT_NAME	
 FILE_SUMMARY_BY_INSTANCE	
 MUTEX_INSTANCES	
 PERFORMANCE_TIMERS	
-PROCESSLIST	
 RWLOCK_INSTANCES	
 SETUP_CONSUMERS	
 SETUP_INSTRUMENTS	
 SETUP_OBJECTS	
 SETUP_TIMERS	
+THREADS	

=== modified file 'mysql-test/suite/perfschema/r/misc.result'
--- a/mysql-test/suite/perfschema/r/misc.result	2010-04-07 08:53:19 +0000
+++ b/mysql-test/suite/perfschema/r/misc.result	2010-05-11 10:36:37 +0000
@@ -1,6 +1,6 @@
 SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
 WHERE THREAD_ID IN
-(SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+(SELECT THREAD_ID FROM performance_schema.THREADS)
 AND EVENT_NAME IN
 (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
 WHERE NAME LIKE "wait/synch/%")

=== modified file 'mysql-test/suite/perfschema/r/no_threads.result'
--- a/mysql-test/suite/perfschema/r/no_threads.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/no_threads.result	2010-05-11 10:36:37 +0000
@@ -17,11 +17,11 @@ show variables like "performance_schema_
 Variable_name	Value
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	10
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
 where name like "thread/sql/main";
 count(*)
 1
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
 where name like "thread/sql/OneConnection";
 count(*)
 0

=== modified file 'mysql-test/suite/perfschema/r/selects.result'
--- a/mysql-test/suite/perfschema/r/selects.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/selects.result	2010-05-11 10:36:37 +0000
@@ -13,7 +13,7 @@ OPERATION	TOTAL
 chsize	[NUM_BYTES]
 SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
 WHERE THREAD_ID IN
-(SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+(SELECT THREAD_ID FROM performance_schema.THREADS)
 AND EVENT_NAME IN
 (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
 WHERE NAME LIKE "wait/synch/%")
@@ -76,21 +76,21 @@ id	c
 12	[EVENT_ID]
 13	[EVENT_ID]
 DROP TRIGGER t_ps_trigger;
-CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
+CREATE PROCEDURE t_ps_proc(IN conid INT, OUT pid INT)
 BEGIN
-SELECT id FROM performance_schema.PROCESSLIST
-WHERE THREAD_ID = tid INTO pid;
+SELECT thread_id FROM performance_schema.THREADS
+WHERE PROCESSLIST_ID = conid INTO pid;
 END;
 |
-CALL t_ps_proc(0, @p_id);
-CREATE FUNCTION t_ps_func(tid INT) RETURNS int
+CALL t_ps_proc(connection_id(), @p_id);
+CREATE FUNCTION t_ps_func(conid INT) RETURNS int
 BEGIN
-return (SELECT id FROM performance_schema.PROCESSLIST
-WHERE THREAD_ID = tid);
+return (SELECT thread_id FROM performance_schema.THREADS
+WHERE PROCESSLIST_ID = conid);
 END;
 |
-SELECT t_ps_func(0) = @p_id;
-t_ps_func(0) = @p_id
+SELECT t_ps_func(connection_id()) = @p_id;
+t_ps_func(connection_id()) = @p_id
 1
 DROP PROCEDURE t_ps_proc;
 DROP FUNCTION t_ps_func;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_cond_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_cond_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_cond_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_cond_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_file_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_file_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_file_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_file_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_mutex_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_mutex_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_mutex_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_rwlock_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_rwlock_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_thread_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	0
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_thread_classes";
@@ -66,7 +67,7 @@ select variable_value > 0 from informati
 where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST';
 variable_value > 0
 1
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
 count(*)
 0
 show status like "performance_schema_thread_instances_lost";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_thread_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	0
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_thread_classes";
@@ -64,7 +65,7 @@ Performance_schema_thread_classes_lost	0
 show variables like "performance_schema_max_thread_instances";
 Variable_name	Value
 performance_schema_max_thread_instances	0
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
 count(*)
 0
 select variable_value > 0 from information_schema.global_status

=== modified file 'mysql-test/suite/perfschema/r/start_server_off.result'
--- a/mysql-test/suite/perfschema/r/start_server_off.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_off.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	OFF
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show status like "performance_schema%";

=== modified file 'mysql-test/suite/perfschema/r/start_server_on.result'
--- a/mysql-test/suite/perfschema/r/start_server_on.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_on.result	2010-05-11 10:36:37 +0000
@@ -29,12 +29,12 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -53,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	50000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show status like "performance_schema%";

=== removed file 'mysql-test/suite/perfschema/t/ddl_processlist.test'
--- a/mysql-test/suite/perfschema/t/ddl_processlist.test	2010-05-04 06:53:22 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_processlist.test	1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-# Copyright (c) 2008, 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
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
--- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.PROCESSLIST add column foo integer;
-
--- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.PROCESSLIST;
-
--- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.PROCESSLIST ADD INDEX test_index(ID);
-
--- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.PROCESSLIST(ID);
-

=== added file 'mysql-test/suite/perfschema/t/ddl_threads.test'
--- a/mysql-test/suite/perfschema/t/ddl_threads.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_threads.test	2010-05-11 10:36:37 +0000
@@ -0,0 +1,32 @@
+# Copyright (c) 2008, 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
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+-- error ER_DBACCESS_DENIED_ERROR
+alter table performance_schema.THREADS add column foo integer;
+
+-- error ER_WRONG_PERFSCHEMA_USAGE
+truncate table performance_schema.THREADS;
+
+-- error ER_DBACCESS_DENIED_ERROR
+ALTER TABLE performance_schema.THREADS ADD INDEX test_index(PROCESSLIST_ID);
+
+-- error ER_DBACCESS_DENIED_ERROR
+CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(PROCESSLIST_ID);
+

=== removed file 'mysql-test/suite/perfschema/t/dml_processlist.test'
--- a/mysql-test/suite/perfschema/t/dml_processlist.test	2010-05-04 06:53:22 +0000
+++ b/mysql-test/suite/perfschema/t/dml_processlist.test	1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
-# Copyright (c) 2009, 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
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
---replace_column 1 # 2 # 3 #
-select * from performance_schema.PROCESSLIST
-  where name like 'Thread/%' limit 1;
-
-select * from performance_schema.PROCESSLIST
-  where name='FOO';
-
---replace_result '\'processlist' '\'PROCESSLIST'
---error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.PROCESSLIST
-  set name='FOO', thread_id=1, id=2;
-
---replace_result '\'processlist' '\'PROCESSLIST'
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.PROCESSLIST
-  set thread_id=12;
-
---replace_result '\'processlist' '\'PROCESSLIST'
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.PROCESSLIST
-  set thread_id=12 where name like "FOO";
-
---replace_result '\'processlist' '\'PROCESSLIST'
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.PROCESSLIST
-  where id=1;
-
---replace_result '\'processlist' '\'PROCESSLIST'
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.PROCESSLIST;
-
---replace_result '\'processlist' '\'PROCESSLIST'
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.PROCESSLIST READ;
-UNLOCK TABLES;
-
---replace_result '\'processlist' '\'PROCESSLIST'
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.PROCESSLIST WRITE;
-UNLOCK TABLES;
-

=== added file 'mysql-test/suite/perfschema/t/dml_threads.test'
--- a/mysql-test/suite/perfschema/t/dml_threads.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/dml_threads.test	2010-05-11 10:36:37 +0000
@@ -0,0 +1,67 @@
+# Copyright (c) 2009, 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
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 11 # 12 # 13 # 14 #
+select * from performance_schema.THREADS
+  where name like 'Thread/%' limit 1;
+
+select * from performance_schema.THREADS
+  where name='FOO';
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+insert into performance_schema.THREADS
+  set name='FOO', thread_id=1, processlist_id=2;
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+update performance_schema.THREADS
+  set thread_id=12;
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+update performance_schema.THREADS
+  set thread_id=12 where PROCESSLIST_ID=connection_id();
+
+update performance_schema.THREADS
+  set instrumented= 'NO' where PROCESSLIST_ID=connection_id();
+
+select instrumented from performance_schema.THREADS
+  where PROCESSLIST_ID=connection_id();
+
+update performance_schema.THREADS
+  set instrumented= 'YES' where PROCESSLIST_ID=connection_id();
+
+select instrumented from performance_schema.THREADS
+  where PROCESSLIST_ID=connection_id();
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.THREADS
+  where id=1;
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.THREADS;
+
+LOCK TABLES performance_schema.THREADS READ;
+UNLOCK TABLES;
+
+LOCK TABLES performance_schema.THREADS WRITE;
+UNLOCK TABLES;
+

=== modified file 'mysql-test/suite/perfschema/t/func_file_io.test'
--- a/mysql-test/suite/perfschema/t/func_file_io.test	2010-05-04 06:53:22 +0000
+++ b/mysql-test/suite/perfschema/t/func_file_io.test	2010-05-11 10:36:37 +0000
@@ -27,6 +27,9 @@ UPDATE performance_schema.SETUP_INSTRUME
 UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
 WHERE name LIKE 'wait/io/file/%';
 
+update performance_schema.THREADS SET instrumented = 'YES'
+  WHERE PROCESSLIST_ID=connection_id();
+
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
@@ -155,12 +158,11 @@ LIMIT 10;
 #
 
 --disable_result_log
-SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
+SELECT p.processlist_user, SUM(TIMER_WAIT) SUM_WAIT
 # ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
+GROUP BY p.processlist_user
 ORDER BY SUM_WAIT DESC
 LIMIT 20;
 --enable_result_log
@@ -171,8 +173,8 @@ LIMIT 20;
 --disable_result_log
 SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
-WHERE p.ID = 1
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
+WHERE p.PROCESSLIST_ID = 1
 GROUP BY h.EVENT_NAME
 HAVING TOTAL_WAIT > 0;
 --enable_result_log
@@ -182,11 +184,12 @@ HAVING TOTAL_WAIT > 0;
 #
 
 --disable_result_log
-SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
+SELECT p.processlist_user, h.operation, SUM(NUMBER_OF_BYTES) bytes
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user, h.operation
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
+GROUP BY p.processlist_user, h.operation
 HAVING BYTES > 0
-ORDER BY i.user, h.operation;
+ORDER BY p.processlist_user, h.operation;
 --enable_result_log
+
+UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';

=== modified file 'mysql-test/suite/perfschema/t/misc.test'
--- a/mysql-test/suite/perfschema/t/misc.test	2010-04-07 08:53:19 +0000
+++ b/mysql-test/suite/perfschema/t/misc.test	2010-05-11 10:36:37 +0000
@@ -27,7 +27,7 @@
 --disable_result_log
 SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
 WHERE THREAD_ID IN
-  (SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+  (SELECT THREAD_ID FROM performance_schema.THREADS)
 AND EVENT_NAME IN
   (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
    WHERE NAME LIKE "wait/synch/%")

=== modified file 'mysql-test/suite/perfschema/t/no_threads.test'
--- a/mysql-test/suite/perfschema/t/no_threads.test	2010-05-04 06:53:22 +0000
+++ b/mysql-test/suite/perfschema/t/no_threads.test	2010-05-11 10:36:37 +0000
@@ -45,10 +45,10 @@ show variables like "performance_schema_
 
 # Verification : in this main thread
 
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
   where name like "thread/sql/main";
 
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
   where name like "thread/sql/OneConnection";
 
 select event_name, operation,

=== modified file 'mysql-test/suite/perfschema/t/schema.test'
--- a/mysql-test/suite/perfschema/t/schema.test	2010-05-04 06:53:22 +0000
+++ b/mysql-test/suite/perfschema/t/schema.test	2010-05-11 10:36:37 +0000
@@ -37,10 +37,10 @@ show create table FILE_SUMMARY_BY_EVENT_
 show create table FILE_SUMMARY_BY_INSTANCE;
 show create table MUTEX_INSTANCES;
 show create table PERFORMANCE_TIMERS;
-show create table PROCESSLIST;
 show create table RWLOCK_INSTANCES;
 show create table SETUP_CONSUMERS;
 show create table SETUP_INSTRUMENTS;
 show create table SETUP_OBJECTS;
 show create table SETUP_TIMERS;
+show create table THREADS;
 

=== modified file 'mysql-test/suite/perfschema/t/selects.test'
--- a/mysql-test/suite/perfschema/t/selects.test	2010-05-04 06:53:22 +0000
+++ b/mysql-test/suite/perfschema/t/selects.test	2010-05-11 10:36:37 +0000
@@ -45,7 +45,7 @@ LIMIT 1;
 --replace_column 1 [EVENT_ID]
 SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
 WHERE THREAD_ID IN
-  (SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+  (SELECT THREAD_ID FROM performance_schema.THREADS)
 AND EVENT_NAME IN
   (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
    WHERE NAME LIKE "wait/synch/%")
@@ -121,33 +121,33 @@ DROP TRIGGER t_ps_trigger;
 
 delimiter |;
 
-CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
+CREATE PROCEDURE t_ps_proc(IN conid INT, OUT pid INT)
 BEGIN
-   SELECT id FROM performance_schema.PROCESSLIST
-   WHERE THREAD_ID = tid INTO pid;
+   SELECT thread_id FROM performance_schema.THREADS
+   WHERE PROCESSLIST_ID = conid INTO pid;
 END;
 
 |
 
 delimiter ;|
 
-CALL t_ps_proc(0, @p_id);
+CALL t_ps_proc(connection_id(), @p_id);
 
 # FUNCTION
 
 delimiter |;
 
-CREATE FUNCTION t_ps_func(tid INT) RETURNS int
+CREATE FUNCTION t_ps_func(conid INT) RETURNS int
 BEGIN
-   return (SELECT id FROM performance_schema.PROCESSLIST
-           WHERE THREAD_ID = tid);
+   return (SELECT thread_id FROM performance_schema.THREADS
+           WHERE PROCESSLIST_ID = conid);
 END;
 
 |
 
 delimiter ;|
 
-SELECT t_ps_func(0) = @p_id;
+SELECT t_ps_func(connection_id()) = @p_id;
 
 DROP PROCEDURE t_ps_proc;
 DROP FUNCTION t_ps_func;

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_thread_class.test'
--- a/mysql-test/suite/perfschema/t/start_server_no_thread_class.test	2010-05-04 06:53:22 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test	2010-05-11 10:36:37 +0000
@@ -31,7 +31,7 @@ select variable_value > 0 from informati
   where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST';
 
 # Expect no instances
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
 
 # Expect no instances lost
 show status like "performance_schema_thread_instances_lost";

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_thread_inst.test'
--- a/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test	2010-05-04 06:53:22 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test	2010-05-11 10:36:37 +0000
@@ -33,7 +33,7 @@ show status like "performance_schema_thr
 # Expect no instances
 show variables like "performance_schema_max_thread_instances";
 
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
 
 # Expect instances lost
 select variable_value > 0 from information_schema.global_status

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2010-04-14 16:40:04 +0000
+++ b/scripts/mysql_system_tables.sql	2010-05-11 10:36:37 +0000
@@ -395,23 +395,6 @@ EXECUTE stmt;
 DROP PREPARE stmt;
 
 --
--- TABLE PROCESSLIST
---
-
-SET @l1="CREATE TABLE performance_schema.PROCESSLIST(";
-SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="ID INTEGER not null,";
-SET @l4="NAME VARCHAR(64) not null";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
 -- TABLE RWLOCK_INSTANCES
 --
 
@@ -498,3 +481,31 @@ PREPARE stmt FROM @str;
 EXECUTE stmt;
 DROP PREPARE stmt;
 
+--
+-- TABLE THREADS
+--
+
+SET @l1="CREATE TABLE performance_schema.THREADS(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="NAME VARCHAR(128) not null,";
+SET @l4="TYPE VARCHAR(10) not null,";
+SET @l5="PROCESSLIST_ID INTEGER,";
+SET @l6="PROCESSLIST_USER VARCHAR(16),";
+SET @l7="PROCESSLIST_HOST VARCHAR(60),";
+SET @l8="PROCESSLIST_DB VARCHAR(64),";
+SET @l9="PROCESSLIST_COMMAND VARCHAR(16),";
+SET @l10="PROCESSLIST_TIME BIGINT,";
+SET @l11="PROCESSLIST_STATE VARCHAR(64),";
+SET @l12="PROCESSLIST_INFO LONGTEXT,";
+SET @l13="PARENT_THREAD_ID INTEGER,";
+SET @l14="ROLE VARCHAR(64),";
+SET @l15="INSTRUMENTED ENUM ('YES', 'NO') not null";
+SET @l16=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-04-21 07:35:37 +0000
+++ b/sql/sys_vars.cc	2010-05-11 10:36:37 +0000
@@ -197,6 +197,14 @@ static Sys_var_ulong Sys_pfs_max_thread_
        DEFAULT(PFS_MAX_THREAD),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
+static Sys_var_ulong Sys_pfs_setup_actors_size(
+       "performance_schema_setup_actors_size",
+       "Maximum number of rows in SETUP_ACTORS.",
+       READ_ONLY GLOBAL_VAR(pfs_param.m_setup_actor_sizing),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024),
+       DEFAULT(PFS_MAX_SETUP_ACTOR),
+       BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+
 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
 
 static Sys_var_ulong Sys_auto_increment_increment(

=== modified file 'storage/perfschema/CMakeLists.txt'
--- a/storage/perfschema/CMakeLists.txt	2010-05-07 10:08:23 +0000
+++ b/storage/perfschema/CMakeLists.txt	2010-05-11 10:36:37 +0000
@@ -25,6 +25,7 @@ ADD_DEFINITIONS(-DMYSQL_SERVER)
 SET(PERFSCHEMA_SOURCES ha_perfschema.h
   pfs_column_types.h
   pfs_column_values.h
+  pfs_defaults.h
   pfs_events_waits.h
   pfs_global.h
   pfs.h
@@ -43,15 +44,16 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
   table_file_instances.h
   table_file_summary.h
   table_performance_timers.h
-  table_processlist.h
   table_setup_consumers.h
   table_setup_instruments.h
   table_setup_objects.h
   table_setup_timers.h
   table_sync_instances.h
+  table_threads.h
   ha_perfschema.cc
   pfs.cc
   pfs_column_values.cc
+  pfs_defaults.cc
   pfs_events_waits.cc
   pfs_global.cc
   pfs_instr.cc
@@ -66,12 +68,12 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
   table_file_instances.cc
   table_file_summary.cc
   table_performance_timers.cc
-  table_processlist.cc
   table_setup_consumers.cc
   table_setup_instruments.cc
   table_setup_objects.cc
   table_setup_timers.cc
   table_sync_instances.cc
+  table_threads.cc
   pfs_atomic.cc
   pfs_check.cc
 )

=== modified file 'storage/perfschema/Makefile.am'
--- a/storage/perfschema/Makefile.am	2010-05-07 10:08:23 +0000
+++ b/storage/perfschema/Makefile.am	2010-05-11 10:36:37 +0000
@@ -39,13 +39,13 @@ noinst_HEADERS = ha_perfschema.h pfs_eng
                 table_setup_instruments.h table_performance_timers.h \
                 table_setup_timers.h \
                 table_setup_consumers.h table_events_waits.h \
-		pfs_events_waits.h pfs_timer.h table_processlist.h \
+		pfs_events_waits.h pfs_timer.h table_threads.h
 		table_sync_instances.h \
 		table_events_waits_summary.h pfs_stat.h \
 		table_all_instr.h \
 		table_file_instances.h table_file_summary.h \
 		table_setup_objects.h pfs_lock.h pfs_atomic.h \
-		pfs_setup_actor.h
+		pfs_setup_actor.h pfs_defaults.h
 
 PSE_SOURCES = ha_perfschema.cc pfs_engine_table.cc pfs.cc pfs_server.cc \
 		pfs_global.cc pfs_instr_class.cc pfs_instr.cc \
@@ -53,13 +53,13 @@ PSE_SOURCES = ha_perfschema.cc pfs_engin
                 table_setup_instruments.cc table_performance_timers.cc \
                 table_setup_timers.cc \
                 table_setup_consumers.cc table_events_waits.cc \
-		pfs_events_waits.cc pfs_timer.cc table_processlist.cc \
+		pfs_events_waits.cc pfs_timer.cc table_threads.cc \
 		table_sync_instances.cc \
 		table_events_waits_summary.cc \
 		table_all_instr.cc \
 		table_file_instances.cc table_file_summary.cc \
 		table_setup_objects.cc pfs_atomic.cc pfs_check.cc \
-		pfs_setup_actor.cc
+		pfs_setup_actor.cc pfs_defaults.cc
 
 EXTRA_LIBRARIES = libperfschema.a
 noinst_LIBRARIES = @plugin_perfschema_static_target@

=== modified file 'storage/perfschema/ha_perfschema.cc'
--- a/storage/perfschema/ha_perfschema.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/ha_perfschema.cc	2010-05-11 10:36:37 +0000
@@ -212,13 +212,7 @@ int ha_perfschema::write_row(uchar *buf)
   ha_statistic_increment(&SSV::ha_write_count);
   DBUG_ASSERT(m_table_share);
 
-  if (m_table_share->m_write_row)
-    result= m_table_share->m_write_row(table, buf, table->field);
-  else
-  {
-    my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
-    result= HA_ERR_WRONG_COMMAND;
-  }
+  result= m_table_share->write_row(table, buf, table->field);
 
   DBUG_RETURN(result);
 }
@@ -243,6 +237,15 @@ int ha_perfschema::update_row(const ucha
   DBUG_RETURN(result);
 }
 
+int ha_perfschema::delete_row(const uchar *buf)
+{
+  DBUG_ENTER("ha_perfschema::delete_row");
+
+  DBUG_ASSERT(m_table);
+  int result= m_table->delete_row(table, buf, table->field);
+  DBUG_RETURN(result);
+}
+
 int ha_perfschema::rnd_init(bool scan)
 {
   int result;
@@ -310,7 +313,7 @@ int ha_perfschema::info(uint flag)
   DBUG_ENTER("ha_perfschema::info");
   DBUG_ASSERT(m_table_share);
   if (flag & HA_STATUS_VARIABLE)
-    stats.records= m_table_share->m_records;
+    stats.records= m_table_share->get_row_count();
   if (flag & HA_STATUS_CONST)
     ref_length= m_table_share->m_ref_length;
   DBUG_RETURN(0);

=== modified file 'storage/perfschema/ha_perfschema.h'
--- a/storage/perfschema/ha_perfschema.h	2010-04-19 12:26:29 +0000
+++ b/storage/perfschema/ha_perfschema.h	2010-05-11 10:36:37 +0000
@@ -72,7 +72,8 @@ public:
       records.
     */
     return HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT |
-      HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_NO_BLOBS;
+      HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
+      HA_PRIMARY_KEY_REQUIRED_FOR_DELETE;
   }
 
   /**
@@ -113,6 +114,8 @@ public:
 
   int update_row(const uchar *old_data, uchar *new_data);
 
+  int delete_row(const uchar *buf);
+
   int rnd_init(bool scan);
 
   int rnd_end(void);

=== added file 'storage/perfschema/pfs_defaults.cc'
--- a/storage/perfschema/pfs_defaults.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/pfs_defaults.cc	2010-05-11 10:36:37 +0000
@@ -0,0 +1,49 @@
+/* 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 storage/perfschema/pfs_defaults.cc
+  Default setup (implementation).
+*/
+
+#include "pfs.h"
+#include "pfs_defaults.h"
+#include "pfs_instr.h"
+#include "pfs_setup_actor.h"
+
+static PSI_thread_key key;
+static PSI_thread_info info= { &key, "setup", PSI_FLAG_GLOBAL };
+
+void install_default_setup(PSI_bootstrap *boot)
+{
+  PSI *psi= (PSI*) boot->get_interface(PSI_CURRENT_VERSION);
+  if (psi == NULL)
+    return;
+
+  psi->register_thread("performance_schema", &info, 1);
+  PSI_thread *psi_thread= psi->new_thread(key, NULL, 0);
+  if (psi_thread == NULL)
+    return;
+
+  /* LF_HASH needs a thread, for PINS */
+  psi->set_thread(psi_thread);
+
+  String percent("%", 1, &my_charset_utf8_bin);
+  /* Enable all users on all hosts by default */
+  insert_setup_actor(&percent, &percent, &percent);
+
+  psi->delete_current_thread();
+}
+

=== added file 'storage/perfschema/pfs_defaults.h'
--- a/storage/perfschema/pfs_defaults.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/pfs_defaults.h	2010-05-11 10:36:37 +0000
@@ -0,0 +1,26 @@
+/* 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 */
+
+#ifndef PFS_DEFAULTS_H
+#define PFS_DEFAULTS_H
+
+/**
+  @file storage/perfschema/pfs_defaults.h
+  Default setup (declarations).
+*/
+
+void install_default_setup(PSI_bootstrap *boot);
+
+#endif

=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/pfs_engine_table.cc	2010-05-11 10:36:37 +0000
@@ -27,11 +27,11 @@
 #include "table_setup_objects.h"
 #include "table_setup_timers.h"
 #include "table_performance_timers.h"
-#include "table_processlist.h"
 #include "table_events_waits_summary.h"
 #include "table_sync_instances.h"
 #include "table_file_instances.h"
 #include "table_file_summary.h"
+#include "table_threads.h"
 
 /* For show status */
 #include "pfs_column_values.h"
@@ -55,7 +55,6 @@ static PFS_engine_table_share *all_share
   &table_setup_objects::m_share,
   &table_setup_timers::m_share,
   &table_performance_timers::m_share,
-  &table_processlist::m_share,
   &table_events_waits_summary_by_thread_by_event_name::m_share,
   &table_events_waits_summary_by_event_name::m_share,
   &table_events_waits_summary_by_instance::m_share,
@@ -65,6 +64,7 @@ static PFS_engine_table_share *all_share
   &table_rwlock_instances::m_share,
   &table_cond_instances::m_share,
   &table_file_instances::m_share,
+  &table_threads::m_share,
   NULL
 };
 
@@ -167,6 +167,45 @@ void PFS_engine_table_share::delete_all_
     thr_lock_delete((*current)->m_thr_lock_ptr);
 }
 
+ha_rows PFS_engine_table_share::get_row_count(void) const
+{
+  /* If available, count the exact number or records */
+  if (m_get_row_count)
+    return m_get_row_count();
+  /* Otherwise, return an estimate */
+  return m_records;
+}
+
+int PFS_engine_table_share::write_row(TABLE *table, unsigned char *buf,
+                                      Field **fields) const
+{
+  my_bitmap_map *org_bitmap;
+
+  /*
+    Make sure the table structure is as expected before mapping
+    hard wired columns in m_write_row.
+  */
+  if (! m_checked)
+  {
+    my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0),
+             PERFORMANCE_SCHEMA_str.str, m_name);
+    return HA_ERR_TABLE_NEEDS_UPGRADE;
+  }
+
+  if (m_write_row == NULL)
+  {
+    my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
+    return HA_ERR_WRONG_COMMAND;
+  }
+
+  /* We internally read from Fields to support the write interface */
+  org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+  int result= m_write_row(table, buf, fields);
+  dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+
+  return result;
+}
+
 static int compare_table_names(const char *name1, const char *name2)
 {
   /*
@@ -278,6 +317,39 @@ int PFS_engine_table::update_row(TABLE *
   return result;
 }
 
+int PFS_engine_table::delete_row(TABLE *table,
+                                 const unsigned char *buf,
+                                 Field **fields)
+{
+  my_bitmap_map *org_bitmap;
+
+  /*
+    Make sure the table structure is as expected before mapping
+    hard wired columns in delete_row_values.
+  */
+  if (! m_share_ptr->m_checked)
+  {
+    my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0),
+             PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name.str);
+    return HA_ERR_TABLE_NEEDS_UPGRADE;
+  }
+
+  /* We internally read from Fields to support the delete interface */
+  org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+  int result= delete_row_values(table, buf, fields);
+  dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+
+  return result;
+}
+
+int PFS_engine_table::delete_row_values(TABLE *,
+                                        const unsigned char *,
+                                        Field **)
+{
+  my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
+  return HA_ERR_WRONG_COMMAND;
+}
+
 /**
   Get the position of the current row.
   @param [out] ref        position
@@ -310,6 +382,14 @@ void PFS_engine_table::set_field_ulonglo
   f2->store(value, true);
 }
 
+void PFS_engine_table::set_field_char_utf8(Field *f, const char* str,
+                                           uint len)
+{
+  DBUG_ASSERT(f->real_type() == MYSQL_TYPE_STRING);
+  Field_string *f2= (Field_string*) f;
+  f2->store(str, len, &my_charset_utf8_bin);
+}
+
 void PFS_engine_table::set_field_varchar_utf8(Field *f, const char* str,
                                               uint len)
 {
@@ -318,6 +398,14 @@ void PFS_engine_table::set_field_varchar
   f2->store(str, len, &my_charset_utf8_bin);
 }
 
+void PFS_engine_table::set_field_longtext_utf8(Field *f, const char* str,
+                                               uint len)
+{
+  DBUG_ASSERT(f->real_type() == MYSQL_TYPE_BLOB);
+  Field_blob *f2= (Field_blob*) f;
+  f2->store(str, len, &my_charset_utf8_bin);
+}
+
 void PFS_engine_table::set_field_enum(Field *f, ulonglong value)
 {
   DBUG_ASSERT(f->real_type() == MYSQL_TYPE_ENUM);
@@ -332,6 +420,24 @@ ulonglong PFS_engine_table::get_field_en
   return f2->val_int();
 }
 
+String*
+PFS_engine_table::get_field_char_utf8(Field *f, String *val)
+{
+  DBUG_ASSERT(f->real_type() == MYSQL_TYPE_STRING);
+  Field_string *f2= (Field_string*) f;
+  val= f2->val_str(NULL, val);
+  return val;
+}
+
+String*
+PFS_engine_table::get_field_varchar_utf8(Field *f, String *val)
+{
+  DBUG_ASSERT(f->real_type() == MYSQL_TYPE_VARCHAR);
+  Field_varstring *f2= (Field_varstring*) f;
+  val= f2->val_str(NULL, val);
+  return val;
+}
+
 int PFS_engine_table::update_row_values(TABLE *,
                                         const unsigned char *,
                                         unsigned char *,

=== modified file 'storage/perfschema/pfs_engine_table.h'
--- a/storage/perfschema/pfs_engine_table.h	2010-04-26 09:27:44 +0000
+++ b/storage/perfschema/pfs_engine_table.h	2010-05-11 10:36:37 +0000
@@ -46,6 +46,8 @@ public:
   int update_row(TABLE *table, const unsigned char *old_buf,
                  unsigned char *new_buf, Field **fields);
 
+  int delete_row(TABLE *table, const unsigned char *buf, Field **fields);
+
   /** Fetch the next row in this cursor. */
   virtual int rnd_next(void)= 0;
   /**
@@ -62,6 +64,17 @@ public:
   virtual ~PFS_engine_table()
   {}
 
+  static void set_field_ulong(Field *f, ulong value);
+  static void set_field_ulonglong(Field *f, ulonglong value);
+  static void set_field_char_utf8(Field *f, const char *str, uint len);
+  static void set_field_varchar_utf8(Field *f, const char *str, uint len);
+  static void set_field_longtext_utf8(Field *f, const char *str, uint len);
+  static void set_field_enum(Field *f, ulonglong value);
+
+  static ulonglong get_field_enum(Field *f);
+  static String *get_field_char_utf8(Field *f, String *val);
+  static String *get_field_varchar_utf8(Field *f, String *val);
+
 protected:
   /**
     Read the current row values.
@@ -84,6 +97,15 @@ protected:
                                 unsigned char *new_buf, Field **fields);
 
   /**
+    Delete a row.
+    @param table            Table handle
+    @param buf              Row buffer
+    @param fields           Table fields
+  */
+  virtual int delete_row_values(TABLE *table, const unsigned char *buf,
+                                Field **fields);
+
+  /**
     Constructor.
     @param share            table share
     @param pos              address of the m_pos position member
@@ -92,13 +114,6 @@ protected:
     : m_share_ptr(share), m_pos_ptr(pos)
   {}
 
-  void set_field_ulong(Field *f, ulong value);
-  void set_field_ulonglong(Field *f, ulonglong value);
-  void set_field_varchar_utf8(Field *f, const char* str, uint len);
-  void set_field_enum(Field *f, ulonglong value);
-
-  ulonglong get_field_enum(Field *f);
-
   /** Table share. */
   const PFS_engine_table_share *m_share_ptr;
   /** Opaque pointer to the m_pos position of this cursor. */
@@ -112,6 +127,8 @@ typedef int (*pfs_write_row_t)(TABLE *ta
                                unsigned char *buf, Field **fields);
 /** Callback to delete all rows. */
 typedef int (*pfs_delete_all_rows_t)(void);
+/** Callback to get a row count. */
+typedef ha_rows (*pfs_get_row_count_t)(void);
 
 /**
   A PERFORMANCE_SCHEMA table share.
@@ -123,6 +140,8 @@ struct PFS_engine_table_share
   void check_one_table(THD *thd);
   static void init_all_locks(void);
   static void delete_all_locks(void);
+  ha_rows get_row_count(void) const;
+  int write_row(TABLE *table, unsigned char *buf, Field **fields) const;
 
   /** Table name. */
   LEX_STRING m_name;
@@ -134,6 +153,8 @@ struct PFS_engine_table_share
   pfs_write_row_t m_write_row;
   /** Delete all rows function. */
   pfs_delete_all_rows_t m_delete_all_rows;
+  /** Get rows count function. */
+  pfs_get_row_count_t m_get_row_count;
   /**
     Number or records.
     This number does not need to be precise,

=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/pfs_server.cc	2010-05-11 10:36:37 +0000
@@ -28,6 +28,8 @@
 #include "pfs_instr.h"
 #include "pfs_events_waits.h"
 #include "pfs_timer.h"
+#include "pfs_setup_actor.h"
+#include "pfs_defaults.h"
 
 PFS_global_param pfs_param;
 
@@ -66,7 +68,9 @@ initialize_performance_schema(const PFS_
       init_events_waits_history_long(
         param->m_events_waits_history_long_sizing) ||
       init_file_hash() ||
-      init_table_share_hash())
+      init_table_share_hash() ||
+      init_setup_actor(param) ||
+      init_setup_actor_hash())
   {
     /*
       The performance schema initialization failed.
@@ -77,6 +81,7 @@ initialize_performance_schema(const PFS_
   }
 
   pfs_initialized= true;
+  install_default_setup(&PFS_bootstrap);
   return &PFS_bootstrap;
 }
 
@@ -109,6 +114,8 @@ void cleanup_performance_schema(void)
   cleanup_events_waits_history_long();
   cleanup_table_share_hash();
   cleanup_file_hash();
+  cleanup_setup_actor();
+  cleanup_setup_actor_hash();
   PFS_atomic::cleanup();
 }
 

=== modified file 'storage/perfschema/pfs_setup_actor.cc'
--- a/storage/perfschema/pfs_setup_actor.cc	2010-05-07 10:08:23 +0000
+++ b/storage/perfschema/pfs_setup_actor.cc	2010-05-11 10:36:37 +0000
@@ -275,7 +275,6 @@ void lookup_setup_actor(PFS_thread *thre
                         const char *host, uint host_length,
                         bool *enabled)
 {
-#ifdef PORTME
   PFS_setup_actor_key key;
   PFS_setup_actor **entry;
   int i;
@@ -317,7 +316,6 @@ void lookup_setup_actor(PFS_thread *thre
       return;
     }
   }
-#endif
   *enabled= false;
   return;
 }

=== modified file 'storage/perfschema/table_events_waits.cc'
--- a/storage/perfschema/table_events_waits.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_events_waits.cc	2010-05-11 10:36:37 +0000
@@ -123,6 +123,7 @@ table_events_waits_current::m_share=
   &table_events_waits_current::create,
   NULL, /* write_row */
   &table_events_waits_current::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_events_waits_current), /* ref length */
   &m_table_lock,
@@ -140,6 +141,7 @@ table_events_waits_history::m_share=
   &table_events_waits_history::create,
   NULL, /* write_row */
   &table_events_waits_history::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_events_waits_history), /* ref length */
   &m_table_lock,
@@ -157,6 +159,7 @@ table_events_waits_history_long::m_share
   &table_events_waits_history_long::create,
   NULL, /* write_row */
   &table_events_waits_history_long::delete_all_rows,
+  NULL, /* get_row_count */
   10000, /* records */
   sizeof(PFS_simple_index), /* ref length */
   &m_table_lock,

=== modified file 'storage/perfschema/table_events_waits_summary.cc'
--- a/storage/perfschema/table_events_waits_summary.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_events_waits_summary.cc	2010-05-11 10:36:37 +0000
@@ -79,6 +79,7 @@ table_events_waits_summary_by_thread_by_
   &table_events_waits_summary_by_thread_by_event_name::create,
   NULL, /* write_row */
   &table_events_waits_summary_by_thread_by_event_name::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_events_waits_summary_by_thread_by_event_name),
   &m_table_lock,
@@ -386,6 +387,7 @@ table_events_waits_summary_by_event_name
   &table_events_waits_summary_by_event_name::create,
   NULL, /* write_row */
   &table_events_waits_summary_by_event_name::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_all_instr_class),
   &m_table_lock,
@@ -529,6 +531,7 @@ table_events_waits_summary_by_instance::
   &table_events_waits_summary_by_instance::create,
   NULL, /* write_row */
   &table_events_waits_summary_by_instance::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_all_instr),
   &m_table_lock,

=== modified file 'storage/perfschema/table_file_instances.cc'
--- a/storage/perfschema/table_file_instances.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_file_instances.cc	2010-05-11 10:36:37 +0000
@@ -59,6 +59,7 @@ table_file_instances::m_share=
   &table_file_instances::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,

=== modified file 'storage/perfschema/table_file_summary.cc'
--- a/storage/perfschema/table_file_summary.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_file_summary.cc	2010-05-11 10:36:37 +0000
@@ -69,6 +69,7 @@ table_file_summary_by_event_name::m_shar
   &table_file_summary_by_event_name::create,
   NULL, /* write_row */
   table_file_summary_by_event_name::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,
@@ -232,6 +233,7 @@ table_file_summary_by_instance::m_share=
   &table_file_summary_by_instance::create,
   NULL, /* write_row */
   table_file_summary_by_instance::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,

=== modified file 'storage/perfschema/table_performance_timers.cc'
--- a/storage/perfschema/table_performance_timers.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_performance_timers.cc	2010-05-11 10:36:37 +0000
@@ -63,6 +63,7 @@ table_performance_timers::m_share=
   &table_performance_timers::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   COUNT_TIMER_NAME, /* records */
   sizeof(PFS_simple_index), /* ref length */
   &m_table_lock,

=== removed file 'storage/perfschema/table_processlist.cc'
--- a/storage/perfschema/table_processlist.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_processlist.cc	1970-01-01 00:00:00 +0000
@@ -1,177 +0,0 @@
-/* Copyright (c) 2008, 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 storage/perfschema/table_processlist.cc
-  Table PROCESSLIST (implementation).
-*/
-
-#include "my_global.h"
-#include "my_pthread.h"
-#include "table_processlist.h"
-#include "pfs_instr_class.h"
-#include "pfs_instr.h"
-
-THR_LOCK table_processlist::m_table_lock;
-
-static const TABLE_FIELD_TYPE field_types[]=
-{
-  {
-    { C_STRING_WITH_LEN("THREAD_ID") },
-    { C_STRING_WITH_LEN("int(11)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("ID") },
-    { C_STRING_WITH_LEN("int(11)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("NAME") },
-    { C_STRING_WITH_LEN("varchar(64)") },
-    { NULL, 0}
-  }
-};
-
-TABLE_FIELD_DEF
-table_processlist::m_field_def=
-{ 3, field_types };
-
-PFS_engine_table_share
-table_processlist::m_share=
-{
-  { C_STRING_WITH_LEN("PROCESSLIST") },
-  &pfs_readonly_acl,
-  &table_processlist::create,
-  NULL, /* write_row */
-  NULL, /* delete_all_rows */
-  1000, /* records */
-  sizeof(PFS_simple_index), /* ref length */
-  &m_table_lock,
-  &m_field_def,
-  false /* checked */
-};
-
-PFS_engine_table* table_processlist::create(void)
-{
-  return new table_processlist();
-}
-
-table_processlist::table_processlist()
-  : PFS_engine_table(&m_share, &m_pos),
-  m_row_exists(false), m_pos(0), m_next_pos(0)
-{}
-
-void table_processlist::reset_position(void)
-{
-  m_pos.m_index= 0;
-  m_next_pos.m_index= 0;
-}
-
-int table_processlist::rnd_next(void)
-{
-  PFS_thread *pfs;
-
-  for (m_pos.set_at(&m_next_pos);
-       m_pos.m_index < thread_max;
-       m_pos.next())
-  {
-    pfs= &thread_array[m_pos.m_index];
-    if (pfs->m_lock.is_populated())
-    {
-      make_row(pfs);
-      m_next_pos.set_after(&m_pos);
-      return 0;
-    }
-  }
-
-  return HA_ERR_END_OF_FILE;
-}
-
-int table_processlist::rnd_pos(const void *pos)
-{
-  PFS_thread *pfs;
-
-  set_position(pos);
-  DBUG_ASSERT(m_pos.m_index < thread_max);
-  pfs= &thread_array[m_pos.m_index];
-  if (pfs->m_lock.is_populated())
-  {
-    make_row(pfs);
-    return 0;
-  }
-
-  return HA_ERR_RECORD_DELETED;
-}
-
-void table_processlist::make_row(PFS_thread *pfs)
-{
-  pfs_lock lock;
-  PFS_thread_class *safe_class;
-
-  m_row_exists= false;
-
-  /* Protect this reader against thread termination */
-  pfs->m_lock.begin_optimistic_lock(&lock);
-
-  safe_class= sanitize_thread_class(pfs->m_class);
-  if (unlikely(safe_class == NULL))
-    return;
-
-  m_row.m_thread_internal_id= pfs->m_thread_internal_id;
-  m_row.m_thread_id= pfs->m_thread_id;
-  m_row.m_name= safe_class->m_name;
-  m_row.m_name_length= safe_class->m_name_length;
-
-  if (pfs->m_lock.end_optimistic_lock(&lock))
-    m_row_exists= true;
-}
-
-int table_processlist::read_row_values(TABLE *table,
-                                       unsigned char *,
-                                       Field **fields,
-                                       bool read_all)
-{
-  Field *f;
-
-  if (unlikely(! m_row_exists))
-    return HA_ERR_RECORD_DELETED;
-
-  /* Set the null bits */
-  DBUG_ASSERT(table->s->null_bytes == 0);
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (read_all || bitmap_is_set(table->read_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case 0: /* THREAD_ID */
-        set_field_ulong(f, m_row.m_thread_internal_id);
-        break;
-      case 1: /* ID */
-        set_field_ulong(f, m_row.m_thread_id);
-        break;
-      case 2: /* NAME */
-        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
-        break;
-      default:
-        DBUG_ASSERT(false);
-      }
-    }
-  }
-  return 0;
-}
-

=== removed file 'storage/perfschema/table_processlist.h'
--- a/storage/perfschema/table_processlist.h	2010-04-26 09:27:44 +0000
+++ b/storage/perfschema/table_processlist.h	1970-01-01 00:00:00 +0000
@@ -1,91 +0,0 @@
-/* Copyright (c) 2008, 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 */
-
-#ifndef TABLE_PROCESSIST_H
-#define TABLE_PROCESSIST_H
-
-/**
-  @file storage/perfschema/table_processlist.h
-  Table PROCESSLIST (declarations).
-*/
-
-#include "pfs_column_types.h"
-#include "pfs_engine_table.h"
-
-struct PFS_thread;
-
-/**
-  @addtogroup Performance_schema_tables
-  @{
-*/
-
-/** A row of PERFORMANCE_SCHEMA.PROCESSLIST. */
-struct row_processlist
-{
-  /** Column THREAD_ID. */
-  ulong m_thread_internal_id;
-  /** Column ID. */
-  ulong m_thread_id;
-  /** Column NAME. */
-  const char *m_name;
-  /** Length in bytes of @c m_name. */
-  uint m_name_length;
-};
-
-/** Table PERFORMANCE_SCHEMA.PROCESSLIST. */
-class table_processlist : public PFS_engine_table
-{
-public:
-  /** Table share. */
-  static PFS_engine_table_share m_share;
-  static PFS_engine_table* create();
-
-  virtual int rnd_next();
-  virtual int rnd_pos(const void *pos);
-  virtual void reset_position(void);
-
-protected:
-  virtual int read_row_values(TABLE *table,
-                              unsigned char *buf,
-                              Field **fields,
-                              bool read_all);
-
-protected:
-  table_processlist();
-
-public:
-  ~table_processlist()
-  {}
-
-private:
-  void make_row(PFS_thread *pfs);
-
-  /** Table share lock. */
-  static THR_LOCK m_table_lock;
-  /** Fields definition. */
-  static TABLE_FIELD_DEF m_field_def;
-
-  /** Current row. */
-  row_processlist m_row;
-  /** True is the current row exists. */
-  bool m_row_exists;
-  /** Current position. */
-  PFS_simple_index m_pos;
-  /** Next position. */
-  PFS_simple_index m_next_pos;
-};
-
-/** @} */
-#endif

=== modified file 'storage/perfschema/table_setup_consumers.cc'
--- a/storage/perfschema/table_setup_consumers.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_setup_consumers.cc	2010-05-11 10:36:37 +0000
@@ -89,6 +89,7 @@ table_setup_consumers::m_share=
   &table_setup_consumers::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   COUNT_SETUP_CONSUMERS, /* records */
   sizeof(PFS_simple_index), /* ref length */
   &m_table_lock,

=== modified file 'storage/perfschema/table_setup_instruments.cc'
--- a/storage/perfschema/table_setup_instruments.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_setup_instruments.cc	2010-05-11 10:36:37 +0000
@@ -59,6 +59,7 @@ table_setup_instruments::m_share=
   &table_setup_instruments::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_setup_instruments),
   &m_table_lock,

=== modified file 'storage/perfschema/table_setup_objects.cc'
--- a/storage/perfschema/table_setup_objects.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_setup_objects.cc	2010-05-11 10:36:37 +0000
@@ -74,6 +74,7 @@ table_setup_objects::m_share=
   &table_setup_objects::create,
   table_setup_objects::write_row,
   table_setup_objects::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_setup_objects),
   &m_table_lock,

=== modified file 'storage/perfschema/table_setup_timers.cc'
--- a/storage/perfschema/table_setup_timers.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_setup_timers.cc	2010-05-11 10:36:37 +0000
@@ -62,6 +62,7 @@ table_setup_timers::m_share=
   &table_setup_timers::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   COUNT_SETUP_TIMERS,
   sizeof(PFS_simple_index),
   &m_table_lock,

=== modified file 'storage/perfschema/table_sync_instances.cc'
--- a/storage/perfschema/table_sync_instances.cc	2010-05-03 15:04:02 +0000
+++ b/storage/perfschema/table_sync_instances.cc	2010-05-11 10:36:37 +0000
@@ -60,6 +60,7 @@ table_mutex_instances::m_share=
   &table_mutex_instances::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,
@@ -228,6 +229,7 @@ table_rwlock_instances::m_share=
   &table_rwlock_instances::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,
@@ -393,6 +395,7 @@ table_cond_instances::m_share=
   &table_cond_instances::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,

=== added file 'storage/perfschema/table_threads.cc'
--- a/storage/perfschema/table_threads.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_threads.cc	2010-05-11 10:36:37 +0000
@@ -0,0 +1,353 @@
+/* Copyright (c) 2008, 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 */
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "table_threads.h"
+#include "sql_parse.h"
+#include "pfs_instr_class.h"
+#include "pfs_instr.h"
+
+THR_LOCK table_threads::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("THREAD_ID") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("NAME") },
+    { C_STRING_WITH_LEN("varchar(128)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("TYPE") },
+    { C_STRING_WITH_LEN("varchar(10)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_ID") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_USER") },
+    { C_STRING_WITH_LEN("varchar(16)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_HOST") },
+    { C_STRING_WITH_LEN("varchar(60)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_DB") },
+    { C_STRING_WITH_LEN("varchar(64)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_COMMAND") },
+    { C_STRING_WITH_LEN("varchar(16)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_TIME") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_STATE") },
+    { C_STRING_WITH_LEN("varchar(64)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_INFO") },
+    { C_STRING_WITH_LEN("longtext") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PARENT_THREAD_ID") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("ROLE") },
+    { C_STRING_WITH_LEN("varchar(64)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("INSTRUMENTED") },
+    { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") },
+    { NULL, 0}
+  }
+};
+
+TABLE_FIELD_DEF
+table_threads::m_field_def=
+{ 14, field_types };
+
+PFS_engine_table_share
+table_threads::m_share=
+{
+  { C_STRING_WITH_LEN("THREADS") },
+  &pfs_updatable_acl,
+  &table_threads::create,
+  NULL, /* write_row */
+  NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
+  1000, /* records */
+  sizeof(PFS_simple_index), /* ref length */
+  &m_table_lock,
+  &m_field_def,
+  false /* checked */
+};
+
+PFS_engine_table* table_threads::create()
+{
+  return new table_threads();
+}
+
+table_threads::table_threads()
+  : PFS_engine_table(& m_share, & m_pos),
+  m_row_exists(false), m_pos(0), m_next_pos(0)
+{}
+
+void table_threads::reset_position(void)
+{
+  m_pos.m_index= 0;
+  m_next_pos.m_index= 0;
+}
+
+int table_threads::rnd_next()
+{
+  PFS_thread *pfs;
+
+  for (m_pos.set_at(&m_next_pos);
+       m_pos.m_index < thread_max;
+       m_pos.next())
+  {
+    pfs= &thread_array[m_pos.m_index];
+    if (pfs->m_lock.is_populated())
+    {
+      make_row(pfs);
+      m_next_pos.set_after(&m_pos);
+      return 0;
+    }
+  }
+
+  return HA_ERR_END_OF_FILE;
+}
+
+int table_threads::rnd_pos(const void *pos)
+{
+  PFS_thread *pfs;
+
+  set_position(pos);
+  DBUG_ASSERT(m_pos.m_index < thread_max);
+  pfs= &thread_array[m_pos.m_index];
+  if (pfs->m_lock.is_populated())
+  {
+    make_row(pfs);
+    return 0;
+  }
+
+  return HA_ERR_RECORD_DELETED;
+}
+
+void table_threads::make_row(PFS_thread *pfs)
+{
+  pfs_lock lock;
+  PFS_thread_class *safe_class;
+
+  m_row_exists= false;
+
+  /* Protect this reader against thread termination */
+  pfs->m_lock.begin_optimistic_lock(&lock);
+
+  safe_class= sanitize_thread_class(pfs->m_class);
+  if (unlikely(safe_class == NULL))
+    return;
+
+  m_row.m_thread_internal_id= pfs->m_thread_internal_id;
+  m_row.m_thread_id= pfs->m_thread_id;
+  m_row.m_name= safe_class->m_name;
+  m_row.m_name_length= safe_class->m_name_length;
+  memcpy(m_row.m_username, pfs->m_username, pfs->m_username_length);
+  m_row.m_username_length= pfs->m_username_length;
+  memcpy(m_row.m_hostname, pfs->m_hostname, pfs->m_hostname_length);
+  m_row.m_hostname_length= pfs->m_hostname_length;
+  memcpy(m_row.m_dbname, pfs->m_dbname, pfs->m_dbname_length);
+  m_row.m_dbname_length= pfs->m_dbname_length;
+  m_row.m_command= pfs->m_command;
+  m_row.m_start_time= pfs->m_start_time;
+  /* FIXME: need to copy it ? */
+  m_row.m_processlist_state_ptr= pfs->m_processlist_state_ptr;
+  m_row.m_processlist_state_length= pfs->m_processlist_state_length;
+  /* FIXME: need to copy it ? */
+  m_row.m_processlist_info_ptr= pfs->m_processlist_info_ptr;
+  m_row.m_processlist_info_length= pfs->m_processlist_info_length;
+  m_row.m_enabled_ptr= &pfs->m_enabled;
+
+  if (pfs->m_lock.end_optimistic_lock(& lock))
+    m_row_exists= true;
+}
+
+int table_threads::read_row_values(TABLE *table,
+                                   unsigned char *buf,
+                                   Field **fields,
+                                   bool read_all)
+{
+  Field *f;
+
+  if (unlikely(! m_row_exists))
+    return HA_ERR_RECORD_DELETED;
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 2);
+  buf[0]= 0;
+  buf[1]= 0;
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* THREAD_ID */
+        set_field_ulong(f, m_row.m_thread_internal_id);
+        break;
+      case 1: /* NAME */
+        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
+        break;
+      case 2: /* TYPE */
+        if (m_row.m_thread_id != 0)
+          set_field_varchar_utf8(f, "FOREGROUND", 10);
+        else
+          set_field_varchar_utf8(f, "BACKGROUND", 10);
+        break;
+      case 3: /* PROCESSLIST_ID */
+        if (m_row.m_thread_id != 0)
+          set_field_ulong(f, m_row.m_thread_id);
+        else
+          f->set_null();
+        break;
+      case 4: /* PROCESSLIST_USER */
+        if (m_row.m_username_length > 0)
+          set_field_varchar_utf8(f, m_row.m_username,
+                                 m_row.m_username_length);
+        else
+          f->set_null();
+        break;
+      case 5: /* PROCESSLIST_HOST */
+        if (m_row.m_hostname_length > 0)
+          set_field_varchar_utf8(f, m_row.m_hostname,
+                                 m_row.m_hostname_length);
+        else
+          f->set_null();
+        break;
+      case 6: /* PROCESSLIST_DB */
+        if (m_row.m_dbname_length > 0)
+          set_field_varchar_utf8(f, m_row.m_dbname,
+                                 m_row.m_dbname_length);
+        else
+          f->set_null();
+        break;
+      case 7: /* PROCESSLIST_COMMAND */
+        if (m_row.m_thread_id != 0)
+          set_field_varchar_utf8(f, command_name[m_row.m_command].str,
+                                 command_name[m_row.m_command].length);
+        else
+          f->set_null();
+        break;
+      case 8: /* PROCESSLIST_TIME */
+        if (m_row.m_start_time)
+          set_field_ulonglong(f, my_time(0) - m_row.m_start_time);
+        else
+          f->set_null();
+        break;
+      case 9: /* PROCESSLIST_STATE */
+        if (m_row.m_processlist_state_length > 0)
+          set_field_varchar_utf8(f, m_row.m_processlist_state_ptr,
+                                 m_row.m_processlist_state_length);
+        else
+          f->set_null();
+        break;
+      case 10: /* PROCESSLIST_INFO */
+        if (m_row.m_processlist_info_length > 0)
+          set_field_longtext_utf8(f, m_row.m_processlist_info_ptr,
+                                  m_row.m_processlist_info_length);
+        else
+          f->set_null();
+        break;
+      case 11: /* PARENT_THREAD_ID */
+        f->set_null();
+        break;
+      case 12: /* ROLE */
+        f->set_null();
+        break;
+      case 13: /* INSTRUMENTED */
+        set_field_enum(f, (*m_row.m_enabled_ptr) ? ENUM_YES : ENUM_NO);
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+  return 0;
+}
+
+int table_threads::update_row_values(TABLE *table,
+                                     const unsigned char *old_buf,
+                                     unsigned char *new_buf,
+                                     Field **fields)
+{
+  Field *f;
+  enum_yes_no value;
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (bitmap_is_set(table->write_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* THREAD_ID */
+      case 1: /* NAME */
+      case 2: /* TYPE */
+      case 3: /* PROCESSLIST_ID */
+      case 4: /* PROCESSLIST_USER */
+      case 5: /* PROCESSLIST_HOST */
+      case 6: /* PROCESSLIST_DB */
+      case 7: /* PROCESSLIST_COMMAND */
+      case 8: /* PROCESSLIST_TIME */
+      case 9: /* PROCESSLIST_STATE */
+      case 10: /* PROCESSLIST_INFO */
+      case 11: /* PARENT_THREAD_ID */
+      case 12: /* ROLE */
+        my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
+        return HA_ERR_WRONG_COMMAND;
+      case 13: /* INSTRUMENTED */
+        value= (enum_yes_no) get_field_enum(f);
+        *m_row.m_enabled_ptr= (value == ENUM_YES) ? true : false;
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+  return 0;
+}
+

=== added file 'storage/perfschema/table_threads.h'
--- a/storage/perfschema/table_threads.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_threads.h	2010-05-11 10:36:37 +0000
@@ -0,0 +1,109 @@
+/* Copyright (c) 2008, 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 */
+
+#ifndef TABLE_THREADS_H
+#define TABLE_THREADS_H
+
+#include "pfs_column_types.h"
+#include "pfs_engine_table.h"
+
+struct PFS_thread;
+
+/**
+  \addtogroup Performance_schema_tables
+  @{
+*/
+
+/**
+  A row of PERFORMANCE_SCHEMA.THREADS.
+*/
+struct row_threads
+{
+  /** Column THREAD_ID. */
+  ulong m_thread_internal_id;
+  /** Column ID. */
+  ulong m_thread_id;
+  /** Column NAME. */
+  const char* m_name;
+  /** Length in bytes of @c m_name. */
+  uint m_name_length;
+
+  char m_username[USERNAME_LENGTH];
+  uint m_username_length;
+  char m_hostname[HOSTNAME_LENGTH];
+  uint m_hostname_length;
+  char m_dbname[NAME_LEN];
+  uint m_dbname_length;
+  int m_command;
+  time_t m_start_time;
+  const char* m_processlist_state_ptr;
+  uint m_processlist_state_length;
+  const char* m_processlist_info_ptr;
+  uint m_processlist_info_length;
+  bool *m_enabled_ptr;
+};
+
+/** Table PERFORMANCE_SCHEMA.THREADS. */
+class table_threads : public PFS_engine_table
+{
+public:
+  /** Table share */
+  static PFS_engine_table_share m_share;
+  /** Table builder */
+  static PFS_engine_table* create();
+
+  virtual int rnd_next();
+  virtual int rnd_pos(const void *pos);
+  virtual void reset_position(void);
+
+protected:
+  virtual int read_row_values(TABLE *table,
+                              unsigned char *buf,
+                              Field **fields,
+                              bool read_all);
+
+
+  virtual int update_row_values(TABLE *table,
+                                const unsigned char *old_buf,
+                                unsigned char *new_buf,
+                                Field **fields);
+
+protected:
+  table_threads();
+
+public:
+  ~table_threads()
+  {}
+
+private:
+  void make_row(PFS_thread *pfs);
+
+  /** Table share lock. */
+  static THR_LOCK m_table_lock;
+  /** Fields definition. */
+  static TABLE_FIELD_DEF m_field_def;
+
+  /** Current row. */
+  row_threads m_row;
+  /** True is the current row exists. */
+  bool m_row_exists;
+  /** Current position. */
+  PFS_simple_index m_pos;
+  /** Next position. */
+  PFS_simple_index m_next_pos;
+};
+
+/** @} */
+#endif


Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100511103637-wi6m5b5kvcy3dnrp.bundle
Thread
bzr push into mysql-next-mr branch (marc.alff:3142 to 3143) WL#4674Marc Alff11 May