List:Commits« Previous MessageNext Message »
From:tomas Date:May 10 2007 12:56pm
Subject:bk commit into 5.1 tree (tomas:1.2509)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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@stripped, 2007-05-10 14:56:02+02:00, tomas@stripped +9 -0
  Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-telco-merge
  into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-telco-batch-slave
  MERGE: 1.2503.1.27

  mysql-test/mysql-test-run.pl@stripped, 2007-05-10 14:52:19+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.282.1.3

  mysql-test/t/disabled.def@stripped, 2007-05-10 14:52:19+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.252.1.2

  sql/ha_ndbcluster.cc@stripped, 2007-05-10 14:52:19+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.456.1.5

  sql/ha_ndbcluster.h@stripped, 2007-05-10 14:52:20+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.177.1.1

  sql/mysql_priv.h@stripped, 2007-05-10 14:52:20+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.501.1.4

  sql/mysqld.cc@stripped, 2007-05-10 14:52:20+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.639.1.2

  sql/set_var.cc@stripped, 2007-05-10 14:55:59+02:00, tomas@stripped +2 -2
    manual merge
    MERGE: 1.229.1.1

  storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp@stripped, 2007-05-10 14:52:20+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.162.1.5

  storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp@stripped, 2007-05-10 14:52:20+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.79.1.9

# 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:	tomas
# Host:	whalegate.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-telco-batch-slave/RESYNC

--- 1.505/sql/mysql_priv.h	2007-05-07 21:32:03 +02:00
+++ 1.506/sql/mysql_priv.h	2007-05-10 14:52:20 +02:00
@@ -357,7 +357,11 @@
   fulltext functions when reading from it.
 */
 #define TMP_TABLE_FORCE_MYISAM          (ULL(1) << 32)
-
+/*
+  Dont report errors for individual rows,
+  But just report error on commit (or read ofcourse)
+*/
+#define OPTION_ALLOW_BATCH              (ULL(1) << 33) // THD, intern (slave)
 
 /*
   Maximum length of time zone name that we support
@@ -1634,6 +1638,7 @@
 extern ulong slow_launch_threads, slow_launch_time;
 extern ulong table_cache_size, table_def_size;
 extern ulong max_connections,max_connect_errors, connect_timeout;
+extern my_bool slave_allow_batching;
 extern ulong slave_net_timeout, slave_trans_retries;
 extern uint max_user_connections;
 extern ulong what_to_log,flush_time;

--- 1.641/sql/mysqld.cc	2007-05-07 21:55:50 +02:00
+++ 1.642/sql/mysqld.cc	2007-05-10 14:52:20 +02:00
@@ -30,22 +30,13 @@
 
 #include "rpl_injector.h"
 
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-#define OPT_INNODB_DEFAULT 1
-#else
-#define OPT_INNODB_DEFAULT 0
-#endif
-#define OPT_BDB_DEFAULT 0
 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
-#define OPT_NDBCLUSTER_DEFAULT 0
 #if defined(NOT_ENOUGH_TESTED) \
   && defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
 #define OPT_NDB_SHM_DEFAULT 1
 #else
 #define OPT_NDB_SHM_DEFAULT 0
 #endif
-#else
-#define OPT_NDBCLUSTER_DEFAULT 0
 #endif
 
 #ifndef DEFAULT_SKIP_THREAD_PRIORITY
@@ -322,7 +313,6 @@
 static bool volatile select_thread_in_use, signal_thread_in_use;
 static bool volatile ready_to_exit;
 static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
-static my_bool opt_ndbcluster;
 static my_bool opt_short_log_format= 0;
 static uint kill_cached_threads, wake_thread;
 static ulong killed_threads, thread_created;
@@ -366,7 +356,6 @@
 my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
 my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
 my_bool opt_log_slave_updates= 0;
-my_bool	opt_innodb;
 bool slave_warning_issued = false; 
 
 /*
@@ -376,49 +365,10 @@
 handlerton *myisam_hton;
 handlerton *partition_hton;
 
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-extern ulong innobase_fast_shutdown;
-extern ulong innobase_large_page_size;
-extern char *innobase_home, *innobase_tmpdir, *innobase_logdir;
-extern long innobase_lock_scan_time;
-extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
-extern longlong innobase_log_file_size;
-extern long innobase_log_buffer_size;
-extern longlong innobase_buffer_pool_size;
-extern long innobase_additional_mem_pool_size;
-extern long innobase_file_io_threads, innobase_lock_wait_timeout;
-extern long innobase_force_recovery;
-extern long innobase_open_files;
-extern char *innobase_data_home_dir, *innobase_data_file_path;
-extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;
-extern char *innobase_unix_file_flush_method;
-/* The following variables have to be my_bool for SHOW VARIABLES to work */
-extern my_bool innobase_log_archive,
-               innobase_use_doublewrite,
-               innobase_use_checksums,
-               innobase_use_large_pages,
-               innobase_use_native_aio,
-               innobase_file_per_table, innobase_locks_unsafe_for_binlog,
-               innobase_rollback_on_timeout,
-               innobase_stats_on_metadata,
-               innobase_create_status_file;
-extern "C" {
-extern ulong srv_max_buf_pool_modified_pct;
-extern ulong srv_max_purge_lag;
-extern ulong srv_auto_extend_increment;
-extern ulong srv_n_spin_wait_rounds;
-extern ulong srv_n_free_tickets_to_enter;
-extern ulong srv_thread_sleep_delay;
-extern ulong srv_thread_concurrency;
-extern ulong srv_commit_concurrency;
-extern ulong srv_flush_log_at_trx_commit;
-}
-#endif
-
 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
 const char *opt_ndbcluster_connectstring= 0;
 const char *opt_ndb_connectstring= 0;
-char opt_ndb_constrbuf[1024];
+char opt_ndb_constrbuf[1024]= {0};
 unsigned opt_ndb_constrbuf_len= 0;
 my_bool	opt_ndb_shm, opt_ndb_optimized_node_selection;
 ulong opt_ndb_cache_check_time, opt_ndb_wait_connected;
@@ -456,7 +406,7 @@
 my_bool sp_automatic_privileges= 1;
 
 ulong opt_binlog_rows_event_max_size;
-const char *binlog_format_names[]= {"STATEMENT", "ROW", "MIXED", NullS};
+const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS};
 TYPELIB binlog_format_typelib=
   { array_elements(binlog_format_names) - 1, "",
     binlog_format_names, NULL };
@@ -602,6 +552,7 @@
 pthread_mutex_t LOCK_des_key_file;
 #endif
 rw_lock_t	LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
+rw_lock_t	LOCK_system_variables_hash;
 pthread_cond_t COND_refresh, COND_thread_count, COND_global_read_lock;
 pthread_t signal_thread;
 pthread_attr_t connection_attrib;
@@ -633,6 +584,7 @@
 static char *opt_update_logname, *opt_binlog_index_name;
 static char *opt_tc_heuristic_recover;
 static char *mysql_home_ptr, *pidfile_name_ptr;
+static int defaults_argc;
 static char **defaults_argv;
 static char *opt_bin_logname;
 
@@ -725,7 +677,8 @@
 
 pthread_handler_t signal_hand(void *arg);
 static void mysql_init_variables(void);
-static void get_options(int argc,char **argv);
+static void get_options(int *argc,char **argv);
+static my_bool get_one_option(int, const struct my_option *, char *);
 static void set_server_version(void);
 static int init_thread_environment();
 static char *get_relative_path(const char *path);
@@ -748,6 +701,7 @@
 static int test_if_case_insensitive(const char *dir_name);
 
 #ifndef EMBEDDED_LIBRARY
+static void usage(void);
 static void start_signal_handler(void);
 static void close_server_sock();
 static void clean_up_mutexes(void);
