Skip to content

Commit

Permalink
feat(tianmu):New configuration parameters: "tianmu_mandatory" and "ti…
Browse files Browse the repository at this point in the history
…anmu_no_key_error (stoneatom#1462)"

In version 1.0.4, we will discard "MANDATORY_TIANMU" and "NO_KEY_ERROR" in (sql_mode)

Specifies whether to enable mandatory Tianmu engine in table. if yes ,set tianmu_mandatory to ON, otherwise set the variable to OFF.
Specifies whether to to directly skip DDL statements that are not supported by the SQL layer, instead of reporting errors.
if yes ,set tianmu_no_key_error to ON, otherwise set the variable to OFF.
  • Loading branch information
konghaiya committed Mar 22, 2023
1 parent e06793e commit dacc47c
Show file tree
Hide file tree
Showing 23 changed files with 160 additions and 224 deletions.
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

0 comments on commit dacc47c

Please sign in to comment.