Skip to content
Permalink
Browse files

Merge 10.2 into 10.3

  • Loading branch information...
dr-m committed Sep 4, 2019
2 parents 647d5b2 + f605ce0 commit 537f8594a60a1e09d6da0933b55764e0f8abbf5c
@@ -3357,18 +3357,26 @@ a b
drop table t1;
set sql_mode=default;
create table t1 (a int default b, b int default 4, t text);
insert into t1 (b, t) values (5, '1 column is omitted');
insert into t1 values (default, 5, '2 column gets DEFAULT, keyword');
insert into t1 values (default(a), 5, '3 column gets DEFAULT(a), expression');
insert into t1 values (default(a)+0, 5, '4 also expression DEFAULT(0)+0');
insert into t1 values (b, 5, '5 the value of the DEFAULT(a), that is b');
insert t1 (b, t) values (5, '1 column is omitted');
insert t1 values (default, 5, '2 column gets DEFAULT, keyword');
insert t1 values (default(a), 5, '3 column gets DEFAULT(a), expression');
insert t1 values (default(a)+0, 5, '4 also expression DEFAULT(0)+0');
insert t1 values (b, 5, '5 the value of the DEFAULT(a), that is b');
insert t1 (t,b,a) values ('6 reversed, column gets DEFAULT, keyword', 5, default);
insert t1 (t,b,a) values ('7 reversed, column gets DEFAULT(a), expression', 5, default(a));
insert t1 (t,b,a) values ('8 reversed, also expression DEFAULT(0)+0', 5, default(a)+0);
insert t1 (t,b,a) values ('9 reversed, the value of the DEFAULT(a), that is b', 5, b);
select * from t1 order by t;
a b t
5 5 1 column is omitted
5 5 2 column gets DEFAULT, keyword
4 5 2 column gets DEFAULT, keyword
4 5 3 column gets DEFAULT(a), expression
4 5 4 also expression DEFAULT(0)+0
4 5 5 the value of the DEFAULT(a), that is b
5 5 6 reversed, column gets DEFAULT, keyword
5 5 7 reversed, column gets DEFAULT(a), expression
5 5 8 reversed, also expression DEFAULT(0)+0
5 5 9 reversed, the value of the DEFAULT(a), that is b
drop table t1;
create table t1 (col1 int default(-(default(col1))));
ERROR 01000: Expression for field `col1` is referring to uninitialized field `col1`
@@ -2073,11 +2073,16 @@ set sql_mode=default;
# MDEV-10201 Bad results for CREATE TABLE t1 (a INT DEFAULT b, b INT DEFAULT 4)
#
create table t1 (a int default b, b int default 4, t text);
insert into t1 (b, t) values (5, '1 column is omitted');
insert into t1 values (default, 5, '2 column gets DEFAULT, keyword');
insert into t1 values (default(a), 5, '3 column gets DEFAULT(a), expression');
insert into t1 values (default(a)+0, 5, '4 also expression DEFAULT(0)+0');
insert into t1 values (b, 5, '5 the value of the DEFAULT(a), that is b');
insert t1 (b, t) values (5, '1 column is omitted');
insert t1 values (default, 5, '2 column gets DEFAULT, keyword');
insert t1 values (default(a), 5, '3 column gets DEFAULT(a), expression');
insert t1 values (default(a)+0, 5, '4 also expression DEFAULT(0)+0');
insert t1 values (b, 5, '5 the value of the DEFAULT(a), that is b');
# and the same in a different order
insert t1 (t,b,a) values ('6 reversed, column gets DEFAULT, keyword', 5, default);
insert t1 (t,b,a) values ('7 reversed, column gets DEFAULT(a), expression', 5, default(a));
insert t1 (t,b,a) values ('8 reversed, also expression DEFAULT(0)+0', 5, default(a)+0);
insert t1 (t,b,a) values ('9 reversed, the value of the DEFAULT(a), that is b', 5, b);
select * from t1 order by t;
drop table t1;

