diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 14f1d7a981c..f039f110629 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -2852,6 +2852,7 @@ do_result_format_version(struct st_command *command) dynstr_append_mem(&ds_res, ds_version.str, ds_version.length); dynstr_append_mem(&ds_res, STRING_WITH_LEN("\n")); dynstr_free(&ds_version); + DBUG_VOID_RETURN; } diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result index a5b0f67c0aa..6bf3a7dcc44 100644 --- a/mysql-test/main/long_unique_bugs.result +++ b/mysql-test/main/long_unique_bugs.result @@ -770,4 +770,42 @@ alter table t1 add constraint constraint_1 unique (a); Warnings: Note 1831 Duplicate index `constraint_1`. This is deprecated and will be disallowed in a future release drop table t1; +# +# MDEV-33675 assertion(reclength < vreclength) in setup_vcols_for_repair() +# +create table t (c1 bit, unique key(c1) using hash) engine=myisam; +insert into t values (0); +check table t; +Table Op Msg_type Msg_text +test.t check status OK +insert into t values(); +select cast(c1 as unsigned) c1 from t; +c1 +0 +NULL +drop table t; +create table t1 (c1 bit, c2 long as (c1) virtual, c3 char(10), +c4 long as (c1) stored) engine=myisam; +insert into t1 (c1, c3) values (1, "a"); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +insert into t1 values(); +select hex(c1), hex(c2), c3, hex(c4) from t1; +hex(c1) hex(c2) c3 hex(c4) +1 01 a 01 +NULL NULL NULL NULL +drop table t1; +create table t1 (c1 bit, c2 long as (c1) virtual, c3 char(10), +c4 long as (c1) stored) engine=aria; +insert into t1 (c1, c3) values (1, "a"); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +insert into t1 values(); +select hex(c1), hex(c2), c3, hex(c4) from t1; +hex(c1) hex(c2) c3 hex(c4) +1 01 a 01 +NULL NULL NULL NULL +drop table t1; # End of 10.5 tests diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index e2fec78b151..e1fa39e922b 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -745,4 +745,30 @@ create table t1 (a blob unique); alter table t1 add constraint constraint_1 unique (a); drop table t1; +--echo # +--echo # MDEV-33675 assertion(reclength < vreclength) in setup_vcols_for_repair() +--echo # +create table t (c1 bit, unique key(c1) using hash) engine=myisam; +insert into t values (0); +check table t; +insert into t values(); +select cast(c1 as unsigned) c1 from t; +drop table t; + +create table t1 (c1 bit, c2 long as (c1) virtual, c3 char(10), + c4 long as (c1) stored) engine=myisam; +insert into t1 (c1, c3) values (1, "a"); +check table t1; +insert into t1 values(); +select hex(c1), hex(c2), c3, hex(c4) from t1; +drop table t1; + +create table t1 (c1 bit, c2 long as (c1) virtual, c3 char(10), + c4 long as (c1) stored) engine=aria; +insert into t1 (c1, c3) values (1, "a"); +check table t1; +insert into t1 values(); +select hex(c1), hex(c2), c3, hex(c4) from t1; +drop table t1; + --echo # End of 10.5 tests diff --git a/mysql-test/suite/galera/r/MDEV-29142.result b/mysql-test/suite/galera/r/MDEV-29142.result index 370cbf5b074..ce214492b29 100644 --- a/mysql-test/suite/galera/r/MDEV-29142.result +++ b/mysql-test/suite/galera/r/MDEV-29142.result @@ -42,4 +42,8 @@ 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"); +connection node_1; +call mtr.add_suppression("WSREP: Cert position .* less than last committed"); +connection node_2; +call mtr.add_suppression("WSREP: Cert position .* less than last committed"); DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_delete.result b/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_delete.result new file mode 100644 index 00000000000..4199fdcd011 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_delete.result @@ -0,0 +1,362 @@ +connection node_2; +connection node_1; +# +# 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and DELETE on t1 +# with foreign key references as below: +# - t1<-t2<-t3<-t4 +# - t3<-t5 +# - t2<-t6 +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +t5_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE, +KEY key_t5_id(t5_id) +); +CREATE TABLE t3 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id(t2_id), +CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t4 ( +id INT PRIMARY KEY, +t3_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t3_id(t3_id), +CONSTRAINT key_t3_id FOREIGN KEY (t3_id) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t5 ( +id INT PRIMARY KEY, +t3_id_1 INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t3_id_1(t3_id_1), +CONSTRAINT key_t3_id_1 FOREIGN KEY (t3_id_1) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t6 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id_1(t2_id), +CONSTRAINT key_t2_id_1 FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); +INSERT INTO t2 VALUES (1,1,1,1234); +INSERT INTO t2 VALUES (2,2,2,1234); +INSERT INTO t3 VALUES (1,1,1234); +INSERT INTO t3 VALUES (2,2,1234); +INSERT INTO t4 VALUES (1,1,1234); +INSERT INTO t4 VALUES (2,2,1234); +INSERT INTO t5 VALUES (1,1,1234); +INSERT INTO t5 VALUES (2,2,1234); +ALTER TABLE t2 ADD CONSTRAINT key_t5_id FOREIGN KEY (t5_id) +REFERENCES t5 (id) ON UPDATE CASCADE ON DELETE CASCADE; +connection node_1; +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +DROP TABLE t6; +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +DELETE FROM t1 WHERE id = 3; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 4 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +include/assert_grep.inc [Foreign key referenced table found: test.t4] +include/assert_grep.inc [Foreign key referenced table found: test.t5] +connection node_2; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id t5_id f2 +1 1 1 1234 +2 2 2 1234 +select * from t3; +id t2_id f2 +1 1 1234 +2 2 1234 +select * from t4; +id t3_id f2 +1 1 1234 +2 2 1234 +select * from t5; +id t3_id_1 f2 +1 1 1234 +2 2 1234 +select * from t6; +ERROR 42S02: Table 'test.t6' doesn't exist +connection node_1; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id t5_id f2 +1 1 1 1234 +2 2 2 1234 +select * from t3; +id t2_id f2 +1 1 1234 +2 2 1234 +select * from t4; +id t3_id f2 +1 1 1234 +2 2 1234 +select * from t5; +id t3_id_1 f2 +1 1 1234 +2 2 1234 +select * from t6; +ERROR 42S02: Table 'test.t6' doesn't exist +ALTER TABLE t2 DROP FOREIGN KEY key_t5_id; +DROP TABLE t5, t4, t3, t2, t1; +# +# 2. BF-BF conflict on MDL locks between: +# ALTER TABLE t3 (whose parent table are t3 -> t2 -> t1), and +# DELETE on t1 with t2 referencing t1, and t3 referencing t2. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t3 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id(t2_id) +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +ALTER TABLE t3 ADD CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE; +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +DELETE FROM t1 WHERE id = 3; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 2 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +connection node_2; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +connection node_1; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +DROP TABLE t3, t2, t1; +# +# 3. BF-BF conflict on MDL locks between: +# CREATE TABLE t3 (whose parent table are t3 -> t2 -> t1), and +# DELETE on t1 with t2 referencing t1, and t3 referencing t2. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT NOT NULL, f2 INTEGER NOT NULL, KEY key_t2_id(t2_id), CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE); +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +DELETE FROM t1 WHERE id = 3; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 2 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +connection node_2; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +connection node_1; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +DROP TABLE t3, t2, t1; +# +# 4. BF-BF conflict on MDL locks between: +# OPTIMIZE TABLE t2 (whose parent table are t2 -> t1), and +# DELETE on t1. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize note Table does not support optimize, doing recreate + analyze instead +test.t2 optimize status OK +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +DELETE FROM t1 WHERE id = 3; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 1 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +connection node_2; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +connection node_1; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +DROP TABLE t2, t1; diff --git a/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_update.result b/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_update.result new file mode 100644 index 00000000000..9c8a34e7dd7 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_update.result @@ -0,0 +1,358 @@ +connection node_2; +connection node_1; +# +# 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and UPDATE on t1 +# with foreign key references as below: +# - t1<-t2<-t3<-t4 +# - t3<-t5 +# - t2<-t6 +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +t5_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE, +KEY key_t5_id(t5_id) +); +CREATE TABLE t3 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id(t2_id), +CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t4 ( +id INT PRIMARY KEY, +t3_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t3_id(t3_id), +CONSTRAINT key_t3_id FOREIGN KEY (t3_id) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t5 ( +id INT PRIMARY KEY, +t3_id_1 INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t3_id_1(t3_id_1), +CONSTRAINT key_t3_id_1 FOREIGN KEY (t3_id_1) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t6 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id_1(t2_id), +CONSTRAINT key_t2_id_1 FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t2 VALUES (1,1,1,1234); +INSERT INTO t2 VALUES (2,2,2,1234); +INSERT INTO t3 VALUES (1,1,1234); +INSERT INTO t3 VALUES (2,2,1234); +INSERT INTO t4 VALUES (1,1,1234); +INSERT INTO t4 VALUES (2,2,1234); +INSERT INTO t5 VALUES (1,1,1234); +INSERT INTO t5 VALUES (2,2,1234); +ALTER TABLE t2 ADD CONSTRAINT key_t5_id FOREIGN KEY (t5_id) +REFERENCES t5 (id) ON UPDATE CASCADE ON DELETE CASCADE; +connection node_1; +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +DROP TABLE t6; +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +UPDATE t1 SET f2 = 1 WHERE id=2; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 4 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +include/assert_grep.inc [Foreign key referenced table found: test.t4] +include/assert_grep.inc [Foreign key referenced table found: test.t5] +connection node_2; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id t5_id f2 +1 1 1 1234 +2 2 2 1234 +select * from t3; +id t2_id f2 +1 1 1234 +2 2 1234 +select * from t4; +id t3_id f2 +1 1 1234 +2 2 1234 +select * from t5; +id t3_id_1 f2 +1 1 1234 +2 2 1234 +select * from t6; +ERROR 42S02: Table 'test.t6' doesn't exist +connection node_1; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id t5_id f2 +1 1 1 1234 +2 2 2 1234 +select * from t3; +id t2_id f2 +1 1 1234 +2 2 1234 +select * from t4; +id t3_id f2 +1 1 1234 +2 2 1234 +select * from t5; +id t3_id_1 f2 +1 1 1234 +2 2 1234 +select * from t6; +ERROR 42S02: Table 'test.t6' doesn't exist +ALTER TABLE t2 DROP FOREIGN KEY key_t5_id; +DROP TABLE t5, t4, t3, t2, t1; +# +# 2. BF-BF conflict on MDL locks between: +# ALTER TABLE t3 (whose parent table are t3 -> t2 -> t1), and +# UPDATE on t1 with t2 referencing t1, and t3 referencing t2. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t3 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id(t2_id) +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +ALTER TABLE t3 ADD CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE; +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +UPDATE t1 SET f2 = 1 WHERE id=2; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 2 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +connection node_2; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +connection node_1; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +DROP TABLE t3, t2, t1; +# +# 3. BF-BF conflict on MDL locks between: +# CREATE TABLE t3 (whose parent table are t3 -> t2 -> t1), and +# UPDATE on t1 with t2 referencing t1, and t3 referencing t2. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT NOT NULL, f2 INTEGER NOT NULL, KEY key_t2_id(t2_id), CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE); +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +UPDATE t1 SET f2 = 1 WHERE id=2; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 2 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +connection node_2; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +connection node_1; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +DROP TABLE t3, t2, t1; +# +# 4. BF-BF conflict on MDL locks between: +# OPTIMIZE TABLE t2 (whose parent table are t2 -> t1), and +# UPDATE on t1. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize note Table does not support optimize, doing recreate + analyze instead +test.t2 optimize status OK +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +UPDATE t1 SET f2 = 1 WHERE id=2; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 1 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +connection node_2; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +connection node_1; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +DROP TABLE t2, t1; diff --git a/mysql-test/suite/galera/t/MDEV-29142.test b/mysql-test/suite/galera/t/MDEV-29142.test index 2dc48a74a9d..d0d886ff490 100644 --- a/mysql-test/suite/galera/t/MDEV-29142.test +++ b/mysql-test/suite/galera/t/MDEV-29142.test @@ -53,16 +53,26 @@ SET SESSION wsrep_sync_wait = 0; --let $start_mysqld_params =--wsrep-new-cluster --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/start_mysqld.inc +--source include/wait_until_ready.inc --connection node_2 --let $start_mysqld_params = --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --source include/start_mysqld.inc +--source include/wait_until_ready.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"); +--connection node_1 +# +# after the membership change on a newly synced node, then this is just a warning +# +call mtr.add_suppression("WSREP: Cert position .* less than last committed"); +--connection node_2 +call mtr.add_suppression("WSREP: Cert position .* less than last committed"); + # # Cleanup # diff --git a/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_delete.test b/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_delete.test new file mode 100644 index 00000000000..b1c3e6d5352 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_delete.test @@ -0,0 +1,452 @@ +# +# BF-BF conflict on MDL locks between DDL and delete query +# when multi-level foreign key like t3 -> t2 -> t1 +# are present. +# +# If bug is present, expect the wait condition +# to timeout and when the DELETE applies, it +# will be granted a MDL lock of type SHARED_READ +# for table t1. When resumed, the DROP TABLE will +# also try to MDL lock t1, causing a BF-BF conflict +# on that MDL lock. + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--echo # +--echo # 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and DELETE on t1 +--echo # with foreign key references as below: +--echo # - t1<-t2<-t3<-t4 +--echo # - t3<-t5 +--echo # - t2<-t6 +--echo # + + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + t5_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE, + KEY key_t5_id(t5_id) +); + +CREATE TABLE t3 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id(t2_id), + CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t4 ( + id INT PRIMARY KEY, + t3_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t3_id(t3_id), + CONSTRAINT key_t3_id FOREIGN KEY (t3_id) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t5 ( + id INT PRIMARY KEY, + t3_id_1 INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t3_id_1(t3_id_1), + CONSTRAINT key_t3_id_1 FOREIGN KEY (t3_id_1) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t6 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id_1(t2_id), + CONSTRAINT key_t2_id_1 FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); + +INSERT INTO t2 VALUES (1,1,1,1234); +INSERT INTO t2 VALUES (2,2,2,1234); + +INSERT INTO t3 VALUES (1,1,1234); +INSERT INTO t3 VALUES (2,2,1234); + +INSERT INTO t4 VALUES (1,1,1234); +INSERT INTO t4 VALUES (2,2,1234); + +INSERT INTO t5 VALUES (1,1,1234); +INSERT INTO t5 VALUES (2,2,1234); + +ALTER TABLE t2 ADD CONSTRAINT key_t5_id FOREIGN KEY (t5_id) +REFERENCES t5 (id) ON UPDATE CASCADE ON DELETE CASCADE; + +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME = "t2" AND CONSTRAINT_TYPE = "FOREIGN KEY" AND CONSTRAINT_NAME="key_t5_id" +--source include/wait_condition.inc + + +--let $fk_parent_query = DROP TABLE t6 +--let $fk_child_query = DELETE FROM t1 WHERE id = 3 +--let $fk_mdl_lock_num = 5 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 4 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 4 +--let assert_select= Foreign key referenced table found: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t4 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t4 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t5 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t5 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + + +# +# Verify delete and drop table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1 +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; +select * from t4; +select * from t5; +--error ER_NO_SUCH_TABLE +select * from t6; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; +select * from t4; +select * from t5; +--error ER_NO_SUCH_TABLE +select * from t6; + + +# +# Cleanup +# +ALTER TABLE t2 DROP FOREIGN KEY key_t5_id; +DROP TABLE t5, t4, t3, t2, t1; + + +--echo # +--echo # 2. BF-BF conflict on MDL locks between: +--echo # ALTER TABLE t3 (whose parent table are t3 -> t2 -> t1), and +--echo # DELETE on t1 with t2 referencing t1, and t3 referencing t2. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t3 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id(t2_id) +); + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +# +# ALTER TABLE t3 and wait for it to reach node_2 +# +--let $fk_parent_query = ALTER TABLE t3 ADD CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +# +# Issue a DELETE to table that references t1 +# +--let $fk_child_query = DELETE FROM t1 WHERE id = 3 +--let $fk_mdl_lock_num = 3 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 2 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 6 +--let assert_select= Foreign key referenced table found: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 2 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 2 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + + +# +# Verify delete and alter table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1 +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; + + +# +# Cleanup +# +DROP TABLE t3, t2, t1; + + +--echo # +--echo # 3. BF-BF conflict on MDL locks between: +--echo # CREATE TABLE t3 (whose parent table are t3 -> t2 -> t1), and +--echo # DELETE on t1 with t2 referencing t1, and t3 referencing t2. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +--let $fk_parent_query = CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT NOT NULL, f2 INTEGER NOT NULL, KEY key_t2_id(t2_id), CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE) +--let $fk_child_query = DELETE FROM t1 WHERE id = 3 +--let $fk_mdl_lock_num = 3 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 2 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 8 +--let assert_select= Foreign key referenced table found: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 3 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 3 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + + +# +# Verify delete and create table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1 +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; + + +# +# Cleanup +# +DROP TABLE t3, t2, t1; + + +--echo # +--echo # 4. BF-BF conflict on MDL locks between: +--echo # OPTIMIZE TABLE t2 (whose parent table are t2 -> t1), and +--echo # DELETE on t1. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +--let $fk_parent_query = OPTIMIZE TABLE t2 +--let $fk_child_query = DELETE FROM t1 WHERE id = 3 +--let $fk_mdl_lock_num = 2 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 1 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 9 +--let assert_select= Foreign key referenced table found: +--let $assert_only_after = CURRENT_TEST: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 4 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + + +# +# Verify delete and create table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1 +--source include/wait_condition.inc + + +select * from t1; +select * from t2; + +--connection node_1 +select * from t1; +select * from t2; + + +# +# Cleanup +# +DROP TABLE t2, t1; diff --git a/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_update.test b/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_update.test new file mode 100644 index 00000000000..1dea0021901 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_update.test @@ -0,0 +1,451 @@ +# +# BF-BF conflict on MDL locks between DDL and update query +# when multi-level foreign key like t3 -> t2 -> t1 +# are present. +# +# If bug is present, expect the wait condition +# to timeout and when the UPDATE applies, it +# will be granted a MDL lock of type SHARED_READ +# for table t1. When resumed, the DROP TABLE will +# also try to MDL lock t1, causing a BF-BF conflict +# on that MDL lock. + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--echo # +--echo # 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and UPDATE on t1 +--echo # with foreign key references as below: +--echo # - t1<-t2<-t3<-t4 +--echo # - t3<-t5 +--echo # - t2<-t6 +--echo # + + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + t5_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE, + KEY key_t5_id(t5_id) +); + +CREATE TABLE t3 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id(t2_id), + CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t4 ( + id INT PRIMARY KEY, + t3_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t3_id(t3_id), + CONSTRAINT key_t3_id FOREIGN KEY (t3_id) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t5 ( + id INT PRIMARY KEY, + t3_id_1 INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t3_id_1(t3_id_1), + CONSTRAINT key_t3_id_1 FOREIGN KEY (t3_id_1) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t6 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id_1(t2_id), + CONSTRAINT key_t2_id_1 FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); + +INSERT INTO t2 VALUES (1,1,1,1234); +INSERT INTO t2 VALUES (2,2,2,1234); + +INSERT INTO t3 VALUES (1,1,1234); +INSERT INTO t3 VALUES (2,2,1234); + +INSERT INTO t4 VALUES (1,1,1234); +INSERT INTO t4 VALUES (2,2,1234); + +INSERT INTO t5 VALUES (1,1,1234); +INSERT INTO t5 VALUES (2,2,1234); + +ALTER TABLE t2 ADD CONSTRAINT key_t5_id FOREIGN KEY (t5_id) +REFERENCES t5 (id) ON UPDATE CASCADE ON DELETE CASCADE; + +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME = "t2" AND CONSTRAINT_TYPE = "FOREIGN KEY" AND CONSTRAINT_NAME="key_t5_id" +--source include/wait_condition.inc + + +--let $fk_parent_query = DROP TABLE t6 +--let $fk_child_query = UPDATE t1 SET f2 = 1 WHERE id=2 +--let $fk_mdl_lock_num = 5 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 4 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 4 +--let assert_select= Foreign key referenced table found: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t4 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t4 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t5 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t5 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + + +# +# Verify update and drop table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1 where id=2 and f2=1; +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; +select * from t4; +select * from t5; +--error ER_NO_SUCH_TABLE +select * from t6; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; +select * from t4; +select * from t5; +--error ER_NO_SUCH_TABLE +select * from t6; + + +# +# Cleanup +# +ALTER TABLE t2 DROP FOREIGN KEY key_t5_id; +DROP TABLE t5, t4, t3, t2, t1; + + +--echo # +--echo # 2. BF-BF conflict on MDL locks between: +--echo # ALTER TABLE t3 (whose parent table are t3 -> t2 -> t1), and +--echo # UPDATE on t1 with t2 referencing t1, and t3 referencing t2. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t3 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id(t2_id) +); + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +# +# ALTER TABLE t3 and wait for it to reach node_2 +# +--let $fk_parent_query = ALTER TABLE t3 ADD CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +# +# Issue a UPDATE to table that references t1 +# Notice that we update field f2, not the primary key, +# and not foreign key. Bug does not manifest if we update +# one of those fields (because FK keys appended in those cases). +# +--let $fk_child_query = UPDATE t1 SET f2 = 1 WHERE id=2 +--let $fk_mdl_lock_num = 3 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 2 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 6 +--let assert_select= Foreign key referenced table found: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 2 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 2 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + + +# +# Verify update and drop table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1 where id=2 and f2=1; +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; + + +# +# Cleanup +# +DROP TABLE t3, t2, t1; + + +--echo # +--echo # 3. BF-BF conflict on MDL locks between: +--echo # CREATE TABLE t3 (whose parent table are t3 -> t2 -> t1), and +--echo # UPDATE on t1 with t2 referencing t1, and t3 referencing t2. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +--let $fk_parent_query = CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT NOT NULL, f2 INTEGER NOT NULL, KEY key_t2_id(t2_id), CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE) +--let $fk_child_query = UPDATE t1 SET f2 = 1 WHERE id=2 +--let $fk_mdl_lock_num = 3 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 2 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 8 +--let assert_select= Foreign key referenced table found: +--let $assert_only_after = CURRENT_TEST: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 3 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 3 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + + +# +# Verify update and drop table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1 where id=2 and f2=1; +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; + + +# +# Cleanup +# +DROP TABLE t3, t2, t1; + + +--echo # +--echo # 4. BF-BF conflict on MDL locks between: +--echo # OPTIMIZE TABLE t2 (whose parent table are t2 -> t1), and +--echo # UPDATE on t1. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +--let $fk_parent_query = OPTIMIZE TABLE t2 +--let $fk_child_query = UPDATE t1 SET f2 = 1 WHERE id=2 +--let $fk_mdl_lock_num = 2 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 1 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 9 +--let assert_select= Foreign key referenced table found: +--let $assert_only_after = CURRENT_TEST: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 4 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + + +# +# Verify update has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1 where id=2 and f2=1; +--source include/wait_condition.inc + +select * from t1; +select * from t2; + +--connection node_1 +select * from t1; +select * from t2; + + +# +# Cleanup +# +DROP TABLE t2, t1; diff --git a/mysql-test/suite/galera/t/galera_multi_level_foreign_key.inc b/mysql-test/suite/galera/t/galera_multi_level_foreign_key.inc new file mode 100644 index 00000000000..598019b0a43 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_multi_level_foreign_key.inc @@ -0,0 +1,60 @@ +# +# Execute parent query on node_1 and wait for it to reach node_2 +# +--connection node_2 +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; + +--connection node_1 +--eval $fk_parent_query + +--connection node_2 +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; + +SET SESSION wsrep_sync_wait = 0; +--let $expected_apply_waits = query_get_value("SHOW STATUS LIKE 'wsrep_apply_waits'", Value, 1) +--let $expected_apply_waits = `select $expected_apply_waits + 1` + + +# +# Execute child query on node_1. +# If bug is present, expect the wait condition +# to timeout and when the child query applies, it +# will be granted a MDL lock on parent table. +# When resumed, the parent query will +# also try to acquire MDL lock on parent table, +# causing a BF-BF conflict on that MDL lock. +# +--connection node_1 +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +--eval $fk_child_query +--let $wait_condition = SELECT COUNT(*) = $fk_mdl_lock_num FROM performance_schema.metadata_locks WHERE OBJECT_SCHEMA='test' AND LOCK_STATUS="GRANTED" +--source include/wait_condition.inc +COMMIT; + + +# +# Expect the child query to depend on the parent query, +# therefore it should wait for the parent query to +# finish before it can be applied. +# +--connection node_2 +--let $status_var = wsrep_apply_waits +--let $status_var_value = $expected_apply_waits +--source include/wait_for_status_var.inc + +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; + + +# +# Cleanup +# +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; + +--connection node_1 +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test index 9836aaa57ef..cc65e6bda9d 100644 --- a/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test +++ b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test @@ -61,6 +61,8 @@ SET SESSION wsrep_sync_wait=0; --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; --source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1001 FROM t1; +--source include/wait_condition.inc SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; @@ -72,6 +74,8 @@ SELECT COUNT(*) AS EXPECT_1001 FROM t1; --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; --source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1001 FROM t1; +--source include/wait_condition.inc SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; diff --git a/mysql-test/suite/galera_3nodes/r/GCF-354.result b/mysql-test/suite/galera_3nodes/r/GCF-354.result index 3fdd44fe9d3..cbf4e8fb147 100644 --- a/mysql-test/suite/galera_3nodes/r/GCF-354.result +++ b/mysql-test/suite/galera_3nodes/r/GCF-354.result @@ -47,9 +47,13 @@ CALL mtr.add_suppression("Slave SQL: Error 'Unknown database 'test'' on query\\. CALL mtr.add_suppression("Query apply failed"); CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +CALL mtr.add_suppression("WSREP: Cert position .* less than last committed"); +CALL mtr.add_suppression("WSREP: Sending JOIN failed: "); connection node_3; Node 3 synced CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\\. Default database: 'test'\\. Query: 'CREATE TABLE test\\.t1 \\(f1 INTEGER\\)', Error_code: 1050"); CALL mtr.add_suppression("Query apply failed"); CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +CALL mtr.add_suppression("WSREP: Cert position .* less than last committed"); +CALL mtr.add_suppression("WSREP: Sending JOIN failed: "); diff --git a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result index 2ecd5edfa99..5faa862ddb6 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result +++ b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result @@ -12,10 +12,12 @@ connection node_3; Suspending node ... connection node_1; SET SESSION wsrep_sync_wait=0; +connection node_2; +SET SESSION wsrep_sync_wait=0; +connection node_1; CREATE TABLE t1 (f1 INTEGER) engine=InnoDB; INSERT INTO t1 VALUES (1); connection node_2; -SET SESSION wsrep_sync_wait=0; SET SESSION wsrep_sync_wait = 15; SELECT COUNT(*) FROM t1; COUNT(*) @@ -29,4 +31,5 @@ SELECT COUNT(*) FROM t1; COUNT(*) 1 connection node_1; +connection node_2; DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/t/GCF-354.test b/mysql-test/suite/galera_3nodes/t/GCF-354.test index 44dfa3deeb7..db4f32fccf9 100644 --- a/mysql-test/suite/galera_3nodes/t/GCF-354.test +++ b/mysql-test/suite/galera_3nodes/t/GCF-354.test @@ -92,6 +92,8 @@ CALL mtr.add_suppression("Slave SQL: Error 'Unknown database 'test'' on query\\. CALL mtr.add_suppression("Query apply failed"); CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +CALL mtr.add_suppression("WSREP: Cert position .* less than last committed"); +CALL mtr.add_suppression("WSREP: Sending JOIN failed: "); --connection node_3 --let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' @@ -101,5 +103,7 @@ CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\ CALL mtr.add_suppression("Query apply failed"); CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +CALL mtr.add_suppression("WSREP: Cert position .* less than last committed"); +CALL mtr.add_suppression("WSREP: Sending JOIN failed: "); --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.cnf b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.cnf new file mode 100644 index 00000000000..bc8942624d2 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.cnf @@ -0,0 +1,4 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-debug=1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test index c36cce61f23..0b270385d24 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test +++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test @@ -43,6 +43,12 @@ SET SESSION wsrep_sync_wait=0; --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc +--connection node_2 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_1 --disable_query_log --eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node1'; --enable_query_log @@ -52,10 +58,6 @@ CREATE TABLE t1 (f1 INTEGER) engine=InnoDB; INSERT INTO t1 VALUES (1); --connection node_2 -SET SESSION wsrep_sync_wait=0; ---let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ---source include/wait_condition.inc - --disable_query_log --eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node2'; --enable_query_log @@ -86,6 +88,10 @@ SELECT COUNT(*) FROM t1; --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + DROP TABLE t1; # Restore original auto_increment_offset values. diff --git a/mysql-test/suite/innodb/r/alter_temp_fail.result b/mysql-test/suite/innodb/r/alter_temp_fail.result new file mode 100644 index 00000000000..f6e62328bbe --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_temp_fail.result @@ -0,0 +1,25 @@ +# +# MDEV-36017 Alter table aborts when temporary +# directory is full +# +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100), +f3 CHAR(100))ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, 'a', 'b' FROM seq_1_to_4096; +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD KEY(f1), ADD INDEX(f3(10)); +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 SELECT * FROM t1; +SET STATEMENT DEBUG_DBUG="+d,os_file_write_fail" FOR COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR HY000: Temporary file write failure +disconnect con1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET STATEMENT DEBUG_DBUG="+d,ddl_log_write_fail" FOR +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/alter_temp_fail.opt b/mysql-test/suite/innodb/t/alter_temp_fail.opt new file mode 100644 index 00000000000..c3f4a891cca --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_temp_fail.opt @@ -0,0 +1 @@ +--innodb_sort_buffer_size=64k diff --git a/mysql-test/suite/innodb/t/alter_temp_fail.test b/mysql-test/suite/innodb/t/alter_temp_fail.test new file mode 100644 index 00000000000..938a3165aaa --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_temp_fail.test @@ -0,0 +1,30 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc +--source include/have_debug.inc +--echo # +--echo # MDEV-36017 Alter table aborts when temporary +--echo # directory is full +--echo # +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100), + f3 CHAR(100))ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, 'a', 'b' FROM seq_1_to_4096; +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +SEND ALTER TABLE t1 ADD KEY(f1), ADD INDEX(f3(10)); + +connect(con1,localhost,root,,,); +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 SELECT * FROM t1; +SET STATEMENT DEBUG_DBUG="+d,os_file_write_fail" FOR COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; + +connection default; +--error ER_TEMP_FILE_WRITE_FAILURE +reap; +disconnect con1; +CHECK TABLE t1; +DROP TABLE t1; + +SET STATEMENT DEBUG_DBUG="+d,ddl_log_write_fail" FOR +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc index 8fca98e0383..61b46f5a26a 100644 --- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc +++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc @@ -1,4 +1,5 @@ --source include/have_perfschema.inc +--source include/have_profiling.inc --source include/word_size.inc --source include/platform.inc --vertical_results diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 84d9e3880dd..30190235805 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -3459,6 +3459,15 @@ insert into t values (1),(2); DELETE from t; drop table t; # +# MDEV-36817 Server crashes in do_mark_index_columns instead of +# ER_DUP_ENTRY on partitioned table +# +create table t (f int, unique(f)) engine=innodb partition by key (f) partitions 2; +insert into t (f) values (1), (3); +update t set f = 0; +ERROR 23000: Duplicate entry '0' for key 'f' +drop table t; +# # End of 10.5 tests # # diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 46851e335ed..def50dfdd17 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -2691,6 +2691,16 @@ insert into t values (1),(2); DELETE from t; drop table t; +--echo # +--echo # MDEV-36817 Server crashes in do_mark_index_columns instead of +--echo # ER_DUP_ENTRY on partitioned table +--echo # +create table t (f int, unique(f)) engine=innodb partition by key (f) partitions 2; +insert into t (f) values (1), (3); +--error ER_DUP_ENTRY +update t set f = 0; +drop table t; + --echo # --echo # End of 10.5 tests --echo # diff --git a/plugin/auth_ed25519/server_ed25519.c b/plugin/auth_ed25519/server_ed25519.c index b789bd34ca4..11e2fb7c03f 100644 --- a/plugin/auth_ed25519/server_ed25519.c +++ b/plugin/auth_ed25519/server_ed25519.c @@ -135,7 +135,7 @@ maria_declare_plugin_end; MYSQL_PLUGIN_EXPORT char *ed25519_password(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, char *result, unsigned long *length, - char *is_null, char *error __attribute__((unused))) + unsigned char *is_null, unsigned char *error __attribute__((unused))) { unsigned char pk[CRYPTO_PUBLICKEYBYTES]; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9164180ea69..dcf2c35365b 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -5081,6 +5081,7 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx, FOREIGN_KEY_INFO *fk; Query_arena *arena, backup; TABLE *table= table_list->table; + bool error= FALSE; if (!table->file->referenced_by_foreign_key()) DBUG_RETURN(FALSE); @@ -5121,10 +5122,24 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx, table_list->belong_to_view, op, &prelocking_ctx->query_tables_last, table_list->for_insert_data); + +#ifdef WITH_WSREP + /* + Append table level shared key for the referenced/foreign table for: + - statement that updates existing rows (UPDATE, multi-update) + - statement that deletes existing rows (DELETE, DELETE_MULTI) + This is done to avoid potential MDL conflicts with concurrent DDLs. + */ + if (wsrep_foreign_key_append(thd, fk)) + { + error= TRUE; + break; + } +#endif // WITH_WSREP } if (arena) thd->restore_active_arena(arena, &backup); - DBUG_RETURN(FALSE); + DBUG_RETURN(error); } /** diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 33cd14ed8c9..f9698cc11a5 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2479,18 +2479,8 @@ static bool check_prepared_statement(Prepared_statement *stmt) } #ifdef WITH_WSREP - if (wsrep_sync_wait(thd, sql_command)) - goto error; - if (!stmt->is_sql_prepare()) - { - wsrep_after_command_before_result(thd); - if (wsrep_current_error(thd)) - { - wsrep_override_error(thd, wsrep_current_error(thd), - wsrep_current_error_status(thd)); - goto error; - } - } + if (wsrep_sync_wait(thd, sql_command)) + goto error; #endif switch (sql_command) { case SQLCOM_REPLACE: @@ -2714,6 +2704,20 @@ static bool check_prepared_statement(Prepared_statement *stmt) default: break; } + +#ifdef WITH_WSREP + if (!stmt->is_sql_prepare()) + { + wsrep_after_command_before_result(thd); + if (wsrep_current_error(thd)) + { + wsrep_override_error(thd, wsrep_current_error(thd), + wsrep_current_error_status(thd)); + goto error; + } + } +#endif + if (res == 0) { if (!stmt->is_sql_prepare()) diff --git a/sql/udf_example.c b/sql/udf_example.c index 14c793ee98a..d87abdc9f1b 100644 --- a/sql/udf_example.c +++ b/sql/udf_example.c @@ -156,33 +156,33 @@ static pthread_mutex_t LOCK_hostname; my_bool metaphon_init(UDF_INIT *initid, UDF_ARGS *args, char *message); void metaphon_deinit(UDF_INIT *initid); char *metaphon(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error); + unsigned long *length, uchar *is_null, uchar *error); my_bool myfunc_double_init(UDF_INIT *, UDF_ARGS *args, char *message); -double myfunc_double(UDF_INIT *initid, UDF_ARGS *args, char *is_null, - char *error); +double myfunc_double(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, + uchar *error); my_bool myfunc_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message); -longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null, - char *error); +longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, + uchar *error); my_bool udf_sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message); void udf_sequence_deinit(UDF_INIT *initid); -longlong udf_sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null, - char *error); +longlong udf_sequence(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, + uchar *error); my_bool avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message ); void avgcost_deinit( UDF_INIT* initid ); -void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); -void avgcost_clear( UDF_INIT* initid, char* is_null, char *error ); -void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); -double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); +void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar *error ); +void avgcost_clear( UDF_INIT* initid, uchar* is_null, uchar *error ); +void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar *error ); +double avgcost( UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar *error ); my_bool avg2_init( UDF_INIT* initid, UDF_ARGS* args, char* message ); void avg2_deinit( UDF_INIT* initid ); -void avg2_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); -void avg2_clear( UDF_INIT* initid, char* is_null, char *error ); -void avg2_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); -void avg2_remove( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); -double avg2( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); +void avg2_reset( UDF_INIT* initid, UDF_ARGS* args, uchar *is_null, uchar *error ); +void avg2_clear( UDF_INIT* initid, uchar* is_null, uchar *error ); +void avg2_add( UDF_INIT* initid, UDF_ARGS* args, uchar *is_null, uchar *error ); +void avg2_remove( UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar *error ); +double avg2( UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar *error ); my_bool is_const_init(UDF_INIT *initid, UDF_ARGS *args, char *message); char *is_const(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long - *length, char *is_null, char *error); + *length, uchar *is_null, uchar *error); /************************************************************************* @@ -292,7 +292,7 @@ static char codes[26] = { char *metaphon(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, char *result, unsigned long *length, - char *is_null, char *error __attribute__((unused))) + uchar *is_null, uchar *error __attribute__((unused))) { const char *word=args->args[0]; const char *w_end; @@ -568,7 +568,7 @@ my_bool myfunc_double_init(UDF_INIT *initid, UDF_ARGS *args, char *message) double myfunc_double(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, - char *is_null, char *error __attribute__((unused))) + uchar *is_null, uchar *error __attribute__((unused))) { unsigned long val = 0; unsigned long v = 0; @@ -607,8 +607,8 @@ double myfunc_double(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, /* This function returns the sum of all arguments */ longlong myfunc_int(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, - char *is_null __attribute__((unused)), - char *error __attribute__((unused))) + uchar *is_null __attribute__((unused)), + uchar *error __attribute__((unused))) { longlong val = 0; uint i; @@ -681,8 +681,8 @@ void udf_sequence_deinit(UDF_INIT *initid) } longlong udf_sequence(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, - char *is_null __attribute__((unused)), - char *error __attribute__((unused))) + uchar *is_null __attribute__((unused)), + uchar *error __attribute__((unused))) { ulonglong val=0; if (args->arg_count) @@ -712,11 +712,11 @@ longlong udf_sequence(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message); void lookup_deinit(UDF_INIT *initid); char *lookup(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *length, char *null_value, char *error); + unsigned long *length, uchar *null_value, uchar *error); my_bool reverse_lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message); void reverse_lookup_deinit(UDF_INIT *initid); char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *length, char *null_value, char *error); + unsigned long *length, uchar *null_value, uchar *error); /**************************************************************************** @@ -750,8 +750,8 @@ void lookup_deinit(UDF_INIT *initid __attribute__((unused))) } char *lookup(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, - char *result, unsigned long *res_length, char *null_value, - char *error __attribute__((unused))) + char *result, unsigned long *res_length, uchar *null_value, + uchar *error __attribute__((unused))) { uint length; char name_buff[256]; @@ -831,7 +831,7 @@ void reverse_lookup_deinit(UDF_INIT *initid __attribute__((unused))) char *reverse_lookup(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, char *result, unsigned long *res_length, - char *null_value, char *error __attribute__((unused))) + uchar *null_value, uchar *error __attribute__((unused))) { #if defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST) char name_buff[256]; @@ -974,7 +974,7 @@ avgcost_deinit( UDF_INIT* initid ) /* This is only for MySQL 4.0 compatibility */ void -avgcost_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message) +avgcost_reset(UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar* message) { avgcost_clear(initid, is_null, message); avgcost_add(initid, args, is_null, message); @@ -983,8 +983,8 @@ avgcost_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message) /* This is needed to get things to work in MySQL 4.1.1 and above */ void -avgcost_clear(UDF_INIT* initid, char* is_null __attribute__((unused)), - char* message __attribute__((unused))) +avgcost_clear(UDF_INIT* initid, uchar* is_null __attribute__((unused)), + uchar* message __attribute__((unused))) { struct avgcost_data* data = (struct avgcost_data*)initid->ptr; data->totalprice= 0.0; @@ -995,8 +995,8 @@ avgcost_clear(UDF_INIT* initid, char* is_null __attribute__((unused)), void avgcost_add(UDF_INIT* initid, UDF_ARGS* args, - char* is_null __attribute__((unused)), - char* message __attribute__((unused))) + uchar* is_null __attribute__((unused)), + uchar* message __attribute__((unused))) { if (args->args[0] && args->args[1]) { @@ -1043,7 +1043,7 @@ avgcost_add(UDF_INIT* initid, UDF_ARGS* args, double avgcost( UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)), - char* is_null, char* error __attribute__((unused))) + uchar* is_null, uchar* error __attribute__((unused))) { struct avgcost_data* data = (struct avgcost_data*)initid->ptr; if (!data->count || !data->totalquantity) @@ -1121,7 +1121,8 @@ avg2_deinit( UDF_INIT* initid ) /* This is only for MySQL 4.0 compatibility */ void -avg2_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message) +avg2_reset(UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, + uchar* message) { avgcost_clear(initid, is_null, message); avgcost_add(initid, args, is_null, message); @@ -1130,8 +1131,8 @@ avg2_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message) /* This is needed to get things to work in MySQL 4.1.1 and above */ void -avg2_clear(UDF_INIT* initid, char* is_null __attribute__((unused)), - char* message __attribute__((unused))) +avg2_clear(UDF_INIT* initid, uchar* is_null __attribute__((unused)), + uchar* message __attribute__((unused))) { struct avg2_data* data = (struct avg2_data*)initid->ptr; data->sum= 0.0; @@ -1141,8 +1142,8 @@ avg2_clear(UDF_INIT* initid, char* is_null __attribute__((unused)), void avg2_add(UDF_INIT* initid, UDF_ARGS* args, - char* is_null __attribute__((unused)), - char* message __attribute__((unused))) + uchar* is_null __attribute__((unused)), + uchar* message __attribute__((unused))) { if (args->args[0] && args->args[1]) { @@ -1158,8 +1159,8 @@ avg2_add(UDF_INIT* initid, UDF_ARGS* args, void avg2_remove(UDF_INIT* initid, UDF_ARGS* args, - char* is_null __attribute__((unused)), - char* message __attribute__((unused))) + uchar* is_null __attribute__((unused)), + uchar* message __attribute__((unused))) { if (args->args[0] && args->args[1]) { @@ -1174,8 +1175,8 @@ avg2_remove(UDF_INIT* initid, UDF_ARGS* args, double -avg2( UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)), - char* is_null, char* error __attribute__((unused))) +avg2(UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)), + uchar* is_null, uchar* error __attribute__((unused))) { struct avg2_data* data = (struct avg2_data*)initid->ptr; if (!data->count) @@ -1191,8 +1192,8 @@ avg2( UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)), my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args, char *message); char *myfunc_argument_name(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *length, char *null_value, - char *error); + unsigned long *length, uchar *null_value, + uchar *error); my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args, char *message) @@ -1210,8 +1211,8 @@ my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args, char *myfunc_argument_name(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, char *result, - unsigned long *length, char *null_value, - char *error __attribute__((unused))) + unsigned long *length, uchar *null_value, + uchar *error __attribute__((unused))) { if (!args->attributes[0]) { @@ -1241,7 +1242,7 @@ my_bool is_const_init(UDF_INIT *initid, UDF_ARGS *args, char *message) char * is_const(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)), char *result, unsigned long *length, - char *is_null, char *error __attribute__((unused))) + uchar *is_null,uchar *error __attribute__((unused))) { if (initid->ptr != 0) { sprintf(result, "const"); @@ -1280,7 +1281,7 @@ my_bool check_const_len_init(UDF_INIT *initid, UDF_ARGS *args, char *message) char * check_const_len(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)), char *result, unsigned long *length, - char *is_null, char *error __attribute__((unused))) + uchar *is_null,uchar *error __attribute__((unused))) { strmov(result, initid->ptr); *length= (uint) strlen(result); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index de94890bd35..ccc55458200 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -4116,3 +4116,36 @@ bool wsrep_table_list_has_non_temp_tables(THD *thd, TABLE_LIST *tables) } return false; } + +bool wsrep_foreign_key_append(THD *thd, FOREIGN_KEY_INFO *fk) +{ + if (WSREP(thd) && !thd->wsrep_applier && + wsrep_is_active(thd) && + (sql_command_flags[thd->lex->sql_command] & + (CF_UPDATES_DATA | CF_DELETES_DATA))) + { + wsrep::key key(wsrep::key::shared); + key.append_key_part(fk->foreign_db->str, fk->foreign_db->length); + key.append_key_part(fk->foreign_table->str, fk->foreign_table->length); + + if (thd->wsrep_cs().append_key(key)) + { + WSREP_ERROR("Appending table key failed: %s", + wsrep_thd_query(thd)); + sql_print_information("Failed Foreign key referenced table found: " + "%s.%s", + fk->foreign_db->str, + fk->foreign_table->str); + return true; + } + + DBUG_EXECUTE_IF( + "wsrep_print_foreign_keys_table", + sql_print_information("Foreign key referenced table found: %s.%s", + fk->foreign_db->str, + fk->foreign_table->str); + ); + } + + return false; +} diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 6cd8d6cea95..e2be203ef27 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -600,6 +600,16 @@ void wsrep_ready_set(bool ready_value); */ bool wsrep_table_list_has_non_temp_tables(THD *thd, TABLE_LIST *tables); +/** + * Append foreign key to wsrep. + * + * @param thd Thread object + * @param fk Foreign Key Info + * + * @return true if error, otherwise false. + */ +bool wsrep_foreign_key_append(THD *thd, FOREIGN_KEY_INFO *fk); + #else /* !WITH_WSREP */ /* These macros are needed to compile MariaDB without WSREP support diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index 2dad053a69c..0d617799a98 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -1973,7 +1973,7 @@ my_bool bsonvalue_init(UDF_INIT* initid, UDF_ARGS* args, char* message) } // end of bsonvalue_init char* bsonvalue(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char*, char*) + unsigned long* res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2015,7 +2015,7 @@ my_bool bson_make_array_init(UDF_INIT* initid, UDF_ARGS* args, char* message) } // end of bson_make_array_init char* bson_make_array(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char*, char*) + unsigned long* res_length, uchar *, uchar *) { char* str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2082,7 +2082,7 @@ my_bool bson_array_add_values_init(UDF_INIT* initid, UDF_ARGS* args, char* messa } // end of bson_array_add_values_init char* bson_array_add_values(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char*) { + unsigned long* res_length, uchar * is_null, uchar *) { char* str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2160,7 +2160,7 @@ my_bool bson_array_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_array_add_init char *bson_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2264,7 +2264,7 @@ my_bool bson_array_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_array_delete_init char *bson_array_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2333,7 +2333,7 @@ my_bool bson_make_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_make_object_init char *bson_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2382,7 +2382,7 @@ my_bool bson_object_nonull_init(UDF_INIT *initid, UDF_ARGS *args, } // end of bson_object_nonull_init char *bson_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2436,7 +2436,7 @@ my_bool bson_object_key_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_object_key_init char *bson_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2505,7 +2505,7 @@ my_bool bson_object_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_object_add_init char *bson_object_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PSZ key; char *str = NULL; @@ -2600,7 +2600,7 @@ my_bool bson_object_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_object_delete_init char *bson_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2679,7 +2679,7 @@ my_bool bson_object_list_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_object_list_init char *bson_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2746,7 +2746,7 @@ my_bool bson_object_values_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_object_values_init char *bson_object_values(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2816,7 +2816,7 @@ my_bool bsonset_def_prec_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonset_def_prec_init -long long bsonset_def_prec(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long bsonset_def_prec(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { long long n = *(long long*)args->args[0]; @@ -2837,7 +2837,7 @@ my_bool bsonget_def_prec_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonget_def_prec_init -long long bsonget_def_prec(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long bsonget_def_prec(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { return (long long)GetJsonDefPrec(); } // end of bsonget_def_prec @@ -2855,7 +2855,7 @@ my_bool bsonset_grp_size_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonset_grp_size_init -long long bsonset_grp_size(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long bsonset_grp_size(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { long long n = *(long long*)args->args[0]; @@ -2876,7 +2876,7 @@ my_bool bsonget_grp_size_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonget_grp_size_init -long long bsonget_grp_size(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long bsonget_grp_size(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { return (long long)GetJsonGroupSize(); } // end of bsonget_grp_size @@ -2910,7 +2910,7 @@ my_bool bson_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return false; } // end of bson_array_grp_init -void bson_array_grp_clear(UDF_INIT *initid, char*, char*) +void bson_array_grp_clear(UDF_INIT *initid, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PBJNX bxp = (PBJNX)((char*)g->Sarea + sizeof(POOLHEADER)); @@ -2920,7 +2920,7 @@ void bson_array_grp_clear(UDF_INIT *initid, char*, char*) g->N = GetJsonGroupSize(); } // end of bson_array_grp_clear -void bson_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) +void bson_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PBJNX bxp = (PBJNX)((char*)g->Sarea + sizeof(POOLHEADER)); @@ -2932,7 +2932,7 @@ void bson_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) } // end of bson_array_grp_add char *bson_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2983,7 +2983,7 @@ my_bool bson_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return false; } // end of bson_object_grp_init -void bson_object_grp_clear(UDF_INIT *initid, char*, char*) +void bson_object_grp_clear(UDF_INIT *initid, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PBJNX bxp = (PBJNX)((char*)g->Sarea + sizeof(POOLHEADER)); @@ -2993,7 +2993,7 @@ void bson_object_grp_clear(UDF_INIT *initid, char*, char*) g->N = GetJsonGroupSize(); } // end of bson_object_grp_clear -void bson_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) +void bson_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PBJNX bxp = (PBJNX)((char*)g->Sarea + sizeof(POOLHEADER)); @@ -3005,7 +3005,7 @@ void bson_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) } // end of bson_object_grp_add char *bson_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3046,7 +3046,7 @@ my_bool bson_test_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bson_test_init char* bson_test(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char* error) { + unsigned long* res_length, uchar * is_null, uchar * error) { char* str = NULL, *fn = NULL; int pretty = 1; PBVAL bvp; @@ -3150,7 +3150,7 @@ my_bool bsonlocate_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bsonlocate_init char* bsonlocate(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char* error) { + unsigned long* res_length, uchar * is_null, uchar * error) { char *path = NULL; int k; PBVAL bvp, bvp2; @@ -3271,7 +3271,7 @@ my_bool bson_locate_all_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bson_locate_all_init char* bson_locate_all(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char* error) { + unsigned long* res_length, uchar * is_null, uchar * error) { char* path = NULL; int mx = 10; PBVAL bvp, bvp2; @@ -3396,9 +3396,10 @@ my_bool bson_contains_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, false, reslen, memlen, more); } // end of bson contains_init -long long bson_contains(UDF_INIT *initid, UDF_ARGS *args, char *, char *error) +long long bson_contains(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *error) { - char isn, res[256]; + unsigned char isn; + char res[256]; unsigned long reslen; isn = 0; @@ -3445,7 +3446,7 @@ my_bool bsoncontains_path_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, true, reslen, memlen, more); } // end of bsoncontains_path_init -long long bsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *, char *error) +long long bsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *error) { char *p, *path; long long n; @@ -3560,7 +3561,7 @@ my_bool bson_item_merge_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_item_merge_init char *bson_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3670,7 +3671,7 @@ my_bool bson_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_get_item_init char *bson_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *path, *str = NULL; PBVAL jvp; @@ -3776,7 +3777,7 @@ my_bool bsonget_string_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonget_string_init char *bsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *p, *path, *str = NULL; PBVAL jsp, jvp; @@ -3887,7 +3888,7 @@ my_bool bsonget_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonget_int_init long long bsonget_int(UDF_INIT *initid, UDF_ARGS *args, - char *is_null, char *error) + uchar *is_null, uchar *error) { char *p, *path; long long n; @@ -4009,7 +4010,7 @@ my_bool bsonget_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonget_real_init double bsonget_real(UDF_INIT *initid, UDF_ARGS *args, - char *is_null, char *error) + uchar *is_null, uchar *error) { char *p, *path; double d; @@ -4131,7 +4132,7 @@ my_bool bson_delete_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_delete_item_init char *bson_delete_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path, *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -4214,7 +4215,7 @@ void bson_delete_item_deinit(UDF_INIT* initid) /* This function is used by the json_set/insert/update_item functions. */ /*********************************************************************************/ static char *bson_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path, *str = NULL; int w; @@ -4361,7 +4362,7 @@ my_bool bson_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_set_item_init char *bson_set_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$set"); return bson_handle_item(initid, args, result, res_length, is_null, p); @@ -4381,7 +4382,7 @@ my_bool bson_insert_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_insert_item_init char *bson_insert_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$insert"); return bson_handle_item(initid, args, result, res_length, is_null, p); @@ -4401,7 +4402,7 @@ my_bool bson_update_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_update_item_init char *bson_update_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$update"); return bson_handle_item(initid, args, result, res_length, is_null, p); @@ -4460,7 +4461,7 @@ my_bool bson_file_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_file_init char *bson_file(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *fn, *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -4553,7 +4554,7 @@ my_bool bfile_make_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bfile_make_init char *bfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *p, *str = NULL, *fn = NULL; int n, pretty = 2; @@ -4674,7 +4675,7 @@ my_bool bfile_convert_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bfile_convert_init char *bfile_convert(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long *res_length, char *is_null, char *error) { + unsigned long *res_length, uchar *is_null, uchar *error) { char *str, *fn, *ofn; int lrecl = (int)*(longlong*)args->args[2]; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -4733,7 +4734,7 @@ my_bool bfile_bjson_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bfile_bjson_init char *bfile_bjson(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char*, char *error) { + unsigned long *res_length, uchar *, uchar *error) { char *buf, *str = NULL, fn[_MAX_PATH], ofn[_MAX_PATH]; bool loop; ssize_t len, newloc; @@ -4847,7 +4848,7 @@ my_bool bson_serialize_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_serialize_init char *bson_serialize(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *error) + unsigned long *res_length, uchar *, uchar *error) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -4894,7 +4895,7 @@ my_bool bbin_make_array_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_make_array_init char *bbin_make_array(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -4967,7 +4968,7 @@ my_bool bbin_array_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_array_add_init char *bbin_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -5036,7 +5037,7 @@ my_bool bbin_array_add_values_init(UDF_INIT* initid, UDF_ARGS* args, char* messa } // end of bbin_array_add_values_init char* bbin_array_add_values(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char* error) + unsigned long* res_length, uchar * is_null, uchar * error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -5088,18 +5089,18 @@ my_bool bbin_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return bson_array_grp_init(initid, args, message); } // end of bbin_array_grp_init -void bbin_array_grp_clear(UDF_INIT *initid, char *a, char *b) +void bbin_array_grp_clear(UDF_INIT *initid, uchar *a, uchar *b) { bson_array_grp_clear(initid, a, b); } // end of bbin_array_grp_clear -void bbin_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, char *a, char *b) +void bbin_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *a, uchar *b) { bson_array_grp_add(initid, args, a, b); } // end of bbin_array_grp_add char *bbin_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PBSON bsp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5136,18 +5137,18 @@ my_bool bbin_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return bson_object_grp_init(initid, args, message); } // end of bbin_object_grp_init -void bbin_object_grp_clear(UDF_INIT *initid, char *a, char *b) +void bbin_object_grp_clear(UDF_INIT *initid, uchar *a, uchar *b) { bson_object_grp_clear(initid, a, b); } // end of bbin_object_grp_clear -void bbin_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char *a, char *b) +void bbin_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *a, uchar *b) { bson_object_grp_add(initid, args, a, b); } // end of bbin_object_grp_add char *bbin_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PBSON bsp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5188,7 +5189,7 @@ my_bool bbin_make_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_make_object_init char *bbin_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5242,7 +5243,7 @@ my_bool bbin_object_nonull_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_nonull_init char *bbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5302,7 +5303,7 @@ my_bool bbin_object_key_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_key_init char *bbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5364,7 +5365,7 @@ my_bool bbin_object_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_add_init char *bbin_object_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -5426,7 +5427,7 @@ my_bool bbin_array_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_array_delete_init char *bbin_array_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -5497,7 +5498,7 @@ my_bool bbin_object_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_delete_init char *bbin_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -5556,7 +5557,7 @@ my_bool bbin_object_list_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_list_init char *bbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5608,7 +5609,7 @@ my_bool bbin_object_values_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_values_init char *bbin_object_values(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5663,7 +5664,7 @@ my_bool bbin_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_get_item_init char *bbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PBSON bsp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5713,7 +5714,7 @@ my_bool bbin_item_merge_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_item_merge_init char *bbin_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PBSON bsp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5786,7 +5787,7 @@ void bbin_item_merge_deinit(UDF_INIT* initid) /* This function is used by the jbin_set/insert/update_item functions. */ /*********************************************************************************/ static char *bbin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path; int w; @@ -5892,7 +5893,7 @@ my_bool bbin_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_set_item_init char *bbin_set_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$set"); return bbin_handle_item(initid, args, result, res_length, is_null, p); @@ -5912,7 +5913,7 @@ my_bool bbin_insert_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_insert_item_init char *bbin_insert_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$insert"); return bbin_handle_item(initid, args, result, res_length, is_null, p); @@ -5932,7 +5933,7 @@ my_bool bbin_update_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_update_item_init char *bbin_update_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$update"); return bbin_handle_item(initid, args, result, res_length, is_null, p); @@ -5952,7 +5953,7 @@ my_bool bbin_delete_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_delete_item_init char *bbin_delete_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path; PBSON bsp = NULL; @@ -6046,7 +6047,7 @@ my_bool bbin_file_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_file_init char *bbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *fn; int pretty = 3; @@ -6123,7 +6124,7 @@ my_bool bbin_locate_all_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bbin_locate_all_init char* bbin_locate_all(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char* error) { + unsigned long* res_length, uchar * is_null, uchar * error) { char *path = NULL; int mx = 10; PBVAL bvp, bvp2; diff --git a/storage/connect/bsonudf.h b/storage/connect/bsonudf.h index e355fe7b48e..90cabf72e21 100644 --- a/storage/connect/bsonudf.h +++ b/storage/connect/bsonudf.h @@ -10,9 +10,6 @@ #include "bson.h" #if 0 -#define UDF_EXEC_ARGS \ - UDF_INIT*, UDF_ARGS*, char*, unsigned long*, char*, char* - // BSON size should be equal on Linux and Windows #define BMX 255 typedef struct BSON* PBSON; @@ -205,11 +202,11 @@ extern "C" { DllExport void bson_locate_all_deinit(UDF_INIT*); DllExport my_bool bson_contains_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bson_contains(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bson_contains(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void bson_contains_deinit(UDF_INIT*); DllExport my_bool bsoncontains_path_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsoncontains_path(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsoncontains_path(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void bsoncontains_path_deinit(UDF_INIT*); DllExport my_bool bson_make_object_init(UDF_INIT*, UDF_ARGS*, char*); @@ -253,34 +250,34 @@ extern "C" { DllExport void bsonget_string_deinit(UDF_INIT*); DllExport my_bool bsonget_int_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsonget_int(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsonget_int(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void bsonget_int_deinit(UDF_INIT*); DllExport my_bool bsonget_real_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport double bsonget_real(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport double bsonget_real(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void bsonget_real_deinit(UDF_INIT*); DllExport my_bool bsonset_def_prec_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsonset_def_prec(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsonset_def_prec(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool bsonget_def_prec_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsonget_def_prec(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsonget_def_prec(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool bsonset_grp_size_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsonset_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsonset_grp_size(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool bsonget_grp_size_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsonget_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsonget_grp_size(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool bson_array_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void bson_array_grp_clear(UDF_INIT *, char *, char *); - DllExport void bson_array_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void bson_array_grp_clear(UDF_INIT *, uchar *, uchar *); + DllExport void bson_array_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *bson_array_grp(UDF_EXEC_ARGS); DllExport void bson_array_grp_deinit(UDF_INIT*); DllExport my_bool bson_object_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void bson_object_grp_clear(UDF_INIT *, char *, char *); - DllExport void bson_object_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void bson_object_grp_clear(UDF_INIT *, uchar *, uchar *); + DllExport void bson_object_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *bson_object_grp(UDF_EXEC_ARGS); DllExport void bson_object_grp_deinit(UDF_INIT*); @@ -337,14 +334,14 @@ extern "C" { DllExport void bbin_array_delete_deinit(UDF_INIT*); DllExport my_bool bbin_array_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void bbin_array_grp_clear(UDF_INIT *, char *, char *); - DllExport void bbin_array_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void bbin_array_grp_clear(UDF_INIT *, uchar *, uchar *); + DllExport void bbin_array_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *bbin_array_grp(UDF_EXEC_ARGS); DllExport void bbin_array_grp_deinit(UDF_INIT*); DllExport my_bool bbin_object_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void bbin_object_grp_clear(UDF_INIT *, char *, char *); - DllExport void bbin_object_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void bbin_object_grp_clear(UDF_INIT *, uchar *, uchar *); + DllExport void bbin_object_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *bbin_object_grp(UDF_EXEC_ARGS); DllExport void bbin_object_grp_deinit(UDF_INIT*); diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index f87ac091f81..ee92a7b94c1 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -29,9 +29,9 @@ #define M 9 static char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error); + unsigned long *res_length, uchar *is_null, uchar *error); static char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error); + unsigned long *res_length, uchar *is_null, uchar *error); static PJSON JsonNew(PGLOBAL g, JTYP type); static PJVAL JvalNew(PGLOBAL g, JTYP type, void *vp = NULL); static PJSNX JsnxNew(PGLOBAL g, PJSON jsp, int type, int len = 64); @@ -2066,7 +2066,7 @@ my_bool jsonvalue_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonvalue_init char *jsonvalue(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2107,7 +2107,7 @@ my_bool json_make_array_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_make_array_init char *json_make_array(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2174,7 +2174,7 @@ my_bool json_array_add_values_init(UDF_INIT *initid, UDF_ARGS *args, char *messa } // end of json_array_add_values_init char *json_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2256,7 +2256,7 @@ my_bool json_array_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_array_add_init char *json_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2364,7 +2364,7 @@ my_bool json_array_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_array_delete_init char *json_array_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2444,7 +2444,7 @@ my_bool jsonsum_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, true, reslen, memlen, more); } // end of jsonsum_int_init -long long jsonsum_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) +long long jsonsum_int(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, uchar *error) { long long n = 0LL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2519,7 +2519,7 @@ my_bool jsonsum_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, true, reslen, memlen, more); } // end of jsonsum_real_init -double jsonsum_real(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) +double jsonsum_real(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, uchar *error) { double n = 0.0; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2583,7 +2583,7 @@ my_bool jsonavg_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return jsonsum_real_init(initid, args, message); } // end of jsonavg_real_init -double jsonavg_real(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) +double jsonavg_real(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, uchar *error) { double n = 0.0; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2654,7 +2654,7 @@ my_bool json_make_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_make_object_init char *json_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2702,7 +2702,7 @@ my_bool json_object_nonull_init(UDF_INIT *initid, UDF_ARGS *args, } // end of json_object_nonull_init char *json_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2756,7 +2756,7 @@ my_bool json_object_key_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_object_key_init char *json_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2824,7 +2824,8 @@ my_bool json_object_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_object_add_init char *json_object_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, + uchar *error) { PCSZ key; char *str = NULL; @@ -2920,7 +2921,7 @@ my_bool json_object_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_object_delete_init char *json_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2997,7 +2998,7 @@ my_bool json_object_list_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_object_list_init char *json_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3073,7 +3074,7 @@ my_bool json_object_values_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_object_list_init char *json_object_values(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3142,7 +3143,7 @@ my_bool jsonset_grp_size_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonset_grp_size_init -long long jsonset_grp_size(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long jsonset_grp_size(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { long long n = *(long long*)args->args[0]; @@ -3163,7 +3164,7 @@ my_bool jsonget_grp_size_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonget_grp_size_init -long long jsonget_grp_size(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long jsonget_grp_size(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { return (long long)GetJsonGroupSize(); } // end of jsonget_grp_size @@ -3198,7 +3199,7 @@ my_bool json_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return false; } // end of json_array_grp_init -void json_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) +void json_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PJAR arp = (PJAR)g->Activityp; @@ -3209,7 +3210,7 @@ void json_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) } // end of json_array_grp_add char *json_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3231,7 +3232,7 @@ char *json_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, return str; } // end of json_array_grp -void json_array_grp_clear(UDF_INIT *initid, char*, char*) +void json_array_grp_clear(UDF_INIT *initid, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3275,7 +3276,7 @@ my_bool json_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return false; } // end of json_object_grp_init -void json_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) +void json_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PJOB objp = (PJOB)g->Activityp; @@ -3286,7 +3287,7 @@ void json_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) } // end of json_object_grp_add char *json_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3302,7 +3303,7 @@ char *json_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, return str; } // end of json_object_grp -void json_object_grp_clear(UDF_INIT *initid, char*, char*) +void json_object_grp_clear(UDF_INIT *initid, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3352,7 +3353,7 @@ my_bool json_item_merge_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_item_merge_init char *json_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3451,7 +3452,7 @@ my_bool json_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_get_item_init char *json_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *path, *str = NULL; PJSON jsp; @@ -3558,7 +3559,7 @@ my_bool jsonget_string_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonget_string_init char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *p, *path, *str = NULL; PJSON jsp; @@ -3667,7 +3668,7 @@ my_bool jsonget_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonget_int_init long long jsonget_int(UDF_INIT *initid, UDF_ARGS *args, - char *is_null, char *error) + uchar *is_null, uchar *error) { char *p, *path; long long n; @@ -3787,7 +3788,7 @@ my_bool jsonget_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonget_real_init double jsonget_real(UDF_INIT *initid, UDF_ARGS *args, - char *is_null, char *error) + uchar *is_null, uchar *error) { char *p, *path; double d; @@ -3908,7 +3909,7 @@ my_bool jsonlocate_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonlocate_init char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path = NULL; int k; @@ -4036,7 +4037,7 @@ my_bool json_locate_all_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_locate_all_init char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *p, *path = NULL; int mx = 10; @@ -4162,9 +4163,10 @@ my_bool jsoncontains_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, false, reslen, memlen, more); } // end of jsoncontains_init -long long jsoncontains(UDF_INIT *initid, UDF_ARGS *args, char *, char *error) +long long jsoncontains(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *error) { - char isn, res[256]; + unsigned char isn; + char res[256]; unsigned long reslen; isn = 0; @@ -4211,7 +4213,7 @@ my_bool jsoncontains_path_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, true, reslen, memlen, more); } // end of jsoncontains_path_init -long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *, char *error) +long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *error) { char *p, *path; long long n; @@ -4291,7 +4293,7 @@ void jsoncontains_path_deinit(UDF_INIT* initid) /* This function is used by the json_set/insert/update_item functions. */ /*********************************************************************************/ char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *p, *path, *str = NULL; int w; @@ -4441,7 +4443,7 @@ my_bool json_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_set_item_init char *json_set_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$set"); return handle_item(initid, args, result, res_length, is_null, p); @@ -4461,7 +4463,7 @@ my_bool json_insert_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_insert_item_init char *json_insert_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$insert"); return handle_item(initid, args, result, res_length, is_null, p); @@ -4481,7 +4483,7 @@ my_bool json_update_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_update_item_init char *json_update_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$update"); return handle_item(initid, args, result, res_length, is_null, p); @@ -4540,7 +4542,7 @@ my_bool json_file_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_file_init char *json_file(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str, *fn; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -4637,7 +4639,7 @@ my_bool jfile_make_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jfile_make_init char *jfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *p, *str = NULL, *fn = NULL; int n, pretty = 2; @@ -4745,7 +4747,7 @@ my_bool jbin_array_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_array_init char *jbin_array(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -4806,7 +4808,7 @@ my_bool jbin_array_add_values_init(UDF_INIT *initid, UDF_ARGS *args, char *messa } // end of jbin_array_add_values_init char *jbin_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -4880,7 +4882,7 @@ my_bool jbin_array_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_array_add_init char *jbin_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { int n = 2; PJSON top = NULL; @@ -4970,7 +4972,7 @@ my_bool jbin_array_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_array_delete_init char *jbin_array_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PJSON top = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5039,7 +5041,7 @@ my_bool jbin_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_init char *jbin_object(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5094,7 +5096,7 @@ my_bool jbin_object_nonull_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_nonull_init char *jbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5155,7 +5157,7 @@ my_bool jbin_object_key_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_key_init char *jbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5217,7 +5219,7 @@ my_bool jbin_object_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_add_init char *jbin_object_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PJSON top = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5297,7 +5299,7 @@ my_bool jbin_object_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_delete_init char *jbin_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PJSON top = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5360,7 +5362,7 @@ my_bool jbin_object_list_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_list_init char *jbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PJAR jarp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5421,7 +5423,7 @@ my_bool jbin_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_get_item_init char *jbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path; PJSON jsp; @@ -5514,7 +5516,7 @@ my_bool jbin_item_merge_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_item_merge_init char *jbin_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PJSON top = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5574,7 +5576,7 @@ void jbin_item_merge_deinit(UDF_INIT* initid) /* This function is used by the jbin_set/insert/update functions. */ /*********************************************************************************/ char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *p, *path; int w; @@ -5698,7 +5700,7 @@ my_bool jbin_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_set_item_init char *jbin_set_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$set"); return bin_handle_item(initid, args, result, res_length, is_null, p); @@ -5718,7 +5720,7 @@ my_bool jbin_insert_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_insert_item_init char *jbin_insert_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$insert"); return bin_handle_item(initid, args, result, res_length, is_null, p); @@ -5738,7 +5740,7 @@ my_bool jbin_update_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_update_item_init char *jbin_update_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$update"); return bin_handle_item(initid, args, result, res_length, is_null, p); @@ -5786,7 +5788,7 @@ my_bool jbin_file_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_file_init char *jbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *fn; int pretty = 3, pty = 3; @@ -5881,7 +5883,7 @@ my_bool json_serialize_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_serialize_init char *json_serialize(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *error) + unsigned long *res_length, uchar *, uchar *error) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5937,7 +5939,7 @@ my_bool jfile_convert_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of jfile_convert_init char *jfile_convert(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long *res_length, char *is_null, char *error) { + unsigned long *res_length, uchar *is_null, uchar *error) { char *str, *fn, *ofn; int lrecl = (int)*(longlong*)args->args[2]; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5996,7 +5998,7 @@ my_bool jfile_bjson_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of jfile_bjson_init char *jfile_bjson(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char*, char *error) { + unsigned long *res_length, uchar *, uchar *error) { char *fn, *ofn, *buf, *str = NULL; bool loop; ssize_t len, newloc; @@ -6536,7 +6538,7 @@ my_bool envar_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of envar_init char *envar(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *str, name[256]; int n = MY_MIN(args->lengths[0], sizeof(name) - 1); @@ -6574,7 +6576,7 @@ my_bool uvar_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of uvar_init char *uvar(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *str, varname[256]; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -6618,7 +6620,7 @@ my_bool countin_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return false; } // end of countin_init -long long countin(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *) +long long countin(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, uchar *) { PSZ str1, str2; char *s; diff --git a/storage/connect/jsonudf.h b/storage/connect/jsonudf.h index 4378bddf9ba..782d17acb12 100644 --- a/storage/connect/jsonudf.h +++ b/storage/connect/jsonudf.h @@ -14,7 +14,7 @@ #include "json.h" #define UDF_EXEC_ARGS \ - UDF_INIT*, UDF_ARGS*, char*, unsigned long*, char*, char* + UDF_INIT*, UDF_ARGS*, char*, unsigned long*, uchar *, uchar * // BSON size should be equal on Linux and Windows #define BMX 255 @@ -95,15 +95,15 @@ extern "C" { DllExport void json_array_delete_deinit(UDF_INIT*); DllExport my_bool jsonsum_int_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsonsum_int(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsonsum_int(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsonsum_int_deinit(UDF_INIT*); DllExport my_bool jsonsum_real_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport double jsonsum_real(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport double jsonsum_real(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsonsum_real_deinit(UDF_INIT*); DllExport my_bool jsonavg_real_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport double jsonavg_real(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport double jsonavg_real(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsonavg_real_deinit(UDF_INIT*); DllExport my_bool json_make_object_init(UDF_INIT*, UDF_ARGS*, char*); @@ -135,21 +135,21 @@ extern "C" { DllExport void json_object_values_deinit(UDF_INIT*); DllExport my_bool jsonset_grp_size_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsonset_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsonset_grp_size(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool jsonget_grp_size_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsonget_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsonget_grp_size(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool json_array_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void json_array_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void json_array_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *json_array_grp(UDF_EXEC_ARGS); - DllExport void json_array_grp_clear(UDF_INIT *, char *, char *); + DllExport void json_array_grp_clear(UDF_INIT *, uchar *, uchar *); DllExport void json_array_grp_deinit(UDF_INIT*); DllExport my_bool json_object_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void json_object_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void json_object_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *json_object_grp(UDF_EXEC_ARGS); - DllExport void json_object_grp_clear(UDF_INIT *, char *, char *); + DllExport void json_object_grp_clear(UDF_INIT *, uchar *, uchar *); DllExport void json_object_grp_deinit(UDF_INIT*); DllExport my_bool json_item_merge_init(UDF_INIT*, UDF_ARGS*, char*); @@ -165,15 +165,15 @@ extern "C" { DllExport void jsonget_string_deinit(UDF_INIT*); DllExport my_bool jsonget_int_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsonget_int(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsonget_int(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsonget_int_deinit(UDF_INIT*); DllExport my_bool jsonget_real_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport double jsonget_real(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport double jsonget_real(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsonget_real_deinit(UDF_INIT*); DllExport my_bool jsoncontains_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsoncontains(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsoncontains(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsoncontains_deinit(UDF_INIT*); DllExport my_bool jsonlocate_init(UDF_INIT*, UDF_ARGS*, char*); @@ -185,7 +185,7 @@ extern "C" { DllExport void json_locate_all_deinit(UDF_INIT*); DllExport my_bool jsoncontains_path_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsoncontains_path(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsoncontains_path(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsoncontains_path_deinit(UDF_INIT*); DllExport my_bool json_set_item_init(UDF_INIT*, UDF_ARGS*, char*); @@ -293,7 +293,7 @@ extern "C" { #endif // DEVELOPMENT DllExport my_bool countin_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long countin(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long countin(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); } // extern "C" diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index bf3511f6551..29757c28e99 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -14587,13 +14587,14 @@ innobase_get_mysql_key_number_for_index( if (index->table != ib_table) { i = 0; ind = dict_table_get_first_index(index->table); + const bool auto_gen_clust = dict_index_is_auto_gen_clust(ind); while (index != ind) { ind = dict_table_get_next_index(ind); i++; } - if (dict_index_is_auto_gen_clust(index)) { + if (auto_gen_clust) { ut_a(i > 0); i--; } diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 18b311e2ae2..5bedaf2e0c9 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -617,13 +617,13 @@ static int table2maria(TABLE *table_arg, data_file_type row_type, while (recpos < (uint) share->stored_rec_length) { Field **field, *found= 0; - minpos= share->reclength; + minpos= share->stored_rec_length; length= 0; for (field= table_arg->field; *field; field++) { if ((fieldpos= (*field)->offset(record)) >= recpos && - fieldpos <= minpos) + fieldpos < minpos) { /* skip null fields */ if (!(temp_length= (*field)->pack_length_in_rec())) diff --git a/storage/mroonga/udf/mrn_udf_command.cpp b/storage/mroonga/udf/mrn_udf_command.cpp index 46911c56e25..44d8c9ccdd0 100644 --- a/storage/mroonga/udf/mrn_udf_command.cpp +++ b/storage/mroonga/udf/mrn_udf_command.cpp @@ -220,7 +220,7 @@ static void mroonga_command_escape_value(grn_ctx *ctx, } MRN_API char *mroonga_command(UDF_INIT *init, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error) + unsigned long *length, uchar *is_null, uchar *error) { CommandInfo *info = (CommandInfo *)init->ptr; grn_ctx *ctx = info->ctx; diff --git a/storage/mroonga/udf/mrn_udf_escape.cpp b/storage/mroonga/udf/mrn_udf_escape.cpp index 55a3639565e..a03bf25cba2 100644 --- a/storage/mroonga/udf/mrn_udf_escape.cpp +++ b/storage/mroonga/udf/mrn_udf_escape.cpp @@ -214,7 +214,7 @@ static void escape(EscapeInfo *info, UDF_ARGS *args) } MRN_API char *mroonga_escape(UDF_INIT *init, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error) + unsigned long *length, uchar *is_null, uchar *error) { EscapeInfo *info = reinterpret_cast(init->ptr); grn_ctx *ctx = info->ctx; diff --git a/storage/mroonga/udf/mrn_udf_highlight_html.cpp b/storage/mroonga/udf/mrn_udf_highlight_html.cpp index d986777caff..5085a885fe0 100644 --- a/storage/mroonga/udf/mrn_udf_highlight_html.cpp +++ b/storage/mroonga/udf/mrn_udf_highlight_html.cpp @@ -412,8 +412,8 @@ MRN_API char *mroonga_highlight_html(UDF_INIT *init, UDF_ARGS *args, char *result, unsigned long *length, - char *is_null, - char *error) + uchar *is_null, + uchar *error) { MRN_DBUG_ENTER_FUNCTION(); diff --git a/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp b/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp index f40dcf0055f..fb948a72ea9 100644 --- a/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp +++ b/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp @@ -45,7 +45,7 @@ MRN_API my_bool last_insert_grn_id_init(UDF_INIT *init, UDF_ARGS *args, char *me return 0; } -MRN_API longlong last_insert_grn_id(UDF_INIT *init, UDF_ARGS *args, char *is_null, char *error) +MRN_API longlong last_insert_grn_id(UDF_INIT *init, UDF_ARGS *args, uchar *is_null, uchar *error) { THD *thd = current_thd; st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, false); diff --git a/storage/mroonga/udf/mrn_udf_normalize.cpp b/storage/mroonga/udf/mrn_udf_normalize.cpp index 0ebee2ff608..5c34e9b0ec7 100644 --- a/storage/mroonga/udf/mrn_udf_normalize.cpp +++ b/storage/mroonga/udf/mrn_udf_normalize.cpp @@ -151,7 +151,7 @@ error: } MRN_API char *mroonga_normalize(UDF_INIT *init, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error) + unsigned long *length, uchar *is_null, uchar *error) { st_mrn_normalize_info *info = (st_mrn_normalize_info *)init->ptr; grn_ctx *ctx = info->ctx; diff --git a/storage/mroonga/udf/mrn_udf_query_expand.cpp b/storage/mroonga/udf/mrn_udf_query_expand.cpp index 76a5dad53b4..4ecafe1812b 100644 --- a/storage/mroonga/udf/mrn_udf_query_expand.cpp +++ b/storage/mroonga/udf/mrn_udf_query_expand.cpp @@ -244,8 +244,8 @@ MRN_API char *mroonga_query_expand(UDF_INIT *init, UDF_ARGS *args, char *result, unsigned long *length, - char *is_null, - char *error) + uchar *is_null, + uchar *error) { MRN_DBUG_ENTER_FUNCTION(); diff --git a/storage/mroonga/udf/mrn_udf_snippet.cpp b/storage/mroonga/udf/mrn_udf_snippet.cpp index 1bd6cb7d722..53058bf02f5 100644 --- a/storage/mroonga/udf/mrn_udf_snippet.cpp +++ b/storage/mroonga/udf/mrn_udf_snippet.cpp @@ -248,7 +248,7 @@ error: } MRN_API char *mroonga_snippet(UDF_INIT *init, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error) + unsigned long *length, uchar *is_null, uchar *error) { st_mrn_snip_info *snip_info = (st_mrn_snip_info *) init->ptr; grn_ctx *ctx = snip_info->ctx; diff --git a/storage/mroonga/udf/mrn_udf_snippet_html.cpp b/storage/mroonga/udf/mrn_udf_snippet_html.cpp index ba0cdadda99..3acdef03f54 100644 --- a/storage/mroonga/udf/mrn_udf_snippet_html.cpp +++ b/storage/mroonga/udf/mrn_udf_snippet_html.cpp @@ -323,8 +323,8 @@ MRN_API char *mroonga_snippet_html(UDF_INIT *init, UDF_ARGS *args, char *result, unsigned long *length, - char *is_null, - char *error) + uchar *is_null, + uchar *error) { MRN_DBUG_ENTER_FUNCTION(); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 2d5b4c001a0..06c6b44b6bf 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -367,13 +367,13 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, while (recpos < (uint) share->stored_rec_length) { Field **field, *found= 0; - minpos= share->reclength; + minpos= share->stored_rec_length; length= 0; for (field= table_arg->field; *field; field++) { if ((fieldpos= (*field)->offset(record)) >= recpos && - fieldpos <= minpos) + fieldpos < minpos) { /* skip null fields */ if (!(temp_length= (*field)->pack_length_in_rec())) diff --git a/strings/json_lib.c b/strings/json_lib.c index 4d9a9aac594..2090bd5d9ab 100644 --- a/strings/json_lib.c +++ b/strings/json_lib.c @@ -1698,7 +1698,7 @@ static enum json_esc_char_classes json_escape_chr_map[0x60] = { }; -static const char hexconv[16] = "0123456789ABCDEF"; +static const char hexconv[17] = "0123456789ABCDEF"; int json_escape(CHARSET_INFO *str_cs,