[Commits] 1ac6640: MDEV-9129: Server is restarting in the loop after crash

Jan Lindström jan.lindstrom at mariadb.com
Tue Dec 15 20:39:28 EET 2015


revision-id: 1ac6640210bb337ecdfa9f8b818cc3c6156dbdcc (mariadb-10.1.9-18-g1ac6640)
parent(s): 477c84d51e9b386baadc053e017c019aaac68fc8
committer: Jan Lindström
timestamp: 2015-12-15 20:37:33 +0200
message:

MDEV-9129: Server is restarting in the loop after crash

Analysis: We have reserved ROW_MERGE_RESERVE_SIZE ( = 4) for
encryption key_version. When calculating is there more
space on sort buffer, this value needs to be substracted
from current available space.

---
 storage/innobase/include/row0merge.h |  3 +++
 storage/innobase/row/row0ftsort.cc   |  6 ++++--
 storage/innobase/row/row0merge.cc    | 18 +++++++++++++-----
 storage/xtradb/include/row0merge.h   |  3 +++
 storage/xtradb/row/row0ftsort.cc     |  6 ++++--
 storage/xtradb/row/row0merge.cc      | 18 +++++++++++++-----
 6 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index fa00700..196543f 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -41,6 +41,9 @@ Created 13/06/2005 Jan Lindstrom
 #include "lock0types.h"
 #include "srv0srv.h"
 