@@ -1173,6 +1127,8 @@
   DBUG_ENTER("unireg_abort");
   if (exit_code)
     sql_print_error("Aborting\n");
+  else if (opt_help)
+    usage();
   clean_up(exit_code || !opt_bootstrap); /* purecov: inspected */
   DBUG_PRINT("quit",("done with cleanup in unireg_abort"));
   wait_for_signal_thread_to_end();
@@ -1358,6 +1314,7 @@
   (void) rwlock_destroy(&LOCK_sys_init_connect);
   (void) rwlock_destroy(&LOCK_sys_init_slave);
   (void) pthread_mutex_destroy(&LOCK_global_system_variables);
+  (void) rwlock_destroy(&LOCK_system_variables_hash);
   (void) pthread_mutex_destroy(&LOCK_global_read_lock);
   (void) pthread_mutex_destroy(&LOCK_uuid_generator);
   (void) pthread_mutex_destroy(&LOCK_prepared_stmt_count);
@@ -1376,6 +1333,7 @@
 ** Init IP and UNIX socket
 ****************************************************************************/
 
+#ifndef EMBEDDED_LIBRARY
 static void set_ports()
 {
   char	*env;
@@ -1400,7 +1358,6 @@
   }
 }
 
-#ifndef EMBEDDED_LIBRARY
 /* Change to run as another user if started with --user */
 
 static struct passwd *check_user(const char *user)
@@ -2358,7 +2315,7 @@
   sigaddset(&set,SIGTSTP);
 #endif
   if (thd_lib_detected != THD_LIB_LT)
-    sigaddset(&set,THR_SERVER_ALARM);
+  sigaddset(&set,THR_SERVER_ALARM);
   if (test_flags & TEST_SIGINT)
   {
     // May be SIGINT
@@ -2659,16 +2616,18 @@
 }
 #endif
 
+#if !defined(EMBEDDED_LIBRARY)
 static const char *load_default_groups[]= {
 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
 "mysql_cluster",
 #endif
 "mysqld","server", MYSQL_BASE_VERSION, 0, 0};
 
-#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
+#if defined(__WIN__)
 static const int load_default_groups_sz=
 sizeof(load_default_groups)/sizeof(load_default_groups[0]);
 #endif
+#endif /*!EMBEDDED_LIBRARY*/
 
 
 /*
@@ -2716,7 +2675,7 @@
 static int init_common_variables(const char *conf_file_name, int argc,
 				 char **argv, const char **groups)
 {
-  char buff[FN_REFLEN];
+  char buff[FN_REFLEN], *s;
   umask(((~my_umask) & 0666));
   my_decimal_set_zero(&decimal_zero); // set decimal_zero constant;
   tzset();			// Set tzname
@@ -2768,7 +2727,7 @@
     strmake(pidfile_name, STRING_WITH_LEN("mysql"));
   }
   else
-    strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
+  strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
   strmov(fn_ext(pidfile_name),".pid");		// Add proper extension
 
   /*
@@ -2782,7 +2741,8 @@
 
   load_defaults(conf_file_name, groups, &argc, &argv);
   defaults_argv=argv;
-  get_options(argc,argv);
+  defaults_argc=argc;
+  get_options(&defaults_argc, defaults_argv);
   set_server_version();
 
   DBUG_PRINT("info",("%s  Ver %s for %s on %s\n",my_progname,
@@ -2794,10 +2754,6 @@
   {
       my_use_large_pages= 1;
       my_large_page_size= opt_large_page_size;
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-      innobase_use_large_pages= 1;
-      innobase_large_page_size= opt_large_page_size;
-#endif
   }
 #endif /* HAVE_LARGE_PAGES */
 
@@ -2860,7 +2816,12 @@
   if (item_create_init())
     return 1;
   item_init();
-  set_var_init();
+  if (set_var_init())
+    return 1;
+#ifdef HAVE_REPLICATION
+  if (init_replication_sys_vars())
+    return 1;
+#endif
   mysys_uses_curses=0;
 #ifdef USE_REGEX
   my_regex_init(&my_charset_latin1);
@@ -2957,15 +2918,13 @@
                       "--log-slow-queries option, log tables are used. "
                       "To enable logging to files use the --log-output option.");
 
-  if (!opt_logname)
-    opt_logname= make_default_log_name(buff, ".log");
-  sys_var_general_log_path.value= my_strdup(opt_logname, MYF(0));
-  sys_var_general_log_path.value_length= strlen(opt_logname);
-
-  if (!opt_slow_logname)
-    opt_slow_logname= make_default_log_name(buff, "-slow.log");
-  sys_var_slow_log_path.value= my_strdup(opt_slow_logname, MYF(0));
-  sys_var_slow_log_path.value_length= strlen(opt_slow_logname);
+  s= opt_logname ? opt_logname : make_default_log_name(buff, ".log");
+  sys_var_general_log_path.value= my_strdup(s, MYF(0));
+  sys_var_general_log_path.value_length= strlen(s);
+
+  s= opt_slow_logname ? opt_slow_logname : make_default_log_name(buff, "-slow.log");
+  sys_var_slow_log_path.value= my_strdup(s, MYF(0));
+  sys_var_slow_log_path.value_length= strlen(s);
 
   if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
     return 1;
