Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-19593

Split create_schema_table() into virtual methods in Type_handler

    XMLWordPrintable

Details

    Description

      The code in create_schema_table() has switch's and if's testing MYSQL_TYPE_XXX.
      This is not friendly to data type plugins.

      Additionally, when schema tables are created in two steps:

      • On the first step, Items are created from ST_FIELD_INFO
      • On the second step, these Items create Fields
        which is slow.

      Let's do the following:

      • Add a new method in Type_handler:

           virtual Field *make_schema_field(TABLE *table,
                                            const Record_addr &addr,
                                            const ST_FIELD_INFO &def,
                                            bool show_field) const
        

      • Change the logic to create Fields directly from ST_FIELD_INFO.
      • For that purpose, and to be able to reuse the code in a convenient way, wrap create_tmp_table() into a class Create_tmp_table with approximately these methods:

      class Create_tmp_table
      {
      public:
        ...
        // The former beginning of create_tmp_table()
        TABLE *start(THD *thd,
                     TMP_TABLE_PARAM *param,
                     const LEX_CSTRING *table_alias);
       
        // The former loop of create_tmp_table(), adding fields into the table
        bool add_fields(THD *thd, TABLE *table,
                        TMP_TABLE_PARAM *param, List<Item> &fields);
       
        // A new code adding fields directly from ST_FIELD_INFO
        bool add_schema_fields(THD *thd, TABLE *table,
                               TMP_TABLE_PARAM *param,
                               const ST_SCHEMA_TABLE &schema_table,
                               const MY_BITMAP &bitmap);
       
        // The forder end of create_tmp_table(), after the loop adding fields.
        bool finalize(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
                      bool do_not_open, bool keep_row_order);
      };
      

      • Remove method Item::create_field_for_schema()
      • Remove class Item_return_date_time
      • Remove class Item_blob

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.