Skip to content

Commit 48c9f0a

Browse files
jhauglidDyre Tjeldvoll
authored andcommitted
Bug#26931470: PLEASE BACKPORT TO 5.7: DEFAULT LOG-TC-SIZE TOO SMALL ON POWER - 3 * ( 64K PAGE
This is a backport to 5.7 of Bug#23014086: DEFAULT LOG-TC-SIZE TOO SMALL ON POWER - 3 * ( 64K PAGE SIZE) MINIMIUM NEEDED The problem was that the memory page size for the memory mapped transaction coordinator was hardcoded to 8k. This did not work properly on platforms like ARM64 and PowerPC where the page size is much larger. This patch fixes the problem by using my_getpagesize() to get the page size of the current platform rather than using a hardcoded value. This has consequences for and changes the behavior of the --log-tc-size startup option. The minimum and default value of the option is now 6 * pagesize. This means it is still 24k on Linux (4k pagesize). The value also now has to be multiples of pagesize rather than multiples of 8k. Patch based on contribution from Alexey Kopytov. (cherry picked from commit e3b09cae22163edfc1951641767b776c8545ad49) Original backport provided by Daniel Black.
1 parent 0f0de06 commit 48c9f0a

File tree

7 files changed

+15
-13
lines changed

7 files changed

+15
-13
lines changed

mysql-test/include/mysqld--help.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ perl;
5858
s/\b393216\b/262144/;
5959
# Replacing port number with string
6060
s/^port \d+/port ####/;
61+
# log-tc-size varies by platform
62+
s/^log-tc-size \d+/log-tc-size #####/;
6163
foreach $var (@env) { s/$ENV{$var}/$var/ }
6264
next if /use --skip-(use-)?symbolic-links to disable/; # for valgrind, again
6365
next if $skip;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ log-syslog-facility daemon
13621362
log-syslog-include-pid TRUE
13631363
log-syslog-tag
13641364
log-tc tc.log
1365-
log-tc-size 24576
1365+
log-tc-size #####
13661366
log-throttle-queries-not-using-indexes 0
13671367
log-timestamps UTC
13681368
log-warnings 0

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ log-statements-unsafe-for-binlog TRUE
13571357
log-syslog FALSE
13581358
log-syslog-tag
13591359
log-tc tc.log
1360-
log-tc-size 24576
1360+
log-tc-size #####
13611361
log-throttle-queries-not-using-indexes 0
13621362
log-timestamps UTC
13631363
log-warnings 0

sql/binlog.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9511,15 +9511,16 @@ int MYSQL_BIN_LOG::recover(IO_CACHE *log, Format_description_log_event *fdle,
95119511
is partially written to the binlog.
95129512
*/
95139513
bool in_transaction= FALSE;
9514+
int memory_page_size= my_getpagesize();
95149515

95159516
if (! fdle->is_valid() ||
9516-
my_hash_init(&xids, &my_charset_bin, TC_LOG_PAGE_SIZE/3, 0,
9517-
sizeof(my_xid), 0, 0, MYF(0),
9517+
my_hash_init(&xids, &my_charset_bin, memory_page_size/3, 0,
9518+
sizeof(my_xid), 0, 0, 0,
95189519
key_memory_binlog_recover_exec))
95199520
goto err1;
95209521

95219522
init_alloc_root(key_memory_binlog_recover_exec,
9522-
&mem_root, TC_LOG_PAGE_SIZE, TC_LOG_PAGE_SIZE);
9523+
&mem_root, memory_page_size, memory_page_size);
95239524

95249525
while ((ev= Log_event::read_log_event(log, 0, fdle, TRUE))
95259526
&& ev->is_valid())

sql/mysqld.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ bool opt_endinfo, using_udf_functions;
314314
my_bool locked_in_memory;
315315
bool opt_using_transactions;
316316
bool volatile abort_loop;
317+
ulong opt_tc_log_size;
318+
317319
static enum_server_operational_state server_operational_state= SERVER_BOOTING;
318320
ulong log_warnings;
319321
bool opt_log_syslog_enable;
@@ -5736,8 +5738,9 @@ struct my_option my_long_options[]=
57365738
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
57375739
{"log-tc-size", 0, "Size of transaction coordinator log.",
57385740
&opt_tc_log_size, &opt_tc_log_size, 0, GET_ULONG,
5739-
REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0,
5740-
TC_LOG_PAGE_SIZE, 0},
5741+
REQUIRED_ARG, TC_LOG_MIN_PAGES * my_getpagesize(),
5742+
TC_LOG_MIN_PAGES * my_getpagesize(), ULONG_MAX, 0,
5743+
my_getpagesize(), 0},
57415744
{"master-info-file", 0,
57425745
"The location and name of the file that remembers the master and where "
57435746
"the I/O replication thread is in the master's binlogs.",

sql/tc_log.cc

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

8686
static const char tc_log_magic[]={(char) 254, 0x23, 0x05, 0x74};
8787

88-
ulong opt_tc_log_size= TC_LOG_MIN_SIZE;
8988
ulong tc_log_max_pages_used=0, tc_log_page_size=0, tc_log_cur_pages_used=0;
9089

9190
int TC_LOG_MMAP::open(const char *opt_name)
@@ -98,10 +97,6 @@ int TC_LOG_MMAP::open(const char *opt_name)
9897
DBUG_ASSERT(opt_name && opt_name[0]);
9998

10099
tc_log_page_size= my_getpagesize();
101-
if (TC_LOG_PAGE_SIZE > tc_log_page_size)
102-
{
103-
DBUG_ASSERT(TC_LOG_PAGE_SIZE % tc_log_page_size == 0);
104-
}
105100

106101
fn_format(logname,opt_name,mysql_data_home,"",MY_UNPACK_FILENAME);
107102
if ((fd= mysql_file_open(key_file_tclog, logname, O_RDWR, MYF(0))) < 0)

sql/tc_log.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
2323
class THD;
2424
typedef ulonglong my_xid;
2525

26+
#define TC_LOG_MIN_PAGES 6
2627

2728
/**
2829
Transaction Coordinator Log.

0 commit comments

Comments
 (0)