MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:November 20 2009 8:30pm
Subject:bzr commit into mysql-5.6-next-mr branch (kostja:2928) Bug#17954
View as plain text  
#At file:///opt/local/work/next-mr-kostja/ based on revid:kostja@stripped

 2928 Konstantin Osipov	2009-11-20
      Backport of:
      ------------------------------------------------------------
      revno: 2572.23.1
      committer: davi@stripped/endora.local
      timestamp: Wed 2008-03-19 09:03:08 -0300
      message:
      Bug#17954 Threads_connected > Threads_created
      
      The problem is that insert delayed threads are counted as connected
      but not as created, leading to a Threads_connected value greater then
      the Threads_created value.
      
      The solution is to enforce the documented behavior that the
      Threads_connected value shall be the number of currently
      open connections and that Threads_created shall be the
      number of threads created to handle connections.
     @ mysql-test/r/status.result
        Add test case result for Bug#17954
     @ mysql-test/t/status.test
        Add test case for Bug#17954
     @ sql/mysqld.cc
        Change Threads_connected to reflect the number of
        open connections. SHOW_INT type variables are not
        reset.

    modified:
      mysql-test/r/status.result
      mysql-test/t/status.test
      sql/mysqld.cc
=== modified file 'mysql-test/r/status.result'
--- a/mysql-test/r/status.result	2009-06-10 08:58:36 +0000
+++ b/mysql-test/r/status.result	2009-11-20 20:30:00 +0000
@@ -238,5 +238,11 @@ SELECT 9;
 9
 DROP PROCEDURE p1;
 DROP FUNCTION f1;
+DROP VIEW IF EXISTS v1;
+CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
+SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
+NAME
+DROP VIEW v1;
 set @@global.concurrent_insert= @old_concurrent_insert;
 SET GLOBAL log_output = @old_log_output;

=== modified file 'mysql-test/t/status.test'
--- a/mysql-test/t/status.test	2009-06-10 08:58:36 +0000
+++ b/mysql-test/t/status.test	2009-11-20 20:30:00 +0000
@@ -353,6 +353,21 @@ DROP FUNCTION f1;
 
 # End of 5.1 tests
 
+#
+# Bug#17954 Threads_connected > Threads_created
+#
+
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+
+SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
+SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
+
+DROP VIEW v1;
+
 # Restore global concurrent_insert value. Keep in the end of the test file.
 --connection default
 set @@global.concurrent_insert= @old_concurrent_insert;

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-11-06 14:20:27 +0000
+++ b/sql/mysqld.cc	2009-11-20 20:30:00 +0000
@@ -2471,7 +2471,8 @@ and this may fail.\n\n");
   fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
   fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
   fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads);
-  fprintf(stderr, "threads_connected=%u\n", thread_count);
+  fprintf(stderr, "thread_count=%u\n", thread_count);
+  fprintf(stderr, "connection_count=%u\n", connection_count);
   fprintf(stderr, "It is possible that mysqld could use up to \n\
 key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = %lu K\n\
 bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size +
@@ -7624,7 +7625,7 @@ SHOW_VAR status_vars[]= {
   {"Tc_log_page_waits",        (char*) &tc_log_page_waits,      SHOW_LONG},
 #endif
   {"Threads_cached",           (char*) &cached_thread_count,    SHOW_LONG_NOFLUSH},
-  {"Threads_connected",        (char*) &thread_count,           SHOW_INT},
+  {"Threads_connected",        (char*) &connection_count,       SHOW_INT},
   {"Threads_created",	       (char*) &thread_created,		SHOW_LONG_NOFLUSH},
   {"Threads_running",          (char*) &thread_running,         SHOW_INT},
   {"Uptime",                   (char*) &show_starttime,         SHOW_FUNC},


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20091120203000-lky3jqo7r35s24ps.bundle
Thread
bzr commit into mysql-5.6-next-mr branch (kostja:2928) Bug#17954Konstantin Osipov20 Nov