[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: FLUSH TABLE LOCK READ
From:       Baron Schwartz <baron () xaprb ! com>
Date:       2007-05-30 16:03:07
Message-ID: 465DA03B.9020302 () xaprb ! com
[Download RAW message or body]

Hi Ananda,

I think you are confused about locks and the binlog both.

Locks lock tables.  This disallows changes.  READ locks prevent changes, but do 
not block anyone from READING from the tables, and if I recall correctly, also 
allow other people to get READ locks at the same time.  WRITE locks block any 
access to the tables by other connections.  You can test this yourself very 
easily.  But regardless, you cannot change a table that is locked.

As for the binlog, it records changes that have happened to the database.  If I 
understand you correctly, you may be thinking of it as a "buffer of changes not 
yet applied, which will be applied when the lock is released."  That is not how 
it works.  If you have a FLUSH TABLES WITH READ LOCK open, all tables are 
flushed to disk and locked, and there will be *no changes* because everything is 
locked.  Therefore nothing other connections try to do will be written to the 
binlog while you have the locks open (unless you make those changes yourself, 
which I have never tried to do).

Cheers
Baron

Ananda Kumar wrote:
> Hi Baron,
> Its only a read lock, so changes on these table should be allowed, that is
> what the documentaion say. And the changes will be in bin-log till the READ
> lock is held.
> 
> regards
> anandkl
> 
> 
> On 5/30/07, Baron Schwartz <baron@xaprb.com> wrote:
>>
>> Hi,
>>
>> Ananda Kumar wrote:
>> > Hi All,
>> > This question just for information sake.
>> > If i do
>> >
>> > flush table lock read;
>>
>> I think you mean FLUSH TABLES WITH READ LOCK?
>>
>> > Any changes happening on tables during this period, will it be viewable
>> by
>> > another user or will the user have to wait till the lock is released to
>> see
>> > the new changes
>> > And once the lock is released, does mysql apply all the changes from
>> > bin-log
>> > to the respective tables.
>>
>> The tables are locked.  There will be no changes while they are locked.
>>
>> I don't think I really understand your question.
>>
>> Baron
>>
> 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql-marcsub@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic