3272 Marc Alff 2010-06-28 [merge]
local merge
removed:
mysql-test/suite/manual/
mysql-test/suite/manual/r/
mysql-test/suite/manual/r/rpl_replication_delay.result
mysql-test/suite/manual/t/
mysql-test/suite/manual/t/rpl_replication_delay-slave.opt
mysql-test/suite/manual/t/rpl_replication_delay.test
sql/sql_repl.cc
sql/sql_repl.h
added:
mysql-test/collections/mysql-next-mr-rpl-merge.push
mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
mysql-test/include/save_master_pos.inc
mysql-test/include/show_delayed_slave_state.inc
mysql-test/include/show_slave_hosts.inc
mysql-test/include/sync_with_master.inc
mysql-test/r/server_uuid.result
mysql-test/std_data/old-format-relay-log-win.info
mysql-test/std_data/old-format-relay-log.info
mysql-test/suite/rpl/extension/
mysql-test/suite/rpl/extension/README
mysql-test/suite/rpl/extension/README.bhs
mysql-test/suite/rpl/extension/bhs/
mysql-test/suite/rpl/extension/bhs.pl
mysql-test/suite/rpl/extension/bhs/default.rules
mysql-test/suite/rpl/extension/bhs/disabled.def
mysql-test/suite/rpl/extension/bhs/master-slave-bhs.inc
mysql-test/suite/rpl/extension/bhs/master-slave.inc
mysql-test/suite/rpl/extension/bhs/my.cnf
mysql-test/suite/rpl/extension/bhs/rpl_1slave_base.cnf
mysql-test/suite/rpl/extension/bhs/update_test_cases
mysql-test/suite/rpl/r/rpl_delayed_slave.result
mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
mysql-test/suite/rpl/r/rpl_row_event_max_size.result
mysql-test/suite/rpl/r/rpl_savepoint.result
mysql-test/suite/rpl/r/rpl_seconds_behind_master.result
mysql-test/suite/rpl/r/rpl_server_uuid.result
mysql-test/suite/rpl/t/rpl_delayed_slave.test
mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
mysql-test/suite/rpl/t/rpl_row_event_max_size-master.opt
mysql-test/suite/rpl/t/rpl_row_event_max_size-slave.opt
mysql-test/suite/rpl/t/rpl_row_event_max_size.test
mysql-test/suite/rpl/t/rpl_savepoint.test
mysql-test/suite/rpl/t/rpl_seconds_behind_master.test
mysql-test/suite/rpl/t/rpl_server_uuid.cnf
mysql-test/suite/rpl/t/rpl_server_uuid.test
mysql-test/suite/sys_vars/r/server_uuid_basic.result
mysql-test/suite/sys_vars/t/server_uuid_basic.test
mysql-test/t/server_uuid.test
sql/binlog.cc
sql/binlog.h
sql/rpl_master.cc
sql/rpl_master.h
renamed:
sql/slave.cc => sql/rpl_slave.cc
sql/slave.h => sql/rpl_slave.h
modified:
BUILD-CMAKE
CMakeLists.txt
client/client_priv.h
client/mysqlbinlog.cc
client/mysqltest.cc
cmake/os/Windows.cmake
cmake/os/WindowsCache.cmake
cmake/package_name.cmake
libmysqld/CMakeLists.txt
libmysqld/Makefile.am
mysql-test/collections/default.experimental
mysql-test/include/mtr_warnings.sql
mysql-test/include/sync_slave_io_with_master.inc
mysql-test/include/wait_for_slave_sql_error.inc
mysql-test/mysql-test-run.pl
mysql-test/r/merge.result
mysql-test/suite/binlog/r/binlog_unsafe.result
mysql-test/suite/engines/funcs/r/rpl_000015.result
mysql-test/suite/engines/funcs/t/rpl_000015.test
mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result
mysql-test/suite/rpl/r/rpl_show_slave_hosts.result
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
mysql-test/suite/rpl/t/rpl_show_slave_hosts.test
mysql-test/suite/rpl/t/rpl_show_slave_running.test
mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
mysql-test/t/merge.test
mysql-test/t/sp_trans_log.test
mysys/default.c
mysys/my_delete.c
mysys/my_mmap.c
packaging/WiX/CMakeLists.txt
packaging/WiX/CPackWixConfig.cmake
packaging/WiX/ca/CMakeLists.txt
packaging/WiX/create_msi.cmake.in
packaging/WiX/mysql_server.wxs.in
sql/CMakeLists.txt
sql/Makefile.am
sql/field.cc
sql/ha_ndbcluster_binlog.cc
sql/ha_partition.cc
sql/item_func.cc
sql/item_strfunc.h
sql/lex.h
sql/log.cc
sql/log.h
sql/log_event.cc
sql/log_event.h
sql/log_event_old.cc
sql/mysqld.cc
sql/mysqld.h
sql/repl_failsafe.cc
sql/repl_failsafe.h
sql/rpl_handler.cc
sql/rpl_injector.cc
sql/rpl_mi.cc
sql/rpl_mi.h
sql/rpl_record.cc
sql/rpl_rli.cc
sql/rpl_rli.h
sql/set_var.h
sql/share/errmsg-utf8.txt
sql/sql_binlog.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_db.cc
sql/sql_insert.cc
sql/sql_lex.cc
sql/sql_lex.h
sql/sql_load.cc
sql/sql_parse.cc
sql/sql_parse.h
sql/sql_select.cc
sql/sql_servers.h
sql/sql_table.cc
sql/sql_yacc.yy
sql/structs.h
sql/sys_vars.cc
sql/transaction.cc
storage/heap/CMakeLists.txt
storage/myisam/mi_check.c
storage/myisammrg/ha_myisammrg.cc
sql/rpl_slave.cc
sql/rpl_slave.h
=== added file 'mysql-test/suite/perfschema/r/thread_cache.result'
--- a/mysql-test/suite/perfschema/r/thread_cache.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/thread_cache.result 2010-06-25 07:56:10 +0000
@@ -0,0 +1,34 @@
+SET @saved_thread_cache_size = @@global.thread_cache_size;
+set global thread_cache_size = 0;
+show variables like "thread_cache_size";
+Variable_name Value
+thread_cache_size 0
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+set global thread_cache_size = 100;
+show variables like "thread_cache_size";
+Variable_name Value
+thread_cache_size 100
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+set global thread_cache_size = @saved_thread_cache_size;
=== added file 'mysql-test/suite/perfschema/t/thread_cache.test'
--- a/mysql-test/suite/perfschema/t/thread_cache.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/thread_cache.test 2010-06-25 07:56:10 +0000
@@ -0,0 +1,134 @@
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+# Setup
+
+SET @saved_thread_cache_size = @@global.thread_cache_size;
+
+set global thread_cache_size = 0;
+
+show variables like "thread_cache_size";
+
+connect (con1, localhost, root, , );
+
+let $con1_ID=`select connection_id()`;
+
+let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+ where ID = connection_id()`;
+
+connect (con2, localhost, root, , );
+
+let $con2_ID=`select connection_id()`;
+
+let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+ where ID = connection_id()`;
+
+connection default;
+
+--disable_query_log
+eval select ($con2_ID - $con1_ID) into @id_increment;
+eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+# Expect 1, connection_id() is incremented for each new connection
+select @id_increment;
+# Expect 1, THREAD_ID is incremented for each new connection
+select @thread_id_increment;
+
+disconnect con2;
+
+connect (con3, localhost, root, , );
+
+let $con3_ID=`select connection_id()`;
+
+let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+ where ID = connection_id()`;
+
+disconnect con3;
+disconnect con1;
+
+connection default;
+
+--disable_query_log
+eval select ($con3_ID - $con2_ID) into @id_increment;
+eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+select @id_increment;
+select @thread_id_increment;
+
+set global thread_cache_size = 100;
+
+show variables like "thread_cache_size";
+
+connect (con1, localhost, root, , );
+
+let $con1_ID=`select connection_id()`;
+
+let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+ where ID = connection_id()`;
+
+connect (con2, localhost, root, , );
+
+let $con2_ID=`select connection_id()`;
+
+let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+ where ID = connection_id()`;
+
+connection default;
+
+--disable_query_log
+eval select ($con2_ID - $con1_ID) into @id_increment;
+eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+select @id_increment;
+select @thread_id_increment;
+
+disconnect con2;
+
+connect (con3, localhost, root, , );
+
+let $con3_ID=`select connection_id()`;
+
+let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+ where ID = connection_id()`;
+
+disconnect con3;
+disconnect con1;
+
+connection default;
+
+--disable_query_log
+eval select ($con3_ID - $con2_ID) into @id_increment;
+eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+# When caching threads, the pthread that executed con2 was parked in the
+# cache on disconnect, and then picked up con3.
+
+# Still expect a new connection_id()
+select @id_increment;
+
+# And expect a new instrumentation: the THREAD_ID of old connections should not be reused.
+select @thread_id_increment;
+
+set global thread_cache_size = @saved_thread_cache_size;
+
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-06-23 09:56:24 +0000
+++ b/sql/mysqld.cc 2010-06-28 23:45:29 +0000
@@ -2145,6 +2145,16 @@ static bool cache_thread()
/* Don't kill the thread, just put it in cache for reuse */
DBUG_PRINT("info", ("Adding thread to cache"));
cached_thread_count++;
+
+#ifdef HAVE_PSI_INTERFACE
+ /*
+ Delete the instrumentation for the job that just completed,
+ before parking this pthread in the cache (blocked on COND_thread_cache).
+ */
+ if (likely(PSI_server != NULL))
+ PSI_server->delete_current_thread();
+#endif
+
while (!abort_loop && ! wake_thread && ! kill_cached_threads)
mysql_cond_wait(&COND_thread_cache, &LOCK_thread_count);
cached_thread_count--;
@@ -2157,6 +2167,21 @@ static bool cache_thread()
thd= thread_cache.get();
thd->thread_stack= (char*) &thd; // For store_globals
(void) thd->store_globals();
+
+#ifdef HAVE_PSI_INTERFACE
+ /*
+ Create new instrumentation for the new THD job,
+ and attach it to this running pthread.
+ */
+ if (likely(PSI_server != NULL))
+ {
+ PSI_thread *psi= PSI_server->new_thread(key_thread_one_connection,
+ thd, thd->thread_id);
+ if (likely(psi != NULL))
+ PSI_server->set_thread(psi);
+ }
+#endif
+
/*
THD::mysys_var::abort is associated with physical thread rather
than with THD object. So we need to reset this flag before using
Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100628234529-wf71vl7kjuxkjioa.bundle
| Thread |
|---|
| • bzr push into mysql-next-mr-bugfixing branch (marc.alff:3272) | Marc Alff | 29 Jun |