1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge branch '10.5' into '10.6'

This commit is contained in:
Julius Goryavsky
2025-04-15 01:49:48 +02:00
115 changed files with 1394 additions and 65 deletions

View File

@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8...3.12)
IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
# Setting build type to RelWithDebInfo as none was specified.

View File

@@ -2997,5 +2997,69 @@ UPDATE t1 SET c=1 ORDER BY (SELECT c);
ERROR 42S22: Reference 'c' not supported (forward reference in item list)
DROP TABLE t1;
#
# MDEV-35238: Wrong results from a tables with a single record and an aggregate
#
CREATE OR REPLACE TABLE t1 (a int) ENGINE=myisam;
SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
1+0 min(1)
1 NULL
explain format=json SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"message": "Impossible WHERE noticed after reading const tables"
}
}
}
INSERT INTO t1 VALUES (NULL);
SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
1+0 min(1)
1 NULL
explain format=json SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
EXPLAIN
{
"query_block": {
"select_id": 1,
"pseudo_bits_condition": "if(uuid_short(),NULL,1)",
"table": {
"table_name": "t1",
"access_type": "system",
"rows": 1,
"filtered": 100
}
}
}
DROP TABLE t1;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=myisam;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (a int NOT NULL) ENGINE=myisam;
INSERT INTO t2 VALUES (10);
SELECT 1+0, MIN(t1.a) FROM t1,t2 WHERE t2.a = rand();
1+0 MIN(t1.a)
1 1
explain format=json SELECT 1+0, MIN(t1.a) FROM t1,t2 WHERE t2.a = rand();
EXPLAIN
{
"query_block": {
"select_id": 1,
"pseudo_bits_condition": "10 = rand()",
"table": {
"table_name": "t1",
"access_type": "system",
"rows": 1,
"filtered": 100
},
"table": {
"table_name": "t2",
"access_type": "system",
"rows": 1,
"filtered": 100
}
}
}
DROP TABLE t1,t2;
#
# End of 10.5 tests
#

View File

@@ -2152,6 +2152,28 @@ UPDATE t1 SET c=1 ORDER BY (SELECT c);
UPDATE t1 SET c=1 ORDER BY (SELECT c);
DROP TABLE t1;
--echo #
--echo # MDEV-35238: Wrong results from a tables with a single record and an aggregate
--echo #
CREATE OR REPLACE TABLE t1 (a int) ENGINE=myisam;
SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
explain format=json SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
INSERT INTO t1 VALUES (NULL);
SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
explain format=json SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
DROP TABLE t1;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=myisam;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (a int NOT NULL) ENGINE=myisam;
INSERT INTO t2 VALUES (10);
SELECT 1+0, MIN(t1.a) FROM t1,t2 WHERE t2.a = rand();
explain format=json SELECT 1+0, MIN(t1.a) FROM t1,t2 WHERE t2.a = rand();
DROP TABLE t1,t2;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@@ -9,7 +9,7 @@ connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR may_kill';
SET DEBUG_SYNC = 'now SIGNAL continue';
connection node_1;
ERROR HY000: Lost connection to server during query
Got one of the listed errors
connection node_2;
SHOW TABLES LIKE 't1';
Tables_in_test (t1)

View File

@@ -0,0 +1,112 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
Server 4 left the cluster
connection node_1;
CALL p1(130);
connection node_1;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_2;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
CALL p1(130);
connection node_1;
SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation";
Restarting server 4
Wait for server 1 to become a donor
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached";
Server 1 got SST request from server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_continue";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Waiting for server 4 to leave the cluster
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
Server 4 left the cluster, killing it...
Killed server 4...
Restarting server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
SELECT count(*) AS expect1_1 FROM t2;
expect1_1
1
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
SELECT count(*) AS expect2_1 FROM t2;
expect2_1
1
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
SELECT count(*) AS expect3_1 FROM t2;
expect3_1
1
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
SELECT count(*) AS expect4_1 FROM t2;
expect4_1
1
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Failed on preordered");
CALL mtr.add_suppression("Failed to apply write set");
CALL mtr.add_suppression("Sending JOIN failed: -103");
CALL mtr.add_suppression("Failed to JOIN the cluster after SST");

View File

@@ -0,0 +1,94 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
connection node_4;
Restarting server 4...
connection node_1;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Wait for the state snapshot to be copied to server 4
SST script unlocked server 1
connection node_1;
CALL p1(130);
connection node_1;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_2;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
CALL p1(130);
Waiting for server 4 to leave the cluster
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
Server 4 left the cluster, killing it...
Killed server 4...
Restarting server 4...
DROP TABLE t2;
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
DROP TABLE t1;
DROP PROCEDURE p1;
connection node_4;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus");
CALL mtr.add_suppression("Failed to apply write set: gtid:");

View File

@@ -0,0 +1,102 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
connection node_4;
Restarting server 4...
connection node_1;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Wait for the state snapshot to be copied to server 4
SST script unlocked server 1
connection node_1;
CALL p1(130);
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
SET SESSION wsrep_on = OFF;
connection node_1;
CALL p1(130);
Waiting for server 3 to leave the cluster
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
Server 3 left the cluster, killing it...
Killed server 3.
Restarting server 3...
Waiting for server 3 to rejoin the cluster
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
sleeping for 20
Waiting ready
Server 3 restarted.
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
DROP TABLE t1;
DROP PROCEDURE p1;
connection node_1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
connection node_2;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
connection node_3;
CALL mtr.add_suppression("Vote 0 \\(success\\) on .+ is inconsistent with group");
connection node_4;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");

View File

@@ -27,7 +27,7 @@ SET DEBUG_SYNC = 'now WAIT_FOR may_kill';
SET DEBUG_SYNC = 'now SIGNAL continue';
--connection node_1
--error 2013
--error 2013,2026
--reap
# Verify no tables created on either nodes.

View File

@@ -0,0 +1,20 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4

View File

