bk commit into 4.1 tree (joreland:1.2304) -
06-01-2005
, 03:35 AM
Below is the list of changes that have just been committed into a local
4.1 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/in...urce-tree.html
ChangeSet
1.2304 05/06/01 11:34:57 joreland (AT) mysql (DOT) com +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.50 05/06/01 11:33:13 joreland (AT) mysql (DOT) com +70 -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
include/my_sys.h
1.138 05/06/01 11:33:12 joreland (AT) mysql (DOT) com +1 -0
export current instance
# 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.137/include/my_sys.h Wed May 25 11:56:40 2005
+++ 1.138/include/my_sys.h Wed Jun 1 11:33:12 2005
@@ -243,6 +243,7 @@
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
extern char *defaults_extra_file;
+extern char *defaults_instance;
typedef struct wild_file_pack /* Struct to hold info when selecting files */
{
--- 1.49/mysys/default.c Mon May 2 17:11:31 2005
+++ 1.50/mysys/default.c Wed Jun 1 11:33:13 2005
@@ -39,6 +39,8 @@
#include <my_dir.h>
char *defaults_extra_file=0;
+char *defaults_instance=0;
+static const char instance_delimiter[] = ".";
/* Which directories are searched for options (and in which order) */
@@ -188,6 +190,61 @@
group.type_names= groups;
for (; *groups ; groups++)
group.count++;
+
+ if (*argc >= 2 + args_used && is_prefix(argv[0][1+args_used], "--instance="))
+ {
+ args_used++;
+ defaults_instance= argv[0][args_used]+sizeof("--instance=")-1;
+ }
+ else
+ {
+ defaults_instance= getenv("MYSQL_INSTANCE");
+ }
+
+ if (defaults_instance)
+ {
+ /**
+ * Handle --instance=
+ */
+ uint i;
+ uint len= 0; /* sum(strlen()) of all groups */
+ 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;
+ /** Sum length of all groups, used later to malloc
+ * (save len in extra_groups[]) */
+ for (i= 0; i<group.count; i++)
+ {
+ extra_groups[i+group.count]= (char*)(strlen(group.type_names[i]));
+ len+= (uint)extra_groups[i+group.count];
+ }
+ len+= len + group.count * (instance_len + sizeof(instance_delimiter));
+
+ if (!(ptr= alloc_root(&alloc, len)))
+ goto err;
+
+ for (i= 0; i<group.count; i++)
+ {
+ extra_groups[i]= group.type_names[i]; /** copy group */
+ len= (uint)extra_groups[i+group.count];
+ extra_groups[i+group.count]= ptr;
+
+ /** Construct new group */
+ memcpy(ptr, extra_groups[i], len);
+ ptr+= len;
+ memcpy(ptr, instance_delimiter, sizeof(instance_delimiter)-1);
+ ptr+= sizeof(instance_delimiter)-1;
+ memcpy(ptr, defaults_instance, instance_len+1);
+ ptr+= instance_len+1;
+ }
+
+ group.count*= 2;
+ group.type_names= extra_groups;
+ group.type_names[group.count]= 0;
+ }
if (my_init_dynamic_array(&args, sizeof(char*),*argc, 32))
goto err;
@@ -676,6 +733,7 @@
#endif
char name[FN_REFLEN], **ext;
const char **dirs;
+ const char **groups_save= groups;
puts("\nDefault options are read from the following files in the given order:");
@@ -731,6 +789,18 @@
fputc(' ',stdout);
fputs(*groups,stdout);
}
+ if (defaults_instance)
+ {
+ groups= groups_save;
+ for ( ; *groups ; groups++)
+ {
+ fputc(' ',stdout);
+ fputs(*groups,stdout);
+ fputs(instance_delimiter,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\
--no-defaults Don't read default options from any options file\n\
--
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe: http://lists.mysql.com/internals?uns...ie.nctu.edu.tw |