Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
733e7ce0
Commit
733e7ce0
authored
Nov 27, 2008
by
Tatiana A. Nurnberg
Browse files
Options
Browse Files
Download
Plain Diff
auto-merge
parents
61296d6d
12758f9d
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
1506 additions
and
412 deletions
+1506
-412
mysql-test/r/csv_alter_table.result
mysql-test/r/csv_alter_table.result
+40
-0
mysql-test/r/events_scheduling.result
mysql-test/r/events_scheduling.result
+5
-4
mysql-test/r/events_time_zone.result
mysql-test/r/events_time_zone.result
+7
-4
mysql-test/r/group_concat_max_len_func.result
mysql-test/r/group_concat_max_len_func.result
+42
-32
mysql-test/r/multi_update.result
mysql-test/r/multi_update.result
+0
-23
mysql-test/r/multi_update2.result
mysql-test/r/multi_update2.result
+25
-0
mysql-test/r/symlink.result
mysql-test/r/symlink.result
+4
-4
mysql-test/r/timestamp_func.result
mysql-test/r/timestamp_func.result
+18
-26
mysql-test/r/timestamp_sysdate_is_now_func.result
mysql-test/r/timestamp_sysdate_is_now_func.result
+25
-0
mysql-test/r/variables-notembedded.result
mysql-test/r/variables-notembedded.result
+92
-0
mysql-test/r/variables.result
mysql-test/r/variables.result
+339
-0
mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
+1
-1
mysql-test/t/disabled.def
mysql-test/t/disabled.def
+0
-1
mysql-test/t/events_scheduling.test
mysql-test/t/events_scheduling.test
+22
-11
mysql-test/t/events_time_zone.test
mysql-test/t/events_time_zone.test
+58
-25
mysql-test/t/group_concat_max_len_func.test
mysql-test/t/group_concat_max_len_func.test
+46
-37
mysql-test/t/multi_update.test
mysql-test/t/multi_update.test
+11
-46
mysql-test/t/multi_update2-master.opt
mysql-test/t/multi_update2-master.opt
+1
-0
mysql-test/t/multi_update2.test
mysql-test/t/multi_update2.test
+43
-0
mysql-test/t/symlink.test
mysql-test/t/symlink.test
+27
-4
mysql-test/t/timestamp_func.test
mysql-test/t/timestamp_func.test
+20
-49
mysql-test/t/timestamp_sysdate_is_now_func-master.opt
mysql-test/t/timestamp_sysdate_is_now_func-master.opt
+1
-0
mysql-test/t/timestamp_sysdate_is_now_func.test
mysql-test/t/timestamp_sysdate_is_now_func.test
+47
-0
mysql-test/t/variables-notembedded.test
mysql-test/t/variables-notembedded.test
+80
-0
mysql-test/t/variables.test
mysql-test/t/variables.test
+296
-0
sql/item_func.cc
sql/item_func.cc
+10
-0
sql/set_var.cc
sql/set_var.cc
+133
-93
sql/set_var.h
sql/set_var.h
+28
-1
sql/slave.cc
sql/slave.cc
+61
-0
sql/slave.h
sql/slave.h
+1
-0
sql/sql_repl.cc
sql/sql_repl.cc
+23
-51
No files found.
mysql-test/r/csv_alter_table.result
0 → 100644
View file @
733e7ce0
# ===== csv_alter_table.1 =====
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
ALTER TABLE t1 ADD COLUMN b CHAR(5) NOT NULL;
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
b char(5) NO NULL
ALTER TABLE t1 DROP COLUMN b;
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
ALTER TABLE t1 MODIFY a BIGINT NOT NULL;
DESC t1;
Field Type Null Key Default Extra
a bigint(20) NO NULL
ALTER TABLE t1 CHANGE a a INT NOT NULL;
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
DROP TABLE t1;
# ===== csv_alter_table.2 =====
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
ALTER TABLE t1 ADD COLUMN b CHAR(5);
ERROR 42000: The storage engine for the table doesn't support nullable columns
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
ALTER TABLE t1 MODIFY a BIGINT;
ERROR 42000: The storage engine for the table doesn't support nullable columns
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
ALTER TABLE t1 CHANGE a a INT;
ERROR 42000: The storage engine for the table doesn't support nullable columns
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
DROP TABLE t1;
mysql-test/r/events_scheduling.result
View file @
733e7ce0
CREATE DATABASE IF NOT EXISTS events_test;
USE events_test;
SET @event_scheduler=@@global.event_scheduler;
SET GLOBAL event_scheduler=OFF;
Try ag
ia
n to make sure it's allowed
Try ag
ai
n to make sure it's allowed
SET GLOBAL event_scheduler=OFF;
SHOW VARIABLES LIKE 'event_scheduler';
Variable_name Value
...
...
@@ -64,8 +65,8 @@ INSERT INTO table_4 VALUES (1);
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
IF(SUM(a) >= 4, 'OK', 'ERROR')
OK
SELECT IF(SUM(a) >=
5
, 'OK', 'ERROR') FROM table_2;
IF(SUM(a) >=
5
, 'OK', 'ERROR')
SELECT IF(SUM(a) >=
4
, 'OK', 'ERROR') FROM table_2;
IF(SUM(a) >=
4
, 'OK', 'ERROR')
OK
SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3;
IF(SUM(a) >= 1, 'OK', 'ERROR')
...
...
@@ -94,4 +95,4 @@ DROP TABLE table_2;
DROP TABLE table_3;
DROP TABLE table_4;
DROP DATABASE events_test;
SET GLOBAL event_scheduler=
OFF
;
SET GLOBAL event_scheduler=
@event_scheduler
;
mysql-test/r/events_time_zone.result
View file @
733e7ce0
...
...
@@ -14,6 +14,7 @@ RETURN FLOOR((i % (step * n) + 0.1) / step);
END//
SET @step3= @step * 3;
SET @step6= @step * 6;
SET @unix_time= UNIX_TIMESTAMP() - 1;
SET @unix_time= @unix_time - @unix_time % @step6;
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
SET @tzid= LAST_INSERT_ID();
...
...
@@ -21,7 +22,7 @@ INSERT INTO mysql.time_zone_transition_type
VALUES (@tzid, 0, 0, 0, 'b16420_0');
INSERT INTO mysql.time_zone_transition_type
VALUES (@tzid, 1, @step3 - @step, 1, 'b16420_1');
INSERT INTO mysql.time_zone_name VALUES ('
bug16420
', @tzid);
INSERT INTO mysql.time_zone_name VALUES ('
<TZ_NAME_1>
', @tzid);
CREATE TABLE t1 (count INT, unix_time INT, local_time INT, comment CHAR(80));
CREATE TABLE t2 (count INT);
INSERT INTO t2 VALUES (1);
...
...
@@ -48,7 +49,7 @@ END//
SET TIME_ZONE= '+00:00';
CREATE EVENT e1 ON SCHEDULE EVERY @step SECOND
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e1>");
SET TIME_ZONE= '
bug16420
';
SET TIME_ZONE= '
<TZ_NAME_1>
';
CREATE EVENT e2 ON SCHEDULE EVERY @step SECOND
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e2>");
SET GLOBAL EVENT_SCHEDULER= ON;
...
...
@@ -86,6 +87,7 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
ALTER TABLE mysql.time_zone AUTO_INCREMENT = 6;
SET TIME_ZONE= '+00:00';
CREATE TABLE t1 (event CHAR(2), dt DATE, offset INT);
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
...
...
@@ -111,8 +113,8 @@ INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now + 7 * @step, 2);
INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now + 12 * @step, 3);
INSERT INTO mysql.time_zone_name VALUES ('
bug16420_2
', @tzid);
SET TIME_ZONE= '
bug16420_2
';
INSERT INTO mysql.time_zone_name VALUES ('
<TZ_NAME_2>
', @tzid);
SET TIME_ZONE= '
<TZ_NAME_2>
';
SET GLOBAL EVENT_SCHEDULER= ON;
SET GLOBAL EVENT_SCHEDULER= OFF;
Below we should see the following:
...
...
@@ -143,6 +145,7 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
ALTER TABLE mysql.time_zone AUTO_INCREMENT = 6;
DROP FUNCTION round_to_step;
DROP TABLE t_step;
DROP DATABASE mysqltest_db1;
...
...
mysql-test/r/group_concat_max_len_func.result
View file @
733e7ce0
SET @save = @@global.group_concat_max_len;
drop table if exists
t1;
DROP TABLE IF EXISTS
t1;
## Creating new table t1 ##
CREATE TABLE t1
(
id INT NOT NULL
auto_increment
,
id INT NOT NULL
AUTO_INCREMENT
,
PRIMARY KEY (id),
rollno
int
NOT NULL,
rollno
INT
NOT NULL,
name VARCHAR(30)
);
'#--------------------FN_DYNVARS_034_01-------------------------#'
## Setting initial value of variable to 4 ##
## Setting initial value of variable to 4 ##
SET @@global.group_concat_max_len = 4;
## Inserting some rows in table ##
INSERT into t1(rollno, name) values(1, 'Record_1');
INSERT into t1(rollno, name) values(2, 'Record_2');
INSERT into t1(rollno, name) values(1, 'Record_3');
INSERT into t1(rollno, name) values(3, 'Record_4');
INSERT into t1(rollno, name) values(1, 'Record_5');
INSERT into t1(rollno, name) values(3, 'Record_6');
INSERT into t1(rollno, name) values(4, 'Record_7');
INSERT into t1(rollno, name) values(4, 'Record_8');
## Creating two new connections ##
## Inserting some rows in table ##
INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
SELECT * FROM t1 ORDER BY id;
id rollno name
1 1 Record_1
2 2 Record_2
3 1 Record_3
4 3 Record_4
5 1 Record_5
6 3 Record_6
7 4 Record_7
8 4 Record_8
## Creating two new connections ##
'#--------------------FN_DYNVARS_034_02-------------------------#'
## Connecting with test_con1 ##
## Accessing data and using group_concat on column whose value is greater than 4 ##
SELECT id, rollno,
group_concat
(name) FROM t1 GROUP BY rollno;
id rollno
group_concat
(name)
## Accessing data and using group_concat on column whose value is greater than 4 ##
SELECT id, rollno,
GROUP_CONCAT
(name) FROM t1 GROUP BY rollno;
id rollno
GROUP_CONCAT
(name)
1 1 Reco
2 2 Reco
4 3 Reco
...
...
@@ -33,10 +43,10 @@ id rollno group_concat(name)
Warnings:
Warning 1260 4 line(s) were cut by GROUP_CONCAT()
## Changing session value of variable and verifying its behavior, ##
## warning should come here ##
## warning should come here ##
SET @@session.group_concat_max_len = 10;
SELECT id, rollno,
group_concat
(name) FROM t1 GROUP BY rollno;
id rollno
group_concat
(name)
SELECT id, rollno,
GROUP_CONCAT
(name) FROM t1 GROUP BY rollno;
id rollno
GROUP_CONCAT
(name)
1 1 Record_1,R
2 2 Record_2
4 3 Record_4,R
...
...
@@ -44,18 +54,18 @@ id rollno group_concat(name)
Warnings:
Warning 1260 3 line(s) were cut by GROUP_CONCAT()
'#--------------------FN_DYNVARS_034_03-------------------------#'
## Connecting with new connection test_con2 ##
## Verifying initial value of variable. It should be 4 ##
## Connecting with new connection test_con2 ##
## Verifying initial value of variable. It should be 4 ##
SELECT @@session.group_concat_max_len = 4;
@@session.group_concat_max_len = 4
1
## Setting session value of variable to 20 and verifying variable is concating ##
## column's value to 20 or not ##
## Setting session value of variable to 20 and verifying variable is concating ##
## column's value to 20 or not ##
SET @@session.group_concat_max_len = 20;
## Verifying value of name column, it should not me more than 20 characters ##
## Warning should come here ##
SELECT id, rollno,
group_concat
(name) FROM t1 GROUP BY rollno;
id rollno
group_concat
(name)
SELECT id, rollno,
GROUP_CONCAT
(name) FROM t1 GROUP BY rollno;
id rollno
GROUP_CONCAT
(name)
1 1 Record_1,Record_3,Re
2 2 Record_2
4 3 Record_4,Record_6
...
...
@@ -63,17 +73,17 @@ id rollno group_concat(name)
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
'#--------------------FN_DYNVARS_034_04-------------------------#'
## Setting session value of variable to 26. No warning should appear here ##
## because the value after concatination is less than 30 ##
## Setting session value of variable to 26. No warning should appear here ##
## because the value after concatination is less than 30 ##
SET @@session.group_concat_max_len = 26;
## Verifying value of name column, it should not give warning now ##
SELECT id, rollno,
group_concat
(name) FROM t1 GROUP BY rollno;
id rollno
group_concat
(name)
## Verifying value of name column, it should not give warning now ##
SELECT id, rollno,
GROUP_CONCAT
(name) FROM t1 GROUP BY rollno;
id rollno
GROUP_CONCAT
(name)
1 1 Record_1,Record_3,Record_5
2 2 Record_2
4 3 Record_4,Record_6
7 4 Record_7,Record_8
## Dropping table t1 ##
DROP
table
t1;
DROP
TABLE
t1;
## Disconnecting both the connection ##
SET @@global.group_concat_max_len = @save;
mysql-test/r/multi_update.result
View file @
733e7ce0
...
...
@@ -378,29 +378,6 @@ where 0=1;
delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1;
drop table t1,t2;
create table t1 ( a int not null, b int not null) ;
alter table t1 add index i1(a);
delete from t1 where a > 2000000;
create table t2 like t1;
insert into t2 select * from t1;
select 't2 rows before small delete', count(*) from t1;
t2 rows before small delete count(*)
t2 rows before small delete 2000000
delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
select 't2 rows after small delete', count(*) from t2;
t2 rows after small delete count(*)
t2 rows after small delete 1999999
select 't1 rows after small delete', count(*) from t1;
t1 rows after small delete count(*)
t1 rows after small delete 1999999
delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
select 't2 rows after big delete', count(*) from t2;
t2 rows after big delete count(*)
t2 rows after big delete 1900001
select 't1 rows after big delete', count(*) from t1;
t1 rows after big delete count(*)
t1 rows after big delete 1900001
drop table t1,t2;
CREATE TABLE t1 ( a int );
CREATE TABLE t2 ( a int );
DELETE t1 FROM t1, t2 AS t3;
...
...
mysql-test/r/multi_update2.result
0 → 100644
View file @
733e7ce0
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
# The protocolling of many inserts into t1 is suppressed.
ALTER TABLE t1 ADD INDEX i1(a);
DELETE FROM t1 WHERE a > 2000000;
CREATE TABLE t2 LIKE t1;
INSERT INTO t2 SELECT * FROM t1;
SELECT 't2 rows before small delete', COUNT(*) FROM t1;
t2 rows before small delete COUNT(*)
t2 rows before small delete 2000000
DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
SELECT 't2 rows after small delete', COUNT(*) FROM t2;
t2 rows after small delete COUNT(*)
t2 rows after small delete 1999999
SELECT 't1 rows after small delete', COUNT(*) FROM t1;
t1 rows after small delete COUNT(*)
t1 rows after small delete 1999999
DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
SELECT 't2 rows after big delete', COUNT(*) FROM t2;
t2 rows after big delete COUNT(*)
t2 rows after big delete 1900001
SELECT 't1 rows after big delete', COUNT(*) FROM t1;
t1 rows after big delete COUNT(*)
t1 rows after big delete 1900001
DROP TABLE t1,t2;
mysql-test/r/symlink.result
View file @
733e7ce0
...
...
@@ -148,16 +148,16 @@ DROP TABLE t1;
End of 5.0 tests
CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data/mysql';
ERROR HY000: Incorrect arguments to INDEX DIRECTORY
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
DATA DIRECTORY='TEST_DIR/master-data/test';
ERROR HY000: Incorrect arguments to DATA DIRECTORY
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
DATA DIRECTORY='TEST_DIR/master-data/';
ERROR HY000: Incorrect arguments to DATA DIRECTORY
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data';
ERROR HY000: Incorrect arguments to INDEX DIRECTORY
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data_var';
ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errcode: 2)
...
...
mysql-test/r/timestamp_func.result
View file @
733e7ce0
** Setup **
** Connecting con0 using root **
** Connecting con1 using root **
'#-----------------------------FN_DYNVARS_179_01------------------#'
** Connection con0 **
SET @ts_old = @@SESSION.timestamp;
waiting 1 sec
SET @ts_new = @@SESSION.timestamp;
SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
Timestamp Difference
SELECT date(now()) = date(sysdate());
date(now()) = date(sysdate())
1
SET @@session.timestamp = 1100000000;
SELECT date(now()) != date(sysdate());
date(now()) != date(sysdate())
1
** Connecting con0 using root **
SELECT @@session.timestamp != 1100000000;
@@session.timestamp != 1100000000
1
SET @@session.timestamp = 1000000000;
SELECT date(now()) != date(sysdate());
date(now()) != date(sysdate())
1
1 means >=1 expected is true
** Connection con1 **
SET @ts_old = @@SESSION.timestamp;
waiting 4 sec
SET @ts_new = @@SESSION.timestamp;
SELECT @ts_new - @ts_old >= 4 AS 'Timestamp Difference';
Timestamp Difference
SELECT @@session.timestamp != 1000000000;
@@session.timestamp != 1000000000
1
1 means >=4 expected is true
'#-----------------------------FN_DYNVARS_179_02---------------------#'
SET @ts_old = @@SESSION.timestamp;
Changing time zone
SET time_zone = 'MET';
SET @ts_new = @@SESSION.timestamp;
SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
Timestamp Difference
SELECT @@session.timestamp = 1100000000;
@@session.timestamp = 1100000000
1
1 means >=1 expected is true
** Cleanup **
** Connection default **
Disconnecting Connections con0, con1
mysql-test/r/timestamp_sysdate_is_now_func.result
0 → 100644
View file @
733e7ce0
** Connecting con1 using root **
SELECT date(now()) = date(sysdate());
date(now()) = date(sysdate())
1
SET @@session.timestamp = 1100000000;
SELECT date(now()) != date(sysdate());
date(now()) != date(sysdate())
0
** Connecting con0 using root **
SELECT @@session.timestamp != 1100000000;
@@session.timestamp != 1100000000
1
SET @@session.timestamp = 1000000000;
SELECT date(now()) != date(sysdate());
date(now()) != date(sysdate())
0
** Connection con1 **
SELECT @@session.timestamp != 1000000000;
@@session.timestamp != 1000000000
1
SELECT @@session.timestamp = 1100000000;
@@session.timestamp = 1100000000
1
** Connection default **
Disconnecting Connections con0, con1
mysql-test/r/variables-notembedded.result
View file @
733e7ce0
...
...
@@ -15,3 +15,95 @@ slave_skip_errors 3,100,137,643,1752
---- Clean Up ----
set global slave_net_timeout=default;
set global sql_slave_skip_counter= 0;
#
SHOW VARIABLES like 'log_slave_updates';
Variable_name Value
log_slave_updates OFF
SELECT @@session.log_slave_updates;
ERROR HY000: Variable 'log_slave_updates' is a GLOBAL variable
SELECT @@global.log_slave_updates;
@@global.log_slave_updates
0
SET @@session.log_slave_updates= true;
ERROR HY000: Variable 'log_slave_updates' is a read only variable
SET @@global.log_slave_updates= true;
ERROR HY000: Variable 'log_slave_updates' is a read only variable
#
SHOW VARIABLES like 'relay_log';
Variable_name Value
relay_log
SELECT @@session.relay_log;
ERROR HY000: Variable 'relay_log' is a GLOBAL variable
SELECT @@global.relay_log;
@@global.relay_log
NULL
SET @@session.relay_log= 'x';
ERROR HY000: Variable 'relay_log' is a read only variable
SET @@global.relay_log= 'x';
ERROR HY000: Variable 'relay_log' is a read only variable
#
SHOW VARIABLES like 'relay_log_index';
Variable_name Value
relay_log_index
SELECT @@session.relay_log_index;
ERROR HY000: Variable 'relay_log_index' is a GLOBAL variable
SELECT @@global.relay_log_index;
@@global.relay_log_index
NULL
SET @@session.relay_log_index= 'x';
ERROR HY000: Variable 'relay_log_index' is a read only variable
SET @@global.relay_log_index= 'x';
ERROR HY000: Variable 'relay_log_index' is a read only variable
#
SHOW VARIABLES like 'relay_log_info_file';
Variable_name Value
relay_log_info_file relay-log.info
SELECT @@session.relay_log_info_file;
ERROR HY000: Variable 'relay_log_info_file' is a GLOBAL variable
SELECT @@global.relay_log_info_file;
@@global.relay_log_info_file
relay-log.info
SET @@session.relay_log_info_file= 'x';
ERROR HY000: Variable 'relay_log_info_file' is a read only variable
SET @@global.relay_log_info_file= 'x';
ERROR HY000: Variable 'relay_log_info_file' is a read only variable
#
SHOW VARIABLES like 'relay_log_space_limit';
Variable_name Value
relay_log_space_limit 0
SELECT @@session.relay_log_space_limit;
ERROR HY000: Variable 'relay_log_space_limit' is a GLOBAL variable
SELECT @@global.relay_log_space_limit;
@@global.relay_log_space_limit
0
SET @@session.relay_log_space_limit= 7;
ERROR HY000: Variable 'relay_log_space_limit' is a read only variable
SET @@global.relay_log_space_limit= 7;
ERROR HY000: Variable 'relay_log_space_limit' is a read only variable
#
SHOW VARIABLES like 'slave_load_tmpdir';
Variable_name Value
slave_load_tmpdir #
SELECT @@session.slave_load_tmpdir;
ERROR HY000: Variable 'slave_load_tmpdir' is a GLOBAL variable
SELECT @@global.slave_load_tmpdir;
@@global.slave_load_tmpdir
#
SET @@session.slave_load_tmpdir= 'x';
ERROR HY000: Variable 'slave_load_tmpdir' is a read only variable
SET @@global.slave_load_tmpdir= 'x';
ERROR HY000: Variable 'slave_load_tmpdir' is a read only variable
#
SHOW VARIABLES like 'slave_skip_errors';
Variable_name Value
slave_skip_errors 3,100,137,643,1752
SELECT @@session.slave_skip_errors;
ERROR HY000: Variable 'slave_skip_errors' is a GLOBAL variable
SELECT @@global.slave_skip_errors;
@@global.slave_skip_errors
3,100,137,643,1752
SET @@session.slave_skip_errors= 7;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable
SET @@global.slave_skip_errors= 7;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable
mysql-test/r/variables.result
View file @
733e7ce0
...
...
@@ -1011,3 +1011,342 @@ SET GLOBAL log_output = 0;
ERROR 42000: Variable 'log_output' can't be set to the value of '0'
# -- End of Bug#34820.
#
SHOW VARIABLES like 'ft_max_word_len';
Variable_name Value
ft_max_word_len 84
SELECT @@session.ft_max_word_len;
ERROR HY000: Variable 'ft_max_word_len' is a GLOBAL variable
SELECT @@global.ft_max_word_len;
@@global.ft_max_word_len
84
SET @@session.ft_max_word_len= 7;
ERROR HY000: Variable 'ft_max_word_len' is a read only variable
SET @@global.ft_max_word_len= 7;
ERROR HY000: Variable 'ft_max_word_len' is a read only variable
#
SHOW VARIABLES like 'ft_min_word_len';
Variable_name Value
ft_min_word_len 4
SELECT @@session.ft_min_word_len;
ERROR HY000: Variable 'ft_min_word_len' is a GLOBAL variable
SELECT @@global.ft_min_word_len;
@@global.ft_min_word_len
4
SET @@session.ft_min_word_len= 7;
ERROR HY000: Variable 'ft_min_word_len' is a read only variable
SET @@global.ft_min_word_len= 7;
ERROR HY000: Variable 'ft_min_word_len' is a read only variable
#
SHOW VARIABLES like 'ft_query_expansion_limit';
Variable_name Value
ft_query_expansion_limit 20
SELECT @@session.ft_query_expansion_limit;
ERROR HY000: Variable 'ft_query_expansion_limit' is a GLOBAL variable
SELECT @@global.ft_query_expansion_limit;
@@global.ft_query_expansion_limit
20
SET @@session.ft_query_expansion_limit= 7;
ERROR HY000: Variable 'ft_query_expansion_limit' is a read only variable
SET @@global.ft_query_expansion_limit= 7;
ERROR HY000: Variable 'ft_query_expansion_limit' is a read only variable
#
SHOW VARIABLES like 'ft_stopword_file';
Variable_name Value
ft_stopword_file (built-in)
SELECT @@session.ft_stopword_file;
ERROR HY000: Variable 'ft_stopword_file' is a GLOBAL variable
SELECT @@global.ft_stopword_file;
@@global.ft_stopword_file
(built-in)
SET @@session.ft_stopword_file= 'x';
ERROR HY000: Variable 'ft_stopword_file' is a read only variable
SET @@global.ft_stopword_file= 'x';
ERROR HY000: Variable 'ft_stopword_file' is a read only variable
#
SHOW VARIABLES like 'back_log';
Variable_name Value
back_log 50
SELECT @@session.back_log;
ERROR HY000: Variable 'back_log' is a GLOBAL variable
SELECT @@global.back_log;
@@global.back_log
50
SET @@session.back_log= 7;
ERROR HY000: Variable 'back_log' is a read only variable
SET @@global.back_log= 7;
ERROR HY000: Variable 'back_log' is a read only variable
#
SHOW VARIABLES like 'large_files_support';
Variable_name Value
large_files_support #
SELECT @@session.large_files_support;
ERROR HY000: Variable 'large_files_support' is a GLOBAL variable
SELECT @@global.large_files_support;
@@global.large_files_support
#
SET @@session.large_files_support= true;
ERROR HY000: Variable 'large_files_support' is a read only variable
SET @@global.large_files_support= true;
ERROR HY000: Variable 'large_files_support' is a read only variable
#
SHOW VARIABLES like 'character_sets_dir';
Variable_name Value
character_sets_dir #
SELECT @@session.character_sets_dir;
ERROR HY000: Variable 'character_sets_dir' is a GLOBAL variable
SELECT @@global.character_sets_dir;
@@global.character_sets_dir
#
SET @@session.character_sets_dir= 'x';
ERROR HY000: Variable 'character_sets_dir' is a read only variable
SET @@global.character_sets_dir= 'x';
ERROR HY000: Variable 'character_sets_dir' is a read only variable
#
SHOW VARIABLES like 'init_file';
Variable_name Value
init_file #
SELECT @@session.init_file;
ERROR HY000: Variable 'init_file' is a GLOBAL variable
SELECT @@global.init_file;
@@global.init_file
#
SET @@session.init_file= 'x';
ERROR HY000: Variable 'init_file' is a read only variable
SET @@global.init_file= 'x';
ERROR HY000: Variable 'init_file' is a read only variable
#
SHOW VARIABLES like 'language';
Variable_name Value
language #
SELECT @@session.language;
ERROR HY000: Variable 'language' is a GLOBAL variable
SELECT @@global.language;
@@global.language
#
SET @@session.language= 'x';
ERROR HY000: Variable 'language' is a read only variable
SET @@global.language= 'x';
ERROR HY000: Variable 'language' is a read only variable
#
SHOW VARIABLES like 'large_page_size';
Variable_name Value
large_page_size #
SELECT @@session.large_page_size;
ERROR HY000: Variable 'large_page_size' is a GLOBAL variable
SELECT @@global.large_page_size;
@@global.large_page_size
#
SET @@session.large_page_size= 7;
ERROR HY000: Variable 'large_page_size' is a read only variable
SET @@global.large_page_size= 7;
ERROR HY000: Variable 'large_page_size' is a read only variable
#
SHOW VARIABLES like 'large_pages';
Variable_name Value
large_pages #
SELECT @@session.large_pages;
ERROR HY000: Variable 'large_pages' is a GLOBAL variable
SELECT @@global.large_pages;
@@global.large_pages
#
SET @@session.large_pages= true;
ERROR HY000: Variable 'large_pages' is a read only variable
SET @@global.large_pages= true;
ERROR HY000: Variable 'large_pages' is a read only variable
#
SHOW VARIABLES like 'log_bin';
Variable_name Value
log_bin OFF
SELECT @@session.log_bin;
ERROR HY000: Variable 'log_bin' is a GLOBAL variable
SELECT @@global.log_bin;
@@global.log_bin
0
SET @@session.log_bin= true;
ERROR HY000: Variable 'log_bin' is a read only variable
SET @@global.log_bin= true;
ERROR HY000: Variable 'log_bin' is a read only variable
#
SHOW VARIABLES like 'log_error';
Variable_name Value
log_error #
SELECT @@session.log_error;
ERROR HY000: Variable 'log_error' is a GLOBAL variable
SELECT @@global.log_error;
@@global.log_error
#
SET @@session.log_error= 'x';
ERROR HY000: Variable 'log_error' is a read only variable
SET @@global.log_error= 'x';
ERROR HY000: Variable 'log_error' is a read only variable
#
SHOW VARIABLES like 'lower_case_file_system';
Variable_name Value
lower_case_file_system #
SELECT @@session.lower_case_file_system;
ERROR HY000: Variable 'lower_case_file_system' is a GLOBAL variable
SELECT @@global.lower_case_file_system;
@@global.lower_case_file_system
#
SET @@session.lower_case_file_system= true;
ERROR HY000: Variable 'lower_case_file_system' is a read only variable
SET @@global.lower_case_file_system= true;
ERROR HY000: Variable 'lower_case_file_system' is a read only variable
#
SHOW VARIABLES like 'lower_case_table_names';
Variable_name Value
lower_case_table_names #
SELECT @@session.lower_case_table_names;
ERROR HY000: Variable 'lower_case_table_names' is a GLOBAL variable
SELECT @@global.lower_case_table_names;
@@global.lower_case_table_names
#
SET @@session.lower_case_table_names= 7;
ERROR HY000: Variable 'lower_case_table_names' is a read only variable
SET @@global.lower_case_table_names= 7;
ERROR HY000: Variable 'lower_case_table_names' is a read only variable
#
SHOW VARIABLES like 'myisam_recover_options';
Variable_name Value
myisam_recover_options OFF
SELECT @@session.myisam_recover_options;
ERROR HY000: Variable 'myisam_recover_options' is a GLOBAL variable
SELECT @@global.myisam_recover_options;
@@global.myisam_recover_options
OFF
SET @@session.myisam_recover_options= 'x';
ERROR HY000: Variable 'myisam_recover_options' is a read only variable
SET @@global.myisam_recover_options= 'x';
ERROR HY000: Variable 'myisam_recover_options' is a read only variable
#
SHOW VARIABLES like 'open_files_limit';
Variable_name Value
open_files_limit #
SELECT @@session.open_files_limit;
ERROR HY000: Variable 'open_files_limit' is a GLOBAL variable
SELECT @@global.open_files_limit;
@@global.open_files_limit
#
SET @@session.open_files_limit= 7;
ERROR HY000: Variable 'open_files_limit' is a read only variable
SET @@global.open_files_limit= 7;
ERROR HY000: Variable 'open_files_limit' is a read only variable
#
SHOW VARIABLES like 'pid_file';
Variable_name Value
pid_file #
SELECT @@session.pid_file;
ERROR HY000: Variable 'pid_file' is a GLOBAL variable
SELECT @@global.pid_file;
@@global.pid_file
#
SET @@session.pid_file= 'x';
ERROR HY000: Variable 'pid_file' is a read only variable
SET @@global.pid_file= 'x';
ERROR HY000: Variable 'pid_file' is a read only variable
#
SHOW VARIABLES like 'plugin_dir';
Variable_name Value
plugin_dir #
SELECT @@session.plugin_dir;
ERROR HY000: Variable 'plugin_dir' is a GLOBAL variable
SELECT @@global.plugin_dir;
@@global.plugin_dir
#
SET @@session.plugin_dir= 'x';
ERROR HY000: Variable 'plugin_dir' is a read only variable
SET @@global.plugin_dir= 'x';
ERROR HY000: Variable 'plugin_dir' is a read only variable
#
SHOW VARIABLES like 'port';
Variable_name Value
port #
SELECT @@session.port;
ERROR HY000: Variable 'port' is a GLOBAL variable
SELECT @@global.port;
@@global.port
#
SET @@session.port= 7;
ERROR HY000: Variable 'port' is a read only variable
SET @@global.port= 7;
ERROR HY000: Variable 'port' is a read only variable
#
SHOW VARIABLES like 'protocol_version';
Variable_name Value
protocol_version 10
SELECT @@session.protocol_version;
ERROR HY000: Variable 'protocol_version' is a GLOBAL variable
SELECT @@global.protocol_version;
@@global.protocol_version
10
SET @@session.protocol_version= 7;
ERROR HY000: Variable 'protocol_version' is a read only variable
SET @@global.protocol_version= 7;
ERROR HY000: Variable 'protocol_version' is a read only variable
#
SHOW VARIABLES like 'skip_external_locking';
Variable_name Value
skip_external_locking ON
SELECT @@session.skip_external_locking;
ERROR HY000: Variable 'skip_external_locking' is a GLOBAL variable
SELECT @@global.skip_external_locking;
@@global.skip_external_locking
1
SET @@session.skip_external_locking= true;
ERROR HY000: Variable 'skip_external_locking' is a read only variable
SET @@global.skip_external_locking= true;
ERROR HY000: Variable 'skip_external_locking' is a read only variable
#
SHOW VARIABLES like 'skip_networking';
Variable_name Value
skip_networking OFF
SELECT @@session.skip_networking;
ERROR HY000: Variable 'skip_networking' is a GLOBAL variable
SELECT @@global.skip_networking;
@@global.skip_networking
0
SET @@session.skip_networking= true;
ERROR HY000: Variable 'skip_networking' is a read only variable
SET @@global.skip_networking= true;
ERROR HY000: Variable 'skip_networking' is a read only variable
#
SHOW VARIABLES like 'skip_show_database';
Variable_name Value
skip_show_database OFF
SELECT @@session.skip_show_database;
ERROR HY000: Variable 'skip_show_database' is a GLOBAL variable
SELECT @@global.skip_show_database;
@@global.skip_show_database
0
SET @@session.skip_show_database= true;
ERROR HY000: Variable 'skip_show_database' is a read only variable
SET @@global.skip_show_database= true;
ERROR HY000: Variable 'skip_show_database' is a read only variable
#
SHOW VARIABLES like 'socket';
Variable_name Value
socket #
SELECT @@session.socket;
ERROR HY000: Variable 'socket' is a GLOBAL variable
SELECT @@global.socket;
@@global.socket
#
SET @@session.socket= 'x';
ERROR HY000: Variable 'socket' is a read only variable
SET @@global.socket= 'x';
ERROR HY000: Variable 'socket' is a read only variable
#
SHOW VARIABLES like 'thread_stack';
Variable_name Value
thread_stack #
SELECT @@session.thread_stack;
ERROR HY000: Variable 'thread_stack' is a GLOBAL variable
SELECT @@global.thread_stack;
@@global.thread_stack
#
SET @@session.thread_stack= 7;
ERROR HY000: Variable 'thread_stack' is a read only variable
SET @@global.thread_stack= 7;
ERROR HY000: Variable 'thread_stack' is a read only variable
mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
View file @
733e7ce0
...
...
@@ -185,7 +185,7 @@ let $message= use db with trigger privilege on db level and without...:;
select
f1
from
t1
order
by
f1
;
--
disable_warnings
disconnect
no_privs
;
--
enable
warnings
--
enable
_
warnings
connection
yes_privs
;
select
current_user
;
...
...
mysql-test/t/disabled.def
View file @
733e7ce0
...
...
@@ -10,6 +10,5 @@
#
##############################################################################
federated_transactions : Bug#29523 Transactions do not work
csv_alter_table : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows
slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions
mysql-test/t/events_scheduling.test
View file @
733e7ce0
# Can't test with embedded server that doesn't support
gra
nts
# Can't test with embedded server that doesn't support
eve
nts
--
source
include
/
not_embedded
.
inc
CREATE
DATABASE
IF
NOT
EXISTS
events_test
;
USE
events_test
;
SET
@
event_scheduler
=@@
global
.
event_scheduler
;
SET
GLOBAL
event_scheduler
=
OFF
;
--
echo
Try
ag
ia
n
to
make
sure
it
's allowed
--
echo
Try
ag
ai
n
to
make
sure
it
's allowed
SET GLOBAL event_scheduler=OFF;
SHOW VARIABLES LIKE '
event_scheduler
';
SET GLOBAL event_scheduler=1;
...
...
@@ -57,34 +58,44 @@ ON COMPLETION PRESERVE
DO
INSERT
INTO
table_4
VALUES
(
1
);
# Wait for the events to fire and check the data afterwards
# Let event_1 insert at least 4 records into the table
let
$wait_condition
=
select
count
(
*
)
>=
4
from
table_1
;
--
source
include
/
wait_condition
.
inc
# Minimum of passed time is 6 seconds assuming
# - event executions starts immediate after creation
# - 4 times event_1 means an insert at ect, ect+2, ect+4, ect+6
# ect = event creation time
# Let event_2 reach the end of its execution interval
# Let event_2 reach the end of its execution interval
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
where
event_name
=
'event_2'
and
status
=
'enabled'
;
--
source
include
/
wait_condition
.
inc
# Minimum of passed time is 6 seconds.
# See wait_condition for event_1 above and ENDS condition for event_2.
# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself
# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
where
event_name
=
'event_3'
;
--
source
include
/
wait_condition
.
inc
# Let event_4 reach the end of its execution interval
# Let event_4 reach the end of its execution interval
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
where
event_name
=
'event_4'
and
status
=
'enabled'
;
--
source
include
/
wait_condition
.
inc
# Wait for the events to fire and check the data afterwards
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
4
FROM
table_1
;
source
include
/
wait_condition
.
inc
;
SELECT
IF
(
SUM
(
a
)
>=
4
,
'OK'
,
'ERROR'
)
FROM
table_1
;
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
5
FROM
table_2
;
# In case of a testing box under heavy load it cannot be guaranteed that
# it is really often enough checked if event_2 has to be executed.
# -> Bug#39854 events_scheduling fails sporadically on pushbuild
# Therefore we lowered here the original expectation of 5 to 4.
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
4
FROM
table_2
;
source
include
/
wait_condition
.
inc
;
SELECT
IF
(
SUM
(
a
)
>=
5
,
'OK'
,
'ERROR'
)
FROM
table_2
;
SELECT
IF
(
SUM
(
a
)
>=
4
,
'OK'
,
'ERROR'
)
FROM
table_2
;
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
1
FROM
table_3
;
source
include
/
wait_condition
.
inc
;
...
...
@@ -112,9 +123,9 @@ DROP TABLE table_2;
DROP
TABLE
table_3
;
DROP
TABLE
table_4
;
DROP
DATABASE
events_test
;
SET
GLOBAL
event_scheduler
=
OFF
;
SET
GLOBAL
event_scheduler
=
@
event_scheduler
;
#
#
# End of tests
#
...
...
mysql-test/t/events_time_zone.test
View file @
733e7ce0
# This test case is sensitive to execution timing. You may control
# this sensitivity by the parameter below. Small values will result
# in fast but more unstable execution, large values will improve
# stability at the cost of speed. Basically, N is a number of seconds
# to wait for operation to complete. Should be positive. Test runs
# about 25*N seconds (it sleeps most of the time, so CPU speed is not
# relevant).
#
1.
This test case is sensitive to execution timing. You may control
#
this sensitivity by the parameter below. Small values will result
#
in fast but more unstable execution, large values will improve
#
stability at the cost of speed. Basically, N is a number of seconds
#
to wait for operation to complete. Should be positive. Test runs
#
about 25*N seconds (it sleeps most of the time, so CPU speed is not
#
relevant).
let
$N
=
5
;
#
# 2. Some subtests
# - create a new time zone
# - run some statements
# - delete the new time zone.
# But the time zone name used gets somewhere cached and it cannot be
# "reused" later in the same or another session for a new time zone.
# Experiments (2008-11 MySQL 5.1) showed that none of the available
# RESET/FLUSH commands removes these entries.
# 2008-11 MySQL 5.1 Bug#39979 main.events_time_zone does not clean up
# second bad effect
# Therefore we compute unique and unusual timezone names to minimize
# the likelihood that a later test uses the same name.
#
# 3. The subtests mentioned in 2. cause that the AUTO_INCREMENT value
# within "SHOW CREATE TABLE mysql.timezone" differ from the initial one.
# (Bug#39979 main.events_time_zone does not clean up)
# Therefore we reset this value after each of these subtests.
#
# Note(mleich):
# There is a significant likelihood that future improvements of the server
# cause that the solutions for the issues mentioned in 2. and 3. will no
# more work.
# A mysql-test-run.pl feature which allows to enforce
# 1. Server shutdown (-> Problem mentioned in 2. disappears)
# 2. Reset all data to initial state (-> Problem mentioned in 3. disappears)
# 3. Server start
# after a tests would be a perfect replacement.
#
--
source
include
/
big_test
.
inc
...
...
@@ -73,19 +102,15 @@ delimiter ;//
SET
@
step3
=
@
step
*
3
;
SET
@
step6
=
@
step
*
6
;
# Disable query log to hide current time.
--
disable_query_log
SET
@
unix_time
=
UNIX_TIMESTAMP
()
-
1
;
--
enable_query_log
SET
@
unix_time
=
@
unix_time
-
@
unix_time
%
@
step6
;
INSERT
INTO
mysql
.
time_zone
VALUES
(
NULL
,
'N'
);
SET
@
tzid
=
LAST_INSERT_ID
();
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
0
,
0
,
0
,
'b16420_0'
);
VALUES
(
@
tzid
,
0
,
0
,
0
,
'b16420_0'
);
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
1
,
@
step3
-
@
step
,
1
,
'b16420_1'
);
VALUES
(
@
tzid
,
1
,
@
step3
-
@
step
,
1
,
'b16420_1'
);
let
$transition_unix_time
=
`SELECT @unix_time`
;
let
$count
=
30
;
...
...
@@ -99,7 +124,9 @@ while ($count)
dec
$count
;
}
--
enable_query_log
INSERT
INTO
mysql
.
time_zone_name
VALUES
(
'bug16420'
,
@
tzid
);
let
$tz_name
=
`SELECT CONCAT('b16420_a',UNIX_TIMESTAMP())`
;
--
replace_result
$tz_name
<
TZ_NAME_1
>
eval
INSERT
INTO
mysql
.
time_zone_name
VALUES
(
'$tz_name'
,
@
tzid
);
CREATE
TABLE
t1
(
count
INT
,
unix_time
INT
,
local_time
INT
,
comment
CHAR
(
80
));
CREATE
TABLE
t2
(
count
INT
);
...
...
@@ -135,7 +162,8 @@ SET TIME_ZONE= '+00:00';
CREATE
EVENT
e1
ON
SCHEDULE
EVERY
@
step
SECOND
STARTS
FROM_UNIXTIME
(
@
unix_time
)
DO
SELECT
f1
(
"<e1>"
);
SET
TIME_ZONE
=
'bug16420'
;
--
replace_result
$tz_name
<
TZ_NAME_1
>
eval
SET
TIME_ZONE
=
'$tz_name'
;
CREATE
EVENT
e2
ON
SCHEDULE
EVERY
@
step
SECOND
STARTS
FROM_UNIXTIME
(
@
unix_time
)
DO
SELECT
f1
(
"<e2>"
);
...
...
@@ -196,6 +224,8 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE
FROM
mysql
.
time_zone_transition_type
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone_transition
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone
WHERE
time_zone_id
=
@
tzid
;
let
$time_zone_auto_inc
=
`SELECT MAX(Time_zone_id) + 1 FROM mysql.time_zone`
;
eval
ALTER
TABLE
mysql
.
time_zone
AUTO_INCREMENT
=
$time_zone_auto_inc
;
#----------------------------------------------------------------------
...
...
@@ -216,13 +246,13 @@ SET @offset_month_03= UNIX_TIMESTAMP('2030-03-31 12:00:00') - @now - 5*@step;
SET
@
offset_month_04
=
UNIX_TIMESTAMP
(
'2030-04-30 12:00:00'
)
-
@
now
-
13
*@
step
;
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
0
,
@
offset_month_01
,
0
,
'b16420_0'
);
VALUES
(
@
tzid
,
0
,
@
offset_month_01
,
0
,
'b16420_0'
);
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
1
,
@
offset_month_02
,
1
,
'b16420_1'
);
VALUES
(
@
tzid
,
1
,
@
offset_month_02
,
1
,
'b16420_1'
);
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
2
,
@
offset_month_03
,
1
,
'b16420_2'
);
VALUES
(
@
tzid
,
2
,
@
offset_month_03
,
1
,
'b16420_2'
);
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
3
,
@
offset_month_04
,
1
,
'b16420_3'
);
VALUES
(
@
tzid
,
3
,
@
offset_month_04
,
1
,
'b16420_3'
);
INSERT
INTO
mysql
.
time_zone_transition
VALUES
(
@
tzid
,
@
now
,
0
);
INSERT
INTO
mysql
.
time_zone_transition
...
...
@@ -231,11 +261,12 @@ INSERT INTO mysql.time_zone_transition
VALUES
(
@
tzid
,
@
now
+
7
*
@
step
,
2
);
INSERT
INTO
mysql
.
time_zone_transition
VALUES
(
@
tzid
,
@
now
+
12
*
@
step
,
3
);
# We have to user a new time zone name, because 'bug16420' has been
# cached already.
INSERT
INTO
mysql
.
time_zone_name
VALUES
(
'bug16420_2
'
,
@
tzid
);
let
$tz_name
=
`SELECT CONCAT('b16420_b',UNIX_TIMESTAMP())`
;
--
replace_result
$tz_name
<
TZ_NAME_2
>
eval
INSERT
INTO
mysql
.
time_zone_name
VALUES
(
'$tz_name
'
,
@
tzid
);
SET
TIME_ZONE
=
'bug16420_2'
;
--
replace_result
$tz_name
<
TZ_NAME_2
>
eval
SET
TIME_ZONE
=
'$tz_name'
;
SET
GLOBAL
EVENT_SCHEDULER
=
ON
;
...
...
@@ -280,6 +311,8 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE
FROM
mysql
.
time_zone_transition_type
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone_transition
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone
WHERE
time_zone_id
=
@
tzid
;
let
$time_zone_auto_inc
=
`SELECT MAX(Time_zone_id) + 1 FROM mysql.time_zone`
;
eval
ALTER
TABLE
mysql
.
time_zone
AUTO_INCREMENT
=
$time_zone_auto_inc
;
DROP
FUNCTION
round_to_step
;
DROP
TABLE
t_step
;
...
...
@@ -291,8 +324,8 @@ eval USE $old_db;
--
enable_query_log
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
processlist
where
db
=
'mysqltest_db1'
and
command
=
'Connect'
and
user
=
current_user
();
SELECT
COUNT
(
*
)
=
0
FROM
information_schema
.
processlist
WHERE
db
=
'mysqltest_db1'
AND
command
=
'Connect'
AND
user
=
current_user
();
--
source
include
/
wait_condition
.
inc
--
echo
End
of
5.1
tests
.
mysql-test/t/group_concat_max_len_func.test
View file @
733e7ce0
...
...
@@ -11,18 +11,23 @@
# Creation Date: 2008-03-07 #
# Author: Salman Rawala #
# #
# Last modification: #
# 2008-11-14 mleich Fix Bug#40644 main.group_concat_max_len_func random #
# failures #
# + minor improvements #
# #
# Description: Test Cases of Dynamic System Variable group_concat_max_len #
# that checks the functionality of this variable #
# #
# Reference:
http://dev.mysql.com/doc/refman/5.1/en/
#
#
server-system-variables.html
#
# Reference:
#
#
http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html
#
# #
###############################################################################
SET
@
save
=
@@
global
.
group_concat_max_len
;
--
disable_warnings
drop
table
if
exists
t1
;
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
#########################
...
...
@@ -32,34 +37,38 @@ drop table if exists t1;
--
echo
## Creating new table t1 ##
CREATE
TABLE
t1
(
id
INT
NOT
NULL
auto_increment
,
id
INT
NOT
NULL
AUTO_INCREMENT
,
PRIMARY
KEY
(
id
),
rollno
int
NOT
NULL
,
rollno
INT
NOT
NULL
,
name
VARCHAR
(
30
)
);
--
echo
'#--------------------FN_DYNVARS_034_01-------------------------#'
########################################################################
# Setting initial value of group_concat_max_len, inserting some rows
# & creating 2 new connections
# & creating 2 new connections
########################################################################
--
echo
## Setting initial value of variable to 4 ##
--
echo
## Setting initial value of variable to 4 ##
SET
@@
global
.
group_concat_max_len
=
4
;
--
echo
## Inserting some rows in table ##
INSERT
into
t1
(
rollno
,
name
)
values
(
1
,
'Record_1'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
2
,
'Record_2'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
1
,
'Record_3'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
3
,
'Record_4'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
1
,
'Record_5'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
3
,
'Record_6'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
4
,
'Record_7'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
4
,
'Record_8'
);
--
echo
## Creating two new connections ##
CONNECT
(
test_con1
,
localhost
,
root
,,);
CONNECT
(
test_con2
,
localhost
,
root
,,);
--
echo
## Inserting some rows in table ##
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
1
,
'Record_1'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
2
,
'Record_2'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
1
,
'Record_3'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
3
,
'Record_4'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
1
,
'Record_5'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
3
,
'Record_6'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
4
,
'Record_7'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
4
,
'Record_8'
);
# The following "auxiliary" select ensures that all records are on disk
# = result sets got by parallel sessions cannot suffer from effects
# caused by the MyISAM feature "concurrent_inserts".
SELECT
*
FROM
t1
ORDER
BY
id
;
--
echo
## Creating two new connections ##
connect
(
test_con1
,
localhost
,
root
,,);
connect
(
test_con2
,
localhost
,
root
,,);
--
echo
'#--------------------FN_DYNVARS_034_02-------------------------#'
...
...
@@ -68,16 +77,16 @@ CONNECT (test_con2,localhost,root,,);
###############################################################################
--
echo
## Connecting with test_con1 ##
CONNECTION
test_con1
;
connection
test_con1
;
--
echo
## Accessing data and using group_concat on column whose value is greater than 4 ##
SELECT
id
,
rollno
,
group_concat
(
name
)
FROM
t1
GROUP
BY
rollno
;
--
echo
## Accessing data and using group_concat on column whose value is greater than 4 ##
SELECT
id
,
rollno
,
GROUP_CONCAT
(
name
)
FROM
t1
GROUP
BY
rollno
;
--
echo
## Changing session value of variable and verifying its behavior, ##
--
echo
## warning should come here ##
--
echo
## warning should come here ##
SET
@@
session
.
group_concat_max_len
=
10
;
SELECT
id
,
rollno
,
group_concat
(
name
)
FROM
t1
GROUP
BY
rollno
;
SELECT
id
,
rollno
,
GROUP_CONCAT
(
name
)
FROM
t1
GROUP
BY
rollno
;
--
echo
'#--------------------FN_DYNVARS_034_03-------------------------#'
...
...
@@ -85,19 +94,19 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
# Verifying behavior of variable by increasing session value of variable #
##############################################################################
--
echo
## Connecting with new connection test_con2 ##
--
echo
## Connecting with new connection test_con2 ##
connection
test_con2
;
--
echo
## Verifying initial value of variable. It should be 4 ##
--
echo
## Verifying initial value of variable. It should be 4 ##
SELECT
@@
session
.
group_concat_max_len
=
4
;
--
echo
## Setting session value of variable to 20 and verifying variable is concating ##
--
echo
## column's value to 20 or not ##
--
echo
## Setting session value of variable to 20 and verifying variable is concating ##
--
echo
## column's value to 20 or not ##
SET
@@
session
.
group_concat_max_len
=
20
;
--
echo
## Verifying value of name column, it should not me more than 20 characters ##
--
echo
## Warning should come here ##
SELECT
id
,
rollno
,
group_concat
(
name
)
FROM
t1
GROUP
BY
rollno
;
SELECT
id
,
rollno
,
GROUP_CONCAT
(
name
)
FROM
t1
GROUP
BY
rollno
;
--
echo
'#--------------------FN_DYNVARS_034_04-------------------------#'
...
...
@@ -106,12 +115,12 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
# greater than the maximum concat length of name column #
###############################################################################
--
echo
## Setting session value of variable to 26. No warning should appear here ##
--
echo
## because the value after concatination is less than 30 ##
--
echo
## Setting session value of variable to 26. No warning should appear here ##
--
echo
## because the value after concatination is less than 30 ##
SET
@@
session
.
group_concat_max_len
=
26
;
--
echo
## Verifying value of name column, it should not give warning now ##
SELECT
id
,
rollno
,
group_concat
(
name
)
FROM
t1
GROUP
BY
rollno
;
--
echo
## Verifying value of name column, it should not give warning now ##
SELECT
id
,
rollno
,
GROUP_CONCAT
(
name
)
FROM
t1
GROUP
BY
rollno
;
############################################################
...
...
@@ -119,11 +128,11 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
############################################################
--
echo
## Dropping table t1 ##
DROP
table
t1
;
DROP
TABLE
t1
;
--
echo
## Disconnecting both the connection ##
DISCONNECT
test_con2
;
DISCONNECT
test_con1
;
disconnect
test_con2
;
disconnect
test_con1
;
connection
default
;
...
...
mysql-test/t/multi_update.test
View file @
733e7ce0
...
...
@@ -10,9 +10,9 @@ source include/have_log_bin.inc;
drop
table
if
exists
t1
,
t2
,
t3
;
drop
database
if
exists
mysqltest
;
drop
view
if
exists
v1
;
--
error
0
,
1141
,
1147
--
error
0
,
ER_NONEXISTING_GRANT
,
ER_NONEXISTING_TABLE_GRANT
revoke
all
privileges
on
mysqltest
.
t1
from
mysqltest_1
@
localhost
;
--
error
0
,
1141
,
1147
--
error
0
,
ER_NONEXISTING_GRANT
,
ER_NONEXISTING_TABLE_GRANT
revoke
all
privileges
on
mysqltest
.*
from
mysqltest_1
@
localhost
;
delete
from
mysql
.
user
where
user
=
_binary
'mysqltest_1'
;
--
enable_warnings
...
...
@@ -160,9 +160,9 @@ create table t2 (n int(10) not null primary key, d int(10));
insert
into
t1
values
(
1
,
1
);
insert
into
t2
values
(
1
,
10
),(
2
,
20
);
LOCK
TABLES
t1
write
,
t2
read
;
--
error
1099
--
error
ER_TABLE_NOT_LOCKED_FOR_WRITE
DELETE
t1
.*
,
t2
.*
FROM
t1
,
t2
where
t1
.
n
=
t2
.
n
;
--
error
1099
--
error
ER_TABLE_NOT_LOCKED_FOR_WRITE
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
,
t2
.
d
=
30
WHERE
t1
.
n
=
t2
.
n
;
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
WHERE
t1
.
n
=
t2
.
n
;
unlock
tables
;
...
...
@@ -183,7 +183,7 @@ create table t1 (n int(10), d int(10));
create
table
t2
(
n
int
(
10
),
d
int
(
10
));
insert
into
t1
values
(
1
,
1
);
insert
into
t2
values
(
1
,
10
),(
2
,
20
);
--
error
1175
--
error
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
WHERE
t1
.
n
=
t2
.
n
;
set
sql_safe_updates
=
0
;
drop
table
t1
,
t2
;
...
...
@@ -196,7 +196,7 @@ set timestamp=1038000000;
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
WHERE
t1
.
n
=
t2
.
n
;
select
n
,
d
,
unix_timestamp
(
t
)
from
t1
;
select
n
,
d
,
unix_timestamp
(
t
)
from
t2
;
--
error
1064
--
error
ER_PARSE_ERROR
UPDATE
t1
,
t2
SET
1
=
2
WHERE
t1
.
n
=
t2
.
n
;
drop
table
t1
,
t2
;
set
timestamp
=
0
;
...
...
@@ -323,41 +323,6 @@ delete t1, t2 from t2,t1
drop
table
t1
,
t2
;
#
# Test for bug #1820.
#
create
table
t1
(
a
int
not
null
,
b
int
not
null
)
;
--
disable_query_log
insert
into
t1
values
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
);
let
$
1
=
19
;
set
@
d
=
4
;
while
(
$
1
)
{
eval
insert
into
t1
select
a
+@
d
,
b
+@
d
from
t1
;
eval
set
@
d
=@
d
*
2
;
dec
$
1
;
}
--
enable_query_log
alter
table
t1
add
index
i1
(
a
);
delete
from
t1
where
a
>
2000000
;
create
table
t2
like
t1
;
insert
into
t2
select
*
from
t1
;
select
't2 rows before small delete'
,
count
(
*
)
from
t1
;
delete
t1
,
t2
from
t1
,
t2
where
t1
.
b
=
t2
.
a
and
t1
.
a
<
2
;
select
't2 rows after small delete'
,
count
(
*
)
from
t2
;
select
't1 rows after small delete'
,
count
(
*
)
from
t1
;
## Try deleting many rows
delete
t1
,
t2
from
t1
,
t2
where
t1
.
b
=
t2
.
a
and
t1
.
a
<
100
*
1000
;
select
't2 rows after big delete'
,
count
(
*
)
from
t2
;
select
't1 rows after big delete'
,
count
(
*
)
from
t1
;
drop
table
t1
,
t2
;
#
# Test alias (this is not correct in 4.0)
#
...
...
@@ -367,7 +332,7 @@ CREATE TABLE t2 ( a int );
DELETE
t1
FROM
t1
,
t2
AS
t3
;
DELETE
t4
FROM
t1
,
t1
AS
t4
;
DELETE
t3
FROM
t1
AS
t3
,
t1
AS
t4
;
--
error
1109
--
error
ER_UNKNOWN_TABLE
DELETE
t1
FROM
t1
AS
t3
,
t2
AS
t4
;
INSERT
INTO
t1
values
(
1
),(
2
);
INSERT
INTO
t2
values
(
1
),(
2
);
...
...
@@ -422,7 +387,7 @@ drop database mysqltest;
create
table
t1
(
a
int
,
primary
key
(
a
));
create
table
t2
(
a
int
,
primary
key
(
a
));
create
table
t3
(
a
int
,
primary
key
(
a
));
--
error
1109
--
error
ER_UNKNOWN_TABLE
delete
t1
,
t3
from
t1
,
t2
where
t1
.
a
=
t2
.
a
and
t2
.
a
=
(
select
t3
.
a
from
t3
where
t1
.
a
=
t3
.
a
);
drop
table
t1
,
t2
,
t3
;
...
...
@@ -431,9 +396,9 @@ drop table t1, t2, t3;
#
create
table
t1
(
col1
int
);
create
table
t2
(
col1
int
);
--
error
1093
--
error
ER_UPDATE_TABLE_USED
update
t1
,
t2
set
t1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
t1
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
delete
t1
from
t1
,
t2
where
t1
.
col1
<
(
select
max
(
col1
)
from
t1
)
and
t1
.
col1
=
t2
.
col1
;
drop
table
t1
,
t2
;
...
...
@@ -458,7 +423,7 @@ drop table t1, t2;
#
create
table
t1
(
a
int
);
create
table
t2
(
a
int
);
--
error
1093
--
error
ER_UPDATE_TABLE_USED
delete
from
t1
,
t2
using
t1
,
t2
where
t1
.
a
=
(
select
a
from
t1
);
drop
table
t1
,
t2
;
# End of 4.1 tests
...
...
mysql-test/t/multi_update2-master.opt
0 → 100644
View file @
733e7ce0
--set-variable=tmp_table_size=1024
mysql-test/t/multi_update2.test
0 → 100644
View file @
733e7ce0
#
# Test of update statement that uses many tables.
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
;
--
enable_warnings
#
# Bug#1820 Rows not deleted from second table on multi-table delete
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
,
b
INT
NOT
NULL
)
;
--
echo
# The protocolling of many inserts into t1 is suppressed.
--
disable_query_log
INSERT
INTO
t1
VALUES
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
);
let
$
1
=
19
;
set
@
d
=
4
;
while
(
$
1
)
{
eval
INSERT
INTO
t1
SELECT
a
+@
d
,
b
+@
d
FROM
t1
;
eval
SET
@
d
=@
d
*
2
;
dec
$
1
;
}
--
enable_query_log
ALTER
TABLE
t1
ADD
INDEX
i1
(
a
);
DELETE
FROM
t1
WHERE
a
>
2000000
;
CREATE
TABLE
t2
LIKE
t1
;
INSERT
INTO
t2
SELECT
*
FROM
t1
;
SELECT
't2 rows before small delete'
,
COUNT
(
*
)
FROM
t1
;
DELETE
t1
,
t2
FROM
t1
,
t2
WHERE
t1
.
b
=
t2
.
a
AND
t1
.
a
<
2
;
SELECT
't2 rows after small delete'
,
COUNT
(
*
)
FROM
t2
;
SELECT
't1 rows after small delete'
,
COUNT
(
*
)
FROM
t1
;
## Try deleting many rows
DELETE
t1
,
t2
FROM
t1
,
t2
WHERE
t1
.
b
=
t2
.
a
AND
t1
.
a
<
100
*
1000
;
SELECT
't2 rows after big delete'
,
COUNT
(
*
)
FROM
t2
;
SELECT
't1 rows after big delete'
,
COUNT
(
*
)
FROM
t1
;
DROP
TABLE
t1
,
t2
;
mysql-test/t/symlink.test
View file @
733e7ce0
...
...
@@ -194,26 +194,49 @@ DROP TABLE t1;
#
# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
#
# With Bug#41002 (symlink.test fails on symlinked datadir) it was
# decided that the below statements may also succeed if the data
# home directory is symlinked, e.g. mysql-test-run --mem.
# This will be fixed in 6.0 only.
#
--
replace_result
$MYSQLTEST_VARDIR
TEST_DIR
--
error
ER_WRONG_ARGUMENTS
--
error
0
,
ER_WRONG_ARGUMENTS
eval
CREATE
TABLE
t1
(
a
INT
)
INDEX
DIRECTORY
=
'$MYSQLTEST_VARDIR/master-data/mysql'
;
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
#
--
replace_result
$MYSQLTEST_VARDIR
TEST_DIR
--
error
ER_WRONG_ARGUMENTS
--
error
0
,
ER_WRONG_ARGUMENTS
eval
CREATE
TABLE
t1
(
a
INT
)
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/master-data/test'
;
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
#
--
replace_result
$MYSQLTEST_VARDIR
TEST_DIR
--
error
ER_WRONG_ARGUMENTS
--
error
0
,
ER_WRONG_ARGUMENTS
eval
CREATE
TABLE
t1
(
a
INT
)
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/master-data/'
;
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
#
--
replace_result
$MYSQLTEST_VARDIR
TEST_DIR
--
error
ER_WRONG_ARGUMENTS
--
error
0
,
ER_WRONG_ARGUMENTS
eval
CREATE
TABLE
t1
(
a
INT
)
INDEX
DIRECTORY
=
'$MYSQLTEST_VARDIR/master-data'
;
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
#
--
replace_result
$MYSQLTEST_VARDIR
TEST_DIR
--
error
1
eval
CREATE
TABLE
t1
(
a
INT
)
INDEX
DIRECTORY
=
'$MYSQLTEST_VARDIR/master-data_var'
;
#
# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
# silently ignored
#
...
...
mysql-test/t/timestamp_func.test
View file @
733e7ce0
...
...
@@ -9,6 +9,8 @@
# Creation Date: 2008-02-25 #
# Author: Sharique Abdullah #
# #
# Modified: HHunger 2008-08-28 Reimplemented the test completely. #
# #
# Description: Test Cases of Dynamic System Variable "timestamp" #
# that checks behavior of this variable in the following ways #
# * Functionality based on different values #
...
...
@@ -17,63 +19,32 @@
# #
############################################################################
--
echo
**
Setup
**
--
echo
#
# Setup
#
--
echo
**
Connecting
con0
using
root
**
connect
(
con0
,
localhost
,
root
,,);
--
echo
**
Connecting
con1
using
root
**
connect
(
con1
,
localhost
,
root
,,);
--
echo
'#-----------------------------FN_DYNVARS_179_01------------------#'
#
# Checking for connection 1
#
# Change timestamp which must have an effect on now(), but not on sysdate().
# Use Unix epoch timestamp
# All comparisons must deliver true(1)
# Exception: --sysdate-is-now switches off this behaviour and must not be set.
--
echo
**
Connection
con0
**
connection
con0
;
SET
@
ts_old
=
@@
SESSION
.
timestamp
;
--
echo
waiting
1
sec
--
sleep
1
SET
@
ts_new
=
@@
SESSION
.
timestamp
;
SELECT
@
ts_new
-
@
ts_old
>=
1
AS
'Timestamp Difference'
;
--
echo
1
means
>=
1
expected
is
true
--
echo
**
Connecting
con1
using
root
**
connect
(
con1
,
localhost
,
root
,,);
SELECT
date
(
now
())
=
date
(
sysdate
());
SET
@@
session
.
timestamp
=
1100000000
;
SELECT
date
(
now
())
!=
date
(
sysdate
());
# Assure that setting of the variable has no effect on other session.
--
echo
**
Connecting
con0
using
root
**
connect
(
con0
,
localhost
,
root
,,);
SELECT
@@
session
.
timestamp
!=
1100000000
;
SET
@@
session
.
timestamp
=
1000000000
;
SELECT
date
(
now
())
!=
date
(
sysdate
());
#
# Checking for connection 2
#
--
echo
**
Connection
con1
**
connection
con1
;
SET
@
ts_old
=
@@
SESSION
.
timestamp
;
--
echo
waiting
4
sec
--
sleep
4
SET
@
ts_new
=
@@
SESSION
.
timestamp
;
SELECT
@
ts_new
-
@
ts_old
>=
4
AS
'Timestamp Difference'
;
--
echo
1
means
>=
4
expected
is
true
--
echo
'#-----------------------------FN_DYNVARS_179_02---------------------#'
#
# Testing timezone change effect
#
SET
@
ts_old
=
@@
SESSION
.
timestamp
;
--
sleep
1
--
echo
Changing
time
zone
SET
time_zone
=
'MET'
;
SET
@
ts_new
=
@@
SESSION
.
timestamp
;
SELECT
@
ts_new
-
@
ts_old
>=
1
AS
'Timestamp Difference'
;
--
echo
1
means
>=
1
expected
is
true
#
# Cleanup
#
--
echo
**
Cleanup
**
SELECT
@@
session
.
timestamp
!=
1000000000
;
SELECT
@@
session
.
timestamp
=
1100000000
;
--
echo
**
Connection
default
**
connection
default
;
--
echo
Disconnecting
Connections
con0
,
con1
disconnect
con0
;
disconnect
con1
;
mysql-test/t/timestamp_sysdate_is_now_func-master.opt
0 → 100644
View file @
733e7ce0
--sysdate-is-now
mysql-test/t/timestamp_sysdate_is_now_func.test
0 → 100644
View file @
733e7ce0
############################################################################
# #
# Variable Name: timestamp with sysdate-is-now #
# Scope: GLOBAL #
# Access Type: Dynamic #
# Data Type: INTEGER #
# #
# #
# Creation Date: 2008-11-25 #
# Author: Horst Hunger #
# #
# Description: Test Cases of Dynamic System Variable "timestamp" #
# that checks behavior of this variable in the following ways #
# * Like timstamp_func, but with set "sysdate-is-now". #
# #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
# #
############################################################################
# Use Unix epoch timestamp
# Due to "--sysdate-is-now" timestamp must have an effect on both.
# See also timestamp_func.test.
--
echo
**
Connecting
con1
using
root
**
connect
(
con1
,
localhost
,
root
,,);
SELECT
date
(
now
())
=
date
(
sysdate
());
SET
@@
session
.
timestamp
=
1100000000
;
SELECT
date
(
now
())
!=
date
(
sysdate
());
# Assure that setting of the variable has no effect on other session.
--
echo
**
Connecting
con0
using
root
**
connect
(
con0
,
localhost
,
root
,,);
SELECT
@@
session
.
timestamp
!=
1100000000
;
SET
@@
session
.
timestamp
=
1000000000
;
SELECT
date
(
now
())
!=
date
(
sysdate
());
--
echo
**
Connection
con1
**
connection
con1
;
SELECT
@@
session
.
timestamp
!=
1000000000
;
SELECT
@@
session
.
timestamp
=
1100000000
;
--
echo
**
Connection
default
**
connection
default
;
--
echo
Disconnecting
Connections
con0
,
con1
disconnect
con0
;
disconnect
con1
;
mysql-test/t/variables-notembedded.test
View file @
733e7ce0
...
...
@@ -28,3 +28,83 @@ set global slave_net_timeout=default;
# sql_slave_skip_counter is write-only, so we can't save previous
# value and restore it here. That's ok, because it's normally 0.
set
global
sql_slave_skip_counter
=
0
;
#
# Bug#28234 - global/session scope - documentation vs implementation
#
--
echo
#
# Additional variables fixed from sql_repl.cc.
#
--
echo
#
SHOW
VARIABLES
like
'log_slave_updates'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
log_slave_updates
;
SELECT
@@
global
.
log_slave_updates
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
log_slave_updates
=
true
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
log_slave_updates
=
true
;
#
--
echo
#
SHOW
VARIABLES
like
'relay_log'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
relay_log
;
SELECT
@@
global
.
relay_log
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
relay_log
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
relay_log
=
'x'
;
#
--
echo
#
SHOW
VARIABLES
like
'relay_log_index'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
relay_log_index
;
SELECT
@@
global
.
relay_log_index
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
relay_log_index
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
relay_log_index
=
'x'
;
#
--
echo
#
SHOW
VARIABLES
like
'relay_log_info_file'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
relay_log_info_file
;
SELECT
@@
global
.
relay_log_info_file
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
relay_log_info_file
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
relay_log_info_file
=
'x'
;
#
--
echo
#
SHOW
VARIABLES
like
'relay_log_space_limit'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
relay_log_space_limit
;
SELECT
@@
global
.
relay_log_space_limit
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
relay_log_space_limit
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
relay_log_space_limit
=
7
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'slave_load_tmpdir'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
slave_load_tmpdir
;
--
replace_column
1
#
SELECT
@@
global
.
slave_load_tmpdir
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
slave_load_tmpdir
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
slave_load_tmpdir
=
'x'
;
#
--
echo
#
SHOW
VARIABLES
like
'slave_skip_errors'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
slave_skip_errors
;
SELECT
@@
global
.
slave_skip_errors
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
slave_skip_errors
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
slave_skip_errors
=
7
;
#
mysql-test/t/variables.test
View file @
733e7ce0
...
...
@@ -793,3 +793,299 @@ SET GLOBAL log_output = 0;
--
echo
--
echo
# -- End of Bug#34820.
#
# Bug#28234 - global/session scope - documentation vs implementation
#
--
echo
--
echo
#
SHOW
VARIABLES
like
'ft_max_word_len'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
ft_max_word_len
;
SELECT
@@
global
.
ft_max_word_len
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
ft_max_word_len
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
ft_max_word_len
=
7
;
#
--
echo
#
SHOW
VARIABLES
like
'ft_min_word_len'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
ft_min_word_len
;
SELECT
@@
global
.
ft_min_word_len
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
ft_min_word_len
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
ft_min_word_len
=
7
;
#
--
echo
#
SHOW
VARIABLES
like
'ft_query_expansion_limit'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
ft_query_expansion_limit
;
SELECT
@@
global
.
ft_query_expansion_limit
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
ft_query_expansion_limit
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
ft_query_expansion_limit
=
7
;
#
--
echo
#
SHOW
VARIABLES
like
'ft_stopword_file'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
ft_stopword_file
;
SELECT
@@
global
.
ft_stopword_file
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
ft_stopword_file
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
ft_stopword_file
=
'x'
;
#
# Additional variables fixed.
#
--
echo
#
SHOW
VARIABLES
like
'back_log'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
back_log
;
SELECT
@@
global
.
back_log
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
back_log
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
back_log
=
7
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'large_files_support'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
large_files_support
;
--
replace_column
1
#
SELECT
@@
global
.
large_files_support
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
large_files_support
=
true
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
large_files_support
=
true
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'character_sets_dir'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
character_sets_dir
;
--
replace_column
1
#
SELECT
@@
global
.
character_sets_dir
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
character_sets_dir
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
character_sets_dir
=
'x'
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'init_file'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
init_file
;
--
replace_column
1
#
SELECT
@@
global
.
init_file
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
init_file
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
init_file
=
'x'
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'language'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
language
;
--
replace_column
1
#
SELECT
@@
global
.
language
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
language
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
language
=
'x'
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'large_page_size'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
large_page_size
;
--
replace_column
1
#
SELECT
@@
global
.
large_page_size
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
large_page_size
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
large_page_size
=
7
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'large_pages'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
large_pages
;
--
replace_column
1
#
SELECT
@@
global
.
large_pages
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
large_pages
=
true
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
large_pages
=
true
;
#
--
echo
#
SHOW
VARIABLES
like
'log_bin'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
log_bin
;
SELECT
@@
global
.
log_bin
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
log_bin
=
true
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
log_bin
=
true
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'log_error'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
log_error
;
--
replace_column
1
#
SELECT
@@
global
.
log_error
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
log_error
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
log_error
=
'x'
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'lower_case_file_system'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
lower_case_file_system
;
--
replace_column
1
#
SELECT
@@
global
.
lower_case_file_system
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
lower_case_file_system
=
true
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
lower_case_file_system
=
true
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'lower_case_table_names'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
lower_case_table_names
;
--
replace_column
1
#
SELECT
@@
global
.
lower_case_table_names
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
lower_case_table_names
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
lower_case_table_names
=
7
;
#
--
echo
#
SHOW
VARIABLES
like
'myisam_recover_options'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
myisam_recover_options
;
SELECT
@@
global
.
myisam_recover_options
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
myisam_recover_options
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
myisam_recover_options
=
'x'
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'open_files_limit'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
open_files_limit
;
--
replace_column
1
#
SELECT
@@
global
.
open_files_limit
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
open_files_limit
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
open_files_limit
=
7
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'pid_file'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
pid_file
;
--
replace_column
1
#
SELECT
@@
global
.
pid_file
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
pid_file
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
pid_file
=
'x'
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'plugin_dir'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
plugin_dir
;
--
replace_column
1
#
SELECT
@@
global
.
plugin_dir
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
plugin_dir
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
plugin_dir
=
'x'
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'port'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
port
;
--
replace_column
1
#
SELECT
@@
global
.
port
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
port
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
port
=
7
;
#
--
echo
#
SHOW
VARIABLES
like
'protocol_version'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
protocol_version
;
SELECT
@@
global
.
protocol_version
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
protocol_version
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
protocol_version
=
7
;
#
--
echo
#
SHOW
VARIABLES
like
'skip_external_locking'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
skip_external_locking
;
SELECT
@@
global
.
skip_external_locking
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
skip_external_locking
=
true
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
skip_external_locking
=
true
;
#
--
echo
#
SHOW
VARIABLES
like
'skip_networking'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
skip_networking
;
SELECT
@@
global
.
skip_networking
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
skip_networking
=
true
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
skip_networking
=
true
;
#
--
echo
#
SHOW
VARIABLES
like
'skip_show_database'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
skip_show_database
;
SELECT
@@
global
.
skip_show_database
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
skip_show_database
=
true
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
skip_show_database
=
true
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'socket'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
socket
;
--
replace_column
1
#
SELECT
@@
global
.
socket
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
socket
=
'x'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
socket
=
'x'
;
#
--
echo
#
--
replace_column
2
#
SHOW
VARIABLES
like
'thread_stack'
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT
@@
session
.
thread_stack
;
--
replace_column
1
#
SELECT
@@
global
.
thread_stack
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
session
.
thread_stack
=
7
;
--
error
ER_INCORRECT_GLOBAL_LOCAL_VAR
SET
@@
global
.
thread_stack
=
7
;
#
sql/item_func.cc
View file @
733e7ce0
...
...
@@ -4855,6 +4855,7 @@ void Item_func_get_system_var::fix_length_and_dec()
max_length
=
MAX_BLOB_WIDTH
;
decimals
=
NOT_FIXED_DEC
;
break
;
case
SHOW_BOOL
:
case
SHOW_MY_BOOL
:
unsigned_flag
=
FALSE
;
max_length
=
1
;
...
...
@@ -4882,6 +4883,7 @@ enum Item_result Item_func_get_system_var::result_type() const
{
switch
(
var
->
show_type
())
{
case
SHOW_BOOL
:
case
SHOW_MY_BOOL
:
case
SHOW_INT
:
case
SHOW_LONG
:
...
...
@@ -4904,6 +4906,7 @@ enum_field_types Item_func_get_system_var::field_type() const
{
switch
(
var
->
show_type
())
{
case
SHOW_BOOL
:
case
SHOW_MY_BOOL
:
case
SHOW_INT
:
case
SHOW_LONG
:
...
...
@@ -4922,6 +4925,10 @@ enum_field_types Item_func_get_system_var::field_type() const
}
/*
Uses var, var_type, component, cache_present, used_query_id, thd,
cached_llval, null_value, cached_null_value
*/
#define get_sys_var_safe(type) \
do { \
type value; \
...
...
@@ -4975,6 +4982,7 @@ longlong Item_func_get_system_var::val_int()
case
SHOW_LONG
:
get_sys_var_safe
(
ulong
);
case
SHOW_LONGLONG
:
get_sys_var_safe
(
longlong
);
case
SHOW_HA_ROWS
:
get_sys_var_safe
(
ha_rows
);
case
SHOW_BOOL
:
get_sys_var_safe
(
bool
);
case
SHOW_MY_BOOL
:
get_sys_var_safe
(
my_bool
);
case
SHOW_DOUBLE
:
{
...
...
@@ -5072,6 +5080,7 @@ String* Item_func_get_system_var::val_str(String* str)
case
SHOW_LONG
:
case
SHOW_LONGLONG
:
case
SHOW_HA_ROWS
:
case
SHOW_BOOL
:
case
SHOW_MY_BOOL
:
str
->
set
(
val_int
(),
collation
.
collation
);
break
;
...
...
@@ -5164,6 +5173,7 @@ double Item_func_get_system_var::val_real()
case
SHOW_LONG
:
case
SHOW_LONGLONG
:
case
SHOW_HA_ROWS
:
case
SHOW_BOOL
:
case
SHOW_MY_BOOL
:
cached_dval
=
(
double
)
val_int
();
cache_present
|=
GET_SYS_VAR_CACHE_DOUBLE
;
...
...
sql/set_var.cc
View file @
733e7ce0
...
...
@@ -77,7 +77,6 @@ extern ulong ndb_report_thresh_binlog_mem_usage;
extern
CHARSET_INFO
*
character_set_filesystem
;
static
DYNAMIC_ARRAY
fixed_show_vars
;
static
HASH
system_variable_hash
;
const
char
*
bool_type_names
[]
=
{
"OFF"
,
"ON"
,
NullS
};
...
...
@@ -174,6 +173,9 @@ sys_auto_increment_offset(&vars, "auto_increment_offset",
static
sys_var_bool_ptr
sys_automatic_sp_privileges
(
&
vars
,
"automatic_sp_privileges"
,
&
sp_automatic_privileges
);
static
sys_var_const
sys_back_log
(
&
vars
,
"back_log"
,
OPT_GLOBAL
,
SHOW_LONG
,
(
uchar
*
)
&
back_log
);
static
sys_var_const_str
sys_basedir
(
&
vars
,
"basedir"
,
mysql_home
);
static
sys_var_long_ptr
sys_binlog_cache_size
(
&
vars
,
"binlog_cache_size"
,
&
binlog_cache_size
);
...
...
@@ -181,6 +183,11 @@ static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
&
SV
::
binlog_format
);
static
sys_var_thd_ulong
sys_bulk_insert_buff_size
(
&
vars
,
"bulk_insert_buffer_size"
,
&
SV
::
bulk_insert_buff_size
);
static
sys_var_const
sys_character_sets_dir
(
&
vars
,
"character_sets_dir"
,
OPT_GLOBAL
,
SHOW_CHAR
,
(
uchar
*
)
mysql_charsets_dir
);
static
sys_var_character_set_sv
sys_character_set_server
(
&
vars
,
"character_set_server"
,
&
SV
::
collation_server
,
&
default_charset_info
,
0
,
...
...
@@ -249,14 +256,31 @@ static sys_var_long_ptr sys_expire_logs_days(&vars, "expire_logs_days",
&
expire_logs_days
);
static
sys_var_bool_ptr
sys_flush
(
&
vars
,
"flush"
,
&
myisam_flush
);
static
sys_var_long_ptr
sys_flush_time
(
&
vars
,
"flush_time"
,
&
flush_time
);
static
sys_var_str
sys_ft_boolean_syntax
(
&
vars
,
"ft_boolean_syntax"
,
sys_check_ftb_syntax
,
sys_update_ftb_syntax
,
sys_default_ftb_syntax
,
ft_boolean_syntax
);
static
sys_var_str
sys_ft_boolean_syntax
(
&
vars
,
"ft_boolean_syntax"
,
sys_check_ftb_syntax
,
sys_update_ftb_syntax
,
sys_default_ftb_syntax
,
ft_boolean_syntax
);
static
sys_var_const
sys_ft_max_word_len
(
&
vars
,
"ft_max_word_len"
,
OPT_GLOBAL
,
SHOW_LONG
,
(
uchar
*
)
&
ft_max_word_len
);
static
sys_var_const
sys_ft_min_word_len
(
&
vars
,
"ft_min_word_len"
,
OPT_GLOBAL
,
SHOW_LONG
,
(
uchar
*
)
&
ft_min_word_len
);
static
sys_var_const
sys_ft_query_expansion_limit
(
&
vars
,
"ft_query_expansion_limit"
,
OPT_GLOBAL
,
SHOW_LONG
,
(
uchar
*
)
&
ft_query_expansion_limit
);
static
sys_var_const
sys_ft_stopword_file
(
&
vars
,
"ft_stopword_file"
,
OPT_GLOBAL
,
SHOW_CHAR_PTR
,
(
uchar
*
)
&
ft_stopword_file
);
sys_var_str
sys_init_connect
(
&
vars
,
"init_connect"
,
0
,
sys_update_init_connect
,
sys_default_init_connect
,
0
);
static
sys_var_const
sys_init_file
(
&
vars
,
"init_file"
,
OPT_GLOBAL
,
SHOW_CHAR_PTR
,
(
uchar
*
)
&
opt_init_file
);
sys_var_str
sys_init_slave
(
&
vars
,
"init_slave"
,
0
,
sys_update_init_slave
,
sys_default_init_slave
,
0
);
...
...
@@ -274,14 +298,37 @@ static sys_var_key_cache_long sys_key_cache_division_limit(&vars, "key_cache_div
static
sys_var_key_cache_long
sys_key_cache_age_threshold
(
&
vars
,
"key_cache_age_threshold"
,
offsetof
(
KEY_CACHE
,
param_age_threshold
));
static
sys_var_const
sys_language
(
&
vars
,
"language"
,
OPT_GLOBAL
,
SHOW_CHAR
,
(
uchar
*
)
language
);
static
sys_var_const
sys_large_files_support
(
&
vars
,
"large_files_support"
,
OPT_GLOBAL
,
SHOW_BOOL
,
(
uchar
*
)
&
opt_large_files
);
static
sys_var_const
sys_large_page_size
(
&
vars
,
"large_page_size"
,
OPT_GLOBAL
,
SHOW_INT
,
(
uchar
*
)
&
opt_large_page_size
);
static
sys_var_const
sys_large_pages
(
&
vars
,
"large_pages"
,
OPT_GLOBAL
,
SHOW_MY_BOOL
,
(
uchar
*
)
&
opt_large_pages
);
static
sys_var_bool_ptr
sys_local_infile
(
&
vars
,
"local_infile"
,
&
opt_local_infile
);
#ifdef HAVE_MLOCKALL
static
sys_var_const
sys_locked_in_memory
(
&
vars
,
"locked_in_memory"
,
OPT_GLOBAL
,
SHOW_MY_BOOL
,
(
uchar
*
)
&
locked_in_memory
);
#endif
static
sys_var_const
sys_log_bin
(
&
vars
,
"log_bin"
,
OPT_GLOBAL
,
SHOW_BOOL
,
(
uchar
*
)
&
opt_bin_log
);
static
sys_var_trust_routine_creators
sys_trust_routine_creators
(
&
vars
,
"log_bin_trust_routine_creators"
,
&
trust_function_creators
);
static
sys_var_bool_ptr
sys_trust_function_creators
(
&
vars
,
"log_bin_trust_function_creators"
,
&
trust_function_creators
);
static
sys_var_const
sys_log_error
(
&
vars
,
"log_error"
,
OPT_GLOBAL
,
SHOW_CHAR
,
(
uchar
*
)
log_error_file
);
static
sys_var_bool_ptr
sys_log_queries_not_using_indexes
(
&
vars
,
"log_queries_not_using_indexes"
,
&
opt_log_queries_not_using_indexes
);
...
...
@@ -296,6 +343,16 @@ static sys_var_thd_bool sys_sql_low_priority_updates(&vars, "sql_low_priority_up
&
SV
::
low_priority_updates
,
fix_low_priority_updates
);
#endif
static
sys_var_const
sys_lower_case_file_system
(
&
vars
,
"lower_case_file_system"
,
OPT_GLOBAL
,
SHOW_MY_BOOL
,
(
uchar
*
)
&
lower_case_file_system
);
static
sys_var_const
sys_lower_case_table_names
(
&
vars
,
"lower_case_table_names"
,
OPT_GLOBAL
,
SHOW_INT
,
(
uchar
*
)
&
lower_case_table_names
);
static
sys_var_thd_ulong_session_readonly
sys_max_allowed_packet
(
&
vars
,
"max_allowed_packet"
,
&
SV
::
max_allowed_packet
);
static
sys_var_long_ptr
sys_max_binlog_cache_size
(
&
vars
,
"max_binlog_cache_size"
,
...
...
@@ -359,6 +416,10 @@ static sys_var_thd_ulong sys_multi_range_count(&vars, "multi_range_count",
static
sys_var_long_ptr
sys_myisam_data_pointer_size
(
&
vars
,
"myisam_data_pointer_size"
,
&
myisam_data_pointer_size
);
static
sys_var_thd_ulonglong
sys_myisam_max_sort_file_size
(
&
vars
,
"myisam_max_sort_file_size"
,
&
SV
::
myisam_max_sort_file_size
,
fix_myisam_max_sort_file_size
,
1
);
static
sys_var_const
sys_myisam_recover_options
(
&
vars
,
"myisam_recover_options"
,
OPT_GLOBAL
,
SHOW_CHAR_PTR
,
(
uchar
*
)
&
myisam_recover_options_str
);
static
sys_var_thd_ulong
sys_myisam_repair_threads
(
&
vars
,
"myisam_repair_threads"
,
&
SV
::
myisam_repair_threads
);
static
sys_var_thd_ulong
sys_myisam_sort_buffer_size
(
&
vars
,
"myisam_sort_buffer_size"
,
&
SV
::
myisam_sort_buff_size
);
static
sys_var_bool_ptr
sys_myisam_use_mmap
(
&
vars
,
"myisam_use_mmap"
,
...
...
@@ -369,6 +430,13 @@ static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_met
&
myisam_stats_method_typelib
,
NULL
);
#ifdef __NT__
/* purecov: begin inspected */
static
sys_var_const
sys_named_pipe
(
&
vars
,
"named_pipe"
,
OPT_GLOBAL
,
SHOW_MY_BOOL
,
(
uchar
*
)
&
opt_enable_named_pipe
);
/* purecov: end */
#endif
static
sys_var_thd_ulong_session_readonly
sys_net_buffer_length
(
&
vars
,
"net_buffer_length"
,
&
SV
::
net_buffer_length
);
static
sys_var_thd_ulong
sys_net_read_timeout
(
&
vars
,
"net_read_timeout"
,
...
...
@@ -387,12 +455,29 @@ static sys_var_bool_ptr_readonly sys_old_mode(&vars, "old",
sys_var_thd_bool
sys_old_alter_table
(
&
vars
,
"old_alter_table"
,
&
SV
::
old_alter_table
);
sys_var_thd_bool
sys_old_passwords
(
&
vars
,
"old_passwords"
,
&
SV
::
old_passwords
);
static
sys_var_const
sys_open_files_limit
(
&
vars
,
"open_files_limit"
,
OPT_GLOBAL
,
SHOW_LONG
,
(
uchar
*
)
&
open_files_limit
);
static
sys_var_thd_ulong
sys_optimizer_prune_level
(
&
vars
,
"optimizer_prune_level"
,
&
SV
::
optimizer_prune_level
);
static
sys_var_thd_ulong
sys_optimizer_search_depth
(
&
vars
,
"optimizer_search_depth"
,
&
SV
::
optimizer_search_depth
);
static
sys_var_const
sys_pid_file
(
&
vars
,
"pid_file"
,
OPT_GLOBAL
,
SHOW_CHAR
,
(
uchar
*
)
pidfile_name
);
static
sys_var_const
sys_plugin_dir
(
&
vars
,
"plugin_dir"
,
OPT_GLOBAL
,
SHOW_CHAR
,
(
uchar
*
)
opt_plugin_dir
);
static
sys_var_const
sys_port
(
&
vars
,
"port"
,
OPT_GLOBAL
,
SHOW_INT
,
(
uchar
*
)
&
mysqld_port
);
static
sys_var_thd_ulong
sys_preload_buff_size
(
&
vars
,
"preload_buffer_size"
,
&
SV
::
preload_buff_size
);
static
sys_var_const
sys_protocol_version
(
&
vars
,
"protocol_version"
,
OPT_GLOBAL
,
SHOW_INT
,
(
uchar
*
)
&
protocol_version
);
static
sys_var_thd_ulong
sys_read_buff_size
(
&
vars
,
"read_buffer_size"
,
&
SV
::
read_buff_size
);
static
sys_var_opt_readonly
sys_readonly
(
&
vars
,
"read_only"
,
&
opt_readonly
);
...
...
@@ -414,6 +499,45 @@ static sys_var_thd_ulong sys_query_alloc_block_size(&vars, "query_alloc_block_si
static
sys_var_thd_ulong
sys_query_prealloc_size
(
&
vars
,
"query_prealloc_size"
,
&
SV
::
query_prealloc_size
,
0
,
fix_thd_mem_root
);
#ifdef HAVE_SMEM
/* purecov: begin tested */
static
sys_var_const
sys_shared_memory
(
&
vars
,
"shared_memory"
,
OPT_GLOBAL
,
SHOW_MY_BOOL
,
(
uchar
*
)
&
opt_enable_shared_memory
);
static
sys_var_const
sys_shared_memory_base_name
(
&
vars
,
"shared_memory_base_name"
,
OPT_GLOBAL
,
SHOW_CHAR_PTR
,
(
uchar
*
)
&
shared_memory_base_name
);
/* purecov: end */
#endif
static
sys_var_const
sys_skip_external_locking
(
&
vars
,
"skip_external_locking"
,
OPT_GLOBAL
,
SHOW_MY_BOOL
,
(
uchar
*
)
&
my_disable_locking
);
static
sys_var_const
sys_skip_networking
(
&
vars
,
"skip_networking"
,
OPT_GLOBAL
,
SHOW_BOOL
,
(
uchar
*
)
&
opt_disable_networking
);
static
sys_var_const
sys_skip_show_database
(
&
vars
,
"skip_show_database"
,
OPT_GLOBAL
,
SHOW_BOOL
,
(
uchar
*
)
&
opt_skip_show_db
);
#ifdef HAVE_SYS_UN_H
static
sys_var_const
sys_socket
(
&
vars
,
"socket"
,
OPT_GLOBAL
,
SHOW_CHAR_PTR
,
(
uchar
*
)
&
mysqld_unix_port
);
#endif
#ifdef HAVE_THR_SETCONCURRENCY
/* purecov: begin tested */
static
sys_var_const
sys_thread_concurrency
(
&
vars
,
"thread_concurrency"
,
OPT_GLOBAL
,
SHOW_LONG
,
(
uchar
*
)
&
concurrency
);
/* purecov: end */
#endif
static
sys_var_const
sys_thread_stack
(
&
vars
,
"thread_stack"
,
OPT_GLOBAL
,
SHOW_LONG
,
(
uchar
*
)
&
my_thread_stack_size
);
static
sys_var_readonly
sys_tmpdir
(
&
vars
,
"tmpdir"
,
OPT_GLOBAL
,
SHOW_CHAR
,
get_tmpdir
);
static
sys_var_thd_ulong
sys_trans_alloc_block_size
(
&
vars
,
"transaction_alloc_block_size"
,
&
SV
::
trans_alloc_block_size
,
...
...
@@ -764,59 +888,6 @@ static sys_var_log_output sys_var_log_output_state(&vars, "log_output", &log_out
&
log_output_typelib
,
0
);
/*
Additional variables (not derived from sys_var class, not accessible as
@@varname in SELECT or SET). Sorted in alphabetical order to facilitate
maintenance - SHOW VARIABLES will sort its output.
TODO: remove this list completely
*/
#define FIXED_VARS_SIZE (sizeof(fixed_vars) / sizeof(SHOW_VAR))
static
SHOW_VAR
fixed_vars
[]
=
{
{
"back_log"
,
(
char
*
)
&
back_log
,
SHOW_LONG
},
{
"character_sets_dir"
,
mysql_charsets_dir
,
SHOW_CHAR
},
{
"ft_max_word_len"
,
(
char
*
)
&
ft_max_word_len
,
SHOW_LONG
},
{
"ft_min_word_len"
,
(
char
*
)
&
ft_min_word_len
,
SHOW_LONG
},
{
"ft_query_expansion_limit"
,(
char
*
)
&
ft_query_expansion_limit
,
SHOW_LONG
},
{
"ft_stopword_file"
,
(
char
*
)
&
ft_stopword_file
,
SHOW_CHAR_PTR
},
{
"init_file"
,
(
char
*
)
&
opt_init_file
,
SHOW_CHAR_PTR
},
{
"language"
,
language
,
SHOW_CHAR
},
{
"large_files_support"
,
(
char
*
)
&
opt_large_files
,
SHOW_BOOL
},
{
"large_page_size"
,
(
char
*
)
&
opt_large_page_size
,
SHOW_INT
},
{
"large_pages"
,
(
char
*
)
&
opt_large_pages
,
SHOW_MY_BOOL
},
#ifdef HAVE_MLOCKALL
{
"locked_in_memory"
,
(
char
*
)
&
locked_in_memory
,
SHOW_MY_BOOL
},
#endif
{
"log_bin"
,
(
char
*
)
&
opt_bin_log
,
SHOW_BOOL
},
{
"log_error"
,
(
char
*
)
log_error_file
,
SHOW_CHAR
},
{
"lower_case_file_system"
,
(
char
*
)
&
lower_case_file_system
,
SHOW_MY_BOOL
},
{
"lower_case_table_names"
,
(
char
*
)
&
lower_case_table_names
,
SHOW_INT
},
{
"myisam_recover_options"
,
(
char
*
)
&
myisam_recover_options_str
,
SHOW_CHAR_PTR
},
#ifdef __NT__
{
"named_pipe"
,
(
char
*
)
&
opt_enable_named_pipe
,
SHOW_MY_BOOL
},
#endif
{
"open_files_limit"
,
(
char
*
)
&
open_files_limit
,
SHOW_LONG
},
{
"pid_file"
,
(
char
*
)
pidfile_name
,
SHOW_CHAR
},
{
"plugin_dir"
,
(
char
*
)
opt_plugin_dir
,
SHOW_CHAR
},
{
"port"
,
(
char
*
)
&
mysqld_port
,
SHOW_INT
},
{
"protocol_version"
,
(
char
*
)
&
protocol_version
,
SHOW_INT
},
#ifdef HAVE_SMEM
{
"shared_memory"
,
(
char
*
)
&
opt_enable_shared_memory
,
SHOW_MY_BOOL
},
{
"shared_memory_base_name"
,
(
char
*
)
&
shared_memory_base_name
,
SHOW_CHAR_PTR
},
#endif
{
"skip_external_locking"
,
(
char
*
)
&
my_disable_locking
,
SHOW_MY_BOOL
},
{
"skip_networking"
,
(
char
*
)
&
opt_disable_networking
,
SHOW_BOOL
},
{
"skip_show_database"
,
(
char
*
)
&
opt_skip_show_db
,
SHOW_BOOL
},
#ifdef HAVE_SYS_UN_H
{
"socket"
,
(
char
*
)
&
mysqld_unix_port
,
SHOW_CHAR_PTR
},
#endif
#ifdef HAVE_THR_SETCONCURRENCY
{
"thread_concurrency"
,
(
char
*
)
&
concurrency
,
SHOW_LONG
},
#endif
{
"thread_stack"
,
(
char
*
)
&
my_thread_stack_size
,
SHOW_LONG
},
};
bool
sys_var
::
check
(
THD
*
thd
,
set_var
*
var
)
{
var
->
save_result
.
ulonglong_value
=
var
->
value
->
val_int
();
...
...
@@ -3135,14 +3206,12 @@ static int show_cmp(SHOW_VAR *a, SHOW_VAR *b)
SHOW_VAR
*
enumerate_sys_vars
(
THD
*
thd
,
bool
sorted
)
{
int
count
=
system_variable_hash
.
records
,
i
;
int
fixed_count
=
fixed_show_vars
.
elements
;
int
size
=
sizeof
(
SHOW_VAR
)
*
(
count
+
fixed_count
+
1
);
int
size
=
sizeof
(
SHOW_VAR
)
*
(
count
+
1
);
SHOW_VAR
*
result
=
(
SHOW_VAR
*
)
thd
->
alloc
(
size
);
if
(
result
)
{
SHOW_VAR
*
show
=
result
+
fixed_count
;
memcpy
(
result
,
fixed_show_vars
.
buffer
,
fixed_count
*
sizeof
(
SHOW_VAR
));
SHOW_VAR
*
show
=
result
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -3155,7 +3224,7 @@ SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted)
/* sort into order */
if
(
sorted
)
my_qsort
(
result
,
count
+
fixed_count
,
sizeof
(
SHOW_VAR
),
my_qsort
(
result
,
count
,
sizeof
(
SHOW_VAR
),
(
qsort_cmp
)
show_cmp
);
/* make last element empty */
...
...
@@ -3183,13 +3252,6 @@ int set_var_init()
for
(
sys_var
*
var
=
vars
.
first
;
var
;
var
=
var
->
next
,
count
++
);
if
(
my_init_dynamic_array
(
&
fixed_show_vars
,
sizeof
(
SHOW_VAR
),
FIXED_VARS_SIZE
+
64
,
64
))
goto
error
;
fixed_show_vars
.
elements
=
FIXED_VARS_SIZE
;
memcpy
(
fixed_show_vars
.
buffer
,
fixed_vars
,
sizeof
(
fixed_vars
));
if
(
hash_init
(
&
system_variable_hash
,
system_charset_info
,
count
,
0
,
0
,
(
hash_get_key
)
get_sys_var_length
,
0
,
HASH_UNIQUE
))
goto
error
;
...
...
@@ -3217,28 +3279,6 @@ error:
void
set_var_free
()
{
hash_free
(
&
system_variable_hash
);
delete_dynamic
(
&
fixed_show_vars
);
}
/*
Add elements to the dynamic list of read-only system variables.
SYNOPSIS
mysql_append_static_vars()
show_vars Pointer to start of array
count Number of elements
RETURN VALUES
0 SUCCESS
otherwise FAILURE
*/
int
mysql_append_static_vars
(
const
SHOW_VAR
*
show_vars
,
uint
count
)
{
for
(;
count
>
0
;
count
--
,
show_vars
++
)
if
(
insert_dynamic
(
&
fixed_show_vars
,
(
uchar
*
)
show_vars
))
return
1
;
return
0
;
}
...
...
sql/set_var.h
View file @
733e7ce0
...
...
@@ -929,6 +929,34 @@ public:
};
/**
Global-only, read-only variable. E.g. command line option.
*/
class
sys_var_const
:
public
sys_var
{
public:
enum_var_type
var_type
;
SHOW_TYPE
show_type_value
;
uchar
*
ptr
;
sys_var_const
(
sys_var_chain
*
chain
,
const
char
*
name_arg
,
enum_var_type
type
,
SHOW_TYPE
show_type_arg
,
uchar
*
ptr_arg
)
:
sys_var
(
name_arg
),
var_type
(
type
),
show_type_value
(
show_type_arg
),
ptr
(
ptr_arg
)
{
chain_sys_var
(
chain
);
}
bool
update
(
THD
*
thd
,
set_var
*
var
)
{
return
1
;
}
bool
check_default
(
enum_var_type
type
)
{
return
1
;
}
bool
check_type
(
enum_var_type
type
)
{
return
type
!=
var_type
;
}
bool
check_update_type
(
Item_result
type
)
{
return
1
;
}
uchar
*
value_ptr
(
THD
*
thd
,
enum_var_type
type
,
LEX_STRING
*
base
)
{
return
ptr
;
}
SHOW_TYPE
show_type
()
{
return
show_type_value
;
}
bool
is_readonly
()
const
{
return
1
;
}
};
class
sys_var_have_option
:
public
sys_var
{
protected:
...
...
@@ -1317,7 +1345,6 @@ struct sys_var_with_base
int
set_var_init
();
void
set_var_free
();
int
mysql_append_static_vars
(
const
SHOW_VAR
*
show_vars
,
uint
count
);
SHOW_VAR
*
enumerate_sys_vars
(
THD
*
thd
,
bool
sorted
);
int
mysql_add_sys_var_chain
(
sys_var
*
chain
,
struct
my_option
*
long_options
);
int
mysql_del_sys_var_chain
(
sys_var
*
chain
);
...
...
sql/slave.cc
View file @
733e7ce0
...
...
@@ -49,6 +49,7 @@
#define MAX_SLAVE_RETRY_PAUSE 5
bool
use_slave_mask
=
0
;
MY_BITMAP
slave_error_mask
;
char
slave_skip_error_names
[
SHOW_VAR_FUNC_BUFF_SIZE
];
typedef
bool
(
*
CHECK_KILLED_FUNC
)(
THD
*
,
void
*
);
...
...
@@ -275,6 +276,64 @@ err:
}
/**
Convert slave skip errors bitmap into a printable string.
*/
static
void
print_slave_skip_errors
(
void
)
{
/*
To be safe, we want 10 characters of room in the buffer for a number
plus terminators. Also, we need some space for constant strings.
10 characters must be sufficient for a number plus {',' | '...'}
plus a NUL terminator. That is a max 6 digit number.
*/
const
int
MIN_ROOM
=
10
;
DBUG_ENTER
(
"print_slave_skip_errors"
);
DBUG_ASSERT
(
sizeof
(
slave_skip_error_names
)
>
MIN_ROOM
);
DBUG_ASSERT
(
MAX_SLAVE_ERROR
<=
999999
);
// 6 digits
if
(
!
use_slave_mask
||
bitmap_is_clear_all
(
&
slave_error_mask
))
{
/* purecov: begin tested */
memcpy
(
slave_skip_error_names
,
STRING_WITH_LEN
(
"OFF"
));
/* purecov: end */
}
else
if
(
bitmap_is_set_all
(
&
slave_error_mask
))
{
/* purecov: begin tested */
memcpy
(
slave_skip_error_names
,
STRING_WITH_LEN
(
"ALL"
));
/* purecov: end */
}
else
{
char
*
buff
=
slave_skip_error_names
;
char
*
bend
=
buff
+
sizeof
(
slave_skip_error_names
);
int
errnum
;
for
(
errnum
=
1
;
errnum
<
MAX_SLAVE_ERROR
;
errnum
++
)
{
if
(
bitmap_is_set
(
&
slave_error_mask
,
errnum
))
{
if
(
buff
+
MIN_ROOM
>=
bend
)
break
;
/* purecov: tested */
buff
=
int10_to_str
(
errnum
,
buff
,
10
);
*
buff
++=
','
;
}
}
if
(
buff
!=
slave_skip_error_names
)
buff
--
;
// Remove last ','
if
(
errnum
<
MAX_SLAVE_ERROR
)
{
/* Couldn't show all errors */
buff
=
strmov
(
buff
,
"..."
);
/* purecov: tested */
}
*
buff
=
0
;
}
DBUG_PRINT
(
"init"
,
(
"error_names: '%s'"
,
slave_skip_error_names
));
DBUG_VOID_RETURN
;
}
/*
Init function to set up array for errors that should be skipped for slave
...
...
@@ -314,6 +373,8 @@ void init_slave_skip_errors(const char* arg)
while
(
!
my_isdigit
(
system_charset_info
,
*
p
)
&&
*
p
)
p
++
;
}
/* Convert slave skip errors bitmap into a printable string. */
print_slave_skip_errors
();
DBUG_VOID_RETURN
;
}
...
...
sql/slave.h
View file @
733e7ce0
...
...
@@ -98,6 +98,7 @@ class Master_info;
extern
ulong
master_retry_count
;
extern
MY_BITMAP
slave_error_mask
;
extern
char
slave_skip_error_names
[];
extern
bool
use_slave_mask
;
extern
char
*
slave_load_tmpdir
;
extern
char
*
master_info_file
,
*
relay_log_info_file
;
...
...
sql/sql_repl.cc
View file @
733e7ce0
...
...
@@ -1660,64 +1660,38 @@ public:
static
sys_var_chain
vars
=
{
NULL
,
NULL
};
static
sys_var_const
sys_log_slave_updates
(
&
vars
,
"log_slave_updates"
,
OPT_GLOBAL
,
SHOW_MY_BOOL
,
(
uchar
*
)
&
opt_log_slave_updates
);
static
sys_var_const
sys_relay_log
(
&
vars
,
"relay_log"
,
OPT_GLOBAL
,
SHOW_CHAR_PTR
,
(
uchar
*
)
&
opt_relay_logname
);
static
sys_var_const
sys_relay_log_index
(
&
vars
,
"relay_log_index"
,
OPT_GLOBAL
,
SHOW_CHAR_PTR
,
(
uchar
*
)
&
opt_relaylog_index_name
);
static
sys_var_const
sys_relay_log_info_file
(
&
vars
,
"relay_log_info_file"
,
OPT_GLOBAL
,
SHOW_CHAR_PTR
,
(
uchar
*
)
&
relay_log_info_file
);
static
sys_var_bool_ptr
sys_relay_log_purge
(
&
vars
,
"relay_log_purge"
,
&
relay_log_purge
);
static
sys_var_const
sys_relay_log_space_limit
(
&
vars
,
"relay_log_space_limit"
,
OPT_GLOBAL
,
SHOW_LONGLONG
,
(
uchar
*
)
&
relay_log_space_limit
);
static
sys_var_const
sys_slave_load_tmpdir
(
&
vars
,
"slave_load_tmpdir"
,
OPT_GLOBAL
,
SHOW_CHAR_PTR
,
(
uchar
*
)
&
slave_load_tmpdir
);
static
sys_var_long_ptr
sys_slave_net_timeout
(
&
vars
,
"slave_net_timeout"
,
&
slave_net_timeout
);
static
sys_var_const
sys_slave_skip_errors
(
&
vars
,
"slave_skip_errors"
,
OPT_GLOBAL
,
SHOW_CHAR
,
(
uchar
*
)
slave_skip_error_names
);
static
sys_var_long_ptr
sys_slave_trans_retries
(
&
vars
,
"slave_transaction_retries"
,
&
slave_trans_retries
);
static
sys_var_sync_binlog_period
sys_sync_binlog_period
(
&
vars
,
"sync_binlog"
,
&
sync_binlog_period
);
static
sys_var_slave_skip_counter
sys_slave_skip_counter
(
&
vars
,
"sql_slave_skip_counter"
);
static
int
show_slave_skip_errors
(
THD
*
thd
,
SHOW_VAR
*
var
,
char
*
buff
);
static
SHOW_VAR
fixed_vars
[]
=
{
{
"log_slave_updates"
,
(
char
*
)
&
opt_log_slave_updates
,
SHOW_MY_BOOL
},
{
"relay_log"
,
(
char
*
)
&
opt_relay_logname
,
SHOW_CHAR_PTR
},
{
"relay_log_index"
,
(
char
*
)
&
opt_relaylog_index_name
,
SHOW_CHAR_PTR
},
{
"relay_log_info_file"
,
(
char
*
)
&
relay_log_info_file
,
SHOW_CHAR_PTR
},
{
"relay_log_space_limit"
,
(
char
*
)
&
relay_log_space_limit
,
SHOW_LONGLONG
},
{
"slave_load_tmpdir"
,
(
char
*
)
&
slave_load_tmpdir
,
SHOW_CHAR_PTR
},
{
"slave_skip_errors"
,
(
char
*
)
&
show_slave_skip_errors
,
SHOW_FUNC
},
};
static
int
show_slave_skip_errors
(
THD
*
thd
,
SHOW_VAR
*
var
,
char
*
buff
)
{
var
->
type
=
SHOW_CHAR
;
var
->
value
=
buff
;
if
(
!
use_slave_mask
||
bitmap_is_clear_all
(
&
slave_error_mask
))
{
var
->
value
=
const_cast
<
char
*>
(
"OFF"
);
}
else
if
(
bitmap_is_set_all
(
&
slave_error_mask
))
{
var
->
value
=
const_cast
<
char
*>
(
"ALL"
);
}
else
{
/* 10 is enough assuming errors are max 4 digits */
int
i
;
var
->
value
=
buff
;
for
(
i
=
1
;
i
<
MAX_SLAVE_ERROR
&&
(
buff
-
var
->
value
)
<
SHOW_VAR_FUNC_BUFF_SIZE
;
i
++
)
{
if
(
bitmap_is_set
(
&
slave_error_mask
,
i
))
{
buff
=
int10_to_str
(
i
,
buff
,
10
);
*
buff
++=
','
;
}
}
if
(
var
->
value
!=
buff
)
buff
--
;
// Remove last ','
if
(
i
<
MAX_SLAVE_ERROR
)
buff
=
strmov
(
buff
,
"..."
);
// Couldn't show all errors
*
buff
=
0
;
}
return
0
;
}
bool
sys_var_slave_skip_counter
::
check
(
THD
*
thd
,
set_var
*
var
)
{
...
...
@@ -1765,8 +1739,6 @@ bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
int
init_replication_sys_vars
()
{
mysql_append_static_vars
(
fixed_vars
,
sizeof
(
fixed_vars
)
/
sizeof
(
SHOW_VAR
));
if
(
mysql_add_sys_var_chain
(
vars
.
first
,
my_long_options
))
{
/* should not happen */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment