Skip to content

Commit f65901e

Browse files
committed
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.
1 parent 8c616cd commit f65901e

File tree

10 files changed

+54
-18
lines changed

10 files changed

+54
-18
lines changed

mysql-test/r/mysqld--help.result

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,6 @@ log-slow-rate-limit 1
11991199
log-slow-slave-statements FALSE
12001200
log-slow-verbosity
12011201
log-tc tc.log
1202-
log-tc-size 24576
12031202
log-warnings 1
12041203
long-query-time 10
12051204
low-priority-updates FALSE

mysql-test/suite/sys_vars/inc/sysvars_server.inc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ select * from information_schema.system_variables
2828
'system_time_zone',
2929
'version_comment',
3030
'version_compile_machine', 'version_compile_os',
31-
'version_malloc_library', 'version'
31+
'version_malloc_library', 'log_tc_size', 'version'
3232
)
3333
order by variable_name;
3434

@@ -53,4 +53,13 @@ select VARIABLE_NAME, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT,
5353
)
5454
order by variable_name;
5555

56+
# yet less data: no values, no blocks size, no min/max value.
57+
select VARIABLE_NAME, GLOBAL_VALUE_ORIGIN, VARIABLE_SCOPE, VARIABLE_TYPE,
58+
VARIABLE_COMMENT, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT
59+
from information_schema.system_variables
60+
where variable_name in (
61+
'log_tc_size'
62+
)
63+
order by variable_name;
64+
5665
set global div_precision_increment=default;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SET GLOBAL log_tc_size=1;
2+
ERROR HY000: Variable 'log_tc_size' is a read only variable
3+
SET SESSION log_tc_size=1;
4+
ERROR HY000: Variable 'log_tc_size' is a read only variable

mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ variable_name not in (
1818
'system_time_zone',
1919
'version_comment',
2020
'version_compile_machine', 'version_compile_os',
21-
'version_malloc_library', 'version'
21+
'version_malloc_library', 'log_tc_size', 'version'
2222
)
2323
order by variable_name;
2424
VARIABLE_NAME AUTOCOMMIT
@@ -4887,4 +4887,19 @@ NUMERIC_BLOCK_SIZE NULL
48874887
ENUM_VALUE_LIST NULL
48884888
READ_ONLY YES
48894889
COMMAND_LINE_ARGUMENT NULL
4890+
select VARIABLE_NAME, GLOBAL_VALUE_ORIGIN, VARIABLE_SCOPE, VARIABLE_TYPE,
4891+
VARIABLE_COMMENT, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT
4892+
from information_schema.system_variables
4893+
where variable_name in (
4894+
'log_tc_size'
4895+
)
4896+
order by variable_name;
4897+
VARIABLE_NAME LOG_TC_SIZE
4898+
GLOBAL_VALUE_ORIGIN AUTO
4899+
VARIABLE_SCOPE GLOBAL
4900+
VARIABLE_TYPE BIGINT UNSIGNED
4901+
VARIABLE_COMMENT Size of transaction coordinator log.
4902+
ENUM_VALUE_LIST NULL
4903+
READ_ONLY YES
4904+
COMMAND_LINE_ARGUMENT REQUIRED
48904905
set global div_precision_increment=default;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
2+
SET GLOBAL log_tc_size=1;
3+
4+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
5+
SET SESSION log_tc_size=1;

mysql-test/t/mysqld--help.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ perl;
2222
log-slow-queries pid-file slow-query-log-file log-basename
2323
datadir slave-load-tmpdir tmpdir socket thread-pool-size
2424
large-files-support lower-case-file-system system-time-zone
25-
version.*/;
25+
log-tc-size version.*/;
2626

2727
# Plugins which may or may not be there:
2828
@plugins=qw/innodb archive blackhole federated partition

sql/log.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8428,7 +8428,7 @@ ulong tc_log_page_waits= 0;
84288428

84298429
static const uchar tc_log_magic[]={(uchar) 254, 0x23, 0x05, 0x74};
84308430

8431-
ulong opt_tc_log_size= TC_LOG_MIN_SIZE;
8431+
ulong opt_tc_log_size;
84328432
ulong tc_log_max_pages_used=0, tc_log_page_size=0, tc_log_cur_pages_used=0;
84338433

84348434
int TC_LOG_MMAP::open(const char *opt_name)
@@ -8441,7 +8441,6 @@ int TC_LOG_MMAP::open(const char *opt_name)
84418441
DBUG_ASSERT(opt_name && opt_name[0]);
84428442

84438443
tc_log_page_size= my_getpagesize();
8444-
DBUG_ASSERT(TC_LOG_PAGE_SIZE % tc_log_page_size == 0);
84458444

