Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1.3
    • OTHER
    • None

    Description

      This is a pre-requisite task for:
      MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

      HA_CREATE_INFO contains:

      • DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.
      • Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

      So these two parts should be moved out of HA_CREATE_INFO.

      Proposed new structure hierarchy:
      1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
      This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
      2. Schema_specification_st
      This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
      3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
      4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
      This will be passed to handlers
      5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
      This will be passed to mysql_create_table.

      Also, API for some functions has to be changed:

      • SCHEMA routines: mysql_create_db, mysql_drop_db
      • TABLE routines: mysql_create_table, mysql_drop_table
        and some others. The new structures will now be passed instead of HA_CREATE_INFO

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            Description This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            These two parts should be moved out of HA_CREATE_INFO.
            Proposed structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db and mysql_drop_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others.

            It would be very nice to have these methods wrapped into classes, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB.


            {note}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {note}
            This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            These two parts should be moved out of HA_CREATE_INFO.
            Proposed structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db and mysql_drop_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others.

            It would be very nice to have these methods wrapped into classes, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            bar Alexander Barkov made changes -
            Assignee Alexander Barkov [ bar ] Sergei Golubchik [ serg ]
            bar Alexander Barkov made changes -
            Description This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            These two parts should be moved out of HA_CREATE_INFO.
            Proposed structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db and mysql_drop_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others.

            It would be very nice to have these methods wrapped into classes, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            bar Alexander Barkov made changes -
            Description This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB. This task will wrap SCHEMA related routines, as the easiest one.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            bar Alexander Barkov made changes -
            Description This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB. This task will wrap SCHEMA related routines, as the easiest one.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB. This task will wrap SCHEMA related routines, as the easiest one and the one that has a lot of duplicate code.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            bar Alexander Barkov made changes -
            Description This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB. This task will wrap SCHEMA related routines, as the easiest one and the one that has a lot of duplicate code.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB. This task will wrap SCHEMA related routines, as SCHEMA the easiest one to refactor, and the one that has a lot of duplicate code.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            bar Alexander Barkov made changes -
            Description This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB. This task will wrap SCHEMA related routines, as SCHEMA the easiest one to refactor, and the one that has a lot of duplicate code.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB. This task will wrap SCHEMA related routines, as SCHEMA is the easiest one to refactor, and the one that has a lot of duplicate code.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            bar Alexander Barkov made changes -
            Description This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - mysql_create_db, mysql_drop_db
            - mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB. This task will wrap SCHEMA related routines, as SCHEMA is the easiest one to refactor, and the one that has a lot of duplicate code.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - SCHEMA routines: mysql_create_db, mysql_drop_db
            - TABLE routines: mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB. This task will wrap SCHEMA related routines, as SCHEMA is the easiest one to refactor, and the one that has a lot of duplicate code.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            bar Alexander Barkov made changes -
            Fix Version/s 10.1 [ 16100 ]
            Fix Version/s 10.1.2 [ 15801 ]
            serg Sergei Golubchik made changes -
            Affects Version/s 10.1.1 [ 16801 ]
            Issue Type Bug [ 1 ] Task [ 3 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.1.2 [ 15801 ]
            Fix Version/s 10.1 [ 16100 ]
            serg Sergei Golubchik made changes -
            Status Open [ 1 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            Status In Review [ 10002 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Alexander Barkov [ bar ]
            bar Alexander Barkov made changes -
            Component/s OTHER [ 10125 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            bar Alexander Barkov made changes -
            Description This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - SCHEMA routines: mysql_create_db, mysql_drop_db
            - TABLE routines: mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            It would be very nice to have these functions wrapped into classes as methods, to share some pieces of the code easier between different commands of the same database object. Look at four very similar pieces of the code in sql_parse.cc performed for SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB_UPGRADE,SQLCOM_ALTER_DB. This task will wrap SCHEMA related routines, as SCHEMA is the easiest one to refactor, and the one that has a lot of duplicate code.


            {panel}
            Note, with this approach in the future we can refactor more code, to share more pieces not only between commands of the same database object, but also between different database objects (e.g. tables, triggers, SP, all the rest). All SQL statements basically consist of these stepts:
            - Check if statement can be executed (e.g. name in "CREATE SCHEMA name" is valid).
            - Check access
            - Apply filters for DDL statements (e.g. Rpl_filters on slave)
            - Perform WSREP_TO_ISOLATION
             - Execute the actual action
            {panel}
            This is a pre-requisite task for:
            MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

            HA_CREATE_INFO contains:
            - DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.

            - Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.

            So these two parts should be moved out of HA_CREATE_INFO.

            Proposed new structure hierarchy:
            1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
               This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
            2. Schema_specification_st
               This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
            3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
            4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
              This will be passed to handlers
            5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
              This will be passed to mysql_create_table.

            Also, API for some functions has to be changed:
            - SCHEMA routines: mysql_create_db, mysql_drop_db
            - TABLE routines: mysql_create_table, mysql_drop_table
            and some others. The new structures will now be passed instead of HA_CREATE_INFO

            elenst Elena Stepanova made changes -
            Fix Version/s 10.1.3 [ 18000 ]
            Fix Version/s 10.1.2 [ 15801 ]
            ratzpo Rasmus Johansson (Inactive) made changes -
            Workflow MariaDB v2 [ 58457 ] MariaDB v3 [ 64985 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 64985 ] MariaDB v4 [ 132462 ]

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.