@@ -3044,6 +3003,7 @@
   (void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
   (void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
   (void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
+  (void) my_rwlock_init(&LOCK_system_variables_hash, NULL);
   (void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST);
   (void) pthread_mutex_init(&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST);
   (void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST);
@@ -3231,8 +3191,12 @@
 
   /* Setup logs */
 
-  /* enable old-fashioned error log */
-  if (opt_error_log)
+  /*
+    Enable old-fashioned error log, except when the user has requested
+    help information. Since the implementation of plugin server
+    variables the help output is now written much later.
+  */
+  if (opt_error_log && !opt_help)
   {
     if (!log_error_file_ptr[0])
       fn_format(log_error_file, pidfile_name, mysql_data_home, ".err",
@@ -3318,13 +3282,13 @@
   }
   if (!opt_bin_log)
     if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC)
-    {
-      sql_print_error("You need to use --log-bin to make "
-		      "--binlog-format work.");
-      unireg_abort(1);
-    }
+  {
+    sql_print_error("You need to use --log-bin to make "
+                    "--binlog-format work.");
+    unireg_abort(1);
+  }
     else
-    {
+  {
       global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC;
     }
   else
@@ -3333,7 +3297,7 @@
     else
     { 
       DBUG_ASSERT(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC);
-    }
+  }
 
   /* Check that we have not let the format to unspecified at this point */
   DBUG_ASSERT((uint)global_system_variables.binlog_format <=
@@ -3387,12 +3351,51 @@
     using_update_log=1;
   }
 
-  if (plugin_init(opt_bootstrap))
+  if (plugin_init(&defaults_argc, defaults_argv,
+                  (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
+                  (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
   {
-    sql_print_error("Failed to init plugins.");
-    return 1;
+    sql_print_error("Failed to initialize plugins.");
+    unireg_abort(1);
   }
 
+  if (opt_help)
+    unireg_abort(0);
+
+  /* we do want to exit if there are any other unknown options */
+  if (defaults_argc > 1)
+  {
+    int ho_error;
+    char **tmp_argv= defaults_argv;
+    struct my_option no_opts[]=
+    {
+      {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+    };
+    /*
+      We need to eat any 'loose' arguments first before we conclude
+      that there are unprocessed options.
+      But we need to preserve defaults_argv pointer intact for
+      free_defaults() to work. Thus we use a copy here.
+    */
+    my_getopt_skip_unknown= 0;
+
+    if ((ho_error= handle_options(&defaults_argc, &tmp_argv, no_opts,
+                                  get_one_option)))
+      unireg_abort(ho_error);
+
+    if (defaults_argc)
+    {
+      fprintf(stderr, "%s: Too many arguments (first extra is '%s').\n"
+              "Use --verbose --help to get a list of available options\n",
+              my_progname, *tmp_argv);
+      unireg_abort(1);
+    }
+  }
+
+  /* if the errmsg.sys is not loaded, terminate to maintain behaviour */
+  if (!errmesg[0][0])
+    unireg_abort(1);
+
   /* We have to initialize the storage engines before CSV logging */
   if (ha_init())
   {
@@ -3421,7 +3424,8 @@
   else
   {
     /* fall back to the log files if tables are not present */
-    if (have_csv_db == SHOW_OPTION_NO)
+    LEX_STRING csv_name={C_STRING_WITH_LEN("csv")};
+    if (!plugin_is_ready(&csv_name, MYSQL_STORAGE_ENGINE_PLUGIN))
     {
       /* purecov: begin inspected */
       sql_print_error("CSV engine is not present, falling back to the "
@@ -3441,11 +3445,16 @@
   /*
     Check that the default storage engine is actually available.
   */
+  if (default_storage_engine_str)
   {
     LEX_STRING name= { default_storage_engine_str,
                        strlen(default_storage_engine_str) };
-    handlerton *hton= ha_resolve_by_name(0, &name);
-    if (hton == NULL)
+    plugin_ref plugin;
+    handlerton *hton;
+    
+    if ((plugin= ha_resolve_by_name(0, &name)))
+      hton= plugin_data(plugin, handlerton*);
+    else
     {
       sql_print_error("Unknown/unsupported table type: %s",
                       default_storage_engine_str);
@@ -3459,9 +3468,17 @@
                         default_storage_engine_str);
         unireg_abort(1);
       }
-      hton= myisam_hton;
+      DBUG_ASSERT(global_system_variables.table_plugin);
+    }
+    else
+    {
+      /*
+        Need to unlock as global_system_variables.table_plugin 
+        was acquired during plugin_init()
+      */
+      plugin_unlock(0, global_system_variables.table_plugin);
+      global_system_variables.table_plugin= plugin;
     }
-    global_system_variables.table_type= hton;
   }
 
   tc_log= (total_ha_2pc > 1 ? (opt_bin_log  ?
@@ -3738,7 +3755,7 @@
     We have enough space for fiddling with the argv, continue
   */
   check_data_home(mysql_real_data_home);
-  if (my_setwd(mysql_real_data_home,MYF(MY_WME)))
+  if (my_setwd(mysql_real_data_home,MYF(MY_WME)) && !opt_help)
     unireg_abort(1);				/* purecov: inspected */
   mysql_data_home= mysql_data_home_buff;
   mysql_data_home[0]=FN_CURLIB;		// all paths are relative from here
@@ -4872,11 +4889,6 @@
   OPT_STORAGE_ENGINE,          OPT_INIT_FILE,
   OPT_DELAY_KEY_WRITE_ALL,     OPT_SLOW_QUERY_LOG,
   OPT_DELAY_KEY_WRITE,	       OPT_CHARSETS_DIR,
-  OPT_BDB_HOME,                OPT_BDB_LOG,
-  OPT_BDB_TMP,                 OPT_BDB_SYNC,
-  OPT_BDB_LOCK,                OPT_BDB,
-  OPT_BDB_NO_RECOVER,          OPT_BDB_SHARED,
-  OPT_BDB_DATA_DIRECT,         OPT_BDB_LOG_DIRECT,
   OPT_MASTER_HOST,             OPT_MASTER_USER,
   OPT_MASTER_PASSWORD,         OPT_MASTER_PORT,
   OPT_MASTER_INFO_FILE,        OPT_MASTER_CONNECT_RETRY,
@@ -4895,28 +4907,14 @@
   OPT_WANT_CORE,               OPT_CONCURRENT_INSERT,
   OPT_MEMLOCK,                 OPT_MYISAM_RECOVER,
   OPT_REPLICATE_REWRITE_DB,    OPT_SERVER_ID,
-  OPT_SKIP_SLAVE_START,        OPT_SKIP_INNOBASE,
+  OPT_SKIP_SLAVE_START,        OPT_SAFE_SHOW_DB, 
   OPT_SAFEMALLOC_MEM_LIMIT,    OPT_REPLICATE_DO_TABLE,
   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_INNODB_DATA_HOME_DIR,
-  OPT_INNODB_DATA_FILE_PATH,
-  OPT_INNODB_LOG_GROUP_HOME_DIR,
-  OPT_INNODB_LOG_ARCH_DIR,
-  OPT_INNODB_LOG_ARCHIVE,
-  OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
-  OPT_INNODB_FLUSH_METHOD,
-  OPT_INNODB_DOUBLEWRITE,
-  OPT_INNODB_CHECKSUMS,
-  OPT_INNODB_FAST_SHUTDOWN,
-  OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB,
-  OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
   OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
-  OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG,
-  OPT_INNODB, OPT_ISAM,
-  OPT_ENGINE_CONDITION_PUSHDOWN, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, 
+  OPT_ENGINE_CONDITION_PUSHDOWN, OPT_NDB_CONNECTSTRING, 
   OPT_NDB_USE_EXACT_COUNT, OPT_NDB_USE_TRANSACTIONS,
   OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
   OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME,
@@ -4981,34 +4979,6 @@
   OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
   OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
   OPT_WAIT_TIMEOUT, OPT_MYISAM_REPAIR_THREADS,
-  OPT_INNODB_MIRRORED_LOG_GROUPS,
-  OPT_INNODB_LOG_FILES_IN_GROUP,
-  OPT_INNODB_LOG_FILE_SIZE,
-  OPT_INNODB_LOG_BUFFER_SIZE,
-  OPT_INNODB_BUFFER_POOL_SIZE,
-  OPT_INNODB_BUFFER_POOL_AWE_MEM_MB,
-  OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE,
-  OPT_INNODB_MAX_PURGE_LAG,
-  OPT_INNODB_FILE_IO_THREADS,
-  OPT_INNODB_LOCK_WAIT_TIMEOUT,
-  OPT_INNODB_THREAD_CONCURRENCY,
-  OPT_INNODB_COMMIT_CONCURRENCY,
-  OPT_INNODB_FORCE_RECOVERY,
-  OPT_INNODB_STATUS_FILE,
-  OPT_INNODB_MAX_DIRTY_PAGES_PCT,
-  OPT_INNODB_TABLE_LOCKS,
-  OPT_INNODB_SUPPORT_XA,
-  OPT_INNODB_OPEN_FILES,
-  OPT_INNODB_AUTOEXTEND_INCREMENT,
-  OPT_INNODB_SYNC_SPIN_LOOPS,
-  OPT_INNODB_CONCURRENCY_TICKETS,
-  OPT_INNODB_THREAD_SLEEP_DELAY,
-  OPT_INNODB_STATS_ON_METADATA,
-  OPT_BDB_CACHE_SIZE,
-  OPT_BDB_CACHE_PARTS,
-  OPT_BDB_LOG_BUFFER_SIZE,
-  OPT_BDB_MAX_LOCK,
-  OPT_BDB_REGION_SIZE,
   OPT_ERROR_LOG_FILE,
   OPT_DEFAULT_WEEK_FORMAT,
   OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS,
@@ -5018,7 +4988,6 @@
   OPT_SYNC_REPLICATION,
   OPT_SYNC_REPLICATION_SLAVE_ID,
   OPT_SYNC_REPLICATION_TIMEOUT,
-  OPT_BDB_NOSYNC,
   OPT_ENABLE_SHARED_MEMORY,
   OPT_SHARED_MEMORY_BASE_NAME,
   OPT_OLD_PASSWORDS,
@@ -5049,12 +5018,12 @@
   OPT_OLD_STYLE_USER_LIMITS,
   OPT_LOG_SLOW_ADMIN_STATEMENTS,
   OPT_TABLE_LOCK_WAIT_TIMEOUT,
+  OPT_PLUGIN_LOAD,
   OPT_PLUGIN_DIR,
   OPT_LOG_OUTPUT,
   OPT_PORT_OPEN_TIMEOUT,
   OPT_GENERAL_LOG,
   OPT_SLOW_LOG,
-  OPT_MERGE,
   OPT_THREAD_HANDLING,
   OPT_INNODB_ROLLBACK_ON_TIMEOUT,
   OPT_SECURE_FILE_PRIV,
@@ -5121,8 +5090,7 @@
    " to 'row' and back implicitly per each query accessing a NDB table."
 #endif
    ,(gptr*) &opt_binlog_format, (gptr*) &opt_binlog_format,
-   0, GET_STR, REQUIRED_ARG, BINLOG_FORMAT_MIXED, BINLOG_FORMAT_STMT,
-   BINLOG_FORMAT_MIXED, 0, 0, 0},
+   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"binlog-do-db", OPT_BINLOG_DO_DB,
    "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -5276,98 +5244,6 @@
   {"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to this master",
    (gptr*) &opt_init_slave, (gptr*) &opt_init_slave, 0, GET_STR_ALLOC,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"innodb", OPT_INNODB, "Enable InnoDB (if this version of MySQL supports it). \
-Disable with --skip-innodb (will save memory).",
-   (gptr*) &opt_innodb, (gptr*) &opt_innodb, 0, GET_BOOL, NO_ARG, OPT_INNODB_DEFAULT, 0, 0,
-   0, 0, 0},
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-  {"innodb_checksums", OPT_INNODB_CHECKSUMS, "Enable InnoDB checksums validation (enabled by default). \
-Disable with --skip-innodb-checksums.", (gptr*) &innobase_use_checksums,
-   (gptr*) &innobase_use_checksums, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
-#endif
-  {"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH,
-   "Path to individual files and their sizes.",
-   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-  {"innodb_data_home_dir", OPT_INNODB_DATA_HOME_DIR,
-   "The common part for InnoDB table spaces.", (gptr*) &innobase_data_home_dir,
-   (gptr*) &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0,
-   0},
-  {"innodb_doublewrite", OPT_INNODB_DOUBLEWRITE, "Enable InnoDB doublewrite buffer (enabled by default). \
-Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
-   (gptr*) &innobase_use_doublewrite, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
-  {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN,
-   "Speeds up the shutdown process of the InnoDB storage engine. Possible "
-   "values are 0, 1 (faster)"
-   /*
-     NetWare can't close unclosed files, can't automatically kill remaining
-     threads, etc, so on this OS we disable the crash-like InnoDB shutdown.
-   */
-#ifndef __NETWARE__
-   " or 2 (fastest - crash-like)"
-#endif
-   ".",
-   (gptr*) &innobase_fast_shutdown,
-   (gptr*) &innobase_fast_shutdown, 0, GET_ULONG, OPT_ARG, 1, 0,
-   IF_NETWARE(1,2), 0, 0, 0},
-  {"innodb_file_per_table", OPT_INNODB_FILE_PER_TABLE,
-   "Stores each InnoDB table to an .ibd file in the database dir.",
-   (gptr*) &innobase_file_per_table,
-   (gptr*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"innodb_flush_log_at_trx_commit", OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
-   "Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second).",
-   (gptr*) &srv_flush_log_at_trx_commit,
-   (gptr*) &srv_flush_log_at_trx_commit,
-   0, GET_ULONG, OPT_ARG,  1, 0, 2, 0, 0, 0},
-  {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
-   "With which method to flush data.", (gptr*) &innobase_unix_file_flush_method,
-   (gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
-   0, 0, 0},
-  {"innodb_locks_unsafe_for_binlog", OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
-   "Force InnoDB to not use next-key locking, to use only row-level locking.",
-   (gptr*) &innobase_locks_unsafe_for_binlog,
-   (gptr*) &innobase_locks_unsafe_for_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"innodb_log_arch_dir", OPT_INNODB_LOG_ARCH_DIR,
-   "Where full logs should be archived.", (gptr*) &innobase_log_arch_dir,
-   (gptr*) &innobase_log_arch_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"innodb_log_archive", OPT_INNODB_LOG_ARCHIVE,
-   "Set to 1 if you want to have logs archived.", 0, 0, 0, GET_LONG, OPT_ARG,
-   0, 0, 0, 0, 0, 0},
-  {"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR,
-   "Path to InnoDB log files.", (gptr*) &innobase_log_group_home_dir,
-   (gptr*) &innobase_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
-   0, 0},
-  {"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT,
-   "Percentage of dirty pages allowed in bufferpool.", (gptr*) &srv_max_buf_pool_modified_pct,
-   (gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0},
-  {"innodb_max_purge_lag", OPT_INNODB_MAX_PURGE_LAG,
-   "Desired maximum length of the purge queue (0 = no limit)",
-   (gptr*) &srv_max_purge_lag,
-   (gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L,
-   0, 1L, 0},
-  {"innodb_rollback_on_timeout", OPT_INNODB_ROLLBACK_ON_TIMEOUT,
-   "Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)",
-   (gptr*) &innobase_rollback_on_timeout, (gptr*) &innobase_rollback_on_timeout,
-   0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"innodb_status_file", OPT_INNODB_STATUS_FILE,
-   "Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
-   (gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file,
-   0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"innodb_stats_on_metadata", OPT_INNODB_STATS_ON_METADATA,
-   "Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)",
-   (gptr*) &innobase_stats_on_metadata, (gptr*) &innobase_stats_on_metadata,
-   0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
-  {"innodb_support_xa", OPT_INNODB_SUPPORT_XA,
-   "Enable InnoDB support for the XA two-phase commit",
-   (gptr*) &global_system_variables.innodb_support_xa,
-   (gptr*) &global_system_variables.innodb_support_xa,
-   0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
-  {"innodb_table_locks", OPT_INNODB_TABLE_LOCKS,
-   "Enable InnoDB locking in LOCK TABLES",
-   (gptr*) &global_system_variables.innodb_table_locks,
-   (gptr*) &global_system_variables.innodb_table_locks,
-   0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
-#endif /* End WITH_INNOBASE_STORAGE_ENGINE */
    {"language", 'L',
    "Client error messages in given language. May be given as a full path.",
    (gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG,
@@ -5546,10 +5422,6 @@
    "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
    (gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
    GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"ndbcluster", OPT_NDBCLUSTER, "Enable NDB Cluster (if this version of MySQL supports it). \
-Disable with --skip-ndbcluster (will save memory).",
-   (gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG,
-   OPT_NDBCLUSTER_DEFAULT, 0, 0, 0, 0, 0},
 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
   {"ndb-connectstring", OPT_NDB_CONNECTSTRING,
    "Connect string for ndbcluster.",
@@ -6018,84 +5890,6 @@
     (gptr*) &global_system_variables.group_concat_max_len,
     (gptr*) &max_system_variables.group_concat_max_len, 0, GET_ULONG,
     REQUIRED_ARG, 1024, 4, (long) ~0, 0, 1, 0},
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-  {"innodb_additional_mem_pool_size", OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE,
-   "Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.",
-   (gptr*) &innobase_additional_mem_pool_size,
-   (gptr*) &innobase_additional_mem_pool_size, 0, GET_LONG, REQUIRED_ARG,
-   1*1024*1024L, 512*1024L, ~0L, 0, 1024, 0},
-  {"innodb_autoextend_increment", OPT_INNODB_AUTOEXTEND_INCREMENT,
-   "Data file autoextend increment in megabytes",
-   (gptr*) &srv_auto_extend_increment,
-   (gptr*) &srv_auto_extend_increment,
-   0, GET_LONG, REQUIRED_ARG, 8L, 1L, 1000L, 0, 1L, 0},
-  {"innodb_buffer_pool_size", OPT_INNODB_BUFFER_POOL_SIZE,
-   "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
-   (gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0,
-   GET_LL, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 0,
-   1024*1024L, 0},
-  {"innodb_commit_concurrency", OPT_INNODB_COMMIT_CONCURRENCY,
-   "Helps in performance tuning in heavily concurrent environments.",
-   (gptr*) &srv_commit_concurrency, (gptr*) &srv_commit_concurrency,
-   0, GET_LONG, REQUIRED_ARG, 0, 0, 1000, 0, 1, 0},
-  {"innodb_concurrency_tickets", OPT_INNODB_CONCURRENCY_TICKETS,
-   "Number of times a thread is allowed to enter InnoDB within the same \
-    SQL query after it has once got the ticket",
-   (gptr*) &srv_n_free_tickets_to_enter,
-   (gptr*) &srv_n_free_tickets_to_enter,
-   0, GET_LONG, REQUIRED_ARG, 500L, 1L, ~0L, 0, 1L, 0},
-  {"innodb_file_io_threads", OPT_INNODB_FILE_IO_THREADS,
-   "Number of file I/O threads in InnoDB.", (gptr*) &innobase_file_io_threads,
-   (gptr*) &innobase_file_io_threads, 0, GET_LONG, REQUIRED_ARG, 4, 4, 64, 0,
-   1, 0},
-  {"innodb_force_recovery", OPT_INNODB_FORCE_RECOVERY,
-   "Helps to save your data in case the disk image of the database becomes corrupt.",
-   (gptr*) &innobase_force_recovery, (gptr*) &innobase_force_recovery, 0,
-   GET_LONG, REQUIRED_ARG, 0, 0, 6, 0, 1, 0},
-  {"innodb_lock_wait_timeout", OPT_INNODB_LOCK_WAIT_TIMEOUT,
-   "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back.",
-   (gptr*) &innobase_lock_wait_timeout, (gptr*) &innobase_lock_wait_timeout,
-   0, GET_LONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
-  {"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE,
-   "The size of the buffer which InnoDB uses to write log to the log files on disk.",
-   (gptr*) &innobase_log_buffer_size, (gptr*) &innobase_log_buffer_size, 0,
-   GET_LONG, REQUIRED_ARG, 1024*1024L, 256*1024L, ~0L, 0, 1024, 0},
-  {"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE,
-   "Size of each log file in a log group.",
-   (gptr*) &innobase_log_file_size, (gptr*) &innobase_log_file_size, 0,
-   GET_LL, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, LONGLONG_MAX, 0,
-   1024*1024L, 0},
-  {"innodb_log_files_in_group", OPT_INNODB_LOG_FILES_IN_GROUP,
-   "Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.",
-   (gptr*) &innobase_log_files_in_group, (gptr*) &innobase_log_files_in_group,
-   0, GET_LONG, REQUIRED_ARG, 2, 2, 100, 0, 1, 0},
-  {"innodb_mirrored_log_groups", OPT_INNODB_MIRRORED_LOG_GROUPS,
-   "Number of identical copies of log groups we keep for the database. Currently this should be set to 1.",
-   (gptr*) &innobase_mirrored_log_groups,
-   (gptr*) &innobase_mirrored_log_groups, 0, GET_LONG, REQUIRED_ARG, 1, 1, 10,
-   0, 1, 0},
-  {"innodb_open_files", OPT_INNODB_OPEN_FILES,
-   "How many files at the maximum InnoDB keeps open at the same time.",
-   (gptr*) &innobase_open_files, (gptr*) &innobase_open_files, 0,
-   GET_LONG, REQUIRED_ARG, 300L, 10L, ~0L, 0, 1L, 0},
-  {"innodb_sync_spin_loops", OPT_INNODB_SYNC_SPIN_LOOPS,
-   "Count of spin-loop rounds in InnoDB mutexes",
-   (gptr*) &srv_n_spin_wait_rounds,
-   (gptr*) &srv_n_spin_wait_rounds,
-   0, GET_LONG, REQUIRED_ARG, 20L, 0L, ~0L, 0, 1L, 0},
-  {"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
-   "Helps in performance tuning in heavily concurrent environments. "
-   "Sets the maximum number of threads allowed inside InnoDB. Value 0"
-   " will disable the thread throttling.",
-   (gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency,
-   0, GET_LONG, REQUIRED_ARG, 8, 0, 1000, 0, 1, 0},
-  {"innodb_thread_sleep_delay", OPT_INNODB_THREAD_SLEEP_DELAY,
-   "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0"
-    " disable a sleep",
-   (gptr*) &srv_thread_sleep_delay,
-   (gptr*) &srv_thread_sleep_delay,
-   0, GET_LONG, REQUIRED_ARG, 10000L, 0L, ~0L, 0, 1L, 0},
-#endif /* WITH_INNOBASE_STORAGE_ENGINE */
   {"interactive_timeout", OPT_INTERACTIVE_TIMEOUT,
    "The number of seconds the server waits for activity on an interactive connection before closing it.",
    (gptr*) &global_system_variables.net_interactive_timeout,
@@ -6325,6 +6119,11 @@
    "Directory for plugins.",
    (gptr*) &opt_plugin_dir_ptr, (gptr*) &opt_plugin_dir_ptr, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"plugin_load", OPT_PLUGIN_LOAD,
+   "Optional colon separated list of plugins to load, where each plugin is "
+   "identified by name and path to library seperated by an equals.",
+   (gptr*) &opt_plugin_load, (gptr*) &opt_plugin_load, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
    {"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
     "The size of the buffer that is allocated when preloading indexes",
     (gptr*) &global_system_variables.preload_buff_size,
@@ -7105,6 +6904,7 @@
 	 server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
 }
 
+#ifndef EMBEDDED_LIBRARY
 static void usage(void)
 {
   if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
@@ -7140,17 +6940,17 @@
 #endif
   print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
   puts("");
-  fix_paths();
   set_ports();
 
-  my_print_help(my_long_options);
-  my_print_variables(my_long_options);
+  /* Print out all the options including plugin supplied options */
+  my_print_help_inc_plugins(my_long_options, sizeof(my_long_options)/sizeof(my_option));
 
   puts("\n\
 To see what values a running MySQL server is using, type\n\
 'mysqladmin variables' instead of 'mysqld --verbose --help'.\n");
   }
 }
+#endif /*!EMBEDDED_LIBRARY*/
 
 
 /*
@@ -7187,6 +6987,7 @@
   mqh_used= 0;
   segfaulted= kill_in_progress= 0;
   cleanup_done= 0;
+  defaults_argc= 0;
   defaults_argv= 0;
   server_id_supplied= 0;
   test_flags= select_errors= dropping_tables= ha_open_options=0;
@@ -7274,7 +7075,7 @@
   lc_time_names_name= (char*) "en_US";
   /* Set default values for some option variables */
   default_storage_engine_str= (char*) "MyISAM";
-  global_system_variables.table_type= myisam_hton;
+  global_system_variables.table_plugin= NULL;
   global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
   global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
   max_system_variables.select_limit=    (ulonglong) HA_POS_ERROR;
@@ -7295,36 +7096,13 @@
 			     "d:t:i:o,/tmp/mysqld.trace");
 #endif
   opt_error_log= IF_WIN(1,0);
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-  have_innodb= SHOW_OPTION_YES;
-#else
-  have_innodb= SHOW_OPTION_NO;
-#endif
-#ifdef WITH_CSV_STORAGE_ENGINE
-  have_csv_db= SHOW_OPTION_YES;
-#else
-  have_csv_db= SHOW_OPTION_NO;
-#endif
 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
-    have_ndbcluster= SHOW_OPTION_DISABLED;
-#else
-    have_ndbcluster= SHOW_OPTION_NO;
-#endif
-#ifdef WITH_PARTITION_STORAGE_ENGINE
-    have_partition_db= SHOW_OPTION_YES;
-#else
-    have_partition_db= SHOW_OPTION_NO;
-#endif
-#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
-  have_ndbcluster=SHOW_OPTION_DISABLED;
   global_system_variables.ndb_index_stat_enable=FALSE;
   max_system_variables.ndb_index_stat_enable=TRUE;
   global_system_variables.ndb_index_stat_cache_entries=32;
   max_system_variables.ndb_index_stat_cache_entries=~0L;
   global_system_variables.ndb_index_stat_update_freq=20;
   max_system_variables.ndb_index_stat_update_freq=~0L;
-#else
-  have_ndbcluster=SHOW_OPTION_NO;
 #endif
 #ifdef HAVE_OPENSSL
   have_ssl=SHOW_OPTION_YES;
@@ -7617,7 +7395,7 @@
 #endif
   case OPT_EVENT_SCHEDULER:
     if (Events::set_opt_event_scheduler(argument))
-      exit(1);
+	exit(1);
     break;
   case (int) OPT_SKIP_NEW:
     opt_specialflag|= SPECIAL_NO_NEW_FUNC;
@@ -7769,17 +7547,6 @@
     global_system_variables.tx_isolation= (type-1);
     break;
   }
-  case OPT_MERGE:
-  case OPT_BDB:
-    break;
-  case OPT_NDBCLUSTER:
-#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
-    if (opt_ndbcluster)
-      have_ndbcluster= SHOW_OPTION_YES;
-    else
-      have_ndbcluster= SHOW_OPTION_DISABLED;
-#endif
-    break;
 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
   case OPT_NDB_MGMD:
   case OPT_NDB_NODEID:
@@ -7818,24 +7585,6 @@
       ndb_extra_logging= atoi(argument);
     break;
 #endif
-  case OPT_INNODB:
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-    if (opt_innodb)
-      have_innodb= SHOW_OPTION_YES;
-    else
-      have_innodb= SHOW_OPTION_DISABLED;
-#endif
-    break;
-  case OPT_INNODB_DATA_FILE_PATH:
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-    innobase_data_file_path= argument;
-#endif
-    break;
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-  case OPT_INNODB_LOG_ARCHIVE:
-    innobase_log_archive= argument ? test(atoi(argument)) : 1;
-    break;
-#endif /* WITH_INNOBASE_STORAGE_ENGINE */
   case OPT_MYISAM_RECOVER:
   {
     if (!argument || !argument[0])
@@ -7966,7 +7715,7 @@
 }
 
 
-static void get_options(int argc,char **argv)
+static void get_options(int *argc,char **argv)
 {
   int ho_error;
 
@@ -7974,34 +7723,20 @@
   strmake(def_ft_boolean_syntax, ft_boolean_syntax,
 	  sizeof(ft_boolean_syntax)-1);
   my_getopt_error_reporter= option_error_reporter;
-  if ((ho_error= handle_options(&argc, &argv, my_long_options,
+
+  /* Skip unknown options so that they may be processed later by plugins */
+  my_getopt_skip_unknown= TRUE;
+
+  if ((ho_error= handle_options(argc, &argv, my_long_options,
                                 get_one_option)))
     exit(ho_error);
+  (*argc)++; /* add back one for the progname handle_options removes */
+             /* no need to do this for argv as we are discarding it. */
 
-#ifndef WITH_NDBCLUSTER_STORAGE_ENGINE
-  if (opt_ndbcluster)
-    sql_print_warning("this binary does not contain NDBCLUSTER storage engine");
-#endif
-#ifndef WITH_INNOBASE_STORAGE_ENGINE
-  if (opt_innodb)
-    sql_print_warning("this binary does not contain INNODB storage engine");
-#endif
   if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes) &&
       !opt_slow_log)
     sql_print_warning("options --log-slow-admin-statements and --log-queries-not-using-indexes have no effect if --log-slow-queries is not set");
 
-  if (argc > 0)
-  {
-    fprintf(stderr, "%s: Too many arguments (first extra is '%s').\nUse --help to get a list of available options\n", my_progname, *argv);
-    /* FIXME add EXIT_TOO_MANY_ARGUMENTS to "mysys_err.h" and return that code? */
-    exit(1);
-  }
-
-  if (opt_help)
-  {
-    usage();
-    exit(0);
-  }
 #if defined(HAVE_BROKEN_REALPATH)
   my_use_symdir=0;
   my_disable_symlinks=1;
@@ -8354,12 +8089,7 @@
   bzero((char*) &thd->status_var, sizeof(thd->status_var));
 
   /* Reset some global variables */
-  for (SHOW_VAR *ptr= status_vars; ptr->name; ptr++)
-  {
-    /* Note that SHOW_LONG_NOFLUSH variables are not reset */
-    if (ptr->type == SHOW_LONG)
-      *(ulong*) ptr->value= 0;
-  }
+  reset_status_vars();
 
   /* Reset the counters of all key caches (default and named). */
   process_key_caches(reset_key_cache_counters);
@@ -8378,51 +8108,9 @@
 
 
 /*****************************************************************************
-  Instantiate have_xyx for missing storage engines
+  Instantiate variables for missing storage engines
+  This section should go away soon
 *****************************************************************************/
-#undef have_innodb
-#undef have_ndbcluster
-#undef have_csv_db
-
-SHOW_COMP_OPTION have_innodb= SHOW_OPTION_NO;
-SHOW_COMP_OPTION have_ndbcluster= SHOW_OPTION_NO;
-SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
-SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
-
-#ifndef WITH_INNOBASE_STORAGE_ENGINE
-uint innobase_flush_log_at_trx_commit;
-ulong innobase_fast_shutdown;
-long innobase_mirrored_log_groups, innobase_log_files_in_group;
-longlong innobase_log_file_size;
-long innobase_log_buffer_size;
-longlong innobase_buffer_pool_size;
-long innobase_additional_mem_pool_size;
-long innobase_file_io_threads, innobase_lock_wait_timeout;
-long innobase_force_recovery;
-long innobase_open_files;
-char *innobase_data_home_dir, *innobase_data_file_path;
-char *innobase_log_group_home_dir, *innobase_log_arch_dir;
-char *innobase_unix_file_flush_method;
-my_bool innobase_log_archive,
-        innobase_use_doublewrite,
-        innobase_use_checksums,
-        innobase_file_per_table,
-        innobase_locks_unsafe_for_binlog,
-        innobase_rollback_on_timeout,
-        innobase_stats_on_metadata;
-
-extern "C" {
-ulong srv_max_buf_pool_modified_pct;
-ulong srv_max_purge_lag;
-ulong srv_auto_extend_increment;
-ulong srv_n_spin_wait_rounds;
-ulong srv_n_free_tickets_to_enter;
-ulong srv_thread_sleep_delay;
-ulong srv_thread_concurrency;
-ulong srv_commit_concurrency;
-}
-
-#endif
 
 #ifndef WITH_NDBCLUSTER_STORAGE_ENGINE
 ulong ndb_cache_check_time;

--- 1.285/mysql-test/mysql-test-run.pl	2007-05-07 21:53:00 +02:00
+++ 1.286/mysql-test/mysql-test-run.pl	2007-05-10 14:52:19 +02:00
@@ -58,7 +58,7 @@
 use File::Path;
 use File::Basename;
 use File::Copy;
-use File::Temp qw / tempdir /;
+use File::Temp qw /tempdir/;
 use Cwd;
 use Getopt::Long;
 use Sys::Hostname;
@@ -113,6 +113,7 @@
 
 our $path_charsetsdir;
 our $path_client_bindir;
+our $path_share;
 our $path_language;
 our $path_timefile;
 our $path_snapshot;
@@ -666,6 +667,7 @@
     $glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
     chomp($glob_mysql_test_dir);
   }
+  $default_vardir= "$glob_mysql_test_dir/var";
 
   # In most cases, the base directory we find everything relative to,
   # is the parent directory of the "mysql-test" directory. For source
@@ -705,6 +707,15 @@
 				       "$glob_basedir/client",
 				       "$glob_basedir/bin");
 
+  # Look for language files and charsetsdir, use same share
+  $path_share=      mtr_path_exists("$glob_basedir/share/mysql",
+                                    "$glob_basedir/sql/share",
+                                    "$glob_basedir/share");
+
+  $path_language=      mtr_path_exists("$path_share/english");
+  $path_charsetsdir=   mtr_path_exists("$path_share/charsets");
+
+
   if (!$opt_extern)
   {
     $exe_mysqld=       mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
@@ -827,7 +838,6 @@
   # --------------------------------------------------------------------------
   # Set the "var/" directory, as it is the base for everything else
   # --------------------------------------------------------------------------
-  $default_vardir= "$glob_mysql_test_dir/var";
   if ( ! $opt_vardir )
   {
     $opt_vardir= $default_vardir;
@@ -1345,10 +1355,15 @@
   my $found_variable_list_start= 0;
 
   #
-  # Execute "mysqld --no-defaults --help --verbose" to get a
+  # Execute "mysqld --help --verbose" to get a list
   # list of all features and settings
   #
-  my $list= `$exe_mysqld --no-defaults --verbose --help`;
+  # --no-defaults and --skip-grant-tables are to avoid loading
+  # system-wide configs and plugins
+  #
+  # --datadir must exist, mysqld will chdir into it
+  #
+  my $list= `$exe_mysqld --no-defaults --datadir=$path_language --language=$path_language --skip-grant-tables --verbose --help`;
 
   foreach my $line (split('\n', $list))
   {
@@ -1511,14 +1526,6 @@
     }
   }
 
-  # Look for language files and charsetsdir, use same share
-  my $path_share=      mtr_path_exists("$glob_basedir/share/mysql",
-				       "$glob_basedir/sql/share",
-				       "$glob_basedir/share");
-
-  $path_language=      mtr_path_exists("$path_share/english");
-  $path_charsetsdir=   mtr_path_exists("$path_share/charsets");
-
   # Look for my_print_defaults
   $exe_my_print_defaults=
     mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
@@ -2972,8 +2979,8 @@
   mtr_add_arg($args, "--bootstrap");
   mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
   mtr_add_arg($args, "--datadir=%s", $data_dir);
-  mtr_add_arg($args, "--skip-innodb");
-  mtr_add_arg($args, "--skip-ndbcluster");
+  mtr_add_arg($args, "--loose-skip-innodb");
+  mtr_add_arg($args, "--loose-skip-ndbcluster");
   mtr_add_arg($args, "--tmpdir=.");
   mtr_add_arg($args, "--core-file");
 
@@ -3114,8 +3121,8 @@
 server_id           = $server_id
 shutdown-delay      = 10
 skip-stack-trace
-skip-innodb
-skip-ndbcluster
+loose-skip-innodb
+loose-skip-ndbcluster
 EOF
 ;
     if ( $mysql_version_id < 50100 )
@@ -3788,21 +3795,21 @@
     mtr_add_arg($args, "%s--server-id=%d", $prefix,
 	       $idx > 0 ? $idx + 101 : 1);
 
-    mtr_add_arg($args, "%s--innodb_data_file_path=ibdata1:10M:autoextend",
+    mtr_add_arg($args, "%s--loose-innodb_data_file_path=ibdata1:10M:autoextend",
 		$prefix);
 
     mtr_add_arg($args, "%s--local-infile", $prefix);
 
     if ( $idx > 0 or !$use_innodb)
     {
-      mtr_add_arg($args, "%s--skip-innodb", $prefix);
+      mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
     }
 
     my $cluster= $clusters->[$mysqld->{'cluster'}];
     if ( $opt_skip_ndbcluster ||
 	 !$cluster->{'pid'})
     {
-      mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
+      mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
     }
     else
     {
@@ -3842,7 +3849,7 @@
     mtr_add_arg($args, "%s--report-port=%d", $prefix,
                 $mysqld->{'port'});
     mtr_add_arg($args, "%s--report-user=root", $prefix);
-    mtr_add_arg($args, "%s--skip-innodb", $prefix);
+    mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
     mtr_add_arg($args, "%s--skip-slave-start", $prefix);
 
     # Directory where slaves find the dumps generated by "load data"
@@ -3879,7 +3886,7 @@
          $mysqld->{'cluster'} == -1 ||
 	 !$clusters->[$mysqld->{'cluster'}]->{'pid'} )
     {
-      mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
+      mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
     }
     else
     {

--- 1.82/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2007-05-07 15:36:27 +02:00
+++ 1.83/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2007-05-10 14:52:20 +02:00
@@ -1272,9 +1272,28 @@
     if(!prevOp->is_first_operation())
       org= (Tuple_header*)c_undo_buffer.get_ptr(&prevOp->m_copy_tuple_location);
     if (regTabPtr->need_expand())
+    {
       expand_tuple(req_struct, sizes, org, regTabPtr, !disk_insert);
+      memset(req_struct->m_disk_ptr->m_null_bits+
+             regTabPtr->m_offsets[DD].m_null_offset, 0xFF, 
+             4*regTabPtr->m_offsets[DD].m_null_words);
+
+      Uint32 bm_size_in_bytes= 4*(regTabPtr->m_offsets[MM].m_dyn_null_words);
+      if (bm_size_in_bytes)
+      {
+        Uint32* ptr = 
+          (Uint32*)req_struct->m_var_data[MM].m_dyn_data_ptr;
+        bzero(ptr, bm_size_in_bytes);
+        * ptr = bm_size_in_bytes >> 2;
+      }
+    } 
     else
+    {
       memcpy(dst, org, 4*regTabPtr->m_offsets[MM].m_fix_header_size);
+    }
+    memset(tuple_ptr->m_null_bits+
+           regTabPtr->m_offsets[MM].m_null_offset, 0xFF, 
+           4*regTabPtr->m_offsets[MM].m_null_words);
   }
   
   if (disk_insert)

--- 1.458/sql/ha_ndbcluster.cc	2007-05-07 11:41:39 +02:00
+++ 1.459/sql/ha_ndbcluster.cc	2007-05-10 14:52:19 +02:00
@@ -902,9 +902,7 @@
                               i, offset, (long) buf, len, (int)ptrdiff));
           DBUG_ASSERT(len == len64);
           // Ugly hack assumes only ptr needs to be changed
-          field_blob->ptr+= ptrdiff;
-          field_blob->set_ptr(len, buf);
-          field_blob->ptr-= ptrdiff;
+          field_blob->set_ptr_offset(ptrdiff, len, buf);
         }
         offset+= size;
       }
@@ -913,9 +911,7 @@
         // have to set length even in this case
         char *buf= buffer + offset; // or maybe NULL
         uint32 len= 0;
-        field_blob->ptr+= ptrdiff;
-        field_blob->set_ptr(len, buf);
-        field_blob->ptr-= ptrdiff;
+        field_blob->set_ptr_offset(ptrdiff, len, buf);
         DBUG_PRINT("info", ("[%u] isNull=%d", i, isNull));
       }
     }
@@ -2739,7 +2735,7 @@
       DBUG_RETURN(peek_res);
   }
 
-  statistic_increment(thd->status_var.ha_write_count, &LOCK_status);
+  ha_statistic_increment(&SSV::ha_write_count);
   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
     table->timestamp_field->set_time();
 
@@ -2970,7 +2966,7 @@
       DBUG_RETURN(peek_res);
   }
 
-  statistic_increment(thd->status_var.ha_update_count, &LOCK_status);
+  ha_statistic_increment(&SSV::ha_update_count);
   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
   {
     table->timestamp_field->set_time();
@@ -3152,7 +3148,7 @@
   DBUG_ENTER("delete_row");
   m_write_op= TRUE;
 
-  statistic_increment(thd->status_var.ha_delete_count,&LOCK_status);
+  ha_statistic_increment(&SSV::ha_delete_count);
   m_rows_changed++;
 
   if (m_use_partition_function &&
@@ -3557,8 +3553,7 @@
 int ha_ndbcluster::index_next(byte *buf)
 {
   DBUG_ENTER("ha_ndbcluster::index_next");
-  statistic_increment(current_thd->status_var.ha_read_next_count,
-                      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_next_count);
   DBUG_RETURN(next_result(buf));
 }
 
@@ -3566,8 +3561,7 @@
 int ha_ndbcluster::index_prev(byte *buf)
 {
   DBUG_ENTER("ha_ndbcluster::index_prev");
-  statistic_increment(current_thd->status_var.ha_read_prev_count,
-                      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_prev_count);
   DBUG_RETURN(next_result(buf));
 }
 
@@ -3575,8 +3569,7 @@
 int ha_ndbcluster::index_first(byte *buf)
 {
   DBUG_ENTER("ha_ndbcluster::index_first");
-  statistic_increment(current_thd->status_var.ha_read_first_count,
-                      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_first_count);
   // Start the ordered index scan and fetch the first row
 
   // Only HA_READ_ORDER indexes get called by index_first
@@ -3587,7 +3580,7 @@
 int ha_ndbcluster::index_last(byte *buf)
 {
   DBUG_ENTER("ha_ndbcluster::index_last");
-  statistic_increment(current_thd->status_var.ha_read_last_count,&LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_last_count);
   DBUG_RETURN(ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL));
 }
 
@@ -3773,8 +3766,7 @@
 int ha_ndbcluster::rnd_next(byte *buf)
 {
   DBUG_ENTER("rnd_next");
-  statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
-                      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
 
   if (!m_active_cursor)
     DBUG_RETURN(full_table_scan(buf));
@@ -3792,8 +3784,7 @@
 int ha_ndbcluster::rnd_pos(byte *buf, byte *pos)
 {
   DBUG_ENTER("rnd_pos");
-  statistic_increment(current_thd->status_var.ha_read_rnd_count,
-                      &LOCK_status);
+  ha_statistic_increment(&SSV::ha_read_rnd_count);
   // The primary key for the record is stored in pos
   // Perform a pk_read using primary key "index"
   {
@@ -6640,9 +6631,9 @@
     if (my_strcasecmp(system_charset_info, elmt.name, name))
       continue;
     DBUG_PRINT("info", ("Found table"));
-    DBUG_RETURN(1);
+    DBUG_RETURN(HA_ERR_TABLE_EXIST);
   }
-  DBUG_RETURN(0);
+  DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
 }
 
 
@@ -7006,7 +6997,7 @@
     DBUG_PRINT("info", ("%s existed on disk", name));     
     // The .ndb file exists on disk, but it's not in list of tables in ndb
     // Verify that handler agrees table is gone.
-    if (ndbcluster_table_exists_in_engine(hton, thd, db, file_name) == 0)    
+    if (ndbcluster_table_exists_in_engine(hton, thd, db, file_name) == HA_ERR_NO_SUCH_TABLE)    
     {
       DBUG_PRINT("info", ("NDB says %s does not exists", file_name));     
       it.remove();
@@ -7136,6 +7127,7 @@
 }
 
 extern int ndb_dictionary_is_mysqld;
+extern pthread_mutex_t LOCK_plugin;
 
 static int ndbcluster_init(void *p)
 {
@@ -7145,6 +7137,13 @@
   if (ndbcluster_inited)
     DBUG_RETURN(FALSE);
 
+  /*
+    Below we create new THD's. They'll need LOCK_plugin, but it's taken now by
+    plugin initialization code. Release it to avoid deadlocks.  It's safe, as
+    there're no threads that may concurrently access plugin control structures.
+  */
+  pthread_mutex_unlock(&LOCK_plugin);
+
   pthread_mutex_init(&ndbcluster_mutex,MY_MUTEX_INIT_FAST);
   pthread_mutex_init(&LOCK_ndb_util_thread, MY_MUTEX_INIT_FAST);
   pthread_cond_init(&COND_ndb_util_thread, NULL);
@@ -7156,7 +7155,7 @@
 
   {
     handlerton *h= ndbcluster_hton;
-    h->state=            have_ndbcluster;
+    h->state=            SHOW_OPTION_YES;
     h->db_type=          DB_TYPE_NDBCLUSTER;
     h->close_connection= ndbcluster_close_connection;
     h->commit=           ndbcluster_commit;
@@ -7178,9 +7177,6 @@
     h->table_exists_in_engine= ndbcluster_table_exists_in_engine;
   }
 
-  if (have_ndbcluster != SHOW_OPTION_YES)
-    DBUG_RETURN(0); // nothing else to do
-
   // Initialize ndb interface
   ndb_init_internal();
 
@@ -7378,6 +7374,8 @@
     goto ndbcluster_init_error;
   }
 
+  pthread_mutex_lock(&LOCK_plugin);
+
   ndbcluster_inited= 1;
   DBUG_RETURN(FALSE);
 
@@ -7404,9 +7402,10 @@
   if (g_ndb_cluster_connection)
     delete g_ndb_cluster_connection;
   g_ndb_cluster_connection= NULL;
-  have_ndbcluster= SHOW_OPTION_DISABLED;	// If we couldn't use handler
   ndbcluster_hton->state= SHOW_OPTION_DISABLED;               // If we couldn't use handler
 
+  pthread_mutex_lock(&LOCK_plugin);
+
   DBUG_RETURN(TRUE);
 }
 
@@ -9442,10 +9441,6 @@
   uint buflen;
   DBUG_ENTER("ndbcluster_show_status");
   
-  if (have_ndbcluster != SHOW_OPTION_YES) 
-  {
-    DBUG_RETURN(FALSE);
-  }
   if (stat_type != HA_ENGINE_STATUS)
   {
     DBUG_RETURN(FALSE);

--- 1.231/sql/set_var.cc	2007-05-10 08:06:06 +02:00
+++ 1.232/sql/set_var.cc	2007-05-10 14:55:59 +02:00
@@ -406,6 +406,9 @@
 static sys_var_long_ptr	sys_server_id(&vars, "server_id", &server_id, fix_server_id);
 static sys_var_bool_ptr	sys_slave_compressed_protocol(&vars, "slave_compressed_protocol",
 						      &opt_slave_compressed_protocol);
+#ifdef HAVE_REPLICATION
+static sys_var_bool_ptr        sys_slave_allow_batching("slave_allow_batching",
+                                                 &slave_allow_batching);
 static sys_var_long_ptr	sys_slow_launch_time(&vars, "slow_launch_time",
 					     &slow_launch_time);
 static sys_var_thd_ulong	sys_sort_buffer(&vars, "sort_buffer_size",
Thread
bk commit into 5.1 tree (tomas:1.2509)tomas10 May