Commit 3043f384 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.4 into 10.5

parents 658289ca d67ea815
......@@ -518,3 +518,29 @@ TRUNCATE t_temporary_innodb;
ALTER TABLE t_temporary_innodb ADD COLUMN col2 INT;
ALTER TABLE t_temporary_innodb ADD KEY idx(col2);
BACKUP STAGE END;
CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, f INT);
BACKUP STAGE START;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
BACKUP STAGE END;
DROP TABLE t1;
CREATE TABLE t1 (a INT);
BACKUP STAGE START;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
connect con1,localhost,root,,test;
BACKUP STAGE START;
connection default;
BACKUP STAGE END;
connection con1;
BACKUP STAGE END;
disconnect con1;
connection default;
DROP TABLE t1;
CREATE TABLE t1 (a INT);
BACKUP STAGE START;
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
BACKUP STAGE BLOCK_COMMIT;
BACKUP STAGE END;
DROP TABLE t1;
......@@ -501,3 +501,38 @@ TRUNCATE t_temporary_innodb;
ALTER TABLE t_temporary_innodb ADD COLUMN col2 INT;
ALTER TABLE t_temporary_innodb ADD KEY idx(col2);
BACKUP STAGE END;
#
# MDEV-18067, MDEV-18068 and MDEV-18069
# Server crashes with BACKUP STAGE and FLUSH TABLE table_name
#
CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, f INT);
BACKUP STAGE START;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
BACKUP STAGE END;
DROP TABLE t1;
CREATE TABLE t1 (a INT);
BACKUP STAGE START;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
--connect (con1,localhost,root,,test)
--send BACKUP STAGE START
--connection default
BACKUP STAGE END;
--connection con1
reap;
BACKUP STAGE END;
--disconnect con1
--connection default
DROP TABLE t1;
CREATE TABLE t1 (a INT);
BACKUP STAGE START;
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
BACKUP STAGE BLOCK_COMMIT;
BACKUP STAGE END;
DROP TABLE t1;
......@@ -1673,3 +1673,14 @@ with columns as (select 1 as t) select * from columns;
t
1
use test;
#
# MDEV-20730: Syntax error on SELECT INTO @variable with CTE
#
with data as (select 1 as id)
select id into @myid from data;
set @save_sql_mode = @@sql_mode;
set sql_mode="oracle";
with data as (select 1 as id)
select id into @myid from data;
set sql_mode= @save_sql_mode;
# End of 10.4 tests
......@@ -1182,3 +1182,18 @@ with t as (select 1 as t) select * from t;
with columns as (select 1 as t) select * from columns;
use test;
--echo #
--echo # MDEV-20730: Syntax error on SELECT INTO @variable with CTE
--echo #
with data as (select 1 as id)
select id into @myid from data;
set @save_sql_mode = @@sql_mode;
set sql_mode="oracle";
with data as (select 1 as id)
select id into @myid from data;
set sql_mode= @save_sql_mode;
--echo # End of 10.4 tests
connection node_2;
connection node_1;
connection node_2;
START SLAVE;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3;
CREATE TABLE t1 (f1 int, f2 int) ENGINE=InnoDB;
connection node_2;
connection node_1;
connection node_3;
DROP TABLE t1;
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
connection node_2;
connection node_1;
call mtr.add_suppression("Sending JOIN failed:.*");
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_1;
create table t1 (a int, s bigint unsigned as row start, e bigint unsigned as row end, period for system_time(s,e)) engine=InnoDB with system versioning;
......
!include ../galera_2nodes_as_slave.cnf
[mysqld.2]
slave-parallel-threads=2
slave-parallel-mode=optimistic
[mysqld.1]
wsrep-slave-threads=10
--source include/have_innodb.inc
--source include/galera_cluster.inc
--connection node_2
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3, MASTER_USE_GTID=slave_pos;
--enable_query_log
START SLAVE;
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
--let $inserts=1000
CREATE TABLE t1 (f1 int, f2 int) ENGINE=InnoDB;
--let $count=0
--disable_query_log
while($count < $inserts)
{
--eval insert into t1 values ($count,1)
--inc $count
}
--enable_query_log
--connection node_2
--let $wait_condition = SELECT COUNT(*) = $inserts FROM t1
--source include/wait_condition.inc
--connection node_1
--let $wait_condition = SELECT COUNT(*) = $inserts FROM t1
--source include/wait_condition.inc
--connection node_3
DROP TABLE t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test'
--source include/wait_condition.inc
STOP SLAVE;
RESET SLAVE ALL;
--source include/galera_cluster.inc
call mtr.add_suppression("Sending JOIN failed:.*");
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_1
......
galera_sr_table_contents : missing file
GCF-437 : test relies on InnoDB redo log size limtation
GCF-437 : test relies on InnoDB redo log size limitation
GCF-1060 : MDEV-20848 Galera test failure on galera_sr.GCF_1060
......@@ -13,26 +13,26 @@ connection node_2;
COMMIT;
connection node_2b;
SET SESSION wsrep_sync_wait = 0;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
connection node_1;
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_trx_fragment_size = 1;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
REPLACE INTO t1 VALUES (1,'y');
connection node_2b;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
connection node_2a;
SET GLOBAL wsrep_provider_options = 'signal=before_local_commit_monitor_enter';
SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_2;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) ENGINE=InnoDB;
......@@ -46,25 +46,25 @@ connection node_2;
COMMIT;
connection node_2b;
SET SESSION wsrep_sync_wait = 0;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
connection node_1;
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_trx_fragment_size = 1;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
REPLACE INTO t1 VALUES (1,'y');
connection node_2b;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
connection node_2a;
SET GLOBAL wsrep_provider_options = 'signal=before_certify_apply_monitor_enter';
SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_2;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
DROP TABLE t1;
......@@ -16,18 +16,18 @@ SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
COUNT(*) > 0
1
ALTER TABLE t1 DROP COLUMN f2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
connection node_1;
INSERT INTO t1 VALUES (6, 6);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
INSERT INTO t1 VALUES (6, 6);
ERROR 21S01: Column count doesn't match value count at row 1
START TRANSACTION;
......@@ -41,10 +41,12 @@ SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
connection node_1;
COMMIT;
connection node_2;
SELECT COUNT(*) = 5 FROM t1;
COUNT(*) = 5
1
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
COUNT(*) = 0
1
set global wsrep_sync_wait=15;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT COUNT(*) AS EXPECT_5 FROM t1;
EXPECT_5
5
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
DROP TABLE t1;
......@@ -48,6 +48,7 @@ SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
expect_0
0
connection node_2;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
set global wsrep_sync_wait=15;
SELECT COUNT(*) as expect_6 FROM t1;
expect_6
......
......@@ -13,19 +13,21 @@ Killing query ...
connection node_1;
ERROR 70100: Query execution was interrupted
connection node_2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
COUNT(*) = 0
1
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
INSERT INTO t1 SELECT 1 FROM ten AS t1, ten AS t2, ten AS t3;
SELECT COUNT(*) = 1000 FROM t1;
COUNT(*) = 1000
1
SELECT COUNT(*) AS EXPECT_1000 FROM t1;
EXPECT_1000
1000
connection node_1a;
SELECT COUNT(*) = 1000 FROM t1;
COUNT(*) = 1000
1
SET GLOBAL wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_1000 FROM t1;
EXPECT_1000
1000
DROP TABLE t1;
DROP TABLE ten;
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
......@@ -24,21 +26,21 @@ connection node_2;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
COUNT(*) > 0
1
SELECT COUNT(*) = 6 FROM t1 WHERE f1 IN (11,12,13,14,15,16);
COUNT(*) = 6
1
SELECT COUNT(*) AS EXPECT_6 FROM t1 WHERE f1 IN (11,12,13,14,15,16);
EXPECT_6
6
connection node_1b;
INSERT INTO t1 VALUES (24),(25),(26);
COMMIT;
connection node_2;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
COUNT(*) = 0
1
SELECT COUNT(*) = 12 FROM t1;
COUNT(*) = 12
1
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_12 FROM t1;
EXPECT_12
12
connection node_1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
DROP TABLE t1;
package My::Suite::Galera_sr;
use File::Basename;
use My::Find;
@ISA = qw(My::Suite);
return "Not run for embedded server" if $::opt_embedded_server;
return "WSREP is not compiled in" if not ::have_wsrep();
return "No wsrep provider library" unless ::have_wsrep_provider();
return ::wsrep_version_message() unless ::check_wsrep_version();
push @::global_suppressions,
(
qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1),
qr(WSREP: Could not open saved state file for reading: .*),
qr(WSREP: Could not open state file for reading: .*),
qr(WSREP: Gap in state sequence. Need state transfer.),
qr(WSREP: Failed to prepare for incremental state transfer:),
qr(WSREP:.*down context.*),
qr(WSREP: Failed to send state UUID:),
qr(WSREP: last inactive check more than .* skipping check),
qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.),
qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
qr(WSREP: Quorum: No node with complete state),
qr(WSREP: Initial position was provided by configuration or SST, avoiding override),
qr|WSREP: discarding established \(time wait\) .*|,
qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.),
qr(WSREP: evs::proto.*),
qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|,
qr(WSREP: no nodes coming from prim view, prim not possible),
qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable),
qr(WSREP: user message in state LEAVING),
qr(WSREP: .* sending install message failed: Transport endpoint is not connected),
qr(WSREP: .* sending install message failed: Resource temporarily unavailable),
qr(WSREP: Maximum writeset size exceeded by .*),
qr(WSREP: transaction size exceeded.*),
qr(WSREP: RBR event .*),
qr(WSREP: Ignoring error for TO isolated action: .*),
qr(WSREP: transaction size limit .*),
qr(WSREP: rbr write fail, .*),
qr(WSREP: .*Backend not supported: foo.*),
qr(WSREP: .*Failed to initialize backend using .*),
qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*),
qr(WSREP: gcs connect failed: Socket type not supported),
qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*),
qr(WSREP: .*Failed to open backend connection: -110 .*),
qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*),
qr(WSREP: gcs connect failed: Connection timed out),
qr|WSREP: wsrep::connect\(.*\) failed: 7|,
qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.),
qr(WSREP: Could not find peer:),
qr(WSREP: TO isolation failed for: .*),
qr|WSREP: gcs_caused\(\) returned .*|,
qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|,
qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|,
qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|,
qr(WSREP: Action message in non-primary configuration from member [0-9]*),
qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*),
qr(WSREP: discarding established .*),
qr|WSREP: .*core_handle_uuid_msg.*|,
qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on),
qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|,
qr|Query apply failed:*|,
qr(WSREP: Ignoring error*),
qr(WSREP: Failed to remove page file .*),
qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*),
);
bless { };
......@@ -14,16 +14,16 @@ INSERT INTO t1 VALUES (1, 'x');
--connection node_2b
--sleep 1
SET SESSION wsrep_sync_wait = 0;
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) AS EXPECT_0 FROM t1;
--connection node_1
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_trx_fragment_size = 1;
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) AS EXPECT_1 FROM t1;
REPLACE INTO t1 VALUES (1,'y');
--connection node_2b
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) AS EXPECT_0 FROM t1;
--connection node_2a
--source include/galera_signal_sync_point.inc
......@@ -31,6 +31,8 @@ SELECT COUNT(*) = 0 FROM t1;
--connection node_2
--reap
SELECT COUNT(*) = 1 FROM t1;
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;
......@@ -27,15 +27,15 @@ SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
ALTER TABLE t1 DROP COLUMN f2;
# SR applied before the DDL is no longer visible
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_0 FROM t1;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
--connection node_1
# Transaction can not continue due to DDL, implicit ROLLBACK
--error ER_LOCK_DEADLOCK
INSERT INTO t1 VALUES (6, 6);
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
# DDL is now in effect
--error ER_WRONG_VALUE_COUNT_ON_ROW
......@@ -52,14 +52,16 @@ INSERT INTO t1 VALUES (5);
--connection node_2
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
--source include/wait_condition.inc
--connection node_1
COMMIT;
--connection node_2
SELECT COUNT(*) = 5 FROM t1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
set global wsrep_sync_wait=15;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT COUNT(*) AS EXPECT_5 FROM t1;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
DROP TABLE t1;
......@@ -59,9 +59,15 @@ SELECT * FROM t1;
SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
--connection node_2
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
set global wsrep_sync_wait=15;
--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) as expect_6 FROM t1;
SELECT * FROM t1;
--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
--source include/wait_condition.inc
SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
DROP TABLE t1;
......@@ -33,16 +33,18 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
# Confirm that the kill caused the updates made so far to be removed
--connection node_2
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT COUNT(*) AS EXPECT_0 FROM t1;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
# Confirm that the transaction can be reissued in its entirety on the slave without a conflict
INSERT INTO t1 SELECT 1 FROM ten AS t1, ten AS t2, ten AS t3;
SELECT COUNT(*) = 1000 FROM t1;
SELECT COUNT(*) AS EXPECT_1000 FROM t1;
--connection node_1a
SELECT COUNT(*) = 1000 FROM t1;
SET GLOBAL wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_1000 FROM t1;
DROP TABLE t1;
DROP TABLE ten;
......@@ -4,6 +4,11 @@
--source include/galera_cluster.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source ../galera/include/auto_increment_offset_save.inc
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB;
......@@ -32,6 +37,7 @@ INSERT INTO t1 VALUES (21),(22),(23);
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
# Commit one transaction while the slave is down
--connection node_1a
......@@ -44,7 +50,7 @@ COMMIT;
# Confirm SR table on slave has entries
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) = 6 FROM t1 WHERE f1 IN (11,12,13,14,15,16);
SELECT COUNT(*) AS EXPECT_6 FROM t1 WHERE f1 IN (11,12,13,14,15,16);
# Commit the second transaction on master after the slave has rejoined
--connection node_1b
......@@ -53,11 +59,14 @@ COMMIT;
# Confirm that SR table on slave is empty
--connection node_2
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) = 12 FROM t1;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_12 FROM t1;
# SR table on master should be empty too
--connection node_1
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
DROP TABLE t1;
# Restore original auto_increment_offset values.
--source ../galera/include/auto_increment_offset_restore.inc
......@@ -169,6 +169,8 @@ ALTER TABLE t1 IMPORT TABLESPACE;
INSERT INTO t1 VALUES(2);
SELECT * FROM t1;
--error 0,1231
SET GLOBAL innodb_compression_algorithm=3;
FLUSH TABLE t1 FOR EXPORT;
--echo # List before copying files
......
......@@ -3166,14 +3166,19 @@ void MDL_context::set_transaction_duration_for_all_locks()
DBUG_ASSERT(m_tickets[MDL_STATEMENT].is_empty());
m_tickets[MDL_TRANSACTION].swap(m_tickets[MDL_EXPLICIT]);
/* Don't swap locks if this thread is running backup stages */
if (current_thd->current_backup_stage == BACKUP_FINISHED)
m_tickets[MDL_TRANSACTION].swap(m_tickets[MDL_EXPLICIT]);
Ticket_iterator it_ticket(m_tickets[MDL_EXPLICIT]);
while ((ticket= it_ticket++))
{
m_tickets[MDL_EXPLICIT].remove(ticket);
m_tickets[MDL_TRANSACTION].push_front(ticket);
if (ticket->get_key()->mdl_namespace() != MDL_key::BACKUP)
{
m_tickets[MDL_EXPLICIT].remove(ticket);
m_tickets[MDL_TRANSACTION].push_front(ticket);
}
}
#ifndef DBUG_OFF
......
......@@ -4,6 +4,10 @@
#include "rpl_mi.h"
#include "sql_parse.h"
#include "debug_sync.h"
#include "wsrep_mysqld.h"
#ifdef WITH_WSREP
#include "wsrep_trans_observer.h"
#endif
/*
Code for optional parallel execution of replicated events on the slave.
......@@ -35,6 +39,13 @@ rpt_handle_event(rpl_parallel_thread::queued_event *qev,
DBUG_ASSERT(qev->typ == rpl_parallel_thread::queued_event::QUEUED_EVENT);
ev= qev->ev;
#ifdef WITH_WSREP
if (wsrep_before_statement(thd))
{
WSREP_WARN("Parallel slave failed at wsrep_before_statement() hook");
return(1);
}
#endif /* WITH_WSREP */
thd->system_thread_info.rpl_sql_info->rpl_filter = rli->mi->rpl_filter;
ev->thd= thd;
......@@ -50,6 +61,13 @@ rpt_handle_event(rpl_parallel_thread::queued_event *qev,
err= apply_event_and_update_pos_for_parallel(ev, thd, rgi);
thread_safe_increment64(&rli->executed_entries);
#ifdef WITH_WSREP
if (wsrep_after_statement(thd))
{
WSREP_WARN("Parallel slave failed at wsrep_after_statement() hook");
err= 1;
}
#endif /* WITH_WSREP */
/* ToDo: error handling. */
return err;
}
......@@ -1066,6 +1084,14 @@ handle_rpl_parallel_thread(void *arg)
mysql_cond_signal(&rpt->COND_rpl_thread);
thd->set_command(COM_SLAVE_WORKER);
#ifdef WITH_WSREP
wsrep_open(thd);
if (wsrep_before_command(thd))
{
WSREP_WARN("Parallel slave failed at wsrep_before_command() hook");
rpt->stop = true;
}
#endif /* WITH_WSREP */
while (!rpt->stop)
{
uint wait_count= 0;
......@@ -1436,6 +1462,11 @@ handle_rpl_parallel_thread(void *arg)
rpt->pool->release_thread(rpt);
}
}
#ifdef WITH_WSREP
wsrep_after_command_before_result(thd);
wsrep_after_command_after_result(thd);
wsrep_close(thd);
#endif /* WITH_WSREP */
rpt->thd= NULL;
mysql_mutex_unlock(&rpt->LOCK_rpl_thread);
......
......@@ -9243,6 +9243,24 @@ select_into:
if (Lex->select_finalize(unit))
MYSQL_YYABORT;
}
| with_clause
select_into_query_specification
{
if (Lex->push_select($2))
MYSQL_YYABORT;
}
opt_order_limit_lock
{
SELECT_LEX_UNIT *unit;
if (!(unit = Lex->create_unit($2)))
MYSQL_YYABORT;
if ($4)
unit= Lex->add_tail_to_query_expression_body(unit, $4);
unit->set_with_clause($1);
$1->attach_to($2);
if (Lex->select_finalize(unit))
MYSQL_YYABORT;
}
;
simple_table:
......
......@@ -9334,6 +9334,24 @@ select_into:
if (Lex->select_finalize(unit))
MYSQL_YYABORT;
}
| with_clause
select_into_query_specification
{
if (Lex->push_select($2))
MYSQL_YYABORT;
}
opt_order_limit_lock
{
SELECT_LEX_UNIT *unit;
if (!(unit = Lex->create_unit($2)))
MYSQL_YYABORT;
if ($4)
unit= Lex->add_tail_to_query_expression_body(unit, $4);
unit->set_with_clause($1);
$1->attach_to($2);
if (Lex->select_finalize(unit))
MYSQL_YYABORT;
}
;
......
......@@ -380,7 +380,7 @@ log_refresh_stats(void);
#define LOG_BLOCK_KEY 4 /* encryption key version
before LOG_BLOCK_CHECKSUM;
in LOG_HEADER_FORMAT_ENC_10_4 only */
in log_t::FORMAT_ENC_10_4 only */
#define LOG_BLOCK_CHECKSUM 4 /* 4 byte checksum of the log block
contents; in InnoDB versions
< 3.23.52 this did not contain the
......@@ -436,23 +436,6 @@ or the MySQL version that created the redo log file. */
IB_TO_STR(MYSQL_VERSION_MINOR) "." \
IB_TO_STR(MYSQL_VERSION_PATCH)
/** The original (not version-tagged) InnoDB redo log format */
#define LOG_HEADER_FORMAT_3_23 0
/** The MySQL 5.7.9/MariaDB 10.2.2 log format */
#define LOG_HEADER_FORMAT_10_2 1
/** The MariaDB 10.3.2 log format.
To prevent crash-downgrade to earlier 10.2 due to the inability to
roll back a retroactively introduced TRX_UNDO_RENAME_TABLE undo log record,
MariaDB 10.2.18 and later will use the 10.3 format, but LOG_HEADER_SUBFORMAT
1 instead of 0. MariaDB 10.3 will use subformat 0 (5.7-style TRUNCATE) or 2
(MDEV-13564 backup-friendly TRUNCATE). */
#define LOG_HEADER_FORMAT_10_3 103
#define LOG_HEADER_FORMAT_10_4 104
/** The MariaDB 10.4.0 log format (only with innodb_encrypt_log=ON) */
#define LOG_HEADER_FORMAT_ENC_10_4 (104U | 1U << 31)
/** Encrypted MariaDB redo log */
#define LOG_HEADER_FORMAT_ENCRYPTED (1U<<31)
/* @} */
#define LOG_CHECKPOINT_1 OS_FILE_LOG_BLOCK_SIZE
......@@ -477,6 +460,24 @@ typedef ib_mutex_t FlushOrderMutex;
/** Redo log buffer */
struct log_t{
/** The original (not version-tagged) InnoDB redo log format */
static constexpr uint32_t FORMAT_3_23 = 0;
/** The MySQL 5.7.9/MariaDB 10.2.2 log format */
static constexpr uint32_t FORMAT_10_2 = 1;
/** The MariaDB 10.3.2 log format.
To prevent crash-downgrade to earlier 10.2 due to the inability to
roll back a retroactively introduced TRX_UNDO_RENAME_TABLE undo log record,
MariaDB 10.2.18 and later will use the 10.3 format, but LOG_HEADER_SUBFORMAT
1 instead of 0. MariaDB 10.3 will use subformat 0 (5.7-style TRUNCATE) or 2
(MDEV-13564 backup-friendly TRUNCATE). */
static constexpr uint32_t FORMAT_10_3 = 103;
/** The MariaDB 10.4.0 log format. */
static constexpr uint32_t FORMAT_10_4 = 104;
/** Encrypted MariaDB redo log */
static constexpr uint32_t FORMAT_ENCRYPTED = 1U << 31;
/** The MariaDB 10.4.0 log format (only with innodb_encrypt_log=ON) */
static constexpr uint32_t FORMAT_ENC_10_4 = FORMAT_10_4 | FORMAT_ENCRYPTED;
MY_ALIGNED(CACHE_LINE_SIZE)
lsn_t lsn; /*!< log sequence number */
ulong buf_free; /*!< first free offset within the log
......@@ -525,7 +526,7 @@ struct log_t{
struct files {
/** number of files */
ulint n_files;
/** format of the redo log: e.g., LOG_HEADER_FORMAT_10_4 */
/** format of the redo log: e.g., FORMAT_10_4 */
uint32_t format;
/** redo log subformat: 0 with separately logged TRUNCATE,
2 with fully redo-logged TRUNCATE (1 in MariaDB 10.2) */
......@@ -543,7 +544,7 @@ struct log_t{
lsn_t scanned_lsn;
/** @return whether the redo log is encrypted */
bool is_encrypted() const { return format & LOG_HEADER_FORMAT_ENCRYPTED; }
bool is_encrypted() const { return format & FORMAT_ENCRYPTED; }
/** @return capacity in bytes */
lsn_t capacity() const{ return (file_size - LOG_FILE_HDR_SIZE) * n_files; }
/** Calculate the offset of a log sequence number.
......@@ -686,14 +687,14 @@ struct log_t{
/** @return the log block header + trailer size */
unsigned framing_size() const
{
return log.format == LOG_HEADER_FORMAT_ENC_10_4
return log.format == FORMAT_ENC_10_4
? LOG_BLOCK_HDR_SIZE + LOG_BLOCK_KEY + LOG_BLOCK_CHECKSUM
: LOG_BLOCK_HDR_SIZE + LOG_BLOCK_CHECKSUM;
}
/** @return the log block payload size */
unsigned payload_size() const
{
return log.format == LOG_HEADER_FORMAT_ENC_10_4
return log.format == FORMAT_ENC_10_4
? OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE - LOG_BLOCK_CHECKSUM -
LOG_BLOCK_KEY
: OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE - LOG_BLOCK_CHECKSUM;
......@@ -701,7 +702,7 @@ struct log_t{
/** @return the log block trailer offset */
unsigned trailer_offset() const
{
return log.format == LOG_HEADER_FORMAT_ENC_10_4
return log.format == FORMAT_ENC_10_4
? OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_CHECKSUM - LOG_BLOCK_KEY
: OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_CHECKSUM;
}
......
......@@ -173,10 +173,10 @@ bool log_crypt(byte* buf, lsn_t lsn, ulint size, log_crypt_t op)
byte* key_ver = &buf[OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_KEY
- LOG_BLOCK_CHECKSUM];
const uint dst_size
= log_sys.log.format == LOG_HEADER_FORMAT_ENC_10_4
= log_sys.log.format == log_t::FORMAT_ENC_10_4
? sizeof dst - LOG_BLOCK_KEY
: sizeof dst;
if (log_sys.log.format == LOG_HEADER_FORMAT_ENC_10_4) {
if (log_sys.log.format == log_t::FORMAT_ENC_10_4) {
const uint key_version = info.key_version;
switch (op) {
case LOG_ENCRYPT_ROTATE_KEY:
......
......@@ -595,8 +595,7 @@ void log_t::files::create(ulint n_files)
ut_ad(log_sys.is_initialised());
this->n_files= n_files;
format= srv_encrypt_log
? LOG_HEADER_FORMAT_ENC_10_4 : LOG_HEADER_FORMAT_10_4;
format= srv_encrypt_log ? log_t::FORMAT_ENC_10_4 : log_t::FORMAT_10_4;
subformat= 2;
file_size= srv_log_file_size;
lsn= LOG_START_LSN;
......@@ -624,8 +623,8 @@ log_file_header_flush(
ut_ad(log_write_mutex_own());
ut_ad(!recv_no_log_write);
ut_a(nth_file < log_sys.log.n_files);
ut_ad(log_sys.log.format == LOG_HEADER_FORMAT_10_4
|| log_sys.log.format == LOG_HEADER_FORMAT_ENC_10_4);
ut_ad(log_sys.log.format == log_t::FORMAT_10_4
|| log_sys.log.format == log_t::FORMAT_ENC_10_4);
// man 2 open suggests this buffer to be aligned by 512 for O_DIRECT
MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE)
......
......@@ -1157,10 +1157,10 @@ recv_find_max_checkpoint(ulint* max_field)
/* Check the header page checksum. There was no
checksum in the first redo log format (version 0). */
log_sys.log.format = mach_read_from_4(buf + LOG_HEADER_FORMAT);
log_sys.log.subformat = log_sys.log.format != LOG_HEADER_FORMAT_3_23
log_sys.log.subformat = log_sys.log.format != log_t::FORMAT_3_23
? mach_read_from_4(buf + LOG_HEADER_SUBFORMAT)
: 0;
if (log_sys.log.format != LOG_HEADER_FORMAT_3_23
if (log_sys.log.format != log_t::FORMAT_3_23
&& !recv_check_log_header_checksum(buf)) {
ib::error() << "Invalid redo log header checksum.";
return(DB_CORRUPTION);
......@@ -1173,14 +1173,14 @@ recv_find_max_checkpoint(ulint* max_field)
creator[LOG_HEADER_CREATOR_END - LOG_HEADER_CREATOR] = 0;
switch (log_sys.log.format) {
case LOG_HEADER_FORMAT_3_23:
case log_t::FORMAT_3_23:
return(recv_find_max_checkpoint_0(max_field));
case LOG_HEADER_FORMAT_10_2:
case LOG_HEADER_FORMAT_10_2 | LOG_HEADER_FORMAT_ENCRYPTED:
case LOG_HEADER_FORMAT_10_3:
case LOG_HEADER_FORMAT_10_3 | LOG_HEADER_FORMAT_ENCRYPTED:
case LOG_HEADER_FORMAT_10_4:
case LOG_HEADER_FORMAT_10_4 | LOG_HEADER_FORMAT_ENCRYPTED:
case log_t::FORMAT_10_2:
case log_t::FORMAT_10_2 | log_t::FORMAT_ENCRYPTED:
case log_t::FORMAT_10_3:
case log_t::FORMAT_10_3 | log_t::FORMAT_ENCRYPTED:
case log_t::FORMAT_10_4:
case log_t::FORMAT_10_4 | log_t::FORMAT_ENCRYPTED:
break;
default:
ib::error() << "Unsupported redo log format."
......@@ -2180,9 +2180,8 @@ void recv_apply_hashed_log_recs(bool last_batch)
The check is too broad, causing all
tables whose names start with FTS_ to
skip the optimization. */
if ((log_sys.log.format
& ~LOG_HEADER_FORMAT_ENCRYPTED)
!= LOG_HEADER_FORMAT_10_4
if ((log_sys.log.format & ~log_t::FORMAT_ENCRYPTED)
!= log_t::FORMAT_10_4
&& strstr(space->name, "/FTS_")) {
goto do_read;
}
......
......@@ -1223,8 +1223,8 @@ srv_prepare_to_delete_redo_log_files(
{
ib::info info;
if (srv_log_file_size == 0
|| (log_sys.log.format & ~LOG_HEADER_FORMAT_ENCRYPTED)
!= LOG_HEADER_FORMAT_10_4) {
|| (log_sys.log.format & ~log_t::FORMAT_ENCRYPTED)
!= log_t::FORMAT_10_4) {
info << "Upgrading redo log: ";
} else if (n_files != srv_n_log_files
|| srv_log_file_size
......@@ -2045,8 +2045,8 @@ dberr_t srv_start(bool create_new_db)
&& srv_n_log_files_found == srv_n_log_files
&& log_sys.log.format
== (srv_encrypt_log
? LOG_HEADER_FORMAT_ENC_10_4
: LOG_HEADER_FORMAT_10_4)
? log_t::FORMAT_ENC_10_4
: log_t::FORMAT_10_4)
&& log_sys.log.subformat == 2) {
/* No need to add or remove encryption,
upgrade, downgrade, or resize. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment