summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2014-12-26 23:38:45 +0400
committerSergey Vojtovich <svoj@mariadb.org>2014-12-26 23:38:45 +0400
commitf65901eef28728212a350f61569dc884c747bffc (patch)
tree3a96b557c8fbd92651e468a08f5ec0a867199fb6
parent8c616cd347aa7b3fcc2d8defb5e172ad316f432c (diff)
downloadmariadb-git-f65901eef28728212a350f61569dc884c747bffc.tar.gz
MDEV-7273 - 10.1 fails to start up during tc_log initializations on PPC64
log-tc-size is 24K by default. Page size is 64K on PPC64. But log-tc-size must be at least 3 x page size. This is enforced by TC_LOG_MMAP::open() with a comment: to guarantee non-empty pool. This all makes server not startable in default configuration on PPC64. Autosize log-tc-size, so that it's min value= page size * 3, default value= page size * 6, block size= page size.
-rw-r--r--mysql-test/r/mysqld--help.result1
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvars_server.inc11
-rw-r--r--mysql-test/suite/sys_vars/r/log_tc_size_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result17
-rw-r--r--mysql-test/suite/sys_vars/t/log_tc_size_basic.test5
-rw-r--r--mysql-test/t/mysqld--help.test2
-rw-r--r--sql/log.cc11
-rw-r--r--sql/log.h3
-rw-r--r--sql/mysqld.cc7
-rw-r--r--sql/sys_vars.cc11
10 files changed, 54 insertions, 18 deletions
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index c5442c3a264..543e6bfd524 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -1199,7 +1199,6 @@ log-slow-rate-limit 1
log-slow-slave-statements FALSE
log-slow-verbosity
log-tc tc.log
-log-tc-size 24576
log-warnings 1
long-query-time 10
low-priority-updates FALSE
diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
index 176d2d9eedd..b7c1c996f0b 100644
--- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc
+++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
@@ -28,7 +28,7 @@ select * from information_schema.system_variables
'system_time_zone',
'version_comment',
'version_compile_machine', 'version_compile_os',
- 'version_malloc_library', 'version'
+ 'version_malloc_library', 'log_tc_size', 'version'
)
order by variable_name;
@@ -53,4 +53,13 @@ select VARIABLE_NAME, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT,
)
order by variable_name;
+# yet less data: no values, no blocks size, no min/max value.
+select VARIABLE_NAME, GLOBAL_VALUE_ORIGIN, VARIABLE_SCOPE, VARIABLE_TYPE,
+ VARIABLE_COMMENT, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT
+ from information_schema.system_variables
+ where variable_name in (
+ 'log_tc_size'
+ )
+ order by variable_name;
+
set global div_precision_increment=default;
diff --git a/mysql-test/suite/sys_vars/r/log_tc_size_basic.result b/mysql-test/suite/sys_vars/r/log_tc_size_basic.result
new file mode 100644
index 00000000000..8097fcf61bd
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/log_tc_size_basic.result
@@ -0,0 +1,4 @@
+SET GLOBAL log_tc_size=1;
+ERROR HY000: Variable 'log_tc_size' is a read only variable
+SET SESSION log_tc_size=1;
+ERROR HY000: Variable 'log_tc_size' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index 006b9a94bc0..f7ceee6eb5c 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -18,7 +18,7 @@ variable_name not in (
'system_time_zone',
'version_comment',
'version_compile_machine', 'version_compile_os',
-'version_malloc_library', 'version'
+'version_malloc_library', 'log_tc_size', 'version'
)
order by variable_name;
VARIABLE_NAME AUTOCOMMIT
@@ -4887,4 +4887,19 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
+select VARIABLE_NAME, GLOBAL_VALUE_ORIGIN, VARIABLE_SCOPE, VARIABLE_TYPE,
+VARIABLE_COMMENT, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT
+from information_schema.system_variables
+where variable_name in (
+'log_tc_size'
+ )
+order by variable_name;
+VARIABLE_NAME LOG_TC_SIZE
+GLOBAL_VALUE_ORIGIN AUTO
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_COMMENT Size of transaction coordinator log.
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
set global div_precision_increment=default;
diff --git a/mysql-test/suite/sys_vars/t/log_tc_size_basic.test b/mysql-test/suite/sys_vars/t/log_tc_size_basic.test
new file mode 100644
index 00000000000..221338d0304
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_tc_size_basic.test
@@ -0,0 +1,5 @@
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL log_tc_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET SESSION log_tc_size=1;
diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test
index 0fdc01ba520..83f58171333 100644
--- a/mysql-test/t/mysqld--help.test
+++ b/mysql-test/t/mysqld--help.test
@@ -22,7 +22,7 @@ perl;
log-slow-queries pid-file slow-query-log-file log-basename
datadir slave-load-tmpdir tmpdir socket thread-pool-size
large-files-support lower-case-file-system system-time-zone
- version.*/;
+ log-tc-size version.*/;
# Plugins which may or may not be there:
@plugins=qw/innodb archive blackhole federated partition
diff --git a/sql/log.cc b/sql/log.cc
index 66e142668a9..52c85d653bb 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -8428,7 +8428,7 @@ ulong tc_log_page_waits= 0;
static const uchar tc_log_magic[]={(uchar) 254, 0x23, 0x05, 0x74};
-ulong opt_tc_log_size= TC_LOG_MIN_SIZE;
+ulong opt_tc_log_size;
ulong tc_log_max_pages_used=0, tc_log_page_size=0, tc_log_cur_pages_used=0;
int TC_LOG_MMAP::open(const char *opt_name)
@@ -8441,7 +8441,6 @@ int TC_LOG_MMAP::open(const char *opt_name)
DBUG_ASSERT(opt_name && opt_name[0]);
tc_log_page_size= my_getpagesize();
- DBUG_ASSERT(TC_LOG_PAGE_SIZE % tc_log_page_size == 0);
fn_format(logname,opt_name,mysql_data_home,"",MY_UNPACK_FILENAME);
if ((fd= mysql_file_open(key_file_tclog, logname, O_RDWR, MYF(0))) < 0)
@@ -8780,6 +8779,7 @@ mmap_do_checkpoint_callback(void *data)
int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
{
pending_cookies *full_buffer= NULL;
+ uint32 ncookies= tc_log_page_size / sizeof(my_xid);
DBUG_ASSERT(*(my_xid *)(data+cookie) == xid);
/*
@@ -8793,7 +8793,7 @@ int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
mysql_mutex_lock(&LOCK_pending_checkpoint);
if (pending_checkpoint == NULL)
{
- uint32 size= sizeof(*pending_checkpoint);
+ uint32 size= sizeof(*pending_checkpoint) + sizeof(ulong) * (ncookies - 1);
if (!(pending_checkpoint=
(pending_cookies *)my_malloc(size, MYF(MY_ZEROFILL))))
{
@@ -8804,8 +8804,7 @@ int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
}
pending_checkpoint->cookies[pending_checkpoint->count++]= cookie;
- if (pending_checkpoint->count == sizeof(pending_checkpoint->cookies) /
- sizeof(pending_checkpoint->cookies[0]))
+ if (pending_checkpoint->count == ncookies)
{
full_buffer= pending_checkpoint;
pending_checkpoint= NULL;
@@ -8839,7 +8838,7 @@ TC_LOG_MMAP::commit_checkpoint_notify(void *cookie)
if (count == 0)
{
uint i;
- for (i= 0; i < sizeof(pending->cookies)/sizeof(pending->cookies[0]); ++i)
+ for (i= 0; i < tc_log_page_size / sizeof(my_xid); ++i)
delete_entry(pending->cookies[i]);
my_free(pending);
}
diff --git a/sql/log.h b/sql/log.h
index 9b6f365eea7..ef28c6ceac6 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -118,7 +118,6 @@ public:
};
#define TC_LOG_PAGE_SIZE 8192
-#define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE)
#ifdef HAVE_MMAP
class TC_LOG_MMAP: public TC_LOG
@@ -133,7 +132,7 @@ class TC_LOG_MMAP: public TC_LOG
struct pending_cookies {
uint count;
uint pending_count;
- ulong cookies[TC_LOG_PAGE_SIZE/sizeof(my_xid)];
+ ulong cookies[1];
};
private:
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 07b4f1da3b1..9fd02e70767 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4124,6 +4124,7 @@ static int init_common_variables()
strmake(pidfile_name, opt_log_basename, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
SYSVAR_AUTOSIZE(pidfile_name_ptr, pidfile_name);
+ mark_sys_var_value_origin(&opt_tc_log_size, sys_var::AUTO);
/*
The default-storage-engine entry in my_long_options should have a
@@ -7224,12 +7225,6 @@ struct my_option my_long_options[]=
"more than one storage engine, when binary log is disabled).",
&opt_tc_log_file, &opt_tc_log_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef HAVE_MMAP
- {"log-tc-size", 0, "Size of transaction coordinator log.",
- &opt_tc_log_size, &opt_tc_log_size, 0, GET_ULONG,
- REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, (ulonglong) ULONG_MAX, 0,
- TC_LOG_PAGE_SIZE, 0},
-#endif
{"master-info-file", 0,
"The location and name of the file that remembers the master and where "
"the I/O replication thread is in the master's binlogs. Defaults to "
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index fb113775ea3..7e6bd409e1a 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -5202,3 +5202,14 @@ static Sys_var_mybool Sys_strict_password_validation(
"that cannot be validated (passwords specified as a hash)",
GLOBAL_VAR(strict_password_validation),
CMD_LINE(OPT_ARG), DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG);
+
+#ifdef HAVE_MMAP
+static Sys_var_ulong Sys_log_tc_size(
+ "log_tc_size",
+ "Size of transaction coordinator log.",
+ READ_ONLY GLOBAL_VAR(opt_tc_log_size),
+ CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(my_getpagesize() * 3, ULONG_MAX),
+ DEFAULT(my_getpagesize() * 6),
+ BLOCK_SIZE(my_getpagesize()));
+#endif