Below is the list of changes that have just been committed into a local
5.0 repository of jonas. When jonas 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.1914 05/06/07 16:52:50 joreland@stripped +2 -0
Add "--instance=name" option to load_defaults (or env(MYSQL_INSTANCE))
which enables having multiple mysqld in same my.cnf
without mysql_multi or IM
mysys/default.c
1.71 05/06/07 16:51:50 joreland@stripped +59 -1
Add "--instance=name" option to load_defaults (or env(MYSQL_INSTANCE))
which enables having multiple mysqld in same my.cnf
without mysql_multi or IM
include/my_sys.h
1.158 05/06/07 16:51:50 joreland@stripped +1 -0
extern instance name
# 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: joreland
# Host: eel.ndb.mysql.com.ndb.mysql.com
# Root: /home/jonas/src/wl1882
--- 1.157/include/my_sys.h Thu May 26 19:54:23 2005
+++ 1.158/include/my_sys.h Tue Jun 7 16:51:50 2005
@@ -263,6 +263,7 @@
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
extern char *defaults_extra_file;
+extern const char *defaults_instance;
extern my_bool timed_mutexes;
--- 1.70/mysys/default.c Thu May 19 02:13:30 2005
+++ 1.71/mysys/default.c Tue Jun 7 16:51:50 2005
@@ -31,6 +31,7 @@
--defaults-file=full-path-to-default-file ; Only this file will be read.
--defaults-extra-file=full-path-to-default-file ; Read this file before ~/
--print-defaults ; Print the modified command line and exit
+ --instance ; also read groups with concat(group, instance)
****************************************************************************/
#include "mysys_priv.h"
@@ -41,6 +42,8 @@
#include <winbase.h>
#endif
+const char *defaults_instance=0;
+static const char instance_option[] = "--instance=";
char *defaults_extra_file=0;
/* Which directories are searched for options (and in which order) */
@@ -115,7 +118,7 @@
DBUG_ENTER("my_search_option_files");
/* Check if we want to force the use a specific default file */
- get_defaults_files(*argc, *argv,
+ get_defaults_files(*argc - *args_used, *argv + *args_used,
(char **)&forced_default_file,
(char **)&forced_extra_defaults);
if (forced_default_file)
@@ -325,6 +328,49 @@
ctx.args= &args;
ctx.group= &group;
+ if (*argc >= 2 + args_used &&
+ is_prefix(argv[0][1+args_used], instance_option))
+ {
+ args_used++;
+ defaults_instance= argv[0][args_used]+sizeof(instance_option)-1;
+ }
+ else
+ {
+ defaults_instance= getenv("MYSQL_INSTANCE");
+ }
+
+ if (defaults_instance)
+ {
+ /** Handle --instance= */
+ uint i, len;
+ const char **extra_groups;
+ const uint instance_len= strlen(defaults_instance);
+
+ if (!(extra_groups=
+ (const char**)alloc_root(&alloc, (2*group.count+1)*sizeof(char*))))
+ goto err;
+
+ for (i= 0; i<group.count; i++)
+ {
+ extra_groups[i]= group.type_names[i]; /** copy group */
+
+ len= strlen(extra_groups[i]);
+ if (!(ptr= alloc_root(&alloc, len+instance_len+1)))
+ goto err;
+
+ extra_groups[i+group.count]= ptr;
+
+ /** Construct new group */
+ memcpy(ptr, extra_groups[i], len);
+ ptr+= len;
+ memcpy(ptr, defaults_instance, instance_len+1);
+ }
+
+ group.count*= 2;
+ group.type_names= extra_groups;
+ group.type_names[group.count]= 0;
+ }
+
error= my_search_option_files(conf_file, argc, argv, &args_used,
handle_default_option, (void *) &ctx);
/*
@@ -794,6 +840,7 @@
void print_defaults(const char *conf_file, const char **groups)
{
+ const char **groups_save= groups;
my_print_default_files(conf_file);
fputs("The following groups are read:",stdout);
@@ -801,6 +848,17 @@
{
fputc(' ',stdout);
fputs(*groups,stdout);
+ }
+
+ if (defaults_instance)
+ {
+ groups= groups_save;
+ for ( ; *groups ; groups++)
+ {
+ fputc(' ',stdout);
+ fputs(*groups,stdout);
+ fputs(defaults_instance,stdout);
+ }
}
puts("\nThe following options may be given as the first argument:\n\
--print-defaults Print the program argument list and exit\n\
| Thread |
|---|
| • bk commit into 5.0 tree (joreland:1.1914) | jonas.oreland | 7 Jun |