Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
db947b75
Commit
db947b75
authored
Sep 07, 2018
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.0-galera' into 10.1
parents
f95d26b4
24823068
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
570 additions
and
139 deletions
+570
-139
include/wsrep.h
include/wsrep.h
+5
-0
mysql-test/suite/galera/r/galera#505.result
mysql-test/suite/galera/r/galera#505.result
+5
-0
mysql-test/suite/galera/r/mysql-wsrep#332.result
mysql-test/suite/galera/r/mysql-wsrep#332.result
+111
-0
mysql-test/suite/galera/t/galera#505.test
mysql-test/suite/galera/t/galera#505.test
+32
-0
mysql-test/suite/galera/t/mysql-wsrep#332.test
mysql-test/suite/galera/t/mysql-wsrep#332.test
+113
-0
mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
+26
-5
mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
+32
-23
scripts/wsrep_sst_rsync.sh
scripts/wsrep_sst_rsync.sh
+9
-3
sql/events.cc
sql/events.cc
+2
-0
sql/handler.cc
sql/handler.cc
+1
-0
sql/log_event.cc
sql/log_event.cc
+0
-5
sql/sql_alter.cc
sql/sql_alter.cc
+13
-7
sql/sql_parse.cc
sql/sql_parse.cc
+2
-0
sql/sql_trigger.cc
sql/sql_trigger.cc
+5
-1
sql/wsrep_hton.cc
sql/wsrep_hton.cc
+7
-2
sql/wsrep_mysqld.cc
sql/wsrep_mysqld.cc
+198
-91
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+3
-1
sql/wsrep_var.cc
sql/wsrep_var.cc
+1
-1
support-files/CMakeLists.txt
support-files/CMakeLists.txt
+5
-0
No files found.
include/wsrep.h
View file @
db947b75
...
...
@@ -27,6 +27,11 @@
if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \
goto error;
#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) \
if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, \
table_list_, alter_info_)) \
goto error;
#define WSREP_TO_ISOLATION_END \
if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \
wsrep_to_isolation_end(thd);
...
...
mysql-test/suite/galera/r/galera#505.result
0 → 100644
View file @
db947b75
SET GLOBAL wsrep_provider_options = 'pc.weight=3';
SHOW GLOBAL VARIABLES LIKE 'wsrep_provider_options';
Variable_name Value
wsrep_provider_options pc.weight = 3
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
mysql-test/suite/galera/r/mysql-wsrep#332.result
0 → 100644
View file @
db947b75
CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER) ENGINE=INNODB;
INSERT INTO p VALUES (1, 0);
INSERT INTO p VALUES (2, 0);
INSERT INTO c VALUES (1, 1);
INSERT INTO c VALUES (2, 2);
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE p SET f1 = f1 + 100;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
ALTER TABLE c ADD FOREIGN KEY (p_id) REFERENCES p(f1);
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
COMMIT;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT * FROM p;
f1 f2
1 0
2 0
SELECT * FROM c;
f1 p_id
1 1
2 2
DROP TABLE c;
DROP TABLE p;
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id1 INTEGER, p_id2 INTEGER) ENGINE=INNODB;
INSERT INTO p1 VALUES (1, 0), (2, 0);
INSERT INTO p2 VALUES (1, 0), (2, 0);
INSERT INTO c VALUES (1, 1, 1);
INSERT INTO c VALUES (2, 2, 2);
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE p1 SET f1 = f1 + 100;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1);
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
COMMIT;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT * FROM p1;
f1 f2
1 0
2 0
SELECT * FROM p2;
f1 f2
1 0
2 0
SELECT * FROM c;
f1 p_id1 p_id2
1 1 1
2 2 2
DROP TABLE c;
DROP TABLE p1;
DROP TABLE p2;
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id1 INTEGER, p_id2 INTEGER) ENGINE=INNODB;
INSERT INTO p1 VALUES (1, 0), (2, 0);
INSERT INTO p2 VALUES (1, 0), (2, 0);
INSERT INTO c VALUES (1, 1, 1);
INSERT INTO c VALUES (2, 2, 2);
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE p2 SET f1 = f1 + 100;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1);
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
COMMIT;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT * FROM p1;
f1 f2
1 0
2 0
SELECT * FROM p2;
f1 f2
1 0
2 0
SELECT * FROM c;
f1 p_id1 p_id2
1 1 1
2 2 2
DROP TABLE c;
DROP TABLE p1;
DROP TABLE p2;
mysql-test/suite/galera/t/galera#505.test
0 → 100644
View file @
db947b75
# galera#505 - Change of pc.weight wsrep param will be correctly stored in wsrep_provider_options variable
--
source
include
/
galera_cluster
.
inc
--
disable_query_log
select
CAST
(
REGEXP_REPLACE
(
variable_value
,
'^(\\d+)\\.(\\d+)\\.(\\d+)(r\\d+)'
,
'\\3'
)
AS
UNSIGNED
)
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
LIKE
'wsrep_provider_version'
INTO
@
GALERA_VERSION
;
# Make sure that the test is operating on the right version of galera library.
--
let
$galera_version
=
24
eval
SET
@
REQUIRED_GALERA_VERSION
=
'$galera_version'
;
SELECT
@
GALERA_VERSION
,
@
REQUIRED_GALERA_VERSION
;
if
(
!
`SELECT (@GALERA_VERSION < @REQUIRED_GALERA_VERSION)`
)
{
skip
Test
requires
Galera
library
version
25.3
.
$galera_version
;
}
--
enable_query_log
--
connection
node_1
# Convert "... pc.weight = N; ..." to "N; ..."
--
let
$s1
=
`SELECT SUBSTR(@@wsrep_provider_options, LOCATE('pc.weight =', @@wsrep_provider_options) + LENGTH('pc.weight = '))`
# Convert "N; ..." to "N"
--
let
$pc_weight_value
=
`SELECT SUBSTR('$s1', 1, LOCATE(';', '$s1') - 1)`
SET
GLOBAL
wsrep_provider_options
=
'pc.weight=3'
;
--
replace_regex
/.*
(
pc
\
.
weight
=
[
0
-
9
]
+
);
.*/
\
1
/
SHOW
GLOBAL
VARIABLES
LIKE
'wsrep_provider_options'
;
--
eval
SET
GLOBAL
wsrep_provider_options
=
'pc.weight=$pc_weight_value'
mysql-test/suite/galera/t/mysql-wsrep#332.test
0 → 100644
View file @
db947b75
--
source
include
/
galera_cluster
.
inc
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_debug_sync
.
inc
--
source
suite
/
galera
/
include
/
galera_have_debug_sync
.
inc
# Open connection node_1a here, MW-369.inc will use it later
--
connect
node_1a
,
127.0
.
0.1
,
root
,
,
test
,
$NODE_MYPORT_1
#
# Test the scenario where a foreign key is added to an existing child table, and
# concurrently UPDATE the parent table so that it violates the constraint.
#
# We expect that ALTER TABLE ADD FOREIGN KEY adds a table level key on both
# parent and child table. And therefore we also expect the UPDATE to fail
# certification.
#
--
connection
node_1
CREATE
TABLE
p
(
f1
INTEGER
PRIMARY
KEY
,
f2
INTEGER
)
ENGINE
=
INNODB
;
CREATE
TABLE
c
(
f1
INTEGER
PRIMARY
KEY
,
p_id
INTEGER
)
ENGINE
=
INNODB
;
INSERT
INTO
p
VALUES
(
1
,
0
);
INSERT
INTO
p
VALUES
(
2
,
0
);
INSERT
INTO
c
VALUES
(
1
,
1
);
INSERT
INTO
c
VALUES
(
2
,
2
);
--
let
$mw_369_parent_query
=
UPDATE
p
SET
f1
=
f1
+
100
--
let
$mw_369_child_query
=
ALTER
TABLE
c
ADD
FOREIGN
KEY
(
p_id
)
REFERENCES
p
(
f1
)
--
source
MW
-
369.
inc
# Expect certification failure
--
connection
node_1
--
error
ER_LOCK_DEADLOCK
--
reap
--
connection
node_2
SELECT
*
FROM
p
;
SELECT
*
FROM
c
;
DROP
TABLE
c
;
DROP
TABLE
p
;
#
# Same as above, except that two foreign keys pointing to different parent
# tables are added, p1 and p2. Concurrently UPDATE p1.
#
# Expect certification error on UPDATE.
#
--
connection
node_1
CREATE
TABLE
p1
(
f1
INTEGER
PRIMARY
KEY
,
f2
INTEGER
)
ENGINE
=
INNODB
;
CREATE
TABLE
p2
(
f1
INTEGER
PRIMARY
KEY
,
f2
INTEGER
)
ENGINE
=
INNODB
;
CREATE
TABLE
c
(
f1
INTEGER
PRIMARY
KEY
,
p_id1
INTEGER
,
p_id2
INTEGER
)
ENGINE
=
INNODB
;
INSERT
INTO
p1
VALUES
(
1
,
0
),
(
2
,
0
);
INSERT
INTO
p2
VALUES
(
1
,
0
),
(
2
,
0
);
INSERT
INTO
c
VALUES
(
1
,
1
,
1
);
INSERT
INTO
c
VALUES
(
2
,
2
,
2
);
--
let
$mw_369_parent_query
=
UPDATE
p1
SET
f1
=
f1
+
100
--
let
$mw_369_child_query
=
ALTER
TABLE
c
ADD
FOREIGN
KEY
(
p_id1
)
REFERENCES
p1
(
f1
),
ADD
FOREIGN
KEY
(
p_id2
)
REFERENCES
p2
(
f1
)
--
source
MW
-
369.
inc
# Expect certification failure
--
connection
node_1
--
error
ER_LOCK_DEADLOCK
--
reap
--
connection
node_2
SELECT
*
FROM
p1
;
SELECT
*
FROM
p2
;
SELECT
*
FROM
c
;
DROP
TABLE
c
;
DROP
TABLE
p1
;
DROP
TABLE
p2
;
#
# Same as above, except that UPDATE is on p2.
#
--
connection
node_1
CREATE
TABLE
p1
(
f1
INTEGER
PRIMARY
KEY
,
f2
INTEGER
)
ENGINE
=
INNODB
;
CREATE
TABLE
p2
(
f1
INTEGER
PRIMARY
KEY
,
f2
INTEGER
)
ENGINE
=
INNODB
;
CREATE
TABLE
c
(
f1
INTEGER
PRIMARY
KEY
,
p_id1
INTEGER
,
p_id2
INTEGER
)
ENGINE
=
INNODB
;
INSERT
INTO
p1
VALUES
(
1
,
0
),
(
2
,
0
);
INSERT
INTO
p2
VALUES
(
1
,
0
),
(
2
,
0
);
INSERT
INTO
c
VALUES
(
1
,
1
,
1
);
INSERT
INTO
c
VALUES
(
2
,
2
,
2
);
--
let
$mw_369_parent_query
=
UPDATE
p2
SET
f1
=
f1
+
100
--
let
$mw_369_child_query
=
ALTER
TABLE
c
ADD
FOREIGN
KEY
(
p_id1
)
REFERENCES
p1
(
f1
),
ADD
FOREIGN
KEY
(
p_id2
)
REFERENCES
p2
(
f1
)
--
source
MW
-
369.
inc
# Expect certification failure
--
connection
node_1
--
error
ER_LOCK_DEADLOCK
--
reap
--
connection
node_2
SELECT
*
FROM
p1
;
SELECT
*
FROM
p2
;
SELECT
*
FROM
c
;
DROP
TABLE
c
;
DROP
TABLE
p1
;
DROP
TABLE
p2
;
mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
View file @
db947b75
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 3
SET GLOBAL wsrep_provider_options = 'pc.weight=3';
Suspending node ...
SELECT VARIABLE_VALUE = 5 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 5
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
SET SESSION wsrep_sync_wait=0;
SET SESSION wsrep_on=OFF;
SET SESSION wsrep_on=ON;
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 2
SHOW STATUS LIKE 'wsrep_cluster_weight';
Variable_name Value
SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status non-Primary
...
...
@@ -22,9 +28,13 @@ SHOW STATUS LIKE 'wsrep_local_state_comment';
Variable_name Value
wsrep_local_state_comment Initialized
SET SESSION wsrep_sync_wait=0;
SET SESSION wsrep_on=OFF;
SET SESSION wsrep_on=ON;
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 2
SHOW STATUS LIKE 'wsrep_cluster_weight';
Variable_name Value
SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status non-Primary
...
...
@@ -40,7 +50,8 @@ wsrep_local_state 0
SHOW STATUS LIKE 'wsrep_local_state_comment';
Variable_name Value
wsrep_local_state_comment Initialized
Resuming node ...
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 3
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary'
1
...
...
@@ -57,11 +68,14 @@ SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VAR
VARIABLE_VALUE = 'Synced'
1
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
SET SESSION wsrep_sync_wait=0;
SET SESSION wsrep_sync_wait=0;
SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 1
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 3
1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 3
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary'
1
...
...
@@ -80,6 +94,8 @@ VARIABLE_VALUE = 'Synced'
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 3
1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 3
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary'
1
...
...
@@ -98,6 +114,8 @@ VARIABLE_VALUE = 'Synced'
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 3
1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 3
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary'
1
...
...
@@ -116,6 +134,9 @@ VARIABLE_VALUE = 'Synced'
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1');
CALL mtr.add_suppression('overriding reported weight for');
CALL mtr.add_suppression('SYNC message from member');
CALL mtr.add_suppression('user message in state LEAVING');
CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)');
CALL mtr.add_suppression('WSREP: user message in state LEAVING');
CALL mtr.add_suppression('sending install message failed:
Transport endpoint is not connected
');
CALL mtr.add_suppression('sending install message failed:
(Transport endpoint is not connected|Socket is not connected)
');
CALL mtr.add_suppression('overriding reported weight for');
mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
View file @
db947b75
...
...
@@ -8,9 +8,12 @@
--
source
include
/
have_innodb
.
inc
--
connection
node_1
SELECT
VARIABLE_VALUE
=
3
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_weight'
;
SET
GLOBAL
wsrep_provider_options
=
'pc.weight=3'
;
--
source
include
/
galera_suspend
.
inc
--
sleep
10
SELECT
VARIABLE_VALUE
=
5
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_weight'
;
# Isolate node_1 from the cluster.
SET
GLOBAL
wsrep_provider_options
=
'gmcast.isolate=1'
;
--
connection
node_2
# Do not wait for causality as we are no longer in the primary component
...
...
@@ -22,8 +25,9 @@ SET SESSION wsrep_on=ON;
# We can not use SELECT queries here, as only SHOW is allowed to run.
# For nodes #2 and #3, we expect a non-primary component of size 2
# and cluster weight 0
SHOW
STATUS
LIKE
'wsrep_cluster_size'
;
SHOW
STATUS
LIKE
'wsrep_cluster_weight'
;
SHOW
STATUS
LIKE
'wsrep_cluster_status'
;
SHOW
STATUS
LIKE
'wsrep_connected'
;
SHOW
STATUS
LIKE
'wsrep_ready'
;
...
...
@@ -35,8 +39,13 @@ SHOW STATUS LIKE 'wsrep_local_state_comment';
--
source
include
/
galera_connect
.
inc
--
connection
node_3
SET
SESSION
wsrep_sync_wait
=
0
;
SET
SESSION
wsrep_on
=
OFF
;
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
'non-Primary'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_status'
--
source
include
/
wait_condition
.
inc
SET
SESSION
wsrep_on
=
ON
;
SHOW
STATUS
LIKE
'wsrep_cluster_size'
;
SHOW
STATUS
LIKE
'wsrep_cluster_weight'
;
SHOW
STATUS
LIKE
'wsrep_cluster_status'
;
SHOW
STATUS
LIKE
'wsrep_connected'
;
SHOW
STATUS
LIKE
'wsrep_ready'
;
...
...
@@ -44,15 +53,13 @@ SHOW STATUS LIKE 'wsrep_local_state';
SHOW
STATUS
LIKE
'wsrep_local_state_comment'
;
--
connection
node_1
--
source
include
/
galera_resume
.
inc
--
sleep
10
--
source
include
/
wait_until_connected_again
.
inc
# For Node #1, we expect a primary component of size 1
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
1
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_size'
--
source
include
/
wait_condition
.
inc
SELECT
VARIABLE_VALUE
=
3
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_weight'
;
SELECT
VARIABLE_VALUE
=
'Primary'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_status'
;
SELECT
VARIABLE_VALUE
=
'ON'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_connected'
;
SELECT
VARIABLE_VALUE
=
'ON'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_ready'
;
...
...
@@ -60,30 +67,27 @@ SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N
SELECT
VARIABLE_VALUE
=
'Synced'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_local_state_comment'
;
SET
GLOBAL
wsrep_provider_options
=
'pc.weight=1'
;
SELECT
VARIABLE_VALUE
=
1
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_weight'
;
# Restore the cluster by resetting wsrep_cluster_address on nodes #1 and #2
# Resume cluster connectivity on node_1
--
connection
node_1
SET
GLOBAL
wsrep_provider_options
=
'gmcast.isolate=0'
;
--
connection
node_2
--
disable_query_log
--
eval
SET
GLOBAL
wsrep_cluster_address
=
@@
wsrep_cluster_address
;
--
enable_query_log
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
3
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_size'
--
source
include
/
wait_condition
.
inc
SET
SESSION
wsrep_sync_wait
=
0
;
--
source
include
/
wait_
until_connected_agai
n
.
inc
--
connection
node_2
--
source
include
/
wait_
conditio
n
.
inc
--
connection
node_3
--
disable_query_log
--
eval
SET
GLOBAL
wsrep_cluster_address
=
@@
wsrep_cluster_address
;
--
enable_query_log
SET
SESSION
wsrep_sync_wait
=
0
;
--
source
include
/
wait_until_connected_again
.
inc
# On all nodes, we now expect a Primary component of size 3, Synced and ready
--
source
include
/
wait_condition
.
inc
--
connection
node_1
--
source
include
/
wait_until_connected_again
.
inc
--
source
include
/
wait_condition
.
inc
# On all nodes, we now expect a Primary component of size 3, weight 3, Synced and ready
SELECT
VARIABLE_VALUE
=
3
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_size'
;
SELECT
VARIABLE_VALUE
=
3
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_weight'
;
SELECT
VARIABLE_VALUE
=
'Primary'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_status'
;
SELECT
VARIABLE_VALUE
=
'ON'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_connected'
;
SELECT
VARIABLE_VALUE
=
'ON'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_ready'
;
...
...
@@ -92,6 +96,7 @@ SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VAR
--
connection
node_2
SELECT
VARIABLE_VALUE
=
3
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_size'
;
SELECT
VARIABLE_VALUE
=
3
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_weight'
;
SELECT
VARIABLE_VALUE
=
'Primary'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_status'
;
SELECT
VARIABLE_VALUE
=
'ON'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_connected'
;
SELECT
VARIABLE_VALUE
=
'ON'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_ready'
;
...
...
@@ -100,6 +105,7 @@ SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VAR
--
connection
node_3
SELECT
VARIABLE_VALUE
=
3
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_size'
;
SELECT
VARIABLE_VALUE
=
3
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_weight'
;
SELECT
VARIABLE_VALUE
=
'Primary'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_status'
;
SELECT
VARIABLE_VALUE
=
'ON'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_connected'
;
SELECT
VARIABLE_VALUE
=
'ON'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_ready'
;
...
...
@@ -116,8 +122,11 @@ CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1');
--
connection
node_2
CALL
mtr
.
add_suppression
(
'overriding reported weight for'
);
CALL
mtr
.
add_suppression
(
'SYNC message from member'
);
CALL
mtr
.
add_suppression
(
'user message in state LEAVING'
);
CALL
mtr
.
add_suppression
(
'sending install message failed: (Transport endpoint is not connected|Socket is not connected)'
);
--
connection
node_3
CALL
mtr
.
add_suppression
(
'WSREP: user message in state LEAVING'
);
CALL
mtr
.
add_suppression
(
'sending install message failed:
Transport endpoint is not connected
'
);
CALL
mtr
.
add_suppression
(
'sending install message failed:
(Transport endpoint is not connected|Socket is not connected)
'
);
CALL
mtr
.
add_suppression
(
'overriding reported weight for'
);
scripts/wsrep_sst_rsync.sh
View file @
db947b75
...
...
@@ -157,9 +157,15 @@ fi
# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index')
# New filter - exclude everything except dirs (schemas) and innodb files
FILTER
=(
-f
'- /lost+found'
-f
'- /.fseventsd'
-f
'- /.Trashes'
-f
'+ /wsrep_sst_binlog.tar'
-f
'- $INNODB_DATA_HOME_DIR/ib_lru_dump'
-f
'- $INNODB_DATA_HOME_DIR/ibdata*'
-f
'+ /*/'
-f
'- /*'
)
FILTER
=(
-f
'- /lost+found'
-f
'- /.fseventsd'
-f
'- /.Trashes'
-f
'+ /wsrep_sst_binlog.tar'
-f
'- $INNODB_DATA_HOME_DIR/ib_lru_dump'
-f
'- $INNODB_DATA_HOME_DIR/ibdata*'
-f
'+ /undo*'
-f
'+ /*/'
-f
'- /*'
)
SSTKEY
=
$(
parse_cnf sst tkey
""
)
SSTCERT
=
$(
parse_cnf sst tcert
""
)
...
...
sql/events.cc
View file @
db947b75
...
...
@@ -462,6 +462,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
if
(
check_access
(
thd
,
EVENT_ACL
,
parse_data
->
dbname
.
str
,
NULL
,
NULL
,
0
,
0
))
DBUG_RETURN
(
TRUE
);
WSREP_TO_ISOLATION_BEGIN
(
WSREP_MYSQL_DB
,
NULL
,
NULL
);
if
(
lock_object_name
(
thd
,
MDL_key
::
EVENT
,
...
...
@@ -591,6 +592,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
if
(
check_access
(
thd
,
EVENT_ACL
,
dbname
.
str
,
NULL
,
NULL
,
0
,
0
))
DBUG_RETURN
(
TRUE
);
WSREP_TO_ISOLATION_BEGIN
(
WSREP_MYSQL_DB
,
NULL
,
NULL
);
/*
...
...
sql/handler.cc
View file @
db947b75
...
...
@@ -4376,6 +4376,7 @@ handler::ha_create_partitioning_metadata(const char *name,
(
!
old_name
&&
strcmp
(
name
,
table_share
->
path
.
str
)));
mark_trx_read_write
();
return
create_partitioning_metadata
(
name
,
old_name
,
action_flag
);
}
...
...
sql/log_event.cc
View file @
db947b75
...
...
@@ -7912,11 +7912,6 @@ User_var_log_event(const char* buf, uint event_len,
we keep the flags set to UNDEF_F.
*/
uint
bytes_read
=
((
val
+
val_len
)
-
buf_start
);
if
(
bytes_read
>
event_len
)
{
error
=
true
;
goto
err
;
}
if
((
data_written
-
bytes_read
)
>
0
)
{
flags
=
(
uint
)
*
(
buf
+
UV_VAL_IS_NULL
+
UV_VAL_TYPE_SIZE
+
...
...
sql/sql_alter.cc
View file @
db947b75
...
...
@@ -307,12 +307,17 @@ bool Sql_cmd_alter_table::execute(THD *thd)
#ifdef WITH_WSREP
TABLE
*
find_temporary_table
(
THD
*
thd
,
const
TABLE_LIST
*
tl
);
if
((
!
thd
->
is_current_stmt_binlog_format_row
()
||
if
(
WSREP
(
thd
)
&&
(
!
thd
->
is_current_stmt_binlog_format_row
()
||
!
find_temporary_table
(
thd
,
first_table
)))
{
WSREP_TO_ISOLATION_BEGIN
(((
lex
->
name
.
str
)
?
select_lex
->
db
:
NULL
),
WSREP_TO_ISOLATION_BEGIN
_ALTER
(((
lex
->
name
.
str
)
?
select_lex
->
db
:
NULL
),
((
lex
->
name
.
str
)
?
lex
->
name
.
str
:
NULL
),
first_table
);
first_table
,
&
alter_info
);
thd
->
variables
.
auto_increment_offset
=
1
;
thd
->
variables
.
auto_increment_increment
=
1
;
}
#endif
/* WITH_WSREP */
...
...
@@ -325,11 +330,12 @@ bool Sql_cmd_alter_table::execute(THD *thd)
lex
->
ignore
);
DBUG_RETURN
(
result
);
#ifdef WITH_WSREP
error:
{
WSREP_WARN
(
"ALTER TABLE isolation failure"
);
DBUG_RETURN
(
TRUE
);
}
#endif
/* WITH_WSREP */
}
...
...
sql/sql_parse.cc
View file @
db947b75
...
...
@@ -7262,7 +7262,9 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
"WAIT_FOR wsrep_retry_autocommit_continue"
;
DBUG_ASSERT
(
!
debug_sync_set_action
(
thd
,
STRING_WITH_LEN
(
act
)));
});
WSREP_DEBUG
(
"Retry autocommit query: %s"
,
thd
->
query
());
}
mysql_parse
(
thd
,
rawbuf
,
length
,
parser_state
);
if
(
WSREP
(
thd
))
{
...
...
sql/sql_trigger.cc
View file @
db947b75
...
...
@@ -503,7 +503,11 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
if
(
err_status
)
goto
end
;
}
#ifdef WITH_WSREP
if
(
thd
->
wsrep_exec_mode
==
LOCAL_STATE
)
WSREP_TO_ISOLATION_BEGIN
(
WSREP_MYSQL_DB
,
NULL
,
NULL
);
#endif
/* We should have only one table in table list. */
DBUG_ASSERT
(
tables
->
next_global
==
0
);
...
...
sql/wsrep_hton.cc
View file @
db947b75
...
...
@@ -24,6 +24,8 @@
#include <cstdlib>
#include "debug_sync.h"
extern
handlerton
*
binlog_hton
;
extern
int
binlog_close_connection
(
handlerton
*
hton
,
THD
*
thd
);
extern
ulonglong
thd_to_trx_id
(
THD
*
thd
);
extern
"C"
int
thd_binlog_format
(
const
MYSQL_THD
thd
);
...
...
@@ -171,7 +173,10 @@ wsrep_close_connection(handlerton* hton, THD* thd)
{
DBUG_RETURN
(
0
);
}
DBUG_RETURN
(
wsrep_binlog_close_connection
(
thd
));
if
(
wsrep_emulate_bin_log
&&
thd_get_ha_data
(
thd
,
binlog_hton
)
!=
NULL
)
binlog_hton
->
close_connection
(
binlog_hton
,
thd
);
DBUG_RETURN
(
0
);
}
/*
...
...
@@ -262,7 +267,7 @@ static int wsrep_rollback(handlerton *hton, THD *thd, bool all)
}
if
((
all
||
!
thd_test_options
(
thd
,
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
&&
(
thd
->
variables
.
wsrep_on
&&
thd
->
wsrep_conflict_state
!=
MUST_REPLAY
)
)
thd
->
variables
.
wsrep_on
&&
thd
->
wsrep_conflict_state
!=
MUST_REPLAY
)
{
if
(
wsrep
&&
wsrep
->
post_rollback
(
wsrep
,
&
thd
->
wsrep_ws_handle
))
{
...
...
sql/wsrep_mysqld.cc
View file @
db947b75
...
...
@@ -627,6 +627,9 @@ int wsrep_init()
wsrep
->
provider_vendor
,
sizeof
(
provider_vendor
)
-
1
);
}
if
(
!
wsrep_data_home_dir
||
strlen
(
wsrep_data_home_dir
)
==
0
)
wsrep_data_home_dir
=
mysql_real_data_home
;
/* Initialize node address */
char
node_addr
[
512
]
=
{
0
,
};
size_t
const
node_addr_max
=
sizeof
(
node_addr
)
-
1
;
...
...
@@ -1060,8 +1063,6 @@ static bool wsrep_prepare_key_for_isolation(const char* db,
if
(
db
)
{
// sql_print_information("%s.%s", db, table);
if
(
db
)
{
key
[
*
key_len
].
ptr
=
db
;
key
[
*
key_len
].
len
=
strlen
(
db
);
++
(
*
key_len
);
...
...
@@ -1072,87 +1073,126 @@ static bool wsrep_prepare_key_for_isolation(const char* db,
++
(
*
key_len
);
}
}
}
break
;
}
default:
return
false
;
}
return
true
;
}
/* Prepare key list from db/table and table_list */
bool
wsrep_prepare_keys_for_isolation
(
THD
*
thd
,
const
char
*
db
,
static
bool
wsrep_prepare_key_for_isolation
(
const
char
*
db
,
const
char
*
table
,
const
TABLE_LIST
*
table_list
,
wsrep_key_arr_t
*
ka
)
{
ka
->
keys
=
0
;
ka
->
keys_len
=
0
;
if
(
db
||
table
)
{
if
(
!
(
ka
->
keys
=
(
wsrep_key_t
*
)
my_malloc
(
sizeof
(
wsrep_key_t
),
MYF
(
0
))))
{
WSREP_ERROR
(
"Can't allocate memory for key_array"
);
goto
err
;
}
ka
->
keys_len
=
1
;
if
(
!
(
ka
->
keys
[
0
].
key_parts
=
(
wsrep_buf_t
*
)
my_malloc
(
sizeof
(
wsrep_buf_t
)
*
2
,
MYF
(
0
))))
{
WSREP_ERROR
(
"Can't allocate memory for key_parts"
);
goto
err
;
}
ka
->
keys
[
0
].
key_parts_num
=
2
;
if
(
!
wsrep_prepare_key_for_isolation
(
db
,
table
,
(
wsrep_buf_t
*
)
ka
->
keys
[
0
].
key_parts
,
&
ka
->
keys
[
0
].
key_parts_num
))
{
WSREP_ERROR
(
"Preparing keys for isolation failed (1)"
);
goto
err
;
}
}
for
(
const
TABLE_LIST
*
table
=
table_list
;
table
;
table
=
table
->
next_global
)
{
wsrep_key_t
*
tmp
;
if
(
ka
->
keys
)
if
(
!
ka
->
keys
)
tmp
=
(
wsrep_key_t
*
)
my_malloc
((
ka
->
keys_len
+
1
)
*
sizeof
(
wsrep_key_t
),
MYF
(
0
));
else
tmp
=
(
wsrep_key_t
*
)
my_realloc
(
ka
->
keys
,
(
ka
->
keys_len
+
1
)
*
sizeof
(
wsrep_key_t
),
MYF
(
0
));
else
tmp
=
(
wsrep_key_t
*
)
my_malloc
((
ka
->
keys_len
+
1
)
*
sizeof
(
wsrep_key_t
),
MYF
(
0
));
if
(
!
tmp
)
{
WSREP_ERROR
(
"Can't allocate memory for key_array"
);
goto
err
;
return
false
;
}
ka
->
keys
=
tmp
;
if
(
!
(
ka
->
keys
[
ka
->
keys_len
].
key_parts
=
(
wsrep_buf_t
*
)
my_malloc
(
sizeof
(
wsrep_buf_t
)
*
2
,
MYF
(
0
))))
{
WSREP_ERROR
(
"Can't allocate memory for key_parts"
);
goto
err
;
return
false
;
}
ka
->
keys
[
ka
->
keys_len
].
key_parts_num
=
2
;
++
ka
->
keys_len
;
if
(
!
wsrep_prepare_key_for_isolation
(
table
->
db
,
table
->
table_nam
e
,
if
(
!
wsrep_prepare_key_for_isolation
(
db
,
tabl
e
,
(
wsrep_buf_t
*
)
ka
->
keys
[
ka
->
keys_len
-
1
].
key_parts
,
&
ka
->
keys
[
ka
->
keys_len
-
1
].
key_parts_num
))
{
WSREP_ERROR
(
"Preparing keys for isolation failed (2)"
);
WSREP_ERROR
(
"Preparing keys for isolation failed"
);
return
false
;
}
return
true
;
}
static
bool
wsrep_prepare_keys_for_alter_add_fk
(
char
*
child_table_db
,
Alter_info
*
alter_info
,
wsrep_key_arr_t
*
ka
)
{
Key
*
key
;
List_iterator
<
Key
>
key_iterator
(
alter_info
->
key_list
);
while
((
key
=
key_iterator
++
))
{
if
(
key
->
type
==
Key
::
FOREIGN_KEY
)
{
Foreign_key
*
fk_key
=
(
Foreign_key
*
)
key
;
const
char
*
db_name
=
fk_key
->
ref_db
.
str
;
const
char
*
table_name
=
fk_key
->
ref_table
.
str
;
if
(
!
db_name
)
{
db_name
=
child_table_db
;
}
if
(
!
wsrep_prepare_key_for_isolation
(
db_name
,
table_name
,
ka
))
{
return
false
;
}
}
}
return
true
;
}
static
bool
wsrep_prepare_keys_for_isolation
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table
,
const
TABLE_LIST
*
table_list
,
Alter_info
*
alter_info
,
wsrep_key_arr_t
*
ka
)
{
ka
->
keys
=
0
;
ka
->
keys_len
=
0
;
if
(
db
||
table
)
{
if
(
!
wsrep_prepare_key_for_isolation
(
db
,
table
,
ka
))
goto
err
;
}
for
(
const
TABLE_LIST
*
table
=
table_list
;
table
;
table
=
table
->
next_global
)
{
if
(
!
wsrep_prepare_key_for_isolation
(
table
->
db
,
table
->
table_name
,
ka
))
goto
err
;
}
return
0
;
if
(
alter_info
&&
(
alter_info
->
flags
&
(
Alter_info
::
ADD_FOREIGN_KEY
)))
{
if
(
!
wsrep_prepare_keys_for_alter_add_fk
(
table_list
->
db
,
alter_info
,
ka
))
goto
err
;
}
return
false
;
err:
wsrep_keys_free
(
ka
);
return
1
;
return
true
;
}
/* Prepare key list from db/table and table_list */
bool
wsrep_prepare_keys_for_isolation
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table
,
const
TABLE_LIST
*
table_list
,
wsrep_key_arr_t
*
ka
)
{
return
wsrep_prepare_keys_for_isolation
(
thd
,
db
,
table
,
table_list
,
NULL
,
ka
);
}
...
...
@@ -1368,6 +1408,67 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
return
wsrep_to_buf_helper
(
thd
,
buff
.
ptr
(),
buff
.
length
(),
buf
,
buf_len
);
}
/*
Rewrite DROP TABLE for TOI. Temporary tables are eliminated from
the query as they are visible only to client connection.
TODO: See comments for sql_base.cc:drop_temporary_table() and refine
the function to deal with transactional locked tables.
*/
static
int
wsrep_drop_table_query
(
THD
*
thd
,
uchar
**
buf
,
size_t
*
buf_len
)
{
LEX
*
lex
=
thd
->
lex
;
SELECT_LEX
*
select_lex
=
&
lex
->
select_lex
;
TABLE_LIST
*
first_table
=
select_lex
->
table_list
.
first
;
String
buff
;
DBUG_ASSERT
(
!
lex
->
create_info
.
tmp_table
());
bool
found_temp_table
=
false
;
for
(
TABLE_LIST
*
table
=
first_table
;
table
;
table
=
table
->
next_global
)
{
if
(
find_temporary_table
(
thd
,
table
->
db
,
table
->
table_name
))
{
found_temp_table
=
true
;
break
;
}
}
if
(
found_temp_table
)
{
buff
.
append
(
"DROP TABLE "
);
if
(
lex
->
check_exists
)
buff
.
append
(
"IF EXISTS "
);
for
(
TABLE_LIST
*
table
=
first_table
;
table
;
table
=
table
->
next_global
)
{
if
(
!
find_temporary_table
(
thd
,
table
->
db
,
table
->
table_name
))
{
append_identifier
(
thd
,
&
buff
,
table
->
db
,
strlen
(
table
->
db
));
buff
.
append
(
"."
);
append_identifier
(
thd
,
&
buff
,
table
->
table_name
,
strlen
(
table
->
table_name
));
buff
.
append
(
","
);
}
}
/* Chop the last comma */
buff
.
chop
();
buff
.
append
(
" /* generated by wsrep */"
);
WSREP_DEBUG
(
"Rewrote '%s' as '%s'"
,
thd
->
query
(),
buff
.
ptr
());
return
wsrep_to_buf_helper
(
thd
,
buff
.
ptr
(),
buff
.
length
(),
buf
,
buf_len
);
}
else
{
return
wsrep_to_buf_helper
(
thd
,
thd
->
query
(),
thd
->
query_length
(),
buf
,
buf_len
);
}
}
/* Forward declarations. */
static
int
wsrep_create_sp
(
THD
*
thd
,
uchar
**
buf
,
size_t
*
buf_len
);
static
int
wsrep_create_trigger_query
(
THD
*
thd
,
uchar
**
buf
,
size_t
*
buf_len
);
...
...
@@ -1476,7 +1577,8 @@ static const char* wsrep_get_query_or_msg(const THD* thd)
-1: TOI replication failed
*/
static
int
wsrep_TOI_begin
(
THD
*
thd
,
char
*
db_
,
char
*
table_
,
const
TABLE_LIST
*
table_list
)
const
TABLE_LIST
*
table_list
,
Alter_info
*
alter_info
)
{
wsrep_status_t
ret
(
WSREP_WARNING
);
uchar
*
buf
(
0
);
...
...
@@ -1511,6 +1613,9 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
case
SQLCOM_ALTER_EVENT
:
buf_err
=
wsrep_alter_event_query
(
thd
,
&
buf
,
&
buf_len
);
break
;
case
SQLCOM_DROP_TABLE
:
buf_err
=
wsrep_drop_table_query
(
thd
,
&
buf
,
&
buf_len
);
break
;
case
SQLCOM_CREATE_ROLE
:
if
(
sp_process_definer
(
thd
))
{
...
...
@@ -1526,7 +1631,8 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
wsrep_key_arr_t
key_arr
=
{
0
,
0
};
struct
wsrep_buf
buff
=
{
buf
,
buf_len
};
if
(
!
buf_err
&&
!
wsrep_prepare_keys_for_isolation
(
thd
,
db_
,
table_
,
table_list
,
&
key_arr
)
&&
!
wsrep_prepare_keys_for_isolation
(
thd
,
db_
,
table_
,
table_list
,
alter_info
,
&
key_arr
)
&&
key_arr
.
keys_len
>
0
&&
WSREP_OK
==
(
ret
=
wsrep
->
to_execute_start
(
wsrep
,
thd
->
thread_id
,
key_arr
.
keys
,
key_arr
.
keys_len
,
...
...
@@ -1669,7 +1775,8 @@ static void wsrep_RSU_end(THD *thd)
}
int
wsrep_to_isolation_begin
(
THD
*
thd
,
char
*
db_
,
char
*
table_
,
const
TABLE_LIST
*
table_list
)
const
TABLE_LIST
*
table_list
,
Alter_info
*
alter_info
)
{
int
ret
=
0
;
...
...
@@ -1725,10 +1832,10 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
{
switch
(
thd
->
variables
.
wsrep_OSU_method
)
{
case
WSREP_OSU_TOI
:
ret
=
wsrep_TOI_begin
(
thd
,
db_
,
table_
,
table_list
);
ret
=
wsrep_TOI_begin
(
thd
,
db_
,
table_
,
table_list
,
alter_info
);
break
;
case
WSREP_OSU_RSU
:
ret
=
wsrep_RSU_begin
(
thd
,
db_
,
table_
);
ret
=
wsrep_RSU_begin
(
thd
,
db_
,
table_
);
break
;
default:
WSREP_ERROR
(
"Unsupported OSU method: %lu"
,
...
...
sql/wsrep_mysqld.h
View file @
db947b75
...
...
@@ -291,8 +291,10 @@ extern PSI_mutex_key key_LOCK_wsrep_desync;
extern
PSI_file_key
key_file_wsrep_gra_log
;
#endif
/* HAVE_PSI_INTERFACE */
struct
TABLE_LIST
;
class
Alter_info
;
int
wsrep_to_isolation_begin
(
THD
*
thd
,
char
*
db_
,
char
*
table_
,
const
TABLE_LIST
*
table_list
);
const
TABLE_LIST
*
table_list
,
Alter_info
*
alter_info
=
NULL
);
void
wsrep_to_isolation_end
(
THD
*
thd
);
void
wsrep_cleanup_transaction
(
THD
*
thd
);
int
wsrep_to_buf_helper
(
...
...
sql/wsrep_var.cc
View file @
db947b75
...
...
@@ -565,7 +565,7 @@ void wsrep_node_address_init (const char* value)
static
void
wsrep_slave_count_change_update
()
{
wsrep_slave_count_change
=
(
wsrep_slave_threads
-
wsrep_prev_slave_threads
);
WSREP_DEBUG
(
"Change on slave threads: New %lu old %lu difference %
lu
"
,
WSREP_DEBUG
(
"Change on slave threads: New %lu old %lu difference %
d
"
,
wsrep_slave_threads
,
wsrep_prev_slave_threads
,
wsrep_slave_count_change
);
wsrep_prev_slave_threads
=
wsrep_slave_threads
;
}
...
...
support-files/CMakeLists.txt
View file @
db947b75
...
...
@@ -66,6 +66,11 @@ IF(UNIX)
DESTINATION
${
inst_location
}
COMPONENT Server_Scripts
)
ENDFOREACH
()
CONFIGURE_FILE
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/wsrep.cnf.sh
${
CMAKE_CURRENT_BINARY_DIR
}
/wsrep.cnf @ONLY
)
INSTALL
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/wsrep.cnf
DESTINATION
${
inst_location
}
COMPONENT SupportFiles
)
IF
(
INSTALL_SUPPORTFILESDIR
)
INSTALL
(
FILES magic DESTINATION
${
inst_location
}
COMPONENT SupportFiles
)
INSTALL
(
DIRECTORY policy DESTINATION
${
inst_location
}
COMPONENT SupportFiles
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment