Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä 2022-10-12 12:14:13 +03:00
commit a992c615a6
55 changed files with 3153 additions and 358 deletions

View File

@ -1725,7 +1725,7 @@ that may lead to an endless loop.",
&opt_binlog_rows_event_max_encoded_size, 0, &opt_binlog_rows_event_max_encoded_size, 0,
GET_ULONG, REQUIRED_ARG, UINT_MAX/4, 256, ULONG_MAX, 0, 256, 0}, GET_ULONG, REQUIRED_ARG, UINT_MAX/4, 256, ULONG_MAX, 0, 256, 0},
#endif #endif
{"verify-binlog-checksum", 'c', "Verify checksum binlog events.", {"verify-binlog-checksum", 'c', "Verify binlog event checksums.",
(uchar**) &opt_verify_binlog_checksum, (uchar**) &opt_verify_binlog_checksum, (uchar**) &opt_verify_binlog_checksum, (uchar**) &opt_verify_binlog_checksum,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"rewrite-db", OPT_REWRITE_DB, {"rewrite-db", OPT_REWRITE_DB,

View File

@ -255,9 +255,6 @@
#cmakedefine STRUCT_TIMESPEC_HAS_TV_SEC 1 #cmakedefine STRUCT_TIMESPEC_HAS_TV_SEC 1
#cmakedefine STRUCT_TIMESPEC_HAS_TV_NSEC 1 #cmakedefine STRUCT_TIMESPEC_HAS_TV_NSEC 1
#define USE_MB 1
#define USE_MB_IDENT 1
/* this means that valgrind headers and macros are available */ /* this means that valgrind headers and macros are available */
#cmakedefine HAVE_VALGRIND_MEMCHECK_H 1 #cmakedefine HAVE_VALGRIND_MEMCHECK_H 1
@ -453,8 +450,8 @@
#cmakedefine MYSQL_DEFAULT_CHARSET_NAME "@MYSQL_DEFAULT_CHARSET_NAME@" #cmakedefine MYSQL_DEFAULT_CHARSET_NAME "@MYSQL_DEFAULT_CHARSET_NAME@"
#cmakedefine MYSQL_DEFAULT_COLLATION_NAME "@MYSQL_DEFAULT_COLLATION_NAME@" #cmakedefine MYSQL_DEFAULT_COLLATION_NAME "@MYSQL_DEFAULT_COLLATION_NAME@"
#cmakedefine USE_MB 1 #cmakedefine USE_MB
#cmakedefine USE_MB_IDENT 1 #cmakedefine USE_MB_IDENT
/* This should mean case insensitive file system */ /* This should mean case insensitive file system */
#cmakedefine FN_NO_CASE_SENSE 1 #cmakedefine FN_NO_CASE_SENSE 1

View File

@ -567,5 +567,14 @@ SELECT * FROM t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES ERROR HY000: Table 't3' was not locked with LOCK TABLES
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t3; DROP TABLE t3;
#
# MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status
# upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED
#
CREATE TABLE t (a INT) ENGINE=MyISAM;
CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t);
CREATE OR REPLACE TABLE t LIKE tm;
ERROR HY000: Table 'tm' is specified twice, both as a target for 'CREATE' and as a separate source for data
DROP TABLE IF EXISTS tm, t;
# End of 10.4 tests # End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_persistent; SET GLOBAL innodb_stats_persistent=@save_persistent;

View File

@ -508,6 +508,18 @@ SELECT * FROM t3;
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t3; DROP TABLE t3;
--echo #
--echo # MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status
--echo # upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED
--echo #
CREATE TABLE t (a INT) ENGINE=MyISAM;
CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t);
--error ER_UPDATE_TABLE_USED
CREATE OR REPLACE TABLE t LIKE tm;
# Cleanup
DROP TABLE IF EXISTS tm, t;
--echo # End of 10.4 tests --echo # End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_persistent; SET GLOBAL innodb_stats_persistent=@save_persistent;

View File

@ -195,4 +195,29 @@ connection default;
DROP USER 'user2'@'%'; DROP USER 'user2'@'%';
DROP DATABASE temp; DROP DATABASE temp;
set global sql_mode=default; set global sql_mode=default;
End of 5.0 tests #
# End of 5.0 tests
#
create database db1;
create user foo@localhost;
grant create on db1.* to foo@localhost;
connect foo,localhost,foo;
create temporary table t as values (1),(2),(3);
use db1;
create table t1 as select * from test.t;
ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table `db1`.`t1`
create table t1 as values (1),(2),(3);
ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table `db1`.`t1`
create table t1 (a int);
disconnect foo;
connection default;
revoke create on db1.* from foo@localhost;
grant insert on db1.* to foo@localhost;
connect foo,localhost,foo;
use db1;
create table t2 as values (1),(2),(3);
ERROR 42000: CREATE command denied to user 'foo'@'localhost' for table `db1`.`t2`
disconnect foo;
connection default;
drop user foo@localhost;
drop database db1;

View File

@ -207,7 +207,35 @@ DROP USER 'user2'@'%';
DROP DATABASE temp; DROP DATABASE temp;
set global sql_mode=default; set global sql_mode=default;
--echo End of 5.0 tests --echo #
--echo # End of 5.0 tests
--echo #
create database db1;
create user foo@localhost;
grant create on db1.* to foo@localhost;
connect foo,localhost,foo;
create temporary table t as values (1),(2),(3);
use db1;
--error ER_TABLEACCESS_DENIED_ERROR
create table t1 as select * from test.t;
--error ER_TABLEACCESS_DENIED_ERROR
create table t1 as values (1),(2),(3);
create table t1 (a int);
disconnect foo;
connection default;
revoke create on db1.* from foo@localhost;
grant insert on db1.* to foo@localhost;
connect foo,localhost,foo;
use db1;
--error ER_TABLEACCESS_DENIED_ERROR
create table t2 as values (1),(2),(3);
disconnect foo;
connection default;
drop user foo@localhost;
drop database db1;
# Wait till we reached the initial number of concurrent sessions # Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc

File diff suppressed because it is too large Load Diff

View File

@ -53,6 +53,8 @@ BEGIN NOT ATOMIC
SELECT tabledef AS ``; SELECT tabledef AS ``;
EXECUTE IMMEDIATE tabledef; EXECUTE IMMEDIATE tabledef;
SHOW WARNINGS; SHOW WARNINGS;
SELECT * FROM t1;
SHOW WARNINGS;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
END; END;

View File

@ -200,4 +200,93 @@ pk
2 2
delete from t1; delete from t1;
drop table t1; drop table t1;
#
# MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table
#
create table t (a int, b int) partition by list (b) (partition p1 values in (1, 2));
insert into t values (0, 1), (2, 2);
alter table t change b f int, change a b int, algorithm=nocopy;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
delete from t order by b limit 1;
drop table t;
# End of 10.3 tests # End of 10.3 tests
#
# MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table
#
create table t (a int)
partition by list (a)
subpartition by hash(a) subpartitions 2
(partition p0 values in (1));
alter table t rename column a to b, algorithm=nocopy;
show create table t;
Table Create Table
t CREATE TABLE `t` (
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`b`)
SUBPARTITION BY HASH (`b`)
SUBPARTITIONS 2
(PARTITION `p0` VALUES IN (1) ENGINE = MyISAM)
alter table t rename column b to c, algorithm=copy;
show create table t;
Table Create Table
t CREATE TABLE `t` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`c`)
SUBPARTITION BY HASH (`c`)
SUBPARTITIONS 2
(PARTITION `p0` VALUES IN (1) ENGINE = MyISAM)
drop table t;
create table t (d int, e int)
partition by list columns (d, e)
subpartition by key (d, e)
(partition p0 values in ((2, 3)));
alter table t rename column d to f, rename column e to g, algorithm=nocopy;
show create table t;
Table Create Table
t CREATE TABLE `t` (
`f` int(11) DEFAULT NULL,
`g` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST COLUMNS(`f`,`g`)
SUBPARTITION BY KEY (`f`,`g`)
(PARTITION `p0` VALUES IN ((2,3)) ENGINE = MyISAM)
alter table t rename column f to h, rename column g to i, algorithm=copy;
show create table t;
Table Create Table
t CREATE TABLE `t` (
`h` int(11) DEFAULT NULL,
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST COLUMNS(`h`,`i`)
SUBPARTITION BY KEY (`h`,`i`)
(PARTITION `p0` VALUES IN ((2,3)) ENGINE = MyISAM)
drop table t;
create table t (k int, l int)
partition by range (k)
subpartition by hash(l) subpartitions 4
(partition p0 values less than (5));
alter table t rename column k to l, rename column l to k;
show create table t;
Table Create Table
t CREATE TABLE `t` (
`l` int(11) DEFAULT NULL,
`k` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`l`)
SUBPARTITION BY HASH (`k`)
SUBPARTITIONS 4
(PARTITION `p0` VALUES LESS THAN (5) ENGINE = MyISAM)
drop table t;
create table t (a int, b int) partition by list (b) (partition p1 values in (1, 2));
insert into t values (0, 1), (2, 2);
alter table t rename column b to f, rename column a to b, algorithm=nocopy;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
delete from t order by b limit 1;
drop table t;
# End of 10.5 tests

View File

@ -185,4 +185,56 @@ select * from t1 partition(p1);
delete from t1; delete from t1;
drop table t1; drop table t1;
--echo #
--echo # MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table
--echo #
create table t (a int, b int) partition by list (b) (partition p1 values in (1, 2));
insert into t values (0, 1), (2, 2);
alter table t change b f int, change a b int, algorithm=nocopy;
check table t;
delete from t order by b limit 1;
# cleanup
drop table t;
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo #
--echo # MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table
--echo #
create table t (a int)
partition by list (a)
subpartition by hash(a) subpartitions 2
(partition p0 values in (1));
alter table t rename column a to b, algorithm=nocopy;
show create table t;
alter table t rename column b to c, algorithm=copy;
show create table t;
drop table t;
create table t (d int, e int)
partition by list columns (d, e)
subpartition by key (d, e)
(partition p0 values in ((2, 3)));
alter table t rename column d to f, rename column e to g, algorithm=nocopy;
show create table t;
alter table t rename column f to h, rename column g to i, algorithm=copy;
show create table t;
drop table t;
create table t (k int, l int)
partition by range (k)
subpartition by hash(l) subpartitions 4
(partition p0 values less than (5));
alter table t rename column k to l, rename column l to k;
show create table t;
drop table t;
create table t (a int, b int) partition by list (b) (partition p1 values in (1, 2));
insert into t values (0, 1), (2, 2);
alter table t rename column b to f, rename column a to b, algorithm=nocopy;
check table t;
delete from t order by b limit 1;
# cleanup
drop table t;
--echo # End of 10.5 tests

View File

@ -34,8 +34,10 @@ SCHEMA="mtr_wsrep_notify"
MEMB_TABLE="$SCHEMA.membership" MEMB_TABLE="$SCHEMA.membership"
STATUS_TABLE="$SCHEMA.status" STATUS_TABLE="$SCHEMA.status"
BEGIN=" WSREP_ON='SET wsrep_on=ON'
SET wsrep_on=0; WSREP_OFF='SET wsrep_on=OFF'
BEGIN="$WSREP_OFF;
CREATE SCHEMA IF NOT EXISTS $SCHEMA; CREATE SCHEMA IF NOT EXISTS $SCHEMA;
CREATE TABLE IF NOT EXISTS $MEMB_TABLE ( CREATE TABLE IF NOT EXISTS $MEMB_TABLE (
idx INT, idx INT,
@ -50,9 +52,8 @@ CREATE TABLE IF NOT EXISTS $STATUS_TABLE (
uuid CHAR(40), /* cluster UUID */ uuid CHAR(40), /* cluster UUID */
prim BOOLEAN /* if component is primary */ prim BOOLEAN /* if component is primary */
) ENGINE=MEMORY; ) ENGINE=MEMORY;
BEGIN; BEGIN"
" END="COMMIT; $WSREP_ON"
END="COMMIT;"
configuration_change() configuration_change()
{ {
@ -71,7 +72,7 @@ configuration_change()
echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);" echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);"
echo "$END" echo "$END;"
} }
status_update() status_update()
@ -186,13 +187,13 @@ then
fi fi
fi fi
case $STATUS in case "$STATUS" in
"joined" | "donor" | "synced") 'joined' | 'donor' | 'synced')
"$COM" | eval "$CLIENT" -B "-u'$USER'"${PSWD:+" -p'$PSWD'"}\ "$COM" | eval "$CLIENT" -B "-u'$USER'"${PSWD:+" -p'$PSWD'"}\
"-h'$HOST'" "-P$PORT"$SSL_PARAM "-h'$HOST'" "-P$PORT"$SSL_PARAM
;; ;;
*) *)
# The node might be shutting down # The node might be shutting down or not initialized
;; ;;
esac esac