@@ -3093,3 +3093,55 @@ a b
1999-12-01 11:22:33.000000 1999-12-01 11:22:33.000000
2001-09-09 04:46:40.000000 2001-09-09 04:46:40.000000
DROP TABLE t1;
create table t1 (t timestamp, i int, v timestamp as (t) virtual, key(v));
insert t1 (t,i) values ('2006-03-01 23:59:59',1);
update t1 set i = 2;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
create table t1 (t timestamp, i int);
create trigger tr1 before update on t1 for each row set @new:=new.t;
insert t1 (t,i) values ('2006-03-01 23:59:59', 1);
update t1 set i = 2;
select if(@new = t, 'correct', 'wrong') from t1;
if(@new = t, 'correct', 'wrong')
correct
drop table t1;
create table t1 (i int, j int as (i));
create trigger tr1 before update on t1 for each row set @new:=new.j;
insert t1 (i) values (1);
update t1, t1 as t2 set t1.i = 2;
select if(@new = j, 'correct', 'wrong') from t1;
if(@new = j, 'correct', 'wrong')
correct
drop table t1;
create table t1 (a int, b varchar(20) default 'foo');
insert t1 values (1,'bla'),(2, 'bar');
select * from t1;
a b
1 bla
2 bar
update t1 set b=default where a=1;
select * from t1;
a b
1 foo
2 bar
drop table t1;
create table t1 (
a int,
b timestamp default '2010-10-10 10:10:10' on update now(),
c varchar(100) default 'x');
insert t1 (a) values (1),(2);
select * from t1;
a b c
1 2010-10-10 10:10:10 x
2 2010-10-10 10:10:10 x
set timestamp=unix_timestamp('2011-11-11 11-11-11');
update t1 set b=default, c=default(b) where a=1;
select * from t1;
a b c
1 2010-10-10 10:10:10 2010-10-10 10:10:10
2 2010-10-10 10:10:10 x
drop table t1;
set timestamp=default;
@@ -19,3 +19,51 @@ let $now=NOW(6);
let $timestamp=TIMESTAMP(6);
let $datetime=DATETIME(6);
source 'include/function_defaults.inc';

#
# MDEV-20403 Assertion `0' or Assertion `btr_validate_index(index, 0)' failed in row_upd_sec_index_entry or error code 126: Index is corrupted upon UPDATE with TIMESTAMP..ON UPDATE
#

# ON UPDATE NOW and indexed virtual columns
create table t1 (t timestamp, i int, v timestamp as (t) virtual, key(v));
insert t1 (t,i) values ('2006-03-01 23:59:59',1);
update t1 set i = 2;
check table t1;
drop table t1;

# ON UPDATE NOW and triggers
create table t1 (t timestamp, i int);
create trigger tr1 before update on t1 for each row set @new:=new.t;
insert t1 (t,i) values ('2006-03-01 23:59:59', 1);
update t1 set i = 2;
select if(@new = t, 'correct', 'wrong') from t1;
drop table t1;

# triggers, virtual columns, multi-update
create table t1 (i int, j int as (i));
create trigger tr1 before update on t1 for each row set @new:=new.j;
insert t1 (i) values (1);
update t1, t1 as t2 set t1.i = 2;
select if(@new = j, 'correct', 'wrong') from t1;
drop table t1;

# SET xxx=DEFAULT
create table t1 (a int, b varchar(20) default 'foo');
insert t1 values (1,'bla'),(2, 'bar');
select * from t1;
update t1 set b=default where a=1;
select * from t1;
drop table t1;

# ON UPDATE NOW and SET xxx=DEFAULT
create table t1 (
a int,
b timestamp default '2010-10-10 10:10:10' on update now(),
c varchar(100) default 'x');
insert t1 (a) values (1),(2);
select * from t1;
set timestamp=unix_timestamp('2011-11-11 11-11-11');
update t1 set b=default, c=default(b) where a=1;
select * from t1;
drop table t1;
set timestamp=default;
@@ -538,7 +538,7 @@ a b
insert into t2 values(1);
select a,b from t2;
a b
12 1
NULL 1
drop table t1,t2;
create table t1 (a int invisible, b int, c int);
create table t2 (a int, b int, d int);
@@ -33,6 +33,7 @@ galera_var_node_address : MDEV-17151 Galera test failure
galera_var_notify_cmd : MDEV-13549 Galera test failures
galera_var_slave_threads : MDEV-19746 Galera test failures because of wsrep_slave_threads identification
galera_sst_mariabackup_encrypt_with_key : MDEV-19926 Galera SST tests fail
galera_wan : MDEV-17259: Test failure on galera.galera_wan
galera_var_node_address : MDEV-20485 Galera test failure on galera.galera_var_node_address
galera_wan : MDEV-17259 Test failure on galera.galera_wan
partition : MDEV-19958 Galera test failure on galera.partition
query_cache: MDEV-15805 Test failure on galera.query_cache
@@ -1,4 +1,5 @@
FLUSH TABLES;
call mtr.add_suppression("Found 1 prepared XA transactions");
#
# MDEV-13797 InnoDB may hang if shutdown is initiated soon after startup
# while rolling back recovered incomplete transactions
@@ -8,10 +9,12 @@ BEGIN;
COMMIT;
connect con$c,localhost,root,,;
CREATE TABLE t8 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
BEGIN;
XA START 'x';
INSERT INTO t8 (a) SELECT NULL FROM t;
UPDATE t8 SET a=a+100, b=a;
DELETE FROM t8;
XA END 'x';
XA PREPARE 'x';
connect con$c,localhost,root,,;
CREATE TABLE t7 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
BEGIN;
@@ -63,4 +66,7 @@ connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
CREATE TABLE u(a SERIAL) ENGINE=INNODB;
FLUSH TABLES;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
DROP TABLE t,u;
@@ -3,6 +3,7 @@