84468445
fn_format(logname,opt_name,mysql_data_home,"",MY_UNPACK_FILENAME);
84478446
if ((fd= mysql_file_open(key_file_tclog, logname, O_RDWR, MYF(0))) < 0)
@@ -8780,6 +8779,7 @@ mmap_do_checkpoint_callback(void *data)
87808779
int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
87818780
{
87828781
pending_cookies *full_buffer= NULL;
8782+
uint32 ncookies= tc_log_page_size / sizeof(my_xid);
87838783
DBUG_ASSERT(*(my_xid *)(data+cookie) == xid);
87848784

87858785
/*
@@ -8793,7 +8793,7 @@ int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
87938793
mysql_mutex_lock(&LOCK_pending_checkpoint);
87948794
if (pending_checkpoint == NULL)
87958795
{
8796-
uint32 size= sizeof(*pending_checkpoint);
8796+
uint32 size= sizeof(*pending_checkpoint) + sizeof(ulong) * (ncookies - 1);
87978797
if (!(pending_checkpoint=
87988798
(pending_cookies *)my_malloc(size, MYF(MY_ZEROFILL))))
87998799
{
@@ -8804,8 +8804,7 @@ int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
88048804
}
88058805

88068806
pending_checkpoint->cookies[pending_checkpoint->count++]= cookie;
8807-
if (pending_checkpoint->count == sizeof(pending_checkpoint->cookies) /
8808-
sizeof(pending_checkpoint->cookies[0]))
8807+
if (pending_checkpoint->count == ncookies)
88098808
{
88108809
full_buffer= pending_checkpoint;
88118810
pending_checkpoint= NULL;
@@ -8839,7 +8838,7 @@ TC_LOG_MMAP::commit_checkpoint_notify(void *cookie)
88398838
if (count == 0)
88408839
{
88418840
uint i;
8842-
for (i= 0; i < sizeof(pending->cookies)/sizeof(pending->cookies[0]); ++i)
8841+
for (i= 0; i < tc_log_page_size / sizeof(my_xid); ++i)
88438842
delete_entry(pending->cookies[i]);
88448843
my_free(pending);
88458844
}

sql/log.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging
118118
};
119119

120120
#define TC_LOG_PAGE_SIZE 8192
121-
#define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE)
122121

123122
#ifdef HAVE_MMAP
124123
class TC_LOG_MMAP: public TC_LOG
@@ -133,7 +132,7 @@ class TC_LOG_MMAP: public TC_LOG
133132
struct pending_cookies {
134133
uint count;
135134
uint pending_count;
136-
ulong cookies[TC_LOG_PAGE_SIZE/sizeof(my_xid)];
135+
ulong cookies[1];
137136
};
138137

139138
private:

sql/mysqld.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4124,6 +4124,7 @@ static int init_common_variables()
41244124
strmake(pidfile_name, opt_log_basename, sizeof(pidfile_name)-5);
41254125
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
41264126
SYSVAR_AUTOSIZE(pidfile_name_ptr, pidfile_name);
4127+
mark_sys_var_value_origin(&opt_tc_log_size, sys_var::AUTO);
41274128

41284129
/*
41294130
The default-storage-engine entry in my_long_options should have a
@@ -7224,12 +7225,6 @@ struct my_option my_long_options[]=
72247225
"more than one storage engine, when binary log is disabled).",
72257226
&opt_tc_log_file, &opt_tc_log_file, 0, GET_STR,
72267227
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
7227-
#ifdef HAVE_MMAP
7228-
{"log-tc-size", 0, "Size of transaction coordinator log.",
7229-
&opt_tc_log_size, &opt_tc_log_size, 0, GET_ULONG,
7230-
REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, (ulonglong) ULONG_MAX, 0,
7231-
TC_LOG_PAGE_SIZE, 0},
7232-
#endif
72337228
{"master-info-file", 0,
72347229
"The location and name of the file that remembers the master and where "
72357230
"the I/O replication thread is in the master's binlogs. Defaults to "

sql/sys_vars.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5202,3 +5202,14 @@ static Sys_var_mybool Sys_strict_password_validation(
52025202
"that cannot be validated (passwords specified as a hash)",
52035203
GLOBAL_VAR(strict_password_validation),
52045204
CMD_LINE(OPT_ARG), DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG);
5205+
5206+
#ifdef HAVE_MMAP
5207+
static Sys_var_ulong Sys_log_tc_size(
5208+
"log_tc_size",
5209+
"Size of transaction coordinator log.",
5210+
READ_ONLY GLOBAL_VAR(opt_tc_log_size),
5211+
CMD_LINE(REQUIRED_ARG),
5212+
VALID_RANGE(my_getpagesize() * 3, ULONG_MAX),
5213+
DEFAULT(my_getpagesize() * 6),
5214+
BLOCK_SIZE(my_getpagesize()));
5215+
#endif

0 commit comments

Comments
 (0)