View File

@ -34,8 +34,10 @@ SCHEMA="mtr_wsrep_notify"
MEMB_TABLE="$SCHEMA.membership" MEMB_TABLE="$SCHEMA.membership"
STATUS_TABLE="$SCHEMA.status" STATUS_TABLE="$SCHEMA.status"
BEGIN=" WSREP_ON='SET wsrep_on=ON'
SET wsrep_on=0; WSREP_OFF='SET wsrep_on=OFF'
BEGIN="$WSREP_OFF;
CREATE SCHEMA IF NOT EXISTS $SCHEMA; CREATE SCHEMA IF NOT EXISTS $SCHEMA;
CREATE TABLE IF NOT EXISTS $MEMB_TABLE ( CREATE TABLE IF NOT EXISTS $MEMB_TABLE (
idx INT, idx INT,
@ -50,9 +52,8 @@ CREATE TABLE IF NOT EXISTS $STATUS_TABLE (
uuid CHAR(40), /* cluster UUID */ uuid CHAR(40), /* cluster UUID */
prim BOOLEAN /* if component is primary */ prim BOOLEAN /* if component is primary */
) ENGINE=MEMORY; ) ENGINE=MEMORY;
BEGIN; BEGIN"
" END="COMMIT; $WSREP_ON"
END="COMMIT;"
configuration_change() configuration_change()
{ {
@ -71,12 +72,12 @@ configuration_change()
echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);" echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);"
echo "$END" echo "$END;"
} }
status_update() status_update()
{ {
echo "SET wsrep_on=0; BEGIN; UPDATE $STATUS_TABLE SET status='$STATUS'; COMMIT;" echo "$BEGIN; UPDATE $STATUS_TABLE SET status='$STATUS'; $END;"
} }
trim_string() trim_string()
@ -186,10 +187,14 @@ then
fi fi
fi fi
# Undefined means node is shutting down case "$STATUS" in
if [ "$STATUS" != 'Undefined' ]; then 'joined' | 'donor' | 'synced')
"$COM" | eval "$CLIENT" -B "-u'$USER'"${PSWD:+" -p'$PSWD'"}\ "$COM" | eval "$CLIENT" -B "-u'$USER'"${PSWD:+" -p'$PSWD'"}\
"-h'$HOST'" "-P$PORT"$SSL_PARAM "-h'$HOST'" "-P$PORT"$SSL_PARAM
fi ;;
*)
# The node might be shutting down or not initialized
;;
esac
exit 0 exit 0

View File

@ -23,7 +23,6 @@ galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
galera_pc_recovery : MDEV-25199 cluster fails to start up galera_pc_recovery : MDEV-25199 cluster fails to start up
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim
galera_sst_mysqldump : MDEV-26501 : galera.galera_sst_mysqldump MTR failed: galera SST with mysqldump failed galera_sst_mysqldump : MDEV-26501 : galera.galera_sst_mysqldump MTR failed: galera SST with mysqldump failed
galera_trigger : MDEV-24048 galera.galera_trigger MTR fails: Result content mismatch
galera_unicode_identifiers : MDEV-26500 : galera.galera_unicode_identifiers MTR failed: InnoDB: innodb_fatal_semaphore_wait_threshold was exceeded for dict_sys.mutex galera_unicode_identifiers : MDEV-26500 : galera.galera_unicode_identifiers MTR failed: InnoDB: innodb_fatal_semaphore_wait_threshold was exceeded for dict_sys.mutex
galera_var_dirty_reads : MDEV-25615 Galera test failure on galera_var_dirty_reads galera_var_dirty_reads : MDEV-25615 Galera test failure on galera_var_dirty_reads
galera_var_ignore_apply_errors : MDEV-26770 galera_var_ignore_apply_errors fails Server did not transition to READY state galera_var_ignore_apply_errors : MDEV-26770 galera_var_ignore_apply_errors fails Server did not transition to READY state
@ -38,3 +37,8 @@ query_cache: MDEV-15805 Test failure on galera.query_cache
versioning_trx_id: MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch versioning_trx_id: MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch
galera_bf_abort_at_after_statement : Unstable galera_bf_abort_at_after_statement : Unstable
# Recent trouble
MDEV-26597 : crashes on 10.5
MDEV-27615 : crashes on 10.5 after MDEV-26597 fix
MDEV-29142 : fails on 10.5 with WSREP: Inconsistency detected
galera_bf_abort_shutdown : MDEV-29368 shutdown hang

View File

@ -0,0 +1,19 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_2;
CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 FLOAT(3,2));
SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
SET @@autocommit=0;
INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
CREATE TABLE t1 ( pk int primary key) ENGINE=INNODB;
ERROR HY000: Maximum writeset size exceeded
SHOW WARNINGS;
Level Code Message
Error 1105 Maximum writeset size exceeded
connection node_2;
SET SESSION wsrep_sync_wait = 0;
Killing server ...
connection node_1;
DROP TABLE t3;

View File

@ -0,0 +1,17 @@
connection node_2;
connection node_1;
show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 3
auto_increment_offset 3
create table t4 (c1 int primary key auto_increment) engine=innodb;
show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 3
auto_increment_offset 3
alter table t4 add (c2 varchar(50));
show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 3
auto_increment_offset 3
DROP TABLE t4;

View File

@ -0,0 +1,43 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
call mtr.add_suppression("WSREP: Event .* Write_rows_v1 apply failed:.*");
call mtr.add_suppression("WSREP: Failed to apply write set:.*");
connection node_2;
call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing");
call mtr.add_suppression("WSREP: Failed to open SR table for write");
call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0");
SET @@global.tx_read_only = ON;
SET default_storage_engine = SEQUENCE;
create table t1 (c1 int);
ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by the engine")
CREATE TABLE t1(c1 VARCHAR(20)) engine=innodb;
INSERT INTO t1 VALUES(0xA9B8);
create TABLE t1 (c1 int) engine=innodb;
ERROR 42S01: Table 't1' already exists
create TABLE t1 (c1 int) engine=innodb;
ERROR 42S01: Table 't1' already exists
SET GLOBAL wsrep_on=OFF;
SET GLOBAL wsrep_cluster_address='gcomm://';
INSERT INTO t1 VALUES (1);
SELECT 1;
1
1
SELECT 1;
1
1
COMMIT;
# Killing cluster because we have messed with wsrep_cluster_address
connection node_2;
SET SESSION wsrep_sync_wait = 0;
Killing server ...
connection node_1;
SET SESSION wsrep_sync_wait = 0;
Killing server ...
connection node_2;
call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing");
call mtr.add_suppression("WSREP: Failed to open SR table for write");
call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0");
DROP TABLE IF EXISTS t1;

View File

@ -4,7 +4,7 @@ connection node_1;
CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB; CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB;
SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512'; SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
INSERT INTO t1 VALUES (REPEAT('a', 512)); INSERT INTO t1 VALUES (REPEAT('a', 512));
ERROR HY000: Got error 5 "Input/output error" during COMMIT ERROR HY000: Maximum writeset size exceeded
SELECT COUNT(*) = 0 FROM t1; SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0 COUNT(*) = 0
1 1

View File

