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

Optimize check on sequences earlier for alter

    XMLWordPrintable

Details

    Description

      Function check_sequence_fields is used to check sequence fields. It is called from mysql_prepare_create_table that happens during table creation
      When altering the table the same functions are called.
      Let's look error message generate from check_sequence_fields:

      #0  my_message_sql (error=21845, str=0x7ffff1f2e570 "\240\345\362\361\377\177", MyFlags=93825015206591) at /home/anel/GitHub/mariadb/server/src/10.5/sql/mysqld.cc:3094
      #1  0x0000555556b2f5a6 in my_error (nr=4086, MyFlags=0) at /home/anel/GitHub/mariadb/server/src/10.5/mysys/my_error.c:124
      #2  0x000055555612f898 in check_sequence_fields (lex=0x7fffe0004e30, fields=0x7ffff1f31270) at /home/anel/GitHub/mariadb/server/src/10.5/sql/sql_sequence.cc:237
      #3  0x0000555555f92b67 in mysql_prepare_create_table (thd=0x7fffe0000d48, create_info=0x7ffff1f312e0, alter_info=0x7ffff1f311f0, db_options=0x7ffff1f2ec4c, file=0x7fffe0017760, key_info_buffer=0x7ffff1f2f5f8, key_count=0x7ffff1f2f5d8, create_table_mode=-2) at /home/anel/GitHub/mariadb/server/src/10.5/sql/sql_table.cc:3621
      #4  0x0000555555f979d9 in mysql_create_frm_image (thd=0x7fffe0000d48, create_info=0x7ffff1f312e0, alter_info=0x7ffff1f311f0, create_table_mode=-2, key_info=0x7ffff1f2f5f8, key_count=0x7ffff1f2f5d8, frm=0x7ffff1f2f670) at /home/anel/GitHub/mariadb/server/src/10.5/sql/sql_table.cc:5069
      #5  0x0000555555f98600 in create_table_impl (thd=0x7fffe0000d48, orig_db=@0x7ffff1f306b0: {str = 0x7fffe0016d10 "test", length = 4}, orig_table_name=@0x7ffff1f306c0: {str = 0x7fffe00165d0 "seq1", length = 4}, db=@0x7ffff1f306e0: {str = 0x7fffe0016d10 "test", length = 4}, table_name=@0x7ffff1f30710: {str = 0x7ffff1f30a4b "#sql-alter-9696-3", length = 17}, path=0x7ffff1f30f0e "/home/anel/GitHub/mariadb/server/build/10.5/mysql-test/var/tmp/mysqld.1/#sql-temptable-9696-3-1", options={m_options = DDL_options_st::OPT_NONE}, create_info=0x7ffff1f312e0, alter_info=0x7ffff1f311f0, create_table_mode=-2, is_trans=0x0, key_info=0x7ffff1f2f5f8, key_count=0x7ffff1f2f5d8, frm=0x7ffff1f2f670) at /home/anel/GitHub/mariadb/server/src/10.5/sql/sql_table.cc:5349
      #6  0x0000555555fa8b43 in mysql_alter_table (thd=0x7fffe0000d48, new_db=0x7fffe00057d8, new_name=0x7fffe0005c28, create_info=0x7ffff1f312e0, table_list=0x7fffe0016610, recreate_info=0x7ffff1f311b0, alter_info=0x7ffff1f311f0, order_num=0, order=0x0, ignore=false, if_exists=false) at /home/anel/GitHub/mariadb/server/src/10.5/sql/sql_table.cc:10753
      

      During alter of table function mysql_prepare_alter_table is called before calling create_table_impl.
      We may create optimization here to call check_sequence_fields from mysql_prepare_alter_table that will generate error before mysql_prepare_create_table is called.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              anel Anel Husakovic
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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