List:Commits« Previous MessageNext Message »
From:Petr Chardin Date:January 27 2006 10:41am
Subject:bk commit into 5.1 tree (petr:1.2082)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of cps. When cps does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2082 06/01/27 13:41:15 petr@stripped +5 -0
  Use one option --log-output[=option[,option...]]
  instead of current --old-log-format and
  --both-log-formats options

  sql/mysqld.cc
    1.525 06/01/27 13:41:11 petr@stripped +51 -41
    Use one option --log-output[=option[,option...]]
    instead of current --old-log-format and
    --both-log-formats options

  sql/log.h
    1.3 06/01/27 13:41:11 petr@stripped +10 -14
    Add log event handler flags to simplify log
    option processing

  sql/log.cc
    1.189 06/01/27 13:41:11 petr@stripped +38 -29
    use log event handler flags instead of enum_printer

  mysql-test/r/im_utils.result
    1.3 06/01/27 13:41:11 petr@stripped +2 -2
    correct result file

  mysql-test/mysql-test-run.pl
    1.58 06/01/27 13:41:11 petr@stripped +1 -1
    use new option instead of the old one for testing

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	petr
# Host:	outpost.site
# Root:	/home/cps/mysql/trees/5.1/5.1-virgin-no-debug

--- 1.188/sql/log.cc	2006-01-20 15:50:49 +03:00
+++ 1.189/sql/log.cc	2006-01-27 13:41:11 +03:00
@@ -596,7 +596,7 @@
     file_log_handler= new Log_to_file_event_handler;
 
   /* by default we use traditional error log */
-  init_error_log(LEGACY);
+  init_error_log(LOG_FILE);
 
   file_log_handler->init_pthread_objects();
   (void) pthread_mutex_init(&LOCK_logger, MY_MUTEX_INIT_SLOW);
@@ -804,41 +804,47 @@
   return error;
 }
 
