]> git.pld-linux.org Git - packages/mysql.git/blobdiff - userstat.patch
report slave status with service mysql status
[packages/mysql.git] / userstat.patch
index 722a27a7a6dca9a4cb7c40c444c9b04c83737010..5c2265a140e64ac67e3dd2181de6e1abcc64864a 100644 (file)
@@ -5,10 +5,9 @@
 #!!! notice !!!
 # Any small change to this file in the main branch
 # should be done or reviewed by the maintainer!
-diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h
---- a/include/mysql/plugin.h   2010-12-03 20:58:24.000000000 +0300
-+++ b/include/mysql/plugin.h   2010-12-31 06:06:43.000000000 +0300
-@@ -547,6 +547,9 @@
+--- a/include/mysql/plugin.h
++++ b/include/mysql/plugin.h
+@@ -556,6 +556,9 @@
  unsigned long thd_log_slow_verbosity(const MYSQL_THD thd);
  int thd_opt_slow_log();
  #define EXTENDED_SLOWLOG
@@ -18,9 +17,8 @@ diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h
  /**
    Create a temporary file.
  
-diff -ruN a/include/mysql_com.h b/include/mysql_com.h
---- a/include/mysql_com.h      2010-12-03 20:58:24.000000000 +0300
-+++ b/include/mysql_com.h      2010-12-31 06:12:05.000000000 +0300
+--- a/include/mysql_com.h
++++ b/include/mysql_com.h
 @@ -31,6 +31,7 @@
  
  #define SERVER_VERSION_LENGTH 60
@@ -29,7 +27,7 @@ diff -ruN a/include/mysql_com.h b/include/mysql_com.h
  
  /*
    Maximum length of comments
-@@ -142,6 +143,11 @@
+@@ -146,6 +147,11 @@
  #define REFRESH_DES_KEY_FILE       0x40000L
  #define REFRESH_USER_RESOURCES             0x80000L
  #define REFRESH_QUERY_RESPONSE_TIME 0x100000L /* response time distibution */
@@ -41,10 +39,9 @@ diff -ruN a/include/mysql_com.h b/include/mysql_com.h
  
  #define CLIENT_LONG_PASSWORD  1       /* new more secure passwords */
  #define CLIENT_FOUND_ROWS     2       /* Found instead of affected rows */
-diff -ruN a/patch_info/userstats.patch b/patch_info/userstats.patch
---- a/patch_info/userstats.patch       1970-01-01 03:00:00.000000000 +0300
-+++ b/patch_info/userstats.patch       2010-12-30 00:45:46.000000000 +0300
-@@ -0,0 +1,15 @@
+--- /dev/null
++++ b/patch_info/userstats.patch
+@@ -0,0 +1,17 @@
 +File=userstats.patch
 +Name=SHOW USER/TABLE/INDEX statistics
 +Version=V2
@@ -55,15 +52,16 @@ diff -ruN a/patch_info/userstats.patch b/patch_info/userstats.patch
 +YK: fix behavior for prepared statements
 +
 +2008-11-26
-+YK: add switch variable "userstat_running" to control INFORMATION_SCHEMA.*_STATISTICS (default:OFF)
++YK: add switch variable "userstat" to control INFORMATION_SCHEMA.*_STATISTICS (default:OFF)
 +2010-12-31
 +Ported to 5.5.8
 +2011-1-5
 +Fix porting
-diff -ruN a/sql/handler.cc b/sql/handler.cc
---- a/sql/handler.cc   2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/handler.cc   2010-12-30 00:59:23.000000000 +0300
-@@ -1243,6 +1243,8 @@
++2011-02
++Rename variable USERSTAT_RUNNING => USERSTAT
+--- a/sql/handler.cc
++++ b/sql/handler.cc
+@@ -1245,6 +1245,8 @@
          goto end;
        }
      DBUG_EXECUTE_IF("crash_commit_after", DBUG_SUICIDE(););
@@ -72,7 +70,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc
      RUN_HOOK(transaction, after_commit, (thd, FALSE));
  end:
      if (rw_trans && mdl_request.ticket)
-@@ -1397,6 +1399,8 @@
+@@ -1399,6 +1401,8 @@
    /* Always cleanup. Even if nht==0. There may be savepoints. */
    if (is_real_trans)
      thd->transaction.cleanup();
@@ -81,7 +79,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc
    if (all)
      thd->transaction_rollback_request= FALSE;
  
-@@ -1800,6 +1804,7 @@
+@@ -1803,6 +1807,7 @@
      ha_info->reset(); /* keep it conveniently zero-filled */
    }
    trans->ha_list= sv->ha_list;
@@ -89,7 +87,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc
    DBUG_RETURN(error);
  }
  
-@@ -2169,6 +2174,8 @@
+@@ -2179,6 +2184,8 @@
        dup_ref=ref+ALIGN_SIZE(ref_length);
      cached_table_flags= table_flags();
    }
@@ -98,14 +96,14 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc
    DBUG_RETURN(error);
  }
  
