List:Internals« Previous MessageNext Message »
From:Mark Callaghan Date:April 25 2008 5:52pm
Subject:Re: Flush Tables with Read Locks
View as plain text  
On Fri, Apr 25, 2008 at 10:37 AM, Jim Starkey <jstarkey@stripped> wrote:
>
> Michael Widenius wrote:
>
> > Jim> Could somebody give me a clue how this gets communicated to a storage
> > Jim> engine?
> >
> > For the storage engine, there is nothing to do, except possible sync
> > all table date to disk when all handlers to a table is closed.
> >
> > All the logic and protection is done on the upper level.
> > Here is how "Flush Tables with Read Locks" works:
> >
> > - Put a protection in place that stops anyone from open a table.
> > - Close all open table handlers that can be closed. Mark all that are
> >  in use to be closed at statement end.
> > - Wait until all table handlers have been closed.
> > - Set a global write protection flag that will cause any statement
> >  that modifies tables to wait.
> > - Allow read only queries to continue.
> >
> >
> >
> Actually, there is a lot for a storage engine to do -- stop any writing threads,
> flush the page cache, and flush the log.
>
> Closing a table object in Falcon is almost a non-event -- it certainly has nothing to
> do with flushing logs or caches or stopping internal threads.
>
> I would like to add support for "Flush Tables with Read Locks" to enable external LVM
> backup.  It sounds the server can't currently support either"Flush Tables with Read Locks"
> or its close cousin, "Unlock Tables".  I suppose this should go to the architecture list.

I don't understand why Falcon requires anything special here. If you
take an LVM snapshot, shouldn't it be sufficient at startup to run
redo recovery from the serial log to make the database files commit
consistent?

The problems for LVM snapshots are operations that are not atomic in
MySQL -- DDL. Those must be not be in progress during the snapshot,
otherwise you might end up with: engine drops the table but the .frm
file is still there, engine creates the table but the .frm file is not
there (or vice versa if the .frm file is added/dropped first).

Can we get a DON'T FLUSH TABLES BUT STILL GET READ LOCK command so
that the command isn't blocked by long running queries? I don't know
what benefit Falcon and InnoDB get from closing table handler
instances.

>
>
> --
> James Starkey, Senior Software Architect
> MySQL Inc., Manchester, MA, USA, www.mysql.com
> Office:      978 526-1376
>
> --
>
>
>
> 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
Thread
Flush Tables with Read LocksJim Starkey25 Apr
  • Re: Flush Tables with Read LocksJay Pipes25 Apr
    • Re: Flush Tables with Read LocksJim Starkey25 Apr
  • re: Flush Tables with Read LocksMichael Widenius25 Apr
    • Re: Flush Tables with Read LocksJim Starkey25 Apr
      • Re: Flush Tables with Read LocksMark Callaghan25 Apr
        • Re: Flush Tables with Read LocksEric Bergen25 Apr
          • Re: Flush Tables with Read LocksJim Starkey25 Apr
Re: Flush Tables with Read LocksMark Callaghan25 Apr
  • Re: Flush Tables with Read LocksJim Starkey25 Apr
    • Re: Flush Tables with Read LocksEric Bergen25 Apr
      • Re: Flush Tables with Read LocksJim Starkey25 Apr
    • RE: Flush Tables with Read LocksRick James29 Apr
      • Re: Flush Tables with Read LocksAnn W. Harrison29 Apr