Skip to content
Permalink
Browse files
Merge 10.0 into 10.1
  • Loading branch information
dr-m committed Jul 31, 2018
2 parents 865e807 + e52315a commit 87ec6a0
Show file tree
Hide file tree
Showing 16 changed files with 496 additions and 462 deletions.
@@ -0,0 +1,117 @@
CREATE TABLE t1 (
id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
value VARCHAR(1024)
) ENGINE=InnoDB;
CREATE FULLTEXT INDEX idx1 ON t1(value);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SET @save_debug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_sync_before_syncing,ib_trunc_sleep_before_fts_cache_clear';
INSERT INTO t1 (value) VALUES
('By default or with the IN NATURAL LANGUAGE MODE modifier')
;
TRUNCATE TABLE t1;
DROP TABLE t1;
SET GLOBAL debug_dbug = @save_debug;
CREATE TABLE t1 (
id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
value VARCHAR(1024)
) ENGINE=InnoDB;
CREATE FULLTEXT INDEX idx1 ON t1(value);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_write_words_before_select_index,ib_trunc_sleep_before_fts_cache_clear';
INSERT INTO t1 (value) VALUES
('By default or with the IN NATURAL LANGUAGE MODE modifier'),
('performs a natural language search for a string'),
('collection is a set of one or more columns included'),
('returns a relevance value; that is, a similarity measure'),
('and the text in that row in the columns named in'),
('By default, the search is performed in case-insensitive'),
('sensitive full-text search, use a binary collation '),
('example, a column that uses the latin1 character'),
('collation of latin1_bin to make it case sensitive')
;
TRUNCATE TABLE t1;
DROP TABLE t1;
SET GLOBAL debug_dbug = @save_debug;
CREATE TABLE t1 (
value VARCHAR(1024)
) ENGINE=InnoDB;
CREATE FULLTEXT INDEX idx1 ON t1(value);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep';
INSERT INTO t1 (value) VALUES
('By default or with the IN NATURAL LANGUAGE MODE modifier'),
('performs a natural language search for a string'),
('collection is a set of one or more columns included'),
('returns a relevance value; that is, a similarity measure'),
('and the text in that row in the columns named in'),
('By default, the search is performed in case-insensitive'),
('sensitive full-text search, use a binary collation '),
('example, a column that uses the latin1 character'),
('collation of latin1_bin to make it case sensitive')
;
DROP INDEX idx1 ON t1;
DROP TABLE t1;
SET GLOBAL debug_dbug = @save_debug;
CREATE TABLE t1 (
value VARCHAR(1024)
) ENGINE=InnoDB;
CREATE FULLTEXT INDEX idx1 ON t1(value);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep';
INSERT INTO t1 (value) VALUES
('By default or with the IN NATURAL LANGUAGE MODE modifier'),
('performs a natural language search for a string'),
('collection is a set of one or more columns included'),
('returns a relevance value; that is, a similarity measure'),
('and the text in that row in the columns named in'),
('By default, the search is performed in case-insensitive'),
('sensitive full-text search, use a binary collation '),
('example, a column that uses the latin1 character'),
('collation of latin1_bin to make it case sensitive')
;
ALTER TABLE t1
DROP INDEX idx1,
ALGORITHM=INPLACE;
DROP TABLE t1;
SET GLOBAL debug_dbug = @save_debug;
CREATE TABLE t1 (
value VARCHAR(1024)
) ENGINE=InnoDB;
CREATE FULLTEXT INDEX idx1 ON t1(value);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep';
INSERT INTO t1 (value) VALUES
('example, a column that uses the latin1 character'),
('collation of latin1_bin to make it case sensitive')
;
ALTER TABLE t1
DROP INDEX idx1,
ALGORITHM=COPY;
DROP TABLE t1;
SET GLOBAL debug_dbug = @save_debug;
CREATE TABLE t1 (
id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
value VARCHAR(1024)
) ENGINE=InnoDB;
CREATE FULLTEXT INDEX idx1 ON t1(value);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep';
INSERT INTO t1 (value) VALUES
('example, a column that uses the latin1 character'),
('collation of latin1_bin to make it case sensitive')
;
ALTER TABLE t1
DROP COLUMN id1,
ADD COLUMN id2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
DROP INDEX idx1,
ADD FULLTEXT INDEX idx2(value),
ALGORITHM=INPLACE;
DROP TABLE t1;
SET GLOBAL debug_dbug = @save_debug;
@@ -0,0 +1,177 @@
#
# BUG#27082268 FTS synchronization issues
#

--source include/have_innodb.inc
--source include/have_debug.inc

#--------------------------------------
# Check FTS_sync vs TRUNCATE (1)
#--------------------------------------

CREATE TABLE t1 (
id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
value VARCHAR(1024)
) ENGINE=InnoDB;

CREATE FULLTEXT INDEX idx1 ON t1(value);

SET @save_debug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_sync_before_syncing,ib_trunc_sleep_before_fts_cache_clear';

INSERT INTO t1 (value) VALUES
('By default or with the IN NATURAL LANGUAGE MODE modifier')
;

TRUNCATE TABLE t1;

DROP TABLE t1;

SET GLOBAL debug_dbug = @save_debug;

#--------------------------------------
# Check FTS sync vs DROP INDEX (2)
#--------------------------------------

CREATE TABLE t1 (
id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
value VARCHAR(1024)
) ENGINE=InnoDB;

CREATE FULLTEXT INDEX idx1 ON t1(value);

SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_write_words_before_select_index,ib_trunc_sleep_before_fts_cache_clear';