-@@ -3614,6 +3621,127 @@
+@@ -3644,6 +3651,127 @@
    return;
  }
  
 +// Updates the global table stats with the TABLE this handler represents.
 +void handler::update_global_table_stats()
 +{
-+  if (!opt_userstat_running)
++  if (!opt_userstat)
 +  {
 +    rows_read= rows_changed= 0;
 +    return;
@@ -167,7 +165,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc
 +  if (!table->s || !table->s->table_cache_key.str || !table->s->table_name.str)
 +    return;
 +
-+  if (!opt_userstat_running)
++  if (!opt_userstat)
 +  {
 +    for (uint x= 0; x < table->s->keys; ++x)
 +    {
@@ -226,10 +224,9 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc
  
  /****************************************************************************
  ** Some general functions that isn't in the handler class
-diff -ruN a/sql/handler.h b/sql/handler.h
---- a/sql/handler.h    2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/handler.h    2010-12-31 05:10:00.000000000 +0300
-@@ -33,6 +33,10 @@
+--- a/sql/handler.h
++++ b/sql/handler.h
+@@ -36,6 +36,10 @@
  #include <ft_global.h>
  #include <keycache.h>
  
@@ -240,7 +237,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
  // the following is for checking tables
  
  #define HA_ADMIN_ALREADY_DONE   1
-@@ -561,10 +565,12 @@
+@@ -562,10 +566,12 @@
  enum enum_schema_tables
  {
    SCH_CHARSETS= 0,
@@ -253,7 +250,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    SCH_ENGINES,
    SCH_EVENTS,
    SCH_FILES,
-@@ -592,9 +598,12 @@
+@@ -593,9 +599,12 @@
    SCH_TABLE_CONSTRAINTS,
    SCH_TABLE_NAMES,
    SCH_TABLE_PRIVILEGES,
@@ -266,7 +263,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    SCH_VARIABLES,
    SCH_VIEWS
  };
-@@ -1209,6 +1218,9 @@
+@@ -1233,6 +1242,9 @@
    bool locked;
    bool implicit_emptied;                /* Can be !=0 only if HEAP */
    const COND *pushed_cond;
@@ -276,7 +273,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    /**
      next_insert_id is the next value which should be inserted into the
      auto_increment column: in a inserting-multi-row statement (like INSERT
-@@ -1260,10 +1272,12 @@
+@@ -1284,10 +1296,12 @@
      ref_length(sizeof(my_off_t)),
      ft_handler(0), inited(NONE),
      locked(FALSE), implicit_emptied(0),
@@ -291,7 +288,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    virtual ~handler(void)
    {
      DBUG_ASSERT(locked == FALSE);
-@@ -1386,6 +1400,8 @@
+@@ -1410,6 +1424,8 @@
    {
      table= table_arg;
      table_share= share;
@@ -300,7 +297,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    }
    virtual double scan_time()
    { return ulonglong2double(stats.data_file_length) / IO_SIZE + 2; }
-@@ -1753,6 +1769,8 @@
+@@ -1805,6 +1821,8 @@
    virtual bool is_crashed() const  { return 0; }
    virtual bool auto_repair() const { return 0; }
  
@@ -309,9 +306,8 @@ diff -ruN a/sql/handler.h b/sql/handler.h
  
  #define CHF_CREATE_FLAG 0
  #define CHF_DELETE_FLAG 1
-diff -ruN a/sql/lex.h b/sql/lex.h
---- a/sql/lex.h        2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/lex.h        2010-12-30 01:25:40.000000000 +0300
+--- a/sql/lex.h
++++ b/sql/lex.h
 @@ -111,6 +111,7 @@
    { "CIPHER",         SYM(CIPHER_SYM)},
    { "CLASS_ORIGIN",     SYM(CLASS_ORIGIN_SYM)},
@@ -351,9 +347,8 @@ diff -ruN a/sql/lex.h b/sql/lex.h
    { "USE_FRM",                SYM(USE_FRM)},
    { "USING",          SYM(USING)},
    { "UTC_DATE",         SYM(UTC_DATE_SYM)},
-diff -ruN a/sql/log.cc b/sql/log.cc
---- a/sql/log.cc       2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/log.cc       2010-12-30 01:55:35.000000000 +0300
+--- a/sql/log.cc
++++ b/sql/log.cc
 @@ -1007,6 +1007,13 @@
      mysql_slow_log.reopen_file();
  }
@@ -368,7 +363,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
  /*
    Log error with all enabled log event handlers
  
-@@ -5041,6 +5048,8 @@
+@@ -5062,6 +5069,8 @@
                               thd->first_successful_insert_id_in_prev_stmt_for_binlog);
            if (e.write(file))
              goto err;
@@ -377,7 +372,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
          }
          if (thd->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0)
          {
-@@ -5052,12 +5061,16 @@
+@@ -5073,12 +5082,16 @@
                               minimum());
            if (e.write(file))
              goto err;
@@ -394,7 +389,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
          }
          if (thd->user_var_events.elements)
          {
-@@ -5080,6 +5093,8 @@
+@@ -5101,6 +5114,8 @@
                                   flags);
              if (e.write(file))
                goto err;
@@ -403,7 +398,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
            }
          }
        }
-@@ -5091,6 +5106,8 @@
+@@ -5112,6 +5127,8 @@
      if (event_info->write(file) ||
          DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0))
        goto err;
@@ -412,7 +407,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
  
      error= 0;
  err:
-@@ -5276,7 +5293,8 @@
+@@ -5346,7 +5363,8 @@
      be reset as a READ_CACHE to be able to read the contents from it.
   */
  
@@ -422,7 +417,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
  {
    Mutex_sentry sentry(lock_log ? &LOCK_log : NULL);
  
-@@ -5323,6 +5341,7 @@
+@@ -5393,6 +5411,7 @@
        /* write the first half of the split header */
        if (my_b_write(&log_file, header, carry))
          return ER_ERROR_ON_WRITE;
@@ -430,7 +425,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
  
        /*
          copy fixed second half of header to cache so the correct
-@@ -5391,6 +5410,7 @@
+@@ -5461,6 +5480,7 @@
      /* Write data to the binary log file */
      if (my_b_write(&log_file, cache->read_pos, length))
        return ER_ERROR_ON_WRITE;
@@ -438,7 +433,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
      cache->read_pos=cache->read_end;          // Mark buffer used up
    } while ((length= my_b_fill(cache)));
  
-@@ -5505,20 +5525,23 @@
+@@ -5584,20 +5604,23 @@
        Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE, TRUE, 0);
        if (qinfo.write(&log_file))
          goto err;
@@ -464,10 +459,9 @@ diff -ruN a/sql/log.cc b/sql/log.cc
  
        if (incident && write_incident(thd, FALSE))
          goto err;
-diff -ruN a/sql/log.h b/sql/log.h
---- a/sql/log.h        2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/log.h        2010-12-30 01:56:04.000000000 +0300
-@@ -414,7 +414,8 @@
+--- a/sql/log.h
++++ b/sql/log.h
+@@ -437,7 +437,8 @@
    bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
    bool write_incident(THD *thd, bool lock);
  
@@ -477,7 +471,7 @@ diff -ruN a/sql/log.h b/sql/log.h
    void set_write_error(THD *thd, bool is_transactional);
    bool check_write_error(THD *thd);
  
-@@ -566,6 +567,7 @@
+@@ -591,6 +592,7 @@
                             const char *sql_text, uint sql_text_len,
                             CHARSET_INFO *client_cs);
    void flush();
@@ -485,18 +479,17 @@ diff -ruN a/sql/log.h b/sql/log.h
    void init_pthread_objects();
    MYSQL_QUERY_LOG *get_mysql_slow_log() { return &mysql_slow_log; }
    MYSQL_QUERY_LOG *get_mysql_log() { return &mysql_log; }
-diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
---- a/sql/mysqld.cc    2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/mysqld.cc    2010-12-30 02:04:50.000000000 +0300
-@@ -438,6 +438,7 @@
- uint    opt_debug_sync_timeout= 0;
+--- a/sql/mysqld.cc
++++ b/sql/mysqld.cc
+@@ -445,6 +445,7 @@
+ MYSQL_PLUGIN_IMPORT uint    opt_debug_sync_timeout= 0;
  #endif /* defined(ENABLED_DEBUG_SYNC) */
  my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
-+my_bool opt_userstat_running= 0, opt_thread_statistics= 0;
++my_bool opt_userstat= 0, opt_thread_statistics= 0;
  my_bool opt_optimizer_fix= 0;
  /*
    True if there is at least one per-hour limit for some user, so we should
-@@ -489,6 +490,7 @@
+@@ -496,6 +497,7 @@
  ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
  ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
  ulong max_connections, max_connect_errors;
@@ -504,7 +497,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  
  /* flashcache */
  int cachedev_fd;
-@@ -633,7 +635,9 @@
+@@ -645,7 +647,9 @@
    LOCK_crypt,
    LOCK_global_system_variables,
    LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
@@ -515,7 +508,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  /**
    The below lock protects access to two global server variables:
    max_prepared_stmt_count and prepared_stmt_count. These variables
-@@ -1493,6 +1497,11 @@
+@@ -1509,6 +1513,11 @@
  #ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
    query_response_time_free();
  #endif // HAVE_RESPONSE_TIME_DISTRIBUTION
@@ -527,7 +520,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  #ifdef HAVE_REPLICATION
    end_slave_list();
  #endif
-@@ -1596,6 +1605,10 @@
+@@ -1612,6 +1621,10 @@
    mysql_cond_destroy(&COND_thread_cache);
    mysql_cond_destroy(&COND_flush_thread_cache);
    mysql_cond_destroy(&COND_manager);
@@ -538,7 +531,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  }
  #endif /*EMBEDDED_LIBRARY*/
  
-@@ -3019,6 +3032,7 @@
+@@ -2938,6 +2951,7 @@
    {"show_binlog_events",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS},
    {"show_binlogs",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
    {"show_charsets",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS},
@@ -546,15 +539,15 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    {"show_collations",      (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS},
    {"show_contributors",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CONTRIBUTORS]), SHOW_LONG_STATUS},
    {"show_create_db",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS},
-@@ -3039,6 +3053,7 @@
+@@ -2958,6 +2972,7 @@
  #endif
    {"show_function_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS_FUNC]), SHOW_LONG_STATUS},
    {"show_grants",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_GRANTS]), SHOW_LONG_STATUS},
 +  {"show_index_statistics",(char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_INDEX_STATS]), SHOW_LONG_STATUS},
    {"show_keys",            (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
    {"show_master_status",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
-   {"show_new_master",      (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_NEW_MASTER]), SHOW_LONG_STATUS},
-@@ -3058,10 +3073,13 @@
+   {"show_open_tables",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
+@@ -2976,10 +2991,13 @@
    {"show_slave_status_nolock", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_NOLOCK_STAT]), SHOW_LONG_STATUS},
    {"show_status",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
    {"show_storage_engines", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STORAGE_ENGINES]), SHOW_LONG_STATUS},