+/* Reserve free space from every block for key_version */
+#define ROW_MERGE_RESERVE_SIZE 4
+
 /* Cluster index read task is mandatory */
 #define COST_READ_CLUSTERED_INDEX            1.0
 
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index f970938..4c02197 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -557,9 +557,11 @@ row_merge_fts_doc_tokenize(
 		fts_max_token_size, add one extra size and one extra byte */
 		cur_len += 2;
 
-		/* Reserve one byte for the end marker of row_merge_block_t. */
+		/* Reserve one byte for the end marker of row_merge_block_t
+		and we have reserved ROW_MERGE_RESERVE_SIZE (= 4) for
+		encryption key_version in the beginning of the buffer. */
 		if (buf->total_size + data_size[idx] + cur_len
-		    >= srv_sort_buf_size - 1) {
+			>= (srv_sort_buf_size - 1 - ROW_MERGE_RESERVE_SIZE)) {
 
 			buf_full = TRUE;
 			break;
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index c921c5b..f5cc33f 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -78,8 +78,6 @@ UNIV_INTERN char	srv_disable_sort_file_cache;
 /* Maximum pending doc memory limit in bytes for a fts tokenization thread */
 #define FTS_PENDING_DOC_MEMORY_LIMIT	1000000
 
-/* Reserve free space from every block for key_version */
-#define ROW_MERGE_RESERVE_SIZE 4
 
 /******************************************************//**
 Encrypt a merge block. */
@@ -2571,7 +2569,11 @@ row_merge_sort(
 	of file marker).  Thus, it must be at least one block. */
 	ut_ad(file->offset > 0);
 
-	thd_progress_init(trx->mysql_thd, num_runs);
+	/* Progress report only for "normal" indexes. */
+	if (!(dup->index->type & DICT_FTS)) {
+		thd_progress_init(trx->mysql_thd, num_runs);
+	}
+
 	sql_print_information("InnoDB: Online DDL : merge-sorting has estimated %lu runs", num_runs);
 
 	/* Merge the runs until we have one big run */
@@ -2580,7 +2582,10 @@ row_merge_sort(
 
 		/* Report progress of merge sort to MySQL for
 		show processlist progress field */
-		thd_progress_report(trx->mysql_thd, cur_run, num_runs);
+		/* Progress report only for "normal" indexes. */
+		if (!(dup->index->type & DICT_FTS)) {
+			thd_progress_report(trx->mysql_thd, cur_run, num_runs);
+		}
 		sql_print_information("InnoDB: Online DDL : merge-sorting current run %lu estimated %lu runs", cur_run, num_runs);
 
 		error = row_merge(trx, dup, file, block, tmpfd,
@@ -2605,7 +2610,10 @@ row_merge_sort(
 
 	mem_free(run_offset);
 
-	thd_progress_end(trx->mysql_thd);
+	/* Progress report only for "normal" indexes. */
+	if (!(dup->index->type & DICT_FTS)) {
+		thd_progress_end(trx->mysql_thd);
+	}
 
 	DBUG_RETURN(error);
 }
diff --git a/storage/xtradb/include/row0merge.h b/storage/xtradb/include/row0merge.h
index fa00700..196543f 100644
--- a/storage/xtradb/include/row0merge.h
+++ b/storage/xtradb/include/row0merge.h
@@ -41,6 +41,9 @@ Created 13/06/2005 Jan Lindstrom
 #include "lock0types.h"
 #include "srv0srv.h"
 
+/* Reserve free space from every block for key_version */
+#define ROW_MERGE_RESERVE_SIZE 4
+
 /* Cluster index read task is mandatory */
 #define COST_READ_CLUSTERED_INDEX            1.0
 
diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc
index 55ac0a7..c7a5b51 100644
--- a/storage/xtradb/row/row0ftsort.cc
+++ b/storage/xtradb/row/row0ftsort.cc
@@ -560,9 +560,11 @@ row_merge_fts_doc_tokenize(
 		fts_max_token_size, add one extra size and one extra byte */
 		cur_len += 2;
 
-		/* Reserve one byte for the end marker of row_merge_block_t. */
+		/* Reserve one byte for the end marker of row_merge_block_t
+		and we have reserved ROW_MERGE_RESERVE_SIZE (= 4) for
+		encryption key_version in the beginning of the buffer. */
 		if (buf->total_size + data_size[idx] + cur_len
-		    >= srv_sort_buf_size - 1) {
+			>= (srv_sort_buf_size - 1 - ROW_MERGE_RESERVE_SIZE)) {
 
 			buf_full = TRUE;
 			break;
diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc
index 3ac18eb..8e0ed37 100644
--- a/storage/xtradb/row/row0merge.cc
+++ b/storage/xtradb/row/row0merge.cc
@@ -78,8 +78,6 @@ UNIV_INTERN char	srv_disable_sort_file_cache;
 /* Maximum pending doc memory limit in bytes for a fts tokenization thread */
 #define FTS_PENDING_DOC_MEMORY_LIMIT	1000000
 
-/* Reserve free space from every block for key_version */
-#define ROW_MERGE_RESERVE_SIZE 4
 
 /******************************************************//**
 Encrypt a merge block. */
@@ -2578,7 +2576,11 @@ row_merge_sort(
 	of file marker).  Thus, it must be at least one block. */
 	ut_ad(file->offset > 0);
 
-	thd_progress_init(trx->mysql_thd, num_runs);
+	/* Progress report only for "normal" indexes. */
+	if (!(dup->index->type & DICT_FTS)) {
+		thd_progress_init(trx->mysql_thd, num_runs);
+	}
+
 	sql_print_information("InnoDB: Online DDL : merge-sorting has estimated %lu runs", num_runs);
 
 	/* Merge the runs until we have one big run */
@@ -2587,7 +2589,10 @@ row_merge_sort(
 
 		/* Report progress of merge sort to MySQL for
 		show processlist progress field */
-		thd_progress_report(trx->mysql_thd, cur_run, num_runs);
+		/* Progress report only for "normal" indexes. */
+		if (!(dup->index->type & DICT_FTS)) {
+			thd_progress_report(trx->mysql_thd, cur_run, num_runs);
+		}
 		sql_print_information("InnoDB: Online DDL : merge-sorting current run %lu estimated %lu runs", cur_run, num_runs);
 
 		error = row_merge(trx, dup, file, block, tmpfd,
@@ -2612,7 +2617,10 @@ row_merge_sort(
 
 	mem_free(run_offset);
 
-	thd_progress_end(trx->mysql_thd);
+	/* Progress report only for "normal" indexes. */
+	if (!(dup->index->type & DICT_FTS)) {
+		thd_progress_end(trx->mysql_thd);
+	}
 
 	DBUG_RETURN(error);
 }


More information about the commits mailing list