List:Internals« Previous MessageNext Message »
From:Eric Bergen Date:May 19 2008 3:04am
Subject:Re: Adding new flush commands
View as plain text  
I updated the patch http://ebergen.net/patches/flush_logs.patch with
the suggestions from Sergei. It now supports log or logs and the log
function works. The patch applies against both 5.1 and 6.0

I found an interesting bug while doing the conversion. It seems that
functions that are special cased in the parser don't return invalid
number of argument errors correctly. For example:

mysql> select left(1);
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near ')' at line 1
mysql> select locate(1);
ERROR 1582 (42000): Incorrect parameter count in the call to native
function 'locate'

I'm not sure what the best way is to fix this.

-Eric


On Fri, May 16, 2008 at 12:44 AM, Mark Callaghan <mcallaghan@stripped> wrote:
> Rick,
>
> I think that you are proposing to do planned failover by sending a
> command or set of commands through the replication stream. That is a
> great idea. Some failovers are more complicated depending on whether
> slaves use different grants than masters but all of that should be
> possible with this approach. And for those of us with many slaves
> replicating from a master, this could make the process much less
> painful (time consuming and error prone) than it is today.
>
> On Thu, May 15, 2008 at 1:44 PM, Rick James <rjames@stripped> wrote:
>>
>> And it would probably work for dual-master, there things get tricky with queries
> crossing 'in the network'.
>>
>> And figuring out if "all's quite" become much easier.
>>
>> The script would take seconds; the manual equivalent would be painful, slow, and
> more error prone.  You would have to figure out a different offset for each slave.  And
> [perhaps] dual master setups would be impossible because of different binlog ordering on
> different slaves.  [Assuming the evil of both masters accepting writes.)
>>
>>
>>
>> > -----Original Message-----
>> > From: Rick James
>> > Sent: Thursday, May 15, 2008 1:40 PM
>> > To: 'Eric Bergen'
>> > Cc: Internals List
>> > Subject: RE: Adding new flush commands
>> >
>> > I pondered the flush & stop a year ago; let me see if I can
>> > justify it...
>> >
>> > Let's say you need to move all (or some) of your slaves from
>> > one master (or relay) to another.  And you want to do it with
>> > minimal downtime.  If I can get all the slaves to stop at
>> > exactly the same point (without stopping the master), then I
>> > can have a script do the CHANGE MASTER on each one (to the same value)
>> >
>> > Meanwhile (if necessary), the script could do SLAVE START on
>> > the other slaves.
>> >
>> >
>> > MySQL Geeks - Consulting & Review
>> >
>> >
>> >
>> > > -----Original Message-----
>> > > From: eric.bergen@stripped
>> > > [mailto:eric.bergen@stripped] On Behalf Of Eric Bergen
>> > > Sent: Thursday, May 15, 2008 1:31 PM
>> > > To: Rick James
>> > > Cc: Internals List
>> > > Subject: Re: Adding new flush commands
>> > >
>> > > I think it should rotate after N bytes like the binlog. It
>> > can also be
>> > > rotated with it's own flush slow log; command. I don't know
>> > how useful
>> > > a flush binary log and slave stop sql will be since it will stop all
>> > > slaves.
>> > >
>> > > On Thu, May 15, 2008 at 10:47 AM, Rick James
>> > > <rjames@stripped> wrote:
>> > > > :)
>> > > >
>> > > > I would like the slowlogs rotated; numbered is fine.
>> > > >
>> > > > When to rotate slowlog?
>> > > > * After N bytes (a la binlog) ?
>> > > > * On demand -- In this case, would not like it tied to
>> > > other logs:  I might want to rotate the slowlogs daily, but
>> > > never explicitly rotate any other logs.
>> > > > * On restart ?  Once there is rotation, this seems ok.  (No
>> > > strong opinion.)
>> > > >
>> > > > General log
>> > > > * would like to turn on/off without restarting server
>> > > > * "rotation" with numbered files would be nice
>> > > > * Again, would not like it to be tied to any other flush.
>> > > >
>> > > > FLUSH LOGS -- command to flush all -- ok
>> > > > FLUSH [SLOW|GENERAL|BIN|...] LOG  -- flush one log.
>> > > >
>> > > > Also, I would like FLUSH BIN LOG to be optionally
>> > > replicated!  This would lead to some interesting tricks for
>> > > taking snapshots and/or pointing a slave to a different
>> > > master.  Think about it; this would easily give you a precise
>> > > position.  [I think]
>> > > >
>> > > > Maybe this combo as an atomic operation
>> > > >  FLUSH BINLOG AND SLAVE STOP SQL;
>> > > > would be 'necessary' for the idea I presented above.
>> > > >
>> > > >
>> > > > MySQL Geeks - Consulting & Review
>> > > > Email: rjames@stripped
>> > > > Messenger : rjasdf
>> > > > http://twiki.corp.yahoo.com/view/Devel/MySQLGeeks
>> > > >
>> > > >
>> > > >
>> > > >> -----Original Message-----
>> > > >> From: eric.bergen@stripped
>> > > >> [mailto:eric.bergen@stripped] On Behalf Of Eric
> Bergen
>> > > >> Sent: Thursday, May 15, 2008 10:32 AM
>> > > >> To: Rick James
>> > > >> Cc: Internals List
>> > > >> Subject: Re: Adding new flush commands
>> > > >>
>> > > >> Rick,
>> > > >>
>> > > >> Flush slow logs (soon to be log or logs) is in the patch
>> > > below. There
>> > > >> is a problem in that the slow query log can be flushed but
>> > > there isn't
>> > > >> any code to rotate it. A flush reopens the file with a new
>> > > header. In
>> > > >> a separate patch I'm going to update the slow, general,
>> > > and error logs
>> > > >> so they rotate in numbered files like the binary logs.
>> > What do you
>> > > >> think?
>> > > >>
>> > > >> -Eric
>> > > >>
>> > > >> On Tue, May 13, 2008 at 10:15 AM, Rick James
>> > > >> <rjames@stripped> wrote:
>> > > >> > FLUSH SLOW LOG; please
>> > > >> >
>> > > >> >
>> > > >> > MySQL Geeks - Consulting & Review
>> > > >> > Email: rjames@stripped
>> > > >> > Messenger : rjasdf
>> > > >> > http://twiki.corp.yahoo.com/view/Devel/MySQLGeeks
>> > > >> >
>> > > >> >
>> > > >> >
>> > > >> >> -----Original Message-----
>> > > >> >> From: Sergei Golubchik [mailto:serg@stripped]
>> > > >> >> Sent: Tuesday, May 13, 2008 12:16 AM
>> > > >> >> To: Eric Bergen
>> > > >> >> Cc: Internals List
>> > > >> >> Subject: Re: Adding new flush commands
>> > > >> >>
>> > > >> >> Hi!
>> > > >> >>
>> > > >> >> On May 12, Eric Bergen wrote:
>> > > >> >> > Hi,
>> > > >> >> >
>> > > >> >> > I'm trying to split the flush logs command into
>> > > several different
>> > > >> >> > flush commands. Examples are;
>> > > >> >> > flush binary log;
>> > > >> >> > flush relay log;
>> > > >> >> >
>> > > >> >> > My problem is that when I add the log symbol the
> new
>> > > >> >> commands work but
>> > > >> >> > the log function is disabled with a parse
> error:
>> > > >> >> >
>> > > >> >> > mysqltest: At line 495: query 'select log()'
> failed with
>> > > >> wrong errno
>> > > >> >> > 1064: 'You have an error in your SQL syntax;
> check the
>> > > >> manual that
>> > > >> >> > corresponds to your MySQL server version for the
> right
>> > > >> syntax to use
>> > > >> >> > near '()' at line 1', instead of 1582...
>> > > >> >> >
>> > > >> >> > If I change the commands to flush binary logs
> (as in the
>> > > >> >> patch below)
>> > > >> >> > it works great.
>> > > >> >> >
>> > > >> >> > Is there something special I have to define to
> prevent
>> > > >> my log symbol
>> > > >> >> > from conflicting with the log function?
>> > > >> >>
>> > > >> >> Yes :(
>> > > >> >> You need to remove LOG function from item_create.cc
> and add
>> > > >> >> an explicit
>> > > >> >> rule for it in sql_yacc.yy. See rules
> function_call_keyword,
>> > > >> >> function_call_nonkeyword, function_call_generic,
>> > > >> >> function_call_conflict
>> > > >> >> there.
>> > > >> >>
>> > > >> >> Regards / Mit vielen Grüssen,
>> > > >> >> Sergei
>> > > >> >>
>> > > >> >> --
>> > > >> >>    __  ___     ___ ____  __
>> > > >> >>   /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik
>> > <serg@stripped>
>> > > >> >>  / /|_/ / // /\ \/ /_/ / /__  Principal Software
>> > > >> >> Engineer/Server Architect
>> > > >> >> /_/  /_/\_, /___/\___\_\___/  Sun Microsystems GmbH,
> HRB
>> > > >> >> München 161028
>> > > >> >>        <___/                  Sonnenallee 1,
> 85551
>> > > >> >> Kirchheim-Heimstetten
>> > > >> >> Geschäftsführer: Thomas Schroeder, Wolfgang
> Engels, Dr.
>> > > >> Roland Boemer
>> > > >> >> Vorsitzender des Aufsichtsrates: Martin Häring
>> > > >> >>
>> > > >> >> --
>> > > >> >> MySQL Internals Mailing List
>> > > >> >> For list archives: http://lists.mysql.com/internals
>> > > >> >> To unsubscribe:
>> > > >> >> http://lists.mysql.com/internals?unsub=1
>> > > >> >>
>> > > >> >>
>> > > >> >
>> > > >> > --
>> > > >> > MySQL Internals Mailing List
>> > > >> > For list archives: http://lists.mysql.com/internals
>> > > >> > To unsubscribe:
>> > > >> http://lists.mysql.com/internals?unsub=1
>> > > >> >
>> > > >> >
>> > > >>
>> > > >>
>> > > >>
>> > > >> --
>> > > >> high performance mysql consulting.
>> > > >> http://provenscaling.com
>> > > >>
>> > > >
>> > > > --
>> > > > MySQL Internals Mailing List
>> > > > For list archives: http://lists.mysql.com/internals
>> > > > To unsubscribe:
>> > > http://lists.mysql.com/internals?unsub=1
>> > > >
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > high performance mysql consulting.
>> > > http://provenscaling.com
>> > >
>>
>> --
>> MySQL Internals Mailing List
>> For list archives: http://lists.mysql.com/internals
>> To unsubscribe:    http://lists.mysql.com/internals?unsub=1
>>
>
>
>
> --
> Mark Callaghan
> mcallaghan@stripped
>



-- 
high performance mysql consulting.
http://provenscaling.com
Thread
Adding new flush commandsEric Bergen13 May
  • Re: Adding new flush commandsSergei Golubchik13 May
    • RE: Adding new flush commandsRick James13 May
      • Re: Adding new flush commandsEric Bergen15 May
        • RE: Adding new flush commandsRick James15 May
          • Re: Adding new flush commandsEric Bergen15 May
            • RE: Adding new flush commandsRick James15 May
  • RE: Adding new flush commandsRick James15 May
    • Re: Adding new flush commandsEric Bergen15 May
    • Re: Adding new flush commandsMark Callaghan16 May
      • Re: Adding new flush commandsEric Bergen19 May
        • Re: Adding new flush commandsSergei Golubchik19 May
          • Re: Adding new flush commandsEric Bergen19 May
            • Re: Adding new flush commandsEric Bergen22 May
              • Re: Adding new flush commandsEric Bergen25 Oct