@ -4,7 +4,7 @@ connection node_1;
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine=InnoDB; CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine=InnoDB;
SET GLOBAL wsrep_max_ws_size = 1024; SET GLOBAL wsrep_max_ws_size = 1024;
INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024)); INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024));
ERROR HY000: Got error 5 "Input/output error" during COMMIT ERROR HY000: Maximum writeset size exceeded
SELECT COUNT(*) = 0 FROM t1; SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0 COUNT(*) = 0
1 1

View File

@ -1,3 +1,5 @@
connection node_2;
connection node_1;
connection node_1; connection node_1;
SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership; SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership;
EXPECT_2 EXPECT_2

View File

@ -0,0 +1,32 @@
--source include/galera_cluster.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_2
CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 FLOAT(3,2));
SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
SET @@autocommit=0;
INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
--error ER_UNKNOWN_ERROR
CREATE TABLE t1 ( pk int primary key) ENGINE=INNODB;
SHOW WARNINGS;
--connection node_2
SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--let $start_mysqld_params = ""
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
#
# Cleanup
#
--source ../../galera/include/auto_increment_offset_restore.inc
--connection node_1
DROP TABLE t3;

View File

@ -0,0 +1,2 @@
--wsrep_auto_increment_control=OFF --auto_increment_increment=3 --auto_increment_offset=3

View File

@ -0,0 +1,8 @@
--source include/galera_cluster.inc
show variables like 'auto_increment%';
create table t4 (c1 int primary key auto_increment) engine=innodb;
show variables like 'auto_increment%';
alter table t4 add (c2 varchar(50));
show variables like 'auto_increment%';
DROP TABLE t4;

View File

