List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:September 6 2001 5:57pm
Subject:UNLOCK TABLES implementation question...
View as plain text  
hi!

>>>>> "Jeremy" == Jeremy Zawodny <jzawodn@stripped> writes:

Jeremy> I've run across a need that has made we want to extend the way UNLOCK
Jeremy> TABLES works.  And after looking at the manual:

Jeremy>   http://www.mysql.com/doc/L/O/LOCK_TABLES.html

Jeremy> I see that one of the reader comments gets at the same question I
Jeremy> have.

Jeremy> Why can't I unlock named tables?  Why must I unlock them all at once?

Jeremy> I understand that you can NOT lock more tables once you have any table
Jeremy> locks (to prevent deadlocks), but is there any reason it would be
Jeremy> unsafe to selectively unlock tables?

Not really; This could be done without compromising the locking
mechanism.

(MySQL actually already do this internally in some cases)


Jeremy> I've been thinking about it and poking at the code a bit, but I can't
Jeremy> think of any reason why it'd be a problem.

There isn't.

Jeremy> I've looked at the code a bit and it doesn't seem to difficult to
Jeremy> implement, but if it just won't work for some reason, I'd rather know
Jeremy> now so that I don't spend any time on it.

The only thing you need to do is to call:

sql/lock.cc::mysql_unlock_some_tables() with the tables you want to
unlock and then remove them from the thd->locked_tables list.

Jeremy> If anyone is interested, I can elaborate on the need for this.

No need for it;  I think I know why you would like to do this.

If you need more input about this, don't be afraid to ask ;)

Regards,
Monty
Thread
UNLOCK TABLES implementation question...Jeremy Zawodny5 Sep
  • UNLOCK TABLES implementation question...Michael Widenius6 Sep