INSERT INTO t1 (value) VALUES
('By default or with the IN NATURAL LANGUAGE MODE modifier'),
('performs a natural language search for a string'),
('collection is a set of one or more columns included'),
('returns a relevance value; that is, a similarity measure'),
('and the text in that row in the columns named in'),
('By default, the search is performed in case-insensitive'),
('sensitive full-text search, use a binary collation '),
('example, a column that uses the latin1 character'),
('collation of latin1_bin to make it case sensitive')
;

TRUNCATE TABLE t1;

DROP TABLE t1;

SET GLOBAL debug_dbug = @save_debug;

#--------------------------------------
# Check FTS sync vs DROP INDEX
#--------------------------------------

CREATE TABLE t1 (
value VARCHAR(1024)
) ENGINE=InnoDB;

CREATE FULLTEXT INDEX idx1 ON t1(value);

SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep';

INSERT INTO t1 (value) VALUES
('By default or with the IN NATURAL LANGUAGE MODE modifier'),
('performs a natural language search for a string'),
('collection is a set of one or more columns included'),
('returns a relevance value; that is, a similarity measure'),
('and the text in that row in the columns named in'),
('By default, the search is performed in case-insensitive'),
('sensitive full-text search, use a binary collation '),
('example, a column that uses the latin1 character'),
('collation of latin1_bin to make it case sensitive')
;

DROP INDEX idx1 ON t1;

DROP TABLE t1;

SET GLOBAL debug_dbug = @save_debug;

#--------------------------------------
# Check FTS sync vs ALTER TABLE DROP INDEX (INPLACE)
#--------------------------------------

CREATE TABLE t1 (
value VARCHAR(1024)
) ENGINE=InnoDB;

CREATE FULLTEXT INDEX idx1 ON t1(value);

SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep';

INSERT INTO t1 (value) VALUES
('By default or with the IN NATURAL LANGUAGE MODE modifier'),
('performs a natural language search for a string'),
('collection is a set of one or more columns included'),
('returns a relevance value; that is, a similarity measure'),
('and the text in that row in the columns named in'),
('By default, the search is performed in case-insensitive'),
('sensitive full-text search, use a binary collation '),
('example, a column that uses the latin1 character'),
('collation of latin1_bin to make it case sensitive')
;

ALTER TABLE t1
DROP INDEX idx1,
ALGORITHM=INPLACE;

DROP TABLE t1;

SET GLOBAL debug_dbug = @save_debug;

#--------------------------------------
# Check FTS sync vs ALTER TABLE DROP INDEX (COPY)
#--------------------------------------

CREATE TABLE t1 (
value VARCHAR(1024)
) ENGINE=InnoDB;

CREATE FULLTEXT INDEX idx1 ON t1(value);

SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep';

INSERT INTO t1 (value) VALUES
('example, a column that uses the latin1 character'),
('collation of latin1_bin to make it case sensitive')
;

ALTER TABLE t1
DROP INDEX idx1,
ALGORITHM=COPY;

DROP TABLE t1;

SET GLOBAL debug_dbug = @save_debug;

#--------------------------------------
# Check FTS sync vs ALTER TABLE (INPLACE, new cluster)
#--------------------------------------

CREATE TABLE t1 (
id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
value VARCHAR(1024)
) ENGINE=InnoDB;

CREATE FULLTEXT INDEX idx1 ON t1(value);

SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep';

INSERT INTO t1 (value) VALUES
('example, a column that uses the latin1 character'),
('collation of latin1_bin to make it case sensitive')
;

ALTER TABLE t1
DROP COLUMN id1,
ADD COLUMN id2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
DROP INDEX idx1,
ADD FULLTEXT INDEX idx2(value),
ALGORITHM=INPLACE;

DROP TABLE t1;

SET GLOBAL debug_dbug = @save_debug;
@@ -268,7 +268,7 @@ FTS auxiliary INDEX table and clear the cache at the end.
@param[in,out] sync sync state
@param[in] unlock_cache whether unlock cache lock when write node
@param[in] wait whether wait when a sync is in progress
@param[in] has_dict whether has dict operation lock
@param[in] has_dict whether has dict operation lock
@return DB_SUCCESS if all OK */
static
dberr_t
@@ -3962,6 +3962,9 @@ fts_sync_write_words(

word = rbt_value(fts_tokenizer_word_t, rbt_node);

DBUG_EXECUTE_IF("fts_instrument_write_words_before_select_index",
os_thread_sleep(300000););

selected = fts_select_index(
index_cache->charset, word->text.f_str,
word->text.f_len);
@@ -4526,7 +4529,7 @@ FTS auxiliary INDEX table and clear the cache at the end.
@param[in,out] sync sync state
@param[in] unlock_cache whether unlock cache lock when write node
@param[in] wait whether wait when a sync is in progress
@param[in] has_dict whether has dict operation lock
@param[in] has_dict whether has dict operation lock
@return DB_SUCCESS if all OK */
static
dberr_t
@@ -4588,15 +4591,13 @@ fts_sync(
continue;
}

DBUG_EXECUTE_IF("fts_instrument_sync_before_syncing",
os_thread_sleep(300000););
index_cache->index->index_fts_syncing = true;
DBUG_EXECUTE_IF("fts_instrument_sync_sleep_drop_waits",
os_thread_sleep(10000000);
);

error = fts_sync_index(sync, index_cache);

if (error != DB_SUCCESS && !sync->interrupted) {

if (error != DB_SUCCESS) {
goto end_sync;
}
}
@@ -4631,8 +4632,8 @@ fts_sync(
}

rw_lock_x_lock(&cache->lock);
/* Clear fts syncing flags of any indexes incase sync is
interrupeted */
/* Clear fts syncing flags of any indexes in case sync is
interrupted */
for (i = 0; i < ib_vector_size(cache->indexes); ++i) {
static_cast<fts_index_cache_t*>(
ib_vector_get(cache->indexes, i))

0 comments on commit 87ec6a0

Please sign in to comment.