summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2016-02-13 18:28:36 -0500
committerNirbhay Choubey <nirbhay@mariadb.com>2016-02-13 18:28:36 -0500
commitd23bd26bec787ebbdbd41be0204e9cb83baf4dbd (patch)
treedda05b0ebb3858e913b0ca3b864705e989bb7661 /storage
parentb83de1151aab6dcc9f300159e31198364000de70 (diff)
parenta9a08b1e2f5b7a9e3ab7c7f75c768389b1d8238f (diff)
downloadmariadb-git-d23bd26bec787ebbdbd41be0204e9cb83baf4dbd.tar.gz
Merge tag 'mariadb-5.5.48' into 5.5-galera
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/buf/buf0flu.c9
-rw-r--r--storage/innobase/dict/dict0dict.c2
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
-rw-r--r--storage/innobase/include/ha_prototypes.h14
-rw-r--r--storage/innobase/row/row0mysql.c49
-rw-r--r--storage/innobase/srv/srv0srv.c33
-rw-r--r--storage/tokudb/ft-index/buildheader/make_tdb.cc4
-rw-r--r--storage/tokudb/ft-index/ft/txn/rollback.cc4
-rw-r--r--storage/tokudb/ft-index/tools/tokudb_dump.cc70
-rw-r--r--storage/tokudb/ft-index/util/dmt.h8
-rw-r--r--storage/tokudb/ha_tokudb.cc2
-rw-r--r--storage/xtradb/dict/dict0dict.c2
-rw-r--r--storage/xtradb/handler/ha_innodb.cc14
-rw-r--r--storage/xtradb/include/ha_prototypes.h14
-rw-r--r--storage/xtradb/include/univ.i4
-rw-r--r--storage/xtradb/log/log0recv.c6
-rw-r--r--storage/xtradb/row/row0mysql.c49
17 files changed, 175 insertions, 111 deletions
diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
index da58d8392cf..d15f2e4601e 100644
--- a/storage/innobase/buf/buf0flu.c
+++ b/storage/innobase/buf/buf0flu.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
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
@@ -2103,12 +2103,7 @@ buf_flush_stat_update(void)
ib_uint64_t lsn;
ulint n_flushed;
- lsn = log_get_lsn_nowait();
-
- /* log_get_lsn_nowait tries to get log_sys->mutex with
- mutex_enter_nowait, if this does not succeed function
- returns 0, do not use that value to update stats. */
- if (lsn == 0) {
+ if (!log_peek_lsn(&lsn)) {
return;
}
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index 7f128771ca0..2a59347bc78 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -2010,7 +2010,7 @@ dict_index_find_cols(
dict_field_t* field = dict_index_get_nth_field(index, i);
for (j = 0; j < table->n_cols; j++) {
- if (!strcmp(dict_table_get_col_name(table, j),
+ if (!innobase_strcasecmp(dict_table_get_col_name(table, j),
field->name)) {
field->col = dict_table_get_nth_col(table, j);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 891584962a8..03385d374bf 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -3533,7 +3533,7 @@ Normalizes a table name string. A normalized name consists of the
database name catenated to '/' and table name. An example:
test/mytable. On Windows normalization puts both the database name and the
table name always to lower case if "set_lower_case" is set to TRUE. */
-static
+extern "C" UNIV_INTERN
void
normalize_table_name_low(
/*=====================*/
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index 1d8c5072a6f..add494d394f 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -349,4 +349,18 @@ ib_push_warning(
const char *format,/*!< in: warning message */
...);
+/*****************************************************************//**
+Normalizes a table name string. A normalized name consists of the
+database name catenated to '/' and table name. An example:
+test/mytable. On Windows normalization puts both the database name and the
+table name always to lower case if "set_lower_case" is set to TRUE. */
+void
+normalize_table_name_low(
+/*=====================*/
+ char* norm_name, /*!< out: normalized name as a
+ null-terminated string */
+ const char* name, /*!< in: table name string */
+ ibool set_lower_case); /*!< in: TRUE if we want to set
+ name to lower case */
+
#endif
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
index 181ca966451..1a11e398959 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -3838,6 +3838,7 @@ row_rename_table_for_mysql(
ibool old_is_tmp, new_is_tmp;
pars_info_t* info = NULL;
int retry;
+ char* is_part = NULL;
ut_a(old_name != NULL);
ut_a(new_name != NULL);
@@ -3872,6 +3873,54 @@ row_rename_table_for_mysql(
table = dict_table_get_low(old_name, DICT_ERR_IGNORE_NONE);
+ /* We look for pattern #P# to see if the table is partitioned
+ MySQL table. */
+#ifdef __WIN__
+ is_part = strstr(old_name, "#p#");
+#else
+ is_part = strstr(old_name, "#P#");
+#endif /* __WIN__ */
+
+ /* MySQL partition engine hard codes the file name
+ separator as "#P#". The text case is fixed even if
+ lower_case_table_names is set to 1 or 2. This is true
+ for sub-partition names as well. InnoDB always
+ normalises file names to lower case on Windows, this
+ can potentially cause problems when copying/moving
+ tables between platforms.
+
+ 1) If boot against an installation from Windows
+ platform, then its partition table name could
+ be all be in lower case in system tables. So we
+ will need to check lower case name when load table.
+
+ 2) If we boot an installation from other case
+ sensitive platform in Windows, we might need to
+ check the existence of table name without lowering
+ case them in the system table. */
+ if (!table &&
+ is_part &&
+ innobase_get_lower_case_table_names() == 1) {
+ char par_case_name[MAX_FULL_NAME_LEN + 1];
+#ifndef __WIN__
+ /* Check for the table using lower
+ case name, including the partition
+ separator "P" */
+ memcpy(par_case_name, old_name,
+ strlen(old_name));
+ par_case_name[strlen(old_name)] = 0;
+ innobase_casedn_str(par_case_name);
+#else
+ /* On Windows platfrom, check
+ whether there exists table name in
+ system table whose name is
+ not being normalized to lower case */
+ normalize_table_name_low(
+ par_case_name, old_name, FALSE);
+#endif
+ table = dict_table_get_low(par_case_name, DICT_ERR_IGNORE_NONE);
+ }
+
if (!table) {
err = DB_TABLE_NOT_FOUND;
ut_print_timestamp(stderr);
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index 3f7c2c80bd9..3f0d3cb7062 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
@@ -2563,6 +2563,8 @@ exit_func:
/*********************************************************************//**
A thread which prints warnings about semaphore waits which have lasted
too long. These can be used to track bugs which cause hangs.
+Note: In order to make sync_arr_wake_threads_if_sema_free work as expected,
+we should avoid waiting any mutexes in this function!
@return a dummy parameter */
UNIV_INTERN
os_thread_ret_t
@@ -2600,24 +2602,21 @@ loop:
/* Try to track a strange bug reported by Harald Fuchs and others,
where the lsn seems to decrease at times */
+ if (log_peek_lsn(&new_lsn)) {
+ if (new_lsn < old_lsn) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: old log sequence number %llu"
+ " was greater\n"
+ "InnoDB: than the new log sequence number %llu!\n"
+ "InnoDB: Please submit a bug report"
+ " to http://bugs.mysql.com\n",
+ old_lsn, new_lsn);
+ ut_ad(0);
+ }
- /* We have to use nowait to ensure we don't block */
- new_lsn= log_get_lsn_nowait();
-
- if (new_lsn && new_lsn < old_lsn) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Error: old log sequence number %llu"
- " was greater\n"
- "InnoDB: than the new log sequence number %llu!\n"
- "InnoDB: Please submit a bug report"
- " to http://bugs.mysql.com\n",
- old_lsn, new_lsn);
- ut_ad(0);
- }
-
- if (new_lsn)
old_lsn = new_lsn;
+ }
if (difftime(time(NULL), srv_last_monitor_time) > 60) {
/* We referesh InnoDB Monitor values so that averages are
diff --git a/storage/tokudb/ft-index/buildheader/make_tdb.cc b/storage/tokudb/ft-index/buildheader/make_tdb.cc
index 53706649231..610ce670db5 100644
--- a/storage/tokudb/ft-index/buildheader/make_tdb.cc
+++ b/storage/tokudb/ft-index/buildheader/make_tdb.cc
@@ -481,7 +481,9 @@ static void print_db_key_range_struct (void) {
static void print_db_lsn_struct (void) {
field_counter=0;
- sort_and_dump_fields("db_lsn", false, NULL);
+ /* A dummy field to make sizeof(DB_LSN) equal in C and C++ */
+ const char *extra[] = { "char dummy", NULL };
+ sort_and_dump_fields("db_lsn", false, extra);
}
static void print_dbt_struct (void) {
diff --git a/storage/tokudb/ft-index/ft/txn/rollback.cc b/storage/tokudb/ft-index/ft/txn/rollback.cc
index 62048039c26..ea2f2a07c50 100644
--- a/storage/tokudb/ft-index/ft/txn/rollback.cc
+++ b/storage/tokudb/ft-index/ft/txn/rollback.cc
@@ -147,9 +147,7 @@ static inline PAIR_ATTR make_rollback_pair_attr(long size) {
PAIR_ATTR
rollback_memory_size(ROLLBACK_LOG_NODE log) {
size_t size = sizeof(*log);
- if (&log->rollentry_arena) {
- size += log->rollentry_arena.total_footprint();
- }
+ size += log->rollentry_arena.total_footprint();
return make_rollback_pair_attr(size);
}
diff --git a/storage/tokudb/ft-index/tools/tokudb_dump.cc b/storage/tokudb/ft-index/tools/tokudb_dump.cc
index 2da50bb793a..b162c5caece 100644
--- a/storage/tokudb/ft-index/tools/tokudb_dump.cc
+++ b/storage/tokudb/ft-index/tools/tokudb_dump.cc
@@ -248,76 +248,6 @@ outputplaintextstring(char* str)
}
static inline int
-hextoint(int ch)
-{
- if (ch >= '0' && ch <= '9') {
- return ch - '0';
- }
- if (ch >= 'a' && ch <= 'z') {
- return ch - 'a' + 10;
- }
- if (ch >= 'A' && ch <= 'Z') {
- return ch - 'A' + 10;
- }
- return EOF;
-}
-
-static inline int
-printabletocstring(char* inputstr, char** poutputstr)
-{
- char highch;
- char lowch;
- char nextch;
- char* cstring;
-
- assert(inputstr);
- assert(poutputstr);
- assert(*poutputstr == NULL);
-
- cstring = (char*)toku_malloc((strlen(inputstr) + 1) * sizeof(char));
- if (cstring == NULL) {
- PRINT_ERROR(errno, "printabletocstring");
- goto error;
- }
-
- for (*poutputstr = cstring; *inputstr != '\0'; inputstr++) {
- if (*inputstr == '\\') {
- if ((highch = *++inputstr) == '\\') {
- *cstring++ = '\\';
- continue;
- }
- if (highch == '\0' || (lowch = *++inputstr) == '\0') {
- PRINT_ERROR(0, "unexpected end of input data or key/data pair");
- goto error;
- }
- if (!isxdigit(highch)) {
- PRINT_ERROR(0, "Unexpected '%c' (non-hex) input.\n", highch);
- goto error;
- }
- if (!isxdigit(lowch)) {
- PRINT_ERROR(0, "Unexpected '%c' (non-hex) input.\n", lowch);
- goto error;
- }
- nextch = (char)((hextoint(highch) << 4) | hextoint(lowch));
- if (nextch == '\0') {
- /* Database names are c strings, and cannot have extra NULL terminators. */
- PRINT_ERROR(0, "Unexpected '\\00' in input.\n");
- goto error;
- }
- *cstring++ = nextch;
- }
- else *cstring++ = *inputstr;
- }
- /* Terminate the string. */
- *cstring = '\0';
- return EXIT_SUCCESS;
-
-error:
- PRINT_ERROR(0, "Quitting out due to errors.\n");
- return EXIT_FAILURE;
-}
-
-static inline int
verify_library_version(void)
{
int major;
diff --git a/storage/tokudb/ft-index/util/dmt.h b/storage/tokudb/ft-index/util/dmt.h
index d4b032f5d6f..43e44df6a70 100644
--- a/storage/tokudb/ft-index/util/dmt.h
+++ b/storage/tokudb/ft-index/util/dmt.h
@@ -679,16 +679,16 @@ private:
__attribute__((nonnull))
void rebalance(subtree *const subtree);
- __attribute__((nonnull))
+ __attribute__((nonnull(3)))
static void copyout(uint32_t *const outlen, dmtdata_t *const out, const dmt_node *const n);
- __attribute__((nonnull))
+ __attribute__((nonnull(3)))
static void copyout(uint32_t *const outlen, dmtdata_t **const out, dmt_node *const n);
- __attribute__((nonnull))
+ __attribute__((nonnull(4)))
static void copyout(uint32_t *const outlen, dmtdata_t *const out, const uint32_t len, const dmtdata_t *const stored_value_ptr);
- __attribute__((nonnull))
+ __attribute__((nonnull(4)))
static void copyout(uint32_t *const outlen, dmtdata_t **const out, const uint32_t len, dmtdata_t *const stored_value_ptr);
template<typename dmtcmp_t,
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index b4e2c1a311e..2eb8004a296 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -379,7 +379,7 @@ static int free_share(TOKUDB_SHARE * share) {
}
const char *ha_tokudb::table_type() const {
- extern const char * const tokudb_hton_name;
+ extern const char *tokudb_hton_name;
return tokudb_hton_name;
}
diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c
index c0f355d8846..6f16fc0bce0 100644
--- a/storage/xtradb/dict/dict0dict.c
+++ b/storage/xtradb/dict/dict0dict.c
@@ -2142,7 +2142,7 @@ dict_index_find_cols(
dict_field_t* field = dict_index_get_nth_field(index, i);
for (j = 0; j < table->n_cols; j++) {
- if (!strcmp(dict_table_get_col_name(table, j),
+ if (!innobase_strcasecmp(dict_table_get_col_name(table, j),
field->name)) {
field->col = dict_table_get_nth_col(table, j);
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 0834f4d08b1..0f5952ce5f2 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -4271,7 +4271,7 @@ Normalizes a table name string. A normalized name consists of the
database name catenated to '/' and table name. An example:
test/mytable. On Windows normalization puts both the database name and the
table name always to lower case if "set_lower_case" is set to TRUE. */
-static
+extern "C" UNIV_INTERN
void
normalize_table_name_low(
/*=====================*/
@@ -8805,7 +8805,8 @@ create_table_def(
/* MySQL does the name length check. But we do additional check
on the name length here */
- if (strlen(table_name) > MAX_FULL_NAME_LEN) {
+ const size_t table_name_len = strlen(table_name);
+ if (table_name_len > MAX_FULL_NAME_LEN) {
push_warning_printf(
(THD*) trx->mysql_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TABLE_NAME,
@@ -8814,6 +8815,15 @@ create_table_def(
DBUG_RETURN(ER_TABLE_NAME);
}
+ if (table_name[table_name_len - 1] == '/') {
+ push_warning_printf(
+ (THD*) trx->mysql_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_TABLE_NAME,
+ "InnoDB: Table name is empty");
+
+ DBUG_RETURN(ER_WRONG_TABLE_NAME);
+ }
+
n_cols = form->s->fields;
/* We pass 0 as the space id, and determine at a lower level the space
diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h
index 411dcfa578c..73741ed911e 100644
--- a/storage/xtradb/include/ha_prototypes.h
+++ b/storage/xtradb/include/ha_prototypes.h
@@ -386,4 +386,18 @@ ib_push_warning(
const char *format,/*!< in: warning message */
...);
+/*****************************************************************//**
+Normalizes a table name string. A normalized name consists of the
+database name catenated to '/' and table name. An example:
+test/mytable. On Windows normalization puts both the database name and the
+table name always to lower case if "set_lower_case" is set to TRUE. */
+void
+normalize_table_name_low(
+/*=====================*/
+ char* norm_name, /*!< out: normalized name as a
+ null-terminated string */
+ const char* name, /*!< in: table name string */
+ ibool set_lower_case); /*!< in: TRUE if we want to set
+ name to lower case */
+
#endif
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 6e130b1c936..116d3115c97 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -64,10 +64,10 @@ component, i.e. we show M.N.P as M.N */
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 37.6
+#define PERCONA_INNODB_VERSION 37.7
#endif
-#define INNODB_VERSION_STR "5.5.46-MariaDB-" IB_TO_STR(PERCONA_INNODB_VERSION)
+#define INNODB_VERSION_STR "5.5.47-MariaDB-" IB_TO_STR(PERCONA_INNODB_VERSION)
#define REFMAN "http://dev.mysql.com/doc/refman/" \
IB_TO_STR(MYSQL_MAJOR_VERSION) "." \
diff --git a/storage/xtradb/log/log0recv.c b/storage/xtradb/log/log0recv.c
index e465f9a60bc..b0b481b0094 100644
--- a/storage/xtradb/log/log0recv.c
+++ b/storage/xtradb/log/log0recv.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
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
@@ -766,6 +766,10 @@ not_consistent:
fprintf(stderr,
"InnoDB: No valid checkpoint found.\n"
+ "InnoDB: If you are attempting downgrade"
+ " from MySQL 5.7.9 or later,\n"
+ "InnoDB: please refer to " REFMAN
+ "upgrading-downgrading.html\n"
"InnoDB: If this error appears when you are"
" creating an InnoDB database,\n"
"InnoDB: the problem may be that during"
diff --git a/storage/xtradb/row/row0mysql.c b/storage/xtradb/row/row0mysql.c
index 9496df8774a..e6ccf44b884 100644
--- a/storage/xtradb/row/row0mysql.c
+++ b/storage/xtradb/row/row0mysql.c
@@ -3978,6 +3978,7 @@ row_rename_table_for_mysql(
ibool old_is_tmp, new_is_tmp;
pars_info_t* info = NULL;
int retry;
+ char* is_part = NULL;
ut_a(old_name != NULL);
ut_a(new_name != NULL);
@@ -4012,6 +4013,54 @@ row_rename_table_for_mysql(
table = dict_table_get_low(old_name, DICT_ERR_IGNORE_NONE);
+ /* We look for pattern #P# to see if the table is partitioned
+ MySQL table. */
+#ifdef __WIN__
+ is_part = strstr(old_name, "#p#");
+#else
+ is_part = strstr(old_name, "#P#");
+#endif /* __WIN__ */
+
+ /* MySQL partition engine hard codes the file name
+ separator as "#P#". The text case is fixed even if
+ lower_case_table_names is set to 1 or 2. This is true
+ for sub-partition names as well. InnoDB always
+ normalises file names to lower case on Windows, this
+ can potentially cause problems when copying/moving
+ tables between platforms.
+
+ 1) If boot against an installation from Windows
+ platform, then its partition table name could
+ be all be in lower case in system tables. So we
+ will need to check lower case name when load table.
+
+ 2) If we boot an installation from other case
+ sensitive platform in Windows, we might need to
+ check the existence of table name without lowering
+ case them in the system table. */
+ if (!table &&
+ is_part &&
+ innobase_get_lower_case_table_names() == 1) {
+ char par_case_name[MAX_FULL_NAME_LEN + 1];
+#ifndef __WIN__
+ /* Check for the table using lower
+ case name, including the partition
+ separator "P" */
+ memcpy(par_case_name, old_name,
+ strlen(old_name));
+ par_case_name[strlen(old_name)] = 0;
+ innobase_casedn_str(par_case_name);
+#else
+ /* On Windows platfrom, check
+ whether there exists table name in
+ system table whose name is
+ not being normalized to lower case */
+ normalize_table_name_low(
+ par_case_name, old_name, FALSE);
+#endif
+ table = dict_table_get_low(par_case_name, DICT_ERR_IGNORE_NONE);
+ }
+
if (!table) {
err = DB_TABLE_NOT_FOUND;
ut_print_timestamp(stderr);