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

InnoDB: Failing assertion: result != FTS_INVALID in fts_trx_row_get_new_state

Details

    Description

      The assertion looks the same as in MDEV-22676, but this time there is no unique blobs (or virtual columns of any kind), and more versions are affected. Please check if a patch for one fixes the other.

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, a VARCHAR(1), b VARCHAR(1), KEY (a), FULLTEXT (a)) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (1,'i','i'),(2,'i','i');
      SET FOREIGN_KEY_CHECKS= OFF;
      ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES x (xx);
      SET FOREIGN_KEY_CHECKS= ON;
      ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b) ON DELETE SET NULL;
      START TRANSACTION;
      DELETE FROM t1;
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 224c9504

      2020-09-11 17:08:08 0x7fd544904700  InnoDB: Assertion failure in file /data/src/10.2/storage/innobase/fts/fts0fts.cc line 2218
      InnoDB: Failing assertion: result != FTS_INVALID
       
      #6  0x0000561a06103b27 in ut_dbg_assertion_failed (expr=0x561a0677820c "result != FTS_INVALID", file=0x561a06777738 "/data/src/10.2/storage/innobase/fts/fts0fts.cc", line=2218) at /data/src/10.2/storage/innobase/ut/ut0dbg.cc:60
      #7  0x0000561a0621e8ef in fts_trx_row_get_new_state (old_state=FTS_DELETE, event=FTS_DELETE) at /data/src/10.2/storage/innobase/fts/fts0fts.cc:2218
      #8  0x0000561a0621ed4f in fts_trx_table_add_op (ftt=0x7fd4ec09a010, doc_id=2, state=FTS_DELETE, fts_indexes=0x0) at /data/src/10.2/storage/innobase/fts/fts0fts.cc:2408
      #9  0x0000561a0621eea8 in fts_trx_add_op (trx=0x7fd5454d8140, table=0x7fd4ec091f90, doc_id=2, state=FTS_DELETE, fts_indexes=0x0) at /data/src/10.2/storage/innobase/fts/fts0fts.cc:2455
      #10 0x0000561a06039147 in row_fts_update_or_delete (prebuilt=0x7fd4ec0a6560) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1677
      #11 0x0000561a060398a0 in row_update_for_mysql (prebuilt=0x7fd4ec0a6560) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1857
      #12 0x0000561a05efa53d in ha_innobase::delete_row (this=0x7fd4ec098368, record=0x7fd4ec0a01a0 "\375\002") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9057
      #13 0x0000561a05cfb726 in handler::ha_delete_row (this=0x7fd4ec098368, buf=0x7fd4ec0a01a0 "\375\002") at /data/src/10.2/sql/handler.cc:6168
      #14 0x0000561a05e7f6c1 in mysql_delete (thd=0x7fd4ec000d90, table_list=0x7fd4ec0127c0, conds=0x0, order_list=0x7fd4ec005328, limit=18446744073709551614, options=0, result=0x0) at /data/src/10.2/sql/sql_delete.cc:583
      #15 0x0000561a05a6ce9c in mysql_execute_command (thd=0x7fd4ec000d90) at /data/src/10.2/sql/sql_parse.cc:4362
      #16 0x0000561a05a77a57 in mysql_parse (thd=0x7fd4ec000d90, rawbuf=0x7fd4ec0126f8 "DELETE FROM t1", length=14, parser_state=0x7fd5449035f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7733
      #17 0x0000561a05a65d66 in dispatch_command (command=COM_QUERY, thd=0x7fd4ec000d90, packet=0x7fd4ec008b51 "DELETE FROM t1", packet_length=14, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1823
      #18 0x0000561a05a64861 in do_command (thd=0x7fd4ec000d90) at /data/src/10.2/sql/sql_parse.cc:1377
      #19 0x0000561a05bbe233 in do_handle_one_connection (connect=0x561a0961c660) at /data/src/10.2/sql/sql_connect.cc:1336
      #20 0x0000561a05bbdf98 in handle_one_connection (arg=0x561a0961c660) at /data/src/10.2/sql/sql_connect.cc:1241
      #21 0x0000561a063e24d2 in pfs_spawn_thread (arg=0x561a09b334a0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #22 0x00007fd54a9b0609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #23 0x00007fd54a58a103 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.1-10.5, debug and non-debug alike.

      Attachments

        Issue Links

          Activity

            Patch is in bb-10.2-MDEV-23722

            thiru Thirunarayanan Balathandayuthapani added a comment - Patch is in bb-10.2- MDEV-23722

            I think that the fix may be on the right track, but I think that we need an additional test case that will delete fewer rows and demonstrate that ON DELETE SET NULL, ON UPDATE SET NULL, ON UPDATE CASCADE will be propagated to the  FULLTEXT INDEX also for self-referential FOREIGN KEY constraints. (I do not expect ON DELETE CASCADE to cause any problems.)

            marko Marko Mäkelä added a comment - I think that the fix may be on the right track, but I think that we need an additional test case that will delete fewer rows and demonstrate that ON DELETE SET NULL , ON UPDATE SET NULL , ON UPDATE CASCADE will be propagated to the   FULLTEXT INDEX also for self-referential FOREIGN KEY constraints. (I do not expect ON DELETE CASCADE to cause any problems.)

            I think that the test case needs a little more work. We would want to demonstrate that

            DELETE FROM t1;
            INSERT INTO t1 (pk,a,b) VALUES (1,'a','b'),(2,'b','b');
            DELETE FROM t1 WHERE pk=2;
            SELECT * FROM t1;
            

            will not return (1,'a','b') but (1,'a',NULL) if FOREIGN KEY (a) REFERENCES (b) ON DELETE SET NULL is in effect.

            marko Marko Mäkelä added a comment - I think that the test case needs a little more work. We would want to demonstrate that DELETE FROM t1; INSERT INTO t1 (pk,a,b) VALUES (1, 'a' , 'b' ),(2, 'b' , 'b' ); DELETE FROM t1 WHERE pk=2; SELECT * FROM t1; will not return (1,'a','b') but (1,'a',NULL) if FOREIGN KEY (a) REFERENCES (b) ON DELETE SET NULL is in effect.

            People

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