← Back to team overview

maria-developers team mailing list archive

Re: MDEV-136 Non-blocking "set read_only"

 

Hi!

>>>>> "Sergei" == Sergei Golubchik <serg@xxxxxxxxxxxx> writes:

<cut>

>> === modified file 'sql/sql_base.cc'
>> --- a/sql/sql_base.cc	2012-04-19 06:16:30 +0000
>> +++ b/sql/sql_base.cc	2012-05-09 18:59:45 +0000
>> @@ -933,7 +938,8 @@
>> for (uint idx=0 ; idx < open_cache.records ; idx++)
>> {
>> TABLE *table=(TABLE*) hash_element(&open_cache,idx);
>> -        if (table->in_use)
>> +        if (table->in_use &&
>> +            (!set_readonly_mode || !table->file->has_transactions()))

Sergei> I wonder how this could work. The line below sets a flag *on a thread*.
Sergei> The task description tells "not wait for transactional tables", while your
Sergei> change means "not set a flag if all tables used in a thread are
Sergei> transactional". That is, if a thread uses both transactional and
Sergei> non-transactional tables, your change does nothing.

I think this is actually correct.
If a statement uses both transactional and non-transactional tables,
the non transactional tables should be flushed as part of set readonly=1

The flag:
table->in_use->some_tables_deleted
is only use as a check if thr_lock() should fail.
If you have a single non transactional table and the thread is doing a
lock tables, we should close the table (and thus all the tables) and
reopen it.

However there is a couple of other things that needs to be done.

If we are not going to increment the refresh version when doing
set readonly, we should reset the refresh version for any non
transactional open table to 0 to force it to be reopened.

Holyfoot, how did you test this feature?

Regards,
Monty


Follow ups

References