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

SIGSEGV in spider_check_and_set_trx_isolation and I_P_List_iterator from THD::drop_temporary_table (10.5.3 opt only) on ALTER

Details

    Description

      INSTALL PLUGIN spider SONAME 'ha_spider.so';
      CREATE TABLE t (c INT) ENGINE=SPIDER PARTITION BY LIST COLUMNS (c) (PARTITION p DEFAULT ENGINE=SPIDER);
      INSERT INTO t VALUES (1);
      ALTER TABLE t CHECK PARTITION ALL;
      

      Leads to:

      10.7.0 1bc82aaf0a7746c0921a94034aff2d51f0d75cd0 (Debug)

      Core was generated by `/test/MD040921-mariadb-10.7.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  spider_check_and_set_trx_isolation (conn=0x1464b008e868, 
          need_mon=<optimized out>) at /test/10.7_dbg/storage/spider/spd_trx.cc:1698
      1698      if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL)
      [Current thread is 1 (Thread 0x1464fc5ad700 (LWP 3331251))]
      (gdb) bt
      #0  spider_check_and_set_trx_isolation (conn=0x1464b008e868, need_mon=<optimized out>) at /test/10.7_dbg/storage/spider/spd_trx.cc:1698
      #1  0x00001464c3b51bdf in ha_spider::dml_init (this=this@entry=0x1464b007c610) at /test/10.7_dbg/storage/spider/ha_spider.cc:16563
      #2  0x00001464c3b55785 in ha_spider::rnd_init (this=0x1464b007c610, scan=<optimized out>) at /test/10.7_dbg/storage/spider/ha_spider.cc:7336
      #3  0x000055b0885681f9 in handler::ha_rnd_init (scan=true, this=0x1464b007c610) at /test/10.7_dbg/sql/handler.h:3535
      #4  ha_partition::check_misplaced_rows (this=this@entry=0x1464b002fc20, read_part_id=read_part_id@entry=0, do_repair=do_repair@entry=false) at /test/10.7_dbg/sql/ha_partition.cc:11089
      #5  0x000055b088568b8a in ha_partition::handle_opt_part (this=this@entry=0x1464b002fc20, thd=thd@entry=0x1464b0000db8, check_opt=check_opt@entry=0x1464b00063b8, part_id=part_id@entry=0, flag=flag@entry=3) at /test/10.7_dbg/sql/ha_partition.cc:1378
      #6  0x000055b088568e5e in ha_partition::handle_opt_partitions (this=this@entry=0x1464b002fc20, thd=thd@entry=0x1464b0000db8, check_opt=check_opt@entry=0x1464b00063b8, flag=flag@entry=3) at /test/10.7_dbg/sql/ha_partition.cc:1548
      #7  0x000055b08856916c in ha_partition::check (this=0x1464b002fc20, thd=0x1464b0000db8, check_opt=0x1464b00063b8) at /test/10.7_dbg/sql/ha_partition.cc:1280
      #8  0x000055b088298ad1 in handler::ha_check (this=0x1464b002fc20, thd=0x1464b0000db8, check_opt=0x1464b00063b8) at /test/10.7_dbg/sql/handler.cc:4922
      #9  0x000055b08811b020 in mysql_admin_table (thd=thd@entry=0x1464b0000db8, tables=tables@entry=0x1464b0013d68, check_opt=check_opt@entry=0x1464b00063b8, operator_name=operator_name@entry=0x55b08934ac60 <msg_check>, lock_type=lock_type@entry=TL_READ_NO_INSERT, org_open_for_modify=org_open_for_modify@entry=false, repair_table_use_frm=false, extra_open_options=32, prepare_func=0x0, operator_func=(int (handler::*)(handler * const, THD *, HA_CHECK_OPT *)) 0x55b088298a6a <handler::ha_check(THD*, st_ha_check_opt*)>, view_operator_func=0x55b0880b1f32 <view_check(THD*, TABLE_LIST*, st_ha_check_opt*)>, is_cmd_replicated=false) at /test/10.7_dbg/sql/sql_admin.cc:919
      #10 0x000055b08811d47e in Sql_cmd_check_table::execute (this=this@entry=0x1464b0014450, thd=thd@entry=0x1464b0000db8) at /test/10.7_dbg/sql/sql_admin.cc:1517
      #11 0x000055b088108abc in Sql_cmd_alter_table_check_partition::execute (this=0x1464b0014450, thd=0x1464b0000db8) at /test/10.7_dbg/sql/sql_partition_admin.cc:790
      #12 0x000055b087f99029 in mysql_execute_command (thd=thd@entry=0x1464b0000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.7_dbg/sql/sql_parse.cc:5997
      #13 0x000055b087f7fccb in mysql_parse (thd=thd@entry=0x1464b0000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1464fc5ac400) at /test/10.7_dbg/sql/sql_parse.cc:8036
      #14 0x000055b087f8e8d0 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1464b0000db8, packet=packet@entry=0x1464b000b739 "", packet_length=packet_length@entry=33, blocking=blocking@entry=true) at /test/10.7_dbg/sql/sql_class.h:1358
      #15 0x000055b087f91cd6 in do_command (thd=0x1464b0000db8, blocking=blocking@entry=true) at /test/10.7_dbg/sql/sql_parse.cc:1404
      #16 0x000055b0881080c8 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55b08c1831d8, put_in_cache=put_in_cache@entry=true) at /test/10.7_dbg/sql/sql_connect.cc:1418
      #17 0x000055b0881086cd in handle_one_connection (arg=arg@entry=0x55b08c1831d8) at /test/10.7_dbg/sql/sql_connect.cc:1312
      #18 0x000055b088571ade in pfs_spawn_thread (arg=0x55b08c082348) at /test/10.7_dbg/storage/perfschema/pfs.cc:2201
      #19 0x000014650067a609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #20 0x0000146500268293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.13 (dbg), 10.5.13 (opt), 10.6.5 (dbg), 10.6.5 (opt), 10.7.0 (dbg), 10.7.0 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.41 (dbg), 10.2.41 (opt), 10.3.32 (dbg), 10.3.32 (opt), 10.4.22 (dbg), 10.4.22 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.35 (dbg), 5.7.35 (opt), 8.0.26 (dbg), 8.0.26 (opt)

      10.4 Works correctly:

      10.4.22 46c3e7e3537c31a94289033bfeccf3faf8d4069e (Debug)

      10.4.22-dbg>ALTER TABLE t CHECK PARTITION ALL;
      +--------+-------+----------+----------+
      | Table  | Op    | Msg_type | Msg_text |
      +--------+-------+----------+----------+
      | test.t | check | status   | OK       |
      +--------+-------+----------+----------+
      1 row in set (0.000 sec)
      

      OR (Alternative testcase):

      INSTALL PLUGIN spider SONAME 'ha_spider.so';
      CREATE TABLE t (c INT) ENGINE=SPIDER PARTITION BY LIST COLUMNS (c) (PARTITION p DEFAULT ENGINE=SPIDER);
      SELECT * FROM t;
      ALTER TABLE t ENGINE=MEMORY;
      

      Leads to:

      10.7.0 1bc82aaf0a7746c0921a94034aff2d51f0d75cd0 (Debug)

      Core was generated by `/test/MD040921-mariadb-10.7.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  spider_check_and_set_trx_isolation (conn=0x15532008e868, 
          need_mon=<optimized out>) at /test/10.7_dbg/storage/spider/spd_trx.cc:1698
      1698	  if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL)
      [Current thread is 1 (Thread 0x1553749e0700 (LWP 1456230))]
      (gdb) bt
      #0  spider_check_and_set_trx_isolation (conn=0x15532008e868, need_mon=<optimized out>) at /test/10.7_dbg/storage/spider/spd_trx.cc:1698
      #1  0x00001553602a3bdf in ha_spider::dml_init (this=this@entry=0x15532007c610) at /test/10.7_dbg/storage/spider/ha_spider.cc:16563
      #2  0x00001553602a7785 in ha_spider::rnd_init (this=0x15532007c610, scan=<optimized out>) at /test/10.7_dbg/storage/spider/ha_spider.cc:7336
      #3  0x00005575f65721a6 in handler::ha_rnd_init (scan=true, this=0x15532007c610) at /test/10.7_dbg/sql/handler.h:3535
      #4  ha_partition::rnd_init (this=0x15532002fc20, scan=true) at /test/10.7_dbg/sql/ha_partition.cc:5133
      #5  0x00005575f62a3435 in handler::ha_rnd_init (scan=true, this=0x15532002fc20) at /test/10.7_dbg/sql/handler.h:3535
      #6  handler::ha_rnd_init_with_error (this=0x15532002fc20, scan=scan@entry=true) at /test/10.7_dbg/sql/handler.cc:3614
      #7  0x00005575f5e96f79 in init_read_record (info=info@entry=0x1553749dc080, thd=thd@entry=0x155320000db8, table=table@entry=0x15532002f348, select=select@entry=0x0, filesort=filesort@entry=0x0, use_record_cache=use_record_cache@entry=1, print_error=true, disable_rr_cache=false) at /test/10.7_dbg/sql/records.cc:328
      #8  0x00005575f608f1ce in copy_data_between_tables (alter_ctx=0x1553749dd6b0, keys_onoff=<optimized out>, deleted=<synthetic pointer>, copied=<synthetic pointer>, order=<optimized out>, order_num=<optimized out>, ignore=<optimized out>, create=@0x1553749dd960: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x0, last = 0x2f747365742f2e00, elements = 1919299188}, <No data fields>}, to=0x1553200ccff8, from=0x15532002f348, thd=0x155320000db8) at /test/10.7_dbg/sql/sql_table.cc:11000
      #9  mysql_alter_table (thd=thd@entry=0x155320000db8, new_db=new_db@entry=0x1553200059b8, new_name=new_name@entry=0x155320005dd0, create_info=create_info@entry=0x1553749de4d0, table_list=<optimized out>, table_list@entry=0x155320013d60, alter_info=alter_info@entry=0x1553749de3e0, order_num=<optimized out>, order=<optimized out>, ignore=<optimized out>, if_exists=<optimized out>) at /test/10.7_dbg/sql/sql_table.cc:10356
      #10 0x00005575f611d0bb in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x155320000db8) at /test/10.7_dbg/sql/structs.h:568
      #11 0x00005575f5fa6029 in mysql_execute_command (thd=thd@entry=0x155320000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.7_dbg/sql/sql_parse.cc:5997
      #12 0x00005575f5f8cccb in mysql_parse (thd=thd@entry=0x155320000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1553749df400) at /test/10.7_dbg/sql/sql_parse.cc:8036
      #13 0x00005575f5f9b8d0 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x155320000db8, packet=packet@entry=0x15532000b739 "ALTER TABLE t ENGINE=MEMORY", packet_length=packet_length@entry=27, blocking=blocking@entry=true) at /test/10.7_dbg/sql/sql_class.h:1358
      #14 0x00005575f5f9ecd6 in do_command (thd=0x155320000db8, blocking=blocking@entry=true) at /test/10.7_dbg/sql/sql_parse.cc:1404
      #15 0x00005575f61150c8 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5575f98d2078, put_in_cache=put_in_cache@entry=true) at /test/10.7_dbg/sql/sql_connect.cc:1418
      #16 0x00005575f61156cd in handle_one_connection (arg=arg@entry=0x5575f98d2078) at /test/10.7_dbg/sql/sql_connect.cc:1312
      #17 0x00005575f657eade in pfs_spawn_thread (arg=0x5575f97d12b8) at /test/10.7_dbg/storage/perfschema/pfs.cc:2201
      #18 0x0000155377aad609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #19 0x000015537769b293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.13 (dbg), 10.5.13 (opt), 10.6.5 (dbg), 10.6.5 (opt), 10.7.0 (dbg), 10.7.0 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.41 (dbg), 10.2.41 (opt), 10.3.32 (dbg), 10.3.32 (opt), 10.4.22 (dbg), 10.4.22 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.35 (dbg), 5.7.35 (opt), 8.0.26 (dbg), 8.0.26 (opt)

      Attachments

        Issue Links

          Activity

            A connection is freed at the end of the INSERT and then is accessed by the ALTER TABLE.

            Thread 2 received signal SIGSEGV, Segmentation fault.
            [Switching to Thread 61780.61825]
            0x00007f323d865dcf in spider_check_and_set_trx_isolation (conn=0x7f323012a9f8, need_mon=0x7f3230128e20) at /home/nayuta/repo/mariadb-server/storage/spider/spd_trx.cc:1640
            1640      if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL)
            (rr) watch -l conn->thd
            Hardware watchpoint 1: -location conn->thd
            (rr) rc
            Continuing.
             
            Thread 2 received signal SIGSEGV, Segmentation fault.
            0x00007f323d865dcf in spider_check_and_set_trx_isolation (conn=0x7f323012a9f8, need_mon=0x7f3230128e20) at /home/nayuta/repo/mariadb-server/storage/spider/spd_trx.cc:1640
            1640      if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL)
            (rr) 
            Continuing.
             
            Thread 2 hit Hardware watchpoint 1: -location conn->thd
             
            Old value = (THD *) 0x8f8f8f8f8f8f8f8f
            New value = (THD *) 0x0
            0x00007f3255330474 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
            (rr) bt
            #0  0x00007f3255330474 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
            #1  0x000055cae84323c6 in free_memory (ptr=0x7f323012a9d0) at /home/nayuta/repo/mariadb-server/mysys/safemalloc.c:279
            #2  0x000055cae843207c in sf_free (ptr=0x7f323012a9d0) at /home/nayuta/repo/mariadb-server/mysys/safemalloc.c:198
            #3  0x000055cae841f3cb in my_free (ptr=0x7f323012a9e8) at /home/nayuta/repo/mariadb-server/mysys/my_malloc.c:211
            #4  0x00007f323d909570 in spider_free_mem (trx=0x7f32300f2c08, ptr=0x7f323012a9f8, my_flags=0) at /home/nayuta/repo/mariadb-server/storage/spider/spd_malloc.cc:188
            #5  0x00007f323d8ab09e in spider_free_conn (conn=0x7f323012a9f8) at /home/nayuta/repo/mariadb-server/storage/spider/spd_conn.cc:1404
            #6  0x00007f323d8a8d9f in spider_free_conn_from_trx (trx=0x7f32300f2c08, conn=0x7f323012a9f8, another=false, trx_free=false, roop_count=0x7f323dd65114)
                at /home/nayuta/repo/mariadb-server/storage/spider/spd_conn.cc:420
            #7  0x00007f323d8601b3 in spider_free_trx_conn (trx=0x7f32300f2c08, trx_free=false) at /home/nayuta/repo/mariadb-server/storage/spider/spd_trx.cc:117
            #8  0x00007f323d86ae9a in spider_commit (hton=0x7f3230035fb8, thd=0x7f3230001d28, all=false) at /home/nayuta/repo/mariadb-server/storage/spider/spd_trx.cc:3486
            #9  0x000055cae7b033a8 in commit_one_phase_2 (thd=0x7f3230001d28, all=false, trans=0x7f32300054b0, is_real_trans=true) at /home/nayuta/repo/mariadb-server/sql/handler.cc:1956
            #10 0x000055cae7b03298 in ha_commit_one_phase (thd=0x7f3230001d28, all=false) at /home/nayuta/repo/mariadb-server/sql/handler.cc:1935
            #11 0x000055cae7b023d4 in ha_commit_trans (thd=0x7f3230001d28, all=false) at /home/nayuta/repo/mariadb-server/sql/handler.cc:1729
            #12 0x000055cae7956976 in trans_commit_stmt (thd=0x7f3230001d28) at /home/nayuta/repo/mariadb-server/sql/transaction.cc:472
            #13 0x000055cae77991df in mysql_execute_command (thd=0x7f3230001d28) at /home/nayuta/repo/mariadb-server/sql/sql_parse.cc:6116
            #14 0x000055cae779ed5b in mysql_parse (thd=0x7f3230001d28, rawbuf=0x7f3230016ba0 "INSERT INTO tbl_a VALUES (1)", length=28, parser_state=0x7f323dd663f0, is_com_multi=false, 
                is_next_command=false) at /home/nayuta/repo/mariadb-server/sql/sql_parse.cc:8100
            #15 0x000055cae778ace2 in dispatch_command (command=COM_QUERY, thd=0x7f3230001d28, packet=0x7f323000e2b9 "INSERT INTO tbl_a VALUES (1)", packet_length=28, is_com_multi=false, 
                is_next_command=false) at /home/nayuta/repo/mariadb-server/sql/sql_parse.cc:1891
            #16 0x000055cae77894da in do_command (thd=0x7f3230001d28) at /home/nayuta/repo/mariadb-server/sql/sql_parse.cc:1370
            #17 0x000055cae793a693 in do_handle_one_connection (connect=0x55caeb9e3778, put_in_cache=true) at /home/nayuta/repo/mariadb-server/sql/sql_connect.cc:1418
            #18 0x000055cae793a349 in handle_one_connection (arg=0x55caeb9e3778) at /home/nayuta/repo/mariadb-server/sql/sql_connect.cc:1312
            #19 0x000055cae7e60116 in pfs_spawn_thread (arg=0x55caeb9207e8) at /home/nayuta/repo/mariadb-server/storage/perfschema/pfs.cc:2201
            #20 0x00007f325572b450 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
            #21 0x00007f32552c4d53 in clone () from /lib/x86_64-linux-gnu/libc.so.6
            

            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - A connection is freed at the end of the INSERT and then is accessed by the ALTER TABLE. Thread 2 received signal SIGSEGV, Segmentation fault. [Switching to Thread 61780.61825] 0x00007f323d865dcf in spider_check_and_set_trx_isolation (conn=0x7f323012a9f8, need_mon=0x7f3230128e20) at /home/nayuta/repo/mariadb-server/storage/spider/spd_trx.cc:1640 1640 if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL) (rr) watch -l conn->thd Hardware watchpoint 1: -location conn->thd (rr) rc Continuing.   Thread 2 received signal SIGSEGV, Segmentation fault. 0x00007f323d865dcf in spider_check_and_set_trx_isolation (conn=0x7f323012a9f8, need_mon=0x7f3230128e20) at /home/nayuta/repo/mariadb-server/storage/spider/spd_trx.cc:1640 1640 if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL) (rr) Continuing.   Thread 2 hit Hardware watchpoint 1: -location conn->thd   Old value = (THD *) 0x8f8f8f8f8f8f8f8f New value = (THD *) 0x0 0x00007f3255330474 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 (rr) bt #0 0x00007f3255330474 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x000055cae84323c6 in free_memory (ptr=0x7f323012a9d0) at /home/nayuta/repo/mariadb-server/mysys/safemalloc.c:279 #2 0x000055cae843207c in sf_free (ptr=0x7f323012a9d0) at /home/nayuta/repo/mariadb-server/mysys/safemalloc.c:198 #3 0x000055cae841f3cb in my_free (ptr=0x7f323012a9e8) at /home/nayuta/repo/mariadb-server/mysys/my_malloc.c:211 #4 0x00007f323d909570 in spider_free_mem (trx=0x7f32300f2c08, ptr=0x7f323012a9f8, my_flags=0) at /home/nayuta/repo/mariadb-server/storage/spider/spd_malloc.cc:188 #5 0x00007f323d8ab09e in spider_free_conn (conn=0x7f323012a9f8) at /home/nayuta/repo/mariadb-server/storage/spider/spd_conn.cc:1404 #6 0x00007f323d8a8d9f in spider_free_conn_from_trx (trx=0x7f32300f2c08, conn=0x7f323012a9f8, another=false, trx_free=false, roop_count=0x7f323dd65114) at /home/nayuta/repo/mariadb-server/storage/spider/spd_conn.cc:420 #7 0x00007f323d8601b3 in spider_free_trx_conn (trx=0x7f32300f2c08, trx_free=false) at /home/nayuta/repo/mariadb-server/storage/spider/spd_trx.cc:117 #8 0x00007f323d86ae9a in spider_commit (hton=0x7f3230035fb8, thd=0x7f3230001d28, all=false) at /home/nayuta/repo/mariadb-server/storage/spider/spd_trx.cc:3486 #9 0x000055cae7b033a8 in commit_one_phase_2 (thd=0x7f3230001d28, all=false, trans=0x7f32300054b0, is_real_trans=true) at /home/nayuta/repo/mariadb-server/sql/handler.cc:1956 #10 0x000055cae7b03298 in ha_commit_one_phase (thd=0x7f3230001d28, all=false) at /home/nayuta/repo/mariadb-server/sql/handler.cc:1935 #11 0x000055cae7b023d4 in ha_commit_trans (thd=0x7f3230001d28, all=false) at /home/nayuta/repo/mariadb-server/sql/handler.cc:1729 #12 0x000055cae7956976 in trans_commit_stmt (thd=0x7f3230001d28) at /home/nayuta/repo/mariadb-server/sql/transaction.cc:472 #13 0x000055cae77991df in mysql_execute_command (thd=0x7f3230001d28) at /home/nayuta/repo/mariadb-server/sql/sql_parse.cc:6116 #14 0x000055cae779ed5b in mysql_parse (thd=0x7f3230001d28, rawbuf=0x7f3230016ba0 "INSERT INTO tbl_a VALUES (1)", length=28, parser_state=0x7f323dd663f0, is_com_multi=false, is_next_command=false) at /home/nayuta/repo/mariadb-server/sql/sql_parse.cc:8100 #15 0x000055cae778ace2 in dispatch_command (command=COM_QUERY, thd=0x7f3230001d28, packet=0x7f323000e2b9 "INSERT INTO tbl_a VALUES (1)", packet_length=28, is_com_multi=false, is_next_command=false) at /home/nayuta/repo/mariadb-server/sql/sql_parse.cc:1891 #16 0x000055cae77894da in do_command (thd=0x7f3230001d28) at /home/nayuta/repo/mariadb-server/sql/sql_parse.cc:1370 #17 0x000055cae793a693 in do_handle_one_connection (connect=0x55caeb9e3778, put_in_cache=true) at /home/nayuta/repo/mariadb-server/sql/sql_connect.cc:1418 #18 0x000055cae793a349 in handle_one_connection (arg=0x55caeb9e3778) at /home/nayuta/repo/mariadb-server/sql/sql_connect.cc:1312 #19 0x000055cae7e60116 in pfs_spawn_thread (arg=0x55caeb9207e8) at /home/nayuta/repo/mariadb-server/storage/perfschema/pfs.cc:2201 #20 0x00007f325572b450 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 #21 0x00007f32552c4d53 in clone () from /lib/x86_64-linux-gnu/libc.so.6

            spider_check_trx_and_get_conn() does not allocate connections if sql_command == SQLCOM_ALTER_TABLE. So, the following patch fix the bug.

            However, I'm not convinced that this is right fix because I do not know why spider_check_trx_and_get_conn() behaves in such a way. I need to check it.

            diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc
            index 0eda9d31df6..a28f4a47f47 100644
            --- a/storage/spider/spd_trx.cc
            +++ b/storage/spider/spd_trx.cc
            @@ -3745,8 +3745,7 @@ int spider_check_trx_and_get_conn(
               spider->wide_handler->trx = trx;
               spider->set_error_mode();
               if (
            -    spider->wide_handler->sql_command != SQLCOM_DROP_TABLE &&
            -    spider->wide_handler->sql_command != SQLCOM_ALTER_TABLE
            +    spider->wide_handler->sql_command != SQLCOM_DROP_TABLE
               ) {
                 SPIDER_TRX_HA *trx_ha = spider_check_trx_ha(trx, spider);
                 if (!trx_ha || trx_ha->wait_for_reusing)
            

            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - spider_check_trx_and_get_conn() does not allocate connections if sql_command == SQLCOM_ALTER_TABLE . So, the following patch fix the bug. However, I'm not convinced that this is right fix because I do not know why spider_check_trx_and_get_conn() behaves in such a way. I need to check it. diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 0eda9d31df6..a28f4a47f47 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -3745,8 +3745,7 @@ int spider_check_trx_and_get_conn( spider->wide_handler->trx = trx; spider->set_error_mode(); if ( - spider->wide_handler->sql_command != SQLCOM_DROP_TABLE && - spider->wide_handler->sql_command != SQLCOM_ALTER_TABLE + spider->wide_handler->sql_command != SQLCOM_DROP_TABLE ) { SPIDER_TRX_HA *trx_ha = spider_check_trx_ha(trx, spider); if (!trx_ha || trx_ha->wait_for_reusing)

            Just dropping tbl_a does not lead to the server crash because DROP TABLE does not access to a data node. So, there is no need to allocate connections before DROP TABLE and thus the current Spider behavior seems to be correct. On the other hand, some ALTER TABLE statements, like ALTER TABLE ... CHECK PARTITION, might access the data node. So, we need to allocate a new connection.

            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - Just dropping tbl_a does not lead to the server crash because DROP TABLE does not access to a data node. So, there is no need to allocate connections before DROP TABLE and thus the current Spider behavior seems to be correct. On the other hand, some ALTER TABLE statements, like ALTER TABLE ... CHECK PARTITION, might access the data node. So, we need to allocate a new connection.
            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - serg Please review: https://github.com/MariaDB/server/commit/ad74dfc98a6d670802d6ca74476bf068e2779f5e

            ad74dfc98a6d670802d6ca74476bf068e2779f5e is ok to push

            serg Sergei Golubchik added a comment - ad74dfc98a6d670802d6ca74476bf068e2779f5e is ok to push

            People

              nayuta-yanagisawa Nayuta Yanagisawa (Inactive)
              Roel Roel Van de Paar
              Votes:
              0 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.