summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-06-19 15:59:19 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-06-19 16:17:03 +0300
commitd1e182d603c73e42a18667f3984d6487c9a3b090 (patch)
treeeb8205ff415a6679912869b47a458a17a870b6f9 /storage
parent9a646c91dde8234c5b32660e029fa97f446fcf41 (diff)
downloadmariadb-git-d1e182d603c73e42a18667f3984d6487c9a3b090.tar.gz
MDEV-12975 InnoDB redo log minimum size check uses detected file size instead of requested innodb_log_file_size
log_calc_max_ages(): Use the requested size in the check, instead of the detected redo log size. The redo log will be resized at startup if it differs from what has been requested.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/log/log0log.cc71
-rw-r--r--storage/xtradb/log/log0log.cc71
2 files changed, 40 insertions, 102 deletions
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 0dc06fd4b1b..1c9cbc3a219 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -754,43 +754,16 @@ ibool
log_calc_max_ages(void)
/*===================*/
{
- log_group_t* group;
lsn_t margin;
ulint free;
- ibool success = TRUE;
- lsn_t smallest_capacity;
- lsn_t archive_margin;
- lsn_t smallest_archive_margin;
-
- mutex_enter(&(log_sys->mutex));
-
- group = UT_LIST_GET_FIRST(log_sys->log_groups);
-
- ut_ad(group);
-
- smallest_capacity = LSN_MAX;
- smallest_archive_margin = LSN_MAX;
-
- while (group) {
- if (log_group_get_capacity(group) < smallest_capacity) {
- smallest_capacity = log_group_get_capacity(group);
- }
-
- archive_margin = log_group_get_capacity(group)
- - (group->file_size - LOG_FILE_HDR_SIZE)
- - LOG_ARCHIVE_EXTRA_MARGIN;
-
- if (archive_margin < smallest_archive_margin) {
-
- smallest_archive_margin = archive_margin;
- }
-
- group = UT_LIST_GET_NEXT(log_groups, group);
- }
+ lsn_t smallest_capacity = ((srv_log_file_size_requested
+ << srv_page_size_shift)
+ - LOG_FILE_HDR_SIZE)
+ * srv_n_log_files;
/* Add extra safety */
- smallest_capacity = smallest_capacity - smallest_capacity / 10;
+ smallest_capacity -= smallest_capacity / 10;
/* For each OS thread we must reserve so much free space in the
smallest log group that it can accommodate the log entries produced
@@ -800,15 +773,16 @@ log_calc_max_ages(void)
free = LOG_CHECKPOINT_FREE_PER_THREAD * (10 + srv_thread_concurrency)
+ LOG_CHECKPOINT_EXTRA_FREE;
if (free >= smallest_capacity / 2) {
- success = FALSE;
-
- goto failure;
- } else {
- margin = smallest_capacity - free;
+ ib_logf(IB_LOG_LEVEL_FATAL,
+ "The combined size of ib_logfiles"
+ " should be bigger than\n"
+ "InnoDB: 200 kB * innodb_thread_concurrency.");
}
-
+ margin = smallest_capacity - free;
margin = margin - margin / 10; /* Add still some extra safety */
+ mutex_enter(&log_sys->mutex);
+
log_sys->log_group_capacity = smallest_capacity;
log_sys->max_modified_age_async = margin
@@ -821,22 +795,17 @@ log_calc_max_ages(void)
log_sys->max_checkpoint_age = margin;
#ifdef UNIV_LOG_ARCHIVE
- log_sys->max_archived_lsn_age = smallest_archive_margin;
+ lsn_t archive_margin = smallest_capacity
+ - (srv_log_file_size_requested - LOG_FILE_HDR_SIZE)
+ - LOG_ARCHIVE_EXTRA_MARGIN;
+ log_sys->max_archived_lsn_age = archive_margin;
- log_sys->max_archived_lsn_age_async = smallest_archive_margin
- - smallest_archive_margin / LOG_ARCHIVE_RATIO_ASYNC;
+ log_sys->max_archived_lsn_age_async = archive_margin
+ - archive_margin / LOG_ARCHIVE_RATIO_ASYNC;
#endif /* UNIV_LOG_ARCHIVE */
-failure:
- mutex_exit(&(log_sys->mutex));
-
- if (!success) {
- ib_logf(IB_LOG_LEVEL_FATAL,
- "The combined size of ib_logfiles"
- " should be bigger than\n"
- "InnoDB: 200 kB * innodb_thread_concurrency.");
- }
+ mutex_exit(&log_sys->mutex);
- return(success);
+ return(true);
}
/******************************************************//**
diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc
index 3252cd793c9..833f3240369 100644
--- a/storage/xtradb/log/log0log.cc
+++ b/storage/xtradb/log/log0log.cc
@@ -860,43 +860,16 @@ ibool
log_calc_max_ages(void)
/*===================*/
{
- log_group_t* group;
lsn_t margin;
ulint free;
- ibool success = TRUE;
- lsn_t smallest_capacity;
- lsn_t archive_margin;
- lsn_t smallest_archive_margin;
-
- mutex_enter(&(log_sys->mutex));
-
- group = UT_LIST_GET_FIRST(log_sys->log_groups);
-
- ut_ad(group);
-
- smallest_capacity = LSN_MAX;
- smallest_archive_margin = LSN_MAX;
-
- while (group) {
- if (log_group_get_capacity(group) < smallest_capacity) {
- smallest_capacity = log_group_get_capacity(group);
- }
-
- archive_margin = log_group_get_capacity(group)
- - (group->file_size - LOG_FILE_HDR_SIZE)
- - LOG_ARCHIVE_EXTRA_MARGIN;
-
- if (archive_margin < smallest_archive_margin) {
-
- smallest_archive_margin = archive_margin;
- }
-
- group = UT_LIST_GET_NEXT(log_groups, group);
- }
+ lsn_t smallest_capacity = ((srv_log_file_size_requested
+ << srv_page_size_shift)
+ - LOG_FILE_HDR_SIZE)
+ * srv_n_log_files;
/* Add extra safety */
- smallest_capacity = smallest_capacity - smallest_capacity / 10;
+ smallest_capacity -= smallest_capacity / 10;
/* For each OS thread we must reserve so much free space in the
smallest log group that it can accommodate the log entries produced
@@ -906,15 +879,16 @@ log_calc_max_ages(void)
free = LOG_CHECKPOINT_FREE_PER_THREAD * (10 + srv_thread_concurrency)
+ LOG_CHECKPOINT_EXTRA_FREE;
if (free >= smallest_capacity / 2) {
- success = FALSE;
-
- goto failure;
- } else {
- margin = smallest_capacity - free;
+ ib_logf(IB_LOG_LEVEL_FATAL,
+ "The combined size of ib_logfiles"
+ " should be bigger than\n"
+ "InnoDB: 200 kB * innodb_thread_concurrency.");
}
-
+ margin = smallest_capacity - free;
margin = margin - margin / 10; /* Add still some extra safety */
+ mutex_enter(&log_sys->mutex);
+
log_sys->log_group_capacity = smallest_capacity;
log_sys->max_modified_age_async = margin
@@ -927,22 +901,17 @@ log_calc_max_ages(void)
log_sys->max_checkpoint_age = margin;
#ifdef UNIV_LOG_ARCHIVE
- log_sys->max_archived_lsn_age = smallest_archive_margin;
+ lsn_t archive_margin = smallest_capacity
+ - (srv_log_file_size_requested - LOG_FILE_HDR_SIZE)
+ - LOG_ARCHIVE_EXTRA_MARGIN;
+ log_sys->max_archived_lsn_age = archive_margin;
- log_sys->max_archived_lsn_age_async = smallest_archive_margin
- - smallest_archive_margin / LOG_ARCHIVE_RATIO_ASYNC;
+ log_sys->max_archived_lsn_age_async = archive_margin
+ - archive_margin / LOG_ARCHIVE_RATIO_ASYNC;
#endif /* UNIV_LOG_ARCHIVE */
-failure:
- mutex_exit(&(log_sys->mutex));
-
- if (!success) {
- ib_logf(IB_LOG_LEVEL_FATAL,
- "The combined size of ib_logfiles"
- " should be bigger than\n"
- "InnoDB: 200 kB * innodb_thread_concurrency.");
- }
+ mutex_exit(&log_sys->mutex);
- return(success);
+ return(true);
}
/******************************************************//**