summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2019-11-25 17:24:09 +0300
committerAleksey Midenkov <midenok@gmail.com>2019-11-25 17:24:09 +0300
commit0c05a2ed71ebf408e32f7fcdd358d756948d8a5d (patch)
treefabe919df6b001b22391f37c7a32a1e34a6bfd79 /storage
parent7c7f9bef28aa566557da31402142f6dd8298ddd2 (diff)
parentf9ceb0a67ffb20631c936a7e8e8776c000d677ac (diff)
downloadmariadb-git-0c05a2ed71ebf408e32f7fcdd358d756948d8a5d.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'storage')
-rw-r--r--storage/federatedx/ha_federatedx.cc7
-rw-r--r--storage/innobase/dict/dict0mem.cc9
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/handler/handler0alter.cc3
-rw-r--r--storage/innobase/include/data0type.h17
-rw-r--r--storage/innobase/include/data0type.ic12
-rw-r--r--storage/innobase/include/dict0mem.h47
-rw-r--r--storage/innobase/row/row0log.cc4
8 files changed, 76 insertions, 27 deletions
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 7db6fe9d541..261074fa98d 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -806,12 +806,12 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share,
goto error;
if (share->hostname[0] == '\0')
- share->hostname= NULL;
+ share->hostname= strdup_root(mem_root, my_localhost);
}
if (!share->port)
{
- if (!share->hostname || strcmp(share->hostname, my_localhost) == 0)
+ if (0 == strcmp(share->hostname, my_localhost))
share->socket= (char *) MYSQL_UNIX_ADDR;
else
share->port= MYSQL_PORT;
@@ -3396,8 +3396,7 @@ int ha_federatedx::create(const char *name, TABLE *table_arg,
goto error;
/* loopback socket connections hang due to LOCK_open mutex */
- if ((!tmp_share.hostname || !strcmp(tmp_share.hostname,my_localhost)) &&
- !tmp_share.port)
+ if (0 == strcmp(tmp_share.hostname, my_localhost) && !tmp_share.port)
goto error;
/*
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index 9e67f19e8b3..7d3f33d1ae2 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -37,6 +37,7 @@ Created 1/8/1996 Heikki Tuuri
#include "lock0lock.h"
#include "sync0sync.h"
#include "row0row.h"
+#include "sql_string.h"
#include <iostream>
#define DICT_HEAP_SIZE 100 /*!< initial memory heap size when
@@ -115,6 +116,14 @@ operator<<(
return(s << ut_get_name(NULL, table_name.m_name));
}
+bool dict_col_t::same_encoding(uint16_t a, uint16_t b)
+{
+ if (const CHARSET_INFO *acs= get_charset(a, MYF(MY_WME)))
+ if (const CHARSET_INFO *bcs= get_charset(b, MYF(MY_WME)))
+ return Charset(acs).same_encoding(bcs);
+ return false;
+}
+
/**********************************************************************//**
Creates a table memory object.
@return own: table object */
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 1f2b818bc12..2a0e8e0a805 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -7970,6 +7970,7 @@ report_error:
if (!error_result
&& wsrep_on(m_user_thd)
&& wsrep_thd_is_local(m_user_thd)
+ && !wsrep_thd_ignore_table(m_user_thd)
&& !wsrep_consistency_check(m_user_thd)
&& (thd_sql_command(m_user_thd) != SQLCOM_CREATE_TABLE)
&& (thd_sql_command(m_user_thd) != SQLCOM_LOAD ||
@@ -8680,7 +8681,8 @@ func_exit:
#ifdef WITH_WSREP
if (error == DB_SUCCESS
&& wsrep_on(m_user_thd)
- && wsrep_thd_is_local(m_user_thd)) {
+ && wsrep_thd_is_local(m_user_thd)
+ && !wsrep_thd_ignore_table(m_user_thd)) {
DBUG_PRINT("wsrep", ("update row key"));
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index dbeb4ce9e60..5f5454deb93 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -539,8 +539,9 @@ inline bool dict_table_t::instant_column(const dict_table_t& table,
c.def_val = o->def_val;
DBUG_ASSERT(!((c.prtype ^ o->prtype)
& ~(DATA_NOT_NULL | DATA_VERSIONED
+ | CHAR_COLL_MASK << 16
| DATA_LONG_TRUE_VARCHAR)));
- DBUG_ASSERT(c.mtype == o->mtype);
+ DBUG_ASSERT(c.same_type(*o));
DBUG_ASSERT(c.len >= o->len);
if (o->vers_sys_start()) {
diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h
index 7168c104b1c..0e496085113 100644
--- a/storage/innobase/include/data0type.h
+++ b/storage/innobase/include/data0type.h
@@ -334,14 +334,15 @@ dtype_get_mblen(
multi-byte character */
ulint* mbmaxlen); /*!< out: maximum length of a
multi-byte character */
-/*********************************************************************//**
-Gets the MySQL charset-collation code for MySQL string types.
-@return MySQL charset-collation code */
-UNIV_INLINE
-ulint
-dtype_get_charset_coll(
-/*===================*/
- ulint prtype);/*!< in: precise data type */
+/**
+Get the charset-collation code for string types.
+@param prtype InnoDB precise type
+@return charset-collation code */
+inline uint16_t dtype_get_charset_coll(ulint prtype)
+{
+ return static_cast<uint16_t>(prtype >> 16) & CHAR_COLL_MASK;
+}
+
/** Form a precise type from the < 4.1.2 format precise type plus the
charset-collation code.
@param[in] old_prtype MySQL type code and the flags
diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic
index f2c499716ce..037a71a9345 100644
--- a/storage/innobase/include/data0type.ic
+++ b/storage/innobase/include/data0type.ic
@@ -28,18 +28,6 @@ Created 1/16/1996 Heikki Tuuri
#include "ha_prototypes.h"
/*********************************************************************//**
-Gets the MySQL charset-collation code for MySQL string types.
-@return MySQL charset-collation code */
-UNIV_INLINE
-ulint
-dtype_get_charset_coll(
-/*===================*/
- ulint prtype) /*!< in: precise data type */
-{
- return((prtype >> 16) & CHAR_COLL_MASK);
-}
-
-/*********************************************************************//**
Determines if a MySQL string type is a subset of UTF-8. This function
may return false negatives, in case further character-set collation
codes are introduced in MySQL later.
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index e2a42519d99..1f419061b8a 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -674,18 +674,63 @@ public:
def_val.data = NULL;
}
+ /** @return whether two columns have compatible data type encoding */
+ bool same_type(const dict_col_t &other) const
+ {
+ if (mtype != other.mtype)
+ {
+ /* For latin1_swedish_ci, DATA_CHAR and DATA_VARCHAR
+ will be used instead of DATA_MYSQL and DATA_VARMYSQL.
+ As long as mtype,prtype are being written to InnoDB
+ data dictionary tables, we cannot simplify this. */
+ switch (mtype) {
+ default:
+ return false;
+ case DATA_VARCHAR:
+ if (other.mtype != DATA_VARMYSQL)
+ return false;
+ goto check_encoding;
+ case DATA_VARMYSQL:
+ if (other.mtype != DATA_VARCHAR)
+ return false;
+ goto check_encoding;
+ case DATA_CHAR:
+ if (other.mtype != DATA_MYSQL)
+ return false;
+ goto check_encoding;
+ case DATA_MYSQL:
+ if (other.mtype != DATA_CHAR)
+ return false;
+ goto check_encoding;
+ }
+ }
+ else if (dtype_is_string_type(mtype))
+ {
+ check_encoding:
+ const uint16_t cset= dtype_get_charset_coll(prtype);
+ const uint16_t ocset= dtype_get_charset_coll(other.prtype);
+ return cset == ocset || dict_col_t::same_encoding(cset, ocset);
+ }
+
+ return true;
+ }
+
+ /** @return whether two collations codes have the same character encoding */
+ static bool same_encoding(uint16_t a, uint16_t b);
+
/** Determine if the columns have the same format
except for is_nullable() and is_versioned().
@param[in] other column to compare to
@return whether the columns have the same format */
bool same_format(const dict_col_t& other) const
{
- return mtype == other.mtype
+ return same_type(other)
&& len >= other.len
&& mbminlen == other.mbminlen
&& mbmaxlen == other.mbmaxlen
&& !((prtype ^ other.prtype)
& ~(DATA_NOT_NULL | DATA_VERSIONED
+ | CHAR_COLL_MASK << 16
| DATA_LONG_TRUE_VARCHAR));
}
};
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index caffeab6af0..5b55409a13a 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -1166,6 +1166,10 @@ row_log_table_get_pk_col(
field = rec_get_nth_field(rec, offsets, i, &len);
+ if (len == UNIV_SQL_DEFAULT) {
+ field = log->instant_field_value(i, &len);
+ }
+
if (len == UNIV_SQL_NULL) {
if (!log->allow_not_null) {
return(DB_INVALID_NULL);