Commit be6307c0 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.1 into 10.2

parents 5c057b3f 871f2a6e
...@@ -1883,6 +1883,16 @@ SELECT COLUMN_JSON(COLUMN_CREATE('test','First line\nSecond line')) AS json; ...@@ -1883,6 +1883,16 @@ SELECT COLUMN_JSON(COLUMN_CREATE('test','First line\nSecond line')) AS json;
json json
{"test":"First line\u000ASecond line"} {"test":"First line\u000ASecond line"}
# #
# MDEV-15230: column_json breaks cyrillic in 10.1.31
#
set names utf8;
create table t1 (b blob);
insert into t1 values (column_create('description',column_create('title','Описание')));
select column_json(b) from t1;
column_json(b)
{"description":{"title":"Описание"}}
drop table t1;
#
# end of 10.0 tests # end of 10.0 tests
# #
# #
......
SET @save_per_table= @@GLOBAL.innodb_file_per_table;
SET GLOBAL innodb_file_per_table= 1;
#
# MDEV-15249 Crash in MVCC read after IMPORT TABLESPACE
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(0);
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connect con1,localhost,root,,;
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
connection default;
SELECT * FROM t1;
ERROR HY000: Table definition has changed, please retry transaction
COMMIT;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection con1;
ALTER TABLE t1 DISCARD TABLESPACE;
ALTER TABLE t1 IMPORT TABLESPACE;
disconnect con1;
connection default;
# FIXME: Block this with ER_TABLE_DEF_CHANGED
SELECT * FROM t1;
a
COMMIT;
SELECT * FROM t1;
a
0
DROP TABLE t1;
SET GLOBAL innodb_file_per_table= @save_per_table;
...@@ -61,4 +61,5 @@ INSERT INTO t1(a) SELECT NULL FROM t1; ...@@ -61,4 +61,5 @@ INSERT INTO t1(a) SELECT NULL FROM t1;
connection default; connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1; SET GLOBAL innodb_flush_log_at_trx_commit=1;
CREATE TABLE u(a SERIAL) ENGINE=INNODB; CREATE TABLE u(a SERIAL) ENGINE=INNODB;
FLUSH TABLES;
DROP TABLE t,u; DROP TABLE t,u;
--source include/have_innodb.inc
SET @save_per_table= @@GLOBAL.innodb_file_per_table;
SET GLOBAL innodb_file_per_table= 1;
let MYSQLD_DATADIR =`SELECT @@datadir`;
--echo #
--echo # MDEV-15249 Crash in MVCC read after IMPORT TABLESPACE
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(0);
FLUSH TABLES t1 WITH READ LOCK;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespace("test", "t1");
EOF
UNLOCK TABLES;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connect (con1,localhost,root,,);
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
connection default;
--error ER_TABLE_DEF_CHANGED
SELECT * FROM t1;
COMMIT;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection con1;
ALTER TABLE t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespace("test", "t1");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
disconnect con1;
connection default;
--echo # FIXME: Block this with ER_TABLE_DEF_CHANGED
SELECT * FROM t1;
COMMIT;
SELECT * FROM t1;
DROP TABLE t1;
SET GLOBAL innodb_file_per_table= @save_per_table;
...@@ -41,6 +41,8 @@ INSERT INTO t1(a) SELECT NULL FROM t1; ...@@ -41,6 +41,8 @@ INSERT INTO t1(a) SELECT NULL FROM t1;
SET GLOBAL innodb_flush_log_at_trx_commit=1; SET GLOBAL innodb_flush_log_at_trx_commit=1;
CREATE TABLE u(a SERIAL) ENGINE=INNODB; CREATE TABLE u(a SERIAL) ENGINE=INNODB;
FLUSH TABLES;
--let $shutdown_timeout=0 --let $shutdown_timeout=0
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--let $shutdown_timeout=60 --let $shutdown_timeout=60
......
...@@ -928,6 +928,15 @@ SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)); ...@@ -928,6 +928,15 @@ SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_JSON(COLUMN_CREATE('test','"\\\t\n\Z')) AS json; SELECT COLUMN_JSON(COLUMN_CREATE('test','"\\\t\n\Z')) AS json;
SELECT COLUMN_JSON(COLUMN_CREATE('test','First line\nSecond line')) AS json; SELECT COLUMN_JSON(COLUMN_CREATE('test','First line\nSecond line')) AS json;
--echo #
--echo # MDEV-15230: column_json breaks cyrillic in 10.1.31
--echo #
set names utf8;
create table t1 (b blob);
insert into t1 values (column_create('description',column_create('title','Описание')));
select column_json(b) from t1;
drop table t1;
--echo # --echo #
--echo # end of 10.0 tests --echo # end of 10.0 tests
--echo # --echo #
......
...@@ -3833,7 +3833,7 @@ my_bool dynstr_append_json_quoted(DYNAMIC_STRING *str, ...@@ -3833,7 +3833,7 @@ my_bool dynstr_append_json_quoted(DYNAMIC_STRING *str,
for (i= 0; i < len; i++) for (i= 0; i < len; i++)
{ {
register char c= append[i]; register char c= append[i];
if (unlikely(c <= 0x1F)) if (unlikely(((uchar)c) <= 0x1F))
{ {
if (lim < 5) if (lim < 5)
{ {
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -126,8 +127,7 @@ row_upd_rec_sys_fields( ...@@ -126,8 +127,7 @@ row_upd_rec_sys_fields(
dict_index_t* index, /*!< in: clustered index */ dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const trx_t* trx, /*!< in: transaction */ const trx_t* trx, /*!< in: transaction */
roll_ptr_t roll_ptr);/*!< in: roll ptr of the undo log record, roll_ptr_t roll_ptr);/*!< in: DB_ROLL_PTR to the undo log */
can be 0 during IMPORT */
/*********************************************************************//** /*********************************************************************//**
Sets the trx id or roll ptr field of a clustered index entry. */ Sets the trx id or roll ptr field of a clustered index entry. */
void void
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -165,8 +165,7 @@ row_upd_rec_sys_fields( ...@@ -165,8 +165,7 @@ row_upd_rec_sys_fields(
dict_index_t* index, /*!< in: clustered index */ dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const trx_t* trx, /*!< in: transaction */ const trx_t* trx, /*!< in: transaction */
roll_ptr_t roll_ptr)/*!< in: roll ptr of the undo log record, roll_ptr_t roll_ptr)/*!< in: DB_ROLL_PTR to the undo log */
can be 0 during IMPORT */
{ {
ut_ad(dict_index_is_clust(index)); ut_ad(dict_index_is_clust(index));
ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(rec_offs_validate(rec, index, offsets));
......
...@@ -897,13 +897,11 @@ class PageConverter : public AbstractCallback { ...@@ -897,13 +897,11 @@ class PageConverter : public AbstractCallback {
@param index the index being converted @param index the index being converted
@param rec record to update @param rec record to update
@param offsets column offsets for the record @param offsets column offsets for the record
@param deleted true if row is delete marked
@return DB_SUCCESS or error code. */ @return DB_SUCCESS or error code. */
dberr_t adjust_cluster_record( dberr_t adjust_cluster_record(
const dict_index_t* index, const dict_index_t* index,
rec_t* rec, rec_t* rec,
const ulint* offsets, const ulint* offsets) UNIV_NOTHROW;
bool deleted) UNIV_NOTHROW;
/** Find an index with the matching id. /** Find an index with the matching id.
@return row_index_t* instance or 0 */ @return row_index_t* instance or 0 */
...@@ -1675,14 +1673,12 @@ PageConverter::purge(const ulint* offsets) UNIV_NOTHROW ...@@ -1675,14 +1673,12 @@ PageConverter::purge(const ulint* offsets) UNIV_NOTHROW
/** Adjust the BLOB references and sys fields for the current record. /** Adjust the BLOB references and sys fields for the current record.
@param rec record to update @param rec record to update
@param offsets column offsets for the record @param offsets column offsets for the record
@param deleted true if row is delete marked
@return DB_SUCCESS or error code. */ @return DB_SUCCESS or error code. */
dberr_t dberr_t
PageConverter::adjust_cluster_record( PageConverter::adjust_cluster_record(
const dict_index_t* index, const dict_index_t* index,
rec_t* rec, rec_t* rec,
const ulint* offsets, const ulint* offsets) UNIV_NOTHROW
bool deleted) UNIV_NOTHROW
{ {
dberr_t err; dberr_t err;
...@@ -1694,7 +1690,7 @@ PageConverter::adjust_cluster_record( ...@@ -1694,7 +1690,7 @@ PageConverter::adjust_cluster_record(
row_upd_rec_sys_fields( row_upd_rec_sys_fields(
rec, m_page_zip_ptr, m_cluster_index, m_offsets, rec, m_page_zip_ptr, m_cluster_index, m_offsets,
m_trx, 0); m_trx, roll_ptr_t(1) << ROLL_PTR_INSERT_FLAG_POS);
} }
return(err); return(err);
...@@ -1737,8 +1733,7 @@ PageConverter::update_records( ...@@ -1737,8 +1733,7 @@ PageConverter::update_records(
if (clust_index) { if (clust_index) {
dberr_t err = adjust_cluster_record( dberr_t err = adjust_cluster_record(
m_index->m_srv_index, rec, m_offsets, m_index->m_srv_index, rec, m_offsets);
deleted);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
return(err); return(err);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -119,8 +120,7 @@ row_upd_rec_sys_fields( ...@@ -119,8 +120,7 @@ row_upd_rec_sys_fields(
dict_index_t* index, /*!< in: clustered index */ dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const trx_t* trx, /*!< in: transaction */ const trx_t* trx, /*!< in: transaction */
roll_ptr_t roll_ptr);/*!< in: roll ptr of the undo log record, roll_ptr_t roll_ptr);/*!< in: DB_ROLL_PTR to the undo log */
can be 0 during IMPORT */
/*********************************************************************//** /*********************************************************************//**
Sets the trx id or roll ptr field of a clustered index entry. */ Sets the trx id or roll ptr field of a clustered index entry. */
UNIV_INTERN UNIV_INTERN
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -153,8 +154,7 @@ row_upd_rec_sys_fields( ...@@ -153,8 +154,7 @@ row_upd_rec_sys_fields(
dict_index_t* index, /*!< in: clustered index */ dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const trx_t* trx, /*!< in: transaction */ const trx_t* trx, /*!< in: transaction */
roll_ptr_t roll_ptr)/*!< in: roll ptr of the undo log record, roll_ptr_t roll_ptr)/*!< in: DB_ROLL_PTR to the undo log */
can be 0 during IMPORT */
{ {
ut_ad(dict_index_is_clust(index)); ut_ad(dict_index_is_clust(index));
ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(rec_offs_validate(rec, index, offsets));
......
...@@ -1770,7 +1770,7 @@ PageConverter::adjust_cluster_record( ...@@ -1770,7 +1770,7 @@ PageConverter::adjust_cluster_record(
row_upd_rec_sys_fields( row_upd_rec_sys_fields(
rec, m_page_zip_ptr, m_cluster_index, m_offsets, rec, m_page_zip_ptr, m_cluster_index, m_offsets,
m_trx, 0); m_trx, roll_ptr_t(1) << 55);
} }
return(err); return(err);
......
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