]> git.pld-linux.org Git - packages/mysql.git/blobdiff - userstat.patch
- update percona patches (mysql_dump_ignore_ct.patch needs updating)
[packages/mysql.git] / userstat.patch
index 722a27a7a6dca9a4cb7c40c444c9b04c83737010..7a97be80b461d9f7129889d31b730f2ef44fcbac 100644 (file)
@@ -44,7 +44,7 @@ diff -ruN a/include/mysql_com.h b/include/mysql_com.h
 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 @@
+@@ -0,0 +1,17 @@
 +File=userstats.patch
 +Name=SHOW USER/TABLE/INDEX statistics
 +Version=V2
@@ -55,11 +55,13 @@ 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
++2011-02
++Rename variable USERSTAT_RUNNING => USERSTAT
 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
@@ -105,7 +107,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc
 +// 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 +169,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)
 +    {
@@ -368,7 +370,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
  /*
    Log error with all enabled log event handlers
  
-@@ -5041,6 +5048,8 @@
+@@ -5042,6 +5049,8 @@
                               thd->first_successful_insert_id_in_prev_stmt_for_binlog);
            if (e.write(file))
              goto err;
@@ -377,7 +379,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 @@
+@@ -5053,12 +5062,16 @@
                               minimum());
            if (e.write(file))
              goto err;
@@ -394,7 +396,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
          }
          if (thd->user_var_events.elements)
          {
-@@ -5080,6 +5093,8 @@
+@@ -5081,6 +5094,8 @@
                                   flags);
              if (e.write(file))
                goto err;
@@ -403,7 +405,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
            }
          }
        }
-@@ -5091,6 +5106,8 @@
+@@ -5092,6 +5107,8 @@
      if (event_info->write(file) ||
          DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0))
        goto err;
@@ -412,7 +414,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
  
      error= 0;
  err:
-@@ -5276,7 +5293,8 @@
+@@ -5277,7 +5294,8 @@
      be reset as a READ_CACHE to be able to read the contents from it.
   */
  
@@ -422,7 +424,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc
  {
    Mutex_sentry sentry(lock_log ? &LOCK_log : NULL);
  
-@@ -5323,6 +5341,7 @@
+@@ -5324,6 +5342,7 @@
        /* write the first half of the split header */
        if (my_b_write(&log_file, header, carry))
          return ER_ERROR_ON_WRITE;
@@ -430,7 +432,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 @@
+@@ -5392,6 +5411,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 +440,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 @@
+@@ -5506,20 +5526,23 @@
        Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE, TRUE, 0);
        if (qinfo.write(&log_file))
          goto err;
@@ -492,7 +494,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  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
@@ -648,7 +650,7 @@ 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;
@@ -795,7 +797,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;
@@ -921,7 +923,7 @@ 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 @@
+@@ -1617,6 +1617,8 @@
    */
    enum enum_server_command command;
    uint32     server_id;
@@ -930,7 +932,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 @@
+@@ -2088,6 +2090,8 @@
    */
    enum_tx_isolation tx_isolation;
    enum_check_fields count_cuted_fields;
@@ -939,7 +941,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 @@
+@@ -2183,6 +2187,49 @@
    */
    LOG_INFO*  current_linfo;
    NET*       slave_net;                       // network connection from slave -> m.
@@ -989,7 +991,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 @@
+@@ -2263,6 +2310,11 @@
      alloc_root. 
    */
    void init_for_queries();
@@ -1001,7 +1003,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 @@
+@@ -2734,6 +2786,15 @@
    }
    thd_scheduler scheduler;
  
@@ -1017,7 +1019,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 @@
+@@ -2921,6 +2982,10 @@
    LEX_STRING invoker_host;
  };
  
@@ -1475,7 +1477,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 +1565,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);
@@ -1883,7 +1885,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 */
@@ -1905,7 +1907,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
      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)))
@@ -1982,7 +1984,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 +2019,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 +2083,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 */
@@ -2111,7 +2113,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 +2178,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 */
@@ -2215,7 +2217,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 +2280,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 */
@@ -2309,7 +2311,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)))
@@ -3248,15 +3250,15 @@ diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
         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
This page took 0.060932 seconds and 4 git commands to generate.