@ -0,0 +1,71 @@
--source include/galera_cluster.inc
--source include/have_sequence.inc
--source include/force_restart.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
call mtr.add_suppression("WSREP: Event .* Write_rows_v1 apply failed:.*");
call mtr.add_suppression("WSREP: Failed to apply write set:.*");
--connection node_2
call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing");
call mtr.add_suppression("WSREP: Failed to open SR table for write");
call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0");
SET @@global.tx_read_only = ON;
--error 0,1286
SET default_storage_engine = SEQUENCE;
--error 1005
create table t1 (c1 int);
CREATE TABLE t1(c1 VARCHAR(20)) engine=innodb;
INSERT INTO t1 VALUES(0xA9B8);
--error 1050
create TABLE t1 (c1 int) engine=innodb;
--error 1050
create TABLE t1 (c1 int) engine=innodb;
--let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address`
SET GLOBAL wsrep_on=OFF;
SET GLOBAL wsrep_cluster_address='gcomm://';
INSERT INTO t1 VALUES (1);
SELECT 1;
SELECT 1;
COMMIT;
#
# Kill the entire cluster and restart
#
--echo # Killing cluster because we have messed with wsrep_cluster_address
--connection node_2
SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--connection node_1
SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
--let $start_mysqld_params = "--wsrep-new-cluster"
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/start_mysqld.inc
--connection node_2
--let $start_mysqld_params = ""
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing");
call mtr.add_suppression("WSREP: Failed to open SR table for write");
call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0");
#
# Cleanup
#
--source ../../galera/include/auto_increment_offset_restore.inc
# We killed cluster, it might mean that table does not exists
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

View File

@ -12,7 +12,7 @@ CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB;
SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512'; SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
--error ER_ERROR_DURING_COMMIT --error ER_UNKNOWN_ERROR
INSERT INTO t1 VALUES (REPEAT('a', 512)); INSERT INTO t1 VALUES (REPEAT('a', 512));
SELECT COUNT(*) = 0 FROM t1; SELECT COUNT(*) = 0 FROM t1;

View File

@ -12,7 +12,7 @@ CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine
--let $wsrep_max_ws_size_orig = `SELECT @@wsrep_max_ws_size` --let $wsrep_max_ws_size_orig = `SELECT @@wsrep_max_ws_size`
SET GLOBAL wsrep_max_ws_size = 1024; SET GLOBAL wsrep_max_ws_size = 1024;
--error ER_ERROR_DURING_COMMIT --error ER_UNKNOWN_ERROR
INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024)); INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024));
SELECT COUNT(*) = 0 FROM t1; SELECT COUNT(*) = 0 FROM t1;

View File

@ -17,6 +17,7 @@ galera_gtid_2_cluster : MDEV-23775 Galera test failure on galera_3nodes.galera_g
galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0,t=1,ut=255,o=4,s=0,sr=0,as=1,f=6,src=50524cfe,srcvid=view_id(REG,50524cfe,4),insvid=view_id(UNKNOWN,00000000,0),ru=00000000,r=[-1,-1],fs=75,nl=(} galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0,t=1,ut=255,o=4,s=0,sr=0,as=1,f=6,src=50524cfe,srcvid=view_id(REG,50524cfe,4),insvid=view_id(UNKNOWN,00000000,0),ru=00000000,r=[-1,-1],fs=75,nl=(}
galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to server during query galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to server during query
galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to server during query galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to server during query
galera_parallel_apply_3nodes : MDEV-29368 DEBUG_SYNC timeout
galera_pc_bootstrap : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed galera_pc_bootstrap : MDEV-24097 MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
galera_safe_to_bootstrap : MDEV-24097 galera_3nodes.galera_safe_to_bootstrap MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed galera_safe_to_bootstrap : MDEV-24097 galera_3nodes.galera_safe_to_bootstrap MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
galera_slave_options_do : MDEV-8798 galera_slave_options_do : MDEV-8798

View File

@ -12,3 +12,6 @@
GCF-1060 : MDEV-26528 wrong usage of mutex LOCK_thd_kill and LOCK_thd_kill GCF-1060 : MDEV-26528 wrong usage of mutex LOCK_thd_kill and LOCK_thd_kill
galera_sr_ws_size2 : MDEV-29773 assertion failure
galera-features#56 : MDEV-29773 assertion failure
MDEV-27615 : MDEV-29773 assertion failure

View File

@ -1082,9 +1082,11 @@ COMMIT;
drop table t2; drop table t2;
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-19526 heap number overflow # MDEV-19526/MDEV-29742 heap number overflow
# #
CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a)) CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a))
ENGINE=InnoDB; ENGINE=InnoDB;
INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191; INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191;
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
DROP TABLE t1; DROP TABLE t1;
# End of 10.3 tests

View File

@ -641,9 +641,12 @@ drop table t2;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
--echo # MDEV-19526 heap number overflow --echo # MDEV-19526/MDEV-29742 heap number overflow
--echo # --echo #
CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a)) CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a))
ENGINE=InnoDB; ENGINE=InnoDB;
INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191; INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191;
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
DROP TABLE t1; DROP TABLE t1;
--echo # End of 10.3 tests

View File

@ -58,6 +58,7 @@ DROP TABLE t1;
# #
call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)");
call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Too many concurrent transactions"); call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Too many concurrent transactions");
SET @saved_debug_dbug= @@debug_dbug;
CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB; CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB;
SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
TRUNCATE t1; TRUNCATE t1;
@ -69,7 +70,7 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100))ENGINE=InnoDB;
SET DEBUG_DBUG="+d,stats_lock_fail"; SET DEBUG_DBUG="+d,stats_lock_fail";
ALTER TABLE t1 ADD FULLTEXT(f2); ALTER TABLE t1 ADD FULLTEXT(f2);
ERROR HY000: Got error 15 "Block device required" from storage engine InnoDB ERROR HY000: Got error 15 "Block device required" from storage engine InnoDB
SET DEBUG_DBUG="-d,stats_lock_fail"; SET debug_dbug=@saved_debug_dbug;
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;
ALTER TABLE t1 ADD FULLTEXT(f2); ALTER TABLE t1 ADD FULLTEXT(f2);
ERROR HY000: Tablespace has been discarded for table `t1` ERROR HY000: Tablespace has been discarded for table `t1`

View File

@ -11,12 +11,13 @@ DROP TABLE mdev21563;
# #
CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES('mysql'), ('innodb'); INSERT INTO t1 VALUES('mysql'), ('innodb');
SET @save_dbug=@@debug_dbug;
set debug_dbug="+d,fts_instrument_sync_request"; set debug_dbug="+d,fts_instrument_sync_request";
INSERT INTO t1 VALUES('test'); INSERT INTO t1 VALUES('test');
set debug_dbug="-d,fts_instrument_sync_request"; set debug_dbug=@save_dbug;
INSERT INTO t1 VALUES('This is a fts issue'); INSERT INTO t1 VALUES('This is a fts issue');
# restart # restart
set debug_dbug="+d,fts_instrument_sync_request"; set debug_dbug="+d,fts_instrument_sync_request";
UPDATE t1 SET f1="mariadb"; UPDATE t1 SET f1="mariadb";
set debug_dbug="-d,fts_instrument_sync_request"; set debug_dbug=@save_dbug;
DROP TABLE t1; DROP TABLE t1;

View File

@ -87,6 +87,7 @@ DROP TABLE t1;
--echo # --echo #
call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)");
call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Too many concurrent transactions"); call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Too many concurrent transactions");
SET @saved_debug_dbug= @@debug_dbug;
CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB; CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB;
SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
@ -102,7 +103,7 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100))ENGINE=InnoDB;
SET DEBUG_DBUG="+d,stats_lock_fail"; SET DEBUG_DBUG="+d,stats_lock_fail";
--error ER_GET_ERRNO --error ER_GET_ERRNO
ALTER TABLE t1 ADD FULLTEXT(f2); ALTER TABLE t1 ADD FULLTEXT(f2);
SET DEBUG_DBUG="-d,stats_lock_fail"; SET debug_dbug=@saved_debug_dbug;
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED --error ER_TABLESPACE_DISCARDED
ALTER TABLE t1 ADD FULLTEXT(f2); ALTER TABLE t1 ADD FULLTEXT(f2);

View File

@ -16,12 +16,13 @@ DROP TABLE mdev21563;
--echo # --echo #
CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES('mysql'), ('innodb'); INSERT INTO t1 VALUES('mysql'), ('innodb');
SET @save_dbug=@@debug_dbug;
set debug_dbug="+d,fts_instrument_sync_request"; set debug_dbug="+d,fts_instrument_sync_request";
INSERT INTO t1 VALUES('test'); INSERT INTO t1 VALUES('test');
set debug_dbug="-d,fts_instrument_sync_request"; set debug_dbug=@save_dbug;
INSERT INTO t1 VALUES('This is a fts issue'); INSERT INTO t1 VALUES('This is a fts issue');
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
set debug_dbug="+d,fts_instrument_sync_request"; set debug_dbug="+d,fts_instrument_sync_request";
UPDATE t1 SET f1="mariadb"; UPDATE t1 SET f1="mariadb";
set debug_dbug="-d,fts_instrument_sync_request"; set debug_dbug=@save_dbug;
DROP TABLE t1; DROP TABLE t1;

View File

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. # Copyright (c) 2006, 2014, Oracle and/or its affiliates.
# Copyright (c) 2010, 2021, MariaDB Corporation. # Copyright (c) 2010, 2022, MariaDB Corporation.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -178,7 +178,14 @@ SET (SQL_SOURCE
${GEN_SOURCES} ${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE} ${MYSYS_LIBWRAP_SOURCE}
) )
IF(CMAKE_C_COMPILER_ID MATCHES "Clang" AND
NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.0.0")
ADD_COMPILE_FLAGS(${CMAKE_CURRENT_BINARY_DIR}/yy_mariadb.cc
${CMAKE_CURRENT_BINARY_DIR}/yy_oracle.cc
COMPILE_FLAGS "-Wno-unused-but-set-variable")
ENDIF()
IF ((CMAKE_SYSTEM_NAME MATCHES "Linux" OR IF ((CMAKE_SYSTEM_NAME MATCHES "Linux" OR
CMAKE_SYSTEM_NAME MATCHES "SunOS" OR CMAKE_SYSTEM_NAME MATCHES "SunOS" OR
WIN32 OR WIN32 OR

View File

@ -5662,7 +5662,7 @@ inline bool Row_definition_list::eq_name(const Spvar_definition *def,
class Create_field :public Column_definition class Create_field :public Column_definition
{ {
public: public:
LEX_CSTRING change; // If done with alter table LEX_CSTRING change; // Old column name if column is renamed by ALTER
LEX_CSTRING after; // Put column after this one LEX_CSTRING after; // Put column after this one
Field *field; // For alter table Field *field; // For alter table
const TYPELIB *save_interval; // Temporary copy for the above const TYPELIB *save_interval; // Temporary copy for the above

View File

@ -79,6 +79,10 @@ struct Vers_part_info : public Sql_alloc
partition_element *hist_part; partition_element *hist_part;
}; };
/*
See generate_partition_syntax() for details of how the data is used
in partition expression.
*/
class partition_info : public Sql_alloc class partition_info : public Sql_alloc
{ {
public: public:
@ -88,6 +92,10 @@ public:
List<partition_element> partitions; List<partition_element> partitions;
List<partition_element> temp_partitions; List<partition_element> temp_partitions;
/*
These are mutually exclusive with part_expr/subpart_expr depending on
what is specified in partitioning filter: expression or column list.
*/
List<const char> part_field_list; List<const char> part_field_list;
List<const char> subpart_field_list; List<const char> subpart_field_list;

View File

@ -508,8 +508,18 @@ bool Sql_cmd_alter_table::execute(THD *thd)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
thd->variables.auto_increment_offset = 1; /*
thd->variables.auto_increment_increment = 1; It makes sense to set auto_increment_* to defaults in TOI operations.
Must be done before wsrep_TOI_begin() since Query_log_event encapsulating
TOI statement and auto inc variables for wsrep replication is constructed
there. Variables are reset back in THD::reset_for_next_command() before
processing of next command.
*/
if (wsrep_auto_increment_control)
{
thd->variables.auto_increment_offset = 1;
thd->variables.auto_increment_increment = 1;
}
} }
#endif #endif

View File

@ -63,23 +63,23 @@ public:
{ {
static LEX_CSTRING names[17]= static LEX_CSTRING names[17]=
{ {
{STRING_WITH_LEN("HA_NOSAME")}, {STRING_WITH_LEN("HA_NOSAME")}, // 1
{STRING_WITH_LEN("HA_PACK_KEY")}, {STRING_WITH_LEN("HA_PACK_KEY")}, // 2; also in HA_KEYSEG
{STRING_WITH_LEN("HA_SPACE_PACK_USED")}, {STRING_WITH_LEN("HA_SPACE_PACK_USED")}, // 4
{STRING_WITH_LEN("HA_VAR_LENGTH_KEY")}, {STRING_WITH_LEN("HA_VAR_LENGTH_KEY")}, // 8
{STRING_WITH_LEN("HA_AUTO_KEY")}, {STRING_WITH_LEN("HA_AUTO_KEY")}, // 16
{STRING_WITH_LEN("HA_BINARY_PACK_KEY")}, {STRING_WITH_LEN("HA_BINARY_PACK_KEY")}, // 32
{STRING_WITH_LEN("HA_NULL_PART_KEY")}, {STRING_WITH_LEN("HA_NULL_PART_KEY")}, // 64
{STRING_WITH_LEN("HA_FULLTEXT")}, {STRING_WITH_LEN("HA_FULLTEXT")}, // 128
{STRING_WITH_LEN("HA_UNIQUE_CHECK")}, {STRING_WITH_LEN("HA_UNIQUE_CHECK")}, // 256
{STRING_WITH_LEN("HA_SORT_ALLOWS_SAME")}, {STRING_WITH_LEN("HA_SORT_ALLOWS_SAME")}, // 512
{STRING_WITH_LEN("HA_SPATIAL")}, {STRING_WITH_LEN("HA_SPATIAL")}, // 1024
{STRING_WITH_LEN("HA_NULL_ARE_EQUAL")}, {STRING_WITH_LEN("HA_NULL_ARE_EQUAL")}, // 2048
{STRING_WITH_LEN("HA_GENERATED_KEY")}, {STRING_WITH_LEN("HA_USES_COMMENT")}, // 4096
{STRING_WITH_LEN("HA_USES_COMMENT")}, {STRING_WITH_LEN("HA_GENERATED_KEY")}, // 8192
{STRING_WITH_LEN("HA_USES_PARSER")}, {STRING_WITH_LEN("HA_USES_PARSER")}, // 16384
{STRING_WITH_LEN("HA_USES_BLOCK_SIZE")}, {STRING_WITH_LEN("HA_USES_BLOCK_SIZE")}, // 32768
{STRING_WITH_LEN("HA_KEY_HAS_PART_KEY_SEG")} {STRING_WITH_LEN("HA_KEY_HAS_PART_KEY_SEG")}// 65536
}; };
return append_flag32_names((uint) flags, names, array_elements(names)); return append_flag32_names((uint) flags, names, array_elements(names));
} }
@ -89,7 +89,7 @@ public:
static LEX_CSTRING names[]= static LEX_CSTRING names[]=
{ {
{STRING_WITH_LEN("HA_SPACE_PACK")}, // 1 {STRING_WITH_LEN("HA_SPACE_PACK")}, // 1
{STRING_WITH_LEN("??? 2 ???")}, // 2 {STRING_WITH_LEN("HA_PACK_KEY")}, // 2; also in KEY/MI/KEY_DEF
{STRING_WITH_LEN("HA_PART_KEY_SEG")}, // 4 {STRING_WITH_LEN("HA_PART_KEY_SEG")}, // 4
{STRING_WITH_LEN("HA_VAR_LENGTH_PART")}, // 8 {STRING_WITH_LEN("HA_VAR_LENGTH_PART")}, // 8
{STRING_WITH_LEN("HA_NULL_PART")}, // 16 {STRING_WITH_LEN("HA_NULL_PART")}, // 16

View File

@ -119,8 +119,8 @@ struct list_node :public Sql_alloc
{ {
list_node *next; list_node *next;
void *info; void *info;
list_node(void *info_par,list_node *next_par) list_node(const void *info_par, list_node *next_par)
:next(next_par),info(info_par) :next(next_par), info(const_cast<void *>(info_par))
{} {}
list_node() /* For end_of_list */ list_node() /* For end_of_list */
{ {
@ -385,7 +385,7 @@ public:
#endif // LIST_EXTRA_DEBUG #endif // LIST_EXTRA_DEBUG
protected: protected:
void after(void *info,list_node *node) void after(const void *info, list_node *node)
{ {
list_node *new_node=new list_node(info,node->next); list_node *new_node=new list_node(info,node->next);
node->next=new_node; node->next=new_node;
@ -446,11 +446,11 @@ public:
{ {
el= &list->first; el= &list->first;
} }
inline void *replace(void *element) inline void *replace(const void *element)
{ // Return old element { // Return old element
void *tmp=current->info; void *tmp=current->info;
DBUG_ASSERT(current->info != 0); DBUG_ASSERT(current->info != 0);
current->info=element; current->info= const_cast<void *>(element);
return tmp; return tmp;
} }
void *replace(base_list &new_list) void *replace(base_list &new_list)
@ -473,7 +473,7 @@ public:
el=prev; el=prev;
current=0; // Safeguard current=0; // Safeguard
} }
void after(void *element) // Insert element after current void after(const void *element) // Insert element after current
{ {
list->after(element,current); list->after(element,current);
current=current->next; current=current->next;

View File

@ -9899,7 +9899,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
SELECT_LEX *select_lex= lex->first_select_lex(); SELECT_LEX *select_lex= lex->first_select_lex();
privilege_t want_priv(NO_ACL); privilege_t want_priv{CREATE_ACL};
bool error= TRUE; // Error message is given bool error= TRUE; // Error message is given
DBUG_ENTER("create_table_precheck"); DBUG_ENTER("create_table_precheck");
@ -9908,8 +9908,10 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
CREATE TABLE ... SELECT, also require INSERT. CREATE TABLE ... SELECT, also require INSERT.
*/ */
want_priv= lex->tmp_table() ? CREATE_TMP_ACL : if (lex->tmp_table())
(CREATE_ACL | (select_lex->item_list.elements ? INSERT_ACL : NO_ACL)); want_priv= CREATE_TMP_ACL;
else if (select_lex->item_list.elements || select_lex->tvc)
want_priv|= INSERT_ACL;
/* CREATE OR REPLACE on not temporary tables require DROP_ACL */ /* CREATE OR REPLACE on not temporary tables require DROP_ACL */
if (lex->create_info.or_replace() && !lex->tmp_table()) if (lex->create_info.or_replace() && !lex->tmp_table())

View File

@ -4802,6 +4802,7 @@ static void check_datadir_altered_for_innodb(THD *thd,
@param[out] partition_changed Boolean indicating whether partition changed @param[out] partition_changed Boolean indicating whether partition changed
@param[out] fast_alter_table Boolean indicating if fast partition alter is @param[out] fast_alter_table Boolean indicating if fast partition alter is
possible. possible.
@param[out] thd->work_part_info Prepared part_info for the new table
@return Operation status @return Operation status
@retval TRUE Error @retval TRUE Error

View File

@ -5136,6 +5136,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
if ((duplicate= unique_table(thd, table, src_table, 0))) if ((duplicate= unique_table(thd, table, src_table, 0)))
{ {
update_non_unique_table_error(src_table, "CREATE", duplicate); update_non_unique_table_error(src_table, "CREATE", duplicate);
res= 1;
goto err; goto err;
} }
} }
@ -7633,6 +7634,20 @@ void append_drop_column(THD *thd, String *str, Field *field)
} }
static inline
void rename_field_in_list(Create_field *field, List<const char> *field_list)
{
DBUG_ASSERT(field->change.str);
List_iterator<const char> it(*field_list);
while (const char *name= it++)
{
if (my_strcasecmp(system_charset_info, name, field->change.str))
continue;
it.replace(field->field_name.str);
}
}
/** /**
Prepare column and key definitions for CREATE TABLE in ALTER TABLE. Prepare column and key definitions for CREATE TABLE in ALTER TABLE.
@ -7999,6 +8014,34 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
field->default_value->expr->walk(&Item::rename_fields_processor, 1, field->default_value->expr->walk(&Item::rename_fields_processor, 1,
&column_rename_param); &column_rename_param);
} }
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (thd->work_part_info)
{
partition_info *part_info= thd->work_part_info;
List_iterator<Create_field> def_it(column_rename_param.fields);
const bool part_field_list= !part_info->part_field_list.is_empty();
const bool subpart_field_list= !part_info->subpart_field_list.is_empty();
if (part_info->part_expr)
part_info->part_expr->walk(&Item::rename_fields_processor, 1,
&column_rename_param);
if (part_info->subpart_expr)
part_info->subpart_expr->walk(&Item::rename_fields_processor, 1,
&column_rename_param);
if (part_field_list || subpart_field_list)
{
while (Create_field *def= def_it++)
{
if (def->change.str)
{
if (part_field_list)
rename_field_in_list(def, &part_info->part_field_list);
if (subpart_field_list)
rename_field_in_list(def, &part_info->subpart_field_list);
} /* if (def->change.str) */
} /* while (def) */
} /* if (part_field_list || subpart_field_list) */
} /* if (part_info) */
#endif
// Force reopen because new column name is on thd->mem_root // Force reopen because new column name is on thd->mem_root
table->mark_table_for_reopen(); table->mark_table_for_reopen();
} }
@ -9910,6 +9953,9 @@ do_continue:;
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
{ {
/*
Partitioning: part_info is prepared and returned via thd->work_part_info
*/
if (prep_alter_part_table(thd, table, alter_info, create_info, if (prep_alter_part_table(thd, table, alter_info, create_info,
&partition_changed, &fast_alter_partition)) &partition_changed, &fast_alter_partition))
{ {
@ -10124,8 +10170,10 @@ do_continue:;
No ddl logging needed as ddl_log_alter_query will take care of failed No ddl logging needed as ddl_log_alter_query will take care of failed
table creations. table creations.
Partitioning: part_info is passed via thd->work_part_info
*/ */
error= create_table_impl(thd, (DDL_LOG_STATE*) 0, (DDL_LOG_STATE*) 0, error= create_table_impl(thd, nullptr, nullptr,
alter_ctx.db, alter_ctx.table_name, alter_ctx.db, alter_ctx.table_name,
alter_ctx.new_db, alter_ctx.tmp_name, alter_ctx.new_db, alter_ctx.tmp_name,
alter_ctx.get_tmp_cstring_path(), alter_ctx.get_tmp_cstring_path(),

View File

@ -2,7 +2,7 @@
#define SQL_TYPE_H_INCLUDED #define SQL_TYPE_H_INCLUDED
/* /*
Copyright (c) 2015 MariaDB Foundation. Copyright (c) 2015 MariaDB Foundation.
Copyright (c) 2015, 2021, MariaDB Corporation. Copyright (c) 2015, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -3810,8 +3810,8 @@ public:
{ {
return this; return this;
} }
virtual bool partition_field_check(const LEX_CSTRING &field_name, virtual bool partition_field_check(const LEX_CSTRING &field_name, Item *)
Item *item_expr) const const
{ {
partition_field_type_not_allowed(field_name); partition_field_type_not_allowed(field_name);
return true; return true;
@ -4180,8 +4180,8 @@ public:
CHARSET_INFO *cs, CHARSET_INFO *cs,
bool send_error) const bool send_error) const
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return NULL; return nullptr;
} }
Item_literal *create_literal_item(THD *thd, const String *str, Item_literal *create_literal_item(THD *thd, const String *str,
bool send_error) const bool send_error) const
@ -4192,12 +4192,13 @@ public:
virtual Item *create_typecast_item(THD *thd, Item *item, virtual Item *create_typecast_item(THD *thd, Item *item,
const Type_cast_attributes &attr) const const Type_cast_attributes &attr) const
{ {
return NULL; MY_ASSERT_UNREACHABLE();
return nullptr;
} }
virtual Item_copy *create_item_copy(THD *thd, Item *item) const; virtual Item_copy *create_item_copy(THD *thd, Item *item) const;
virtual int cmp_native(const Native &a, const Native &b) const virtual int cmp_native(const Native &a, const Native &b) const
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
virtual bool set_comparator_func(THD *thd, Arg_comparator *cmp) const= 0; virtual bool set_comparator_func(THD *thd, Arg_comparator *cmp) const= 0;
@ -4351,11 +4352,10 @@ class Type_handler_row: public Type_handler
public: public:
virtual ~Type_handler_row() {} virtual ~Type_handler_row() {}
const Name &default_value() const override; const Name &default_value() const override;
bool validate_implicit_default_value(THD *thd, bool validate_implicit_default_value(THD *, const Column_definition &)
const Column_definition &def) const const override
override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
const Type_collection *type_collection() const override; const Type_collection *type_collection() const override;
@ -4369,12 +4369,12 @@ public:
bool can_return_time() const override { return false; } bool can_return_time() const override { return false; }
enum_field_types field_type() const override enum_field_types field_type() const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return MYSQL_TYPE_NULL; return MYSQL_TYPE_NULL;
}; };
protocol_send_type_t protocol_send_type() const override protocol_send_type_t protocol_send_type() const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return PROTOCOL_SEND_STRING; return PROTOCOL_SEND_STRING;
} }
Item_result result_type() const override Item_result result_type() const override
@ -4385,47 +4385,44 @@ public:
{ {
return ROW_RESULT; return ROW_RESULT;
} }
enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) enum_dynamic_column_type dyncol_type(const Type_all_attributes *)
const override const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return DYN_COL_NULL; return DYN_COL_NULL;
} }
const Type_handler *type_handler_for_comparison() const override; const Type_handler *type_handler_for_comparison() const override;
int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override int stored_field_cmp_to_item(THD *, Field *, Item *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
bool subquery_type_allows_materialization(const Item *, const Item *, bool subquery_type_allows_materialization(const Item *, const Item *, bool)
bool) const override const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return false; return false;
} }
Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const override Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const
override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return NULL; return nullptr;
} }
Field *make_conversion_table_field(MEM_ROOT *root, Field *make_conversion_table_field(MEM_ROOT *, TABLE *, uint, const Field *)
TABLE *table, const override
uint metadata,
const Field *target) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return NULL; return nullptr;
} }
bool Column_definition_fix_attributes(Column_definition *c) const override bool Column_definition_fix_attributes(Column_definition *) const override
{ {
return false; return false;
} }
void Column_definition_reuse_fix_attributes(THD *thd, void Column_definition_reuse_fix_attributes(THD *, Column_definition *,
Column_definition *c, const Field *) const override
const Field *field)
const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
} }
bool Column_definition_prepare_stage1(THD *thd, bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root, MEM_ROOT *mem_root,
@ -4435,28 +4432,25 @@ public:
const Column_derived_attributes const Column_derived_attributes
*derived_attr) *derived_attr)
const override; const override;
bool Column_definition_redefine_stage1(Column_definition *def, bool Column_definition_redefine_stage1(Column_definition *,
const Column_definition *dup, const Column_definition *,
const handler *file) const handler *)
const override const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Column_definition_prepare_stage2(Column_definition *c, bool Column_definition_prepare_stage2(Column_definition *, handler *,
handler *file, ulonglong) const override
ulonglong table_flags) const override
{ {
return false; return false;
} }
Field *make_table_field(MEM_ROOT *root, Field *make_table_field(MEM_ROOT *, const LEX_CSTRING *, const Record_addr &,
const LEX_CSTRING *name, const Type_all_attributes &, TABLE_SHARE *)
const Record_addr &addr, const override
const Type_all_attributes &attr,
TABLE_SHARE *share) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return NULL; return nullptr;
} }
Field *make_table_field_from_def(TABLE_SHARE *share, Field *make_table_field_from_def(TABLE_SHARE *share,
MEM_ROOT *mem_root, MEM_ROOT *mem_root,
@ -4469,76 +4463,73 @@ public:
const SORT_FIELD_ATTR *sort_field, const SORT_FIELD_ATTR *sort_field,
Sort_param *param) const override Sort_param *param) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
} }
uint make_packed_sort_key_part(uchar *to, Item *item, uint make_packed_sort_key_part(uchar *, Item *, const SORT_FIELD_ATTR *,
const SORT_FIELD_ATTR *sort_field, Sort_param *) const override
Sort_param *param) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
void sort_length(THD *thd, const Type_std_attributes *item, void sort_length(THD *, const Type_std_attributes *, SORT_FIELD_ATTR *)
SORT_FIELD_ATTR *attr) const override const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
} }
uint32 max_display_length(const Item *item) const override uint32 max_display_length(const Item *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
uint32 max_display_length_for_field(const Conv_source &src) const override uint32 max_display_length_for_field(const Conv_source &) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
uint32 calc_pack_length(uint32 length) const override uint32 calc_pack_length(uint32) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr, bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
Item *a, Item *b) const override; Item *a, Item *b) const override;
decimal_digits_t Item_decimal_precision(const Item *item) const override decimal_digits_t Item_decimal_precision(const Item *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return DECIMAL_MAX_PRECISION; return DECIMAL_MAX_PRECISION;
} }
bool Item_save_in_value(THD *thd, Item *item, st_value *value) const override; bool Item_save_in_value(THD *thd, Item *item, st_value *value) const
override;
bool Item_param_set_from_value(THD *thd, bool Item_param_set_from_value(THD *thd,
Item_param *param, Item_param *param,
const Type_all_attributes *attr, const Type_all_attributes *attr,
const st_value *value) const override; const st_value *value) const override;
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const override bool Item_send(Item *, Protocol *, st_value *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
void Item_update_null_value(Item *item) const override; void Item_update_null_value(Item *item) const override;
int Item_save_in_field(Item *item, Field *field, bool no_conversions) int Item_save_in_field(Item *, Field *, bool) const override
const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 1; return 1;
} }
String *print_item_value(THD *thd, Item *item, String *str) const override; String *print_item_value(THD *thd, Item *item, String *str) const override;
bool can_change_cond_ref_to_const(Item_bool_func2 *target, bool can_change_cond_ref_to_const(Item_bool_func2 *, Item *, Item *,
Item *target_expr, Item *target_value, Item_bool_func2 *, Item *, Item *)
Item_bool_func2 *source, const override
Item *source_expr, Item *source_const)
const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return false; return false;
} }
Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const
const override; override;
Item_cache *Item_get_cache(THD *thd, const Item *item) const override; Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
Item_copy *create_item_copy(THD *thd, Item *item) const override Item_copy *create_item_copy(THD *, Item *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return NULL; return nullptr;
} }
bool set_comparator_func(THD *thd, Arg_comparator *cmp) const override; bool set_comparator_func(THD *thd, Arg_comparator *cmp) const override;
bool Item_hybrid_func_fix_attributes(THD *thd, bool Item_hybrid_func_fix_attributes(THD *thd,
@ -4548,188 +4539,187 @@ public:
Item **items, uint nitems) Item **items, uint nitems)
const override const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const override bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_val_bool(Item *item) const override bool Item_val_bool(Item *item) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return false; return false;
} }
void Item_get_date(THD *thd, Item *item, void Item_get_date(THD *, Item *, Temporal::Warn *, MYSQL_TIME *ltime,
Temporal::Warn *warn, MYSQL_TIME *ltime, date_mode_t) const override
date_mode_t fuzzydate) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
set_zero_time(ltime, MYSQL_TIMESTAMP_NONE); set_zero_time(ltime, MYSQL_TIMESTAMP_NONE);
} }
longlong Item_val_int_signed_typecast(Item *item) const override longlong Item_val_int_signed_typecast(Item *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
longlong Item_val_int_unsigned_typecast(Item *item) const override longlong Item_val_int_unsigned_typecast(Item *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) String *Item_func_hex_val_str_ascii(Item_func_hex *, String *) const override
const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return NULL; return nullptr;
} }
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
String *) const override String *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return NULL; return nullptr;
} }
double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *) double Item_func_hybrid_field_type_val_real(Item_func_hybrid_field_type *)
const override const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0.0; return 0.0;
} }
longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *) longlong Item_func_hybrid_field_type_val_int(Item_func_hybrid_field_type *)
const override const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
my_decimal *Item_func_hybrid_field_type_val_decimal( my_decimal *Item_func_hybrid_field_type_val_decimal(
Item_func_hybrid_field_type *, Item_func_hybrid_field_type *,
my_decimal *) const override my_decimal *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return NULL; return nullptr;
} }
void Item_func_hybrid_field_type_get_date(THD *, void Item_func_hybrid_field_type_get_date(THD *,
Item_func_hybrid_field_type *, Item_func_hybrid_field_type *,
Temporal::Warn *, Temporal::Warn *,
MYSQL_TIME *ltime, MYSQL_TIME *ltime,
date_mode_t fuzzydate) date_mode_t) const override
const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
set_zero_time(ltime, MYSQL_TIMESTAMP_NONE); set_zero_time(ltime, MYSQL_TIMESTAMP_NONE);
} }
String *Item_func_min_max_val_str(Item_func_min_max *, String *) const override String *Item_func_min_max_val_str(Item_func_min_max *, String *) const
override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return NULL; return nullptr;
} }
double Item_func_min_max_val_real(Item_func_min_max *) const override double Item_func_min_max_val_real(Item_func_min_max *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
longlong Item_func_min_max_val_int(Item_func_min_max *) const override longlong Item_func_min_max_val_int(Item_func_min_max *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
my_decimal *) const override my_decimal *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return NULL; return nullptr;
} }
bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, bool Item_func_min_max_get_date(THD *, Item_func_min_max*, MYSQL_TIME *,
MYSQL_TIME *, date_mode_t fuzzydate) date_mode_t) const override
const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_func_between_fix_length_and_dec(Item_func_between *func) bool Item_func_between_fix_length_and_dec(Item_func_between *) const override
const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
longlong Item_func_between_val_int(Item_func_between *func) const override; longlong Item_func_between_val_int(Item_func_between *func) const override;
cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override; cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const override;
in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) const
const override; override;
bool Item_func_in_fix_comparator_compatible_types(THD *thd, Item_func_in *) bool Item_func_in_fix_comparator_compatible_types(THD *thd,
const override; Item_func_in *) const
override;
bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const override; bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const
override;
bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override; bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override;
bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override; bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override;
bool Item_func_signed_fix_length_and_dec(Item_func_signed *) const override bool Item_func_signed_fix_length_and_dec(Item_func_signed *) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *) const override bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *) const
override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_double_typecast_fix_length_and_dec(Item_double_typecast *) bool Item_double_typecast_fix_length_and_dec(Item_double_typecast *) const
const override override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_float_typecast_fix_length_and_dec(Item_float_typecast *) bool Item_float_typecast_fix_length_and_dec(Item_float_typecast *) const
const override override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *) bool Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *) const
const override override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const
const override override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_time_typecast_fix_length_and_dec(Item_time_typecast *) bool Item_time_typecast_fix_length_and_dec(Item_time_typecast *) const
const override override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_date_typecast_fix_length_and_dec(Item_date_typecast *) bool Item_date_typecast_fix_length_and_dec(Item_date_typecast *) const
const override override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
bool Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *) bool Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *)
const override const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return true; return true;
} }
@ -4749,8 +4739,6 @@ class Type_handler_numeric: public Type_handler
public: public:
const Name &default_value() const override; const Name &default_value() const override;
String *print_item_value(THD *thd, Item *item, String *str) const override; String *print_item_value(THD *thd, Item *item, String *str) const override;
double Item_func_min_max_val_real(Item_func_min_max *) const override;
longlong Item_func_min_max_val_int(Item_func_min_max *) const override;
bool Column_definition_prepare_stage1(THD *thd, bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root, MEM_ROOT *mem_root,
Column_definition *c, Column_definition *c,
@ -4759,19 +4747,23 @@ public:
const Column_derived_attributes const Column_derived_attributes
*derived_attr) *derived_attr)
const override; const override;
double Item_func_min_max_val_real(Item_func_min_max *) const override;
longlong Item_func_min_max_val_int(Item_func_min_max *) const override;
my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *, my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
my_decimal *) const override; my_decimal *) const override;
bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*,
MYSQL_TIME *, date_mode_t fuzzydate) MYSQL_TIME *, date_mode_t fuzzydate) const
const override; override;
virtual ~Type_handler_numeric() { } virtual ~Type_handler_numeric() { }
bool can_change_cond_ref_to_const(Item_bool_func2 *target, bool can_change_cond_ref_to_const(Item_bool_func2 *target,
Item *target_expr, Item *target_value, Item *target_expr, Item *target_value,
Item_bool_func2 *source, Item_bool_func2 *source,
Item *source_expr, Item *source_const) Item *source_expr, Item *source_const) const
const override; override;
bool Item_func_between_fix_length_and_dec(Item_func_between *func) const override; bool Item_func_between_fix_length_and_dec(Item_func_between *func) const
bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const override; override;
bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const
override;
}; };
@ -5266,8 +5258,8 @@ public:
return type_limits_int()->char_length(); return type_limits_int()->char_length();
} }
uint32 Item_decimal_notation_int_digits(const Item *item) const override; uint32 Item_decimal_notation_int_digits(const Item *item) const override;
bool partition_field_check(const LEX_CSTRING &field_name, bool partition_field_check(const LEX_CSTRING &, Item *item_expr)
Item *item_expr) const override const override
{ {
return partition_field_check_result_type(item_expr, INT_RESULT); return partition_field_check_result_type(item_expr, INT_RESULT);
} }
@ -6105,8 +6097,8 @@ public:
const override; const override;
bool Item_param_val_native(THD *thd, Item_param *item, Native *to) bool Item_param_val_native(THD *thd, Item_param *item, Native *to)
const override; const override;
bool partition_field_check(const LEX_CSTRING &field_name, bool partition_field_check(const LEX_CSTRING &, Item *item_expr)
Item *item_expr) const override const override
{ {
return partition_field_check_result_type(item_expr, STRING_RESULT); return partition_field_check_result_type(item_expr, STRING_RESULT);
} }
@ -6315,8 +6307,8 @@ public:
{ {
return true; return true;
} }
bool partition_field_check(const LEX_CSTRING &field_name, bool partition_field_check(const LEX_CSTRING &, Item *item_expr)
Item *item_expr) const override const override
{ {
return partition_field_check_result_type(item_expr, STRING_RESULT); return partition_field_check_result_type(item_expr, STRING_RESULT);
} }
@ -6445,8 +6437,8 @@ public:
{ {
return true; return true;
} }
bool partition_field_check(const LEX_CSTRING &field_name, bool partition_field_check(const LEX_CSTRING &, Item *item_expr)
Item *item_expr) const override const override
{ {
return partition_field_check_result_type(item_expr, STRING_RESULT); return partition_field_check_result_type(item_expr, STRING_RESULT);
} }
@ -6896,12 +6888,13 @@ public:
bool is_param_long_data_type() const override { return true; } bool is_param_long_data_type() const override { return true; }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
uint32 calc_pack_length(uint32 length) const override { return length; } uint32 calc_pack_length(uint32 length) const override { return length; }
const Type_handler *type_handler_for_tmp_table(const Item *item) const override const Type_handler *type_handler_for_tmp_table(const Item *item) const
override
{ {
return varstring_type_handler(item); return varstring_type_handler(item);
} }
bool partition_field_check(const LEX_CSTRING &field_name, bool partition_field_check(const LEX_CSTRING &, Item *item_expr)
Item *item_expr) const override const override
{ {
return partition_field_check_result_type(item_expr, STRING_RESULT); return partition_field_check_result_type(item_expr, STRING_RESULT);
} }
@ -6988,7 +6981,8 @@ public:
{ {
return (length + (length < 256 ? 1: 2)); return (length + (length < 256 ? 1: 2));
} }
const Type_handler *type_handler_for_tmp_table(const Item *item) const override const Type_handler *type_handler_for_tmp_table(const Item *item) const
override
{ {
return varstring_type_handler(item); return varstring_type_handler(item);
} }
@ -6997,8 +6991,8 @@ public:
return varstring_type_handler(item); return varstring_type_handler(item);
} }
bool is_param_long_data_type() const override { return true; } bool is_param_long_data_type() const override { return true; }
bool partition_field_check(const LEX_CSTRING &field_name, bool partition_field_check(const LEX_CSTRING &, Item *item_expr)
Item *item_expr) const override const override
{ {
return partition_field_check_result_type(item_expr, STRING_RESULT); return partition_field_check_result_type(item_expr, STRING_RESULT);
} }
@ -7058,12 +7052,12 @@ public:
} }
ulong KEY_pack_flags(uint column_nr) const override ulong KEY_pack_flags(uint column_nr) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
bool partition_field_check(const LEX_CSTRING &field_name, bool partition_field_check(const LEX_CSTRING &field_name, Item *)
Item *item_expr) const override const override
{ {
partition_field_type_not_allowed(field_name); partition_field_type_not_allowed(field_name);
return true; return true;
@ -7143,7 +7137,7 @@ public:
void Item_param_setup_conversion(THD *thd, Item_param *) const override; void Item_param_setup_conversion(THD *thd, Item_param *) const override;
bool partition_field_check(const LEX_CSTRING &field_name, bool partition_field_check(const LEX_CSTRING &field_name,
Item *item_expr) const override; Item *item_expr) const override;
Field *make_schema_field(MEM_ROOT *root, Field *make_schema_field(MEM_ROOT *root,
TABLE *table, TABLE *table,
const Record_addr &addr, const Record_addr &addr,
@ -7181,7 +7175,8 @@ class Type_handler_medium_blob: public Type_handler_blob_common
public: public:
virtual ~Type_handler_medium_blob() {} virtual ~Type_handler_medium_blob() {}
uint length_bytes() const override { return 3; } uint length_bytes() const override { return 3; }
enum_field_types field_type() const override { return MYSQL_TYPE_MEDIUM_BLOB; } enum_field_types field_type() const override
{ return MYSQL_TYPE_MEDIUM_BLOB; }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
uint32 calc_pack_length(uint32 length) const override; uint32 calc_pack_length(uint32 length) const override;
Field *make_table_field(MEM_ROOT *root, Field *make_table_field(MEM_ROOT *root,
@ -7238,7 +7233,7 @@ public:
} }
ulong KEY_pack_flags(uint) const override ulong KEY_pack_flags(uint) const override
{ {
DBUG_ASSERT(0); MY_ASSERT_UNREACHABLE();
return 0; return 0;
} }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;

View File

@ -473,19 +473,20 @@ void wsrep_recover_sr_from_storage(THD *orig_thd)
if (!wsrep_schema) if (!wsrep_schema)
{ {
WSREP_ERROR("Wsrep schema not initialized when trying to recover " WSREP_ERROR("Wsrep schema not initialized when trying to recover "
"streaming transactions"); "streaming transactions: wsrep_on %d", WSREP_ON);
unireg_abort(1); trans_commit(orig_thd);
} }
if (wsrep_schema->recover_sr_transactions(orig_thd)) if (wsrep_schema->recover_sr_transactions(orig_thd))
{ {
WSREP_ERROR("Failed to recover SR transactions from schema"); WSREP_ERROR("Failed to recover SR transactions from schema: wsrep_on : %d", WSREP_ON);
unireg_abort(1); trans_commit(orig_thd);
} }
break; break;
default: default:
/* */ /* */
WSREP_ERROR("Unsupported wsrep SR store type: %lu", wsrep_SR_store_type); WSREP_ERROR("Unsupported wsrep SR store type: %lu wsrep_on: %d",
unireg_abort(1); wsrep_SR_store_type, WSREP_ON);
trans_commit(orig_thd);
break; break;
} }
} }
@ -2675,7 +2676,7 @@ static int wsrep_TOI_begin(THD *thd, const char *db, const char *table,
ret, ret,
(thd->db.str ? thd->db.str : "(null)"), (thd->db.str ? thd->db.str : "(null)"),
wsrep_thd_query(thd)); wsrep_thd_query(thd));
my_error(ER_ERROR_DURING_COMMIT, MYF(0), WSREP_SIZE_EXCEEDED); my_error(ER_UNKNOWN_ERROR, MYF(0), "Maximum writeset size exceeded");
break; break;
case wsrep::e_deadlock_error: case wsrep::e_deadlock_error:
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. " WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2013 Codership Oy <info@codership.com> /* Copyright (C) 2013-2022 Codership Oy <info@codership.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2013-2021 Codership Oy <info@codership.com> /* Copyright (C) 2013-2022 Codership Oy <info@codership.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -182,7 +182,7 @@ void wsrep_reset_threadvars(THD *);
so don't override those by default so don't override those by default
*/ */
static inline void wsrep_override_error(THD *thd, uint error) static inline void wsrep_override_error(THD *thd, uint error, const char *format= 0, ...)
{ {
DBUG_ASSERT(error != ER_ERROR_DURING_COMMIT); DBUG_ASSERT(error != ER_ERROR_DURING_COMMIT);
Diagnostics_area *da= thd->get_stmt_da(); Diagnostics_area *da= thd->get_stmt_da();
@ -195,26 +195,11 @@ static inline void wsrep_override_error(THD *thd, uint error)
da->sql_errno() != ER_LOCK_DEADLOCK)) da->sql_errno() != ER_LOCK_DEADLOCK))
{ {
da->reset_diagnostics_area(); da->reset_diagnostics_area();
my_error(error, MYF(0)); va_list args;
} va_start(args, format);
} if (!format) format= ER_THD(thd, error);
my_printv_error(error, format, MYF(0), args);
/** va_end(args);
Override error with additional wsrep status.
*/
static inline void wsrep_override_error(THD *thd, uint error,
enum wsrep::provider::status status)
{
Diagnostics_area *da= thd->get_stmt_da();
if (da->is_ok() ||
!da->is_set() ||
(da->is_error() &&
da->sql_errno() != error &&
da->sql_errno() != ER_ERROR_DURING_COMMIT &&
da->sql_errno() != ER_LOCK_DEADLOCK))
{
da->reset_diagnostics_area();
my_error(error, MYF(0), status);
} }
} }
@ -226,7 +211,10 @@ static inline void wsrep_override_error(THD* thd,
switch (ce) switch (ce)
{ {
case wsrep::e_error_during_commit: case wsrep::e_error_during_commit:
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status); if (status == wsrep::provider::error_size_exceeded)
wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded");
else
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status);
break; break;
case wsrep::e_deadlock_error: case wsrep::e_deadlock_error:
wsrep_override_error(thd, ER_LOCK_DEADLOCK); wsrep_override_error(thd, ER_LOCK_DEADLOCK);
@ -235,11 +223,11 @@ static inline void wsrep_override_error(THD* thd,
wsrep_override_error(thd, ER_QUERY_INTERRUPTED); wsrep_override_error(thd, ER_QUERY_INTERRUPTED);
break; break;
case wsrep::e_size_exceeded_error: case wsrep::e_size_exceeded_error:
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status); wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded");
break; break;
case wsrep::e_append_fragment_error: case wsrep::e_append_fragment_error:
/* TODO: Figure out better error number */ /* TODO: Figure out better error number */
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status); wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status);
break; break;
case wsrep::e_not_supported_error: case wsrep::e_not_supported_error:
wsrep_override_error(thd, ER_NOT_SUPPORTED_YET); wsrep_override_error(thd, ER_NOT_SUPPORTED_YET);

View File

@ -1,4 +1,4 @@
/* Copyright 2016-2019 Codership Oy <http://www.codership.com> /* Copyright 2016-2022 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
/* Copyright 2008-2021 Codership Oy <http://www.codership.com> /* Copyright 2008-2022 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -119,8 +119,7 @@ bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
if (wsrep_init()) if (wsrep_init())
{ {
my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp, my_error, "wsrep_init failed"); my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp, errno, "wsrep_init failed");
//rcode= true;
saved_wsrep_on= false; saved_wsrep_on= false;
} }
@ -791,11 +790,22 @@ bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type)
{ {
WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads); WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads);
res= wsrep_create_appliers(wsrep_slave_count_change, true); res= wsrep_create_appliers(wsrep_slave_count_change, true);
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_unlock(&LOCK_wsrep_slave_threads);
// Thread creation and execution is asyncronous, therefore we need
// wait them to be started or error produced
while (wsrep_running_applier_threads != (ulong)wsrep_slave_threads)
{
my_sleep(1000);
}
mysql_mutex_lock(&LOCK_global_system_variables);
WSREP_DEBUG("Running %lu applier threads", wsrep_running_applier_threads); WSREP_DEBUG("Running %lu applier threads", wsrep_running_applier_threads);
wsrep_slave_count_change = 0; wsrep_slave_count_change = 0;
} }
else
mysql_mutex_unlock(&LOCK_wsrep_slave_threads); mysql_mutex_unlock(&LOCK_wsrep_slave_threads);
return res; return res;
} }

View File

@ -517,6 +517,11 @@ IF(MSVC)
# on generated file. # on generated file.
TARGET_COMPILE_OPTIONS(innobase PRIVATE "/wd4065") TARGET_COMPILE_OPTIONS(innobase PRIVATE "/wd4065")
ENDIF() ENDIF()
IF(CMAKE_C_COMPILER_ID MATCHES "Clang" AND
NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.0.0")
ADD_COMPILE_FLAGS(pars/pars0grm.cc fts/fts0pars.cc
COMPILE_FLAGS "-Wno-unused-but-set-variable")
ENDIF()
IF(NOT (PLUGIN_INNOBASE STREQUAL DYNAMIC)) IF(NOT (PLUGIN_INNOBASE STREQUAL DYNAMIC))
TARGET_LINK_LIBRARIES(innobase tpool mysys) TARGET_LINK_LIBRARIES(innobase tpool mysys)

View File

@ -765,6 +765,11 @@ bool
PageBulk::isSpaceAvailable( PageBulk::isSpaceAvailable(
ulint rec_size) ulint rec_size)
{ {
if (m_rec_no >= 8190) {
ut_ad(srv_page_size == 65536);
return false;
}
ulint slot_size; ulint slot_size;
ulint required_space; ulint required_space;

View File

@ -335,7 +335,7 @@ static int mrn_change_encoding(grn_ctx *ctx, const CHARSET_INFO *charset)
return mrn::encoding::set(ctx, charset); return mrn::encoding::set(ctx, charset);
} }
#if !defined(DBUG_OFF) && !defined(_lint) #if defined DBUG_TRACE && !defined(_lint)
static const char *mrn_inspect_thr_lock_type(enum thr_lock_type lock_type) static const char *mrn_inspect_thr_lock_type(enum thr_lock_type lock_type)
{ {
const char *inspected = "<unknown>"; const char *inspected = "<unknown>";
@ -3381,16 +3381,16 @@ int ha_mroonga::wrapper_create_index(const char *name, TABLE *table,
index_tables, NULL, tmp_share); index_tables, NULL, tmp_share);
} }
} }
}
if (error) { if (error) {
for (uint j = 0; j < i; j++) { for (uint j = 0; j < i; j++) {
if (index_tables[j]) { if (index_tables[j]) {
grn_obj_remove(ctx, index_tables[j]); grn_obj_remove(ctx, index_tables[j]);
}
} }
grn_obj_remove(ctx, grn_table);
grn_table = NULL;
} }
grn_obj_remove(ctx, grn_table);
grn_table = NULL;
} }
MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables);
DBUG_RETURN(error); DBUG_RETURN(error);

View File

@ -828,8 +828,8 @@ grn_free_default(grn_ctx *ctx, void *ptr,
if (ptr) { if (ptr) {
GRN_ADD_ALLOC_COUNT(-1); GRN_ADD_ALLOC_COUNT(-1);
} else { } else {
GRN_LOG(ctx, GRN_LOG_ALERT, "free fail (%p) (%s:%d) <%d>", GRN_LOG(ctx, GRN_LOG_ALERT, "free fail (%s:%d) <%d>",
ptr, file, line, alloc_count); file, line, alloc_count);
} }
} }
} }

View File

@ -3591,53 +3591,51 @@ grn_obj_search_column_index_by_key(grn_ctx *ctx, grn_obj *obj,
if (need_cast) { if (need_cast) {
GRN_OBJ_INIT(&casted_query, GRN_BULK, 0, key_type); GRN_OBJ_INIT(&casted_query, GRN_BULK, 0, key_type);
rc = grn_obj_cast(ctx, query, &casted_query, GRN_FALSE); rc = grn_obj_cast(ctx, query, &casted_query, GRN_FALSE);
if (rc == GRN_SUCCESS) { if (rc != GRN_SUCCESS)
key = GRN_BULK_HEAD(&casted_query); goto fail;
key_len = GRN_BULK_VSIZE(&casted_query); query = &casted_query;
}
} else {
rc = GRN_SUCCESS;
key = GRN_BULK_HEAD(query);
key_len = GRN_BULK_VSIZE(query);
} }
if (rc == GRN_SUCCESS) {
if (grn_logger_pass(ctx, GRN_REPORT_INDEX_LOG_LEVEL)) { key = GRN_BULK_HEAD(query);
const char *tag; key_len = GRN_BULK_VSIZE(query);
if (optarg) {
switch (optarg->mode) { if (grn_logger_pass(ctx, GRN_REPORT_INDEX_LOG_LEVEL)) {
case GRN_OP_MATCH : const char *tag;
tag = "[key][match]"; if (optarg) {
break; switch (optarg->mode) {
case GRN_OP_EXACT : case GRN_OP_MATCH :
tag = "[key][exact]"; tag = "[key][match]";
break; break;
case GRN_OP_NEAR : case GRN_OP_EXACT :
tag = "[key][near]";
break;
case GRN_OP_NEAR2 :
tag = "[key][near2]";
break;
case GRN_OP_SIMILAR :
tag = "[key][similar]";
break;
case GRN_OP_REGEXP :
tag = "[key][regexp]";
break;
case GRN_OP_FUZZY :
tag = "[key][fuzzy]";
break;
default :
tag = "[key][unknown]";
break;
}
} else {
tag = "[key][exact]"; tag = "[key][exact]";
break;
case GRN_OP_NEAR :
tag = "[key][near]";
break;
case GRN_OP_NEAR2 :
tag = "[key][near2]";
break;
case GRN_OP_SIMILAR :
tag = "[key][similar]";
break;
case GRN_OP_REGEXP :
tag = "[key][regexp]";
break;
case GRN_OP_FUZZY :
tag = "[key][fuzzy]";
break;
default :
tag = "[key][unknown]";
break;
} }
grn_obj_search_index_report(ctx, tag, obj); } else {
tag = "[key][exact]";
} }
rc = grn_ii_sel(ctx, (grn_ii *)obj, key, key_len, grn_obj_search_index_report(ctx, tag, obj);
(grn_hash *)res, op, optarg);
} }
rc = grn_ii_sel(ctx, (grn_ii *)obj, key, key_len,
(grn_hash *)res, op, optarg);
fail:
if (need_cast) { if (need_cast) {
GRN_OBJ_FIN(ctx, &casted_query); GRN_OBJ_FIN(ctx, &casted_query);
} }

View File

@ -860,6 +860,13 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
/* purecov: end */ /* purecov: end */
} }
} }
DBUG_EXECUTE_IF("key",
Debug_key_myisam::print_keys_myisam(table->in_use,
"ha_myisam::open: ",
table, file->s->keyinfo,
file->s->base.keys);
);
if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE)) if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE))
(void) mi_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0); (void) mi_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0);

View File

@ -34,8 +34,10 @@ SCHEMA="wsrep"
MEMB_TABLE="$SCHEMA.membership" MEMB_TABLE="$SCHEMA.membership"
STATUS_TABLE="$SCHEMA.status" STATUS_TABLE="$SCHEMA.status"
BEGIN=" WSREP_ON='SET wsrep_on=ON'
SET wsrep_on=0; WSREP_OFF='SET wsrep_on=OFF'
BEGIN="$WSREP_OFF;
DROP SCHEMA IF EXISTS $SCHEMA; CREATE SCHEMA $SCHEMA; DROP SCHEMA IF EXISTS $SCHEMA; CREATE SCHEMA $SCHEMA;
CREATE TABLE $MEMB_TABLE ( CREATE TABLE $MEMB_TABLE (
idx INT UNIQUE PRIMARY KEY, idx INT UNIQUE PRIMARY KEY,
@ -50,9 +52,8 @@ CREATE TABLE $STATUS_TABLE (
uuid CHAR(40), /* cluster UUID */ uuid CHAR(40), /* cluster UUID */
prim BOOLEAN /* if component is primary */ prim BOOLEAN /* if component is primary */
) ENGINE=MEMORY; ) ENGINE=MEMORY;
BEGIN; BEGIN"
" END="COMMIT; $WSREP_ON"
END="COMMIT;"
configuration_change() configuration_change()
{ {
@ -71,12 +72,12 @@ configuration_change()
echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);" echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);"
echo "$END" echo "$END;"
} }
status_update() status_update()
{ {
echo "SET wsrep_on=0; BEGIN; UPDATE $STATUS_TABLE SET status='$STATUS'; COMMIT;" echo "$WSREP_OFF; BEGIN; UPDATE $STATUS_TABLE SET status='$STATUS'; $END;"
} }
trim_string() trim_string()
@ -186,10 +187,14 @@ then
fi fi
fi fi
# Undefined means node is shutting down case "$STATUS" in
if [ "$STATUS" != 'Undefined' ]; then 'joined' | 'donor' | 'synced')
"$COM" | eval "$CLIENT" -B "-u'$USER'"${PSWD:+" -p'$PSWD'"}\ "$COM" | eval "$CLIENT" -B "-u'$USER'"${PSWD:+" -p'$PSWD'"}\
"-h'$HOST'" "-P$PORT"$SSL_PARAM "-h'$HOST'" "-P$PORT"$SSL_PARAM
fi ;;
*)
# The node might be shutting down or not initialized
;;
esac
exit 0 exit 0