packages: mysql/mysql-acc-pslist.patch, mysql/mysql-bug-43594.patch, mysql/...

glen glen at pld-linux.org
Wed Aug 26 11:42:57 CEST 2009


Author: glen                         Date: Wed Aug 26 09:42:57 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- oops, restore

---- Files affected:
packages/mysql:
   mysql-acc-pslist.patch (1.6 -> 1.7) , mysql-bug-43594.patch (1.2 -> 1.3) , mysql-config.patch (1.2 -> 1.3) , mysql-libwrap.patch (1.3 -> 1.4) , mysql-microslow.patch (1.3 -> 1.4) , mysql-upgrade.patch (1.9 -> 1.10) , mysql-userstats.patch (1.6 -> 1.7) 

---- Diffs:

================================================================
Index: packages/mysql/mysql-acc-pslist.patch
diff -u /dev/null packages/mysql/mysql-acc-pslist.patch:1.7
--- /dev/null	Wed Aug 26 11:42:57 2009
+++ packages/mysql/mysql-acc-pslist.patch	Wed Aug 26 11:42:51 2009
@@ -0,0 +1,80 @@
+diff -r 1a59073d658d mysql-test/r/create.result
+--- a/mysql-test/r/create.result	Sat Sep 13 17:31:30 2008 -0700
++++ b/mysql-test/r/create.result	Sat Sep 13 17:31:40 2008 -0700
+@@ -1720,7 +1720,8 @@
+   `COMMAND` varchar(16) NOT NULL DEFAULT '',
+   `TIME` bigint(7) NOT NULL DEFAULT '0',
+   `STATE` varchar(64) DEFAULT NULL,
+-  `INFO` longtext
++  `INFO` longtext,
++  `TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000'
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8
+ drop table t1;
+ create temporary table t1 like information_schema.processlist;
+@@ -1734,7 +1735,8 @@
+   `COMMAND` varchar(16) NOT NULL DEFAULT '',
+   `TIME` bigint(7) NOT NULL DEFAULT '0',
+   `STATE` varchar(64) DEFAULT NULL,
+-  `INFO` longtext
++  `INFO` longtext,
++  `TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000'
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8
+ drop table t1;
+ create table t1 like information_schema.character_sets;
+diff -r 1a59073d658d sql/sql_show.cc
+--- a/sql/sql_show.cc	Sat Sep 13 17:31:30 2008 -0700
++++ b/sql/sql_show.cc	Sat Sep 13 17:31:40 2008 -0700
+@@ -1803,7 +1803,7 @@
+   TABLE *table= tables->table;
+   CHARSET_INFO *cs= system_charset_info;
+   char *user;
+-  time_t now= my_time(0);
++  ulonglong unow= my_micro_time();
+   DBUG_ENTER("fill_process_list");
+ 
+   user= thd->security_ctx->master_access & PROCESS_ACL ?
+@@ -1873,8 +1873,8 @@
+         table->field[4]->store(command_name[tmp->command].str,
+                                command_name[tmp->command].length, cs);
+       /* MYSQL_TIME */
+-      table->field[5]->store((longlong)(tmp->start_time ?
+-                                      now - tmp->start_time : 0), FALSE);
++      const ulonglong utime= tmp->start_utime ? unow - tmp->start_utime : 0;
++      table->field[5]->store(utime / 1000000, TRUE);
+       /* STATE */
+ #ifndef EMBEDDED_LIBRARY
+       val= (char*) (tmp->locked ? "Locked" :
+@@ -1896,11 +1896,15 @@
+         table->field[7]->set_notnull();
+       }
+ 
++      /* TIME_MS */
++      table->field[8]->store((double)(utime / 1000.0));
++
+       if (schema_table_store_record(thd, table))
+       {
+         VOID(pthread_mutex_unlock(&LOCK_thread_count));
+         DBUG_RETURN(1);
+       }
++
+     }
+   }
+ 
+@@ -5531,7 +5535,7 @@
+     into it two numbers, based on modulus of base-10 numbers.  In the ones
+     position is the number of decimals.  Tens position is unused.  In the
+     hundreds and thousands position is a two-digit decimal number representing
+-    length.  Encode this value with  (decimals*100)+length  , where
++    length.  Encode this value with  (length*100)+decimals  , where
+     0<decimals<10 and 0<=length<100 .
+ 
+   @param
+@@ -6539,6 +6543,8 @@
+   {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE},
+   {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
+    SKIP_OPEN_TABLE},
++  {"TIME_MS", 100 * (MY_INT64_NUM_DECIMAL_DIGITS + 1) + 3, MYSQL_TYPE_DECIMAL,
++    0, 0, "Time_ms", SKIP_OPEN_TABLE},
+   {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ };
+ 

