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

IMPORT TABLESPACE unnecessarily traverses tablespaces list

    XMLWordPrintable

Details

    Description

      ALTER TABLE ... IMPORT TABLESPACE causes hang while running on database which has large no. of tables or partitions. I was able to reproduce the same at my local machine, here is the backtrace. (attached full backtrace)

      Thread 9 (Thread 0x7fd134e9f700 (LWP 5023)):
      #0 0x00007fd14238f2a6 in open64 () from /lib64/libpthread.so.0
      #1 0x000055cf86deec94 in open (__oflag=524290, __path=0x7fd0f5980088 "./neel_test/output#P#p571.ibd") at /usr/include/bits/fcntl2.h:59
      #2 os_file_create_func (name=name@entry=0x7fd0f5980088 "./neel_test/output#P#p571.ibd", create_mode=51, create_mode@entry=179, purpose=purpose@entry=61, type=type@entry=100, read_only=read_only@entry=false, success=success@entry=0x7fd134e9d650) at /home/buildbot/buildbot/build/storage/innobase/os/os0file.cc:1210
      #3 0x000055cf86f4f2fe in pfs_os_file_create_func (purpose=61, src_file=0x55cf8742c970 "/home/buildbot/buildbot/build/storage/innobase/fil/fil0fil.cc", src_line=383, src_file=0x55cf8742c970 "/home/buildbot/buildbot/build/storage/innobase/fil/fil0fil.cc", success=0x7fd134e9d650, read_only=<optimized out>, type=<optimized out>, purpose=61, create_mode=179, name=0x7fd0f5980088 "./neel_test/output#P#p571.ibd", key=<optimized out>) at /home/buildbot/buildbot/build/storage/innobase/include/os0file.inl:168
      #4 fil_node_open_file_low (node=node@entry=0x7fd10d3ca958) at /home/buildbot/buildbot/build/storage/innobase/fil/fil0fil.cc:383
      #5 0x000055cf86f527cd in fil_node_open_file (node=node@entry=0x7fd10d3ca958) at /home/buildbot/buildbot/build/storage/innobase/fil/fil0fil.cc:465
      #6 0x000055cf8670a7b9 in fil_space_t::prepare_acquired (this=this@entry=0x7fd0f51ba478) at /home/buildbot/buildbot/build/storage/innobase/fil/fil0fil.cc:676
      #7 0x000055cf86f5a5c4 in fil_space_t::acquire_if_not_stopped (this=<optimized out>) at /home/buildbot/buildbot/build/storage/innobase/fil/fil0crypt.cc:1345
      #8 fil_crypt_default_encrypt_tables_fill () at /home/buildbot/buildbot/build/storage/innobase/fil/fil0crypt.cc:2141
      #9 0x000055cf86f5ebcd in fil_crypt_set_encrypt_tables (val=0) at /home/buildbot/buildbot/build/storage/innobase/fil/fil0crypt.cc:2217
      #10 0x000055cf86d8e869 in ha_innobase::discard_or_import_tablespace (this=0x7fd0f41c9d50, discard=<optimized out>) at /home/buildbot/buildbot/build/storage/innobase/handler/ha_innodb.cc:13426
      #11 0x000055cf868d06bc in mysql_discard_or_import_tablespace (thd=thd@entry=0x7fd10c0018a8, table_list=table_list@entry=0x7fd10c011260, discard=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_table.cc:5553
      #12 0x000055cf86942805 in Sql_cmd_discard_import_tablespace::execute (this=0x7fd10c011978, thd=0x7fd10c0018a8) at /home/buildbot/buildbot/build/sql/sql_alter.cc:714
      #13 0x000055cf8683b5c9 in mysql_execute_command (thd=thd@entry=0x7fd10c0018a8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /home/buildbot/buildbot/build/sql/sql_parse.cc:6091
      #14 0x000055cf8683f05b in mysql_parse (thd=thd@entry=0x7fd10c0018a8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fd134e9e1e0) at /home/buildbot/buildbot/build/sql/sql_parse.cc:8117
      #15 0x000055cf868414b0 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fd10c0018a8, packet=packet@entry=0x7fd10cd2bdf9 "ALTER TABLE t1 IMPORT TABLESPACE", packet_length=packet_length@entry=32, blocking=blocking@entry=true) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1896
      #16 0x000055cf86842a43 in do_command (thd=0x7fd10c0018a8, blocking=blocking@entry=true) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1410
      #17 0x000055cf8693de47 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55cf8a42de68, put_in_cache=put_in_cache@entry=true) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1415
      #18 0x000055cf8693e0e4 in handle_one_connection (arg=arg@entry=0x55cf8a42de68) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1317
      #19 0x000055cf86cdb10c in pfs_spawn_thread (arg=0x55cf8a3e2d58) at /home/buildbot/buildbot/build/storage/perfschema/pfs.cc:2201
      #20 0x00007fd1423851ca in start_thread () from /lib64/libpthread.so.0
      #21 0x00007fd1416d6e73 in clone () from /lib64/libc.so.6
      

      I had total 8000 data files on the server. By default innodb_open_files was 2000. When I've increased it to 15000. It worked fine without hang.

      Attachments

        Activity

          People

            thiru Thirunarayanan Balathandayuthapani
            niljoshi Nilnandan Joshi
            Votes:
            1 Vote for this issue
            Watchers:
            4 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.