summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-04-29 17:54:10 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-04-29 17:54:10 +0300
commit447b8ba1645435cb7d538a6f1b644cad113f4835 (patch)
tree1fca3981fd9f3829287b5f3b372a0661c7e4273d
parent4d59f45260547b3230f177498b6fa07a12647fdc (diff)
parent810f014ca7a705381e110cb26649c528bc00f179 (diff)
downloadmariadb-git-447b8ba1645435cb7d538a6f1b644cad113f4835.tar.gz
Merge 10.2 into 10.3
-rw-r--r--extra/innochecksum.cc7
-rw-r--r--extra/mariabackup/xtrabackup.cc2
m---------libmariadb0
-rw-r--r--mysql-test/suite/innodb/r/page_reorganize.result27
-rw-r--r--mysql-test/suite/innodb/t/page_reorganize.test56
-rw-r--r--mysql-test/suite/innodb_zip/r/innochecksum_2.result2
-rw-r--r--mysql-test/suite/plugins/r/server_audit.result17
-rw-r--r--mysql-test/suite/plugins/t/server_audit.test11
-rw-r--r--plugin/server_audit/server_audit.c69
-rw-r--r--storage/innobase/btr/btr0bulk.cc2
-rw-r--r--storage/innobase/buf/buf0buddy.cc11
-rw-r--r--storage/innobase/buf/buf0flu.cc5
-rw-r--r--storage/innobase/fil/fil0fil.cc21
-rw-r--r--storage/innobase/handler/ha_innodb.cc19
-rw-r--r--storage/innobase/include/buf0buf.h10
-rw-r--r--storage/innobase/include/ha_prototypes.h3
-rw-r--r--storage/innobase/include/univ.i2
-rw-r--r--storage/innobase/include/ut0lst.h130
-rw-r--r--storage/innobase/lock/lock0lock.cc67
19 files changed, 302 insertions, 159 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index 5c6cf74fd8e..164a7727d68 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
- Copyright (c) 2014, 2017, MariaDB Corporation.
+ Copyright (c) 2014, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1232,7 +1232,7 @@ static struct my_option innochecksum_options[] = {
{"verbose", 'v', "Verbose (prints progress every 5 seconds).",
&verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
- {"debug", '#', "Output debug log. See " REFMAN "dbug-package.html",
+ {"debug", '#', "Output debug log. See https://mariadb.com/kb/en/library/creating-a-trace-file/",
&dbug_setting, &dbug_setting, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif /* !DBUG_OFF */
{"count", 'c', "Print the count of pages in the file and exits.",
@@ -1299,7 +1299,8 @@ static void usage(void)
"[-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] "
"[-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] "
"[-l <log>] [-l] [-m <merge pages>] <filename or [-]>\n", my_progname);
- printf("See " REFMAN "innochecksum.html for usage hints.\n");
+ printf("See https://mariadb.com/kb/en/library/innochecksum/"
+ " for usage hints.\n");
my_print_help(innochecksum_options);
my_print_variables(innochecksum_options);
}
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index d1fd7aa0994..cad31bc2bed 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -4148,7 +4148,7 @@ reread_log_header:
memset(&stat_info, 0, sizeof(MY_STAT));
dst_log_file = ds_open(ds_redo, "ib_logfile0", &stat_info);
if (dst_log_file == NULL) {
- msg("§rror: failed to open the target stream for "
+ msg("Error: failed to open the target stream for "
"'ib_logfile0'.");
goto fail;
}
diff --git a/libmariadb b/libmariadb
-Subproject 2c5aebb3bc724c1663c481ba2fedde00ab494fa
+Subproject b50871611764d282874ad095d6c021163d1fe35
diff --git a/mysql-test/suite/innodb/r/page_reorganize.result b/mysql-test/suite/innodb/r/page_reorganize.result
new file mode 100644
index 00000000000..1059fc78531
--- /dev/null
+++ b/mysql-test/suite/innodb/r/page_reorganize.result
@@ -0,0 +1,27 @@
+#
+# Bug# 20005279 ASSERT !OTHER_LOCK, LOCK_MOVE_REORGANIZE_PAGE()
+#
+create table t1 (f1 int auto_increment primary key,
+f2 char(255)) engine=innodb;
+start transaction;
+commit;
+start transaction;
+select f1, f2 from t1 where f1 = 20 for update;
+f1 f2
+20 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+connect con1,localhost,root,,;
+select f1 from t1 where f1 = 20 for update;
+connection default;
+SET @save_dbug = @@debug_dbug;
+SET DEBUG_DBUG = '+d,do_page_reorganize,do_lock_reverse_page_reorganize';
+insert into t1(f2) values (repeat('+', 100));
+SET DEBUG = @save_dbug;
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+commit;
+connection con1;
+f1
+20
+disconnect con1;
+connection default;
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/page_reorganize.test b/mysql-test/suite/innodb/t/page_reorganize.test
new file mode 100644
index 00000000000..7408353976d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/page_reorganize.test
@@ -0,0 +1,56 @@
+--source include/have_innodb.inc
+--source include/have_innodb_16k.inc
+--source include/have_debug.inc
+
+--source include/count_sessions.inc
+
+--echo #
+--echo # Bug# 20005279 ASSERT !OTHER_LOCK, LOCK_MOVE_REORGANIZE_PAGE()
+--echo #
+
+create table t1 (f1 int auto_increment primary key,
+ f2 char(255)) engine=innodb;
+
+let $inc = 50;
+
+start transaction;
+--disable_query_log
+
+while ($inc)
+{
+ insert into t1(f2) values (repeat('~', 50));
+ dec $inc;
+}
+
+--enable_query_log
+commit;
+
+start transaction;
+select f1, f2 from t1 where f1 = 20 for update;
+
+connect (con1,localhost,root,,);
+--send
+select f1 from t1 where f1 = 20 for update;
+
+connection default;
+
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where INFO = 'select f1 from t1 where f1 = 20 for update';
+
+--source include/wait_condition.inc
+
+SET @save_dbug = @@debug_dbug;
+SET DEBUG_DBUG = '+d,do_page_reorganize,do_lock_reverse_page_reorganize';
+insert into t1(f2) values (repeat('+', 100));
+SET DEBUG = @save_dbug;
+commit;
+
+connection con1;
+reap;
+disconnect con1;
+connection default;
+
+drop table t1;
+
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_2.result b/mysql-test/suite/innodb_zip/r/innochecksum_2.result
index 582bb42f0cb..bfd03c72f12 100644
--- a/mysql-test/suite/innodb_zip/r/innochecksum_2.result
+++ b/mysql-test/suite/innodb_zip/r/innochecksum_2.result
@@ -43,10 +43,12 @@ Copyright (c) YEAR, YEAR , Oracle, MariaDB Corporation Ab and others.
InnoDB offline file checksum utility.
Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] [-l] [-m <merge pages>] <filename or [-]>
+See https://mariadb.com/kb/en/library/innochecksum/ for usage hints.
-?, --help Displays this help and exits.
-I, --info Synonym for --help.
-V, --version Displays version information and exits.
-v, --verbose Verbose (prints progress every 5 seconds).
+ https://mariadb.com/kb/en/library/creating-a-trace-file/
-c, --count Print the count of pages in the file and exits.
-s, --start-page=# Start on this page number (0 based).
-e, --end-page=# End at this page number (0 based).
diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result
index 01392760317..b8d2986feea 100644
--- a/mysql-test/suite/plugins/r/server_audit.result
+++ b/mysql-test/suite/plugins/r/server_audit.result
@@ -21,6 +21,16 @@ set global server_audit_incl_users=null;
set global server_audit_file_path='server_audit.log';
set global server_audit_output_type=file;
set global server_audit_logging=on;
+set global server_audit_incl_users= repeat("'root',", 10000);
+ERROR 42000: Variable 'server_audit_incl_users' can't be set to the value of ''root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','roo'
+show variables like 'server_audit_incl_users';
+Variable_name Value
+server_audit_incl_users
+set global server_audit_excl_users= repeat("'root',", 10000);
+ERROR 42000: Variable 'server_audit_excl_users' can't be set to the value of ''root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','roo'
+show variables like 'server_audit_excl_users';
+Variable_name Value
+server_audit_excl_users
connect con1,localhost,root,,mysql;
connection default;
disconnect con1;
@@ -202,6 +212,8 @@ select 2;
2
2
drop table t1;
+set global server_audit_logging= off;
+set global server_audit_logging= on;
set global server_audit_events='';
set global server_audit_query_log_limit= 15;
select (1), (2), (3), (4);
@@ -251,6 +263,10 @@ uninstall plugin server_audit;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_logging=on',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users= repeat("\'root\',", 10000)',ID
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit_incl_users\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_excl_users= repeat("\'root\',", 10000)',ID
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit_excl_users\'',0
TIME,HOSTNAME,root,localhost,ID,0,CONNECT,mysql,,0
TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,mysql,,0
TIME,HOSTNAME,no_such_user,localhost,ID,0,FAILED_CONNECT,,,ID
@@ -364,6 +380,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_logging= off',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0
diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test
index 4af1ed883e3..f19c8f53b61 100644
--- a/mysql-test/suite/plugins/t/server_audit.test
+++ b/mysql-test/suite/plugins/t/server_audit.test
@@ -13,6 +13,14 @@ set global server_audit_incl_users=null;
set global server_audit_file_path='server_audit.log';
set global server_audit_output_type=file;
set global server_audit_logging=on;
+
+--error ER_WRONG_VALUE_FOR_VAR
+set global server_audit_incl_users= repeat("'root',", 10000);
+show variables like 'server_audit_incl_users';
+--error ER_WRONG_VALUE_FOR_VAR
+set global server_audit_excl_users= repeat("'root',", 10000);
+show variables like 'server_audit_excl_users';
+
--sleep 2
connect (con1,localhost,root,,mysql);
connection default;
@@ -128,6 +136,9 @@ select * from t1;
select 2;
drop table t1;
+set global server_audit_logging= off;
+set global server_audit_logging= on;
+
set global server_audit_events='';
set global server_audit_query_log_limit= 15;
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index c655e02a4fc..801718265ad 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -15,7 +15,7 @@
#define PLUGIN_VERSION 0x104
-#define PLUGIN_STR_VERSION "1.4.4"
+#define PLUGIN_STR_VERSION "1.4.5"
#define _my_thread_var loc_thread_var
@@ -333,6 +333,10 @@ static void update_file_rotations(MYSQL_THD thd, struct st_mysql_sys_var *var,
void *var_ptr, const void *save);
static void update_incl_users(MYSQL_THD thd, struct st_mysql_sys_var *var,
void *var_ptr, const void *save);
+static int check_incl_users(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
+ struct st_mysql_value *value);
+static int check_excl_users(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
+ struct st_mysql_value *value);
static void update_excl_users(MYSQL_THD thd, struct st_mysql_sys_var *var,
void *var_ptr, const void *save);
static void update_output_type(MYSQL_THD thd, struct st_mysql_sys_var *var,
@@ -352,10 +356,10 @@ static void rotate_log(MYSQL_THD thd, struct st_mysql_sys_var *var,
static MYSQL_SYSVAR_STR(incl_users, incl_users, PLUGIN_VAR_RQCMDARG,
"Comma separated list of users to monitor.",
- NULL, update_incl_users, NULL);
+ check_incl_users, update_incl_users, NULL);
static MYSQL_SYSVAR_STR(excl_users, excl_users, PLUGIN_VAR_RQCMDARG,
"Comma separated list of users to exclude from auditing.",
- NULL, update_excl_users, NULL);
+ check_excl_users, update_excl_users, NULL);
/* bits in the event filter. */
#define EVENT_CONNECT 1
#define EVENT_QUERY_ALL 2
@@ -1621,7 +1625,7 @@ static int log_statement_ex(const struct connection_info *cn,
}
if (query && !(events & EVENT_QUERY_ALL) &&
- (events & EVENT_QUERY))
+ (events & EVENT_QUERY && !cn->log_always))
{
const char *orig_query= query;
@@ -2555,9 +2559,10 @@ static void log_current_query(MYSQL_THD thd)
if (!ci_needs_setup(cn) && cn->query_length &&
FILTER(EVENT_QUERY) && do_log_user(cn->user))
{
+ cn->log_always= 1;
log_statement_ex(cn, cn->query_time, thd_get_thread_id(thd),
cn->query, cn->query_length, 0, "QUERY");
- cn->log_always= 1;
+ cn->log_always= 0;
}
}
@@ -2646,16 +2651,56 @@ static void update_file_rotate_size(MYSQL_THD thd __attribute__((unused)),
}
+static int check_users(void *save, struct st_mysql_value *value,
+ size_t s, const char *name)
+{
+ const char *users;
+ int len= 0;
+
+ users= value->val_str(value, NULL, &len);
+ if ((size_t) len > s)
+ {
+ error_header();
+ fprintf(stderr,
+ "server_audit_%s_users value can't be longer than %zu characters.\n",
+ name, s);
+ return 1;
+ }
+ *((const char**)save)= users;
+ return 0;
+}
+
+static int check_incl_users(MYSQL_THD thd __attribute__((unused)),
+ struct st_mysql_sys_var *var __attribute__((unused)),
+ void *save, struct st_mysql_value *value)
+{
+ return check_users(save, value, sizeof(incl_user_buffer), "incl");
+}
+
+static int check_excl_users(MYSQL_THD thd __attribute__((unused)),
+ struct st_mysql_sys_var *var __attribute__((unused)),
+ void *save, struct st_mysql_value *value)
+{
+ return check_users(save, value, sizeof(excl_user_buffer), "excl");
+}
+
+
static void update_incl_users(MYSQL_THD thd,
struct st_mysql_sys_var *var __attribute__((unused)),
void *var_ptr __attribute__((unused)), const void *save)
{
char *new_users= (*(char **) save) ? *(char **) save : empty_str;
+ size_t new_len= strlen(new_users) + 1;
if (!maria_55_started || !debug_server_started)
flogger_mutex_lock(&lock_operations);
mark_always_logged(thd);
- strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer)-1);
- incl_user_buffer[sizeof(incl_user_buffer)-1]= 0;
+
+ if (new_len > sizeof(incl_user_buffer))
+ new_len= sizeof(incl_user_buffer);
+
+ memcpy(incl_user_buffer, new_users, new_len - 1);
+ incl_user_buffer[new_len - 1]= 0;
+
incl_users= incl_user_buffer;
user_coll_fill(&incl_user_coll, incl_users, &excl_user_coll, 1);
error_header();
@@ -2670,11 +2715,17 @@ static void update_excl_users(MYSQL_THD thd __attribute__((unused)),
void *var_ptr __attribute__((unused)), const void *save)
{
char *new_users= (*(char **) save) ? *(char **) save : empty_str;
+ size_t new_len= strlen(new_users) + 1;
if (!maria_55_started || !debug_server_started)
flogger_mutex_lock(&lock_operations);
mark_always_logged(thd);
- strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer)-1);
- excl_user_buffer[sizeof(excl_user_buffer)-1]= 0;
+
+ if (new_len > sizeof(excl_user_buffer))
+ new_len= sizeof(excl_user_buffer);
+
+ memcpy(excl_user_buffer, new_users, new_len - 1);
+ excl_user_buffer[new_len - 1]= 0;
+
excl_users= excl_user_buffer;
user_coll_fill(&excl_user_coll, excl_users, &incl_user_coll, 0);
error_header();
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc
index dbbf68ff207..edd26a672be 100644
--- a/storage/innobase/btr/btr0bulk.cc
+++ b/storage/innobase/btr/btr0bulk.cc
@@ -1045,7 +1045,7 @@ BtrBulk::finish(dberr_t err)
ut_ad(!sync_check_iterate(dict_sync_check()));
- ut_ad(err == DB_SUCCESS
+ ut_ad(err != DB_SUCCESS
|| btr_validate_index(m_index, NULL, false) == DB_SUCCESS);
return(err);
}
diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc
index 3b784494fda..a41345b43ab 100644
--- a/storage/innobase/buf/buf0buddy.cc
+++ b/storage/innobase/buf/buf0buddy.cc
@@ -171,13 +171,13 @@ buf_buddy_get(
struct CheckZipFree {
CheckZipFree(ulint i) : m_i(i) {}
- void operator()(const buf_buddy_free_t* elem) const
+ void operator()(const buf_buddy_free_t* elem) const
{
- ut_a(buf_buddy_stamp_is_free(elem));
- ut_a(elem->stamp.size <= m_i);
+ ut_ad(buf_buddy_stamp_is_free(elem));
+ ut_ad(elem->stamp.size <= m_i);
}
- ulint m_i;
+ const ulint m_i;
};
/** Validate a buddy list.
@@ -189,8 +189,7 @@ buf_buddy_list_validate(
const buf_pool_t* buf_pool,
ulint i)
{
- CheckZipFree check(i);
- ut_list_validate(buf_pool->zip_free[i], check);
+ ut_list_validate(buf_pool->zip_free[i], CheckZipFree(i));
}
/**********************************************************************//**
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index fd9d4713a9c..e3c45863c8b 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -3567,7 +3567,7 @@ buf_flush_request_force(
/** Functor to validate the flush list. */
struct Check {
- void operator()(const buf_page_t* elem)
+ void operator()(const buf_page_t* elem) const
{
ut_a(elem->in_flush_list);
}
@@ -3584,11 +3584,10 @@ buf_flush_validate_low(
{
buf_page_t* bpage;
const ib_rbt_node_t* rnode = NULL;
- Check check;
ut_ad(buf_flush_list_mutex_own(buf_pool));
- ut_list_validate(buf_pool->flush_list, check);
+ ut_list_validate(buf_pool->flush_list, Check());
bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index fce7c6a98fe..7ed703de5d7 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -548,13 +548,9 @@ bool fil_node_t::read_page0(bool first)
return false;
}
- ut_ad(space->free_limit == 0 || space->free_limit == free_limit);
- ut_ad(space->free_len == 0 || space->free_len == free_len);
- space->size_in_header = size;
- space->free_limit = free_limit;
- space->free_len = free_len;
-
if (first) {
+ ut_ad(space->id != TRX_SYS_SPACE);
+
/* Truncate the size to a multiple of extent size. */
ulint mask = psize * FSP_EXTENT_SIZE - 1;
@@ -567,8 +563,19 @@ bool fil_node_t::read_page0(bool first)
this->size = ulint(size_bytes / psize);
space->size += this->size;
+ } else if (space->id != TRX_SYS_SPACE || space->size_in_header) {
+ /* If this is not the first-time open, do nothing.
+ For the system tablespace, we always get invoked as
+ first=false, so we detect the true first-time-open based
+ on size_in_header and proceed to initiailze the data. */
+ return true;
}
+ ut_ad(space->free_limit == 0 || space->free_limit == free_limit);
+ ut_ad(space->free_len == 0 || space->free_len == free_len);
+ space->size_in_header = size;
+ space->free_limit = free_limit;
+ space->free_len = free_len;
return true;
}
@@ -4658,7 +4665,7 @@ fil_validate(void)
ut_a(fil_system.n_open == n_open);
- UT_LIST_CHECK(fil_system.LRU);
+ ut_list_validate(fil_system.LRU);
for (fil_node = UT_LIST_GET_FIRST(fil_system.LRU);
fil_node != 0;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 10b8c0e61a9..e0e0afd3dc7 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -6135,9 +6135,9 @@ no_such_table:
<< n_cols << " user"
" defined columns in InnoDB, but " << n_fields
<< " columns in MariaDB. Please check"
- " INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and " REFMAN
- "innodb-troubleshooting.html for how to resolve the"
- " issue.";
+ " INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and"
+ " https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/"
+ " for how to resolve the issue.";
/* Mark this table as corrupted, so the drop table
or force recovery can still use it, but not others. */
@@ -21150,11 +21150,11 @@ ib_errf(
/* Keep the first 16 characters as-is, since the url is sometimes used
as an offset from this.*/
const char* TROUBLESHOOTING_MSG =
- "Please refer to " REFMAN "innodb-troubleshooting.html"
+ "Please refer to https://mariadb.com/kb/en/innodb-troubleshooting/"
" for how to resolve the issue.";
const char* TROUBLESHOOT_DATADICT_MSG =
- "Please refer to " REFMAN "innodb-troubleshooting-datadict.html"
+ "Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/"
" for how to resolve the issue.";
const char* BUG_REPORT_MSG =
@@ -21165,9 +21165,6 @@ const char* FORCE_RECOVERY_MSG =
"https://mariadb.com/kb/en/library/innodb-recovery-modes/"
" for information about forcing recovery.";
-const char* ERROR_CREATING_MSG =
- "Please refer to " REFMAN "error-creating-innodb.html";
-
const char* OPERATING_SYSTEM_ERROR_MSG =
"Some operating system error numbers are described at"
" https://mariadb.com/kb/en/library/operating-system-error-codes/";
@@ -21555,8 +21552,7 @@ ib_push_frm_error(
" Have you mixed up "
".frm files from different "
"installations? See "
- REFMAN
- "innodb-troubleshooting.html\n",
+ "https://mariadb.com/kb/en/innodb-troubleshooting/\n",
ib_table->name.m_name);
if (push_warning) {
@@ -21599,8 +21595,7 @@ ib_push_frm_error(
" Have you mixed up "
".frm files from different "
"installations? See "
- REFMAN
- "innodb-troubleshooting.html\n",
+ "https://mariadb.com/kb/en/innodb-troubleshooting/\n",
ib_table->name.m_name, n_keys,
table->s->keys);
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 5c6360823bf..64716703b40 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -2427,8 +2427,7 @@ struct CheckInLRUList {
static void validate(const buf_pool_t* buf_pool)
{
- CheckInLRUList check;
- ut_list_validate(buf_pool->LRU, check);
+ ut_list_validate(buf_pool->LRU, CheckInLRUList());
}
};
@@ -2441,8 +2440,7 @@ struct CheckInFreeList {
static void validate(const buf_pool_t* buf_pool)
{
- CheckInFreeList check;
- ut_list_validate(buf_pool->free, check);
+ ut_list_validate(buf_pool->free, CheckInFreeList());
}
};
@@ -2455,8 +2453,8 @@ struct CheckUnzipLRUAndLRUList {
static void validate(const buf_pool_t* buf_pool)
{
- CheckUnzipLRUAndLRUList check;
- ut_list_validate(buf_pool->unzip_LRU, check);
+ ut_list_validate(buf_pool->unzip_LRU,
+ CheckUnzipLRUAndLRUList());
}
};
#endif /* UNIV_DEBUG || defined UNIV_BUF_DEBUG */
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index 88b5e181efe..0e3402d2864 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -431,7 +431,6 @@ extern const char* TROUBLESHOOTING_MSG;
extern const char* TROUBLESHOOT_DATADICT_MSG;
extern const char* BUG_REPORT_MSG;
extern const char* FORCE_RECOVERY_MSG;
-extern const char* ERROR_CREATING_MSG;
extern const char* OPERATING_SYSTEM_ERROR_MSG;
extern const char* FOREIGN_KEY_CONSTRAINTS_MSG;
extern const char* SET_TRANSACTION_MSG;
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index b66c4a96c9b..69e8e9eb96e 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -53,8 +53,6 @@ component, i.e. we show M.N.P as M.N */
IB_TO_STR(MYSQL_VERSION_MINOR) "." \
IB_TO_STR(MYSQL_VERSION_PATCH)
-#define REFMAN "http://dev.mysql.com/doc/refman/5.7/en/"
-
/** How far ahead should we tell the service manager the timeout
(time in seconds) */
#define INNODB_EXTEND_TIMEOUT_INTERVAL 30
diff --git a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst.h
index f62d3744b96..986f73ea17c 100644
--- a/storage/innobase/include/ut0lst.h
+++ b/storage/innobase/include/ut0lst.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -426,24 +427,19 @@ Gets the last node in a two-way list.
@return last node, or NULL if the list is empty */
#define UT_LIST_GET_LAST(BASE) (BASE).end
-struct NullValidate { void operator()(const void*) { } };
+struct NullValidate { void operator()(const void*) const {} };
-/********************************************************************//**
-Iterate over all the elements and call the functor for each element.
+/** Iterate over all the elements and call the functor for each element.
@param[in] list base node (not a pointer to it)
@param[in,out] functor Functor that is called for each element in the list */
template <typename List, class Functor>
-void
-ut_list_map(
- const List& list,
- Functor& functor)
+inline void ut_list_map(const List& list, Functor& functor)
{
- ulint count = 0;
+ ulint count = 0;
UT_LIST_IS_INITIALISED(list);
- for (typename List::elem_type* elem = list.start;
- elem != 0;
+ for (typename List::elem_type* elem = list.start; elem;
elem = (elem->*list.node).next, ++count) {
functor(elem);
@@ -452,32 +448,50 @@ ut_list_map(
ut_a(count == list.count);
}
-template <typename List>
-void
-ut_list_reverse(List& list)
+/** Iterate over all the elements and call the functor for each element.
+@param[in] list base node (not a pointer to it)
+@param[in] functor Functor that is called for each element in the list */
+template <typename List, class Functor>
+inline void ut_list_map(const List& list, const Functor& functor)
{
+ ulint count = 0;
+
UT_LIST_IS_INITIALISED(list);
- for (typename List::elem_type* elem = list.start;
+ for (typename List::elem_type* elem = list.start; elem;
+ elem = (elem->*list.node).next, ++count) {
+
+ functor(elem);
+ }
+
+ ut_a(count == list.count);
+}
+
+/** Check the consistency of a doubly linked list.
+@param[in] list base node (not a pointer to it)
+@param[in,out] functor Functor that is called for each element in the list */
+template <typename List, class Functor>
+void ut_list_validate(const List& list, Functor& functor)
+{
+ ut_list_map(list, functor);
+
+ /* Validate the list backwards. */
+ ulint count = 0;
+
+ for (typename List::elem_type* elem = list.end;
elem != 0;
elem = (elem->*list.node).prev) {
- (elem->*list.node).reverse();
+ ++count;
}
- list.reverse();
+ ut_a(count == list.count);
}
-#define UT_LIST_REVERSE(LIST) ut_list_reverse(LIST)
-
-/********************************************************************//**
-Checks the consistency of a two-way list.
-@param[in] list base node (not a pointer to it)
-@param[in,out] functor Functor that is called for each element in the list */
+/** Check the consistency of a doubly linked list.
+@param[in] list base node (not a pointer to it)
+@param[in] functor Functor that is called for each element in the list */
template <typename List, class Functor>
-void
-ut_list_validate(
- const List& list,
- Functor& functor)
+inline void ut_list_validate(const List& list, const Functor& functor)
{
ut_list_map(list, functor);
@@ -493,12 +507,42 @@ ut_list_validate(
ut_a(count == list.count);
}
-/** Check the consistency of a two-way list.
-@param[in] LIST base node reference */
-#define UT_LIST_CHECK(LIST) do { \
- NullValidate nullV; \
- ut_list_validate(LIST, nullV); \
-} while (0)
+template <typename List>
+inline void ut_list_validate(const List& list)
+{
+ ut_list_validate(list, NullValidate());
+}
+
+#ifdef UNIV_DEBUG
+template <typename List>
+inline void ut_list_reverse(List& list)
+{
+ UT_LIST_IS_INITIALISED(list);
+
+ for (typename List::elem_type* elem = list.start;
+ elem != 0;
+ elem = (elem->*list.node).prev) {
+ (elem->*list.node).reverse();
+ }
+
+ list.reverse();
+}
+
+/** Check if the given element exists in the list.
+@param[in,out] list the list object
+@param[in] elem the element of the list which will be checked */
+template <typename List>
+inline bool ut_list_exists(const List& list, typename List::elem_type* elem)
+{
+ for (typename List::elem_type* e1 = UT_LIST_GET_FIRST(list); e1;
+ e1 = (e1->*list.node).next) {
+ if (elem == e1) {
+ return true;
+ }
+ }
+ return false;
+}
+#endif
/** Move the given element to the beginning of the list.
@param[in,out] list the list object
@@ -519,28 +563,6 @@ ut_list_move_to_front(
}
#ifdef UNIV_DEBUG
-/** Check if the given element exists in the list.
-@param[in,out] list the list object
-@param[in] elem the element of the list which will be checked */
-template <typename List>
-bool
-ut_list_exists(
- List& list,
- typename List::elem_type* elem)
-{
- typename List::elem_type* e1;
-
- for (e1 = UT_LIST_GET_FIRST(list); e1 != NULL;
- e1 = (e1->*list.node).next) {
- if (elem == e1) {
- return(true);
- }
- }
- return(false);
-}
#endif
-#define UT_LIST_MOVE_TO_FRONT(LIST, ELEM) \
- ut_list_move_to_front(LIST, ELEM)
-
#endif /* ut0lst.h */
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 7ef468fae39..1b8394b8790 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -2585,7 +2585,7 @@ lock_move_granted_locks_to_front(
if (!lock->is_waiting()) {
lock_t* prev = UT_LIST_GET_PREV(trx_locks, lock);
ut_a(prev);
- UT_LIST_MOVE_TO_FRONT(lock_list, lock);
+ ut_list_move_to_front(lock_list, lock);
lock = prev;
}
}
@@ -2673,7 +2673,7 @@ lock_move_reorganize_page(
lock_move_granted_locks_to_front(old_locks);
DBUG_EXECUTE_IF("do_lock_reverse_page_reorganize",
- UT_LIST_REVERSE(old_locks););
+ ut_list_reverse(old_locks););
for (lock = UT_LIST_GET_FIRST(old_locks); lock;
lock = UT_LIST_GET_NEXT(trx_locks, lock)) {
@@ -4624,29 +4624,6 @@ lock_print_info_summary(
return(TRUE);
}
-/** Functor to print not-started transaction from the trx_list. */
-
-struct PrintNotStarted {
-
- PrintNotStarted(FILE* file) : m_file(file) { }
-
- void operator()(const trx_t* trx)
- {
- ut_ad(mutex_own(&trx_sys.mutex));
-
- /* See state transitions and locking rules in trx0trx.h */
-
- if (trx->mysql_thd
- && trx_state_eq(trx, TRX_STATE_NOT_STARTED)) {
-
- fputs("---", m_file);
- trx_print_latched(m_file, trx, 600);
- }
- }
-
- FILE* m_file;
-};
-
/** Prints transaction lock wait and MVCC state.
@param[in,out] file file where to print
@param[in] trx transaction */
@@ -4719,29 +4696,24 @@ lock_trx_print_locks(
}
}
-
-static my_bool lock_print_info_all_transactions_callback(
- rw_trx_hash_element_t *element, FILE *file)
+/** Functor to display all transactions */
+struct lock_print_info
{
- mutex_enter(&element->mutex);
- if (trx_t *trx= element->trx)
+ lock_print_info(FILE* file) : file(file) {}
+
+ void operator()(const trx_t* trx) const
{
- check_trx_state(trx);
+ ut_ad(mutex_own(&trx_sys.mutex));
+ if (trx == purge_sys.query->trx)
+ return;
lock_trx_print_wait_and_mvcc_state(file, trx);
- if (srv_print_innodb_lock_monitor)
- {
- trx->reference();
- mutex_exit(&element->mutex);
+ if (trx->will_lock && srv_print_innodb_lock_monitor)
lock_trx_print_locks(file, trx);
- trx->release_reference();
- return 0;
- }
}
- mutex_exit(&element->mutex);
- return 0;
-}
+ FILE* const file;
+};
/*********************************************************************//**
Prints info of locks for each transaction. This function assumes that the
@@ -4756,20 +4728,9 @@ lock_print_info_all_transactions(
fprintf(file, "LIST OF TRANSACTIONS FOR EACH SESSION:\n");
- /* First print info on non-active transactions */
-
- /* NOTE: information of auto-commit non-locking read-only
- transactions will be omitted here. The information will be
- available from INFORMATION_SCHEMA.INNODB_TRX. */
-
- PrintNotStarted print_not_started(file);
mutex_enter(&trx_sys.mutex);
- ut_list_map(trx_sys.trx_list, print_not_started);
+ ut_list_map(trx_sys.trx_list, lock_print_info(file));
mutex_exit(&trx_sys.mutex);
-
- trx_sys.rw_trx_hash.iterate_no_dups(
- reinterpret_cast<my_hash_walk_action>
- (lock_print_info_all_transactions_callback), file);
lock_mutex_exit();
ut_ad(lock_validate());