Re: RFE: Allow to use version-specific my.cnf files

2012-05-02 Thread Honza Horak

On 04/27/2012 03:26 PM, Shawn Green wrote:

I frequently need to have multiple versions ready to operate on my
machine at any time. I solved the configuration file problems by only
setting them up in the basedir of the installed version.

For those special occasions when I need to configure multiple copies of
the same version, I create a separate set of --datadir folders and craft
separate configuration files for both. I start mysqld using the
--defaults-file option and point that at the special file for each
instance.

As a matter of convenience, if you need to constantly run with multiple
instances on the same host and if any one of those may need to be using
a different version than the others, then the utility mysqld_multi may
be what you need to be looking at. Each instance you manage by the
script can have their own separate set of settings all stored in the
same, common, configuration file. Check it out:
http://dev.mysql.com/doc/refman/5.1/en/mysqld-multi.html


Hi Shawn,

thanks for pointing to that. So we have a possibility to define 
different options for different server instances using mysqld_multi.


My proposal allows to have something similar for clients as well 
(without need to specify any command-line argument), or in cases when we 
want to define the same options to more servers, according to their version.


It's probably nothing we cannot do now. But it could be a nice option, 
much more cleaner in some environments.


Cheers,

Honza

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



RE: RFE: Allow to use version-specific my.cnf files

2012-05-02 Thread Rick James
I think you need deal with only these:
  * Diff my.cnf (set as a parameter to mysqld)
  * Diff tree for all the data (and reflect this in my.cnf)
  * Diff port (3306 can't be shared between the instances)

 -Original Message-
 From: Andrés Tello [mailto:mr.crip...@gmail.com]
 Sent: Wednesday, April 25, 2012 8:52 AM
 To: Honza Horak
 Cc: mysql@lists.mysql.com
 Subject: Re: RFE: Allow to use version-specific my.cnf files
 
 Reads interesting, but...
 
 Why would you need that?
 
 I mean... If I run several databases in the same hardware, I use
 completely diferent paths for evertying, so I can have atomic, clean
 and specific files for each instance/version of the database
 
 I think is much more easy to migrato to another hardware that way, just
 copy the instance and you are set...
 
 
 
 
 
 On Wed, Apr 25, 2012 at 9:23 AM, Honza Horak hho...@redhat.com wrote:
 
  Hi,
 
  PostgreSQL allows to use version-specific configuration files, which
  allows to change some settings only for particular version of DB.
 
  I think a similar enhancement would be nice and usable for
  administrators of MySQL as well.
 
  Please, consider the attached patch as a simple proposal. Any
 comments
  are welcome.
 
  Cheers,
 
  Honza
 
 
  --
  MySQL General Mailing List
  For list archives: http://lists.mysql.com/mysql
  To unsubscribe:http://lists.mysql.com/mysql
 

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: RFE: Allow to use version-specific my.cnf files

2012-04-27 Thread Honza Horak

On 04/25/2012 05:52 PM, Andrés Tello wrote:

Reads interesting, but...

Why would you need that?

I mean... If I run several databases in the same hardware, I use completely
diferent paths for evertying, so I can have atomic, clean  and specific
files for each instance/version of the database


Thanks for your opinion.

You're right, it doesn't make too much sense regarding system-wide 
configuration files, such as /etc/my.cnf. A real use case I see is when 
we speak about users' config files, like ~/.my.cnf.


Let's say we have two different MySQL versions on one hardware, then 
it's possible we'll need a bit different options for each instance.


MySQL unfortunately doesn't distinguish between user-specific (usually 
called rc files) and system-wide config files. Trying to have the patch 
simple, I applied the feature to all config files (which was not necessary).


The attached patch now is a bit more complicated, but restricts the 
feature only for config files in user's home directory. I believe this 
makes more sense, than the original one.


Any comments welcome again.

Cheers,

Honza
diff -up mysql-5.5.22/mysys/default.c.versionedcnf mysql-5.5.22/mysys/default.c
--- mysql-5.5.22/mysys/default.c.versionedcnf	2012-03-02 20:44:47.0 +0100
+++ mysql-5.5.22/mysys/default.c	2012-04-27 09:44:01.136938181 +0200
@@ -37,6 +37,7 @@
 #include m_string.h
 #include m_ctype.h
 #include my_dir.h
