Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tianmu):New configuration parameters: "tianmu_mandatory" and "tianmu_no_key_error (#1462)" #1466

Merged
merged 3 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions mysql-test/suite/tianmu/r/drop_index.result
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ UNIQUE KEY `idx_uk` (`copy_id`),
KEY `idx_firstname` (`first_name`),
FULLTEXT KEY `idx_lastname` (`last_name`)
) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4;
set session sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
Warnings:
Warning 3135 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
set session tianmu_no_key_error=OFF;
drop index idx_id on t1;
ERROR HY000: Tianmu engine does not support unique index.
drop index idx_name on t2;
Expand Down
15 changes: 10 additions & 5 deletions mysql-test/suite/tianmu/r/issue1065.result
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
DROP DATABASE IF EXISTS issue1065_test;
CREATE DATABASE issue1065_test;
USE issue1065_test;
set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set tianmu_mandatory=OFF;
set tianmu_no_key_error=OFF;
drop table if exists t_test;
CREATE TABLE t_test(
id INT NOT NULL AUTO_INCREMENT,
Expand Down Expand Up @@ -38,7 +39,8 @@ insert INTO t_test(first_name,last_name,sex,score,copy_id) VALUES (firstname,las
END WHILE;
END //
drop PROCEDURE add_user;
set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU,NO_KEY_ERROR';
set tianmu_mandatory=ON;
set tianmu_no_key_error=ON;
create PROCEDURE add_user(in num INT)
BEGIN
DECLARE rowid INT DEFAULT 0;
Expand All @@ -65,7 +67,8 @@ insert INTO t_test(first_name,last_name,sex,score,copy_id) VALUES (firstname,las
END WHILE;
END //
drop PROCEDURE add_user;
set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set tianmu_mandatory=OFF;
set tianmu_no_key_error=OFF;
create PROCEDURE add_user(in num INT)
BEGIN
DECLARE rowid INT DEFAULT 0;
Expand Down Expand Up @@ -102,7 +105,8 @@ score INT NOT NULL,
copy_id INT NOT NULL,
PRIMARY KEY (`id`)
) engine=innodb;
set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU,NO_KEY_ERROR';
set tianmu_mandatory=ON;
set tianmu_no_key_error=ON;
create PROCEDURE add_user(in num INT)
BEGIN
DECLARE rowid INT DEFAULT 0;
Expand All @@ -129,7 +133,8 @@ insert INTO t_test(first_name,last_name,sex,score,copy_id) VALUES (firstname,las
END WHILE;
END //
drop PROCEDURE add_user;
set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set tianmu_mandatory=OFF;
set tianmu_no_key_error=OFF;
create PROCEDURE add_user(in num INT)
BEGIN
DECLARE rowid INT DEFAULT 0;
Expand Down
68 changes: 10 additions & 58 deletions mysql-test/suite/tianmu/r/issue1090.result
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ set global default_storage_engine=innodb;
include/master-slave.inc
[connection master]
#
# sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
# tianmu_mandatory=OFF
#
[on slave]
include/sync_slave_sql_with_master.inc
set global sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set global tianmu_mandatory=OFF;
[on master]
create table t_issue1090(c1 int,c2 varchar(255));
show create table t_issue1090;
Expand All @@ -19,7 +19,7 @@ t_issue1090 CREATE TABLE `t_issue1090` (
include/sync_slave_sql_with_master.inc
show global variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_mode ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
show variables like '%_engine';
Variable_name Value
default_storage_engine TIANMU
Expand All @@ -44,7 +44,7 @@ t_issue1090 CREATE TABLE `t_issue1090` (
include/sync_slave_sql_with_master.inc
show global variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_mode ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
show global variables like '%_engine';
Variable_name Value
default_storage_engine TIANMU
Expand All @@ -61,10 +61,10 @@ t_issue1090 CREATE TABLE `t_issue1090` (
drop table t_issue1090;
include/sync_slave_sql_with_master.inc
#
# sql_mode='MANDATORY_TIANMU'
# tianmu_mandatory=ON
#
[on slave]
set global sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU';
set global tianmu_mandatory=ON;
[on master]
create table t_issue1090_2(c1 int,c2 varchar(255));
show create table t_issue1090_2;
Expand All @@ -75,14 +75,6 @@ t_issue1090_2 CREATE TABLE `t_issue1090_2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
[on slave]
include/sync_slave_sql_with_master.inc
show global variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU
show variables like '%_engine';
Variable_name Value
default_storage_engine TIANMU
default_tmp_storage_engine InnoDB
internal_tmp_disk_storage_engine InnoDB
show create table t_issue1090_2;
Table Create Table
t_issue1090_2 CREATE TABLE `t_issue1090_2` (
Expand All @@ -100,14 +92,6 @@ t_issue1090_2 CREATE TABLE `t_issue1090_2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
[on slave]
include/sync_slave_sql_with_master.inc
show global variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU
show global variables like '%_engine';
Variable_name Value
default_storage_engine TIANMU
default_tmp_storage_engine InnoDB
internal_tmp_disk_storage_engine InnoDB
show create table t_issue1090_2;
Table Create Table
t_issue1090_2 CREATE TABLE `t_issue1090_2` (
Expand All @@ -119,10 +103,10 @@ t_issue1090_2 CREATE TABLE `t_issue1090_2` (
drop table t_issue1090_2;
include/sync_slave_sql_with_master.inc
#
# sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
# tianmu_mandatory=OFF
#
[on slave]
set global sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set global tianmu_mandatory=OFF;
[on master]
create table t_issue1090_3(c1 int,c2 varchar(255));
show create table t_issue1090_3;
Expand All @@ -133,14 +117,6 @@ t_issue1090_3 CREATE TABLE `t_issue1090_3` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
[on slave]
include/sync_slave_sql_with_master.inc
show global variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
show global variables like '%_engine';
Variable_name Value
default_storage_engine TIANMU
default_tmp_storage_engine InnoDB
internal_tmp_disk_storage_engine InnoDB
show create table t_issue1090_3;
Table Create Table
t_issue1090_3 CREATE TABLE `t_issue1090_3` (
Expand All @@ -158,14 +134,6 @@ t_issue1090_3 CREATE TABLE `t_issue1090_3` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
[on slave]
include/sync_slave_sql_with_master.inc
show global variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
show global variables like '%_engine';
Variable_name Value
default_storage_engine TIANMU
default_tmp_storage_engine InnoDB
internal_tmp_disk_storage_engine InnoDB
show create table t_issue1090_3;
Table Create Table
t_issue1090_3 CREATE TABLE `t_issue1090_3` (
Expand All @@ -177,10 +145,10 @@ t_issue1090_3 CREATE TABLE `t_issue1090_3` (
drop table t_issue1090_3;
include/sync_slave_sql_with_master.inc
#
# sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU'
# tianmu_mandatory=ON
#
[on slave]
set global sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU';
set global tianmu_mandatory=ON;
[on master]
create table t_issue1090_4(c1 int,c2 varchar(255));
show create table t_issue1090_4;
Expand All @@ -191,14 +159,6 @@ t_issue1090_4 CREATE TABLE `t_issue1090_4` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
[on slave]
include/sync_slave_sql_with_master.inc
show global variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU
show global variables like '%_engine';
Variable_name Value
default_storage_engine TIANMU
default_tmp_storage_engine InnoDB
internal_tmp_disk_storage_engine InnoDB
show create table t_issue1090_4;
Table Create Table
t_issue1090_4 CREATE TABLE `t_issue1090_4` (
Expand All @@ -214,14 +174,6 @@ t_issue1090_4 CREATE TABLE `t_issue1090_4` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
[on slave]
include/sync_slave_sql_with_master.inc
show global variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU
show global variables like '%_engine';
Variable_name Value
default_storage_engine TIANMU
default_tmp_storage_engine InnoDB
internal_tmp_disk_storage_engine InnoDB
show create table t_issue1090_4;
Table Create Table
t_issue1090_4 CREATE TABLE `t_issue1090_4` (
Expand Down
28 changes: 8 additions & 20 deletions mysql-test/suite/tianmu/r/issue1131.result
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
use test;
drop table IF EXISTS tmp_table;
#
# sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
# tianmu_mandatory=OFF
#
set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set tianmu_mandatory=OFF;
create table t_issue1131(c1 int,c2 varchar(255))engine=innodb;
show create table t_issue1131;
Table Create Table
t_issue1131 CREATE TABLE `t_issue1131` (
`c1` int(11) DEFAULT NULL,
`c2` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
show variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
show variables like '%_engine';
Variable_name Value
default_storage_engine TIANMU
Expand All @@ -40,19 +37,16 @@ tmp_table CREATE TEMPORARY TABLE `tmp_table` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table tmp_table;
#
# sql_mode='MANDATORY_TIANMU'
# tianmu_mandatory=ON
#
set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU';
set tianmu_mandatory=ON;
create table t_issue1131(c1 int,c2 varchar(255))engine=innodb;
show create table t_issue1131;
Table Create Table
t_issue1131 CREATE TABLE `t_issue1131` (
`c1` int(11) DEFAULT NULL,
`c2` varchar(255) DEFAULT NULL
) ENGINE=TIANMU DEFAULT CHARSET=latin1
show variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU
show variables like '%_engine';
Variable_name Value
default_storage_engine TIANMU
Expand All @@ -79,9 +73,9 @@ tmp_table CREATE TEMPORARY TABLE `tmp_table` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table tmp_table;
#
# sql_mode='MANDATORY_TIANMU'
# tianmu_mandatory=ON
# set default_storage_engine=innodb;
set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU';
set tianmu_mandatory=ON;
set default_storage_engine=innodb;
create table t_issue1131(c1 int,c2 varchar(255));
show create table t_issue1131;
Expand All @@ -90,9 +84,6 @@ t_issue1131 CREATE TABLE `t_issue1131` (
`c1` int(11) DEFAULT NULL,
`c2` varchar(255) DEFAULT NULL
) ENGINE=TIANMU DEFAULT CHARSET=latin1
show variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU
show variables like '%_engine';
Variable_name Value
default_storage_engine InnoDB
Expand All @@ -119,20 +110,17 @@ tmp_table CREATE TEMPORARY TABLE `tmp_table` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table tmp_table;
#
# sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
# tianmu_mandatory=OFF
#
[on slave]
set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set tianmu_mandatory=OFF;
create table t_issue1131(c1 int,c2 varchar(255));
show create table t_issue1131;
Table Create Table
t_issue1131 CREATE TABLE `t_issue1131` (
`c1` int(11) DEFAULT NULL,
`c2` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
show variables like 'sql_mode';
Variable_name Value
sql_mode STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
show variables like '%_engine';
Variable_name Value
default_storage_engine InnoDB
Expand Down
19 changes: 2 additions & 17 deletions mysql-test/suite/tianmu/r/issue1325.result
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@ include/sync_slave_sql_with_master.inc
# on master:
CREATE DATABASE issue1325_test;
USE issue1325_test;
include/sync_slave_sql_with_master.inc
# on slave:
USE issue1325_test;
show databases;
Database
information_schema
cache
issue1325_test
mtr
mysql
performance_schema
sys
sys_tianmu
test
set global sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,MANDATORY_TIANMU,NO_KEY_ERROR';
#
# Secondary INDEX
#
Expand All @@ -39,14 +24,14 @@ ttt CREATE TABLE `ttt` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
include/sync_slave_sql_with_master.inc
# on slave:
# on master:
USE issue1325_test;
show create table ttt;
Table Create Table
ttt CREATE TABLE `ttt` (
`id` int(11) NOT NULL,
`name` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
) ENGINE=TIANMU DEFAULT CHARSET=latin1
#
# UNIQUE INDEX
#
Expand Down
Loading