List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:May 4 2003 12:42pm
Subject:Re: Mysql failover configuration
View as plain text  
Hi!

>>>>> "benning" == benning  <benning@stripped> writes:

benning> Hi,
benning> i attached a patch which adds a "readonly" option to mysqld.
benning> When the option is set no write operations are allowed on the whole
benning> server for all clients except the slave thread.

benning> I'm not sure if the returned error message the correct one.
benning> And i'm no mysql guru, so the patch may be total wrong.
benning> Some of the gurus on the interals mailling list should have
benning> a look at it.

benning> The patch is against the current 4.0 release.

benning> Markus

<cut>

<cut>

benning> +  
benning> +  /*
benning> +  if we're not the replication thread and readonly is set
benning> +  dont allow a operation which changes tables.
benning> +  */
benning> +  
benning> +  if( (!thd->slave_thread) && opt_readonly &&
benning> +      (uc_update_queries[lex->sql_command] > 0) ) {
benning> +    send_error(&thd->net,ER_CANT_UPDATE_WITH_READLOCK);
benning> +    DBUG_VOID_RETURN;
benning> +  }
 
Patch looks correct; The main change I would have done is still allow
the 'super' use to do changes (which may be needed when doing repairs
etc)

In this case the patch would be:

 if (!(thd->slave_thread || (thd->master_access & SUPER_ACL)) &&
opt_readonly &&
     (uc_update_queries[lex->sql_command] > 0) ) {
   send_error(&thd->net,ER_CANT_UPDATE_WITH_READLOCK);

Regards,
Monty

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Mr. Michael Widenius <monty@stripped>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, CTO
/_/  /_/\_, /___/\___\_\___/   Helsinki, Finland
       <___/   www.mysql.com
Thread
Re: Mysql failover configurationSteven Roussey3 May