[Commits] Rev 3808: MDEV-4786 - merge 10.0-monty - 10.0 in lp:~maria-captains/maria/10.0-serg

Sergey Vojtovich svoj at mariadb.org
Thu Aug 1 15:09:29 EEST 2013


At lp:~maria-captains/maria/10.0-serg

------------------------------------------------------------
revno: 3808
revision-id: svoj at mariadb.org-20130801120926-vlx272fuu5oucfos
parent: svoj at mariadb.org-20130801120413-ldyr9of2zs64ef61
committer: Sergey Vojtovich <svoj at mariadb.org>
branch nick: 10.0-serg
timestamp: Thu 2013-08-01 16:09:26 +0400
message:
  MDEV-4786 - merge 10.0-monty - 10.0
  
  Fixed main.partition_open_files_limit, innodb.innodb_bug12400341 failures.
  
  These testcases use --max-connections=N command line option, which
  was declared PARSE_EARLY during the merge. Embedded didn't handle
  early options and failed to start due to unknown command line
  option.
  
  libmysqld/lib_sql.cc:
    Let embedded handle early options.
  sql/mysqld.cc:
    Moved handling of early options to a separate function.
  sql/mysqld.h:
    Moved handling of early options to a separate function.
=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc	2013-07-30 19:42:16 +0000
+++ b/libmysqld/lib_sql.cc	2013-08-01 12:09:26 +0000
@@ -542,6 +542,10 @@ int init_embedded_server(int argc, char
   system_charset_info= &my_charset_utf8_general_ci;
   sys_var_init();
 
+  int ho_error= handle_early_options();
+  if (ho_error != 0)
+    return 1;
+
   if (init_common_variables())
   {
     mysql_server_end();

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2013-07-31 13:04:14 +0000
+++ b/sql/mysqld.cc	2013-08-01 12:09:26 +0000
@@ -5038,24 +5038,12 @@ int mysqld_main(int argc, char **argv)
 
   sys_var_init();
 
+#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
   /*
-    The performance schema needs to be initialized as early as possible,
-    before to-be-instrumented objects of the server are initialized.
+    Initialize the array of performance schema instrument configurations.
   */
-  int ho_error;
-  DYNAMIC_ARRAY all_early_options;
-
-  my_getopt_register_get_addr(NULL);
-  /* Skip unknown options so that they may be processed later */
-  my_getopt_skip_unknown= TRUE;
-
-  /* prepare all_early_options array */
-  my_init_dynamic_array(&all_early_options, sizeof(my_option), 100, 25, MYF(0));
-  add_many_options(&all_early_options, pfs_early_options,
-                  array_elements(pfs_early_options));
-  sys_var_add_options(&all_early_options, sys_var::PARSE_EARLY);
-  add_terminator(&all_early_options);
-
+  init_pfs_instrument_array();
+#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
   /*
     Logs generated while parsing the command line
     options are buffered and printed later.
@@ -5065,23 +5053,11 @@ int mysqld_main(int argc, char **argv)
   my_charset_error_reporter= buffered_option_error_reporter;
   pfs_param.m_pfs_instrument= const_cast<char*>("");
 
-#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
-  /*
-    Initialize the array of performance schema instrument configurations.
-  */
-  init_pfs_instrument_array();
-#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
+  int ho_error= handle_early_options();
 
-  ho_error= handle_options(&remaining_argc, &remaining_argv,
-                           (my_option*)(all_early_options.buffer),
-                           mysqld_get_one_option);
-  delete_dynamic(&all_early_options);
 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
   if (ho_error == 0)
   {
-    /* Add back the program name handle_options removes */
-    remaining_argc++;
-    remaining_argv--;
     if (pfs_param.m_enabled  && !opt_help && !opt_bootstrap)
     {
       /* Add sizing hints from the server sizing parameters. */
@@ -6514,6 +6490,51 @@ pthread_handler_t handle_connections_sha
   Handle start options
 ******************************************************************************/
 
+
+/**
+  Process command line options flagged as 'early'.
+  Some components needs to be initialized as early as possible,
+  because the rest of the server initialization depends on them.
+  Options that needs to be parsed early includes:
+  - the performance schema, when compiled in,
+  - options related to the help,
+  - options related to the bootstrap
+  The performance schema needs to be initialized as early as possible,
+  before to-be-instrumented objects of the server are initialized.
+*/
+
+int handle_early_options()
+{
+  int ho_error;
+  DYNAMIC_ARRAY all_early_options;
+
+  my_getopt_register_get_addr(NULL);
+  /* Skip unknown options so that they may be processed later */
+  my_getopt_skip_unknown= TRUE;
+
+  /* prepare all_early_options array */
+  my_init_dynamic_array(&all_early_options, sizeof(my_option), 100, 25, MYF(0));
+  add_many_options(&all_early_options, pfs_early_options,
+                  array_elements(pfs_early_options));
+  sys_var_add_options(&all_early_options, sys_var::PARSE_EARLY);
+  add_terminator(&all_early_options);
+
+  ho_error= handle_options(&remaining_argc, &remaining_argv,
+                           (my_option*)(all_early_options.buffer),
+                           mysqld_get_one_option);
+  if (ho_error == 0)
+  {
+    /* Add back the program name handle_options removes */
+    remaining_argc++;
+    remaining_argv--;
+  }
+
+  delete_dynamic(&all_early_options);
+
+  return ho_error;
+}
+
+
 /**
   System variables are automatically command-line options (few
   exceptions are documented in sys_var.h), so don't need
@@ -8346,6 +8367,7 @@ mysqld_get_one_option(int optid,
     break;
   case OPT_PFS_INSTRUMENT:
 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
+#ifndef EMBEDDED_LIBRARY
     /* Parse instrument name and value from argument string */
     char* name = argument,*p, *val;
 
@@ -8409,6 +8431,7 @@ mysqld_get_one_option(int optid,
                              "'%s'", argument);
       return 0;
     }
+#endif /* EMBEDDED_LIBRARY */
 #endif
     break;
   }

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2013-07-21 14:39:19 +0000
+++ b/sql/mysqld.h	2013-08-01 12:09:26 +0000
@@ -203,6 +203,7 @@ extern handlerton *myisam_hton;
 extern handlerton *heap_hton;
 extern const char *load_default_groups[];
 extern struct my_option my_long_options[];
+int handle_early_options();
 extern int mysqld_server_started, mysqld_server_initialized;
 extern "C" MYSQL_PLUGIN_IMPORT int orig_argc;
 extern "C" MYSQL_PLUGIN_IMPORT char **orig_argv;



More information about the commits mailing list