summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-02-15 09:46:02 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2018-02-15 15:00:46 +0000
commit37af958d23eee5e80aa8f66f4772c84a43485b90 (patch)
tree71048e8871e1073437832f49087735ec2f1a681c
parent6f314edac7a4eb23fa2324d99587a9f4e01eabbd (diff)
downloadmariadb-git-37af958d23eee5e80aa8f66f4772c84a43485b90.tar.gz
MDEV-14905 Fulltext index modification committed during shutdown
If CREATE TABLE...FULLTEXT INDEX was initiated right before shutdown, then the function fts_load_stopword() could commit modifications after shutdown was initiated, causing an assertion failure in the function trx_purge_add_update_undo_to_history(). Mark as internal all the read/write transactions that modify fulltext indexes, so that they will be ignored by the assertion that guards against transaction commits after shutdown has been initiated. fts_optimize_free(): Invoke trx_commit_for_mysql() just in case, because in fts_optimize_create() we started the transaction as internal, and fts_free_for_backgruond() would assert that the flag is clear. Transaction commit would clear the flag.
-rw-r--r--storage/innobase/fts/fts0fts.cc8
-rw-r--r--storage/innobase/fts/fts0opt.cc5
2 files changed, 11 insertions, 2 deletions
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 2002374ce83..dd74270e84a 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -2699,6 +2699,7 @@ retry:
fts_table.parent = table->name.m_name;
trx = trx_allocate_for_background();
+ trx_start_internal(trx);
trx->op_info = "update the next FTS document id";
@@ -2819,6 +2820,7 @@ fts_update_sync_doc_id(
if (!trx) {
trx = trx_allocate_for_background();
+ trx_start_internal(trx);
trx->op_info = "setting last FTS document id";
local_trx = TRUE;
@@ -3056,6 +3058,8 @@ fts_commit_table(
fts_cache_t* cache = ftt->table->fts->cache;
trx_t* trx = trx_allocate_for_background();
+ trx_start_internal(trx);
+
rows = ftt->rows;
ftt->fts_trx->trx = trx;
@@ -3792,6 +3796,7 @@ fts_doc_fetch_by_doc_id(
trx_t* trx = trx_allocate_for_background();
que_t* graph;
+ trx_start_internal(trx);
trx->op_info = "fetching indexed FTS document";
/* The FTS index can be supplied by caller directly with
@@ -4138,6 +4143,7 @@ fts_sync_begin(
sync->start_time = ut_time();
sync->trx = trx_allocate_for_background();
+ trx_start_internal(sync->trx);
if (fts_enable_diag_print) {
ib::info() << "FTS SYNC for table " << sync->table->name
@@ -5008,7 +5014,6 @@ fts_get_rows_count(
char table_name[MAX_FULL_NAME_LEN];
trx = trx_allocate_for_background();
-
trx->op_info = "fetching FT table rows count";
info = pars_info_create();
@@ -7350,6 +7355,7 @@ fts_load_stopword(
if (!trx) {
trx = trx_allocate_for_background();
+ trx_start_internal(trx);
trx->op_info = "upload FTS stopword";
new_trx = TRUE;
}
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index d7e434320a3..3a05f1f013a 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation. All Rights reserved.
+Copyright (c) 2016, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -989,6 +989,7 @@ fts_table_fetch_doc_ids(
if (!trx) {
trx = trx_allocate_for_background();
+ trx_start_internal(trx);
alloc_bk_trx = TRUE;
}
@@ -1619,6 +1620,7 @@ fts_optimize_create(
optim->table = table;
optim->trx = trx_allocate_for_background();
+ trx_start_internal(optim->trx);
optim->fts_common_table.parent = table->name.m_name;
optim->fts_common_table.table_id = table->id;
@@ -1741,6 +1743,7 @@ fts_optimize_free(
{
mem_heap_t* heap = static_cast<mem_heap_t*>(optim->self_heap->arg);
+ trx_commit_for_mysql(optim->trx);
trx_free_for_background(optim->trx);
fts_doc_ids_free(optim->to_delete);