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

Assertion `val <= 4294967295u' failed in fts_encode_int | InnoDB: Failing assertion: pos == node->first_doc_id

Details

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, c TINYTEXT, PRIMARY KEY (FTS_DOC_ID), FULLTEXT KEY (c)) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (1,'txt');
      UPDATE t1 SET FTS_DOC_ID = 4294967298;
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 462d6893

      2019-05-18 19:30:23 9 [Warning] InnoDB: Doc ID 4294967298 is too big. Its difference with largest Doc ID used 1 cannot exceed or equal to 65535
      mysqld: /data/src/10.3/storage/innobase/include/fts0vlc.ic:96: ulint fts_encode_int(ulint, byte*): Assertion `val <= 4294967295u' failed.
      190518 19:30:23 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f19c668cf12 in __GI___assert_fail (assertion=0x55b7f1ad9b43 "val <= 4294967295u", file=0x55b7f1ad9b10 "/data/src/10.3/storage/innobase/include/fts0vlc.ic", line=96, function=0x55b7f1adcca0 <fts_encode_int(unsigned long, unsigned char*)::__PRETTY_FUNCTION__> "ulint fts_encode_int(ulint, byte*)") at assert.c:101
      #8  0x000055b7f14f1747 in fts_encode_int (val=4294967297, buf=0x7f19680a7273 "h\031\177") at /data/src/10.3/storage/innobase/include/fts0vlc.ic:96
      #9  0x000055b7f14f4016 in fts_cache_node_add_positions (cache=0x7f196800c1f8, node=0x7f196800c890, doc_id=4294967298, positions=0x7f19680431b0) at /data/src/10.3/storage/innobase/fts/fts0fts.cc:1317
      #10 0x000055b7f14f4342 in fts_cache_add_doc (cache=0x7f196800c1f8, index_cache=0x7f196800c5d8, doc_id=4294967298, tokens=0x7f19680476e0) at /data/src/10.3/storage/innobase/fts/fts0fts.cc:1414
      #11 0x000055b7f14f8b46 in fts_add_doc_by_id (ftt=0x7f196800ac68, doc_id=4294967298, fts_indexes=0x0) at /data/src/10.3/storage/innobase/fts/fts0fts.cc:3561
      #12 0x000055b7f14f70a5 in fts_add (ftt=0x7f196800ac68, row=0x7f1968037f50) at /data/src/10.3/storage/innobase/fts/fts0fts.cc:2849
      #13 0x000055b7f14f784c in fts_commit_table (ftt=0x7f196800ac68) at /data/src/10.3/storage/innobase/fts/fts0fts.cc:3021
      #14 0x000055b7f14f7940 in fts_commit (trx=0x7f19c05230f0) at /data/src/10.3/storage/innobase/fts/fts0fts.cc:3070
      #15 0x000055b7f13b5e28 in trx_commit_low (trx=0x7f19c05230f0, mtr=0x7f19c0288c30) at /data/src/10.3/storage/innobase/trx/trx0trx.cc:1445
      #16 0x000055b7f13b5ff3 in trx_commit (trx=0x7f19c05230f0) at /data/src/10.3/storage/innobase/trx/trx0trx.cc:1534
      #17 0x000055b7f13b63fc in trx_commit_for_mysql (trx=0x7f19c05230f0) at /data/src/10.3/storage/innobase/trx/trx0trx.cc:1670
      #18 0x000055b7f11931ff in innobase_commit_low (trx=0x7f19c05230f0) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4410
      #19 0x000055b7f1193594 in innobase_commit_ordered_2 (trx=0x7f19c05230f0, thd=0x7f1968000b00) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4524
      #20 0x000055b7f1193a82 in innobase_commit (hton=0x55b7f400c670, thd=0x7f1968000b00, commit_trx=false) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4640
      #21 0x000055b7f0f899be in commit_one_phase_2 (thd=0x7f1968000b00, all=false, trans=0x7f1968004030, is_real_trans=true) at /data/src/10.3/sql/handler.cc:1615
      #22 0x000055b7f0f898ba in ha_commit_one_phase (thd=0x7f1968000b00, all=false) at /data/src/10.3/sql/handler.cc:1595
      #23 0x000055b7f0f89053 in ha_commit_trans (thd=0x7f1968000b00, all=false) at /data/src/10.3/sql/handler.cc:1457
      #24 0x000055b7f0e041dc in trans_commit_stmt (thd=0x7f1968000b00) at /data/src/10.3/sql/transaction.cc:505
      #25 0x000055b7f0c9748c in mysql_execute_command (thd=0x7f1968000b00) at /data/src/10.3/sql/sql_parse.cc:6367
      #26 0x000055b7f0c9c1b8 in mysql_parse (thd=0x7f1968000b00, rawbuf=0x7f1968012808 "UPDATE t1 SET FTS_DOC_ID = 4294967298", length=37, parser_state=0x7f19c028a5f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8098
      #27 0x000055b7f0c891fa in dispatch_command (command=COM_QUERY, thd=0x7f1968000b00, packet=0x7f196815fe71 "UPDATE t1 SET FTS_DOC_ID = 4294967298", packet_length=37, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1858
      #28 0x000055b7f0c87c1d in do_command (thd=0x7f1968000b00) at /data/src/10.3/sql/sql_parse.cc:1403
      #29 0x000055b7f0defd65 in do_handle_one_connection (connect=0x55b7f4347020) at /data/src/10.3/sql/sql_connect.cc:1402
      #30 0x000055b7f0defadc in handle_one_connection (arg=0x55b7f4347020) at /data/src/10.3/sql/sql_connect.cc:1308
      #31 0x000055b7f16c5650 in pfs_spawn_thread (arg=0x55b7f428a680) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #32 0x00007f19c82014a4 in start_thread (arg=0x7f19c028b700) at pthread_create.c:456
      #33 0x00007f19c6749d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.1-10.4 debug.
      Non-debug just produces the warning which is probably expected:

      2019-05-18 19:34:16 9 [Warning] InnoDB: Doc ID 4294967298 is too big. Its difference with largest Doc ID used 1 cannot exceed or equal to 65535
      

      Attachments

        Issue Links

          Activity

            Roel Roel Van de Paar added a comment - - edited

            Two more stack traces with this testcase:

            SET SESSION insert_id = 100000000000;
            CREATE TABLE articles (FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT) ENGINE=InnoDB;
            INSERT INTO articles (title,body) VALUES ('MySQL TutORial','DBMS stANDs FOR DATABASE ...'), ('How TO USE MySQL Well','AFTER you went through a ...'), ('Optimizing MySQL','In this tutORial we will SHOW ...'), ('1001 MySQL Tricks','1. Never run mysqld AS root. 2. ...'), ('MySQL vs. YourSQL','In the following DATABASE comparison ...'), (' (that''s me)','WHEN configured properly, MySQL ...');
            CREATE FULLTEXT INDEX idx ON articles (title, body);
            SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+mySQL -yourSQL' IN BOOLEAN MODE);
            

            10.6.0 c3d4e5718262c0e385f641fbed055b00397fcbf6 (Optimized)

            InnoDB: Failing assertion: pos == node->first_doc_id
            

            10.6.0 c3d4e5718262c0e385f641fbed055b00397fcbf6 (Optimized)

            Core was generated by `/test/MD201120-mariadb-10.6.0-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
            Program terminated with signal SIGABRT, Aborted.
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
                at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
            [Current thread is 1 (Thread 0x14fe6010c700 (LWP 2508422))]
            (gdb) bt
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
            #1  0x00005613c5745c5f in my_write_core (sig=sig@entry=6) at /test/10.6_opt/mysys/stacktrace.c:424
            #2  0x00005613c5176550 in handle_fatal_signal (sig=6) at /test/10.6_opt/sql/signal_handler.cc:330
            #3  <signal handler called>
            #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            #5  0x000014fe77dcd859 in __GI_abort () at abort.c:79
            #6  0x00005613c4e3ae72 in ut_dbg_assertion_failed (expr=expr@entry=0x5613c5a7666b "pos == node->first_doc_id", file=file@entry=0x5613c5a762e0 "/test/10.6_opt/storage/innobase/fts/fts0que.cc", line=line@entry=3243) at /test/10.6_opt/storage/innobase/ut/ut0dbg.cc:60
            #7  0x00005613c4e571e6 in fts_query_filter_doc_ids (query=0x14fe601080c0, word=0x14fe2405f2d8, data=0x14fe24064af8, len=22, calc_doc_count=0, node=<optimized out>, node=<optimized out>, word_freq=<optimized out>, word_freq=<optimized out>) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:3243
            #8  0x00005613c56a3979 in fts_query_read_node (query=0x14fe601080c0, exp=0x14fe24d6d980, word=<optimized out>, word=<optimized out>) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:3427
            #9  0x00005613c56a3a44 in fts_query_index_fetch_nodes (row=<optimized out>, user_arg=<optimized out>) at /test/10.6_opt/storage/innobase/include/que0que.ic:209
            #10 0x00005613c557a15e in fetch_step (thr=thr@entry=0x14fe24d6ee10) at /test/10.6_opt/storage/innobase/row/row0sel.cc:2343
            #11 0x00005613c55331a8 in que_thr_step (thr=<optimized out>) at /test/10.6_opt/storage/innobase/que/que0que.cc:931
            #12 que_run_threads_low (thr=<optimized out>) at /test/10.6_opt/storage/innobase/que/que0que.cc:1009
            #13 que_run_threads (thr=<optimized out>) at /test/10.6_opt/storage/innobase/que/que0que.cc:1049
            #14 0x00005613c56a9f55 in fts_eval_sql (trx=trx@entry=0x14fe75505228, graph=<optimized out>) at /test/10.6_opt/storage/innobase/fts/fts0sql.cc:213
            #15 0x00005613c569c72f in fts_index_fetch_nodes (trx=trx@entry=0x14fe75505228, graph=graph@entry=0x14fe60107b50, fts_table=fts_table@entry=0x14fe60108108, word=word@entry=0x14fe60107b70, fetch=fetch@entry=0x14fe60107bd0) at /test/10.6_opt/storage/innobase/fts/fts0opt.cc:532
            #16 0x00005613c56a7707 in fts_query_intersect (token=0x14fe60107b70, query=0x14fe601080c0) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:1311
            #17 fts_query_execute (token=0x14fe60107b70, query=0x14fe601080c0) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:2918
            #18 fts_query_visitor (oper=<optimized out>, node=<optimized out>, arg=0x14fe601080c0) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:3046
            #19 0x00005613c56d0703 in fts_ast_visit (oper=FTS_EXIST_SKIP, node=0x14fe24021578, visitor=0x5613c56a6ab0 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=<optimized out>, has_ignore=0x14fe60107f7f) at /test/10.6_opt/storage/innobase/fts/fts0ast.cc:693
            #20 0x00005613c56d0792 in fts_ast_visit (oper=<optimized out>, oper@entry=FTS_NONE, node=0x14fe24064248, visitor=visitor@entry=0x5613c56a6ab0 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=arg@entry=0x14fe601080c0, has_ignore=has_ignore@entry=0x14fe6010802f) at /test/10.6_opt/storage/innobase/fts/fts0ast.cc:718
            #21 0x00005613c56a4c6e in fts_query (trx=trx@entry=0x14fe75504180, index=index@entry=0x14fe2404ed20, flags=flags@entry=3, query_str=query_str@entry=0x14fe24064698 "+mySQL -yourSQL", query_len=<optimized out>, result=result@entry=0x14fe601083f8) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:4072
            #22 0x00005613c5497798 in ha_innobase::ft_init_ext (this=0x14fe24020a20, flags=3, keynr=<optimized out>, key=<optimized out>) at /test/10.6_opt/storage/innobase/handler/ha_innodb.cc:9161
            #23 0x00005613c51eb063 in Item_func_match::init_search (this=0x14fe24011540, thd=thd@entry=0x14fe24000c58, no_order=no_order@entry=false) at /test/10.6_opt/sql/sql_string.h:630
            #24 0x00005613c4f05ae5 in init_ftfuncs (thd=0x14fe24000c58, select_lex=<optimized out>, no_order=false) at /test/10.6_opt/sql/sql_base.cc:8938
            #25 0x00005613c4fcc8b9 in JOIN::optimize_stage2 (this=<optimized out>) at /test/10.6_opt/sql/sql_select.cc:2797
            #26 0x00005613c4fcf99a in JOIN::optimize_inner (this=0x14fe24012058) at /test/10.6_opt/sql/sql_select.cc:2277
            #27 0x00005613c4fd1a83 in JOIN::optimize (this=this@entry=0x14fe24012058) at /test/10.6_opt/sql/sql_select.cc:1627
            #28 0x00005613c4fd1b47 in mysql_select (thd=0x14fe24000c58, tables=0x14fe24010ad0, fields=<optimized out>, conds=0x14fe24011540, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14fe24012030, unit=0x14fe24004c28, select_lex=0x14fe240104d0) at /test/10.6_opt/sql/sql_select.cc:4651
            #29 0x00005613c4fd2567 in handle_select (thd=thd@entry=0x14fe24000c58, lex=lex@entry=0x14fe24004b60, result=result@entry=0x14fe24012030, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.6_opt/sql/sql_select.cc:417
            #30 0x00005613c4f61551 in execute_sqlcom_select (thd=0x14fe24000c58, all_tables=0x14fe24010ad0) at /test/10.6_opt/sql/sql_parse.cc:6118
            #31 0x00005613c4f6f243 in mysql_execute_command (thd=0x14fe24000c58) at /test/10.6_opt/sql/sql_parse.cc:3820
            #32 0x00005613c4f5beff in mysql_parse (thd=0x14fe24000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.6_opt/sql/sql_parse.cc:7883
            #33 0x00005613c4f67857 in dispatch_command (command=COM_QUERY, thd=0x14fe24000c58, packet=0x14fe24008019 "SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+mySQL -yourSQL' IN BOOLEAN MODE)", packet_length=<optimized out>) at /test/10.6_opt/sql/sql_class.h:1254
            #34 0x00005613c4f69c32 in do_command (thd=0x14fe24000c58) at /test/10.6_opt/sql/sql_parse.cc:1348
            #35 0x00005613c506e801 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5613c80944c8, put_in_cache=put_in_cache@entry=true) at /test/10.6_opt/sql/sql_connect.cc:1410
            #36 0x00005613c506ec7d in handle_one_connection (arg=arg@entry=0x5613c80944c8) at /test/10.6_opt/sql/sql_connect.cc:1312
            #37 0x00005613c53f4726 in pfs_spawn_thread (arg=0x5613c8010438) at /test/10.6_opt/storage/perfschema/pfs.cc:2201
            #38 0x000014fe782db609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #39 0x000014fe77eca293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            10.1.48 (Optimized)

            InnoDB: Failing assertion: pos == node->first_doc_id
            

            10.1.48 (Optimized)

            Core was generated by `/test/MD201020-mariadb-10.1.48-linux-x86_64-opt/bin/mysqld --no-defaults --core'.
            Program terminated with signal SIGABRT, Aborted.
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
                at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
            [Current thread is 1 (Thread 0x14ada31fb700 (LWP 2586288))]
            (gdb) bt
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
            #1  0x000055bf20d3498f in my_write_core (sig=sig@entry=6) at /test/10.1_opt/mysys/stacktrace.c:387
            #2  0x000055bf2088d904 in handle_fatal_signal (sig=6) at /test/10.1_opt/sql/signal_handler.cc:296
            #3  <signal handler called>
            #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            #5  0x000014adc8484859 in __GI_abort () at abort.c:79
            #6  0x000055bf20ce761d in fts_query_filter_doc_ids (calc_doc_count=0, word_freq=0x14ad7c0100f0, word_freq=0x14ad7c0100f0, node=0x14ada31f5b50, node=0x14ada31f5b50, len=22, data=0x14ad7c033f68, word=0x14ad7c0100f0, query=0x14ada31f6470) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:3107
            #7  fts_query_read_node (query=query@entry=0x14ada31f6470, exp=0x14ad7c03f988, word=<optimized out>, word=<optimized out>) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:3289
            #8  0x000055bf20ce76f0 in fts_query_index_fetch_nodes (row=<optimized out>, user_arg=<optimized out>) at /test/10.1_opt/storage/xtradb/include/que0que.ic:226
            #9  0x000055bf20bc9236 in fetch_step (thr=thr@entry=0x14ad7c040de0) at /test/10.1_opt/storage/xtradb/row/row0sel.cc:2171
            #10 0x000055bf20b8a668 in que_thr_step (thr=0x14ad7c040de0) at /test/10.1_opt/storage/xtradb/que/que0que.cc:1069
            #11 que_run_threads_low (thr=0x14ad7c040de0) at /test/10.1_opt/storage/xtradb/que/que0que.cc:1147
            #12 que_run_threads (thr=0x14ad7c040de0) at /test/10.1_opt/storage/xtradb/que/que0que.cc:1188
            #13 0x000055bf20ceabe1 in fts_eval_sql (trx=trx@entry=0x14ad7c034798, graph=<optimized out>) at /test/10.1_opt/storage/xtradb/fts/fts0sql.cc:232
            #14 0x000055bf20cdee3d in fts_index_fetch_nodes (trx=trx@entry=0x14ad7c034798, graph=graph@entry=0x14ada31f61e0, fts_table=fts_table@entry=0x14ada31f64b8, word=word@entry=0x14ada31f61c0, fetch=fetch@entry=0x14ada31f6200) at /test/10.1_opt/storage/xtradb/fts/fts0opt.cc:534
            #15 0x000055bf20ce92f6 in fts_query_intersect (token=0x14ada31f61c0, query=0x14ada31f6470) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:1336
            #16 fts_query_execute (token=0x14ada31f61c0, query=0x14ada31f6470) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:2808
            #17 fts_query_visitor (oper=<optimized out>, node=<optimized out>, arg=0x14ada31f6470) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:2921
            #18 0x000055bf20cf729c in fts_ast_visit (oper=oper@entry=FTS_EXIST_SKIP, node=0x14ad7c0117f0, node@entry=0x14ad7c012de0, visitor=visitor@entry=0x55bf20ce81d0 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=arg@entry=0x14ada31f6470, has_ignore=has_ignore@entry=0x14ada31f633f) at /test/10.1_opt/storage/xtradb/fts/fts0ast.cc:589
            #19 0x000055bf20cf7472 in fts_ast_visit (oper=<optimized out>, oper@entry=FTS_NONE, node=0x14ad7c012de0, visitor=visitor@entry=0x55bf20ce81d0 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=arg@entry=0x14ada31f6470, has_ignore=has_ignore@entry=0x14ada31f63ef) at /test/10.1_opt/storage/xtradb/fts/fts0ast.cc:614
            #20 0x000055bf20ce61b4 in fts_query (trx=trx@entry=0x14ad7c002468, index=index@entry=0x14ad7c01c388, flags=flags@entry=3, query_str=query_str@entry=0x14ad7c012fe8 "+mySQL -yourSQL", query_len=<optimized out>, result=result@entry=0x14ada31f65f8) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:4015
            #21 0x000055bf20afc62a in ha_innobase::ft_init_ext (this=0x14ad7c01a1e0, flags=3, keynr=<optimized out>, key=<optimized out>) at /test/10.1_opt/storage/xtradb/handler/ha_innodb.cc:10624
            #22 0x000055bf208f6384 in Item_func_match::init_search (this=0x14ad7c009aa0, thd=thd@entry=0x55bf23a30018, no_order=no_order@entry=false) at /test/10.1_opt/sql/sql_string.h:315
            #23 0x000055bf206bd9d1 in init_ftfuncs (thd=0x55bf23a30018, select_lex=<optimized out>, no_order=false) at /test/10.1_opt/sql/sql_base.cc:9286
            #24 0x000055bf207570bd in JOIN::optimize_inner (this=<optimized out>) at /test/10.1_opt/sql/sql_select.cc:1850
            #25 JOIN::optimize_inner (this=<optimized out>) at /test/10.1_opt/sql/sql_select.cc:1090
            #26 0x000055bf207582da in JOIN::optimize (this=0x14ad7c009d08) at /test/10.1_opt/sql/sql_select.cc:1063
            #27 JOIN::optimize (this=0x14ad7c009d08) at /test/10.1_opt/sql/sql_select.cc:1055
            #28 0x000055bf20758a62 in mysql_select (thd=thd@entry=0x55bf23a30018, rref_pointer_array=rref_pointer_array@entry=0x55bf23a34350, tables=0x14ad7c0091a0, wild_num=<optimized out>, fields=@0x55bf23a341c0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14ad7c009148, last = 0x14ad7c00a600, elements = 3}, <No data fields>}, conds=<optimized out>, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14ad7c009ce8, unit=0x55bf23a339a0, select_lex=0x55bf23a340a8) at /test/10.1_opt/sql/sql_select.cc:3490
            #29 0x000055bf20758dc4 in handle_select (thd=thd@entry=0x55bf23a30018, lex=lex@entry=0x55bf23a338e0, result=result@entry=0x14ad7c009ce8, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.1_opt/sql/sql_select.cc:377
            #30 0x000055bf206f4851 in execute_sqlcom_select (thd=thd@entry=0x55bf23a30018, all_tables=0x14ad7c0091a0) at /test/10.1_opt/sql/sql_parse.cc:5682
            #31 0x000055bf20701786 in mysql_execute_command (thd=0x55bf23a30018) at /test/10.1_opt/sql/sql_parse.cc:3029
            #32 0x000055bf20704757 in mysql_parse (thd=0x55bf23a30018, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.1_opt/sql/sql_parse.cc:7200
            #33 0x000055bf207075c1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x55bf23a30018, packet=packet@entry=0x55bf23a35339 "SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+mySQL -yourSQL' IN BOOLEAN MODE)", packet_length=packet_length@entry=91) at /test/10.1_opt/sql/sql_class.h:1064
            #34 0x000055bf2070859e in do_command (thd=0x55bf23a30018) at /test/10.1_opt/sql/sql_parse.cc:1123
            #35 0x000055bf207da2de in do_handle_one_connection (thd_arg=thd_arg@entry=0x55bf23a30018) at /test/10.1_opt/sql/sql_connect.cc:1331
            #36 0x000055bf207da412 in handle_one_connection (arg=0x55bf23a30018) at /test/10.1_opt/sql/sql_connect.cc:1242
            #37 0x000014adc8a3b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #38 0x000014adc8581293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            MS 5.6.50 (Optimized)

            InnoDB: Failing assertion: pos == node->first_doc_id
            

            MS 5.6.50 (Optimized)

            Core was generated by `/test/MS241020-mysql-5.6.50-linux-x86_64-opt/bin/mysqld --no-defaults --core --'.
            Program terminated with signal SIGABRT, Aborted.
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
                at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
            [Current thread is 1 (Thread 0x15171e0a4700 (LWP 2580700))]
            (gdb) bt
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
            #1  0x000055a8fe4f3c6f in my_write_core (sig=sig@entry=6) at /test/5.6_opt/mysys/stacktrace.c:436
            #2  0x000055a8fe280cfb in handle_fatal_signal (sig=6) at /test/5.6_opt/sql/signal_handler.cc:237
            #3  <signal handler called>
            #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            #5  0x0000151744596859 in __GI_abort () at abort.c:79
            #6  0x000055a8fe1a423a in fts_query_filter_doc_ids (query=0x15171e0a00c0, word=0x1516f8021f90, data=0x1516f8022088, len=22, calc_doc_count=0, node=<optimized out>, node=<optimized out>, word_freq=<optimized out>, word_freq=<optimized out>) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:3093
            #7  0x000055a8fe6a4859 in fts_query_read_node (query=0x15171e0a00c0, exp=0x1516f8042030, word=<optimized out>, word=<optimized out>) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:3275
            #8  0x000055a8fe6a4933 in fts_query_index_fetch_nodes (row=<optimized out>, user_arg=<optimized out>) at /test/5.6_opt/storage/innobase/include/que0que.ic:234
            #9  0x000055a8fe5c8d76 in fetch_step (thr=thr@entry=0x1516f8043488) at /test/5.6_opt/storage/innobase/row/row0sel.cc:2175
            #10 0x000055a8fe5967b8 in que_thr_step (thr=0x1516f8043488) at /test/5.6_opt/storage/innobase/que/que0que.cc:1071
            #11 que_run_threads_low (thr=0x1516f8043488) at /test/5.6_opt/storage/innobase/que/que0que.cc:1149
            #12 que_run_threads (thr=0x1516f8043488) at /test/5.6_opt/storage/innobase/que/que0que.cc:1190
            #13 0x000055a8fe6a9195 in fts_eval_sql (trx=trx@entry=0x1516f8033458, graph=<optimized out>) at /test/5.6_opt/storage/innobase/fts/fts0sql.cc:294
            #14 0x000055a8fe6a1ac6 in fts_index_fetch_nodes (trx=trx@entry=0x1516f8033458, graph=graph@entry=0x15171e09fe20, fts_table=fts_table@entry=0x15171e0a0110, word=word@entry=0x15171e09fe00, fetch=fetch@entry=0x15171e09fe40) at /test/5.6_opt/storage/innobase/fts/fts0opt.cc:550
            #15 0x000055a8fe6a790f in fts_query_intersect (token=0x15171e09fe00, query=0x15171e0a00c0) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:1332
            #16 fts_query_execute (token=0x15171e09fe00, query=0x15171e0a00c0) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:2783
            #17 fts_query_visitor (oper=<optimized out>, node=<optimized out>, arg=0x15171e0a00c0) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:2896
            #18 0x000055a8fe6b3d02 in fts_ast_visit (oper=FTS_EXIST_SKIP, node=0x1516f8020560, visitor=0x55a8fe6a6e40 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=<optimized out>, has_ignore=0x15171e09ff87) at /test/5.6_opt/storage/innobase/fts/fts0ast.cc:594
            #19 0x000055a8fe6b3d72 in fts_ast_visit (oper=<optimized out>, oper@entry=FTS_NONE, node=0x1516f80372b0, visitor=visitor@entry=0x55a8fe6a6e40 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=arg@entry=0x15171e0a00c0, has_ignore=has_ignore@entry=0x15171e0a003f) at /test/5.6_opt/storage/innobase/fts/fts0ast.cc:615
            #20 0x000055a8fe6a5914 in fts_query (trx=trx@entry=0x1516f8010988, index=index@entry=0x1516f8022b08, flags=flags@entry=3, query_str=query_str@entry=0x1516f803a0b0 "+mySQL -yourSQL", query_len=<optimized out>, result=result@entry=0x15171e0a0278) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:4004
            #21 0x000055a8fe52b1f1 in ha_innobase::ft_init_ext (this=0x1516f8020670, flags=3, keynr=<optimized out>, key=<optimized out>) at /test/5.6_opt/storage/innobase/handler/ha_innodb.cc:8337
            #22 0x000055a8fe2284d4 in Item_func_match::init_search (this=0x1516f80019a0, thd=thd@entry=0x55a8ff4af4a0, no_order=no_order@entry=false) at /test/5.6_opt/sql/sql_string.h:272
            #23 0x000055a8fe2b9c73 in init_ftfuncs (thd=0x55a8ff4af4a0, select_lex=<optimized out>, no_order=false) at /test/5.6_opt/sql/sql_base.cc:9452
            #24 0x000055a8fe4563b0 in JOIN::optimize (this=this@entry=0x1516f8001bd8) at /test/5.6_opt/sql/sql_optimizer.h:302
            #25 0x000055a8fe322caf in mysql_execute_select (free_join=true, select_lex=0x55a8ff4b1958, thd=0x55a8ff4af4a0) at /test/5.6_opt/sql/sql_select.cc:1094
            #26 mysql_select (thd=0x55a8ff4af4a0, tables=<optimized out>, wild_num=1, fields=<optimized out>, conds=0x1516f80019a0, order=<optimized out>, group=<optimized out>, having=0x0, select_options=2147748608, result=0x1516f8001bb0, unit=0x55a8ff4b1310, select_lex=0x55a8ff4b1958) at /test/5.6_opt/sql/sql_select.cc:1229
            #27 0x000055a8fe32360e in handle_select (thd=thd@entry=0x55a8ff4af4a0, result=result@entry=0x1516f8001bb0, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/5.6_opt/sql/sql_select.cc:108
            #28 0x000055a8fe2f739d in execute_sqlcom_select (thd=0x55a8ff4af4a0, all_tables=0x1516f8001100) at /test/5.6_opt/sql/sql_parse.cc:5162
            #29 0x000055a8fe3013c4 in mysql_execute_command (thd=0x55a8ff4af4a0) at /test/5.6_opt/sql/sql_parse.cc:2717
            #30 0x000055a8fe303678 in mysql_parse (thd=thd@entry=0x55a8ff4af4a0, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15171e0a3670) at /test/5.6_opt/sql/sql_parse.cc:6538
            #31 0x000055a8fe3059ef in dispatch_command (command=<optimized out>, thd=0x55a8ff4af4a0, packet=0x55a8ff593eb1 "SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+mySQL -yourSQL' IN BOOLEAN MODE)", packet_length=91) at /test/5.6_opt/sql/sql_class.h:888
            #32 0x000055a8fe2d13f2 in do_handle_one_connection (thd_arg=thd_arg@entry=0x55a8ff4af4a0) at /test/5.6_opt/sql/sql_connect.cc:989
            #33 0x000055a8fe2d14b2 in handle_one_connection (arg=arg@entry=0x55a8ff4af4a0) at /test/5.6_opt/sql/sql_connect.cc:906
            #34 0x000055a8fe729719 in pfs_spawn_thread (arg=0x55a8ff4a0990) at /test/5.6_opt/storage/perfschema/pfs.cc:1868
            #35 0x0000151744ab7609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #36 0x0000151744693293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            Roel Roel Van de Paar added a comment - - edited Two more stack traces with this testcase: SET SESSION insert_id = 100000000000; CREATE TABLE articles (FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT) ENGINE=InnoDB; INSERT INTO articles (title,body) VALUES ('MySQL TutORial','DBMS stANDs FOR DATABASE ...'), ('How TO USE MySQL Well','AFTER you went through a ...'), ('Optimizing MySQL','In this tutORial we will SHOW ...'), ('1001 MySQL Tricks','1. Never run mysqld AS root. 2. ...'), ('MySQL vs. YourSQL','In the following DATABASE comparison ...'), (' (that''s me)','WHEN configured properly, MySQL ...'); CREATE FULLTEXT INDEX idx ON articles (title, body); SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+mySQL -yourSQL' IN BOOLEAN MODE); 10.6.0 c3d4e5718262c0e385f641fbed055b00397fcbf6 (Optimized) InnoDB: Failing assertion: pos == node->first_doc_id 10.6.0 c3d4e5718262c0e385f641fbed055b00397fcbf6 (Optimized) Core was generated by `/test/MD201120-mariadb-10.6.0-linux-x86_64-opt/bin/mysqld --no-defaults --core-'. Program terminated with signal SIGABRT, Aborted. #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56 [Current thread is 1 (Thread 0x14fe6010c700 (LWP 2508422))] (gdb) bt #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56 #1 0x00005613c5745c5f in my_write_core (sig=sig@entry=6) at /test/10.6_opt/mysys/stacktrace.c:424 #2 0x00005613c5176550 in handle_fatal_signal (sig=6) at /test/10.6_opt/sql/signal_handler.cc:330 #3 <signal handler called> #4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #5 0x000014fe77dcd859 in __GI_abort () at abort.c:79 #6 0x00005613c4e3ae72 in ut_dbg_assertion_failed (expr=expr@entry=0x5613c5a7666b "pos == node->first_doc_id", file=file@entry=0x5613c5a762e0 "/test/10.6_opt/storage/innobase/fts/fts0que.cc", line=line@entry=3243) at /test/10.6_opt/storage/innobase/ut/ut0dbg.cc:60 #7 0x00005613c4e571e6 in fts_query_filter_doc_ids (query=0x14fe601080c0, word=0x14fe2405f2d8, data=0x14fe24064af8, len=22, calc_doc_count=0, node=<optimized out>, node=<optimized out>, word_freq=<optimized out>, word_freq=<optimized out>) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:3243 #8 0x00005613c56a3979 in fts_query_read_node (query=0x14fe601080c0, exp=0x14fe24d6d980, word=<optimized out>, word=<optimized out>) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:3427 #9 0x00005613c56a3a44 in fts_query_index_fetch_nodes (row=<optimized out>, user_arg=<optimized out>) at /test/10.6_opt/storage/innobase/include/que0que.ic:209 #10 0x00005613c557a15e in fetch_step (thr=thr@entry=0x14fe24d6ee10) at /test/10.6_opt/storage/innobase/row/row0sel.cc:2343 #11 0x00005613c55331a8 in que_thr_step (thr=<optimized out>) at /test/10.6_opt/storage/innobase/que/que0que.cc:931 #12 que_run_threads_low (thr=<optimized out>) at /test/10.6_opt/storage/innobase/que/que0que.cc:1009 #13 que_run_threads (thr=<optimized out>) at /test/10.6_opt/storage/innobase/que/que0que.cc:1049 #14 0x00005613c56a9f55 in fts_eval_sql (trx=trx@entry=0x14fe75505228, graph=<optimized out>) at /test/10.6_opt/storage/innobase/fts/fts0sql.cc:213 #15 0x00005613c569c72f in fts_index_fetch_nodes (trx=trx@entry=0x14fe75505228, graph=graph@entry=0x14fe60107b50, fts_table=fts_table@entry=0x14fe60108108, word=word@entry=0x14fe60107b70, fetch=fetch@entry=0x14fe60107bd0) at /test/10.6_opt/storage/innobase/fts/fts0opt.cc:532 #16 0x00005613c56a7707 in fts_query_intersect (token=0x14fe60107b70, query=0x14fe601080c0) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:1311 #17 fts_query_execute (token=0x14fe60107b70, query=0x14fe601080c0) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:2918 #18 fts_query_visitor (oper=<optimized out>, node=<optimized out>, arg=0x14fe601080c0) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:3046 #19 0x00005613c56d0703 in fts_ast_visit (oper=FTS_EXIST_SKIP, node=0x14fe24021578, visitor=0x5613c56a6ab0 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=<optimized out>, has_ignore=0x14fe60107f7f) at /test/10.6_opt/storage/innobase/fts/fts0ast.cc:693 #20 0x00005613c56d0792 in fts_ast_visit (oper=<optimized out>, oper@entry=FTS_NONE, node=0x14fe24064248, visitor=visitor@entry=0x5613c56a6ab0 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=arg@entry=0x14fe601080c0, has_ignore=has_ignore@entry=0x14fe6010802f) at /test/10.6_opt/storage/innobase/fts/fts0ast.cc:718 #21 0x00005613c56a4c6e in fts_query (trx=trx@entry=0x14fe75504180, index=index@entry=0x14fe2404ed20, flags=flags@entry=3, query_str=query_str@entry=0x14fe24064698 "+mySQL -yourSQL", query_len=<optimized out>, result=result@entry=0x14fe601083f8) at /test/10.6_opt/storage/innobase/fts/fts0que.cc:4072 #22 0x00005613c5497798 in ha_innobase::ft_init_ext (this=0x14fe24020a20, flags=3, keynr=<optimized out>, key=<optimized out>) at /test/10.6_opt/storage/innobase/handler/ha_innodb.cc:9161 #23 0x00005613c51eb063 in Item_func_match::init_search (this=0x14fe24011540, thd=thd@entry=0x14fe24000c58, no_order=no_order@entry=false) at /test/10.6_opt/sql/sql_string.h:630 #24 0x00005613c4f05ae5 in init_ftfuncs (thd=0x14fe24000c58, select_lex=<optimized out>, no_order=false) at /test/10.6_opt/sql/sql_base.cc:8938 #25 0x00005613c4fcc8b9 in JOIN::optimize_stage2 (this=<optimized out>) at /test/10.6_opt/sql/sql_select.cc:2797 #26 0x00005613c4fcf99a in JOIN::optimize_inner (this=0x14fe24012058) at /test/10.6_opt/sql/sql_select.cc:2277 #27 0x00005613c4fd1a83 in JOIN::optimize (this=this@entry=0x14fe24012058) at /test/10.6_opt/sql/sql_select.cc:1627 #28 0x00005613c4fd1b47 in mysql_select (thd=0x14fe24000c58, tables=0x14fe24010ad0, fields=<optimized out>, conds=0x14fe24011540, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14fe24012030, unit=0x14fe24004c28, select_lex=0x14fe240104d0) at /test/10.6_opt/sql/sql_select.cc:4651 #29 0x00005613c4fd2567 in handle_select (thd=thd@entry=0x14fe24000c58, lex=lex@entry=0x14fe24004b60, result=result@entry=0x14fe24012030, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.6_opt/sql/sql_select.cc:417 #30 0x00005613c4f61551 in execute_sqlcom_select (thd=0x14fe24000c58, all_tables=0x14fe24010ad0) at /test/10.6_opt/sql/sql_parse.cc:6118 #31 0x00005613c4f6f243 in mysql_execute_command (thd=0x14fe24000c58) at /test/10.6_opt/sql/sql_parse.cc:3820 #32 0x00005613c4f5beff in mysql_parse (thd=0x14fe24000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.6_opt/sql/sql_parse.cc:7883 #33 0x00005613c4f67857 in dispatch_command (command=COM_QUERY, thd=0x14fe24000c58, packet=0x14fe24008019 "SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+mySQL -yourSQL' IN BOOLEAN MODE)", packet_length=<optimized out>) at /test/10.6_opt/sql/sql_class.h:1254 #34 0x00005613c4f69c32 in do_command (thd=0x14fe24000c58) at /test/10.6_opt/sql/sql_parse.cc:1348 #35 0x00005613c506e801 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5613c80944c8, put_in_cache=put_in_cache@entry=true) at /test/10.6_opt/sql/sql_connect.cc:1410 #36 0x00005613c506ec7d in handle_one_connection (arg=arg@entry=0x5613c80944c8) at /test/10.6_opt/sql/sql_connect.cc:1312 #37 0x00005613c53f4726 in pfs_spawn_thread (arg=0x5613c8010438) at /test/10.6_opt/storage/perfschema/pfs.cc:2201 #38 0x000014fe782db609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #39 0x000014fe77eca293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 10.1.48 (Optimized) InnoDB: Failing assertion: pos == node->first_doc_id 10.1.48 (Optimized) Core was generated by `/test/MD201020-mariadb-10.1.48-linux-x86_64-opt/bin/mysqld --no-defaults --core'. Program terminated with signal SIGABRT, Aborted. #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56 [Current thread is 1 (Thread 0x14ada31fb700 (LWP 2586288))] (gdb) bt #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56 #1 0x000055bf20d3498f in my_write_core (sig=sig@entry=6) at /test/10.1_opt/mysys/stacktrace.c:387 #2 0x000055bf2088d904 in handle_fatal_signal (sig=6) at /test/10.1_opt/sql/signal_handler.cc:296 #3 <signal handler called> #4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #5 0x000014adc8484859 in __GI_abort () at abort.c:79 #6 0x000055bf20ce761d in fts_query_filter_doc_ids (calc_doc_count=0, word_freq=0x14ad7c0100f0, word_freq=0x14ad7c0100f0, node=0x14ada31f5b50, node=0x14ada31f5b50, len=22, data=0x14ad7c033f68, word=0x14ad7c0100f0, query=0x14ada31f6470) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:3107 #7 fts_query_read_node (query=query@entry=0x14ada31f6470, exp=0x14ad7c03f988, word=<optimized out>, word=<optimized out>) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:3289 #8 0x000055bf20ce76f0 in fts_query_index_fetch_nodes (row=<optimized out>, user_arg=<optimized out>) at /test/10.1_opt/storage/xtradb/include/que0que.ic:226 #9 0x000055bf20bc9236 in fetch_step (thr=thr@entry=0x14ad7c040de0) at /test/10.1_opt/storage/xtradb/row/row0sel.cc:2171 #10 0x000055bf20b8a668 in que_thr_step (thr=0x14ad7c040de0) at /test/10.1_opt/storage/xtradb/que/que0que.cc:1069 #11 que_run_threads_low (thr=0x14ad7c040de0) at /test/10.1_opt/storage/xtradb/que/que0que.cc:1147 #12 que_run_threads (thr=0x14ad7c040de0) at /test/10.1_opt/storage/xtradb/que/que0que.cc:1188 #13 0x000055bf20ceabe1 in fts_eval_sql (trx=trx@entry=0x14ad7c034798, graph=<optimized out>) at /test/10.1_opt/storage/xtradb/fts/fts0sql.cc:232 #14 0x000055bf20cdee3d in fts_index_fetch_nodes (trx=trx@entry=0x14ad7c034798, graph=graph@entry=0x14ada31f61e0, fts_table=fts_table@entry=0x14ada31f64b8, word=word@entry=0x14ada31f61c0, fetch=fetch@entry=0x14ada31f6200) at /test/10.1_opt/storage/xtradb/fts/fts0opt.cc:534 #15 0x000055bf20ce92f6 in fts_query_intersect (token=0x14ada31f61c0, query=0x14ada31f6470) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:1336 #16 fts_query_execute (token=0x14ada31f61c0, query=0x14ada31f6470) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:2808 #17 fts_query_visitor (oper=<optimized out>, node=<optimized out>, arg=0x14ada31f6470) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:2921 #18 0x000055bf20cf729c in fts_ast_visit (oper=oper@entry=FTS_EXIST_SKIP, node=0x14ad7c0117f0, node@entry=0x14ad7c012de0, visitor=visitor@entry=0x55bf20ce81d0 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=arg@entry=0x14ada31f6470, has_ignore=has_ignore@entry=0x14ada31f633f) at /test/10.1_opt/storage/xtradb/fts/fts0ast.cc:589 #19 0x000055bf20cf7472 in fts_ast_visit (oper=<optimized out>, oper@entry=FTS_NONE, node=0x14ad7c012de0, visitor=visitor@entry=0x55bf20ce81d0 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=arg@entry=0x14ada31f6470, has_ignore=has_ignore@entry=0x14ada31f63ef) at /test/10.1_opt/storage/xtradb/fts/fts0ast.cc:614 #20 0x000055bf20ce61b4 in fts_query (trx=trx@entry=0x14ad7c002468, index=index@entry=0x14ad7c01c388, flags=flags@entry=3, query_str=query_str@entry=0x14ad7c012fe8 "+mySQL -yourSQL", query_len=<optimized out>, result=result@entry=0x14ada31f65f8) at /test/10.1_opt/storage/xtradb/fts/fts0que.cc:4015 #21 0x000055bf20afc62a in ha_innobase::ft_init_ext (this=0x14ad7c01a1e0, flags=3, keynr=<optimized out>, key=<optimized out>) at /test/10.1_opt/storage/xtradb/handler/ha_innodb.cc:10624 #22 0x000055bf208f6384 in Item_func_match::init_search (this=0x14ad7c009aa0, thd=thd@entry=0x55bf23a30018, no_order=no_order@entry=false) at /test/10.1_opt/sql/sql_string.h:315 #23 0x000055bf206bd9d1 in init_ftfuncs (thd=0x55bf23a30018, select_lex=<optimized out>, no_order=false) at /test/10.1_opt/sql/sql_base.cc:9286 #24 0x000055bf207570bd in JOIN::optimize_inner (this=<optimized out>) at /test/10.1_opt/sql/sql_select.cc:1850 #25 JOIN::optimize_inner (this=<optimized out>) at /test/10.1_opt/sql/sql_select.cc:1090 #26 0x000055bf207582da in JOIN::optimize (this=0x14ad7c009d08) at /test/10.1_opt/sql/sql_select.cc:1063 #27 JOIN::optimize (this=0x14ad7c009d08) at /test/10.1_opt/sql/sql_select.cc:1055 #28 0x000055bf20758a62 in mysql_select (thd=thd@entry=0x55bf23a30018, rref_pointer_array=rref_pointer_array@entry=0x55bf23a34350, tables=0x14ad7c0091a0, wild_num=<optimized out>, fields=@0x55bf23a341c0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14ad7c009148, last = 0x14ad7c00a600, elements = 3}, <No data fields>}, conds=<optimized out>, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14ad7c009ce8, unit=0x55bf23a339a0, select_lex=0x55bf23a340a8) at /test/10.1_opt/sql/sql_select.cc:3490 #29 0x000055bf20758dc4 in handle_select (thd=thd@entry=0x55bf23a30018, lex=lex@entry=0x55bf23a338e0, result=result@entry=0x14ad7c009ce8, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.1_opt/sql/sql_select.cc:377 #30 0x000055bf206f4851 in execute_sqlcom_select (thd=thd@entry=0x55bf23a30018, all_tables=0x14ad7c0091a0) at /test/10.1_opt/sql/sql_parse.cc:5682 #31 0x000055bf20701786 in mysql_execute_command (thd=0x55bf23a30018) at /test/10.1_opt/sql/sql_parse.cc:3029 #32 0x000055bf20704757 in mysql_parse (thd=0x55bf23a30018, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.1_opt/sql/sql_parse.cc:7200 #33 0x000055bf207075c1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x55bf23a30018, packet=packet@entry=0x55bf23a35339 "SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+mySQL -yourSQL' IN BOOLEAN MODE)", packet_length=packet_length@entry=91) at /test/10.1_opt/sql/sql_class.h:1064 #34 0x000055bf2070859e in do_command (thd=0x55bf23a30018) at /test/10.1_opt/sql/sql_parse.cc:1123 #35 0x000055bf207da2de in do_handle_one_connection (thd_arg=thd_arg@entry=0x55bf23a30018) at /test/10.1_opt/sql/sql_connect.cc:1331 #36 0x000055bf207da412 in handle_one_connection (arg=0x55bf23a30018) at /test/10.1_opt/sql/sql_connect.cc:1242 #37 0x000014adc8a3b609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #38 0x000014adc8581293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 MS 5.6.50 (Optimized) InnoDB: Failing assertion: pos == node->first_doc_id MS 5.6.50 (Optimized) Core was generated by `/test/MS241020-mysql-5.6.50-linux-x86_64-opt/bin/mysqld --no-defaults --core --'. Program terminated with signal SIGABRT, Aborted. #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56 [Current thread is 1 (Thread 0x15171e0a4700 (LWP 2580700))] (gdb) bt #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56 #1 0x000055a8fe4f3c6f in my_write_core (sig=sig@entry=6) at /test/5.6_opt/mysys/stacktrace.c:436 #2 0x000055a8fe280cfb in handle_fatal_signal (sig=6) at /test/5.6_opt/sql/signal_handler.cc:237 #3 <signal handler called> #4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #5 0x0000151744596859 in __GI_abort () at abort.c:79 #6 0x000055a8fe1a423a in fts_query_filter_doc_ids (query=0x15171e0a00c0, word=0x1516f8021f90, data=0x1516f8022088, len=22, calc_doc_count=0, node=<optimized out>, node=<optimized out>, word_freq=<optimized out>, word_freq=<optimized out>) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:3093 #7 0x000055a8fe6a4859 in fts_query_read_node (query=0x15171e0a00c0, exp=0x1516f8042030, word=<optimized out>, word=<optimized out>) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:3275 #8 0x000055a8fe6a4933 in fts_query_index_fetch_nodes (row=<optimized out>, user_arg=<optimized out>) at /test/5.6_opt/storage/innobase/include/que0que.ic:234 #9 0x000055a8fe5c8d76 in fetch_step (thr=thr@entry=0x1516f8043488) at /test/5.6_opt/storage/innobase/row/row0sel.cc:2175 #10 0x000055a8fe5967b8 in que_thr_step (thr=0x1516f8043488) at /test/5.6_opt/storage/innobase/que/que0que.cc:1071 #11 que_run_threads_low (thr=0x1516f8043488) at /test/5.6_opt/storage/innobase/que/que0que.cc:1149 #12 que_run_threads (thr=0x1516f8043488) at /test/5.6_opt/storage/innobase/que/que0que.cc:1190 #13 0x000055a8fe6a9195 in fts_eval_sql (trx=trx@entry=0x1516f8033458, graph=<optimized out>) at /test/5.6_opt/storage/innobase/fts/fts0sql.cc:294 #14 0x000055a8fe6a1ac6 in fts_index_fetch_nodes (trx=trx@entry=0x1516f8033458, graph=graph@entry=0x15171e09fe20, fts_table=fts_table@entry=0x15171e0a0110, word=word@entry=0x15171e09fe00, fetch=fetch@entry=0x15171e09fe40) at /test/5.6_opt/storage/innobase/fts/fts0opt.cc:550 #15 0x000055a8fe6a790f in fts_query_intersect (token=0x15171e09fe00, query=0x15171e0a00c0) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:1332 #16 fts_query_execute (token=0x15171e09fe00, query=0x15171e0a00c0) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:2783 #17 fts_query_visitor (oper=<optimized out>, node=<optimized out>, arg=0x15171e0a00c0) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:2896 #18 0x000055a8fe6b3d02 in fts_ast_visit (oper=FTS_EXIST_SKIP, node=0x1516f8020560, visitor=0x55a8fe6a6e40 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=<optimized out>, has_ignore=0x15171e09ff87) at /test/5.6_opt/storage/innobase/fts/fts0ast.cc:594 #19 0x000055a8fe6b3d72 in fts_ast_visit (oper=<optimized out>, oper@entry=FTS_NONE, node=0x1516f80372b0, visitor=visitor@entry=0x55a8fe6a6e40 <fts_query_visitor(fts_ast_oper_t, fts_ast_node_t*, void*)>, arg=arg@entry=0x15171e0a00c0, has_ignore=has_ignore@entry=0x15171e0a003f) at /test/5.6_opt/storage/innobase/fts/fts0ast.cc:615 #20 0x000055a8fe6a5914 in fts_query (trx=trx@entry=0x1516f8010988, index=index@entry=0x1516f8022b08, flags=flags@entry=3, query_str=query_str@entry=0x1516f803a0b0 "+mySQL -yourSQL", query_len=<optimized out>, result=result@entry=0x15171e0a0278) at /test/5.6_opt/storage/innobase/fts/fts0que.cc:4004 #21 0x000055a8fe52b1f1 in ha_innobase::ft_init_ext (this=0x1516f8020670, flags=3, keynr=<optimized out>, key=<optimized out>) at /test/5.6_opt/storage/innobase/handler/ha_innodb.cc:8337 #22 0x000055a8fe2284d4 in Item_func_match::init_search (this=0x1516f80019a0, thd=thd@entry=0x55a8ff4af4a0, no_order=no_order@entry=false) at /test/5.6_opt/sql/sql_string.h:272 #23 0x000055a8fe2b9c73 in init_ftfuncs (thd=0x55a8ff4af4a0, select_lex=<optimized out>, no_order=false) at /test/5.6_opt/sql/sql_base.cc:9452 #24 0x000055a8fe4563b0 in JOIN::optimize (this=this@entry=0x1516f8001bd8) at /test/5.6_opt/sql/sql_optimizer.h:302 #25 0x000055a8fe322caf in mysql_execute_select (free_join=true, select_lex=0x55a8ff4b1958, thd=0x55a8ff4af4a0) at /test/5.6_opt/sql/sql_select.cc:1094 #26 mysql_select (thd=0x55a8ff4af4a0, tables=<optimized out>, wild_num=1, fields=<optimized out>, conds=0x1516f80019a0, order=<optimized out>, group=<optimized out>, having=0x0, select_options=2147748608, result=0x1516f8001bb0, unit=0x55a8ff4b1310, select_lex=0x55a8ff4b1958) at /test/5.6_opt/sql/sql_select.cc:1229 #27 0x000055a8fe32360e in handle_select (thd=thd@entry=0x55a8ff4af4a0, result=result@entry=0x1516f8001bb0, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/5.6_opt/sql/sql_select.cc:108 #28 0x000055a8fe2f739d in execute_sqlcom_select (thd=0x55a8ff4af4a0, all_tables=0x1516f8001100) at /test/5.6_opt/sql/sql_parse.cc:5162 #29 0x000055a8fe3013c4 in mysql_execute_command (thd=0x55a8ff4af4a0) at /test/5.6_opt/sql/sql_parse.cc:2717 #30 0x000055a8fe303678 in mysql_parse (thd=thd@entry=0x55a8ff4af4a0, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15171e0a3670) at /test/5.6_opt/sql/sql_parse.cc:6538 #31 0x000055a8fe3059ef in dispatch_command (command=<optimized out>, thd=0x55a8ff4af4a0, packet=0x55a8ff593eb1 "SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+mySQL -yourSQL' IN BOOLEAN MODE)", packet_length=91) at /test/5.6_opt/sql/sql_class.h:888 #32 0x000055a8fe2d13f2 in do_handle_one_connection (thd_arg=thd_arg@entry=0x55a8ff4af4a0) at /test/5.6_opt/sql/sql_connect.cc:989 #33 0x000055a8fe2d14b2 in handle_one_connection (arg=arg@entry=0x55a8ff4af4a0) at /test/5.6_opt/sql/sql_connect.cc:906 #34 0x000055a8fe729719 in pfs_spawn_thread (arg=0x55a8ff4a0990) at /test/5.6_opt/storage/perfschema/pfs.cc:1868 #35 0x0000151744ab7609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #36 0x0000151744693293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

            thiru It would be great if we could fix this as it generates many stacks. Apparently avoiding deferred processing may be an option? Thank you.

            Roel Roel Van de Paar added a comment - thiru It would be great if we could fix this as it generates many stacks. Apparently avoiding deferred processing may be an option? Thank you.

            Patch is in bb-10.2-MDEV-19522

            thiru Thirunarayanan Balathandayuthapani added a comment - Patch is in bb-10.2- MDEV-19522
            marko Marko Mäkelä added a comment - - edited

            Thank you. I posted some review comments.

            If I understood correctly, the fix may be too intrusive. The problem in fts_cache_node_add_positions() does not appear to be that the FTS_DOC_ID value itself does not fit in 32 bits, but that the difference doc_id - node->last_doc_id will not fit. (By the way, on 32-bit CPUs, that difference is being happily truncated to 32 bits.)

            I think that we should check if we can fix fts_encode_int() without a format-breaking change. Let us consider how 32-bit values are currently encoded into 5 bytes:

            		/* Best to keep the limitations of the 32/64 bit versions
            		identical, at least for the time being. */
            		ut_ad(val <= 4294967295u);
             
            		*buf++ = (byte)(val >> 28);
            		*buf++ = (byte)((val >> 21) & 0x7F);
            		*buf++ = (byte)((val >> 14) & 0x7F);
            		*buf++ = (byte)((val >> 7) & 0x7F);
            		*buf = (byte)(val & 0x7F);
             
            		len = 5;
            	}
             
            	/* High-bit on means "last byte in the encoded integer". */
            	*buf |= 0x80;
            

            A value 0bEEEEEEEEFFFFFFFFGGGGGGGGHHHHHHHH that is larger than 268435455 would be encoded into 5 bytes as follows:

            0b0000EEEE,
            0b0EEEEFFF,
            0b0FFFFFGG,
            0b0GGGGGGH,
            0b1HHHHHHH
            

            In this peculiar encoding, we waste ⅛ of the bytes for the "last byte" marker bit. A more commonplace and efficient encoding would be to encode the length in the first byte, using some kind of a unary encoding (a number of '1' bits followed by a '0' bit). Exactly that is being used in mach_write_compressed(), which already existed when this problematic encoding was created. That encoding was probably invented in some compression format in the 1980s or 1970s.

            Anyway, it seems possible to extend the encoding in a backward-compatible way. We can see above that the most significant 4 bits of the first byte are 0 for any 5-byte encoded integer. Maybe we could just extend this peculiar encoding in the straightforward fashion, so that a 64-bit word (with not too many leading zeroes) would be encoded in up to 10 bytes as follows:

            0bAAAAAAAABBBBBBBBCCCCCCCCDDDDDDDDEEEEEEEEFFFFFFFFGGGGGGGGHHHHHHHH;
             
            0b0000000A,
            0b0AAAAAAA,
            0b0BBBBBBB,
            0b0BCCCCCC,
            0b0CCDDDDD,
            0b0DDDEEEE,
            0b0EEEEFFF,
            0b0FFFFFGG,
            0b0GGGGGGH,
            0b1HHHHHHH
            

            As you can see above, a 63-bit value would fit in 9 bytes and a 56-bit value in 8 bytes.

            I think that we should try replace any ulint (size_t) with the 64-bit fts_doc_id_t wherever applicable, and extend the encoding as suggested above.

            marko Marko Mäkelä added a comment - - edited Thank you. I posted some review comments . If I understood correctly, the fix may be too intrusive. The problem in fts_cache_node_add_positions() does not appear to be that the FTS_DOC_ID value itself does not fit in 32 bits, but that the difference doc_id - node->last_doc_id will not fit. (By the way, on 32-bit CPUs, that difference is being happily truncated to 32 bits.) I think that we should check if we can fix fts_encode_int() without a format-breaking change. Let us consider how 32-bit values are currently encoded into 5 bytes: /* Best to keep the limitations of the 32/64 bit versions identical, at least for the time being. */ ut_ad(val <= 4294967295u);   *buf++ = (byte)(val >> 28); *buf++ = (byte)((val >> 21) & 0x7F); *buf++ = (byte)((val >> 14) & 0x7F); *buf++ = (byte)((val >> 7) & 0x7F); *buf = (byte)(val & 0x7F);   len = 5; }   /* High-bit on means "last byte in the encoded integer". */ *buf |= 0x80; A value 0bEEEEEEEEFFFFFFFFGGGGGGGGHHHHHHHH that is larger than 268435455 would be encoded into 5 bytes as follows: 0b0000EEEE, 0b0EEEEFFF, 0b0FFFFFGG, 0b0GGGGGGH, 0b1HHHHHHH In this peculiar encoding, we waste ⅛ of the bytes for the "last byte" marker bit. A more commonplace and efficient encoding would be to encode the length in the first byte, using some kind of a unary encoding (a number of '1' bits followed by a '0' bit). Exactly that is being used in mach_write_compressed() , which already existed when this problematic encoding was created. That encoding was probably invented in some compression format in the 1980s or 1970s. Anyway, it seems possible to extend the encoding in a backward-compatible way. We can see above that the most significant 4 bits of the first byte are 0 for any 5-byte encoded integer. Maybe we could just extend this peculiar encoding in the straightforward fashion, so that a 64-bit word (with not too many leading zeroes) would be encoded in up to 10 bytes as follows: 0bAAAAAAAABBBBBBBBCCCCCCCCDDDDDDDDEEEEEEEEFFFFFFFFGGGGGGGGHHHHHHHH;   0b0000000A, 0b0AAAAAAA, 0b0BBBBBBB, 0b0BCCCCCC, 0b0CCDDDDD, 0b0DDDEEEE, 0b0EEEEFFF, 0b0FFFFFGG, 0b0GGGGGGH, 0b1HHHHHHH As you can see above, a 63-bit value would fit in 9 bytes and a 56-bit value in 8 bytes. I think that we should try replace any ulint ( size_t ) with the 64-bit fts_doc_id_t wherever applicable, and extend the encoding as suggested above.

            I posted a few comments. The unit test must cover values larger than 9223372036854775808 (2⁶³).

            marko Marko Mäkelä added a comment - I posted a few comments. The unit test must cover values larger than 9223372036854775808 (2⁶³).

            People

              thiru Thirunarayanan Balathandayuthapani
              elenst Elena Stepanova
              Votes:
              2 Vote for this issue
              Watchers:
              6 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.