List:Internals« Previous MessageNext Message »
From:Weldon Whipple Date:October 18 2010 8:21pm
Subject:Re: How to lock individual tables in 1-db-per-file binlogging (Was:
View as plain text  
Davi,

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 ...

Weldon
weldon@stripped


On Mon, Oct 18, 2010 at 12:48 PM, Davi Arnaut <davi.arnaut@stripped> 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
>> locking/unlocking?
>>
>
> 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
>        lock_schema_name("db1");
>        // Build list of tables in the db1 directory
>        table_list = ..
>        // Initialize metadata lock request
>        table_list->mdl_request.init(MDL_key::TABLE,
>                table_list->db,
>                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
> open/locked.
>
> Regards,
>
> Davi
>
> --
> MySQL Internals Mailing List
> For list archives: http://lists.mysql.com/internals
> To unsubscribe:    http://lists.mysql.com/internals?unsub=1
>
>
Thread
How to lock individual tables in 1-db-per-file binlogging (Was: Re:Per-db binlogging)Weldon Whipple18 Oct
  • Re: How to lock individual tables in 1-db-per-file binlogging (Was:Re: Per-db binlogging)Davi Arnaut18 Oct
    • Re: How to lock individual tables in 1-db-per-file binlogging (Was:Re: Per-db binlogging)Weldon Whipple18 Oct
    • Re: How to lock individual tables in 1-db-per-file binlogging (Was:Re: Per-db binlogging)Weldon Whipple19 Oct
      • Re: How to lock individual tables in 1-db-per-file binlogging(Was: Re: Per-db binlogging)Dmitry Lenev22 Oct
        • Re: How to lock individual tables in 1-db-per-file binlogging (Was:Re: Per-db binlogging)Weldon Whipple28 Oct
          • Re: How to lock individual tables in 1-db-per-file binlogging (Was: Re: Per-db binlogging)Mark Leith28 Oct
            • Re: How to lock individual tables in 1-db-per-file binlogging (Was:Re: Per-db binlogging)Weldon Whipple29 Oct