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

Spider uses too long variable names on a remote server

    XMLWordPrintable

Details

    Description

      Upon connecting to a remote server, Spider creates a user variable consisting of a prefix, database name and table name. The identifier can easily exceed 64 symbols. It is currently allowed (see MDEV-31967, MDEV-23665), but causes problems, for example, with performance schema, as described there, and most likely with some other components. If it ends up to be forbidden, it will obviously cause even more problems. It is already forbidden in MySQL, so if Spider intends to be able to read from MySQL, it can be a cause of a failure.

      --source plugin/spider/spider/include/init_spider.inc
       
      SET spider_same_server_link= on;
      eval create server s foreign data wrapper mysql options (host "127.0.0.1", database "spider_remote_db", user "root", port $MASTER_MYPORT);
       
      CREATE DATABASE spider_remote_db;
      CREATE TABLE spider_remote_db.sufficiently_but_not_exceessively_long_table_name (a INT);
       
      CREATE TABLE t_spider (a INT) ENGINE=SPIDER COMMENT = 'wrapper "mysql", srv "s", table "sufficiently_but_not_exceessively_long_table_name"';
      SHOW CREATE TABLE t_spider;
       
      # This wll currently cause an assertion failure
      # SELECT * FROM performance_schema.user_variables_by_thread;
       
      # Cleanup
      DROP DATABASE spider_remote_db;
      DROP TABLE t_spider;
      --source plugin/spider/spider/include/deinit_spider.inc
      

      10.5 7c9837ce general log

      set session time_zone = '+00:00';set @`spider_lc_./spider_remote_db/sufficiently_but_not_exceessively_long_table_name` = '-2cf05d72f7ce-35bcab-./test/t_spider-'
      

      With uncommented query from performance schema:

      10.5 7c9837ce

      mariadbd: /data/src/10.5/storage/perfschema/table_uvar_by_thread.cc:108: void User_variables::materialize(PFS_thread*, THD*): Assertion `name_length <= sizeof(pfs_uvar.m_name)' failed.
      230820 17:53:50 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007f9cb0e53df2 in __GI___assert_fail (assertion=0x55d99ea02f80 "name_length <= sizeof(pfs_uvar.m_name)", file=0x55d99ea02d60 "/data/src/10.5/storage/perfschema/table_uvar_by_thread.cc", line=108, function=0x55d99ea02e80 "void User_variables::materialize(PFS_thread*, THD*)") at ./assert/assert.c:101
      #10 0x000055d99d23fedc in User_variables::materialize (this=0x60d000010ae8, pfs=0x7f9caee0a200, thd=0x62b000230218) at /data/src/10.5/storage/perfschema/table_uvar_by_thread.cc:108
      #11 0x000055d99d2407c6 in table_uvar_by_thread::materialize (this=0x60d000010ac0, thread=0x7f9caee0a200) at /data/src/10.5/storage/perfschema/table_uvar_by_thread.cc:258
      #12 0x000055d99d2403e6 in table_uvar_by_thread::rnd_next (this=0x60d000010ac0) at /data/src/10.5/storage/perfschema/table_uvar_by_thread.cc:201
      #13 0x000055d99d13f831 in ha_perfschema::rnd_next (this=0x61a00002eeb8, buf=0x61900027b0e0 "\377") at /data/src/10.5/storage/perfschema/ha_perfschema.cc:358
      #14 0x000055d99c8dabd5 in handler::ha_rnd_next (this=0x61a00002eeb8, buf=0x61900027b0e0 "\377") at /data/src/10.5/sql/handler.cc:3120
      #15 0x000055d99cd2d298 in rr_sequential (info=0x62b00003cd68) at /data/src/10.5/sql/records.cc:519
      #16 0x000055d99befc764 in READ_RECORD::read_record (this=0x62b00003cd68) at /data/src/10.5/sql/records.h:80
      #17 0x000055d99c20e5a4 in join_init_read_record (tab=0x62b00003cca0) at /data/src/10.5/sql/sql_select.cc:22141
      #18 0x000055d99c20774c in sub_select (join=0x62b00003b410, join_tab=0x62b00003cca0, end_of_records=false) at /data/src/10.5/sql/sql_select.cc:21174
      #19 0x000055d99c2056d4 in do_select (join=0x62b00003b410, procedure=0x0) at /data/src/10.5/sql/sql_select.cc:20696
      #20 0x000055d99c19122d in JOIN::exec_inner (this=0x62b00003b410) at /data/src/10.5/sql/sql_select.cc:4602
      #21 0x000055d99c18e812 in JOIN::exec (this=0x62b00003b410) at /data/src/10.5/sql/sql_select.cc:4382
      #22 0x000055d99c192b2d in mysql_select (thd=0x62b000069218, tables=0x62b0000389e0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b00003b3e0, unit=0x62b00006d3c8, select_lex=0x62b000038318) at /data/src/10.5/sql/sql_select.cc:4859
      #23 0x000055d99c163892 in handle_select (thd=0x62b000069218, lex=0x62b00006d300, result=0x62b00003b3e0, setup_tables_done_option=0) at /data/src/10.5/sql/sql_select.cc:450
      #24 0x000055d99c0cc887 in execute_sqlcom_select (thd=0x62b000069218, all_tables=0x62b0000389e0) at /data/src/10.5/sql/sql_parse.cc:6341
      #25 0x000055d99c0bb37b in mysql_execute_command (thd=0x62b000069218) at /data/src/10.5/sql/sql_parse.cc:4018
      #26 0x000055d99c0d784d in mysql_parse (thd=0x62b000069218, rawbuf=0x62b000038238 "SELECT * FROM performance_schema.user_variables_by_thread", length=57, parser_state=0x7f9ca96bac10, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:8118
      #27 0x000055d99c0ad1ee in dispatch_command (command=COM_QUERY, thd=0x62b000069218, packet=0x629000253219 "", packet_length=57, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1891
      #28 0x000055d99c0a9b81 in do_command (thd=0x62b000069218) at /data/src/10.5/sql/sql_parse.cc:1375
      #29 0x000055d99c4f8be7 in do_handle_one_connection (connect=0x608000002b38, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1416
      #30 0x000055d99c4f85af in handle_one_connection (arg=0x608000002ab8) at /data/src/10.5/sql/sql_connect.cc:1318
      #31 0x000055d99d145e18 in pfs_spawn_thread (arg=0x615000005318) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #32 0x00007f9cb0ea7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #33 0x00007f9cb0f285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Issue Links

          Activity

            People

              ycp Yuchen Pei
              elenst Elena Stepanova
              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.