Commit f65901ee authored by Sergey Vojtovich's avatar Sergey Vojtovich

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.
parent 8c616cd3
...@@ -1199,7 +1199,6 @@ log-slow-rate-limit 1 ...@@ -1199,7 +1199,6 @@ log-slow-rate-limit 1
log-slow-slave-statements FALSE log-slow-slave-statements FALSE
log-slow-verbosity log-slow-verbosity
log-tc tc.log log-tc tc.log
log-tc-size 24576
log-warnings 1 log-warnings 1
long-query-time 10 long-query-time 10
low-priority-updates FALSE low-priority-updates FALSE
......
...@@ -28,7 +28,7 @@ select * from information_schema.system_variables ...@@ -28,7 +28,7 @@ select * from information_schema.system_variables
'system_time_zone', 'system_time_zone',
'version_comment', 'version_comment',
'version_compile_machine', 'version_compile_os', 'version_compile_machine', 'version_compile_os',
'version_malloc_library', 'version' 'version_malloc_library', 'log_tc_size', 'version'
) )
order by variable_name; order by variable_name;
...@@ -53,4 +53,13 @@ select VARIABLE_NAME, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, ...@@ -53,4 +53,13 @@ select VARIABLE_NAME, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT,
) )
order by variable_name; 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; set global div_precision_increment=default;
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
...@@ -18,7 +18,7 @@ variable_name not in ( ...@@ -18,7 +18,7 @@ variable_name not in (
'system_time_zone', 'system_time_zone',
'version_comment', 'version_comment',
'version_compile_machine', 'version_compile_os', 'version_compile_machine', 'version_compile_os',
'version_malloc_library', 'version' 'version_malloc_library', 'log_tc_size', 'version'
) )
order by variable_name; order by variable_name;
VARIABLE_NAME AUTOCOMMIT VARIABLE_NAME AUTOCOMMIT
...@@ -4887,4 +4887,19 @@ NUMERIC_BLOCK_SIZE NULL ...@@ -4887,4 +4887,19 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY YES READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL 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; set global div_precision_increment=default;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET GLOBAL log_tc_size=1;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET SESSION log_tc_size=1;
...@@ -22,7 +22,7 @@ perl; ...@@ -22,7 +22,7 @@ perl;
log-slow-queries pid-file slow-query-log-file log-basename log-slow-queries pid-file slow-query-log-file log-basename
datadir slave-load-tmpdir tmpdir socket thread-pool-size datadir slave-load-tmpdir tmpdir socket thread-pool-size
large-files-support lower-case-file-system system-time-zone large-files-support lower-case-file-system system-time-zone
version.*/; log-tc-size version.*/;
# Plugins which may or may not be there: # Plugins which may or may not be there:
@plugins=qw/innodb archive blackhole federated partition @plugins=qw/innodb archive blackhole federated partition
......
...@@ -8428,7 +8428,7 @@ ulong tc_log_page_waits= 0; ...@@ -8428,7 +8428,7 @@ ulong tc_log_page_waits= 0;
static const uchar tc_log_magic[]={(uchar) 254, 0x23, 0x05, 0x74}; 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; 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) int TC_LOG_MMAP::open(const char *opt_name)
...@@ -8441,7 +8441,6 @@ 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]); DBUG_ASSERT(opt_name && opt_name[0]);
tc_log_page_size= my_getpagesize(); 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); 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) if ((fd= mysql_file_open(key_file_tclog, logname, O_RDWR, MYF(0))) < 0)
...@@ -8780,6 +8779,7 @@ mmap_do_checkpoint_callback(void *data) ...@@ -8780,6 +8779,7 @@ mmap_do_checkpoint_callback(void *data)
int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid) int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
{ {
pending_cookies *full_buffer= NULL; pending_cookies *full_buffer= NULL;
uint32 ncookies= tc_log_page_size / sizeof(my_xid);
DBUG_ASSERT(*(my_xid *)(data+cookie) == xid); DBUG_ASSERT(*(my_xid *)(data+cookie) == xid);
/* /*
...@@ -8793,7 +8793,7 @@ int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid) ...@@ -8793,7 +8793,7 @@ int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
mysql_mutex_lock(&LOCK_pending_checkpoint); mysql_mutex_lock(&LOCK_pending_checkpoint);
if (pending_checkpoint == NULL) if (pending_checkpoint == NULL)
{ {
uint32 size= sizeof(*pending_checkpoint); uint32 size= sizeof(*pending_checkpoint) + sizeof(ulong) * (ncookies - 1);
if (!(pending_checkpoint= if (!(pending_checkpoint=
(pending_cookies *)my_malloc(size, MYF(MY_ZEROFILL)))) (pending_cookies *)my_malloc(size, MYF(MY_ZEROFILL))))
{ {
...@@ -8804,8 +8804,7 @@ int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid) ...@@ -8804,8 +8804,7 @@ int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
} }
pending_checkpoint->cookies[pending_checkpoint->count++]= cookie; pending_checkpoint->cookies[pending_checkpoint->count++]= cookie;
if (pending_checkpoint->count == sizeof(pending_checkpoint->cookies) / if (pending_checkpoint->count == ncookies)
sizeof(pending_checkpoint->cookies[0]))
{ {
full_buffer= pending_checkpoint; full_buffer= pending_checkpoint;
pending_checkpoint= NULL; pending_checkpoint= NULL;
...@@ -8839,7 +8838,7 @@ TC_LOG_MMAP::commit_checkpoint_notify(void *cookie) ...@@ -8839,7 +8838,7 @@ TC_LOG_MMAP::commit_checkpoint_notify(void *cookie)
if (count == 0) if (count == 0)
{ {
uint i; 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]); delete_entry(pending->cookies[i]);
my_free(pending); my_free(pending);
} }
......
...@@ -118,7 +118,6 @@ class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging ...@@ -118,7 +118,6 @@ class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging
}; };
#define TC_LOG_PAGE_SIZE 8192 #define TC_LOG_PAGE_SIZE 8192
#define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE)
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
class TC_LOG_MMAP: public TC_LOG class TC_LOG_MMAP: public TC_LOG
...@@ -133,7 +132,7 @@ class TC_LOG_MMAP: public TC_LOG ...@@ -133,7 +132,7 @@ class TC_LOG_MMAP: public TC_LOG
struct pending_cookies { struct pending_cookies {
uint count; uint count;
uint pending_count; uint pending_count;
ulong cookies[TC_LOG_PAGE_SIZE/sizeof(my_xid)]; ulong cookies[1];
}; };
private: private:
......
...@@ -4124,6 +4124,7 @@ static int init_common_variables() ...@@ -4124,6 +4124,7 @@ static int init_common_variables()
strmake(pidfile_name, opt_log_basename, sizeof(pidfile_name)-5); strmake(pidfile_name, opt_log_basename, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
SYSVAR_AUTOSIZE(pidfile_name_ptr, pidfile_name); 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 The default-storage-engine entry in my_long_options should have a
...@@ -7224,12 +7225,6 @@ struct my_option my_long_options[]= ...@@ -7224,12 +7225,6 @@ struct my_option my_long_options[]=
"more than one storage engine, when binary log is disabled).", "more than one storage engine, when binary log is disabled).",
&opt_tc_log_file, &opt_tc_log_file, 0, GET_STR, &opt_tc_log_file, &opt_tc_log_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 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, {"master-info-file", 0,
"The location and name of the file that remembers the master and where " "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 " "the I/O replication thread is in the master's binlogs. Defaults to "
......
...@@ -5202,3 +5202,14 @@ static Sys_var_mybool Sys_strict_password_validation( ...@@ -5202,3 +5202,14 @@ static Sys_var_mybool Sys_strict_password_validation(
"that cannot be validated (passwords specified as a hash)", "that cannot be validated (passwords specified as a hash)",
GLOBAL_VAR(strict_password_validation), GLOBAL_VAR(strict_password_validation),
CMD_LINE(OPT_ARG), DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG); 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
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