@@ -0,0 +1,165 @@
#
# Test a case where a joiner encounters an error during IST
# Instead of voting it should assume error and bail out.
#
--source include/galera_cluster.inc
--source include/big_test.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
# Make sure that the test is operating on the right version of galera library.
--let $galera_version=26.4.19
source ../wsrep/include/check_galera_version.inc;
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--let $node_4=node_4
--source ../include/auto_increment_offset_save.inc
# create table t1 and procedure p1 to generate wirtesets
--connection node_1
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
DELIMITER |;
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
DELIMITER ;|
CALL p1(130);
--connection node_4
--echo Shutting down server 4...
--let $node_4_server_id= `SELECT @@server_id`
--let $node_4_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_4_server_id.expect
--let $node_4_pid_file= `SELECT @@pid_file`
--source include/shutdown_mysqld.inc
# Wait for node #4 to leave cluster
--let $members = 3
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_3
--source include/wsrep_wait_membership.inc
--echo Server 4 left the cluster
# Create some writesets for IST
--connection node_1
CALL p1(130);
# Create a writeset that node 4 won't be able to apply by creating a table
# that won't be present in the replication stream
--connection node_1
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_2
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_3
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause error during IST
INSERT INTO t2 VALUES (DEFAULT);
# make sure nodes 1,2,3 progress far enough for commit cut update
CALL p1(130);
--connection node_1
# prepare to stop SST donor thread when it receives a request from starting node #4
SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation";
--echo Restarting server 4
# Need to use this form instead of start_mysqld.inc because the latter is blocking
--exec echo "restart:$start_mysqld_params" > $node_4_expect_file_name
--echo Wait for server 1 to become a donor
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached";
--echo Server 1 got SST request from server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_continue";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
#
# After this point node #4 shall proceed to IST and bail out
#
--echo Waiting for server 4 to leave the cluster
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_3
--source include/wsrep_wait_membership.inc
--connection node_4
--echo Server 4 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_4_expect_file_name
--let KILL_NODE_PIDFILE = $node_4_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 4...
--source include/wait_until_disconnected.inc
--echo Restarting server 4...
--source include/start_mysqld.inc
--source include/galera_wait_ready.inc
# Confirm node #4 has rejoined
--connection node_1
--let $members = 4
--source include/wsrep_wait_membership.inc
# Confirm that all is good and all nodes have identical data
--connection node_1
SELECT count(*) AS expect1_390 FROM t1;
SELECT count(*) AS expect1_1 FROM t2;
--connection node_2
SELECT count(*) AS expect2_390 FROM t1;
SELECT count(*) AS expect2_1 FROM t2;
--connection node_3
SELECT count(*) AS expect3_390 FROM t1;
SELECT count(*) AS expect3_1 FROM t2;
--connection node_4
SELECT count(*) AS expect4_390 FROM t1;
SELECT count(*) AS expect4_1 FROM t2;
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Failed on preordered");
CALL mtr.add_suppression("Failed to apply write set");
CALL mtr.add_suppression("Sending JOIN failed: -103");
CALL mtr.add_suppression("Failed to JOIN the cluster after SST");
--source ../include/auto_increment_offset_restore.inc

View File

@@ -0,0 +1,21 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4
MTR_SST_JOINER_DELAY=20

View File

@@ -0,0 +1,73 @@
#
# Test a case where a vote happens in JOINED state after SST on a writeset
# that should be applied.
#
--source galera_vote_joined_begin.inc
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 10 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#
# Increase replication queue on node_4
--connection node_1
CALL p1(130);
# Create a writeset that node 4 won't be able to apply by creating a table
# that won't be present in the replication stream
--connection node_1
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_2
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_3
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause node #4 to initiate a vote and leave the cluster
INSERT INTO t2 VALUES (DEFAULT);
# make sure nodes 1,2,3 progress far enough for commit cut update
CALL p1(130);
--echo Waiting for server 4 to leave the cluster
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_4
--echo Server 4 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_4_expect_file_name
--let KILL_NODE_PIDFILE = $node_4_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 4...
--source include/wait_until_disconnected.inc
--echo Restarting server 4...
--source include/start_mysqld.inc
--source include/galera_wait_ready.inc
DROP TABLE t2;
--source galera_vote_joined_end.inc
--connection node_4
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus");
CALL mtr.add_suppression("Failed to apply write set: gtid:");

View File

@@ -0,0 +1,79 @@
# This file purpose is to set up node 4 to require SST which is artificaially
# prolonged and as a result accumulate sufficient relication queue.
# The contents of the qeuee are controlled in the sourcing test files.
--source include/galera_cluster.inc
--source include/big_test.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
# Make sure that the test is operating on the right version of galera library.
--let $galera_version=26.4.19
source ../wsrep/include/check_galera_version.inc;
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--let $node_4=node_4
--source ../include/auto_increment_offset_save.inc
# create table t1 and procedure p1 to generate wirtesets
--connection node_1
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
DELIMITER |;
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
DELIMITER ;|
# 130 events move the commit cut, it is essential in voting
CALL p1(130);
--connection node_4
--echo Shutting down server 4...
--let $node_4_server_id= `SELECT @@server_id`
--let $node_4_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_4_server_id.expect
--let $node_4_pid_file= `SELECT @@pid_file`
--source include/shutdown_mysqld.inc
# enforce SST
--exec rm -rf $MYSQLTEST_VARDIR/mysqld.4/data/grastate.dat
# Wait for node #4 to leave cluster
--connection node_1
--let $members = 3
--source include/wsrep_wait_membership.inc
# prepare to stop SST donor thread when node is in donor state
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
--connection node_4
--echo Restarting server 4...
# Need to use this form instead of start_mysqld.inc because the latter is blocking
--exec echo "restart:$start_mysqld_params" > $node_4_expect_file_name
# Wait for node #1 to become a donor
--connection node_1
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
--echo Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
--echo Wait for the state snapshot to be copied to server 4
--source include/galera_wait_ready.inc
--echo SST script unlocked server 1
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 20 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#

View File

@@ -0,0 +1,33 @@
# Confirm node #4 has rejoined
--connection node_1
--let $members = 4
--source include/wsrep_wait_membership.inc
#DROP TABLE IF EXISTS t2;
# Confirm that all is good and all nodes have identical data
--connection node_1
SELECT count(*) AS expect1_390 FROM t1;
#CALL mtr.add_suppression("Replica SQL: Could not execute Delete_rows");
#CALL mtr.add_suppression("Event 3 Delete_rows apply failed: 120, seqno [0-9]+");
--connection node_2
SELECT count(*) AS expect2_390 FROM t1;
#CALL mtr.add_suppression("mysqld: Can't find record in 't1'");
#CALL mtr.add_suppression("Replica SQL: Could not execute Delete_rows");
#CALL mtr.add_suppression("Event 3 Delete_rows apply failed: 120, seqno seqno [0-9]+");
--connection node_3
SELECT count(*) AS expect3_390 FROM t1;
--connection node_4
SELECT count(*) AS expect4_390 FROM t1;
DROP TABLE t1;
DROP PROCEDURE p1;
#CALL mtr.add_suppression("inconsistent with group");
--source ../include/auto_increment_offset_restore.inc