@@ -568,7 +561,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    {"show_variables",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
    {"show_warnings",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
    {"slave_start",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
-@@ -3582,6 +3600,13 @@
+@@ -3517,6 +3535,13 @@
    mysql_mutex_init(key_LOCK_server_started,
                     &LOCK_server_started, MY_MUTEX_INIT_FAST);
    mysql_cond_init(key_COND_server_started, &COND_server_started, NULL);
@@ -582,7 +575,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    sp_cache_init();
  #ifdef HAVE_EVENT_SCHEDULER
    Events::init_mutexes();
-@@ -3951,6 +3976,9 @@
+@@ -3886,6 +3911,9 @@
    query_response_time_init();
  #endif // HAVE_RESPONSE_TIME_DISTRIBUTION
    /* We have to initialize the storage engines before CSV logging */
@@ -592,7 +585,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    if (ha_init())
    {
      sql_print_error("Can't init databases");
-@@ -4087,6 +4115,9 @@
+@@ -4022,6 +4050,9 @@
  
    init_max_user_conn();
    init_update_queries();
@@ -602,7 +595,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    DBUG_RETURN(0);
  }
  
-@@ -5118,6 +5149,7 @@
+@@ -5087,6 +5118,7 @@
      {
        sql_print_warning("%s", ER_DEFAULT(ER_CON_COUNT_ERROR));
      }
@@ -610,7 +603,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
      delete thd;
      DBUG_VOID_RETURN;
    }
-@@ -7817,6 +7849,8 @@
+@@ -7825,6 +7857,8 @@
    key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
    key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
    key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
@@ -619,7 +612,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    key_LOCK_gdl, key_LOCK_global_system_variables,
    key_LOCK_manager,
    key_LOCK_prepared_stmt_count,
-@@ -7854,6 +7888,13 @@
+@@ -7864,6 +7898,13 @@
    { &key_LOCK_delayed_insert, "LOCK_delayed_insert", PSI_FLAG_GLOBAL},
    { &key_LOCK_delayed_status, "LOCK_delayed_status", PSI_FLAG_GLOBAL},
    { &key_LOCK_error_log, "LOCK_error_log", PSI_FLAG_GLOBAL},
@@ -633,9 +626,8 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    { &key_LOCK_gdl, "LOCK_gdl", PSI_FLAG_GLOBAL},
    { &key_LOCK_global_system_variables, "LOCK_global_system_variables", PSI_FLAG_GLOBAL},
    { &key_LOCK_manager, "LOCK_manager", PSI_FLAG_GLOBAL},
-diff -ruN a/sql/mysqld.h b/sql/mysqld.h
---- a/sql/mysqld.h     2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/mysqld.h     2010-12-31 06:04:59.000000000 +0300
+--- a/sql/mysqld.h
++++ b/sql/mysqld.h
 @@ -23,6 +23,7 @@
  #include "my_atomic.h"                     /* my_atomic_rwlock_t */
  #include "mysql/psi/mysql_file.h"          /* MYSQL_FILE */
@@ -648,11 +640,11 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
  extern ulonglong slave_type_conversions_options;
  extern my_bool read_only, opt_readonly;
  extern my_bool lower_case_file_system;
-+extern my_bool opt_userstat_running, opt_thread_statistics;
++extern my_bool opt_userstat, opt_thread_statistics;
  extern my_bool opt_optimizer_fix;
  extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
  extern my_bool opt_secure_auth;
-@@ -181,6 +183,7 @@
+@@ -183,6 +185,7 @@
  extern ulong slave_trans_retries;
  extern uint  slave_net_timeout;
  extern uint max_user_connections;
@@ -660,7 +652,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
  extern ulong what_to_log,flush_time;
  extern ulong max_prepared_stmt_count, prepared_stmt_count;
  extern ulong open_files_limit;
-@@ -207,6 +210,11 @@
+@@ -210,6 +213,11 @@
  extern struct system_variables max_system_variables;
  extern struct system_status_var global_status_var;
  extern struct rand_struct sql_rand;
@@ -672,7 +664,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
  extern const char *opt_date_time_formats[];
  extern handlerton *partition_hton;
  extern handlerton *myisam_hton;
-@@ -244,6 +252,8 @@
+@@ -252,6 +260,8 @@
    key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
    key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
    key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
@@ -681,7 +673,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
    key_LOCK_gdl, key_LOCK_global_system_variables,
    key_LOCK_logger, key_LOCK_manager,
    key_LOCK_prepared_stmt_count,
-@@ -340,7 +350,9 @@
+@@ -351,7 +361,9 @@
         LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
         LOCK_slave_list, LOCK_active_mi, LOCK_manager,
         LOCK_global_system_variables, LOCK_user_conn,
@@ -692,7 +684,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
  extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
  #ifdef HAVE_OPENSSL
  extern mysql_mutex_t LOCK_des_key_file;
-@@ -452,6 +464,16 @@
+@@ -463,6 +475,16 @@
    return id;
  }
  
@@ -709,10 +701,9 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
  
  /*
    TODO: Replace this with an inline function.
-diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc
---- a/sql/sql_base.cc  2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_base.cc  2010-12-30 02:33:17.000000000 +0300
-@@ -1524,6 +1524,11 @@
+--- a/sql/sql_base.cc
++++ b/sql/sql_base.cc
+@@ -1587,6 +1587,11 @@
    table->mdl_ticket= NULL;
  
    mysql_mutex_lock(&thd->LOCK_thd_data);
@@ -724,7 +715,7 @@ diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc
    *table_ptr=table->next;
    mysql_mutex_unlock(&thd->LOCK_thd_data);
  
-@@ -2149,6 +2154,8 @@
+@@ -2225,6 +2230,8 @@
    DBUG_PRINT("tmptable", ("closing table: '%s'.'%s'",
                            table->s->db.str, table->s->table_name.str));
  
@@ -733,10 +724,9 @@ diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc
    free_io_cache(table);
    closefrm(table, 0);
    if (delete_table)
-diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
---- a/sql/sql_class.cc 2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_class.cc 2010-12-30 02:41:40.000000000 +0300
-@@ -601,6 +601,13 @@
+--- a/sql/sql_class.cc
++++ b/sql/sql_class.cc
+@@ -978,6 +978,13 @@
    mysys_var=0;
    binlog_evt_union.do_union= FALSE;
    enable_slow_log= 0;
@@ -750,7 +740,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  #ifndef DBUG_OFF
    dbug_sentry=THD_SENTRY_MAGIC;
  #endif
-@@ -981,6 +988,7 @@
+@@ -1357,6 +1364,7 @@
      variables.option_bits|= OPTION_BIN_LOG;
    else
      variables.option_bits&= ~OPTION_BIN_LOG;
@@ -758,8 +748,8 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
  #if defined(ENABLED_DEBUG_SYNC)
    /* Initialize the Debug Sync Facility. See debug_sync.cc. */
-@@ -988,6 +996,94 @@
- #endif /* defined(ENABLED_DEBUG_SYNC) */
+@@ -1366,6 +1374,94 @@
+   clear_slow_extended();
  }
  
 +// Resets stats in a THD.