# Flush any open myisam tables from previous tests
FLUSH TABLES;
call mtr.add_suppression("Found 1 prepared XA transactions");

--echo #
--echo # MDEV-13797 InnoDB may hang if shutdown is initiated soon after startup
@@ -23,6 +24,15 @@ dec $c;
COMMIT;

let $c = $trx;
connect (con$c,localhost,root,,);
eval CREATE TABLE t$c (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
XA START 'x';
eval INSERT INTO t$c (a) SELECT NULL FROM t;
eval UPDATE t$c SET a=a+$size, b=a;
eval DELETE FROM t$c;
XA END 'x';
XA PREPARE 'x';
dec $c;
while ($c)
{
connect (con$c,localhost,root,,);
@@ -53,12 +63,17 @@ FLUSH TABLES;

# Perform a slow shutdown in order to roll back all recovered transactions
# and to avoid locking conflicts with the DROP TABLE below.
XA RECOVER;
--disable_query_log
SET GLOBAL innodb_fast_shutdown=0;
--source include/restart_mysqld.inc

--disable_query_log
let $c = $trx;
disconnect con$c;
XA ROLLBACK 'x';
eval DROP TABLE t$c;
dec $c;
while ($c)
{
disconnect con$c;
@@ -17,5 +17,4 @@ rpl_row_binlog_max_cache_size : MDEV-11092
rpl_row_index_choice : MDEV-11666
rpl_parallel2 : fails after MDEV-16172
rpl_semi_sync_after_sync : fails after MDEV-16172
mdev_17588: MDEV-20137
rpl_slave_grp_exec: MDEV-10514
@@ -1,18 +1,16 @@
include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
include/start_slave.inc
connection master;
create table t1 (a int) engine=innodb;
create table t2 (a int);
create table t3 (a int) engine=innodb;
include/save_master_gtid.inc
connection slave;
include/wait_for_slave_sql_error.inc [errno=1286]
Last_Error = 'Error 'Unknown storage engine 'innodb'' on query. Default database: 'test'. Query: 'create table t1 (a int) engine=innodb''
STOP SLAVE IO_THREAD;
include/wait_for_slave_to_stop.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
include/sync_with_master_gtid.inc
include/wait_for_slave_sql_error_and_skip.inc [errno=1286]
# Asserted this: Status should be 'Slave has read all relay log...'
show tables;
Tables_in_test
t2
@@ -1,23 +1,28 @@
--source include/master-slave.inc
--source include/have_innodb.inc

--connection slave
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
--source include/start_slave.inc

--connection master
create table t1 (a int) engine=innodb;
create table t2 (a int);
create table t3 (a int) engine=innodb;
--source include/save_master_gtid.inc
--save_master_pos

--connection slave
# Using ER_UNKNOWN_STORAGE_ENGINE wont work
let $slave_sql_errno= 1286;
--source include/wait_for_slave_sql_error.inc
--let $status_items= Last_Error
--source include/show_slave_status.inc
STOP SLAVE IO_THREAD;
source include/wait_for_slave_to_stop.inc;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--source include/wait_for_slave_sql_error_and_skip.inc
--sync_with_master

--let $assert_text= Status should be 'Slave has read all relay log...'
--let $assert_cond= "[SHOW SLAVE STATUS, Slave_SQL_Running_State, 1]"
#Like "Slave has read all relay log%"
--source include/rpl_assert.inc

show tables;
show create table t2;
--error ER_NO_SUCH_TABLE
@@ -11422,33 +11422,6 @@ key_map Field::get_possible_keys()
}


/**
Mark the field as having an explicit default value.
@param value if available, the value that the field is being set to
@note
Fields that have an explicit default value should not be updated
automatically via the DEFAULT or ON UPDATE functions. The functions
that deal with data change functionality (INSERT/UPDATE/LOAD),
determine if there is an explicit value for each field before performing
the data change, and call this method to mark the field.
If the 'value' parameter is NULL, then the field is marked unconditionally
as having an explicit value. If 'value' is not NULL, then it can be further
analyzed to check if it really should count as a value.
*/

bool Field::set_explicit_default(Item *value)
{
if (value->type() == Item::DEFAULT_VALUE_ITEM &&
!((Item_default_value*)value)->arg)
return false;
set_has_explicit_value();
return true;
}


bool Field::validate_value_in_record_with_warn(THD *thd, const uchar *record)
{
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);

0 comments on commit 537f859

Please sign in to comment.
You can’t perform that action at this time.