View File

@@ -0,0 +1,21 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4
MTR_SST_JOINER_DELAY=20

View File

@@ -0,0 +1,100 @@
#
# Test a case where a vote happens in JOINED state after SST on a writeset
# that should be skipped. I.e. JOINED node should continue operation.
#
--source galera_vote_joined_begin.inc
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 10 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#
# Increase replication queue on node_4
--connection node_1
CALL p1(130);
#
# Create a writeset that node 4 won't be able to apply by making node 3
# inconsisitent
#
--connection node_3
--let $node_3_server_id= `SELECT @@server_id`
--let $node_3_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_3_server_id.expect
--let $node_3_pid_file= `SELECT @@pid_file`
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause nodes #1 and #2 to initiate a vote and kick node #3
# out of the cluster, node #4 should recover the vote when fails to apply
# the event and continue
INSERT INTO t2 VALUES (DEFAULT);
SET SESSION wsrep_on = OFF;
# make sure nodes 1,2 progress far enough for commit cut update
--connection node_1
CALL p1(130);
--let $members = 3
--echo Waiting for server 3 to leave the cluster
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_4
# need to wait for extra SST delay on joiner
--sleep $MTR_SST_JOINER_DELAY
--sleep $MTR_SST_JOINER_DELAY
--enable_reconnect
--let $wait_timeout = 60
--source include/wsrep_wait_membership.inc
--connection node_3
--echo Server 3 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_3_expect_file_name
--let KILL_NODE_PIDFILE = $node_3_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 3.
--source include/wait_until_disconnected.inc
--echo Restarting server 3...
--exec echo "restart:$start_mysqld_params" > $node_3_expect_file_name
--echo Waiting for server 3 to rejoin the cluster
--connection node_1
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_3
--echo sleeping for $MTR_SST_JOINER_DELAY
# need to wait for extra SST delay on joiner
--sleep $MTR_SST_JOINER_DELAY
--sleep $MTR_SST_JOINER_DELAY
--echo Waiting ready
--enable_reconnect
--source include/galera_wait_ready.inc
--echo Server 3 restarted.
--source galera_vote_joined_end.inc
--connection node_1
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
--connection node_2
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
--connection node_3
CALL mtr.add_suppression("Vote 0 \\(success\\) on .+ is inconsistent with group");
--connection node_4
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");

View File

@@ -36,3 +36,16 @@ SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
DROP TABLE t1;
--echo #
--echo # MDEV-34922: Assertion `value.length() == FbtImpl::binary_length()' failed in
--echo # Type_handler_fbt<FbtImpl, TypeCollectionImpl>::Field_fbt::store_native,
--echo # Assertion `item->null_value' failed in Type_handler::Item_send_str
--echo #
CREATE TABLE t1 (a datetime);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM (SELECT cast('::' AS INET6),min(1) FROM t1 WHERE if(uuid_short(), a,1)) dt;
DROP TABLE t1;
--echo # End of 10.5 tests

View File

@@ -88,6 +88,18 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = INET6'::ff'
DROP TABLE t1;
#
# MDEV-34922: Assertion `value.length() == FbtImpl::binary_length()' failed in
# Type_handler_fbt<FbtImpl, TypeCollectionImpl>::Field_fbt::store_native,
# Assertion `item->null_value' failed in Type_handler::Item_send_str
#
CREATE TABLE t1 (a datetime);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM (SELECT cast('::' AS INET6),min(1) FROM t1 WHERE if(uuid_short(), a,1)) dt;
cast('::' AS INET6) min(1)
:: NULL
DROP TABLE t1;
# End of 10.5 tests
#
# MDEV-26742 Assertion `field->type_handler() == this' failed in FixedBinTypeBundle<NATIVE_LEN, MAX_CHAR_LEN>::Type_handler_fbt::stored_field_cmp_to_item
#
CREATE TABLE t1 (pk inet6, c text) engine=myisam;

View File

@@ -155,5 +155,17 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = INET6'::ff'
DROP TABLE t1;
#
# MDEV-34922: Assertion `value.length() == FbtImpl::binary_length()' failed in
# Type_handler_fbt<FbtImpl, TypeCollectionImpl>::Field_fbt::store_native,
# Assertion `item->null_value' failed in Type_handler::Item_send_str
#
CREATE TABLE t1 (a datetime);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM (SELECT cast('::' AS INET6),min(1) FROM t1 WHERE if(uuid_short(), a,1)) dt;
cast('::' AS INET6) min(1)
:: NULL
DROP TABLE t1;
# End of 10.5 tests
#
# End of 10.5 tests
#

View File

@@ -88,6 +88,18 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = INET6'::ff'
DROP TABLE t1;
#
# MDEV-34922: Assertion `value.length() == FbtImpl::binary_length()' failed in
# Type_handler_fbt<FbtImpl, TypeCollectionImpl>::Field_fbt::store_native,
# Assertion `item->null_value' failed in Type_handler::Item_send_str
#
CREATE TABLE t1 (a datetime);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM (SELECT cast('::' AS INET6),min(1) FROM t1 WHERE if(uuid_short(), a,1)) dt;
cast('::' AS INET6) min(1)
:: NULL
DROP TABLE t1;
# End of 10.5 tests
#
# MDEV-26742 Assertion `field->type_handler() == this' failed in FixedBinTypeBundle<NATIVE_LEN, MAX_CHAR_LEN>::Type_handler_fbt::stored_field_cmp_to_item
#
CREATE TABLE t1 (c varchar(64), key(c)) engine=myisam;

View File

@@ -1910,4 +1910,17 @@ create_data
SST_PID="$DATA/wsrep_sst.pid"
if [ -n "${MTR_SST_JOINER_DELAY:-}" ]; then
MTR_SST_JOINER_DELAY=$(trim_string "$MTR_SST_JOINER_DELAY")
fi
simulate_long_sst()
{
# Delay for MTR tests if needed to simulate long SST/IST:
if [ ${MTR_SST_JOINER_DELAY:-0} -gt 0 ]; then
wsrep_log_info "Sleeping $MTR_SST_JOINER_DELAY seconds for MTR test"
sleep $MTR_SST_JOINER_DELAY
fi
}
wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE started on $WSREP_SST_OPT_ROLE"

View File