@@ -795,7 +785,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
 +// Updates 'diff' stats of a THD.
 +void THD::update_stats(bool ran_command)
 +{
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +  diff_total_busy_time+=            busy_time;
 +  diff_total_cpu_time+=             cpu_time;
@@ -853,7 +843,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
  /*
    Init THD for query processing.
-@@ -1722,6 +1818,32 @@
+@@ -2125,6 +2221,32 @@
  }
  #endif
  
@@ -886,7 +876,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
  struct Item_change_record: public ilink
  {
-@@ -1898,6 +2020,7 @@
+@@ -2301,6 +2423,7 @@
    }
  
    thd->sent_row_count++;
@@ -894,7 +884,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
    if (thd->vio_ok())
      DBUG_RETURN(protocol->write());
-@@ -1990,6 +2113,7 @@
+@@ -2393,6 +2516,7 @@
  select_export::~select_export()
  {
    thd->sent_row_count=row_count;
@@ -902,7 +892,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  }
  
  
-@@ -3013,6 +3137,7 @@
+@@ -3416,6 +3540,7 @@
    if (likely(thd != 0))
    { /* current_thd==0 when close_connection() calls net_send_error() */
      thd->status_var.bytes_sent+= length;
@@ -910,7 +900,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
    }
  }
  
-@@ -3020,6 +3145,7 @@
+@@ -3423,6 +3548,7 @@
  void thd_increment_bytes_received(ulong length)
  {
    current_thd->status_var.bytes_received+= length;
@@ -918,10 +908,9 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  }
  
  
-diff -ruN a/sql/sql_class.h b/sql/sql_class.h
---- a/sql/sql_class.h  2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_class.h  2010-12-31 05:15:57.000000000 +0300
-@@ -1610,6 +1610,8 @@
+--- a/sql/sql_class.h
++++ b/sql/sql_class.h
+@@ -1705,6 +1705,8 @@
    */
    enum enum_server_command command;
    uint32     server_id;
@@ -930,7 +919,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
    uint32     file_id;                 // for LOAD DATA INFILE
    /* remote (peer) port */
    uint16 peer_port;
-@@ -2081,6 +2083,8 @@
+@@ -2214,6 +2216,8 @@
    */
    enum_tx_isolation tx_isolation;
    enum_check_fields count_cuted_fields;
@@ -939,7 +928,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
  
    DYNAMIC_ARRAY user_var_events;        /* For user variables replication */
    MEM_ROOT      *user_var_events_alloc; /* Allocate above array elements here */
-@@ -2176,6 +2180,49 @@
+@@ -2308,6 +2312,49 @@
    */
    LOG_INFO*  current_linfo;
    NET*       slave_net;                       // network connection from slave -> m.
@@ -989,7 +978,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
    /* Used by the sys_var class to store temporary values */
    union
    {
-@@ -2256,6 +2303,11 @@
+@@ -2388,6 +2435,11 @@
      alloc_root. 
    */
    void init_for_queries();
@@ -1001,7 +990,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
    void change_user(void);
    void cleanup(void);
    void cleanup_after_query();
-@@ -2727,6 +2779,15 @@
+@@ -2860,6 +2912,15 @@
    }
    thd_scheduler scheduler;
  
@@ -1017,7 +1006,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
  public:
    inline Internal_error_handler *get_internal_handler()
    { return m_internal_handler; }
-@@ -2914,6 +2975,10 @@
+@@ -3060,6 +3121,10 @@
    LEX_STRING invoker_host;
  };
  
@@ -1028,10 +1017,9 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
  
  /** A short cut for thd->stmt_da->set_ok_status(). */
  
-diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
---- a/sql/sql_connect.cc       2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_connect.cc       2010-12-31 03:53:28.000000000 +0300
-@@ -55,6 +55,24 @@
+--- a/sql/sql_connect.cc
++++ b/sql/sql_connect.cc
+@@ -56,6 +56,24 @@
  #define MIN_HANDSHAKE_SIZE      6
  #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
  
@@ -1056,7 +1044,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
  /*
    Get structure for logging connection data for the current user
  */
-@@ -112,6 +130,586 @@
+@@ -113,6 +131,586 @@
  
  }
  
@@ -1475,7 +1463,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
 +  const char* client_string= get_client_host(thd);
 +  int return_value=          0;
 +
-+  if (!opt_userstat_running)
++  if (!opt_userstat)
 +    return return_value;
 +
 +  if (use_lock)
@@ -1563,7 +1551,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
 +// Updates the global stats of a user or client
 +void update_global_user_stats(THD* thd, bool create_user, time_t now)
 +{
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +    char* user_string=         get_valid_user_string(thd->main_security_ctx.user);
 +    const char* client_string= get_client_host(thd);
@@ -1643,7 +1631,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
  
  /*
    check if user has already too many connections
-@@ -169,6 +767,7 @@
+@@ -170,6 +768,7 @@
    if (error)
    {
      uc->connections--; // no need for decrease_user_connections() here
@@ -1651,7 +1639,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
      /*
        The thread may returned back to the pool and assigned to a user
        that doesn't have a limit. Ensure the user is not using resources
-@@ -565,11 +1164,18 @@
+@@ -589,11 +1188,18 @@
        my_sleep(1000);                         /* must wait after eof() */
  #endif
      statistic_increment(aborted_connects,&LOCK_status);
@@ -1670,7 +1658,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
    DBUG_RETURN(0);
  }
  
-@@ -599,6 +1205,7 @@
+@@ -623,6 +1229,7 @@
    if (thd->killed || (net->error && net->vio != 0))
    {
      statistic_increment(aborted_threads,&LOCK_status);
@@ -1678,24 +1666,22 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
    }
  
    if (net->error && net->vio != 0)