-void LOGGER::init_error_log(enum enum_printer error_log_printer)
+void LOGGER::init_error_log(uint error_log_printer)
 {
-  switch (error_log_printer) {
-  case NONE:
+  if (error_log_printer & LOG_NONE)
+  {
     error_log_handler_list[0]= 0;
-    break;
-  case LEGACY:
+    return;
+  }
+
+  switch (error_log_printer) {
+  case LOG_FILE:
     error_log_handler_list[0]= file_log_handler;
     error_log_handler_list[1]= 0;
     break;
     /* these two are disabled for now */
-  case CSV:
+  case LOG_TABLE:
     DBUG_ASSERT(0);
     break;
-  case LEGACY_AND_CSV:
+  case LOG_TABLE|LOG_FILE:
     DBUG_ASSERT(0);
     break;
   }
 }
 
-void LOGGER::init_slow_log(enum enum_printer slow_log_printer)
+void LOGGER::init_slow_log(uint slow_log_printer)
 {
-  switch (slow_log_printer) {
-  case NONE:
+  if (slow_log_printer & LOG_NONE)
+  {
     slow_log_handler_list[0]= 0;
-    break;
-  case LEGACY:
+    return;
+  }
+
+  switch (slow_log_printer) {
+  case LOG_FILE:
     slow_log_handler_list[0]= file_log_handler;
     slow_log_handler_list[1]= 0;
     break;
-  case CSV:
+  case LOG_TABLE:
     slow_log_handler_list[0]= table_log_handler;
     slow_log_handler_list[1]= 0;
     break;
-  case LEGACY_AND_CSV:
+  case LOG_TABLE|LOG_FILE:
     slow_log_handler_list[0]= file_log_handler;
     slow_log_handler_list[1]= table_log_handler;
     slow_log_handler_list[2]= 0;
@@ -846,21 +852,24 @@
   }
 }
 
-void LOGGER::init_general_log(enum enum_printer general_log_printer)
+void LOGGER::init_general_log(uint general_log_printer)
 {
-  switch (general_log_printer) {
-  case NONE:
+  if (general_log_printer & LOG_NONE)
+  {
     general_log_handler_list[0]= 0;
-    break;
-  case LEGACY:
+    return;
+  }
+
+  switch (general_log_printer) {
+  case LOG_FILE:
     general_log_handler_list[0]= file_log_handler;
     general_log_handler_list[1]= 0;
     break;
-  case CSV:
+  case LOG_TABLE:
     general_log_handler_list[0]= table_log_handler;
     general_log_handler_list[1]= 0;
     break;
-  case LEGACY_AND_CSV:
+  case LOG_TABLE|LOG_FILE:
     general_log_handler_list[0]= file_log_handler;
     general_log_handler_list[1]= table_log_handler;
     general_log_handler_list[2]= 0;
@@ -891,20 +900,20 @@
   return (open_log_table(QUERY_LOG_GENERAL) || open_log_table(QUERY_LOG_SLOW));
 }
 
-int LOGGER::set_handlers(enum enum_printer error_log_printer,
-                         enum enum_printer slow_log_printer,
-                         enum enum_printer general_log_printer)
+int LOGGER::set_handlers(uint error_log_printer,
+                         uint slow_log_printer,
+                         uint general_log_printer)
 {
   /* error log table is not supported yet */
-  DBUG_ASSERT(error_log_printer < CSV);
+  DBUG_ASSERT(error_log_printer < LOG_TABLE);
 
   lock();
 
-  if ((slow_log_printer >= CSV || general_log_printer >= CSV) &&
+  if ((slow_log_printer & LOG_TABLE || general_log_printer & LOG_TABLE) &&
       !is_log_tables_initialized)
   {
-    slow_log_printer= LEGACY;
-    general_log_printer= LEGACY;
+    slow_log_printer= (slow_log_printer & ~LOG_TABLE) | LOG_FILE;
+    general_log_printer= (general_log_printer & ~LOG_TABLE) | LOG_FILE;
 
     sql_print_error("Failed to initialize log tables. "
                     "Falling back to the old-fashioned logs");

--- 1.524/sql/mysqld.cc	2006-01-24 15:33:58 +03:00
+++ 1.525/sql/mysqld.cc	2006-01-27 13:41:11 +03:00
@@ -297,8 +297,16 @@
  {&Arg_comparator::compare_row,        &Arg_comparator::compare_e_row},
  {&Arg_comparator::compare_decimal,    &Arg_comparator::compare_e_decimal}};
 
+const char *log_output_names[] =
+{ "NONE", "FILE", "TABLE", NullS};
+TYPELIB log_output_typelib= {array_elements(log_output_names)-1,"",
+				 log_output_names, NULL};
+
 /* static variables */
 
+/* the default log output is log tables */
+static const char *log_output_str= "TABLE";
+static ulong log_output_options= LOG_TABLE;
 static bool lower_case_table_names_used= 0;
 static bool volatile select_thread_in_use, signal_thread_in_use;
 static bool volatile ready_to_exit;
@@ -332,9 +340,6 @@
 
 bool opt_log, opt_update_log, opt_bin_log, opt_slow_log;
 bool opt_error_log= IF_WIN(1,0);
-#ifdef WITH_CSV_STORAGE_ENGINE
-bool opt_old_log_format, opt_both_log_formats;
-#endif
 bool opt_disable_networking=0, opt_skip_show_db=0;
 my_bool opt_character_set_client_handshake= 1;
 bool server_id_supplied = 0;
@@ -2395,8 +2400,8 @@
       sql_print_information("Got signal %d to shutdown mysqld",sig);
 #endif
       /* switch to the old log message processing */
-      logger.set_handlers(LEGACY, opt_slow_log ? LEGACY:NONE,
-                          opt_log ? LEGACY:NONE);
+      logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE,
+                          opt_log ? LOG_FILE:LOG_NONE);
       DBUG_PRINT("info",("Got signal: %d  abort_loop: %d",sig,abort_loop));
       if (!abort_loop)
       {
@@ -2425,8 +2430,8 @@
 			     (TABLE_LIST*) 0, &not_used); // Flush logs
       }
       /* reenable logs after the options were reloaded */
-      logger.set_handlers(LEGACY, opt_slow_log ? CSV:NONE,
-                          opt_log ? CSV:NONE);
+      logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_TABLE:LOG_NONE,
+                          opt_log ? LOG_TABLE:LOG_NONE);
       break;
 #ifdef USE_ONE_SIGNAL_HAND
     case THR_SERVER_ALARM:
@@ -3085,21 +3090,20 @@
 #ifdef WITH_CSV_STORAGE_ENGINE
   logger.init_log_tables();
 
-  if (opt_old_log_format || (have_csv_db != SHOW_OPTION_YES))
-    logger.set_handlers(LEGACY, opt_slow_log ? LEGACY:NONE,
-                        opt_log ? LEGACY:NONE);
+  if (log_output_options & LOG_NONE)
+    logger.set_handlers(LOG_FILE, LOG_NONE, LOG_NONE);
   else
-    if (opt_both_log_formats)
-      logger.set_handlers(LEGACY,
-                          opt_slow_log ? LEGACY_AND_CSV:NONE,
-                          opt_log ? LEGACY_AND_CSV:NONE);
-    else
-      /* the default is CSV log tables */
-      logger.set_handlers(LEGACY, opt_slow_log ? CSV:NONE,
-                          opt_log ? CSV:NONE);
+  {
+    /* fall back to the log files if tables are not present */
+    if (have_csv_db == SHOW_OPTION_NO)
+      log_output_options= log_output_options & ~LOG_TABLE | LOG_FILE;
+
+    logger.set_handlers(LOG_FILE, opt_slow_log ? log_output_options:LOG_NONE,
+                        opt_log ? log_output_options:LOG_NONE);
+  }
 #else
-  logger.set_handlers(LEGACY, opt_slow_log ? LEGACY:NONE,
-                      opt_log ? LEGACY:NONE);
+  logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE,
+                      opt_log ? LOG_FILE:LOG_NONE);
 #endif
 
   if (opt_update_log)
@@ -4676,8 +4680,8 @@
   OPT_REPLICATE_IGNORE_TABLE,  OPT_REPLICATE_WILD_DO_TABLE,
   OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID,
   OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER,
-  OPT_ABORT_SLAVE_EVENT_COUNT, OPT_OLD_LOG_FORMAT, OPT_BOTH_LOG_FORMATS,
-  OPT_INNODB_DATA_HOME_DIR,
+  OPT_ABORT_SLAVE_EVENT_COUNT,
+  OPT_INNODB_DATA_HOME_DIR, OPT_LOG_OUTPUT,
   OPT_INNODB_DATA_FILE_PATH,
   OPT_INNODB_LOG_GROUP_HOME_DIR,
   OPT_INNODB_LOG_ARCH_DIR,
@@ -5217,6 +5221,13 @@
   {"log-long-format", '0',
    "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.", 
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+#ifdef WITH_CSV_STORAGE_ENGINE
+  {"log-output", OPT_LOG_OUTPUT,
+   "Syntax: log-output[=option[,option...]], where option can be TABLE, "
+   "FILE or NONE.",
+   (gptr*) &log_output_str, (gptr*) &log_output_str, 0,
+   GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+#endif
   {"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
    "Log queries that are executed without benefit of any index to the slow log if it is open.",
    (gptr*) &opt_log_queries_not_using_indexes, (gptr*) &opt_log_queries_not_using_indexes,
@@ -5238,16 +5249,6 @@
     "Log slow queries to this log file. Defaults logging to hostname-slow.log file. Must be enabled to activate other slow log options.",
    (gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
    0, 0, 0, 0, 0, 0},
-#ifdef WITH_CSV_STORAGE_ENGINE
-  {"old-log-format", OPT_OLD_LOG_FORMAT,
-   "Enable old log file format. (No SELECT * FROM logs)",
-   (gptr*) &opt_old_log_format, 0, 0, GET_BOOL, OPT_ARG,
-   0, 0, 0, 0, 0, 0},
-  {"both-log-formats", OPT_BOTH_LOG_FORMATS,
-   "Enable old log file format along with log tables",
-   (gptr*) &opt_both_log_formats, 0, 0, GET_BOOL, OPT_ARG,
-   0, 0, 0, 0, 0, 0},
-#endif
   {"log-tc", OPT_LOG_TC,
    "Path to transaction coordinator log (used for transactions that affect "
    "more than one storage engine, when binary log is disabled)",
@@ -6940,10 +6941,6 @@
   opt_skip_slave_start= opt_reckless_slave = 0;
   mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0;
   opt_log= opt_update_log= opt_slow_log= 0;
-#ifdef WITH_CSV_STORAGE_ENGINE
-  opt_old_log_format= 0;
-  opt_both_log_formats= 0;
-#endif
   opt_bin_log= 0;
   opt_disable_networking= opt_skip_show_db=0;
   opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0;
@@ -7357,12 +7354,25 @@
     opt_slow_log= 1;
     break;
 #ifdef WITH_CSV_STORAGE_ENGINE
-  case (int) OPT_OLD_LOG_FORMAT:
-    opt_old_log_format= 1;
-    break;
-  case (int) OPT_BOTH_LOG_FORMATS:
-    opt_both_log_formats= 1;
+  case  OPT_LOG_OUTPUT:
+  {
+    if (!argument || !argument[0])
+    {
+      log_output_options= LOG_TABLE;
+      log_output_str= log_output_typelib.type_names[1];
+    }
+    else
+    {
+      log_output_str= argument;
+      if ((log_output_options=
+	   find_bit_type(argument, &log_output_typelib)) == ~(ulong) 0)
+      {
+	fprintf(stderr, "Unknown option to log-output: %s\n", argument);
+	exit(1);
+      }
+    }
     break;
+  }
 #endif
   case (int) OPT_SKIP_NEW:
     opt_specialflag|= SPECIAL_NO_NEW_FUNC;

--- 1.2/mysql-test/r/im_utils.result	2006-01-19 05:55:59 +03:00
+++ 1.3/mysql-test/r/im_utils.result	2006-01-27 13:41:11 +03:00
@@ -21,7 +21,7 @@
 skip-innodb	VALUE
 skip-bdb	VALUE
 skip-ndbcluster	VALUE
-old-log-format	VALUE
+log-output	VALUE
 SHOW INSTANCE OPTIONS mysqld2;
 option_name	value
 instance_name	VALUE
@@ -42,7 +42,7 @@
 skip-innodb	VALUE
 skip-bdb	VALUE
 skip-ndbcluster	VALUE
-old-log-format	VALUE
+log-output	VALUE
 START INSTANCE mysqld2;
 STOP INSTANCE mysqld2;
 SHOW mysqld1 LOG FILES;

--- 1.57/mysql-test/mysql-test-run.pl	2006-01-23 14:31:46 +03:00
+++ 1.58/mysql-test/mysql-test-run.pl	2006-01-27 13:41:11 +03:00
@@ -1832,7 +1832,7 @@
 ;
 
     print OUT "nonguarded\n" if $instance->{'nonguarded'};
-    print OUT "old-log-format\n" if $instance->{'old_log_format'};
+    print OUT "log-output=FILE\n" if $instance->{'old_log_format'};
     print OUT "\n";
   }
 

--- 1.2/sql/log.h	2006-01-19 05:56:00 +03:00
+++ 1.3/sql/log.h	2006-01-27 13:41:11 +03:00
@@ -138,14 +138,10 @@
 */
 #define MAX_LOG_HANDLERS_NUM 3
 
-enum enum_printer
-{
-  NONE,
-  LEGACY,
-  CSV,
-  LEGACY_AND_CSV
-};
-
+/* log event handler flags */
+#define LOG_NONE       1
+#define LOG_FILE       2
+#define LOG_TABLE      4
 
 class Log_event;
 class Rows_log_event;
@@ -491,12 +487,12 @@
   bool reopen_log_table(uint log_type);
 
   /* we use this function to setup all enabled log event handlers */
-  int set_handlers(enum enum_printer error_log_printer,
-                   enum enum_printer slow_log_printer,
-                   enum enum_printer general_log_printer);
-  void init_error_log(enum enum_printer error_log_printer);
-  void init_slow_log(enum enum_printer slow_log_printer);
-  void init_general_log(enum enum_printer general_log_printer);
+  int set_handlers(uint error_log_printer,
+                   uint slow_log_printer,
+                   uint general_log_printer);
+  void init_error_log(uint error_log_printer);
+  void init_slow_log(uint slow_log_printer);
+  void init_general_log(uint general_log_printer);
  };
 
 #endif /* LOG_H */
Thread
bk commit into 5.1 tree (petr:1.2082)Petr Chardin27 Jan