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

ANALYZE TABLES crash with table-independent-statistics gathering

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.15
    • 10.0.16
    • Optimizer
    • None
    • wheezy x86_64

    Description

      Was running mysqlanalyze --skip-write-binlog --all-databases

      Ran though a lot of tables without error.

      ....
      ...
      ..
       
      oq_dev_eventum.eventum_search_profile              Engine-independent statistics collected
      status   : OK
      oq_dev_eventum.eventum_status                      Engine-independent statistics collected
      status   : OK
      oq_dev_eventum.eventum_subscription                Engine-independent statistics collected
      status   : OK
      oq_dev_eventum.eventum_subscription_type           Engine-independent statistics collected
      status   : OK
      oq_dev_eventum.eventum_support_email               Engine-independent statistics collected
      status   : OK
      mysqlanalyze: Got error: 2013: Lost connection to MySQL server during query when executing 'ANALYZE NO_WRITE_TO_BINLOG TABLE ... '

      Settings where:

      | use_stat_tables | COMPLEMENTARY |

      Dec 23 03:23:25 catinthehat mysqld: Server version: 10.0.15-MariaDB-1~wheezy-log
      Dec 23 03:23:25 catinthehat mysqld: key_buffer_size=8388608
      Dec 23 03:23:25 catinthehat mysqld: read_buffer_size=1048576
      Dec 23 03:23:25 catinthehat mysqld: max_used_connections=4
      Dec 23 03:23:25 catinthehat mysqld: max_threads=102
      Dec 23 03:23:25 catinthehat mysqld: thread_count=4
      Dec 23 03:23:25 catinthehat mysqld: It is possible that mysqld could use up to
      Dec 23 03:23:25 catinthehat mysqld: key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 140842 K  bytes of memory
      Dec 23 03:23:25 catinthehat mysqld: Hope that's ok; if not, decrease some variables in the equation.
      Dec 23 03:23:25 catinthehat mysqld: 
      Dec 23 03:23:25 catinthehat mysqld: Thread pointer: 0x0x7f53f3936008
      Dec 23 03:23:25 catinthehat mysqld: Attempting backtrace. You can use the following information to find out
      Dec 23 03:23:25 catinthehat mysqld: where mysqld died. If you see no messages after this, something went
      Dec 23 03:23:25 catinthehat mysqld: terribly wrong...
      Dec 23 03:23:25 catinthehat mysqld: stack_bottom = 0x7f5425c73e30 thread_stack 0x48000
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(my_print_stacktrace+0x2b)[0x7f5428926b9b]
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(handle_fatal_signal+0x422)[0x7f54284b6e92]
      Dec 23 03:23:25 catinthehat mysqld: /lib/x86_64-linux-gnu/libpthread.so.0(+0xf8d0)[0x7f5427b078d0]
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(_Z27update_statistics_for_tableP3THDP5TABLE+0x360)[0x7f54283c8850]
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(+0x4f693e)[0x7f542842e93e]
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(_ZN21Sql_cmd_analyze_table7executeEP3THD+0xd9)[0x7f5428430079]
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x1968)[0x7f542835a7f8]
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(+0x4275ba)[0x7f542835f5ba]
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x14df)[0x7f5428360b7f]
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0x47b)[0x7f542842273b]
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(handle_one_connection+0x47)[0x7f5428422817]
      Dec 23 03:23:25 catinthehat mysqld: /usr/sbin/mysqld(+0x6f5d5d)[0x7f542862dd5d]
      Dec 23 03:23:25 catinthehat mysqld: /lib/x86_64-linux-gnu/libpthread.so.0(+0x80a4)[0x7f5427b000a4]
      Dec 23 03:23:25 catinthehat mysqld: /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f5426178ccd]
      Dec 23 03:23:25 catinthehat mysqld: 
      Dec 23 03:23:25 catinthehat mysqld: Trying to get some variables.
      Dec 23 03:23:25 catinthehat mysqld: Some pointers may be invalid and cause the dump to abort.
      Dec 23 03:23:25 catinthehat mysqld: Query (0x7f540a4c8020): is an invalid pointer
      Dec 23 03:23:25 catinthehat mysqld: Connection ID (thread ID): 13
      Dec 23 03:23:25 catinthehat mysqld: Status: NOT_KILLED

       mysqlcheck --skip-write-binlog --all-databases 
      ..
      (all OK)

      select * from mysql.table_stats
      | oq_dev_eventum | eventum_round_robin_user          |           0 |
      | oq_dev_eventum | eventum_search_profile            |          27 |
      | oq_dev_eventum | eventum_status                    |          10 |
      | oq_dev_eventum | eventum_subscription              |        1052 |
      | oq_dev_eventum | eventum_subscription_type         |        4003 |
      | oq_dev_eventum | eventum_support_email             |        4535 |
      | oq_dev_eventum | eventum_support_email_body        |        4534 |
      | logsleads      | clflog                            |           0 |
       
       
       
      MariaDB [mysql]> show tables in oq_dev_eventum like 'eventum_%';
      ...
      | eventum_support_email                |
      | eventum_support_email_body           |
      | eventum_time_tracking                |
      | eventum_time_tracking_category       |
      | eventum_user                         |
      +--------------------------------------+
      69 rows in set (0.00 sec)

      After restart with:

      | use_stat_tables                           | NEVER  |
       
      mysqlanalyze --skip-write-binlog --all-databases 
      ...
      oq_eventum.eventum_status                          OK
      oq_eventum.eventum_subscription                    OK
      oq_eventum.eventum_subscription_type               OK
      oq_eventum.eventum_support_email                   OK
      oq_eventum.eventum_support_email_body              Table is already up to date
      oq_eventum.eventum_time_tracking                   Table is already up to date
      oq_eventum.eventum_time_tracking_category          OK
      oq_eventum.eventum_user                            OK
      oq_eventum.oq_customer_contacts                    OK
      oq_eventum.oq_customers                            OK
      oq_ourdelta.wp_QuoteRotator                        OK
      oq_ourdelta.wp_commentmeta                         OK
      oq_ourdelta.wp_comments                            OK
      oq_ourdelta.wp_links                               OK
      ...

      This is repeatable on this table:

      MariaDB [(none)]> set sql_log_bin=0;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [(none)]> analyze local table oq_dev_eventum.eventum_support_email_body;
      +-------------------------------------------+---------+----------+-----------------------------+
      | Table                                     | Op      | Msg_type | Msg_text                    |
      +-------------------------------------------+---------+----------+-----------------------------+
      | oq_dev_eventum.eventum_support_email_body | analyze | status   | Table is already up to date |
      +-------------------------------------------+---------+----------+-----------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [(none)]> set global use_stat_tables=COMPLEMENTARY;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [(none)]> analyze local table oq_dev_eventum.eventum_support_email_body;
      +-------------------------------------------+---------+----------+-----------------------------+
      | Table                                     | Op      | Msg_type | Msg_text                    |
      +-------------------------------------------+---------+----------+-----------------------------+
      | oq_dev_eventum.eventum_support_email_body | analyze | status   | Table is already up to date |
      +-------------------------------------------+---------+----------+-----------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [(none)]> analyze local table oq_dev_eventum.eventum_support_email_body PERSISTENT FOR ALL;
      ERROR 2013 (HY000): Lost connection to MySQL server during query

      | eventum_support_email_body | CREATE TABLE `eventum_support_email_body` (
        `seb_sup_id` int(11) unsigned NOT NULL,
        `seb_body` longtext NOT NULL,
        `seb_full_email` longtext NOT NULL,
        PRIMARY KEY (`seb_sup_id`),
        FULLTEXT KEY `ft_support_email` (`seb_body`)
      ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
       
      MariaDB [(none)]> select count(*) from  oq_dev_eventum.eventum_support_email_body;
      +----------+
      | count(*) |
      +----------+
      |     4534 |
       
       
      MariaDB [(none)]> select length(seb_body) as b from oq_dev_eventum.eventum_support_email_body order by b desc limit 1;
      +-------+
      | b     |
      +-------+
      | 44175 |
       
      MariaDB [(none)]> select length(seb_full_email) as b from oq_dev_eventum.eventum_support_email_body order by b desc limit 1;
      +---------+
      | b       |
      +---------+
      | 8937583 |

      Running with use_stat_tables=NEVER didn't cause a crash.

      If you can repeat this without a copy of oq_dev_eventum.eventum_support_email_body that would be good. If you can't I'll see what I can do.

      Attachments

        1. bt.txt
          7 kB
        2. bt-full.txt
          23 kB
        3. bt-second.txt
          12 kB
        4. catinthehat.cnf
          0.5 kB
        5. mdev-7362.sql
          13 kB
        6. my.cnf
          5 kB

        Issue Links

          Activity

            danblack Daniel Black created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            Due Date 2015-01-16
            danblack Daniel Black made changes -
            Attachment catinthehat.cnf [ 36608 ]
            Attachment my.cnf [ 36609 ]
            danblack Daniel Black made changes -
            Attachment bt.txt [ 36610 ]
            danblack Daniel Black made changes -
            Attachment bt-full.txt [ 36611 ]
            elenst Elena Stepanova made changes -
            Due Date 2015-01-16
            danblack Daniel Black made changes -
            Attachment mdev-7362.sql [ 36614 ]
            danblack Daniel Black made changes -
            Attachment bt-second.txt [ 36615 ]
            elenst Elena Stepanova made changes -
            Assignee Elena Stepanova [ elenst ]
            elenst Elena Stepanova made changes -
            Component/s Optimizer [ 10200 ]
            Fix Version/s 10.0 [ 16000 ]
            Assignee Elena Stepanova [ elenst ] Igor Babaev [ igor ]
            danblack Daniel Black made changes -
            elenst Elena Stepanova made changes -
            Assignee Igor Babaev [ igor ] Elena Stepanova [ elenst ]
            elenst Elena Stepanova made changes -
            Comment [ Reduced it even further and replaced the data (failed to do it before because apparently the combination of columns and data length is important, and I didn't stumble across the right one earlier):

            {code:sql}
            CREATE TABLE t1 (f longtext NOT NULL, FULLTEXT KEY f (f)) ENGINE=MyISAM;
            INSERT INTO t1 VALUES (REPEAT('a',27)),('foo');
            ANALYZE TABLE t1 PERSISTENT FOR ALL;
            {code}

            {noformat:title=Debug assertion and stack trace from 10.0 revno 4543}
            10.0/include/my_bitmap.h:130: uint bitmap_is_set(const MY_BITMAP*, uint): Assertion `bit < (map)->n_bits' failed.
            141226 14:54:46 [ERROR] mysqld got signal 6 ;


            #6 0x00007fe22a33c6f1 in *__GI___assert_fail (assertion=0xf1acaa "bit < (map)->n_bits", file=<optimized out>, line=130, function=0xf1bca0 "uint bitmap_is_set(const MY_BITMAP*, uint)") at assert.c:81
            #7 0x0000000000711237 in bitmap_is_set (map=0x7fe22249e580, bit=127) at 10.0/include/my_bitmap.h:130
            #8 0x0000000000712dab in update_statistics_for_table (thd=0x7fe224f2f070, table=0x7fe22249e470) at 10.0/sql/sql_statistics.cc:2628
            #9 0x00000000007a4f75 in mysql_admin_table(THD *, TABLE_LIST *, HA_CHECK_OPT *, const char *, thr_lock_type, bool, bool, uint, int (*)(THD *, TABLE_LIST *, HA_CHECK_OPT *), struct {...}, int (*)(THD *, TABLE_LIST *)) (thd=0x7fe224f2f070, tables=0x7fe222414180, check_opt=0x7fe224f33ba0, operator_name=0xf4ac87 "analyze", lock_type=TL_READ_NO_INSERT, open_for_modify=true, repair_table_use_frm=false, extra_open_options=0, prepare_func=0, operator_func=(int (handler::*)(handler * const, THD *, HA_CHECK_OPT *)) 0x8712d4 <handler::ha_analyze(THD*, st_ha_check_opt*)>, view_operator_func=0) at 10.0/sql/sql_admin.cc:738
            #10 0x00000000007a6565 in Sql_cmd_analyze_table::execute (this=0x7fe222414760, thd=0x7fe224f2f070) at 10.0/sql/sql_admin.cc:1148
            #11 0x0000000000682928 in mysql_execute_command (thd=0x7fe224f2f070) at 10.0/sql/sql_parse.cc:5078
            #12 0x00000000006859bd in mysql_parse (thd=0x7fe224f2f070, rawbuf=0x7fe222414088 "ANALYZE TABLE t1 PERSISTENT FOR ALL", length=35, parser_state=0x7fe22c549610) at 10.0/sql/sql_parse.cc:6407
            #13 0x00000000006787b2 in dispatch_command (command=COM_QUERY, thd=0x7fe224f2f070, packet=0x7fe225ff6071 "", packet_length=35) at 10.0/sql/sql_parse.cc:1299
            #14 0x0000000000677b57 in do_command (thd=0x7fe224f2f070) at 10.0/sql/sql_parse.cc:996
            #15 0x0000000000794877 in do_handle_one_connection (thd_arg=0x7fe224f2f070) at 10.0/sql/sql_connect.cc:1375
            #16 0x00000000007945ca in handle_one_connection (arg=0x7fe224f2f070) at 10.0/sql/sql_connect.cc:1289
            #17 0x0000000000ccda5e in pfs_spawn_thread (arg=0x7fe224367bf0) at 10.0/storage/perfschema/pfs.cc:1860
            #18 0x00007fe22c136b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
            #19 0x00007fe22a3ed20d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
            {noformat}
            ]
            elenst Elena Stepanova made changes -
            Assignee Elena Stepanova [ elenst ] Igor Babaev [ igor ]
            serg Sergei Golubchik made changes -
            Assignee Igor Babaev [ igor ] Vicentiu Ciorbaru [ cvicentiu ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.0.16 [ 17900 ]
            Fix Version/s 10.0 [ 16000 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            ratzpo Rasmus Johansson (Inactive) made changes -
            Workflow MariaDB v2 [ 59059 ] MariaDB v3 [ 62557 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 62557 ] MariaDB v4 [ 148649 ]

            People

              cvicentiu Vicențiu Ciorbaru
              danblack Daniel Black
              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.