← Back to team overview

maria-developers team mailing list archive

Re: Open and close a TABLE_LIST at random place in code

 

Hello.

I need to know whether a table is a SYSTEM VERSIONING table. It's needed for MDEV-16231. And also it's needed to disable TRUNCATE TABLE for MDEV-15966: one code path do not open table at all.

31.05.2018, 14:11, "Sergei Golubchik" <serg@xxxxxxxxxxx>:
> Hi, Eugene!
>
> What are you trying to do in the first place?
>
> On May 30, Eugene Kosov wrote:
>>  Hello.
>>
>>  I need to see a table structure while executing some query (DELETE in my case, but there will be more query types in future). I have a TABLE_LIST which came from a parser. Now I'm opening it with open_table_only_view_structure(), examine table structure and close it, trying to prevent any side effects. And there is a lot of them.
>>
>>  Current code looks like this:
>>
>>    if (open_tables_only_view_structure(thd, table_list, false))
>>    {
>>      return true;
>>    }
>>
>>    // examine table structure
>>
>>    close_mysql_tables(thd);
>>
>>    for (Sroutine_hash_entry *e = thd->lex->sroutines_list.first;e; e=e->next)
>>      e->mdl_request.ticket= NULL;
>>
>>    for (TABLE_LIST *it= table_list; it; it= it->next_global)
>>    {
>>      it->table= NULL;
>>      it->reinit_before_use(thd);
>>      //it->next_global= NULL;
>>      it->derived_result= NULL;
>>      it->derived= NULL;
>>      it->view= NULL;
>>      it->view_tables= NULL;
>>      it->view_sctx= NULL;
>>      it->file_version= 0;
>>      it->mariadb_version= 0;
>>      it->updatable_view= 0;
>>      it->view_suid= 0;
>>      it->derived_type= 0;
>>      it->open_type= OT_BASE_ONLY;
>>      it->view_creation_ctx= 0;
>>      // it->set_table_ref_id(TABLE_REF_NULL, 0);
>>    }
>>
>>  Is there a way to close a TABLE_LIST gracefully without touching a lot of it's fields? Or even maybe it's possible to open a table in a simpler manner?
>>
>>  --
>>  Eugene
>>
>>  _______________________________________________
>>  Mailing list: https://launchpad.net/~maria-developers
>>  Post to : maria-developers@xxxxxxxxxxxxxxxxxxx
>>  Unsubscribe : https://launchpad.net/~maria-developers
>>  More help : https://help.launchpad.net/ListHelp
>
> Regards,
> Sergei
> Chief Architect MariaDB
> and security@xxxxxxxxxxx

-- 
Eugene



Follow ups

References