-@@ -729,12 +1336,16 @@
+@@ -787,10 +1394,14 @@
+   for (;;)
    {
-     NET *net= &thd->net;
      bool rc;
 +    bool create_user= TRUE;
  
-     lex_start(thd);
-     rc= login_connection(thd);
-     MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT(thd);
+     rc= thd_prepare_connection(thd);
      if (rc)
 +    {
 +      create_user= FALSE;
        goto end_thread;
 +    }
  
-     MYSQL_CONNECTION_START(thd->thread_id, &thd->security_ctx->priv_user[0],
-                            (char *) thd->security_ctx->host_or_ip);
-@@ -761,6 +1372,8 @@
+     while (thd_is_connection_alive(thd))
+     {
+@@ -802,6 +1413,8 @@
     
  end_thread:
      close_connection(thd);
@@ -1704,9 +1690,8 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
      if (MYSQL_CALLBACK_ELSE(thread_scheduler, end_thread, (thd, 1), 0))
        return;                                 // Probably no-threads
  
-diff -ruN a/sql/sql_delete.cc b/sql/sql_delete.cc
---- a/sql/sql_delete.cc        2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_delete.cc        2010-12-31 03:58:22.000000000 +0300
+--- a/sql/sql_delete.cc
++++ b/sql/sql_delete.cc
 @@ -411,6 +411,7 @@
      my_ok(thd, deleted);
      DBUG_PRINT("info",("%ld records deleted",(long) deleted));
@@ -1723,10 +1708,9 @@ diff -ruN a/sql/sql_delete.cc b/sql/sql_delete.cc
    return 0;
  }
  
-diff -ruN a/sql/sql_insert.cc b/sql/sql_insert.cc
---- a/sql/sql_insert.cc        2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_insert.cc        2010-12-31 04:12:35.000000000 +0300
-@@ -1069,13 +1069,14 @@
+--- a/sql/sql_insert.cc
++++ b/sql/sql_insert.cc
+@@ -1072,13 +1072,14 @@
  
    if (error)
      goto abort;
@@ -1744,7 +1728,7 @@ diff -ruN a/sql/sql_insert.cc b/sql/sql_insert.cc
    }
    else
    {
-@@ -1091,8 +1092,10 @@
+@@ -1094,8 +1095,10 @@
        sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
              (ulong) (info.deleted + updated),
                (ulong) thd->warning_info->statement_warn_count());
@@ -1756,7 +1740,7 @@ diff -ruN a/sql/sql_insert.cc b/sql/sql_insert.cc
    thd->abort_on_warning= 0;
    DBUG_RETURN(FALSE);
  
-@@ -3539,6 +3542,7 @@
+@@ -3540,6 +3543,7 @@
       thd->first_successful_insert_id_in_prev_stmt :
       (info.copied ? autoinc_value_of_last_inserted_row : 0));
    ::my_ok(thd, row_count, id, buff);
@@ -1764,25 +1748,23 @@ diff -ruN a/sql/sql_insert.cc b/sql/sql_insert.cc
    DBUG_RETURN(0);
  }
  
-diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h
---- a/sql/sql_lex.h    2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_lex.h    2010-12-31 05:07:18.000000000 +0300
-@@ -196,6 +196,9 @@
-     When a command is added here, be sure it's also added in mysqld.cc
+--- a/sql/sql_lex.h
++++ b/sql/sql_lex.h
+@@ -197,6 +197,9 @@
      in "struct show_var_st status_vars[]= {" ...
    */
+   SQLCOM_SHOW_TEMPORARY_TABLES,
 +  // TODO(mcallaghan): update status_vars in mysqld to export these
 +  SQLCOM_SHOW_USER_STATS, SQLCOM_SHOW_TABLE_STATS, SQLCOM_SHOW_INDEX_STATS,
 +  SQLCOM_SHOW_CLIENT_STATS, SQLCOM_SHOW_THREAD_STATS,
    /* This should be the last !!! */
    SQLCOM_END
  };
-diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
---- a/sql/sql_parse.cc 2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_parse.cc 2010-12-31 04:57:45.000000000 +0300
-@@ -116,6 +116,9 @@
- static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
+--- a/sql/sql_parse.cc
++++ b/sql/sql_parse.cc
+@@ -117,6 +117,9 @@
  static void sql_kill(THD *thd, ulong id, bool only_kill_query);
+ static inline ulonglong get_query_exec_time(THD *thd, ulonglong cur_utime);
  
 +// Uses the THD to update the global stats by user name and client IP
 +void update_global_user_stats(THD* thd, bool create_user, time_t now);
@@ -1790,7 +1772,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
  const char *any_db="*any*";   // Special symbol for check_access
  
  const LEX_STRING command_name[]={
-@@ -701,6 +704,12 @@
+@@ -703,6 +706,12 @@
    */
    thd->clear_error();                         // Clear error message
    thd->stmt_da->reset_diagnostics_area();
@@ -1803,7 +1785,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
  
    net_new_transaction(net);
  
-@@ -886,6 +895,10 @@
+@@ -888,6 +897,10 @@
                        (char *) thd->security_ctx->host_or_ip);
    
    thd->command=command;
@@ -1814,7 +1796,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
    /*
      Commands which always take a long time are logged into
      the slow log only if opt_log_slow_admin_statements is set.
-@@ -1626,6 +1639,13 @@
+@@ -1683,6 +1696,13 @@
      thd->profiling.discard_current_query();
  #endif
      break;
@@ -1828,7 +1810,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
    case SCH_OPEN_TABLES:
    case SCH_VARIABLES:
    case SCH_STATUS:
-@@ -1783,6 +1803,7 @@
+@@ -1857,6 +1877,7 @@
                         thd->security_ctx->priv_host)) &&
          check_global_access(thd, SUPER_ACL))
      {
@@ -1836,7 +1818,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
        my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
        DBUG_RETURN(TRUE);
      }
-@@ -4725,6 +4746,7 @@
+@@ -4892,6 +4913,7 @@
        case ACL_INTERNAL_ACCESS_DENIED:
          if (! no_errors)
          {
@@ -1844,7 +1826,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
            my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
                     sctx->priv_user, sctx->priv_host, db);
          }
-@@ -4775,6 +4797,7 @@
+@@ -4942,6 +4964,7 @@
      DBUG_PRINT("error",("No possible access"));
      if (!no_errors)
      {
@@ -1852,7 +1834,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
        if (thd->password == 2)
          my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0),
                   sctx->priv_user,
-@@ -4891,6 +4914,7 @@
+@@ -5058,6 +5081,7 @@
  
      if (!thd->col_access && check_grant_db(thd, dst_db_name))
      {
@@ -1860,7 +1842,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
        my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
                 thd->security_ctx->priv_user,
                 thd->security_ctx->priv_host,
-@@ -5161,6 +5185,7 @@
+@@ -5328,6 +5352,7 @@
    if ((thd->security_ctx->master_access & want_access))
      return 0;
    get_privilege_desc(command, sizeof(command), want_access);
@@ -1868,7 +1850,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
    my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
    return 1;
  #else
-@@ -5542,6 +5567,32 @@
+@@ -5695,6 +5720,32 @@
    lex_start(thd);
    mysql_reset_thd_for_next_command(thd);
  
@@ -1883,7 +1865,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
 +  double start_cpu_nsecs= 0;
 +  double end_cpu_nsecs=   0;
 +
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +#ifdef HAVE_CLOCK_GETTIME
 +    /* get start cputime */
