summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-08-29 22:54:25 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-09-06 17:23:31 +0530
commitac49b7a845f5b5de30d1266879a4c584f9d7c914 (patch)
treeb9674b7ffb03a1e060467f34075696f21345c247
parentf501f815bc78fc743a9ccb8bd9f0bb6e888abf4f (diff)
downloadmariadb-git-ac49b7a845f5b5de30d1266879a4c584f9d7c914.tar.gz
MDEV-29342 Assertion failure in file que0que.cc line 728
- During shutdown, InnoDB fts fails to update synced doc id when there is only one doc id about to sync. While starting the server, InnoDB fetches the already synced doc id from config table. In the subsequent sync operation, InnoDB fails with DB_DUPLICATE_KEY error.
-rw-r--r--mysql-test/suite/innodb_fts/r/misc_debug2.result13
-rw-r--r--mysql-test/suite/innodb_fts/t/misc_debug2.test15
-rw-r--r--storage/innobase/fts/fts0fts.cc2
3 files changed, 29 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb_fts/r/misc_debug2.result b/mysql-test/suite/innodb_fts/r/misc_debug2.result
index b3bc12f92cc..583d43bd9db 100644
--- a/mysql-test/suite/innodb_fts/r/misc_debug2.result
+++ b/mysql-test/suite/innodb_fts/r/misc_debug2.result
@@ -5,3 +5,16 @@ set debug_dbug="+d,fts_instrument_sync_request";
INSERT INTO mdev21563 VALUES('This is a test');
ALTER TABLE mdev21563 DISCARD TABLESPACE;
DROP TABLE mdev21563;
+#
+# MDEV-29342 Assertion failure in file que0que.cc line 728
+#
+CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
+INSERT INTO t1 VALUES('mysql'), ('innodb');
+set debug_dbug="+d,fts_instrument_sync_debug";
+INSERT INTO t1 VALUES('test');
+set debug_dbug="-d,fts_instrument_sync_debug";
+INSERT INTO t1 VALUES('This is a fts issue');
+set debug_dbug="+d,fts_instrument_sync_debug";
+UPDATE t1 SET f1="mariadb";
+set debug_dbug="-d,fts_instrument_sync_debug";
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/misc_debug2.test b/mysql-test/suite/innodb_fts/t/misc_debug2.test
index 0a9e137dd80..1ba77f2481e 100644
--- a/mysql-test/suite/innodb_fts/t/misc_debug2.test
+++ b/mysql-test/suite/innodb_fts/t/misc_debug2.test
@@ -10,3 +10,18 @@ INSERT INTO mdev21563 VALUES('This is a test');
ALTER TABLE mdev21563 DISCARD TABLESPACE;
--source include/restart_mysqld.inc
DROP TABLE mdev21563;
+
+--echo #
+--echo # MDEV-29342 Assertion failure in file que0que.cc line 728
+--echo #
+CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
+INSERT INTO t1 VALUES('mysql'), ('innodb');
+set debug_dbug="+d,fts_instrument_sync_debug";
+INSERT INTO t1 VALUES('test');
+set debug_dbug="-d,fts_instrument_sync_debug";
+INSERT INTO t1 VALUES('This is a fts issue');
+--source include/restart_mysqld.inc
+set debug_dbug="+d,fts_instrument_sync_debug";
+UPDATE t1 SET f1="mariadb";
+set debug_dbug="-d,fts_instrument_sync_debug";
+DROP TABLE t1;
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 6ac41ac1f03..b16bb6611b0 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -2667,7 +2667,7 @@ retry:
}
mutex_exit(&cache->doc_id_lock);
- if (cmp_doc_id > *doc_id) {
+ if (cmp_doc_id && cmp_doc_id >= *doc_id) {
error = fts_update_sync_doc_id(
table, cache->synced_doc_id, trx);
}