================================================================
Index: packages/mysql/mysql-bug-43594.patch
diff -u /dev/null packages/mysql/mysql-bug-43594.patch:1.3
--- /dev/null	Wed Aug 26 11:42:57 2009
+++ packages/mysql/mysql-bug-43594.patch	Wed Aug 26 11:42:51 2009
@@ -0,0 +1,30 @@
+=== modified file 'scripts/mysqlhotcopy.sh'
+--- scripts/mysqlhotcopy.sh	2008-03-07 20:45:40 +0000
++++ scripts/mysqlhotcopy.sh	2009-03-12 13:06:42 +0000
+@@ -777,7 +777,24 @@ sub get_list_of_tables {
+         } || [];
+     warn "Unable to retrieve list of tables in $db: $@" if $@;
+ 
+-    return (map { $_->[0] } @$tables);
++    my @ignore_tables = ();
++
++    # Ignore tables for the mysql database
++    if ($db eq 'mysql') {
++        @ignore_tables = qw(general_log slow_log schema apply_status);
++    }
++
++    my @res = ();
++    if ($#ignore_tables > 1) {
++       my @tmp = (map { $_->[0] } @$tables);
++       for my $t (@tmp) {
++           push(@res, $t) if not exists { map { $_=>1 } @ignore_tables }->{$t};
++       }
++    } else {
++       @res = (map { $_->[0] } @$tables);
++    }
++
++    return @res;
+ }
+ 
+ sub quote_names {
+

================================================================
Index: packages/mysql/mysql-config.patch
diff -u /dev/null packages/mysql/mysql-config.patch:1.3
--- /dev/null	Wed Aug 26 11:42:57 2009
+++ packages/mysql/mysql-config.patch	Wed Aug 26 11:42:51 2009
@@ -0,0 +1,30 @@
+--- mysql-5.1.26-rc/scripts/mysql_config.sh.orig	2008-07-01 00:36:15.000000000 +0200
++++ mysql-5.1.26-rc/scripts/mysql_config.sh	2008-08-25 19:39:20.111236513 +0200
+@@ -132,21 +132,21 @@
+               DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
+               'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \
+               Xa xstrconst "xc99=none" AC99 \
+-              unroll2 ip mp restrict
++              unroll2 ip mp restrict 'f[-a-z0-9]*' 'g[-a-z0-9]*' 'm[-a-z0-9]*'
+ do
+   # The first option we might strip will always have a space before it because
+   # we set -I$pkgincludedir as the first option
+-  cflags=`echo "$cflags"|sed -e "s/ -$remove  */ /g"` 
++  cflags=`echo "$cflags"|sed -e "s/ \(-$remove  *\)\{1,\}/ /g"` 
+ done
+ cflags=`echo "$cflags"|sed -e 's/ *\$//'` 
+ 
+ # Same for --libs(_r)
+-for remove in lmtmalloc static-libcxa i-static static-intel
++for remove in lmtmalloc static-libcxa i-static static-intel 'Wl,-[-a-z0-9,]*'
+ do
+   # We know the strings starts with a space
+-  libs=`echo "$libs"|sed -e "s/ -$remove  */ /g"` 
+-  libs_r=`echo "$libs_r"|sed -e "s/ -$remove  */ /g"` 
+-  embedded_libs=`echo "$embedded_libs"|sed -e "s/ -$remove  */ /g"` 
++  libs=`echo "$libs"|sed -e "s/ \(-$remove  *\)\{1,\}/ /g"` 
++  libs_r=`echo "$libs_r"|sed -e "s/ \(-$remove  *\)\{1,\}/ /g"` 
++  embedded_libs=`echo "$embedded_libs"|sed -e "s/ \(-$remove  *\)\{1,\}/ /g"` 
+ done
+ 
+ # Strip trailing and ending space if any, and '+' (FIXME why?)

================================================================
Index: packages/mysql/mysql-libwrap.patch
diff -u /dev/null packages/mysql/mysql-libwrap.patch:1.4
--- /dev/null	Wed Aug 26 11:42:57 2009
+++ packages/mysql/mysql-libwrap.patch	Wed Aug 26 11:42:51 2009
@@ -0,0 +1,19 @@
+--- mysql-4.1.9/sql/mysqld.cc.orig	2005-01-11 23:06:00.000000000 +0100
++++ mysql-4.1.9/sql/mysqld.cc	2005-02-06 17:21:26.238717200 +0100
+@@ -133,7 +133,16 @@
+ #endif /* __WIN__ */
+ 
+ #ifdef HAVE_LIBWRAP
++#define hosts_access hosts_access_old
++#define sock_host sock_host_old
++#define eval_client eval_client_old
+ #include <tcpd.h>
++#undef hosts_access
++#undef sock_host
++#undef eval_client
++extern int hosts_access(struct request_info *);
++extern int sock_host(struct request_info *);
++extern int eval_client(struct request_info *);
+ #include <syslog.h>
+ #ifdef NEED_SYS_SYSLOG_H
+ #include <sys/syslog.h>

================================================================
Index: packages/mysql/mysql-microslow.patch
diff -u /dev/null packages/mysql/mysql-microslow.patch:1.4
--- /dev/null	Wed Aug 26 11:42:57 2009
+++ packages/mysql/mysql-microslow.patch	Wed Aug 26 11:42:51 2009
@@ -0,0 +1,700 @@
+diff -r 0b1f42e1aacf sql/event_scheduler.cc
+--- a/sql/event_scheduler.cc	Thu Dec 04 08:55:22 2008 -0800
++++ b/sql/event_scheduler.cc	Thu Dec 04 08:55:29 2008 -0800
+@@ -192,6 +192,7 @@
+   thd->client_capabilities|= CLIENT_MULTI_RESULTS;
+   pthread_mutex_lock(&LOCK_thread_count);
+   thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
++  thd->write_to_slow_log = TRUE;
+   pthread_mutex_unlock(&LOCK_thread_count);
+ 
+   /*
+diff -r 0b1f42e1aacf sql/filesort.cc
+--- a/sql/filesort.cc	Thu Dec 04 08:55:22 2008 -0800
++++ b/sql/filesort.cc	Thu Dec 04 08:55:29 2008 -0800
+@@ -188,6 +188,7 @@
+   {
+     status_var_increment(thd->status_var.filesort_scan_count);
+   }
++  thd->query_plan_flags|= QPLAN_FILESORT;
+ #ifdef CAN_TRUST_RANGE
+   if (select && select->quick && select->quick->records > 0L)
+   {
+@@ -253,6 +254,7 @@
+   }
+   else
+   {
++    thd->query_plan_flags|= QPLAN_FILESORT_DISK;
+     if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer)
+     {
+       x_free(table_sort.buffpek);
+@@ -1202,6 +1204,7 @@
+   DBUG_ENTER("merge_buffers");
+ 
+   status_var_increment(current_thd->status_var.filesort_merge_passes);
++  current_thd->query_plan_fsort_passes++;
+   if (param->not_killable)
+   {
+     killed= &not_killable;
+diff -r 0b1f42e1aacf sql/log.cc
+--- a/sql/log.cc	Thu Dec 04 08:55:22 2008 -0800
++++ b/sql/log.cc	Thu Dec 04 08:55:29 2008 -0800
+@@ -963,7 +963,7 @@
+     /* fill in user_host value: the format is "%s[%s] @ %s [%s]" */
+     user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE,
+                              sctx->priv_user ? sctx->priv_user : "", "[",
+-                             sctx->user ? sctx->user : "", "] @ ",
++                             sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ",
+                              sctx->host ? sctx->host : "", " [",
+                              sctx->ip ? sctx->ip : "", "]", NullS) -
+                     user_host_buff);
+@@ -985,6 +985,13 @@
+       query= command_name[thd->command].str;
+       query_length= command_name[thd->command].length;
+     }
++
++    if (!query_length) 
++    { 
++      thd->sent_row_count= thd->examined_row_count= 0; 
++      thd->query_plan_flags= QPLAN_NONE; 
++      thd->query_plan_fsort_passes= 0; 
++    } 
+ 
+     for (current_handler= slow_log_handler_list; *current_handler ;)
+       error= (*current_handler++)->log_slow(thd, current_time, thd->start_time,
+@@ -2242,16 +2249,31 @@
+       if (my_b_write(&log_file, (uchar*) "\n", 1))
+         tmp_errno= errno;
+     }
++    
+     /* For slow query log */
+     sprintf(query_time_buff, "%.6f", ulonglong2double(query_utime)/1000000.0);
+     sprintf(lock_time_buff,  "%.6f", ulonglong2double(lock_utime)/1000000.0);
+     if (my_b_printf(&log_file,
+-                    "# Query_time: %s  Lock_time: %s"
+-                    " Rows_sent: %lu  Rows_examined: %lu\n",
++                    "# Thread_id: %lu  Schema: %s\n" \
++                    "# Query_time: %s  Lock_time: %s  Rows_sent: %lu  Rows_examined: %lu\n",
++                    (ulong) thd->thread_id, (thd->db ? thd->db : ""),
+                     query_time_buff, lock_time_buff,
+                     (ulong) thd->sent_row_count,
+                     (ulong) thd->examined_row_count) == (uint) -1)
+       tmp_errno= errno;
++     if ((thd->variables.log_slow_verbosity & SLOG_V_QUERY_PLAN) && 
++         my_b_printf(&log_file, 
++                     "# QC_Hit: %s  Full_scan: %s  Full_join: %s  Tmp_table: %s  Tmp_table_on_disk: %s\n" \
++                     "# Filesort: %s  Filesort_on_disk: %s  Merge_passes: %lu\n", 
++                     ((thd->query_plan_flags & QPLAN_QC) ? "Yes" : "No"), 
++                     ((thd->query_plan_flags & QPLAN_FULL_SCAN) ? "Yes" : "No"), 
++                     ((thd->query_plan_flags & QPLAN_FULL_JOIN) ? "Yes" : "No"), 
++                     ((thd->query_plan_flags & QPLAN_TMP_TABLE) ? "Yes" : "No"), 
++                     ((thd->query_plan_flags & QPLAN_TMP_DISK) ? "Yes" : "No"), 
++                     ((thd->query_plan_flags & QPLAN_FILESORT) ? "Yes" : "No"), 
++                     ((thd->query_plan_flags & QPLAN_FILESORT_DISK) ? "Yes" : "No"), 
++                     thd->query_plan_fsort_passes) == (uint) -1) 
++       tmp_errno=errno; 
+     if (thd->db && strcmp(thd->db, db))
+     {						// Database changed
+       if (my_b_printf(&log_file,"use %s;\n",thd->db) == (uint) -1)
+diff -r 0b1f42e1aacf sql/mysql_priv.h
+--- a/sql/mysql_priv.h	Thu Dec 04 08:55:22 2008 -0800
++++ b/sql/mysql_priv.h	Thu Dec 04 08:55:29 2008 -0800
+@@ -597,6 +597,73 @@
+ #define WEEK_FIRST_WEEKDAY   4
+ 
+ #define STRING_BUFFER_USUAL_SIZE 80
++
++/* Slow log */
++
++struct msl_opts
++{
++  ulong val;
++  const char *name;
++};
++
++#define SLOG_V_QUERY_PLAN     1 << 1
++/* ... */
++#define SLOG_V_INVALID        1 << 31
++#define SLOG_V_NONE           1 << 0
++
++static const struct msl_opts slog_verb[]= 
++{
++  /* Basic flags */
++
++  { SLOG_V_QUERY_PLAN, "query_plan" },
++
++  /* End of baisc flags */
++
++  { 0, "" },
++
++  /* Complex flags */
++
++  { SLOG_V_QUERY_PLAN, "standard" },
++  { SLOG_V_INVALID, "full" },
++
++  /* End of complex flags */
++
++  { SLOG_V_INVALID, (char *)0 }
++};
++
++#define QPLAN_NONE            0
++#define QPLAN_QC              1 << 0
++#define QPLAN_QC_NO           1 << 1
++#define QPLAN_FULL_SCAN       1 << 2
++#define QPLAN_FULL_JOIN       1 << 3
++#define QPLAN_TMP_TABLE       1 << 4
++#define QPLAN_TMP_DISK        1 << 5
++#define QPLAN_FILESORT        1 << 6
++#define QPLAN_FILESORT_DISK   1 << 7
++/* ... */
++#define QPLAN_MAX             1 << 31
++
++#define SLOG_F_QC_NO          QPLAN_QC_NO
++#define SLOG_F_FULL_SCAN      QPLAN_FULL_SCAN
++#define SLOG_F_FULL_JOIN      QPLAN_FULL_JOIN
++#define SLOG_F_TMP_TABLE      QPLAN_TMP_TABLE
++#define SLOG_F_TMP_DISK       QPLAN_TMP_DISK
++#define SLOG_F_FILESORT       QPLAN_FILESORT
++#define SLOG_F_FILESORT_DISK  QPLAN_FILESORT_DISK
++#define SLOG_F_INVALID        1 << 31
++#define SLOG_F_NONE           0
++
++static const struct msl_opts slog_filter[]= 
++{
++  { SLOG_F_QC_NO,         "qc_miss" },
++  { SLOG_F_FULL_SCAN,     "full_scan" },
++  { SLOG_F_FULL_JOIN,     "full_join" },
++  { SLOG_F_TMP_TABLE,     "tmp_table" },
++  { SLOG_F_TMP_DISK,      "tmp_table_on_disk" },
++  { SLOG_F_FILESORT,      "filesort" },
++  { SLOG_F_FILESORT_DISK, "filesort_on_disk" },
++  { SLOG_F_INVALID,       (char *)0 }
++};
+ 
+ /*
+   Some defines for exit codes for ::is_equal class functions.
+diff -r 0b1f42e1aacf sql/mysqld.cc
+--- a/sql/mysqld.cc	Thu Dec 04 08:55:22 2008 -0800
++++ b/sql/mysqld.cc	Thu Dec 04 08:55:29 2008 -0800
+@@ -5553,6 +5553,9 @@
+   OPT_SECURE_FILE_PRIV,
+   OPT_MIN_EXAMINED_ROW_LIMIT,
+   OPT_LOG_SLOW_SLAVE_STATEMENTS,
++  OPT_LOG_SLOW_RATE_LIMIT, 
++  OPT_LOG_SLOW_VERBOSITY, 
++  OPT_LOG_SLOW_FILTER, 
+   OPT_OLD_MODE,
+   OPT_SLAVE_EXEC_MODE,
+   OPT_GENERAL_LOG_FILE,
+@@ -6480,6 +6483,17 @@
+    (uchar**) 0,
+    0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
+    1, 100, 0, 1, 0},
++  {"log_slow_filter", OPT_LOG_SLOW_FILTER,
++   "Log only the queries that followed certain execution plan. Multiple flags allowed in a comma-separated string. [qc_miss, full_scan, full_join, tmp_table, tmp_table_on_disk, filesort, filesort_on_disk]",
++   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, SLOG_F_NONE, 0, 0},
++  {"log_slow_rate_limit", OPT_LOG_SLOW_RATE_LIMIT,
++   "Rate limit statement writes to slow log to only those from every (1/log_slow_rate_limit) session.",
++   (uchar**) &global_system_variables.log_slow_rate_limit,
++   (uchar**) &max_system_variables.log_slow_rate_limit, 0, GET_ULONG,
++   REQUIRED_ARG, 1, 1, ~0L, 0, 1L, 0},
++  {"log_slow_verbosity", OPT_LOG_SLOW_VERBOSITY,
++   "Choose how verbose the messages to your slow log will be. Multiple flags allowed in a comma-separated string. [microtime, query_plan, innodb]",
++   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, SLOG_V_NONE, 0, 0},
+   {"long_query_time", OPT_LONG_QUERY_TIME,
+    "Log all queries that have taken more than long_query_time seconds to execute to file. "
+    "The argument will be treated as a decimal value with microsecond precission.",
+@@ -7556,6 +7570,10 @@
+   global_system_variables.old_passwords= 0;
+   global_system_variables.old_alter_table= 0;
+   global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC;
++  
++  global_system_variables.log_slow_verbosity= SLOG_V_NONE; 
++  global_system_variables.log_slow_filter= SLOG_F_NONE; 
++  
+   /*
+     Default behavior for 4.1 and 5.0 is to treat NULL values as unequal
+     when collecting index statistics for MyISAM tables.
+@@ -8007,6 +8025,24 @@
+   case OPT_BOOTSTRAP:
+     opt_noacl=opt_bootstrap=1;
+     break;
++  case OPT_LOG_SLOW_FILTER: 
++    if ((global_system_variables.log_slow_filter=  
++          msl_flag_resolve_by_name(slog_filter, argument, 
++                                   SLOG_F_NONE, SLOG_F_INVALID)) == SLOG_F_INVALID) 
++    { 
++      fprintf(stderr,"Invalid argument to log_slow_filter\n"); 
++      exit(1); 
++    } 
++    break; 
++  case OPT_LOG_SLOW_VERBOSITY: 
++    if ((global_system_variables.log_slow_verbosity=  
++         msl_flag_resolve_by_name(slog_verb, argument, 
++                                  SLOG_V_NONE, SLOG_V_INVALID)) == SLOG_V_INVALID) 
++    { 
++      fprintf(stderr,"Invalid argument to log_slow_verbosity\n"); 
++      exit(1); 
++    } 
++    break; 
+   case OPT_SERVER_ID:
+     server_id_supplied = 1;
+     break;
+diff -r 0b1f42e1aacf sql/set_var.cc
+--- a/sql/set_var.cc	Thu Dec 04 08:55:22 2008 -0800
++++ b/sql/set_var.cc	Thu Dec 04 08:55:29 2008 -0800
+@@ -336,6 +336,20 @@
+ 					      &SV::max_join_size,
+ 					      fix_max_join_size);
+ #endif
++static sys_var_thd_ulong  sys_log_slow_rate_limit(&vars, "log_slow_rate_limit", 
++              &SV::log_slow_rate_limit); 
++static sys_var_thd_msl_flag sys_log_slow_filter(&vars, "log_slow_filter", 
++              &SV::log_slow_filter, 
++                                       SLOG_F_NONE, 
++                                       SLOG_F_NONE, 
++                                       SLOG_F_INVALID, 
++                                       slog_filter); 
++static sys_var_thd_msl_flag sys_log_slow_verbosity(&vars, "log_slow_verbosity", 
++              &SV::log_slow_verbosity, 
++                                       SLOG_V_NONE, 
++                                       SLOG_V_NONE, 
++                                       SLOG_V_INVALID, 
++                                       slog_verb); 
+ static sys_var_long_ptr_global
+ sys_max_prepared_stmt_count(&vars, "max_prepared_stmt_count",
+                             &max_prepared_stmt_count,
+@@ -3631,6 +3645,192 @@
+ #endif
+ }
+ 
++/* Slow log stuff */
++
++ulong msl_option_resolve_by_name(const struct msl_opts *opts, const char *name, ulong len)
++{
++  ulong i;
++  
++  for (i=0; opts[i].name; i++)
++  {
++    if (!my_strnncoll(&my_charset_latin1,
++                      (const uchar *)name, len,
++                      (const uchar *)opts[i].name, strlen(opts[i].name)))
++      return opts[i].val;
++  }
++  return opts[i].val;
++}
++
++ulong msl_flag_resolve_by_name(const struct msl_opts *opts, const char *names_list, 
++                               const ulong none_val, const ulong invalid_val)
++{
++  const char *p, *e;
++  ulong val= none_val;
++  
++  if (!*names_list)
++    return val;
++  
++  for (p= e= names_list; ; e++)
++  {
++    ulong i;
++    
++    if (*e != ',' && *e)
++      continue;
++    for (i=0; opts[i].name; i++)
++    {
++      if (!my_strnncoll(&my_charset_latin1,
++                        (const uchar *)p, e - p,
++                        (const uchar *)opts[i].name, strlen(opts[i].name)))
++      {
++        val= val | opts[i].val;
++        break;
++      }
++    }
++    if (opts[i].val == invalid_val)
++      return invalid_val;
++    if (!*e)
++      break;
++    p= e + 1;
++  }
++  return val;
++}
++
++const char *msl_option_get_name(const struct msl_opts *opts, ulong val)
++{
++  for (ulong i=0; opts[i].name && opts[i].name[0]; i++)
++  {
++    if (opts[i].val == val)
++      return opts[i].name;
++  }
++  return "*INVALID*";
++}
++
++char *msl_flag_get_name(const struct msl_opts *opts, char *buf, ulong val)
++{
++  uint offset= 0;
++  
++  *buf= '\0';
++  for (ulong i=0; opts[i].name && opts[i].name[0]; i++)
++  {
++    if (opts[i].val & val)
++      offset+= snprintf(buf+offset, STRING_BUFFER_USUAL_SIZE - offset - 1,
++                        "%s%s", (offset ? "," : ""), opts[i].name);
++  }
++  return buf;
++}
++
++/****************************************************************************
++ Functions to handle log_slow_verbosity
++****************************************************************************/
++
++/* Based upon sys_var::check_enum() */
++
++bool sys_var_thd_msl_option::check(THD *thd, set_var *var)
++{
++  char buff[STRING_BUFFER_USUAL_SIZE];
++  String str(buff, sizeof(buff), &my_charset_latin1), *res;
++
++  if (var->value->result_type() == STRING_RESULT)
++  {
++    ulong verb= this->invalid_val;
++    if (!(res=var->value->val_str(&str)) ||
++	      (var->save_result.ulong_value=
++          (ulong) (verb= msl_option_resolve_by_name(this->opts, res->ptr(), res->length()))) == this->invalid_val)
++      goto err;
++    return 0;
++  }
++
++err:
++  my_error(ER_WRONG_ARGUMENTS, MYF(0), var->var->name);
++  return 1;
++}
++
++uchar *sys_var_thd_msl_option::value_ptr(THD *thd, enum_var_type type,
++					LEX_STRING *base)
++{
++  ulong val;
++  val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
++        thd->variables.*offset);
++  const char *verbosity= msl_option_get_name(this->opts, val);
++  return (uchar *) verbosity;
++}
++
++
++void sys_var_thd_msl_option::set_default(THD *thd, enum_var_type type)
++{
++  if (type == OPT_GLOBAL)
++    global_system_variables.*offset= (ulong) this->default_val;
++  else
++    thd->variables.*offset= (ulong) (global_system_variables.*offset);
++}
++
++
++bool sys_var_thd_msl_option::update(THD *thd, set_var *var)
++{
++  if (var->type == OPT_GLOBAL)
++    global_system_variables.*offset= var->save_result.ulong_value;
++  else
++    thd->variables.*offset= var->save_result.ulong_value;
++  return 0;
++}
++
++/****************************************************************************
++ Functions to handle log_slow_filter
++****************************************************************************/
++  
++/* Based upon sys_var::check_enum() */
++
++bool sys_var_thd_msl_flag::check(THD *thd, set_var *var)
++{
++  char buff[2 * STRING_BUFFER_USUAL_SIZE];
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql/mysql-acc-pslist.patch?r1=1.6&r2=1.7&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql/mysql-bug-43594.patch?r1=1.2&r2=1.3&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql/mysql-config.patch?r1=1.2&r2=1.3&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql/mysql-libwrap.patch?r1=1.3&r2=1.4&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql/mysql-microslow.patch?r1=1.3&r2=1.4&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql/mysql-upgrade.patch?r1=1.9&r2=1.10&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql/mysql-userstats.patch?r1=1.6&r2=1.7&f=u



More information about the pld-cvs-commit mailing list