Commit da99e086 authored by Alexander Barkov's avatar Alexander Barkov

Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext

parents 5559905d 7a106d19
......@@ -74,12 +74,15 @@ fi
# Convert gcc version to numberical value. Format is Mmmpp where M is Major
# version, mm is minor version and p is patch.
GCCVERSION=$(gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$/&00/')
# -dumpfullversion & -dumpversion to make it uniform across old and new (>=7)
GCCVERSION=$(gcc -dumpfullversion -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' \
-e 's/\.\([0-9]\)/0\1/g' \
-e 's/^[0-9]\{3,4\}$/&00/')
# Don't build rocksdb package if gcc version is less than 4.8 or we are running on
# x86 32 bit.
if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]]
then
sed '/Package: mariadb-plugin-rocksdb/,+9d' -i debian/control
sed '/Package: mariadb-plugin-rocksdb/,+10d' -i debian/control
fi
if [[ $GCCVERSION -lt 40800 ]]
then
......
......@@ -455,6 +455,7 @@ Architecture: any
Depends: mariadb-server-10.2 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Recommends: python-mysqldb
Description: RocksDB storage engine for MariaDB
The RocksDB storage engine is a high performance storage engine, aimed
at maximising storage efficiency while maintaining InnoDB-like performance.
......
etc/mysql/conf.d/rocksdb.cnf etc/mysql/mariadb.conf.d
usr/lib/mysql/plugin/ha_rocksdb.so
usr/bin/mysql_ldb
usr/bin/myrocks_hotbackup
usr/bin/sst_dump
......@@ -2276,5 +2276,38 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
# MDEV-13508 Check that rename of columns changes defaults, virtual
# columns and constraints
#
create table t1 (a int, b int, check(a>b));
alter table t1 change column a b int, change column b a int;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
`a` int(11) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (`b` > `a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int primary key, b int, c int default (a+b) check (a+b>0),
d int as (a+b),
key (b),
constraint test check (a+b > 1));
alter table t1 change b new_b int not null, add column b char(1), add constraint new check (length(b) > 0);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`new_b` int(11) NOT NULL,
`c` int(11) DEFAULT (`a` + `new_b`) CHECK (`a` + `new_b` > 0),
`d` int(11) GENERATED ALWAYS AS (`a` + `new_b`) VIRTUAL,
`b` char(1) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`new_b`),
CONSTRAINT `test` CHECK (`a` + `new_b` > 1),
CONSTRAINT `new` CHECK (octet_length(`b`) > 0)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
# End of 10.2 tests
#
......@@ -2308,3 +2308,47 @@ col_int_nokey
1
DROP TABLE t1,t2,t3;
SET TIMESTAMP=0;
#
# MDEV-15262 Wrong results for SELECT..WHERE non_indexed_datetime_column=indexed_time_column
#
SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-31 10:14:35');
CREATE TABLE t1 (col_time_key TIME, KEY(col_time_key));
CREATE TABLE t2 (col_datetime_key DATETIME);
INSERT INTO t1 VALUES ('-760:00:00'),('760:00:00');
INSERT INTO t1 VALUES ('-770:00:00'),('770:00:00');
INSERT INTO t2 SELECT * FROM t1;
SELECT * FROM t2 STRAIGHT_JOIN t1 IGNORE INDEX(col_time_key) WHERE col_time_key = col_datetime_key;
col_datetime_key col_time_key
2011-12-30 08:00:00 -760:00:00
2012-03-02 16:00:00 760:00:00
2011-12-29 22:00:00 -770:00:00
2012-03-03 02:00:00 770:00:00
SELECT * FROM t2 STRAIGHT_JOIN t1 FORCE INDEX (col_time_key) WHERE col_time_key = col_datetime_key;
col_datetime_key col_time_key
2011-12-29 22:00:00 -770:00:00
2011-12-30 08:00:00 -760:00:00
2012-03-02 16:00:00 760:00:00
2012-03-03 02:00:00 770:00:00
INSERT INTO t1 VALUES ('-838:59:59'),('838:59:59');
INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '-838:59:59' HOUR_SECOND));
INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '838:59:59' HOUR_SECOND));
INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '-839:00:00' HOUR_SECOND));
INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '839:00:00' HOUR_SECOND));
SELECT * FROM t2 STRAIGHT_JOIN t1 IGNORE INDEX(col_time_key) WHERE col_time_key = col_datetime_key;
col_datetime_key col_time_key
2011-12-30 08:00:00 -760:00:00
2012-03-02 16:00:00 760:00:00
2011-12-29 22:00:00 -770:00:00
2012-03-03 02:00:00 770:00:00
2011-12-27 01:00:01 -838:59:59
2012-03-05 22:59:59 838:59:59
SELECT * FROM t2 STRAIGHT_JOIN t1 FORCE INDEX (col_time_key) WHERE col_time_key = col_datetime_key;
col_datetime_key col_time_key
2011-12-29 22:00:00 -770:00:00
2011-12-30 08:00:00 -760:00:00
2012-03-02 16:00:00 760:00:00
2012-03-03 02:00:00 770:00:00
2011-12-27 01:00:01 -838:59:59
2012-03-05 22:59:59 838:59:59
DROP TABLE t1, t2;
SET TIMESTAMP=DEFAULT;
......@@ -26,14 +26,7 @@ foobar 2
# Restart server with keysbad3.txt
SELECT * FROM t1;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table test/t1 in tablespace is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 192 Table t1 in file ./test/t1.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DROP TABLE t1;
SHOW WARNINGS;
Level Code Message
# Start server with keys3.txt
SET GLOBAL innodb_default_encryption_key_id=5;
CREATE TABLE t2 (c VARCHAR(8), id int not null primary key, b int, key(b)) ENGINE=InnoDB ENCRYPTED=YES;
......@@ -42,73 +35,32 @@ INSERT INTO t2 VALUES ('foobar',1,2);
# Restart server with keys2.txt
SELECT * FROM t2;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table test/t2 in tablespace is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 192 Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SELECT * FROM t2 where id = 1;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SELECT * FROM t2 where b = 1;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
INSERT INTO t2 VALUES ('tmp',3,3);
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DELETE FROM t2 where b = 3;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DELETE FROM t2 where id = 3;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
UPDATE t2 set b = b +1;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
OPTIMIZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 optimize Warning Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
test.t2 optimize Error Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
test.t2 optimize error Corrupt
SHOW WARNINGS;
Level Code Message
ALTER TABLE t2 ADD COLUMN d INT;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze Warning Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
test.t2 analyze Error Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
test.t2 analyze error Corrupt
SHOW WARNINGS;
Level Code Message
TRUNCATE TABLE t2;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table t2 in file ./test/t2.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DROP TABLE t2;
# Start server with keys2.txt
select @@encrypt_tmp_files;
@@encrypt_tmp_files
1
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(1),(2);
DELETE FROM t1 WHERE a=1;
......@@ -25,6 +28,7 @@ h 10
i 10
j 10
drop table t1;
reset master;
set global binlog_cache_size=8192;
connect con1, localhost, root;
create table t1 (a text) engine=innodb;
......@@ -34,18 +38,71 @@ commit;
start transaction;
insert t1 select repeat(seq, 1000) from seq_1_to_8;
commit;
drop table t1;
disconnect con1;
connect con2, localhost, root;
create table t1 (a text) engine=innodb;
create table t2 (a text) engine=innodb;
start transaction;
insert t1 select repeat(seq, 1000) from seq_1_to_15;
insert t2 select repeat(seq, 1000) from seq_1_to_15;
savepoint foo;
insert t1 select repeat(seq, 1000) from seq_16_to_30;
insert t2 select repeat(seq, 1000) from seq_16_to_30;
rollback to savepoint foo;
insert t1 select repeat(seq, 1000) from seq_31_to_40;
insert t2 select repeat(seq, 1000) from seq_31_to_40;
commit;
drop table t1;
disconnect con2;
connection default;
flush binary logs;
drop table t1, t2;
set global binlog_cache_size=default;
select left(a, 10) from t1;
left(a, 10)
1111111111
2222222222
3333333333
4444444444
5555555555
6666666666
7777777777
8888888888
9999999999
1010101010
1111111111
1212121212
1313131313
1414141414
1515151515
1111111111
2222222222
3333333333
4444444444
5555555555
6666666666
7777777777
8888888888
select left(a, 10) from t2;
left(a, 10)
1111111111
2222222222
3333333333
4444444444
5555555555
6666666666
7777777777
8888888888
9999999999
1010101010
1111111111
1212121212
1313131313
1414141414
1515151515
3131313131
3232323232
3333333333
3434343434
3535353535
3636363636
3737373737
3838383838
3939393939
4040404040
drop table t1, t2;
......@@ -36,17 +36,18 @@ SELECT * FROM t1;
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt
-- source include/restart_mysqld.inc
--disable_warnings
--error ER_GET_ERRMSG
SELECT * FROM t1;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
--enable_warnings
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt
-- source include/restart_mysqld.inc
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
--disable_warnings
--replace_regex /tablespace [0-9]*/tablespace /
DROP TABLE t1;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
--enable_warnings
#
# MDEV-8591: Database page corruption on disk or a failed space, Assertion failure in file buf0buf.cc
......@@ -66,50 +67,41 @@ INSERT INTO t2 VALUES ('foobar',1,2);
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
-- source include/restart_mysqld.inc
--disable_warnings
--error ER_GET_ERRMSG
SELECT * FROM t2;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
--error ER_GET_ERRMSG
SELECT * FROM t2 where id = 1;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
--error ER_GET_ERRMSG
SELECT * FROM t2 where b = 1;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
--replace_regex /tablespace [0-9]*/tablespace /
--error ER_GET_ERRMSG
INSERT INTO t2 VALUES ('tmp',3,3);
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
--error ER_GET_ERRMSG
DELETE FROM t2 where b = 3;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
--error ER_GET_ERRMSG
DELETE FROM t2 where id = 3;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
--error ER_GET_ERRMSG
UPDATE t2 set b = b +1;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
OPTIMIZE TABLE t2;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
--error ER_GET_ERRMSG
ALTER TABLE t2 ADD COLUMN d INT;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
ANALYZE TABLE t2;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
--error ER_GET_ERRMSG
TRUNCATE TABLE t2;
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
SHOW WARNINGS;
DROP TABLE t2;
--enable_warnings
--echo
--echo # Start server with keys2.txt
......
[none]
binlog-checksum=NONE
[crc32]
binlog-checksum=CRC32
......@@ -9,6 +9,8 @@ source include/have_binlog_format_row.inc;
source include/have_innodb.inc;
select @@encrypt_tmp_files;
#
# MyISAM messing around with IO_CACHE::file
#
......@@ -29,6 +31,7 @@ update t1 set c=v, t=v;
select sql_big_result t,count(t) from t1 group by t limit 10;
drop table t1;
reset master;
set global binlog_cache_size=8192;
connect con1, localhost, root;
......@@ -46,7 +49,6 @@ commit;
start transaction;
insert t1 select repeat(seq, 1000) from seq_1_to_8;
commit;
drop table t1;
disconnect con1;
connect con2, localhost, root;
......@@ -56,17 +58,27 @@ connect con2, localhost, root;
# Start a transaction, write until the cache goes to disk,
# create a savepoint, write more blocks to disk, rollback to savepoint.
#
create table t1 (a text) engine=innodb;
create table t2 (a text) engine=innodb;
start transaction;
insert t1 select repeat(seq, 1000) from seq_1_to_15;
insert t2 select repeat(seq, 1000) from seq_1_to_15;
savepoint foo;
insert t1 select repeat(seq, 1000) from seq_16_to_30;
insert t2 select repeat(seq, 1000) from seq_16_to_30;
rollback to savepoint foo;
insert t1 select repeat(seq, 1000) from seq_31_to_40;
insert t2 select repeat(seq, 1000) from seq_31_to_40;
commit;
drop table t1;
disconnect con2;
connection default;
flush binary logs;
drop table t1, t2;
set global binlog_cache_size=default;
let $MYSQLD_DATADIR= `select @@datadir`;
exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL;
select left(a, 10) from t1;
select left(a, 10) from t2;
drop table t1, t2;
......@@ -127,5 +127,198 @@ t1#P#p0.ibd
t1#P#p1.ibd
DROP TABLE t1;
#
# MDEV-14611 ALTER TABLE EXCHANGE PARTITION does not work
# properly when used with DATA DIRECTORY
#
SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB PARTITION BY KEY (myid)
(
PARTITION p0001 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB,
PARTITION p0002 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB,
PARTITION p0003 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB,
PARTITION p0004 DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB
);
CREATE TABLE t2
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir';
ALTER TABLE t1 EXCHANGE PARTITION p0001 WITH TABLE t2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`myid` int(11) NOT NULL,
`myval` varchar(10) DEFAULT NULL,
PRIMARY KEY (`myid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (`myid`)
(PARTITION `p0001` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB,
PARTITION `p0002` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB,
PARTITION `p0003` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB,
PARTITION `p0004` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB)
DROP TABLE t1, t2;
CREATE TABLE t1
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB PARTITION BY RANGE (myid)
(
PARTITION p0001 VALUES LESS THAN (50) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB,
PARTITION p0002 VALUES LESS THAN (150) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB,
PARTITION p0003 VALUES LESS THAN (1050) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB,
PARTITION p0004 VALUES LESS THAN (10050) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB
);
CREATE TABLE t2
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir';
insert into t1 values (1, 'one');
insert into t2 values (2, 'two'), (3, 'threee'), (4, 'four');
select * from t1;
myid myval
1 one
ALTER TABLE t1 EXCHANGE PARTITION p0001 WITH TABLE t2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`myid` int(11) NOT NULL,
`myval` varchar(10) DEFAULT NULL,
PRIMARY KEY (`myid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (`myid`)
(PARTITION `p0001` VALUES LESS THAN (50) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = InnoDB,
PARTITION `p0002` VALUES LESS THAN (150) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB,
PARTITION `p0003` VALUES LESS THAN (1050) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB,
PARTITION `p0004` VALUES LESS THAN (10050) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB)
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`myid` int(11) NOT NULL,
`myval` varchar(10) DEFAULT NULL,
PRIMARY KEY (`myid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/mysql-test-data-dir/'
select * from t1;
myid myval
2 two
3 threee
4 four
select * from t2;
myid myval
1 one
DROP TABLE t1, t2;
CREATE TABLE t1
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB PARTITION BY RANGE (myid)
(
PARTITION p0001 VALUES LESS THAN (50) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB,
PARTITION p0002 VALUES LESS THAN (150) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB,
PARTITION p0003 VALUES LESS THAN (1050) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB,
PARTITION p0004 VALUES LESS THAN (10050) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = INNODB
);
CREATE TABLE t2
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB;
insert into t1 values (1, 'one');
insert into t2 values (2, 'two'), (3, 'threee'), (4, 'four');
select * from t1;
myid myval
1 one
ALTER TABLE t1 EXCHANGE PARTITION p0001 WITH TABLE t2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`myid` int(11) NOT NULL,
`myval` varchar(10) DEFAULT NULL,
PRIMARY KEY (`myid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (`myid`)
(PARTITION `p0001` VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION `p0002` VALUES LESS THAN (150) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB,
PARTITION `p0003` VALUES LESS THAN (1050) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB,
PARTITION `p0004` VALUES LESS THAN (10050) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB)
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`myid` int(11) NOT NULL,
`myval` varchar(10) DEFAULT NULL,
PRIMARY KEY (`myid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/mysql-test-data-dir/'
select * from t1;
myid myval
2 two
3 threee
4 four
select * from t2;
myid myval
1 one
DROP TABLE t1, t2;
CREATE TABLE t1
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB PARTITION BY RANGE (myid)
(
PARTITION p0001 VALUES LESS THAN (50) ENGINE = INNODB,
PARTITION p0002 VALUES LESS THAN (150) ENGINE = INNODB,
PARTITION p0003 VALUES LESS THAN (1050) ENGINE = INNODB,
PARTITION p0004 VALUES LESS THAN (10050) ENGINE = INNODB
);
CREATE TABLE t2
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir';
insert into t1 values (1, 'one');
insert into t2 values (2, 'two'), (3, 'threee'), (4, 'four');
select * from t1;
myid myval
1 one
ALTER TABLE t1 EXCHANGE PARTITION p0001 WITH TABLE t2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`myid` int(11) NOT NULL,
`myval` varchar(10) DEFAULT NULL,
PRIMARY KEY (`myid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (`myid`)
(PARTITION `p0001` VALUES LESS THAN (50) DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-idx-dir' ENGINE = InnoDB,
PARTITION `p0002` VALUES LESS THAN (150) ENGINE = InnoDB,
PARTITION `p0003` VALUES LESS THAN (1050) ENGINE = InnoDB,
PARTITION `p0004` VALUES LESS THAN (10050) ENGINE = InnoDB)
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`myid` int(11) NOT NULL,
`myval` varchar(10) DEFAULT NULL,
PRIMARY KEY (`myid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
select * from t1;
myid myval
2 two
3 threee
4 four
select * from t2;
myid myval
1 one
DROP TABLE t1, t2;
#
# Cleanup
#
......@@ -147,6 +147,147 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # MDEV-14611 ALTER TABLE EXCHANGE PARTITION does not work
--echo # properly when used with DATA DIRECTORY
--echo #
let $data_dir_path= $MYSQLTEST_VARDIR/mysql-test-data-dir;
let $alt_data_dir_path= $MYSQLTEST_VARDIR/mysql-test-idx-dir;
SET GLOBAL innodb_file_per_table = ON;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB PARTITION BY KEY (myid)
(
PARTITION p0001 DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB,
PARTITION p0002 DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB,
PARTITION p0003 DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB,
PARTITION p0004 DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB
);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t2
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB DATA DIRECTORY = '$data_dir_path';
ALTER TABLE t1 EXCHANGE PARTITION p0001 WITH TABLE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t1;
DROP TABLE t1, t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB PARTITION BY RANGE (myid)
(
PARTITION p0001 VALUES LESS THAN (50) DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB,
PARTITION p0002 VALUES LESS THAN (150) DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB,
PARTITION p0003 VALUES LESS THAN (1050) DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB,
PARTITION p0004 VALUES LESS THAN (10050) DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB
);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t2
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB DATA DIRECTORY = '$alt_data_dir_path';
insert into t1 values (1, 'one');
insert into t2 values (2, 'two'), (3, 'threee'), (4, 'four');
select * from t1;
ALTER TABLE t1 EXCHANGE PARTITION p0001 WITH TABLE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t2;
select * from t1;
select * from t2;
DROP TABLE t1, t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB PARTITION BY RANGE (myid)
(
PARTITION p0001 VALUES LESS THAN (50) DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB,
PARTITION p0002 VALUES LESS THAN (150) DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB,
PARTITION p0003 VALUES LESS THAN (1050) DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB,
PARTITION p0004 VALUES LESS THAN (10050) DATA DIRECTORY = '$data_dir_path' ENGINE = INNODB
);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t2
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB;
insert into t1 values (1, 'one');
insert into t2 values (2, 'two'), (3, 'threee'), (4, 'four');
select * from t1;
ALTER TABLE t1 EXCHANGE PARTITION p0001 WITH TABLE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t2;
select * from t1;
select * from t2;
DROP TABLE t1, t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB PARTITION BY RANGE (myid)
(
PARTITION p0001 VALUES LESS THAN (50) ENGINE = INNODB,
PARTITION p0002 VALUES LESS THAN (150) ENGINE = INNODB,
PARTITION p0003 VALUES LESS THAN (1050) ENGINE = INNODB,
PARTITION p0004 VALUES LESS THAN (10050) ENGINE = INNODB
);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t2
(
myid INT(11) NOT NULL,
myval VARCHAR(10),
PRIMARY KEY (myid)
) ENGINE=INNODB DATA DIRECTORY = '$alt_data_dir_path';
insert into t1 values (1, 'one');
insert into t2 values (2, 'two'), (3, 'threee'), (4, 'four');
select * from t1;
ALTER TABLE t1 EXCHANGE PARTITION p0001 WITH TABLE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t2;
select * from t1;
select * from t2;
DROP TABLE t1, t2;
--echo #
--echo # Cleanup
--echo #
......@@ -160,5 +301,3 @@ EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
--enable_query_log
......@@ -1236,7 +1236,7 @@
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.37
+GLOBAL_VALUE 5.6.36-83.0
+GLOBAL_VALUE 5.6.38-83.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
......
......@@ -676,7 +676,7 @@
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.37
+GLOBAL_VALUE 5.6.36-83.0
+GLOBAL_VALUE 5.6.38-83.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
......
......@@ -1882,6 +1882,24 @@ alter table t1 drop column a, drop index a;
show create table t1;
drop table t1;
--echo #
--echo # MDEV-13508 Check that rename of columns changes defaults, virtual
--echo # columns and constraints
--echo #
create table t1 (a int, b int, check(a>b));
alter table t1 change column a b int, change column b a int;
show create table t1;
drop table t1;
create table t1 (a int primary key, b int, c int default (a+b) check (a+b>0),
d int as (a+b),
key (b),
constraint test check (a+b > 1));
alter table t1 change b new_b int not null, add column b char(1), add constraint new check (length(b) > 0);
show create table t1;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -172,6 +172,29 @@ eval $query;
DROP TABLE t1,t2,t3;
SET TIMESTAMP=0; # back to current time
--echo #
--echo # MDEV-15262 Wrong results for SELECT..WHERE non_indexed_datetime_column=indexed_time_column
--echo #
SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-31 10:14:35');
CREATE TABLE t1 (col_time_key TIME, KEY(col_time_key));
CREATE TABLE t2 (col_datetime_key DATETIME);
INSERT INTO t1 VALUES ('-760:00:00'),('760:00:00');
INSERT INTO t1 VALUES ('-770:00:00'),('770:00:00');
INSERT INTO t2 SELECT * FROM t1;
SELECT * FROM t2 STRAIGHT_JOIN t1 IGNORE INDEX(col_time_key) WHERE col_time_key = col_datetime_key;
SELECT * FROM t2 STRAIGHT_JOIN t1 FORCE INDEX (col_time_key) WHERE col_time_key = col_datetime_key;
INSERT INTO t1 VALUES ('-838:59:59'),('838:59:59');
INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '-838:59:59' HOUR_SECOND));
INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '838:59:59' HOUR_SECOND));
INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '-839:00:00' HOUR_SECOND));
INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '839:00:00' HOUR_SECOND));
SELECT * FROM t2 STRAIGHT_JOIN t1 IGNORE INDEX(col_time_key) WHERE col_time_key = col_datetime_key;
SELECT * FROM t2 STRAIGHT_JOIN t1 FORCE INDEX (col_time_key) WHERE col_time_key = col_datetime_key;
DROP TABLE t1, t2;
SET TIMESTAMP=DEFAULT;
#
# End of 10.0 tests
#
This diff is collapsed.
......@@ -512,7 +512,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
info->read_end= info->buffer;
_my_b_encr_read(info, 0, 0); /* prefill the buffer */
info->write_pos= info->read_pos;
info->pos_in_file+= info->buffer_length;
info->seek_not_done=1;
}
}
else
......
......@@ -5772,6 +5772,13 @@ static void calc_datetime_days_diff(MYSQL_TIME *ltime, long days)
ltime->second) * 1000000LL +
ltime->second_part);
unpack_time(timediff, ltime);
/*
unpack_time() broke down hours into ltime members hour,day,month.
Mix them back to ltime->hour using the same factors
that pack_time()/unpack_time() use (i.e. 32 for month).
*/
ltime->hour+= (ltime->month * 32 + ltime->day) * 24;
ltime->month= ltime->day= 0;
}
ltime->time_type= MYSQL_TIMESTAMP_TIME;
}
......
......@@ -881,6 +881,34 @@ bool Item_field::add_field_to_set_processor(void *arg)
DBUG_RETURN(FALSE);
}
/**
Rename fields in an expression to new field name as speficied by ALTER TABLE
*/
bool Item_field::rename_fields_processor(void *arg)
{
Item::func_processor_rename *rename= (Item::func_processor_rename*) arg;
List_iterator<Create_field> def_it(rename->fields);
Create_field *def;
while ((def=def_it++))
{
if (def->change.str &&
(!db_name || !db_name[0] ||
!my_strcasecmp(table_alias_charset, db_name, rename->db_name.str)) &&
(!table_name || !table_name[0] ||
!my_strcasecmp(table_alias_charset, table_name, rename->table_name.str)) &&
!my_strcasecmp(system_charset_info, field_name.str, def->change.str))
{
field_name= def->field_name;
break;
}
}
return 0;
}
/**
Check if an Item_field references some field from a list of fields.
......
......@@ -1641,6 +1641,7 @@ class Item: public Value_source,
*/
virtual bool check_partition_func_processor(void *arg) { return 1;}
virtual bool vcol_in_partition_func_processor(void *arg) { return 0; }
virtual bool rename_fields_processor(void *arg) { return 0; }
/** Processor used to check acceptability of an item in the defining
expression for a virtual column
......@@ -1654,6 +1655,12 @@ class Item: public Value_source,
uint errors; /* Bits of possible errors */
const char *name; /* Not supported function */
};
struct func_processor_rename
{
LEX_CSTRING db_name;
LEX_CSTRING table_name;
List<Create_field> fields;
};
virtual bool check_vcol_func_processor(void *arg)
{
return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE);
......@@ -2869,6 +2876,7 @@ class Item_field :public Item_ident
bool update_table_bitmaps_processor(void *arg);
bool switch_to_nullable_fields_processor(void *arg);
bool update_vcol_processor(void *arg);
bool rename_fields_processor(void *arg);
bool check_vcol_func_processor(void *arg)
{
context= 0;
......
......@@ -145,9 +145,10 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
if (info->seek_not_done)
{
DBUG_ASSERT(info->pos_in_file == 0);
DBUG_ASSERT(info->pos_in_file % info->buffer_length == 0);
my_off_t wpos= info->pos_in_file / info->buffer_length * crypt_data->block_length;
if ((mysql_file_seek(info->file, 0, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR))
if ((mysql_file_seek(info->file, wpos, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR))
{
info->error= -1;
DBUG_RETURN(1);
......
......@@ -95,7 +95,8 @@ class Alter_info
// Set for ADD [COLUMN] FIRST | AFTER
ALTER_COLUMN_ORDER = 1L << 25,
ALTER_ADD_CHECK_CONSTRAINT = 1L << 27,
ALTER_DROP_CHECK_CONSTRAINT = 1L << 28
ALTER_DROP_CHECK_CONSTRAINT = 1L << 28,
ALTER_RENAME_COLUMN = 1L << 29
};
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
......
......@@ -38,21 +38,21 @@ void free_list(I_List <i_string> *list)
}
base_list::base_list(const base_list &rhs, MEM_ROOT *mem_root)
bool base_list::copy(const base_list *rhs, MEM_ROOT *mem_root)
{
if (rhs.elements)
bool error= 0;
if (rhs->elements)
{
/*
It's okay to allocate an array of nodes at once: we never
call a destructor for list_node objects anyway.
*/
first= (list_node*) alloc_root(mem_root,
sizeof(list_node) * rhs.elements);
if (first)
if ((first= (list_node*) alloc_root(mem_root,
sizeof(list_node) * rhs->elements)))
{
elements= rhs.elements;
elements= rhs->elements;
list_node *dst= first;
list_node *src= rhs.first;
list_node *src= rhs->first;
for (; dst < first + elements - 1; dst++, src= src->next)
{
dst->info= src->info;
......@@ -63,10 +63,12 @@ base_list::base_list(const base_list &rhs, MEM_ROOT *mem_root)
dst->next= &end_of_list;
/* Setup 'last' member */
last= &dst->next;
return;
return 0;
}
error= 1;
}
elements= 0;
first= &end_of_list;
last= &first;
return error;
}
......@@ -202,7 +202,8 @@ class base_list :public Sql_alloc
need to copy elements by value, you should employ
list_copy_and_replace_each_value after creating a copy.
*/
base_list(const base_list &rhs, MEM_ROOT *mem_root);
bool copy(const base_list *rhs, MEM_ROOT *mem_root);
base_list(const base_list &rhs, MEM_ROOT *mem_root) { copy(&rhs, mem_root); }
inline base_list(bool error) { }
inline bool push_back(void *info)
{
......@@ -536,6 +537,8 @@ template <class T> class List :public base_list
inline void disjoin(List<T> *list) { base_list::disjoin(list); }
inline bool add_unique(T *a, bool (*eq)(T *a, T *b))
{ return base_list::add_unique(a, (List_eq *)eq); }
inline bool copy(const List<T> *list, MEM_ROOT *root)
{ return base_list::copy(list, root); }
void delete_elements(void)
{
list_node *element,*next;
......
......@@ -7438,6 +7438,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
List<Virtual_column_info> new_constraint_list;
uint db_create_options= (table->s->db_create_options
& ~(HA_OPTION_PACK_RECORD));
Item::func_processor_rename column_rename_param;
uint used_fields;
KEY *key_info=table->key_info;
bool rc= TRUE;
......@@ -7490,6 +7491,11 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (!(used_fields & HA_CREATE_USED_SEQUENCE))
create_info->sequence= table->s->table_type == TABLE_TYPE_SEQUENCE;
column_rename_param.db_name= table->s->db;
column_rename_param.table_name= table->s->table_name;
if (column_rename_param.fields.copy(&alter_info->create_list, thd->mem_root))
DBUG_RETURN(1); // OOM
restore_record(table, s->default_values); // Empty record for DEFAULT
if ((create_info->fields_option_struct= (ha_field_option_struct**)
......@@ -7534,6 +7540,24 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
bitmap_set_bit(dropped_fields, field->field_index);
continue;
}
/*
If we are doing a rename of a column, update all references in virtual
column expressions, constraints and defaults to use the new column name
*/
if (alter_info->flags & Alter_info::ALTER_RENAME_COLUMN)
{
if (field->vcol_info)
field->vcol_info->expr->walk(&Item::rename_fields_processor, 1,
&column_rename_param);
if (field->check_constraint)
field->check_constraint->expr->walk(&Item::rename_fields_processor, 1,
&column_rename_param);
if (field->default_value)
field->default_value->expr->walk(&Item::rename_fields_processor, 1,
&column_rename_param);
}
/* Check if field is changed */
def_it.rewind();
while ((def=def_it++))
......@@ -7950,7 +7974,10 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
}
if (!drop)
{
check->expr->walk(&Item::rename_fields_processor, 1, &column_rename_param);
new_constraint_list.push_back(check, thd->mem_root);
}
}
}
/* Add new constraints */
......
......@@ -7767,7 +7767,8 @@ alter_list_item:
| CHANGE opt_column opt_if_exists_table_element field_ident
field_spec opt_place
{
Lex->alter_info.flags|= Alter_info::ALTER_CHANGE_COLUMN;
Lex->alter_info.flags|= (Alter_info::ALTER_CHANGE_COLUMN |
Alter_info::ALTER_RENAME_COLUMN);
Lex->create_last_non_select_table= Lex->last_table();
$5->change= $4;
$5->after= $6;
......
......@@ -7627,7 +7627,8 @@ alter_list_item:
| CHANGE opt_column opt_if_exists_table_element field_ident
field_spec opt_place
{
Lex->alter_info.flags|= Alter_info::ALTER_CHANGE_COLUMN;
Lex->alter_info.flags|= (Alter_info::ALTER_CHANGE_COLUMN |
Alter_info::ALTER_RENAME_COLUMN);
Lex->create_last_non_select_table= Lex->last_table();
$5->change= $4;
$5->after= $6;
......
......@@ -4603,6 +4603,8 @@ buf_page_get_gen(
buf_block_unfix(fix_block);
buf_pool_mutex_exit(buf_pool);
rw_lock_x_unlock(&fix_block->lock);
*err = DB_PAGE_CORRUPTED;
return NULL;
}
}
......
......@@ -4715,6 +4715,8 @@ row_rename_table_for_mysql(
DICT_ERR_IGNORE_NONE);
fk_tables.pop_front();
}
table->data_dir_path= NULL;
}
funct_exit:
......
......@@ -208,6 +208,8 @@ TARGET_LINK_LIBRARIES(sst_dump rocksdblib)
MYSQL_ADD_EXECUTABLE(mysql_ldb tools/mysql_ldb.cc COMPONENT rocksdb-engine)
TARGET_LINK_LIBRARIES(mysql_ldb rocksdb_tools rocksdb_aux_lib)
INSTALL_SCRIPT(myrocks_hotbackup COMPONENT rocksdb-engine)
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET_TARGET_PROPERTIES(rocksdb_tools sst_dump mysql_ldb PROPERTIES COMPILE_FLAGS -frtti)
ENDIF()
......
This diff is collapsed.
......@@ -1041,8 +1041,8 @@ static bool ParseUrl ( CSphSEShare * share, TABLE * table, bool bCreate )
bool bOk = true;
bool bQL = false;
char * sScheme = NULL;
char * sHost = SPHINXAPI_DEFAULT_HOST;
char * sIndex = SPHINXAPI_DEFAULT_INDEX;
char * sHost = (char*) SPHINXAPI_DEFAULT_HOST;
char * sIndex = (char*) SPHINXAPI_DEFAULT_INDEX;
int iPort = SPHINXAPI_DEFAULT_PORT;
// parse connection string, if any
......@@ -1068,12 +1068,12 @@ static bool ParseUrl ( CSphSEShare * share, TABLE * table, bool bCreate )
sHost--; // reuse last slash
iPort = 0;
if (!( sIndex = strrchr ( sHost, ':' ) ))
sIndex = SPHINXAPI_DEFAULT_INDEX;
sIndex = (char*) SPHINXAPI_DEFAULT_INDEX;
else
{
*sIndex++ = '\0';
if ( !*sIndex )
sIndex = SPHINXAPI_DEFAULT_INDEX;
sIndex = (char*) SPHINXAPI_DEFAULT_INDEX;
}
bOk = true;
break;
......@@ -1095,11 +1095,11 @@ static bool ParseUrl ( CSphSEShare * share, TABLE * table, bool bCreate )
if ( sIndex )
*sIndex++ = '\0';
else
sIndex = SPHINXAPI_DEFAULT_INDEX;
sIndex = (char*) SPHINXAPI_DEFAULT_INDEX;
iPort = atoi(sPort);
if ( !iPort )
iPort = SPHINXAPI_DEFAULT_PORT;
iPort = SPHINXAPI_DEFAULT_PORT;
}
} else
{
......@@ -1107,7 +1107,7 @@ static bool ParseUrl ( CSphSEShare * share, TABLE * table, bool bCreate )
if ( sIndex )
*sIndex++ = '\0';
else
sIndex = SPHINXAPI_DEFAULT_INDEX;
sIndex = (char*) SPHINXAPI_DEFAULT_INDEX;
}
bOk = true;
break;
......@@ -1303,8 +1303,8 @@ CSphSEQuery::CSphSEQuery ( const char * sQuery, int iLength, const char * sIndex
, m_sGeoLongAttr ( "" )
, m_fGeoLatitude ( 0.0f )
, m_fGeoLongitude ( 0.0f )
, m_sComment ( "" )
, m_sSelect ( "*" )
, m_sComment ( (char*) "" )
, m_sSelect ( (char*) "*" )
, m_pBuf ( NULL )
, m_pCur ( NULL )
......
......@@ -40,6 +40,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include <portability/toku_config.h>
#ifdef HAVE_valgrind
#undef USE_VALGRIND
#define USE_VALGRIND 1
#endif
#if defined(__linux__) && USE_VALGRIND
# include <valgrind/helgrind.h>
......
......@@ -3372,6 +3372,8 @@ buf_page_get_gen(
mutex_enter(&buf_pool->LRU_list_mutex);
buf_block_unfix(fix_block);
mutex_exit(&buf_pool->LRU_list_mutex);
*err = DB_PAGE_CORRUPTED;
return NULL;
}
}
......
......@@ -45,7 +45,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6
#define INNODB_VERSION_BUGFIX 36
#define INNODB_VERSION_BUGFIX 38
#ifndef PERCONA_INNODB_VERSION
#define PERCONA_INNODB_VERSION 83.0
......
......@@ -5372,6 +5372,7 @@ row_rename_table_for_mysql(
trx_rollback_to_savepoint(trx, NULL);
trx->error_state = DB_SUCCESS;
}
table->data_dir_path= NULL;
}
funct_exit:
......
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