@@ -1901,11 +1883,11 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
    if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)
    {
      LEX *lex= thd->lex;
-@@ -5610,6 +5661,52 @@
+@@ -5763,6 +5814,52 @@
      DBUG_ASSERT(thd->change_list.is_empty());
    }
  
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +    // Gets the end time.
 +    if (!(end_time_error= gettimeofday(&end_time, NULL)))
@@ -1954,9 +1936,8 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
    DBUG_VOID_RETURN;
  }
  
-diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
---- a/sql/sql_prepare.cc       2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_prepare.cc       2010-12-31 04:25:04.000000000 +0300
+--- a/sql/sql_prepare.cc
++++ b/sql/sql_prepare.cc
 @@ -114,6 +114,9 @@
  #endif
  #include "lock.h"                               // MYSQL_OPEN_FORCE_SHARED_MDL
@@ -1982,7 +1963,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
 +  double start_cpu_nsecs= 0;
 +  double end_cpu_nsecs=   0;
 +
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +#ifdef HAVE_CLOCK_GETTIME
 +    /* get start cputime */
@@ -2017,7 +1998,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
  
    /* check_prepared_statemnt sends the metadata packet in case of success */
 +end:
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +    // Gets the end time.
 +    if (!(end_time_error= gettimeofday(&end_time, NULL)))
@@ -2081,7 +2062,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
 +  double start_cpu_nsecs= 0;
 +  double end_cpu_nsecs=   0;
 +
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +#ifdef HAVE_CLOCK_GETTIME
 +    /* get start cputime */
@@ -2099,7 +2080,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
    if (!(stmt= find_prepared_statement(thd, stmt_id)))
    {
      char llbuf[22];
-     my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf),
+     my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
               llstr(stmt_id, llbuf), "mysqld_stmt_execute");
 -    DBUG_VOID_RETURN;
 +    goto end;
@@ -2111,7 +2092,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
    DBUG_EXECUTE_IF("close_conn_after_stmt_execute", vio_close(thd->net.vio););
  
 +end:
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +    // Gets the end time.
 +    if (!(end_time_error= gettimeofday(&end_time, NULL)))
@@ -2176,7 +2157,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
 +  double start_cpu_nsecs= 0;
 +  double end_cpu_nsecs=   0;
 +
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +#ifdef HAVE_CLOCK_GETTIME
 +    /* get start cputime */
@@ -2195,7 +2176,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
    if (!(stmt= find_prepared_statement(thd, stmt_id)))
    {
      char llbuf[22];
-     my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf),
+     my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
               llstr(stmt_id, llbuf), "mysqld_stmt_fetch");
 -    DBUG_VOID_RETURN;
 +    goto end;
@@ -2215,7 +2196,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
    thd->stmt_arena= thd;
  
 +end:
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +    // Gets the end time.
 +    if (!(end_time_error = gettimeofday(&end_time, NULL)))
@@ -2278,7 +2259,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
 +  double start_cpu_nsecs= 0;
 +  double end_cpu_nsecs=   0;
 +
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +#ifdef HAVE_CLOCK_GETTIME
 +    /* get start cputime */
@@ -2297,7 +2278,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
    if (!(stmt= find_prepared_statement(thd, stmt_id)))
    {
      char llbuf[22];
-     my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf),
+     my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
               llstr(stmt_id, llbuf), "mysqld_stmt_reset");
 -    DBUG_VOID_RETURN;
 +    goto end;
@@ -2309,7 +2290,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
    my_ok(thd);
  
 +end:
-+  if (opt_userstat_running)
++  if (opt_userstat)
 +  {
 +    // Gets the end time.
 +    if (!(end_time_error = gettimeofday(&end_time, NULL)))
@@ -2358,10 +2339,9 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
    DBUG_VOID_RETURN;
  }
  
-diff -ruN a/sql/sql_reload.cc b/sql/sql_reload.cc
---- a/sql/sql_reload.cc        2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_reload.cc        2010-12-31 05:00:59.000000000 +0300
-@@ -280,14 +280,48 @@
+--- a/sql/sql_reload.cc
++++ b/sql/sql_reload.cc
+@@ -320,14 +320,48 @@
     mysql_mutex_unlock(&LOCK_active_mi);
   }
  #endif
@@ -2412,9 +2392,8 @@ diff -ruN a/sql/sql_reload.cc b/sql/sql_reload.cc
   if (*write_to_binlog != -1)
     *write_to_binlog= tmp_write_to_binlog;
   /*
-diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
---- a/sql/sql_show.cc  2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_show.cc  2010-12-31 04:39:23.000000000 +0300
+--- a/sql/sql_show.cc
++++ b/sql/sql_show.cc
 @@ -114,6 +114,43 @@
  
  static COND * make_cond_for_info_schema(COND *cond, TABLE_LIST *table);
@@ -2459,7 +2438,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  /***************************************************************************
  ** List all table types supported
  ***************************************************************************/
-@@ -799,6 +836,7 @@
+@@ -800,6 +837,7 @@
                sctx->master_access);
    if (!(db_access & DB_ACLS) && check_grant_db(thd,dbname))
    {
@@ -2467,7 +2446,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
      my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
               sctx->priv_user, sctx->host_or_ip, dbname);
      general_log_print(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
-@@ -2351,6 +2389,284 @@
+@@ -2359,6 +2397,284 @@
    DBUG_RETURN(res);
  }
  
@@ -2752,7 +2731,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  
  /* collect status for all running threads */
  
-@@ -7512,6 +7828,104 @@
+@@ -7712,6 +8028,104 @@
  };
  
  
