Commit 6f9e33ec authored by Sergey Vojtovich's avatar Sergey Vojtovich Committed by Nirbhay Choubey

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.

Conflicts:
	mysql-test/suite/sys_vars/inc/sysvars_server.inc
	mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
	mysql-test/t/mysqld--help.test
	sql/mysqld.cc
	sql/sys_vars.cc
parent 9af42db6
......@@ -1248,7 +1248,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
......
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
--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;
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
wsrep-node-name wsrep-data-home-dir version.*/;
wsrep-node-name wsrep-data-home-dir log-tc-size version.*/;
# Plugins which may or may not be there:
@plugins=qw/innodb ndb archive blackhole federated partition ndbcluster
......
......@@ -8432,7 +8432,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)
......@@ -8445,7 +8445,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)
......@@ -8784,6 +8783,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);
/*
......@@ -8797,7 +8797,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))))
{
......@@ -8808,8 +8808,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;
......@@ -8843,7 +8842,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);
}
......
......@@ -114,7 +114,6 @@ class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging
};
#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
......@@ -129,7 +128,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:
......
......@@ -7698,12 +7698,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 "
......
......@@ -5107,3 +5107,13 @@ static Sys_var_mybool Sys_pseudo_slave_mode(
SESSION_ONLY(pseudo_slave_mode), NO_CMD_LINE, DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_pseudo_slave_mode));
#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