73 changed files with 1662 additions and 574 deletions
-
4CREDITS
-
35extra/mariabackup/xtrabackup.cc
-
4mysql-test/r/contributors.result
-
15mysql-test/r/create_or_replace.result
-
158mysql-test/r/func_time.result
-
32mysql-test/r/grant.result
-
26mysql-test/r/sp-security.result
-
53mysql-test/r/stat_tables.result
-
53mysql-test/r/stat_tables_innodb.result
-
40mysql-test/r/type_float.result
-
9mysql-test/suite/galera/disabled.def
-
11mysql-test/suite/galera/include/reset_query_cache.inc
-
14mysql-test/suite/galera/r/MW-44.result
-
3mysql-test/suite/galera/r/galera#505.result
-
147mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result
-
103mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,debug.rdiff
-
106mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff
-
103mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff
-
103mysql-test/suite/galera/r/galera_ist_xtrabackup-v2,debug.rdiff
-
1mysql-test/suite/galera/r/galera_kill_ddl.result
-
1mysql-test/suite/galera/r/galera_kill_largechanges.result
-
1mysql-test/suite/galera/r/galera_kill_smallchanges.result
-
2mysql-test/suite/galera/r/galera_suspend_slave.result
-
2mysql-test/suite/galera/r/galera_toi_truncate.result
-
6mysql-test/suite/galera/r/galera_unicode_identifiers.result
-
2mysql-test/suite/galera/r/galera_var_node_address.result
-
6mysql-test/suite/galera/r/galera_wan.result
-
43mysql-test/suite/galera/r/query_cache.result
-
1mysql-test/suite/galera/t/MW-328A.test
-
1mysql-test/suite/galera/t/MW-328B.test
-
1mysql-test/suite/galera/t/MW-328C.test
-
1mysql-test/suite/galera/t/MW-44-master.opt
-
14mysql-test/suite/galera/t/MW-44.test
-
230mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test
-
2mysql-test/suite/galera/t/galera_kill_ddl.test
-
2mysql-test/suite/galera/t/galera_kill_largechanges.test
-
2mysql-test/suite/galera/t/galera_kill_smallchanges.test
-
3mysql-test/suite/galera/t/galera_suspend_slave.test
-
16mysql-test/suite/galera/t/galera_toi_truncate.test
-
12mysql-test/suite/galera/t/galera_unicode_identifiers.test
-
8mysql-test/suite/galera/t/galera_var_node_address.test
-
14mysql-test/suite/galera/t/galera_wan.test
-
123mysql-test/suite/galera/t/query_cache.test
-
7mysql-test/suite/parts/r/update_and_cache.result
-
12mysql-test/suite/parts/t/update_and_cache.test
-
2mysql-test/suite/wsrep/r/variables.result
-
21mysql-test/t/create_or_replace.test
-
49mysql-test/t/func_time.test
-
22mysql-test/t/grant.test
-
28mysql-test/t/sp-security.test
-
45mysql-test/t/stat_tables.test
-
30mysql-test/t/type_float.test
-
3mysys/my_alloc.c
-
15scripts/wsrep_sst_common.sh
-
4sql/contributors.h
-
2sql/field.cc
-
180sql/item.cc
-
100sql/item.h
-
2sql/item_func.cc
-
8sql/item_func.h
-
29sql/item_timefunc.cc
-
5sql/sql_acl.cc
-
7sql/sql_base.cc
-
1sql/sql_delete.cc
-
7sql/sql_error.h
-
19sql/sql_select.cc
-
44sql/sql_type_int.h
-
2sql/sql_update.cc
-
1sql/table_cache.cc
-
48storage/spider/mysql-test/spider/r/spider_fixes_part.result
-
12storage/tokudb/ha_tokudb.cc
-
2storage/tokudb/ha_tokudb.h
-
16storage/tokudb/hatoku_defines.h
@ -0,0 +1,11 @@ |
|||
--disable_query_log |
|||
--disable_result_log |
|||
--connection node_1 |
|||
flush query cache; |
|||
reset query cache; |
|||
|
|||
--connection node_2 |
|||
flush query cache; |
|||
reset query cache; |
|||
--enable_result_log |
|||
--enable_query_log |
@ -0,0 +1,147 @@ |
|||
SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; |
|||
SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; |
|||
CREATE TABLE t1 ( |
|||
i int(11) NOT NULL AUTO_INCREMENT, |
|||
c char(32) DEFAULT 'dummy_text', |
|||
PRIMARY KEY (i) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
|||
insert into t1(i) values(null); |
|||
select * from t1; |
|||
i c |
|||
3 dummy_text |
|||
insert into t1(i) values(null), (null), (null); |
|||
select * from t1; |
|||
i c |
|||
3 dummy_text |
|||
5 dummy_text |
|||
7 dummy_text |
|||
9 dummy_text |
|||
select * from t1; |
|||
i c |
|||
3 dummy_text |
|||
5 dummy_text |
|||
7 dummy_text |
|||
9 dummy_text |
|||
SET GLOBAL wsrep_forced_binlog_format='none'; |
|||
SET GLOBAL wsrep_forced_binlog_format='none'; |
|||
drop table t1; |
|||
SET SESSION binlog_format='STATEMENT'; |
|||
show variables like 'binlog_format'; |
|||
Variable_name Value |
|||
binlog_format STATEMENT |
|||
SET GLOBAL wsrep_auto_increment_control='OFF'; |
|||
SET SESSION auto_increment_increment = 3; |
|||
SET SESSION auto_increment_offset = 1; |
|||
CREATE TABLE t1 ( |
|||
i int(11) NOT NULL AUTO_INCREMENT, |
|||
c char(32) DEFAULT 'dummy_text', |
|||
PRIMARY KEY (i) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
|||
insert into t1(i) values(null); |
|||
select * from t1; |
|||
i c |
|||
4 dummy_text |
|||
insert into t1(i) values(null), (null), (null); |
|||
select * from t1; |
|||
i c |
|||
4 dummy_text |
|||
7 dummy_text |
|||
10 dummy_text |
|||
13 dummy_text |
|||
select * from t1; |
|||
i c |
|||
4 dummy_text |
|||
7 dummy_text |
|||
10 dummy_text |
|||
13 dummy_text |
|||
SET GLOBAL wsrep_auto_increment_control='ON'; |
|||
SET SESSION binlog_format='ROW'; |
|||
show variables like 'binlog_format'; |
|||
Variable_name Value |
|||
binlog_format ROW |
|||
show variables like '%auto_increment%'; |
|||
Variable_name Value |
|||
auto_increment_increment 2 |
|||
auto_increment_offset 1 |
|||
wsrep_auto_increment_control ON |
|||
SET GLOBAL wsrep_auto_increment_control='OFF'; |
|||
show variables like '%auto_increment%'; |
|||
Variable_name Value |
|||
auto_increment_increment 2 |
|||
auto_increment_offset 1 |
|||
wsrep_auto_increment_control OFF |
|||
SET GLOBAL wsrep_auto_increment_control='ON'; |
|||
drop table t1; |
|||
SET GLOBAL wsrep_forced_binlog_format='ROW'; |
|||
SET GLOBAL wsrep_forced_binlog_format='ROW'; |
|||
CREATE TABLE t1 ( |
|||
i int(11) NOT NULL AUTO_INCREMENT, |
|||
c char(32) DEFAULT 'dummy_text', |
|||
PRIMARY KEY (i) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
|||
insert into t1(i) values(null); |
|||
select * from t1; |
|||
i c |
|||
3 dummy_text |
|||
insert into t1(i) values(null), (null), (null); |
|||
select * from t1; |
|||
i c |
|||
3 dummy_text |
|||
5 dummy_text |
|||
7 dummy_text |
|||
9 dummy_text |
|||
select * from t1; |
|||
i c |
|||
3 dummy_text |
|||
5 dummy_text |
|||
7 dummy_text |
|||
9 dummy_text |
|||
SET GLOBAL wsrep_forced_binlog_format='none'; |
|||
SET GLOBAL wsrep_forced_binlog_format='none'; |
|||
drop table t1; |
|||
SET SESSION binlog_format='ROW'; |
|||
show variables like 'binlog_format'; |
|||
Variable_name Value |
|||
binlog_format ROW |
|||
SET GLOBAL wsrep_auto_increment_control='OFF'; |
|||
SET SESSION auto_increment_increment = 3; |
|||
SET SESSION auto_increment_offset = 1; |
|||
CREATE TABLE t1 ( |
|||
i int(11) NOT NULL AUTO_INCREMENT, |
|||
c char(32) DEFAULT 'dummy_text', |
|||
PRIMARY KEY (i) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
|||
insert into t1(i) values(null); |
|||
select * from t1; |
|||
i c |
|||
4 dummy_text |
|||
insert into t1(i) values(null), (null), (null); |
|||
select * from t1; |
|||
i c |
|||
4 dummy_text |
|||
7 dummy_text |
|||
10 dummy_text |
|||
13 dummy_text |
|||
select * from t1; |
|||
i c |
|||
4 dummy_text |
|||
7 dummy_text |
|||
10 dummy_text |
|||
13 dummy_text |
|||
SET GLOBAL wsrep_auto_increment_control='ON'; |
|||
show variables like 'binlog_format'; |
|||
Variable_name Value |
|||
binlog_format ROW |
|||
show variables like '%auto_increment%'; |
|||
Variable_name Value |
|||
auto_increment_increment 2 |
|||
auto_increment_offset 1 |
|||
wsrep_auto_increment_control ON |
|||
SET GLOBAL wsrep_auto_increment_control='OFF'; |
|||
show variables like '%auto_increment%'; |
|||
Variable_name Value |
|||
auto_increment_increment 2 |
|||
auto_increment_offset 1 |
|||
wsrep_auto_increment_control OFF |
|||
SET GLOBAL wsrep_auto_increment_control='ON'; |
|||
drop table t1; |
@ -0,0 +1,103 @@ |
|||
--- r/galera_ist_innodb_flush_logs.result 2018-09-05 10:34:36.192439933 +0300 |
|||
+++ r/galera_ist_innodb_flush_logs.reject 2018-09-17 10:20:06.039150838 +0300 |
|||
@@ -86,3 +86,100 @@ |
|||
DROP TABLE t1; |
|||
COMMIT; |
|||
SET AUTOCOMMIT=ON; |
|||
+Performing State Transfer on a server that has been killed and restarted |
|||
+while a DDL was in progress on it |
|||
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+COMMIT; |
|||
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; |
|||
+ALTER TABLE t1 ADD COLUMN f2 INTEGER; |
|||
+SET wsrep_sync_wait = 0; |
|||
+Killing server ... |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+COMMIT; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+Performing --wsrep-recover ... |
|||
+Starting server ... |
|||
+Using --wsrep-start-position when starting mysqld ... |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+COMMIT; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+COMMIT; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+ROLLBACK; |
|||
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; |
|||
+COUNT(*) = 2 |
|||
+1 |
|||
+SELECT COUNT(*) = 35 FROM t1; |
|||
+COUNT(*) = 35 |
|||
+1 |
|||
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
|||
+COUNT(*) = 0 |
|||
+1 |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=ON; |
|||
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; |
|||
+COUNT(*) = 2 |
|||
+1 |
|||
+SELECT COUNT(*) = 35 FROM t1; |
|||
+COUNT(*) = 35 |
|||
+1 |
|||
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
|||
+COUNT(*) = 0 |
|||
+1 |
|||
+DROP TABLE t1; |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=ON; |
|||
+SET GLOBAL debug_dbug = $debug_orig; |
@ -0,0 +1,106 @@ |
|||
--- r/galera_ist_mysqldump.result 2018-09-11 12:38:42.027479411 +0300 |
|||
+++ r/galera_ist_mysqldump.reject 2018-09-17 10:28:44.483441364 +0300 |
|||
@@ -180,6 +180,103 @@ |
|||
DROP TABLE t1; |
|||
COMMIT; |
|||
SET AUTOCOMMIT=ON; |
|||
+Performing State Transfer on a server that has been killed and restarted |
|||
+while a DDL was in progress on it |
|||
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+COMMIT; |
|||
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; |
|||
+ALTER TABLE t1 ADD COLUMN f2 INTEGER; |
|||
+SET wsrep_sync_wait = 0; |
|||
+Killing server ... |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+COMMIT; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+Performing --wsrep-recover ... |
|||
+Starting server ... |
|||
+Using --wsrep-start-position when starting mysqld ... |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+COMMIT; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+COMMIT; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+ROLLBACK; |
|||
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; |
|||
+COUNT(*) = 2 |
|||
+1 |
|||
+SELECT COUNT(*) = 35 FROM t1; |
|||
+COUNT(*) = 35 |
|||
+1 |
|||
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
|||
+COUNT(*) = 0 |
|||
+1 |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=ON; |
|||
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; |
|||
+COUNT(*) = 2 |
|||
+1 |
|||
+SELECT COUNT(*) = 35 FROM t1; |
|||
+COUNT(*) = 35 |
|||
+1 |
|||
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
|||
+COUNT(*) = 0 |
|||
+1 |
|||
+DROP TABLE t1; |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=ON; |
|||
+SET GLOBAL debug_dbug = $debug_orig; |
|||
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); |
|||
DROP USER sst; |
|||
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); |
@ -0,0 +1,103 @@ |
|||
--- r/galera_ist_rsync.result 2018-09-11 12:38:42.027479411 +0300 |
|||
+++ r/galera_ist_rsync.reject 2018-09-17 10:50:16.527307668 +0300 |
|||
@@ -259,3 +259,100 @@ |
|||
DROP TABLE t1; |
|||
COMMIT; |
|||
SET AUTOCOMMIT=ON; |
|||
+Performing State Transfer on a server that has been killed and restarted |
|||
+while a DDL was in progress on it |
|||
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+COMMIT; |
|||
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; |
|||
+ALTER TABLE t1 ADD COLUMN f2 INTEGER; |
|||
+SET wsrep_sync_wait = 0; |
|||
+Killing server ... |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+COMMIT; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+Performing --wsrep-recover ... |
|||
+Starting server ... |
|||
+Using --wsrep-start-position when starting mysqld ... |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+COMMIT; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+COMMIT; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+ROLLBACK; |
|||
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; |
|||
+COUNT(*) = 2 |
|||
+1 |
|||
+SELECT COUNT(*) = 35 FROM t1; |
|||
+COUNT(*) = 35 |
|||
+1 |
|||
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
|||
+COUNT(*) = 0 |
|||
+1 |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=ON; |
|||
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; |
|||
+COUNT(*) = 2 |
|||
+1 |
|||
+SELECT COUNT(*) = 35 FROM t1; |
|||
+COUNT(*) = 35 |
|||
+1 |
|||
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
|||
+COUNT(*) = 0 |
|||
+1 |
|||
+DROP TABLE t1; |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=ON; |
|||
+SET GLOBAL debug_dbug = $debug_orig; |
@ -0,0 +1,103 @@ |
|||
--- r/galera_ist_xtrabackup-v2.result 2018-09-05 10:34:36.192439933 +0300 |
|||
+++ r/galera_ist_xtrabackup-v2.reject 2018-09-17 11:13:33.395264800 +0300 |
|||
@@ -259,3 +259,100 @@ |
|||
DROP TABLE t1; |
|||
COMMIT; |
|||
SET AUTOCOMMIT=ON; |
|||
+Performing State Transfer on a server that has been killed and restarted |
|||
+while a DDL was in progress on it |
|||
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node1_committed_before'); |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+INSERT INTO t1 VALUES ('node2_committed_before'); |
|||
+COMMIT; |
|||
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; |
|||
+ALTER TABLE t1 ADD COLUMN f2 INTEGER; |
|||
+SET wsrep_sync_wait = 0; |
|||
+Killing server ... |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); |
|||
+COMMIT; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+Performing --wsrep-recover ... |
|||
+Starting server ... |
|||
+Using --wsrep-start-position when starting mysqld ... |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); |
|||
+COMMIT; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=OFF; |
|||
+START TRANSACTION; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); |
|||
+COMMIT; |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); |
|||
+ROLLBACK; |
|||
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; |
|||
+COUNT(*) = 2 |
|||
+1 |
|||
+SELECT COUNT(*) = 35 FROM t1; |
|||
+COUNT(*) = 35 |
|||
+1 |
|||
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
|||
+COUNT(*) = 0 |
|||
+1 |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=ON; |
|||
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; |
|||
+COUNT(*) = 2 |
|||
+1 |
|||
+SELECT COUNT(*) = 35 FROM t1; |
|||
+COUNT(*) = 35 |
|||
+1 |
|||
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
|||
+COUNT(*) = 0 |
|||
+1 |
|||
+DROP TABLE t1; |
|||
+COMMIT; |
|||
+SET AUTOCOMMIT=ON; |
|||
+SET GLOBAL debug_dbug = $debug_orig; |
@ -1 +1,2 @@ |
|||
--log-output=TABLE |
|||
--general-log=OFF |
@ -0,0 +1,230 @@ |
|||
## |
|||
## Tests the auto-increment with binlog in STATEMENT mode. |
|||
## |
|||
|
|||
--source include/galera_cluster.inc |
|||
--source include/have_innodb.inc |
|||
|
|||
--let $node_1=node_1 |
|||
--let $node_2=node_2 |
|||
--source include/auto_increment_offset_save.inc |
|||
|
|||
## |
|||
## Verify the correct operation of the auto-increment when the binlog |
|||
## format artificially set to the 'STATEMENT' (although this mode is |
|||
## not recommended in the current version): |
|||
## |
|||
|
|||
--connection node_2 |
|||
SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; |
|||
|
|||
--connection node_1 |
|||
SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; |
|||
|
|||
CREATE TABLE t1 ( |
|||
i int(11) NOT NULL AUTO_INCREMENT, |
|||
c char(32) DEFAULT 'dummy_text', |
|||
PRIMARY KEY (i) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
|||
|
|||
insert into t1(i) values(null); |
|||
|
|||
select * from t1; |
|||
|
|||
insert into t1(i) values(null), (null), (null); |
|||
|
|||
select * from t1; |
|||
|
|||
--connection node_2 |
|||
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; |
|||
--source include/wait_condition.inc |
|||
select * from t1; |
|||
|
|||
SET GLOBAL wsrep_forced_binlog_format='none'; |
|||
|
|||
--connection node_1 |
|||
|
|||
SET GLOBAL wsrep_forced_binlog_format='none'; |
|||
|
|||
drop table t1; |
|||
|
|||
## |
|||
## Check the operation when the automatic control over the auto-increment |
|||
## settings is switched off, that is, when we use the increment step and |
|||
## the offset specified by the user. In the current session, the binlog |
|||
## format is set to 'STATEMENT'. It is important that the values of the |
|||
## auto-increment options does not changed on other node - it allows us |
|||
## to check the correct transmission of the auto-increment options to |
|||
## other nodes: |
|||
## |
|||
|
|||
--disable_warnings |
|||
SET SESSION binlog_format='STATEMENT'; |
|||
--enable_warnings |
|||
|
|||
show variables like 'binlog_format'; |
|||
|
|||
SET GLOBAL wsrep_auto_increment_control='OFF'; |
|||
|
|||
SET SESSION auto_increment_increment = 3; |
|||
SET SESSION auto_increment_offset = 1; |
|||
|
|||
CREATE TABLE t1 ( |
|||
i int(11) NOT NULL AUTO_INCREMENT, |
|||
c char(32) DEFAULT 'dummy_text', |
|||
PRIMARY KEY (i) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
|||
|
|||
insert into t1(i) values(null); |
|||
|
|||
select * from t1; |
|||
|
|||
insert into t1(i) values(null), (null), (null); |
|||
|
|||
select * from t1; |
|||
|
|||
--connection node_2 |
|||
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; |
|||
--source include/wait_condition.inc |
|||
|
|||
select * from t1; |
|||
|
|||
--connection node_1 |
|||
|
|||
## |
|||
## Verify the return to automatic calculation of the step |
|||
## and offset of the auto-increment: |
|||
## |
|||
|
|||
SET GLOBAL wsrep_auto_increment_control='ON'; |
|||
|
|||
SET SESSION binlog_format='ROW'; |
|||
|
|||
show variables like 'binlog_format'; |
|||
show variables like '%auto_increment%'; |
|||
|
|||
## |
|||
## Verify the recovery of original user-defined values after |
|||
## stopping the automatic control over auto-increment: |
|||
## |
|||
|
|||
SET GLOBAL wsrep_auto_increment_control='OFF'; |
|||
|
|||
show variables like '%auto_increment%'; |
|||
|
|||
## |
|||
## Restore original options and drop test table: |
|||
## |
|||
|
|||
SET GLOBAL wsrep_auto_increment_control='ON'; |
|||
|
|||
drop table t1; |
|||
|
|||
## |
|||
## Verify the correct operation of the auto-increment when the binlog |
|||
## format set to the 'ROW': |
|||
## |
|||
|
|||
--connection node_2 |
|||
SET GLOBAL wsrep_forced_binlog_format='ROW'; |
|||
|
|||
--connection node_1 |
|||
SET GLOBAL wsrep_forced_binlog_format='ROW'; |
|||
|
|||
CREATE TABLE t1 ( |
|||
i int(11) NOT NULL AUTO_INCREMENT, |
|||
c char(32) DEFAULT 'dummy_text', |
|||
PRIMARY KEY (i) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
|||
|
|||
insert into t1(i) values(null); |
|||
|
|||
select * from t1; |
|||
|
|||
insert into t1(i) values(null), (null), (null); |
|||
|
|||
select * from t1; |
|||
|
|||
--connection node_2 |
|||
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; |
|||
--source include/wait_condition.inc |
|||
|
|||
select * from t1; |
|||
|
|||
SET GLOBAL wsrep_forced_binlog_format='none'; |
|||
|
|||
--connection node_1 |
|||
|
|||
SET GLOBAL wsrep_forced_binlog_format='none'; |
|||
|
|||
drop table t1; |
|||
|
|||
## |
|||
## Check the operation when the automatic control over the auto-increment |
|||
## settings is switched off, that is, when we use the increment step and |
|||
## the offset specified by the user. In the current session, the binlog |
|||
## format is set to 'ROW'. It is important that the values of the |
|||
## auto-increment options does not changed on other node - it allows us |
|||
## to check the correct transmission of the auto-increment options to |
|||
## other nodes: |
|||
## |
|||
|
|||
SET SESSION binlog_format='ROW'; |
|||
|
|||
show variables like 'binlog_format'; |
|||
|
|||
SET GLOBAL wsrep_auto_increment_control='OFF'; |
|||
|
|||
SET SESSION auto_increment_increment = 3; |
|||
SET SESSION auto_increment_offset = 1; |
|||
|
|||
CREATE TABLE t1 ( |
|||
i int(11) NOT NULL AUTO_INCREMENT, |
|||
c char(32) DEFAULT 'dummy_text', |
|||
PRIMARY KEY (i) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
|||
|
|||
insert into t1(i) values(null); |
|||
|
|||
select * from t1; |
|||
|
|||
insert into t1(i) values(null), (null), (null); |
|||
|
|||
select * from t1; |
|||
|
|||
--connection node_2 |
|||
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; |
|||
--source include/wait_condition.inc |
|||
|
|||
select * from t1; |
|||
|
|||
--connection node_1 |
|||
|
|||
## |
|||
## Verify the return to automatic calculation of the step |
|||
## and offset of the auto-increment: |
|||
## |
|||
|
|||
SET GLOBAL wsrep_auto_increment_control='ON'; |
|||
|
|||
show variables like 'binlog_format'; |
|||
show variables like '%auto_increment%'; |
|||
|
|||
## |
|||
## Verify the recovery of original user-defined values after |
|||
## stopping the automatic control over auto-increment: |
|||
## |
|||
|
|||
SET GLOBAL wsrep_auto_increment_control='OFF'; |
|||
|
|||
show variables like '%auto_increment%'; |
|||
|
|||
## |
|||
## Restore original options and drop test table: |
|||
## |
|||
|
|||
SET GLOBAL wsrep_auto_increment_control='ON'; |
|||
|
|||
drop table t1; |
|||
|
|||
--source include/auto_increment_offset_restore.inc |
@ -0,0 +1,7 @@ |
|||
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT); |
|||
INSERT INTO t1 VALUES (1,10),(2,20); |
|||
CREATE TABLE t2 (b INT) PARTITION BY KEY (b) PARTITIONS 2; |
|||
INSERT INTO t2 VALUES (1),(2); |
|||
DELETE t2 FROM t2 WHERE b BETWEEN 5 AND 9; |
|||
UPDATE t2 JOIN t1 SET b = 5; |
|||
DROP TABLE t1, t2; |
@ -0,0 +1,12 @@ |
|||
--source include/have_partition.inc |
|||
|
|||
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT); |
|||
INSERT INTO t1 VALUES (1,10),(2,20); |
|||
|
|||
CREATE TABLE t2 (b INT) PARTITION BY KEY (b) PARTITIONS 2; |
|||
INSERT INTO t2 VALUES (1),(2); |
|||
|
|||
DELETE t2 FROM t2 WHERE b BETWEEN 5 AND 9; |
|||
UPDATE t2 JOIN t1 SET b = 5; |
|||
|
|||
DROP TABLE t1, t2; |
@ -0,0 +1,44 @@ |
|||
/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. |
|||
Copyright (c) 2011, 2016, MariaDB |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
|||
|
|||
#ifndef SQL_TYPE_INT_INCLUDED |
|||
#define SQL_TYPE_INT_INCLUDED |
|||
|
|||
|
|||
// A longlong/ulonglong hybrid. Good to store results of val_int(). |
|||
class Longlong_hybrid |
|||
{ |
|||
protected: |
|||
longlong m_value; |
|||
bool m_unsigned; |
|||
public: |
|||
Longlong_hybrid(longlong nr, bool unsigned_flag) |
|||
:m_value(nr), m_unsigned(unsigned_flag) |
|||
{ } |
|||
longlong value() const { return m_value; } |
|||
bool is_unsigned() const { return m_unsigned; } |
|||
bool neg() const { return m_value < 0 && !m_unsigned; } |
|||
ulonglong abs() const |
|||
{ |
|||
if (m_unsigned) |
|||
return (ulonglong) m_value; |
|||
if (m_value == LONGLONG_MIN) // avoid undefined behavior |
|||
return ((ulonglong) LONGLONG_MAX) + 1; |
|||
return m_value < 0 ? -m_value : m_value; |
|||
} |
|||
}; |
|||
|
|||
#endif // SQL_TYPE_INT_INCLUDED |
Write
Preview
Loading…
Cancel
Save
Reference in new issue