@@ -2857,7 +2836,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  ST_FIELD_INFO processlist_fields_info[]=
  {
    {"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE},
-@@ -7701,6 +8115,8 @@
+@@ -7901,6 +8315,8 @@
  {
    {"CHARACTER_SETS", charsets_fields_info, create_schema_table, 
     fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
@@ -2866,7 +2845,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
    {"COLLATIONS", collation_fields_info, create_schema_table, 
     fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
    {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
-@@ -7710,6 +8126,8 @@
+@@ -7910,6 +8326,8 @@
     OPTIMIZE_I_S_TABLE|OPEN_VIEW_FULL},
    {"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table,
     fill_schema_column_privileges, 0, 0, -1, -1, 0, 0},
@@ -2875,7 +2854,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
    {"ENGINES", engines_fields_info, create_schema_table,
     fill_schema_engines, make_old_format, 0, -1, -1, 0, 0},
  #ifdef HAVE_EVENT_SCHEDULER
-@@ -7782,14 +8200,20 @@
+@@ -7982,14 +8400,20 @@
     get_all_tables, make_table_names_old_format, 0, 1, 2, 1, 0},
    {"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
     fill_schema_table_privileges, 0, 0, -1, -1, 0, 0},
@@ -2896,9 +2875,8 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
    {"VARIABLES", variables_fields_info, create_schema_table, fill_variables,
     make_old_format, 0, 0, -1, 1, 0},
    {"VIEWS", view_fields_info, create_schema_table, 
-diff -ruN a/sql/sql_update.cc b/sql/sql_update.cc
---- a/sql/sql_update.cc        2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_update.cc        2010-12-31 04:08:17.000000000 +0300
+--- a/sql/sql_update.cc
++++ b/sql/sql_update.cc
 @@ -900,8 +900,10 @@
      my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found,
                  (ulong) updated,
@@ -2912,7 +2890,7 @@ diff -ruN a/sql/sql_update.cc b/sql/sql_update.cc
      DBUG_PRINT("info",("%ld records updated", (long) updated));
    }
    thd->count_cuted_fields= CHECK_FIELD_IGNORE;                /* calc cuted fields */
-@@ -2146,7 +2148,9 @@
+@@ -2252,7 +2254,9 @@
      thd->first_successful_insert_id_in_prev_stmt : 0;
    my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO),
                (ulong) found, (ulong) updated, (ulong) thd->cuted_fields);
@@ -2924,10 +2902,9 @@ diff -ruN a/sql/sql_update.cc b/sql/sql_update.cc
 +  thd->updated_row_count+= row_count;
    DBUG_RETURN(FALSE);
  }
-diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
---- a/sql/sql_yacc.yy  2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sql_yacc.yy  2010-12-31 05:06:16.000000000 +0300
-@@ -864,6 +864,7 @@
+--- a/sql/sql_yacc.yy
++++ b/sql/sql_yacc.yy
+@@ -865,6 +865,7 @@
  %token  CIPHER_SYM
  %token  CLASS_ORIGIN_SYM              /* SQL-2003-N */
  %token  CLIENT_SYM
@@ -2935,7 +2912,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
  %token  CLOSE_SYM                     /* SQL-2003-R */
  %token  COALESCE                      /* SQL-2003-N */
  %token  CODE_SYM
-@@ -1017,6 +1018,7 @@
+@@ -1018,6 +1019,7 @@
  %token  IMPORT
  %token  INDEXES
  %token  INDEX_SYM
@@ -2943,7 +2920,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
  %token  INFILE
  %token  INITIAL_SIZE_SYM
  %token  INNER_SYM                     /* SQL-2003-R */
-@@ -1315,6 +1317,7 @@
+@@ -1316,6 +1318,7 @@
  %token  TABLESPACE
  %token  TABLE_REF_PRIORITY
  %token  TABLE_SYM                     /* SQL-2003-R */
@@ -2951,7 +2928,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
  %token  TABLE_CHECKSUM_SYM
  %token  TABLE_NAME_SYM                /* SQL-2003-N */
  %token  TEMPORARY                     /* SQL-2003-N */
-@@ -1324,6 +1327,7 @@
+@@ -1325,6 +1328,7 @@
  %token  TEXT_SYM
  %token  THAN_SYM
  %token  THEN_SYM                      /* SQL-2003-R */
@@ -2959,7 +2936,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
  %token  TIMESTAMP                     /* SQL-2003-R */
  %token  TIMESTAMP_ADD
  %token  TIMESTAMP_DIFF
-@@ -1361,6 +1365,7 @@
+@@ -1362,6 +1366,7 @@
  %token  UPGRADE_SYM
  %token  USAGE                         /* SQL-2003-N */
  %token  USER                          /* SQL-2003-R */
@@ -2967,7 +2944,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
  %token  USE_FRM
  %token  USE_SYM
  %token  USING                         /* SQL-2003-R */
-@@ -11109,6 +11114,41 @@
+@@ -11126,6 +11131,41 @@
               MYSQL_YYABORT;
  #endif // HAVE_RESPONSE_TIME_DISTRIBUTION
           }
@@ -3009,7 +2986,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
          | CREATE PROCEDURE_SYM sp_name
            {
              LEX *lex= Lex;
-@@ -11351,6 +11391,16 @@
+@@ -11371,6 +11411,16 @@
              Lex->type|= REFRESH_QUERY_RESPONSE_TIME;
  #endif // HAVE_RESPONSE_TIME_DISTRIBUTION
            }
@@ -3026,7 +3003,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
          | MASTER_SYM
            { Lex->type|= REFRESH_MASTER; }
          | DES_KEY_FILE
-@@ -12473,6 +12523,7 @@
+@@ -12515,6 +12565,7 @@
          | CHAIN_SYM                {}
          | CHANGED                  {}
          | CIPHER_SYM               {}
@@ -3034,7 +3011,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
          | CLIENT_SYM               {}
          | CLASS_ORIGIN_SYM         {}
          | COALESCE                 {}
-@@ -12541,6 +12592,7 @@
+@@ -12583,6 +12634,7 @@
          | HOSTS_SYM                {}
          | HOUR_SYM                 {}
          | IDENTIFIED_SYM           {}
@@ -3042,7 +3019,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
          | IGNORE_SERVER_IDS_SYM    {}
          | INVOKER_SYM              {}
          | IMPORT                   {}
-@@ -12692,6 +12744,7 @@
+@@ -12734,6 +12786,7 @@
          | SUSPEND_SYM              {}
          | SWAPS_SYM                {}
          | SWITCHES_SYM             {}
@@ -3050,7 +3027,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
          | TABLE_NAME_SYM           {}
          | TABLES                   {}
          | TABLE_CHECKSUM_SYM       {}
-@@ -12717,6 +12770,7 @@
+@@ -12759,6 +12812,7 @@
          | UNKNOWN_SYM              {}
          | UNTIL_SYM                {}
          | USER                     {}
@@ -3058,9 +3035,8 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
          | USE_FRM                  {}
          | VARIABLES                {}
          | VIEW_SYM                 {}
-diff -ruN a/sql/structs.h b/sql/structs.h
---- a/sql/structs.h    2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/structs.h    2010-12-31 05:12:04.000000000 +0300
+--- a/sql/structs.h
++++ b/sql/structs.h
 @@ -25,6 +25,7 @@
  #include "my_time.h"                   /* enum_mysql_timestamp_type */
  #include "thr_lock.h"                  /* thr_lock_type */
@@ -3241,31 +3217,29 @@ diff -ruN a/sql/structs.h b/sql/structs.h
        /* Bits in form->update */
  #define REG_MAKE_DUPP         1       /* Make a copy of record when read */
  #define REG_NEW_RECORD                2       /* Write a new record if not found */
-diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
---- a/sql/sys_vars.cc  2010-12-03 20:58:26.000000000 +0300
-+++ b/sql/sys_vars.cc  2010-12-30 02:22:25.000000000 +0300
-@@ -1563,6 +1563,17 @@
+--- a/sql/sys_vars.cc
++++ b/sql/sys_vars.cc
+@@ -1711,6 +1711,17 @@
         NO_MUTEX_GUARD, NOT_IN_BINLOG,
         ON_CHECK(check_read_only), ON_UPDATE(fix_read_only));
  