+#include mysql_version.h
 #ifdef __WIN__
 #include winbase.h
 #endif
@@ -660,18 +661,24 @@ static int search_default_file(Process_o
 			   const char *config_file)
 {
   char **ext;
+  char **version_ext;
   const char *empty_list[]= { , 0 };
+  const char *versioned_list[]= { , - MYSQL_SERVER_VERSION, 0 };
   my_bool have_ext= fn_ext(config_file)[0] != 0;
   const char **exts_to_use= have_ext ? empty_list : f_extensions;
+  const char **versioned_exts_to_use= (dir[0] == FN_HOMELIB) ? versioned_list : empty_list;
 
   for (ext= (char**) exts_to_use; *ext; ext++)
-  {
-int error;
-if ((error= search_default_file_with_ext(opt_handler, handler_ctx,
- dir, *ext,
-	 config_file, 0))  0)
-  return error;
-  }
+for (version_ext= (char**) versioned_exts_to_use; *version_ext; version_ext++)
+{
+  int error;
+  char full_ext[FN_REFLEN + sizeof(MYSQL_SERVER_VERSION) + 2];
+  strxmov(full_ext,*ext,*version_ext,NullS);
+  if ((error= search_default_file_with_ext(opt_handler, handler_ctx,
+   dir, full_ext,
+   config_file, 0))  0)
+return error;
+}
   return 0;
 }
 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql

Re: RFE: Allow to use version-specific my.cnf files

2012-04-27 Thread Shawn Green

Hello Honza,

On 4/27/2012 4:35 AM, Honza Horak wrote:

On 04/25/2012 05:52 PM, Andrés Tello wrote:

Reads interesting, but...

Why would you need that?

I mean... If I run several databases in the same hardware, I use
completely
diferent paths for evertying, so I can have atomic, clean and specific
files for each instance/version of the database


Thanks for your opinion.

You're right, it doesn't make too much sense regarding system-wide
configuration files, such as /etc/my.cnf. A real use case I see is when
we speak about users' config files, like ~/.my.cnf.

Let's say we have two different MySQL versions on one hardware, then
it's possible we'll need a bit different options for each instance.

MySQL unfortunately doesn't distinguish between user-specific (usually
called rc files) and system-wide config files. Trying to have the patch
simple, I applied the feature to all config files (which was not
necessary).

The attached patch now is a bit more complicated, but restricts the
feature only for config files in user's home directory. I believe this
makes more sense, than the original one.

Any comments welcome again.

Cheers,


I frequently need to have multiple versions ready to operate on my 
machine at any time. I solved the configuration file problems by only 
setting them up in the basedir of the installed version.


For those special occasions when I need to configure multiple copies of 
the same version, I create a separate set of --datadir folders and craft 
separate configuration files for both. I start mysqld using the 
--defaults-file option and point that at the special file for each 
instance.


As a matter of convenience, if you need to constantly run with multiple 
instances on the same host and if any one of those may need to be using 
a different version than the others, then the utility mysqld_multi may 
be what you need to be looking at.  Each instance you manage by the 
script can have their own separate set of settings all stored in the 
same, common, configuration file. Check it out:

http://dev.mysql.com/doc/refman/5.1/en/mysqld-multi.html



--
Shawn Green
MySQL Principal Technical Support Engineer
Oracle USA, Inc. - Hardware and Software, Engineered to Work Together.
Office: Blountville, TN

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: RFE: Allow to use version-specific my.cnf files

2012-04-25 Thread Andrés Tello
Reads interesting, but...

Why would you need that?

I mean... If I run several databases in the same hardware, I use completely
diferent paths for evertying, so I can have atomic, clean  and specific
files for each instance/version of the database

I think is much more easy to migrato to another hardware that way, just
copy the instance and you are set...





On Wed, Apr 25, 2012 at 9:23 AM, Honza Horak hho...@redhat.com wrote:

 Hi,

 PostgreSQL allows to use version-specific configuration files, which
 allows to change some settings only for particular version of DB.

 I think a similar enhancement would be nice and usable for administrators
 of MySQL as well.

 Please, consider the attached patch as a simple proposal. Any comments are
 welcome.

 Cheers,

 Honza


 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql