maria-discuss team mailing list archive
Mailing list archive
Re: How to lock individual tables in 1-db-per-file binlogging (Was: Re: Per-db binlogging)
Thanks for the pointers! I'd like to lock an entire database. (I guess
I can iterate through the tables in database if that's the only way.
[I suppose there might be possible locking issues to deal with ...])
I'll look at the source you recommend ...
On Mon, Oct 18, 2010 at 12:48 PM, Davi Arnaut <davi.arnaut@xxxxxxxxxx> wrote:
> On 10/18/10 3:16 PM, Weldon Whipple wrote:
>> Well, I finished a working prototype that does everything except the
>> locking and unlocking of databases. Someone mentioned that it's now
>> possible to lock individual tables. Would you--anyone--be willing to
>> point me toward places in the 5.5 code that use that
> Do you want to lock the database, or individual tables, or both? Anyway,
> take a look at mysql_rm_db as the locking is all very similar. Roughly, the
> algorithm of a DROP DATABASE is:
> // Protect against other schema operations
> // Build list of tables in the db1 directory
> table_list = ..
> // Initialize metadata lock request
> table_list->table_name, MDL_EXCLUSIVE);
> // Lock tables
> lock_table_names(thd, tables, NULL ...)
> // Remove from cache and drop the table...
> The best thing at this point is to study (and debug) a similar statement and
> understand how metadata locks work (mdl prefix) or how tables are
> MySQL Internals Mailing List
> For list archives: http://lists.mysql.com/internals
> To unsubscribe: http://lists.mysql.com/internals?unsub=weldon@xxxxxxxxxxx