summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-04-05 15:38:26 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-04-06 21:25:43 +0300
commitaa3f7a107ce3a9a7f80daf3cadd442a61c5493ab (patch)
tree9d3fba669478b7661dcb292beb7351d844ee6dd7
parent45d338dca89dcf66fc6fe224ce1e00401d2c9bd0 (diff)
downloadmariadb-git-aa3f7a107ce3a9a7f80daf3cadd442a61c5493ab.tar.gz
MDEV-12699 preparation: Write MLOG_INDEX_LOAD for FTS_ tables
The record MLOG_INDEX_LOAD is supposed to be written to indicate that some page modifications bypassed redo logging, and that redo logging is now re-enabled. It was not written for fulltext indexes during ALTER TABLE. row_merge_write_redo(): Declare globally. Assert that the index is neither a spatial nor fulltext index. recv_mlog_index_load(): Observe a MLOG_INDEX_LOAD operation. recv_parse_log_recs(): Handle MLOG_INDEX_LOAD also in multi-record mini-transactions. Because of this omission, we should keep writing MLOG_INDEX_LOAD in single-record mini-transactions, because older versions of Mariabackup would fail. row_fts_merge_insert(): Write MLOG_INDEX_LOAD for the auxiliary tables of fulltext indexes.
-rw-r--r--storage/innobase/include/row0merge.h8
-rw-r--r--storage/innobase/log/log0recv.cc18
-rw-r--r--storage/innobase/row/row0ftsort.cc4
-rw-r--r--storage/innobase/row/row0merge.cc18
4 files changed, 31 insertions, 17 deletions
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index f1bb45d76d9..3360dbc09e8 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2017, MariaDB Corporation.
+Copyright (c) 2015, 2019, 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
@@ -294,6 +294,12 @@ row_merge_drop_table(
dict_table_t* table) /*!< in: table instance to drop */
MY_ATTRIBUTE((nonnull, warn_unused_result));
+/** Write an MLOG_INDEX_LOAD record to indicate in the redo-log
+that redo-logging of individual index pages was disabled, and
+the flushing of such pages to the data files was completed.
+@param[in] index an index tree on which redo logging was disabled */
+void row_merge_write_redo(const dict_index_t* index);
+
/** Build indexes on a table by reading a clustered index, creating a temporary
file containing index entries, merge sorting these index entries and inserting
sorted index entries to indexes.
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index b6b10072081..85d41cfb534 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2527,6 +2527,15 @@ recv_report_corrupt_log(
return(true);
}
+/** Report a MLOG_INDEX_LOAD operation.
+@param[in] space_id tablespace identifier */
+ATTRIBUTE_COLD static void recv_mlog_index_load(ulint space_id)
+{
+ if (log_optimized_ddl_op) {
+ log_optimized_ddl_op(space_id);
+ }
+}
+
/** Parse log records from a buffer and optionally store them to a
hash table to wait merging to file pages.
@param[in] checkpoint_lsn the LSN of the latest checkpoint
@@ -2684,9 +2693,7 @@ loop:
/* fall through */
case MLOG_INDEX_LOAD:
if (type == MLOG_INDEX_LOAD) {
- if (log_optimized_ddl_op) {
- log_optimized_ddl_op(space);
- }
+ recv_mlog_index_load(space);
}
/* fall through */
case MLOG_FILE_NAME:
@@ -2840,10 +2847,7 @@ corrupted_log:
break;
#endif /* UNIV_LOG_LSN_DEBUG */
case MLOG_INDEX_LOAD:
- /* Mariabackup FIXME: Report an error
- when encountering MLOG_INDEX_LOAD on
- --prepare or already on --backup. */
- ut_a(srv_operation == SRV_OPERATION_NORMAL);
+ recv_mlog_index_load(space);
break;
case MLOG_FILE_NAME:
case MLOG_FILE_DELETE:
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index 959c2e3465a..d3af57986de 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1807,5 +1807,9 @@ exit:
ib::info() << "InnoDB_FTS: inserted " << count << " records";
}
+ if (psort_info[0].psort_common->trx->get_flush_observer()) {
+ row_merge_write_redo(aux_index);
+ }
+
return(error);
}
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index bd3acf5f063..e659654387f 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -4481,17 +4481,14 @@ row_merge_drop_table(
that redo-logging of individual index pages was disabled, and
the flushing of such pages to the data files was completed.
@param[in] index an index tree on which redo logging was disabled */
-static
-void
-row_merge_write_redo(
- const dict_index_t* index)
+void row_merge_write_redo(const dict_index_t* index)
{
- mtr_t mtr;
- byte* log_ptr;
-
ut_ad(!dict_table_is_temporary(index->table));
+ ut_ad(!(index->type & (DICT_SPATIAL | DICT_FTS)));
+
+ mtr_t mtr;
mtr.start();
- log_ptr = mlog_open(&mtr, 11 + 8);
+ byte* log_ptr = mlog_open(&mtr, 11 + 8);
log_ptr = mlog_write_initial_log_record_low(
MLOG_INDEX_LOAD,
index->space, index->page, log_ptr, &mtr);
@@ -5030,7 +5027,10 @@ func_exit:
= dict_table_get_first_index(new_table);
index != NULL;
index = dict_table_get_next_index(index)) {
- row_merge_write_redo(index);
+ if (!(index->type
+ & (DICT_FTS | DICT_SPATIAL))) {
+ row_merge_write_redo(index);
+ }
}
}
}