@@ -1519,6 +1519,8 @@ else # joiner
exit 2
fi
simulate_long_sst
# use donor magic file, if present
# if IST was used, donor magic file was not created
# Remove special tags from the magic file, and from the output:

View File

@@ -184,5 +184,9 @@ else
echo "$SET_START_POSITION" | $MYSQL || exit $?
fi
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
simulate_long_sst
fi
wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE completed on $WSREP_SST_OPT_ROLE"
exit 0

View File

@@ -915,6 +915,8 @@ EOF
fi
fi
simulate_long_sst
# Remove special tags from the magic file, and from the output:
coords=$(head -n1 "$MAGIC_FILE")
wsrep_log_info "Galera co-ords from recovery: $coords"

View File

@@ -643,19 +643,8 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count,
static char dbug_row_print_buf[4096];
/*
Print table's current row into a buffer and return a pointer to it.
This is intended to be used from gdb:
(gdb) p dbug_print_table_row(table)
$33 = "SUBQUERY2_t1(col_int_key,col_varchar_nokey)=(7,c)"
(gdb)
Only columns in table->read_set are printed
*/
const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names)
String dbug_format_row(TABLE *table, const uchar *rec, bool print_names)
{
Field **pfield;
char row_buff_tmp[512];
@@ -724,13 +713,36 @@ const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names)
}
}
output.append(')');
if (output.c_ptr() == dbug_row_print_buf)
return dbug_row_print_buf;
else
return "Couldn't fit into buffer";
return output;
}
/**
A function to display a row in debugger.
Example usage:
(gdb) p dbug_print_row(table, table->record[1])
*/
const char *dbug_print_row(TABLE *table, const uchar *rec)
{
String row= dbug_format_row(table, table->record[0]);
if (row.length() > sizeof dbug_row_print_buf - 1)
return "Couldn't fit into buffer";
memcpy(dbug_row_print_buf, row.c_ptr(), row.length());
return dbug_row_print_buf;
}
/**
Print table's current row into a buffer and return a pointer to it.
This is intended to be used from gdb:
(gdb) p dbug_print_table_row(table)
$33 = "SUBQUERY2_t1(col_int_key,col_varchar_nokey)=(7,c)"
(gdb)
Only columns in table->read_set are printed
*/
const char* dbug_print_table_row(TABLE *table)
{
return dbug_print_row(table, table->record[0]);

View File

@@ -7763,7 +7763,8 @@ int handler::ha_write_row(const uchar *buf)
TABLE_IO_WAIT(tracker, PSI_TABLE_WRITE_ROW, MAX_KEY, error,
{ error= write_row(buf); })
DBUG_PRINT("dml", ("INSERT: %s = %d", dbug_print_row(table, buf, false), error));
DBUG_PRINT("dml", ("INSERT: %s = %d",
dbug_format_row(table, buf, false).c_ptr_safe(), error));
MYSQL_INSERT_ROW_DONE(error);
if (likely(!error))
@@ -7823,8 +7824,10 @@ int handler::ha_update_row(const uchar *old_data, const uchar *new_data)
TABLE_IO_WAIT(tracker, PSI_TABLE_UPDATE_ROW, active_index, 0,
{ error= update_row(old_data, new_data);})
DBUG_PRINT("dml", ("UPDATE: %s => %s = %d", dbug_print_row(table, old_data, false),
dbug_print_row(table, new_data, false), error));
DBUG_PRINT("dml", ("UPDATE: %s => %s = %d",
dbug_format_row(table, old_data, false).c_ptr_safe(),
dbug_format_row(table, new_data, false).c_ptr_safe(),
error));
MYSQL_UPDATE_ROW_DONE(error);
if (likely(!error))
@@ -7904,7 +7907,8 @@ int handler::ha_delete_row(const uchar *buf)
TABLE_IO_WAIT(tracker, PSI_TABLE_DELETE_ROW, active_index, error,
{ error= delete_row(buf);})
DBUG_PRINT("dml", ("DELETE: %s = %d", dbug_print_row(table, buf, false), error));
DBUG_PRINT("dml", ("DELETE: %s = %d",
dbug_format_row(table, buf, false).c_ptr_safe(), error));
MYSQL_DELETE_ROW_DONE(error);
if (likely(!error))
{

View File

@@ -5537,6 +5537,6 @@ int get_select_field_pos(Alter_info *alter_info, int select_field_count,
bool versioned);
#ifndef DBUG_OFF
const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names= true);
String dbug_format_row(TABLE *table, const uchar *rec, bool print_names= true);
#endif /* DBUG_OFF */
#endif /* HANDLER_INCLUDED */

View File

@@ -5287,6 +5287,7 @@ bool Item_param::assign_default(Field *field)
double Item_copy_string::val_real()
{
DBUG_ASSERT(copied_in);
int err_not_used;
char *end_not_used;
return (null_value ? 0.0 :
@@ -5297,6 +5298,7 @@ double Item_copy_string::val_real()
longlong Item_copy_string::val_int()
{
DBUG_ASSERT(copied_in);
int err;
return null_value ? 0 : str_value.charset()->strntoll(str_value.ptr(),
str_value.length(), 10,
@@ -5306,6 +5308,7 @@ longlong Item_copy_string::val_int()
int Item_copy_string::save_in_field(Field *field, bool no_conversions)
{
DBUG_ASSERT(copied_in);
return save_str_value_in_field(field, &str_value);
}
@@ -5316,11 +5319,15 @@ void Item_copy_string::copy()
if (res && res != &str_value)
str_value.copy(*res);
null_value=item->null_value;
#ifndef DBUG_OFF
copied_in= 1;
#endif
}
/* ARGSUSED */
String *Item_copy_string::val_str(String *str)
{
DBUG_ASSERT(copied_in);
// Item_copy_string is used without fix_fields call
if (null_value)
return (String*) 0;
@@ -5330,6 +5337,7 @@ String *Item_copy_string::val_str(String *str)
my_decimal *Item_copy_string::val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(copied_in);
// Item_copy_string is used without fix_fields call
if (null_value)
return (my_decimal *) 0;

View File

@@ -6644,8 +6644,15 @@ protected:
Type_std_attributes::set(item);
name= item->name;
set_handler(item->type_handler());
#ifndef DBUG_OFF
copied_in= 0;
#endif
}
#ifndef DBUG_OFF
bool copied_in;
#endif
public:
/**
@@ -6711,7 +6718,10 @@ public:
double val_real() override;
longlong val_int() override;
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ return get_date_from_string(thd, ltime, fuzzydate); }
{
DBUG_ASSERT(copied_in);
return get_date_from_string(thd, ltime, fuzzydate);
}
void copy() override;
int save_in_field(Field *field, bool no_conversions) override;
Item *do_get_copy(THD *thd) const override
@@ -6741,9 +6751,13 @@ public:
null_value= tmp.is_null();
m_value= tmp.is_null() ? Timestamp_or_zero_datetime() :
Timestamp_or_zero_datetime(tmp);
#ifndef DBUG_OFF
copied_in=1;
#endif
}
int save_in_field(Field *field, bool) override
{
DBUG_ASSERT(copied_in);
DBUG_ASSERT(sane());
if (null_value)
return set_field_to_null(field);
@@ -6752,30 +6766,35 @@ public:
}
longlong val_int() override
{
DBUG_ASSERT(copied_in);
DBUG_ASSERT(sane());
return null_value ? 0 :
m_value.to_datetime(current_thd).to_longlong();
}
double val_real() override
{
DBUG_ASSERT(copied_in);
DBUG_ASSERT(sane());
return null_value ? 0e0 :
m_value.to_datetime(current_thd).to_double();
}
String *val_str(String *to) override
{
DBUG_ASSERT(copied_in);
DBUG_ASSERT(sane());
return null_value ? NULL :
m_value.to_datetime(current_thd).to_string(to, decimals);
}
my_decimal *val_decimal(my_decimal *to) override
{
DBUG_ASSERT(copied_in);
DBUG_ASSERT(sane());
return null_value ? NULL :
m_value.to_datetime(current_thd).to_decimal(to);
}
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{
DBUG_ASSERT(copied_in);
DBUG_ASSERT(sane());
bool res= m_value.to_TIME(thd, ltime, fuzzydate);
DBUG_ASSERT(!res);
@@ -6783,6 +6802,7 @@ public:
}
bool val_native(THD *thd, Native *to) override
{
DBUG_ASSERT(copied_in);
DBUG_ASSERT(sane());
return null_value || m_value.to_native(to, decimals);
}

View File

@@ -146,7 +146,6 @@ public:
};
transaction() : m_thd(NULL) { }
transaction(transaction const&);
~transaction();
/* Clear transaction, i.e., make calls to 'good()' return false. */

View File

@@ -8591,14 +8591,15 @@ err_no_arena:
}
static void unwind_stored_field_offsets(const List<Item> &fields, Field *end)
static void unwind_stored_field_offsets(const List<Item> &fields, Item_field *end)
{
for (Item &item_field: fields)
for (Item &item: fields)
{
Field *f= item_field.field_for_view_update()->field;
if (f == end)
Item_field *item_field= item.field_for_view_update();
if (item_field == end)
break;
Field *f= item_field->field;
if (f->stored_in_db())
{
TABLE *table= f->table;
@@ -8643,7 +8644,7 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
{
List_iterator_fast<Item> f(fields),v(values);
Item *value, *fld;
Item_field *field;
Item_field *field= NULL;
Field *rfield;
TABLE *table;
bool only_unvers_fields= update && table_arg->versioned();
@@ -8661,11 +8662,8 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
while ((fld= f++))
{
if (!(field= fld->field_for_view_update()))
{
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), fld->name.str);
goto err_unwind_fields;
}
field= fld->field_for_view_update();
DBUG_ASSERT(field); // ensured by check_fields or check_view_insertability.
value=v++;
DBUG_ASSERT(value);
rfield= field->field;
@@ -8727,7 +8725,7 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
DBUG_RETURN(thd->is_error());
err_unwind_fields:
if (update && thd->variables.sql_mode & MODE_SIMULTANEOUS_ASSIGNMENT)
unwind_stored_field_offsets(fields, rfield);
unwind_stored_field_offsets(fields, field);
err:
DBUG_PRINT("error",("got error"));
thd->abort_on_warning= save_abort_on_warning;

View File

@@ -21875,6 +21875,8 @@ do_select(JOIN *join, Procedure *procedure)
*/
clear_tables(join, &cleared_tables);
}
if (join->tmp_table_param.copy_funcs.elements)
copy_fields(&join->tmp_table_param);
if (!join->having || join->having->val_bool())
{
List<Item> *columns_list= (procedure ? &join->procedure_fields_list :

View File

@@ -909,6 +909,8 @@ public:
:Charset(cs), Binary_string(str, len)
{ }
String(const String &str) = default;
String(String &&str) noexcept
:Charset(std::move(str)), Binary_string(std::move(str)){}
void set(String &str,size_t offset,size_t arg_length)
{

View File

@@ -2527,7 +2527,7 @@ struct TABLE_LIST
List<TABLE_LIST> *view_tables;
/* most upper view this table belongs to */
TABLE_LIST *belong_to_view;
/* A derived table this table belongs to */
/* A merged derived table this table belongs to */
TABLE_LIST *belong_to_derived;
/*
The view directly referencing this table

View File

@@ -5,7 +5,7 @@
/******************************************************************/
/* Dual XML implementation base classes defines. */
/******************************************************************/
#if !defined(BASE_BUFFER_SIZE)
#ifndef LIBXML2_SUPPORT
enum ElementType { // libxml2
XML_ELEMENT_NODE = 1,
XML_ATTRIBUTE_NODE = 2,
@@ -28,7 +28,7 @@ enum ElementType { // libxml2
XML_XINCLUDE_START = 19,
XML_XINCLUDE_END = 20,
XML_DOCB_DOCUMENT_NODE = 21};
#endif // !BASE_BUFFER_SIZE
#endif
//#if !defined(NODE_TYPE_LIST)
#ifdef NOT_USED

View File

@@ -25,6 +25,9 @@
#include <netinet/in.h>
#include <unistd.h>
//#include <ctype.h>
#ifdef LIBXML2_SUPPORT
#include <libxml/tree.h>
#endif
#include "osutil.h"
#define _O_RDONLY O_RDONLY
#endif // !_WIN32

View File

@@ -17,7 +17,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 2.8...3.12)
project(mroonga)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")

View File

@@ -15,7 +15,7 @@
# https://buildbot.askmonty.org/buildbot/builders/work-amd64-valgrind/builds/5263/steps/compile/logs/stdio
# says CMake 2.6.2... We want to drop old software support...
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 2.8...3.12)
# cmake_minimum_required(VERSION 2.6.4) # CentOS 5
set(GRN_PROJECT_NAME "groonga")
set(GRN_PROJECT_LABEL "Groonga")

View File

@@ -15,7 +15,7 @@
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1335 USA
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 2.8...3.12)
if(NOT DEFINED GROONGA_NORMALIZER_MYSQL_PROJECT_NAME)
set(GROONGA_NORMALIZER_MYSQL_PROJECT_NAME "groonga-normalizer-mysql")
endif()

View File

@@ -395,7 +395,9 @@ if ($USE_CHILD_GROUP3)
--connection master_1
eval $MASTER_1_SET_RECOVERY_STATUS_2_1;
eval $MASTER_1_CHECK_LINK_STATUS;
--disable_view_protocol
eval $MASTER_1_COPY_TABLES_2_1;
--enable_view_protocol
if ($USE_CHILD_GROUP3)
{
if (!$OUTPUT_CHILD_GROUP3)

View File

@@ -460,7 +460,9 @@ if ($HAVE_PARTITION)
--connection master_1
eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1;
eval $MASTER_1_CHECK_LINK_STATUS;
--disable_view_protocol
eval $MASTER_1_COPY_TABLES_P_2_1;
--enable_view_protocol
if ($USE_CHILD_GROUP3)
{
if (!$OUTPUT_CHILD_GROUP3)

View File

@@ -6,6 +6,6 @@
--enable_query_log
--enable_warnings
let $DIRECT_SQL_COMMAND=
SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"');
SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"') as exp;
--connection child2_1
GRANT ALL ON *.* TO tu@'%' IDENTIFIED BY 'pass,1234';

View File

@@ -6,4 +6,4 @@
--enable_query_log
--enable_warnings
let $DIRECT_SQL_COMMAND=
SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test"');
SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test"') as exp;

View File

@@ -15,8 +15,8 @@ CREATE TEMPORARY TABLE tmp_a (
pkey int NOT NULL,
PRIMARY KEY (pkey)
) MASTER_1_ENGINE2
SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"');
spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"')
SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"') as exp;
exp
1
SELECT pkey FROM tmp_a;
pkey

View File

@@ -13,8 +13,8 @@ CREATE TEMPORARY TABLE tmp_a (
pkey int NOT NULL,
PRIMARY KEY (pkey)
) MASTER_1_ENGINE2
SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test"');
spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test"')
SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test"') as exp;
exp
1
SELECT pkey FROM tmp_a;
pkey

View File

@@ -15,6 +15,9 @@ insert into t1 VALUES (1,4), (1,2), (2,11);
SELECT MIN(b), a FROM t1 WHERE a=1;
MIN(b) a
2 1
select * from (SELECT MIN(b), a FROM t1 WHERE a=1) as v;
MIN(b) a
2 1
SELECT MAX(b), a FROM t1 WHERE a<3;
MAX(b) a
11 1

View File

@@ -31,8 +31,8 @@ CREATE TABLE tbl_a (
a INT
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
create temporary table results (a int);
SELECT SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"');
SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"')
SELECT SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"') as exp;
exp
1
select * from results;
a

View File

@@ -31,8 +31,8 @@ CREATE TABLE tbl_a (
a INT
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
create temporary table results (a int);
SELECT SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"');
SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"')
SELECT SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"') as exp;
exp
1
select * from results;
a

View File

@@ -52,9 +52,11 @@ TRUNCATE TABLE mysql.general_log;
CHECKSUM TABLE tbl_a EXTENDED;
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--echo

View File

@@ -59,9 +59,11 @@ SET NAMES utf8;
--connection child2_1
SET NAMES cp932;
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
SET NAMES utf8;

View File

@@ -78,9 +78,11 @@ sync_with_master;
SET SESSION sql_log_bin= 0;
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection slave1_1

View File

@@ -71,16 +71,22 @@ TRUNCATE TABLE mysql.general_log;
set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
set spider_direct_aggregate=1;
SHOW STATUS LIKE 'Spider_direct_aggregate';
--disable_view_protocol
SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5;
--enable_view_protocol
SHOW STATUS LIKE 'Spider_direct_aggregate';
set spider_direct_aggregate=@old_spider_direct_aggregate;
--connection child2_1
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -79,9 +79,11 @@ INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FRO
INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 5 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--echo

View File

@@ -71,11 +71,15 @@ SELECT * FROM tbl_a WHERE pkey = 2;
SELECT * FROM tbl_a;
--connection child2_1
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -70,7 +70,9 @@ SELECT a, b, c FROM tbl_a PARTITION (pt2,pt3);
--connection child2_1
--disable_ps2_protocol
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
--enable_ps2_protocol
--disable_ps_protocol
eval $CHILD2_1_SELECT_TABLES;

View File

@@ -49,17 +49,23 @@ TRUNCATE TABLE mysql.general_log;
--disable_ps2_protocol
--connection master_1
--disable_view_protocol
SELECT id, 0 AS const, val FROM tbl_a;
SELECT 1+2, id, 0 AS const, val, val+10, (SELECT tbl_a.val+1 FROM tbl_a) AS sq
FROM tbl_a;
--enable_view_protocol
INSERT INTO tbl_a (val) VALUES (2), (1);
--disable_view_protocol
SELECT val+10, 0 AS const, val, (SELECT tbl_a.val+1 FROM tbl_a LIMIT 1) AS sq
FROM tbl_a GROUP BY val;
SELECT MAX(id) AS m, 0 AS const, val, (SELECT tbl_a.val+1 FROM tbl_a LIMIT 1) AS sq
FROM tbl_a GROUP BY val;
--enable_view_protocol
--connection child2_1
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -81,9 +81,11 @@ SELECT STRAIGHT_JOIN b.a, b.b FROM tb_l a, tbl_a b WHERE a.a = b.a;
--connection child2_1
SET NAMES utf8;
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
--disable_ps_protocol
eval $CHILD2_1_SELECT_TABLES;
--enable_ps_protocol

View File

@@ -22,6 +22,7 @@ create table t1 (a int, b int, PRIMARY KEY (a, b)) ENGINE=Spider
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
insert into t1 VALUES (1,4), (1,2), (2,11);
SELECT MIN(b), a FROM t1 WHERE a=1;
select * from (SELECT MIN(b), a FROM t1 WHERE a=1) as v;
SELECT MAX(b), a FROM t1 WHERE a<3;
drop table t1, t2;

View File

@@ -50,8 +50,10 @@ eval CREATE TABLE tbl_a (
--disable_ps2_protocol
INSERT INTO tbl_a VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
--disable_view_protocol
SELECT * FROM tbl_a WHERE greeting = "Aloha!"
AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH
--enable_view_protocol
# LIKE
eval CREATE TABLE tbl_b (
@@ -61,8 +63,10 @@ eval CREATE TABLE tbl_b (
) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_b", srv "s_2_1"';
INSERT INTO tbl_b VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
--disable_view_protocol
SELECT * FROM tbl_b WHERE greeting = "Aloha!"
AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH
--enable_view_protocol
# LIKE
eval CREATE TABLE tbl_c (
@@ -72,11 +76,15 @@ eval CREATE TABLE tbl_c (
) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_c", srv "s_2_1"';
INSERT INTO tbl_c VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
--disable_view_protocol
SELECT * FROM tbl_c WHERE greeting = "Aloha!"
AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH
--enable_view_protocol
--connection child2_1
--disable_view_protocol
SELECT argument FROM mysql.general_log WHERE argument LIKE 'select `id`,`greeting` from %';
--enable_view_protocol
--enable_ps2_protocol
--connection child2_1

View File

@@ -31,15 +31,19 @@ eval CREATE TABLE tbl_a (
) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
--disable_ps_protocol
--disable_view_protocol
SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY f1, f2;
SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY MIN(t2.a), MAX(t2.a), f2;
--enable_view_protocol
--enable_ps_protocol
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
--connection child2_1
--disable_ps_protocol
--disable_view_protocol
SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %';
--enable_view_protocol
--enable_ps_protocol
set global log_output=@old_log_output;
set global general_log=@old_general_log;

View File

@@ -24,10 +24,14 @@ eval CREATE TABLE t1 (a INT KEY) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "$sr
SELECT MAX(a) FROM t1;
SELECT SUM(a) FROM t1;
SELECT COUNT(a) FROM t1;
# Spider does not create a GBH with view protocol in these cases which
# would cause extra direct aggregate counts than without view protocol
--disable_view_protocol
SELECT MAX(a), SUM(a) FROM t1;
SELECT COUNT(a), MAX(a), SUM(a) FROM t1;
SELECT MAX(a), COUNT(a), SUM(a) FROM t1;
SELECT MAX(a), MAX(COALESCE(a)) FROM t1;
--enable_view_protocol
SHOW STATUS LIKE 'Spider_direct_aggregate';
DROP TABLE t, t1;

View File

@@ -25,7 +25,9 @@ INSERT INTO dst VALUES (555, '1999-12-12');
# possibly a bug, e.g. an unnecessary requirement.
evalp CREATE TABLE t (c INT, d DATE, PRIMARY KEY(c)) ENGINE=SPIDER
COMMENT='table "src dst", srv "s_2_1 s_1"';
--disable_view_protocol
SELECT spider_copy_tables('t', '0', '1');
--enable_view_protocol
SELECT * FROM dst;

View File

@@ -7,8 +7,10 @@ CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
SELECT spider_bg_direct_sql ('SELECT * FROM s','a','srv "b"');
CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so';
--disable_view_protocol
--error ER_CANT_INITIALIZE_UDF
SELECT spider_copy_tables ('t', '0', '0');
--enable_view_protocol
# spider_flush_table_mon_cache does not require spider init to function
CREATE FUNCTION spider_flush_table_mon_cache RETURNS INT SONAME 'ha_spider.so';
@@ -21,8 +23,10 @@ install soname 'ha_spider';
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
call mtr.add_suppression(".*\\[Error\\] (mysqld|mariadbd): Can't find record in 'spider_tables'");
--disable_view_protocol
--error ER_KEY_NOT_FOUND
SELECT spider_copy_tables ('t', '0', '0');
--enable_view_protocol
SELECT spider_flush_table_mon_cache ();

View File

@@ -12,7 +12,10 @@ CREATE TABLE t1 (c INT) ENGINE=MyISAM;
CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t1"';
insert into t2 values (456), (123);
SELECT * FROM t2 ORDER BY CAST(c AS char(60));
# extra warnings with view protocol
--disable_view_protocol
SELECT * FROM t2 ORDER BY CAST(c AS INET6);
--enable_view_protocol
SELECT * FROM t2 GROUP BY CAST(c AS char(60));
SELECT * FROM t2 GROUP BY CAST(c AS INET6);
# Cleanup

View File

@@ -78,13 +78,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--connection master_1
@@ -103,13 +107,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--connection master_1
@@ -129,12 +137,16 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
--disable_view_protocol
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -78,13 +78,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--connection master_1
@@ -103,13 +107,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--connection master_1
@@ -128,13 +136,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -78,13 +78,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--connection master_1
@@ -103,13 +107,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--connection master_1
@@ -128,13 +136,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -79,13 +79,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--connection master_1
@@ -104,13 +108,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--connection master_1
@@ -129,13 +137,17 @@ TRUNCATE TABLE mysql.general_log;
SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -56,9 +56,11 @@ exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -
--enable_query_log
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
TRUNCATE TABLE mysql.general_log;
@@ -69,9 +71,11 @@ exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -
--enable_query_log
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
TRUNCATE TABLE mysql.general_log;
@@ -82,9 +86,11 @@ exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -
--enable_query_log
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--echo

View File

@@ -58,9 +58,11 @@ exec $MYSQL -v -v -u root -h localhost --default-character-set=latin1 -P $MASTER
--enable_query_log
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--echo

View File

@@ -52,9 +52,11 @@ TRUNCATE TABLE mysql.general_log;
SELECT pkey FROM tbl_a WHERE NULL;
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--echo

View File

@@ -55,7 +55,9 @@ SELECT `pkey`, LEFT(`txt_utf8`, 4) FROM `auto_test_local`.`tbl_a` ORDER BY LEFT(
--connection child2_1
SET NAMES utf8;
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -71,10 +71,12 @@ SET SESSION sql_log_bin= 0;
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
--replace_regex /-[0-9a-f]{12}-[0-9a-f]+-/-xxxxxxxxxxxx-xxxxx-/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection slave1_1

View File

@@ -49,8 +49,10 @@ TRUNCATE TABLE mysql.general_log;
SELECT * FROM tbl_a ORDER BY pkey;
--connection child2_1
--disable_view_protocol
--replace_regex /-[0-9a-f]{12}-[0-9a-f]+-/-xxxxxxxxxxxx-xxxxx-/
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -78,15 +78,19 @@ SHOW STATUS LIKE 'Spider_direct_aggregate';
set spider_direct_aggregate=@old_spider_direct_aggregate;
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--echo

View File

@@ -37,7 +37,7 @@ eval CREATE TABLE tbl_a (
create temporary table results (a int);
--disable_ps_protocol
SELECT SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"');
SELECT SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"') as exp;
--enable_ps_protocol
select * from results;

View File

@@ -47,12 +47,14 @@ TRUNCATE TABLE mysql.general_log;
--disable_ps2_protocol
--connection master_1
--disable_view_protocol
SELECT * FROM tbl_a ORDER BY pkey;
--enable_view_protocol
--connection child2_1
# in --ps a query is logged differently in a general log
replace_regex /order by t0.`pkey`/order by `pkey`/;
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -49,9 +49,11 @@ XA PREPARE 'test';
XA COMMIT 'test';
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--echo

View File

@@ -11,11 +11,11 @@ create table t2 (c int);
create table t1 (c int) ENGINE=Spider
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
insert into t1 values (42), (3), (848), (100);
explain select case c when 3 then "three" when 42 then "answer" else "other" end from t1;
explain select case c when 3 then "three" when 42 then "answer" else "other" end as exp from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY
select case c when 3 then "three" when 42 then "answer" else "other" end from t1;
case c when 3 then "three" when 42 then "answer" else "other" end
select case c when 3 then "three" when 42 then "answer" else "other" end as exp from t1;
exp
answer
three
other
@@ -29,11 +29,11 @@ answer
three
NULL
NULL
explain select case when c = 3 then "three" when c = 42 then "answer" else "other" end from t1;
explain select case when c = 3 then "three" when c = 42 then "answer" else "other" end as exp from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY
select case when c = 3 then "three" when c = 42 then "answer" else "other" end from t1;
case when c = 3 then "three" when c = 42 then "answer" else "other" end
select case when c = 3 then "three" when c = 42 then "answer" else "other" end as exp from t1;
exp
answer
three
other

View File

@@ -74,10 +74,12 @@ send_eval $MASTER_1_CHECKSUM_TABLE;
--connection child2_1_2
SELECT SLEEP(1);
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--connection child2_2_2
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
--connection child2_1
UNLOCK TABLES;

View File

@@ -16,7 +16,7 @@ insert into t1 values (42), (3), (848), (100);
# everything
let $query=
select case c when 3 then "three" when 42 then "answer" else "other" end from t1;
select case c when 3 then "three" when 42 then "answer" else "other" end as exp from t1;
eval explain $query;
eval $query;
@@ -28,7 +28,7 @@ eval $query;
# no value
let $query=
select case when c = 3 then "three" when c = 42 then "answer" else "other" end from t1;
select case when c = 3 then "three" when c = 42 then "answer" else "other" end as exp from t1;
eval explain $query;
eval $query;

View File

@@ -395,7 +395,9 @@ if ($USE_CHILD_GROUP3)
--connection master_1
eval $MASTER_1_SET_RECOVERY_STATUS_2_1;
eval $MASTER_1_CHECK_LINK_STATUS;
--disable_view_protocol
eval $MASTER_1_COPY_TABLES_2_1;
--enable_view_protocol
if ($USE_CHILD_GROUP3)
{
if (!$OUTPUT_CHILD_GROUP3)

View File

@@ -460,7 +460,9 @@ if ($HAVE_PARTITION)
--connection master_1
eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1;
eval $MASTER_1_CHECK_LINK_STATUS;
--disable_view_protocol
eval $MASTER_1_COPY_TABLES_P_2_1;
--enable_view_protocol
if ($USE_CHILD_GROUP3)
{
if (!$OUTPUT_CHILD_GROUP3)

View File

@@ -67,7 +67,9 @@ SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5;
--connection child2_1
--disable_ps_protocol
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--enable_ps_protocol

View File

@@ -67,7 +67,9 @@ SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5;
--connection child2_1
--disable_ps_protocol
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--enable_ps_protocol

View File

@@ -67,9 +67,11 @@ eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $
--remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv
--connection child2_1
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--echo

View File

@@ -71,16 +71,22 @@ TRUNCATE TABLE mysql.general_log;
set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
set spider_direct_aggregate=1;
SHOW STATUS LIKE 'Spider_direct_aggregate';
--disable_view_protocol
SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5;
--enable_view_protocol
SHOW STATUS LIKE 'Spider_direct_aggregate';
set spider_direct_aggregate=@old_spider_direct_aggregate;
--connection child2_1
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -84,11 +84,15 @@ eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $
--disable_ps2_protocol
--connection child2_1
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
--disable_view_protocol
eval $CHILD2_2_SELECT_ARGUMENT1;
--enable_view_protocol
eval $CHILD2_2_SELECT_TABLES;
--enable_ps2_protocol

View File

@@ -145,7 +145,9 @@ if ($USE_CHILD_GROUP2)
}
--connection master_1
--disable_ps2_protocol
--disable_view_protocol
SELECT * FROM tbl_a;
--enable_view_protocol
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
@@ -156,7 +158,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

View File

@@ -96,9 +96,11 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
--disable_ps2_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_ps2_protocol
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

View File

@@ -168,7 +168,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)
@@ -315,7 +317,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_CONST_TABLE_JOIN;
eval $CHILD2_1_SELECT_CONST_TABLE2_JOIN;

View File

@@ -156,7 +156,9 @@ if ($USE_CHILD_GROUP2)
--connection master_1
--disable_ps2_protocol
--disable_view_protocol
SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
--enable_view_protocol
if ($USE_CHILD_GROUP2)
{
@@ -168,7 +170,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

View File

@@ -156,7 +156,9 @@ if ($USE_CHILD_GROUP2)
--connection master_1
--disable_ps2_protocol
--disable_view_protocol
SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
--enable_view_protocol
if ($USE_CHILD_GROUP2)
{
@@ -168,7 +170,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

View File

@@ -183,7 +183,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

View File

@@ -183,7 +183,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

View File

@@ -183,7 +183,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

View File

@@ -156,7 +156,9 @@ if ($USE_CHILD_GROUP2)
--connection master_1
--disable_ps2_protocol
--disable_view_protocol
SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
--enable_view_protocol
if ($USE_CHILD_GROUP2)
{
@@ -168,7 +170,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

View File

@@ -183,7 +183,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

View File

@@ -183,7 +183,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

View File

@@ -183,7 +183,9 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--disable_view_protocol
eval $CHILD2_1_SELECT_ARGUMENT1;
--enable_view_protocol
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)

Some files were not shown because too many files have changed in this diff Show More