-+static Sys_var_mybool Sys_userstat_running(
-+       "userstat_running",
++static Sys_var_mybool Sys_userstat(
++       "userstat",
 +       "Control USER_STATISTICS, CLIENT_STATISTICS, THREAD_STATISTICS, "
 +       "INDEX_STATISTICS and TABLE_STATISTICS running",
-+       GLOBAL_VAR(opt_userstat_running), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
++       GLOBAL_VAR(opt_userstat), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
 +
 +static Sys_var_mybool Sys_thread_statistics(
 +       "thread_statistics",
-+       "Control TABLE_STATISTICS running, when userstat_running is enabled",
++       "Control TABLE_STATISTICS running, when userstat is enabled",
 +       GLOBAL_VAR(opt_thread_statistics), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
 +
  // Small lower limit to be able to test MRR
  static Sys_var_ulong Sys_read_rnd_buff_size(
         "read_rnd_buffer_size",
-diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
---- a/storage/myisam/ha_myisam.cc      2010-12-03 20:58:26.000000000 +0300
-+++ b/storage/myisam/ha_myisam.cc      2010-12-31 05:58:01.000000000 +0300
-@@ -768,6 +768,7 @@
+--- a/storage/myisam/ha_myisam.cc
++++ b/storage/myisam/ha_myisam.cc
+@@ -770,6 +770,7 @@
  
  int ha_myisam::write_row(uchar *buf)
  {
@@ -3273,7 +3247,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    ha_statistic_increment(&SSV::ha_write_count);
  
    /* If we have a timestamp column, update it to the current time */
-@@ -780,11 +781,13 @@
+@@ -782,11 +783,13 @@
    */
    if (table->next_number_field && buf == table->record[0])
    {
@@ -3289,7 +3263,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
  }
  
  int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
-@@ -1535,16 +1538,24 @@
+@@ -1553,16 +1556,24 @@
  
  int ha_myisam::update_row(const uchar *old_data, uchar *new_data)
  {
@@ -3316,7 +3290,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
  }
  
  int ha_myisam::index_read_map(uchar *buf, const uchar *key,
-@@ -1556,6 +1567,14 @@
+@@ -1574,6 +1585,14 @@
    ha_statistic_increment(&SSV::ha_read_key_count);
    int error=mi_rkey(file, buf, active_index, key, keypart_map, find_flag);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3331,7 +3305,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1568,6 +1587,14 @@
+@@ -1586,6 +1605,14 @@
    ha_statistic_increment(&SSV::ha_read_key_count);
    int error=mi_rkey(file, buf, index, key, keypart_map, find_flag);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3346,7 +3320,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1582,6 +1609,14 @@
+@@ -1600,6 +1627,14 @@
    int error=mi_rkey(file, buf, active_index, key, keypart_map,
                      HA_READ_PREFIX_LAST);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3361,7 +3335,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    DBUG_RETURN(error);
  }
-@@ -1593,6 +1628,13 @@
+@@ -1611,6 +1646,13 @@
    ha_statistic_increment(&SSV::ha_read_next_count);
    int error=mi_rnext(file,buf,active_index);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3375,7 +3349,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1604,6 +1646,13 @@
+@@ -1622,6 +1664,13 @@
    ha_statistic_increment(&SSV::ha_read_prev_count);
    int error=mi_rprev(file,buf, active_index);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3389,7 +3363,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1615,6 +1664,14 @@
+@@ -1633,6 +1682,14 @@
    ha_statistic_increment(&SSV::ha_read_first_count);
    int error=mi_rfirst(file, buf, active_index);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3404,7 +3378,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1626,6 +1683,14 @@
+@@ -1644,6 +1701,14 @@
    ha_statistic_increment(&SSV::ha_read_last_count);
    int error=mi_rlast(file, buf, active_index);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3419,7 +3393,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1643,6 +1708,14 @@
+@@ -1661,6 +1726,14 @@
      error= mi_rnext_same(file,buf);
    } while (error == HA_ERR_RECORD_DELETED);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3434,7 +3408,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1662,6 +1735,8 @@
+@@ -1680,6 +1753,8 @@
    ha_statistic_increment(&SSV::ha_read_rnd_next_count);
    int error=mi_scan(file, buf);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3443,7 +3417,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_READ_ROW_DONE(error);
    return error;
  }
-@@ -1678,6 +1753,8 @@
+@@ -1696,6 +1771,8 @@
    ha_statistic_increment(&SSV::ha_read_rnd_count);
    int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3452,3 +3426,73 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_READ_ROW_DONE(error);
    return error;
  }
+--- /dev/null
++++ b/mysql-test/r/userstat_bug602047.result
+@@ -0,0 +1,15 @@
++DROP TABLE IF EXISTS t1;
++SET GLOBAL userstat=ON;
++CREATE TABLE t1 ( id int(10), PRIMARY KEY (id)) ENGINE=InnoDB;
++INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
++SELECT COUNT(*) FROM t1;
++COUNT(*)
++10
++SELECT ROWS_READ FROM information_schema.table_statistics WHERE TABLE_NAME='t1';
++ROWS_READ
++10
++SELECT ROWS_READ FROM information_schema.index_statistics WHERE TABLE_NAME='t1';
++ROWS_READ
++10
++SET GLOBAL userstat=OFF;
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/t/userstat_bug602047.test
+@@ -0,0 +1,11 @@
++--disable_warnings
++DROP TABLE IF EXISTS t1; 
++--enable_warnings
++SET GLOBAL userstat=ON;
++CREATE TABLE t1 ( id int(10), PRIMARY KEY (id)) ENGINE=InnoDB;
++INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
++SELECT COUNT(*) FROM t1; 
++SELECT ROWS_READ FROM information_schema.table_statistics WHERE TABLE_NAME='t1';
++SELECT ROWS_READ FROM information_schema.index_statistics WHERE TABLE_NAME='t1';
++SET GLOBAL userstat=OFF;
++DROP TABLE t1;
+\ No newline at end of file
+--- a/mysql-test/r/mysqld--help-notwin.result
++++ b/mysql-test/r/mysqld--help-notwin.result
+@@ -745,6 +745,8 @@
+  Define threads usage for handling queries, one of
+  one-thread-per-connection, no-threads, loaded-dynamically
+  --thread-stack=#    The stack size for each thread
++ --thread-statistics Control TABLE_STATISTICS running, when userstat is
++ enabled
+  --time-format=name  The TIME format (ignored)
+  --timed-mutexes     Specify whether to time mutexes (only InnoDB mutexes are
+  currently supported)
+@@ -770,6 +772,9 @@
+  of the underlying table and the query uses a LIMIT clause
+  (usually get from GUI tools)
+  -u, --user=name     Run mysqld daemon as user.
++ --userstat          Control USER_STATISTICS, CLIENT_STATISTICS,
++ THREAD_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS
++ running
+  -v, --verbose       Used with --help option for detailed help.
+  -V, --version       Output version information and exit.
+  --wait-timeout=#    The number of seconds the server waits for activity on a
+@@ -1005,6 +1010,7 @@
+ thread-cache-size 0
+ thread-handling one-thread-per-connection
+ thread-stack 262144
++thread-statistics FALSE
+ time-format %H:%i:%s
+ timed-mutexes FALSE
+ tmp-table-size 16777216
+@@ -1012,6 +1018,7 @@
+ transaction-isolation REPEATABLE-READ
+ transaction-prealloc-size 4096
+ updatable-views-with-limit YES
++userstat FALSE
+ verbose TRUE
+ wait-timeout 28800
+ xtradb-admin-command ON
This page took 0.172872 seconds and 4 git commands to generate.