Commit 1ac66402 authored by Jan Lindström's avatar Jan Lindström

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.
parent 477c84d5
......@@ -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
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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
......
......@@ -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;
......
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment