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
3fee1b44
Commit
3fee1b44
authored
Aug 15, 2023
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.5 into 10.6
parents
fc78b253
599c4d9a
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
944 additions
and
52 deletions
+944
-52
include/my_sys.h
include/my_sys.h
+0
-1
mysql-test/main/column_compression.result
mysql-test/main/column_compression.result
+245
-2
mysql-test/main/column_compression.test
mysql-test/main/column_compression.test
+183
-2
mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
+6
-3
mysql-test/suite/galera/r/galera_restart_replica.result
mysql-test/suite/galera/r/galera_restart_replica.result
+122
-0
mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf
mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf
+1
-0
mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test
mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test
+9
-3
mysql-test/suite/galera/t/galera_restart_replica.cnf
mysql-test/suite/galera/t/galera_restart_replica.cnf
+20
-0
mysql-test/suite/galera/t/galera_restart_replica.test
mysql-test/suite/galera/t/galera_restart_replica.test
+212
-0
mysql-test/suite/rpl/t/rpl_parallel_optimistic_until.test
mysql-test/suite/rpl/t/rpl_parallel_optimistic_until.test
+22
-1
mysys/my_sync.c
mysys/my_sync.c
+2
-16
sql/backup.cc
sql/backup.cc
+1
-2
sql/field_conv.cc
sql/field_conv.cc
+49
-0
sql/log.cc
sql/log.cc
+8
-8
sql/rpl_gtid.cc
sql/rpl_gtid.cc
+28
-5
sql/slave.cc
sql/slave.cc
+2
-0
sql/wsrep_mysqld.cc
sql/wsrep_mysqld.cc
+25
-1
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+3
-1
sql/wsrep_priv.h
sql/wsrep_priv.h
+1
-3
sql/wsrep_server_service.cc
sql/wsrep_server_service.cc
+4
-3
wsrep-lib
wsrep-lib
+1
-1
No files found.
include/my_sys.h
View file @
3fee1b44
...
...
@@ -90,7 +90,6 @@ C_MODE_START
#define MY_THREADSAFE 2048U
/* my_seek(): lock fd mutex */
#define MY_SYNC 4096U
/* my_copy(): sync dst file */
#define MY_SYNC_DIR 32768U
/* my_create/delete/rename: sync directory */
#define MY_SYNC_FILESIZE 65536U
/* my_sync(): safe sync when file is extended */
#define MY_THREAD_SPECIFIC 0x10000U
/* my_malloc(): thread specific */
/* Tree that should delete things automatically */
#define MY_TREE_WITH_DELETE 0x40000U
...
...
mysql-test/main/column_compression.result
View file @
3fee1b44
This diff is collapsed.
Click to expand it.
mysql-test/main/column_compression.test
View file @
3fee1b44
...
...
@@ -267,13 +267,194 @@ INSERT INTO t1 VALUES('aa');
SET
column_compression_threshold
=
DEFAULT
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# End of 10.3 tests
--
echo
# MDEV-31724 Compressed varchar values lost on joins when sorting on columns from joined table(s)
--
echo
#
CREATE
TABLE
t1
(
id
int
(
10
)
unsigned
not
null
,
txt
varchar
(
5000
)
COMPRESSED
NOT
NULL
DEFAULT
''
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb3
COLLATE
=
utf8mb3_bin
;
CREATE
TABLE
t2
(
id
int
(
10
)
unsigned
not
null
,
n1
bigint
(
20
)
NOT
NULL
,
n2
bigint
(
20
)
NOT
NULL
,
n3
bigint
(
20
)
NOT
NULL
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb3
COLLATE
=
utf8mb3_bin
;
INSERT
INTO
t1
VALUES
(
1
,
'short string < 100 chars'
),
(
2
,
'long string = 99 chars '
),
(
3
,
'long string = 100 chars !'
),
(
4
,
'long string = 101 chars !'
);
INSERT
INTO
t2
VALUES
(
1
,
24
,
1
,
1
),
(
2
,
99
,
2
,
2
),
(
3
,
100
,
3
,
3
),
(
4
,
101
,
4
,
4
);
SELECT
txt
,
v
.*
FROM
t1
LEFT
JOIN
t2
v
ON
t1
.
id
=
v
.
id
;
SELECT
txt
,
v
.*
FROM
t1
LEFT
JOIN
t2
v
ON
t1
.
id
=
v
.
id
ORDER
BY
v
.
n1
;
SELECT
txt
,
v
.*
FROM
t1
JOIN
t2
v
ON
t1
.
id
=
v
.
id
;
SELECT
txt
,
v
.*
FROM
t1
JOIN
t2
v
ON
t1
.
id
=
v
.
id
ORDER
BY
v
.
n1
;
DROP
TABLE
t1
,
t2
;
CREATE
OR
REPLACE
TABLE
t1
(
id
INT
NOT
NULL
PRIMARY
KEY
,
txt
varchar
(
5000
)
COMPRESSED
NOT
NULL
DEFAULT
''
)
CHARSET
=
utf8mb3
;
INSERT
INTO
t1
VALUES
(
1
,
REPEAT
(
'a'
,
10
)),
(
2
,
REPEAT
(
'b'
,
99
)),
(
3
,
REPEAT
(
'c'
,
100
)),
(
4
,
REPEAT
(
'd'
,
121
));
--
replace_column
2
<
sysdate
>
--
sorted_result
SELECT
txt
,
sysdate
(
6
)
FROM
t1
ORDER
BY
2
;
DROP
TABLE
t1
;
DELIMITER
$$
;
CREATE
FUNCTION
f1
(
imax
INT
,
jmax
INT
)
RETURNS
TEXT
BEGIN
DECLARE
res
TEXT
DEFAULT
'x'
;
FOR
i
IN
0.
.
imax
DO
FOR
j
IN
0.
.
jmax
DO
SET
res
=
CONCAT
(
res
,
' '
,
i
,
' '
,
j
);
END
FOR
;
END
FOR
;
RETURN
res
;
END
;
$$
DELIMITER
;
$$
# Let's override the default threshold (100) to force
# comression for VARCHAR1+MB, for example, for:
# VARCHAR(80) CHARACTER SET utf8mb3
SET
@@
column_compression_threshold
=
32
;
--
echo
# VARCHAR1, 8bit, truncation
CREATE
TABLE
t1
(
a
VARCHAR
(
254
)
COMPRESSED
CHARACTER
SET
latin1
);
INSERT
INTO
t1
VALUES
(
f1
(
6
,
6
));
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
FLUSH
STATUS
;
ALTER
IGNORE
TABLE
t1
MODIFY
a
VARCHAR
(
4
)
COMPRESSED
CHARACTER
SET
latin1
;
SHOW
STATUS
LIKE
'Column%compressions'
;
SELECT
LENGTH
(
a
),
a
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
VARCHAR
(
254
)
COMPRESSED
CHARACTER
SET
latin1
);
INSERT
INTO
t1
VALUES
(
REPEAT
(
'a'
,
254
));
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
FLUSH
STATUS
;
ALTER
IGNORE
TABLE
t1
MODIFY
a
VARCHAR
(
4
)
COMPRESSED
CHARACTER
SET
latin1
;
SHOW
STATUS
LIKE
'Column%compressions'
;
SELECT
LENGTH
(
a
),
a
FROM
t1
;
DROP
TABLE
t1
;
--
echo
# VARCHAR1, 8bit, no truncation
CREATE
TABLE
t1
(
a
VARCHAR
(
250
)
COMPRESSED
CHARACTER
SET
latin1
);
INSERT
INTO
t1
VALUES
(
f1
(
6
,
6
));
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
FLUSH
STATUS
;
ALTER
IGNORE
TABLE
t1
MODIFY
a
VARCHAR
(
254
)
COMPRESSED
CHARACTER
SET
latin1
;
SHOW
STATUS
LIKE
'Column%compressions'
;
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
DROP
TABLE
t1
;
--
echo
# VARCHAR2, 8bit, truncation
CREATE
TABLE
t1
(
a
VARCHAR
(
32000
)
COMPRESSED
CHARACTER
SET
latin1
);
INSERT
INTO
t1
VALUES
(
f1
(
31
,
31
));
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
FLUSH
STATUS
;
ALTER
IGNORE
TABLE
t1
MODIFY
a
VARCHAR
(
256
)
COMPRESSED
CHARACTER
SET
latin1
;
SHOW
STATUS
LIKE
'Column%compressions'
;
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
DROP
TABLE
t1
;
--
echo
# VARCHAR2, 8bit, no truncation
CREATE
TABLE
t1
(
a
VARCHAR
(
32000
)
COMPRESSED
CHARACTER
SET
latin1
);
INSERT
INTO
t1
VALUES
(
f1
(
31
,
31
));
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
FLUSH
STATUS
;
ALTER
IGNORE
TABLE
t1
MODIFY
a
VARCHAR
(
32001
)
COMPRESSED
CHARACTER
SET
latin1
;
SHOW
STATUS
LIKE
'Column%compressions'
;
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
DROP
TABLE
t1
;
--
echo
# VARCHAR1, multi-byte, truncation
CREATE
TABLE
t1
(
a
VARCHAR
(
80
)
COMPRESSED
CHARACTER
SET
utf8mb3
);
INSERT
INTO
t1
VALUES
(
f1
(
3
,
3
));
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
FLUSH
STATUS
;
ALTER
IGNORE
TABLE
t1
MODIFY
a
VARCHAR
(
1
)
COMPRESSED
CHARACTER
SET
utf8mb3
;
SHOW
STATUS
LIKE
'Column%compressions'
;
SELECT
LENGTH
(
a
),
a
FROM
t1
;
DROP
TABLE
t1
;
--
echo
# VARCHAR1, multi-byte, no truncation
CREATE
TABLE
t1
(
a
VARCHAR
(
80
)
COMPRESSED
CHARACTER
SET
utf8mb3
);
INSERT
INTO
t1
VALUES
(
f1
(
3
,
3
));
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
FLUSH
STATUS
;
ALTER
IGNORE
TABLE
t1
MODIFY
a
VARCHAR
(
81
)
COMPRESSED
CHARACTER
SET
utf8mb3
;
SHOW
STATUS
LIKE
'Column%compressions'
;
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
DROP
TABLE
t1
;
--
echo
# VARCHAR2, multi-byte, truncation
CREATE
TABLE
t1
(
a
VARCHAR
(
10000
)
COMPRESSED
CHARACTER
SET
utf8mb3
);
INSERT
INTO
t1
VALUES
(
f1
(
31
,
31
));
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
FLUSH
STATUS
;
ALTER
IGNORE
TABLE
t1
MODIFY
a
VARCHAR
(
256
)
COMPRESSED
CHARACTER
SET
utf8mb3
;
SHOW
STATUS
LIKE
'Column%compressions'
;
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
DROP
TABLE
t1
;
--
echo
# VARCHAR2, multi-byte, no truncation
CREATE
TABLE
t1
(
a
VARCHAR
(
10000
)
COMPRESSED
CHARACTER
SET
utf8mb3
);
INSERT
INTO
t1
VALUES
(
f1
(
31
,
31
));
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
FLUSH
STATUS
;
ALTER
IGNORE
TABLE
t1
MODIFY
a
VARCHAR
(
10001
)
COMPRESSED
CHARACTER
SET
utf8mb3
;
SHOW
STATUS
LIKE
'Column%compressions'
;
SELECT
LENGTH
(
a
),
LEFT
(
a
,
30
),
RIGHT
(
a
,
30
)
FROM
t1
;
DROP
TABLE
t1
;
SET
@@
column_compression_threshold
=
DEFAULT
;
DROP
FUNCTION
f1
;
--
echo
#
--
echo
# MDEV-24797 Column Compression - ERROR 1265 (01000): Data truncated for column
--
echo
#
CREATE
TABLE
t1
(
a
VARCHAR
(
500
)
COMPRESSED
CHARACTER
SET
utf8mb3
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
SET
a
=
REPEAT
(
'x'
,
127
);
ALTER
TABLE
t1
FORCE
,
ALGORITHM
=
COPY
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
VARCHAR
(
500
)
COMPRESSED
CHARACTER
SET
utf8mb3
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
SET
a
=
REPEAT
(
'x'
,
127
);
ALTER
TABLE
t1
FORCE
,
ALGORITHM
=
COPY
;
DROP
TABLE
t1
;
--
echo
#
--
echo
#
Start of 10.5
tests
--
echo
#
End of 10.4
tests
--
echo
#
--
echo
#
...
...
mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
View file @
3fee1b44
...
...
@@ -17,12 +17,15 @@ SELECT LENGTH(@@global.gtid_binlog_state) > 1;
LENGTH(@@global.gtid_binlog_state) > 1
1
connection node_1;
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
gtid_binlog_state_equal
0
connection node_2;
SELECT COUNT(*) AS EXPECT_
0
FROM t1;
EXPECT_
0
0
SELECT COUNT(*) AS EXPECT_
1
FROM t1;
EXPECT_
1
1
gtid_binlog_state_equal
0
#cleanup
...
...
mysql-test/suite/galera/r/galera_restart_replica.result
0 → 100644
View file @
3fee1b44
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
create user repl@'%' identified by 'repl';
grant all on *.* to repl@'%';
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
connection node_1;
connection node_2;
connection node_2;
START SLAVE;
connection node_3;
CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_1;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
# Verify that graceful shutdown succeeds.
# Force SST
connection node_1;
# Waiting until node_2 is not part of cluster anymore
connection node_2;
# Start node_2 again
¤ Wait until node_2 is back on cluster
connection node_2;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_1;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_3;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_3;
drop table t1;
connection node_2;
connection node_1;
connection node_3;
CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_1;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
# Verify that graceful shutdown succeeds.
# Force SST
connection node_1;
# Waiting until node_2 is not part of cluster anymore
connection node_3;
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
EXPECT_20000
20000
connection node_2;
# Start node_2 again
¤ Wait until node_2 is back on cluster
connection node_2;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
EXPECT_20000
20000
connection node_1;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
EXPECT_20000
20000
connection node_3;
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
EXPECT_20000
20000
connection node_3;
drop table t1;
connection node_2;
connection node_1;
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
connection node_3;
RESET MASTER;
connection node_1;
disconnect node_3;
disconnect node_2;
disconnect node_1;
# End of test
mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf
View file @
3fee1b44
...
...
@@ -4,3 +4,4 @@
log-bin=mysqld-bin
log-slave-updates
binlog-format=ROW
wsrep-replicate-myisam=ON
mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test
View file @
3fee1b44
...
...
@@ -44,12 +44,20 @@ SELECT LENGTH(@@global.gtid_binlog_state) > 1;
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
t1
;
--
source
include
/
wait_condition
.
inc
SELECT
COUNT
(
*
)
AS
EXPECT_1
FROM
t1
;
--
disable_query_log
--
eval
SELECT
'$gtid_binlog_state_node1'
=
@@
global
.
gtid_binlog_state
AS
gtid_binlog_state_equal
;
--
enable_query_log
--
connection
node_2
SELECT
COUNT
(
*
)
AS
EXPECT_0
FROM
t1
;
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
't1'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
t1
;
--
source
include
/
wait_condition
.
inc
SELECT
COUNT
(
*
)
AS
EXPECT_1
FROM
t1
;
--
disable_query_log
--
eval
SELECT
'$gtid_binlog_state_node1'
=
@@
global
.
gtid_binlog_state
AS
gtid_binlog_state_equal
;
...
...
@@ -59,8 +67,6 @@ SELECT COUNT(*) AS EXPECT_0 FROM t1;
--
connection
node_3
DROP
TABLE
t1
;
--
sleep
1
--
connection
node_1
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
0
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
't1'
;
--
source
include
/
wait_condition
.
inc
...
...
mysql-test/suite/galera/t/galera_restart_replica.cnf
0 → 100644
View file @
3fee1b44
!include ../galera_2nodes_as_slave.cnf
[mysqld]
wsrep-debug=1
[mysqld.1]
server_id=15
wsrep_gtid_mode=1
wsrep_gtid_domain_id=16
gtid_domain_id=11
gtid_strict_mode=1
[mysqld.2]
skip-slave-start=OFF
server_id=15
wsrep_gtid_mode=1
wsrep_gtid_domain_id=16
gtid_domain_id=11
gtid_strict_mode=1
mysql-test/suite/galera/t/galera_restart_replica.test
0 → 100644
View file @
3fee1b44
#
# Test Galera as a replica to a MySQL async replication
#
# The galera/galera_2node_slave.cnf describes the setup of the nodes
#
--
source
include
/
big_test
.
inc
--
source
include
/
force_restart
.
inc
--
source
include
/
galera_cluster
.
inc
--
source
include
/
have_sequence
.
inc
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
# we open the node_3 connection here
--
connect
node_3
,
127.0
.
0.1
,
root
,
,
test
,
$NODE_MYPORT_3
create
user
repl
@
'%'
identified
by
'repl'
;
grant
all
on
*.*
to
repl
@
'%'
;
ALTER
TABLE
mysql
.
gtid_slave_pos
ENGINE
=
InnoDB
;
--
let
$node_1
=
node_1
--
let
$node_2
=
node_2
--
source
include
/
auto_increment_offset_save
.
inc
--
connection
node_2
--
disable_query_log
--
eval
CHANGE
MASTER
TO
master_host
=
'127.0.0.1'
,
master_user
=
'repl'
,
master_password
=
'repl'
,
master_port
=
$NODE_MYPORT_3
,
master_use_gtid
=
slave_pos
;
--
enable_query_log
START
SLAVE
;
--
connection
node_3
CREATE
TABLE
t1
(
id
bigint
primary
key
,
msg
varchar
(
100
))
engine
=
innodb
;
--
disable_query_log
INSERT
INTO
t1
SELECT
seq
,
'test'
from
seq_1_to_10000
;
--
enable_query_log
SELECT
COUNT
(
*
)
AS
EXPECT_10000
FROM
t1
;
--
connection
node_2
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
't1'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
10000
FROM
t1
;
--
source
include
/
wait_condition
.
inc
SELECT
COUNT
(
*
)
>
0
AS
EXPECT_1
FROM
mysql
.
gtid_slave_pos
;
SELECT
COUNT
(
*
)
AS
EXPECT_10000
FROM
t1
;
--
connection
node_1
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
't1'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
10000
FROM
t1
;
--
source
include
/
wait_condition
.
inc
SELECT
COUNT
(
*
)
>
0
AS
EXPECT_1
FROM
mysql
.
gtid_slave_pos
;
SELECT
COUNT
(
*
)
AS
EXPECT_10000
FROM
t1
;
--
connection
node_2
--
echo
# Verify that graceful shutdown succeeds.
--
source
include
/
shutdown_mysqld
.
inc
--
echo
# Force SST
--
remove_file
$MYSQLTEST_VARDIR
/
mysqld
.
2
/
data
/
grastate
.
dat
--
connection
node_1
--
echo
# Waiting until node_2 is not part of cluster anymore
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
1
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_size'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
'Primary'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_status'
;
--
source
include
/
wait_condition
.
inc
--
connection
node_2
--
echo
# Start node_2 again
--
source
include
/
start_mysqld
.
inc
--
echo
¤
Wait
until
node_2
is
back
on
cluster
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
'Primary'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_status'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
2
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_size'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
'ON'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_ready'
;
--
source
include
/
wait_condition
.
inc
--
connection
node_2
SELECT
COUNT
(
*
)
>
0
AS
EXPECT_1
FROM
mysql
.
gtid_slave_pos
;
SELECT
COUNT
(
*
)
AS
EXPECT_10000
FROM
t1
;
--
connection
node_1
SELECT
COUNT
(
*
)
>
0
AS
EXPECT_1
FROM
mysql
.
gtid_slave_pos
;
SELECT
COUNT
(
*
)
AS
EXPECT_10000
FROM
t1
;
--
connection
node_3
SELECT
COUNT
(
*
)
AS
EXPECT_10000
FROM
t1
;
#
# Cleanup
#
--
connection
node_3
drop
table
t1
;
--
connection
node_2
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
0
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
't1'
;
--
source
include
/
wait_condition
.
inc
--
connection
node_1
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
0
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
't1'
;
--
source
include
/
wait_condition
.
inc
#
# Case 2 : While slave is down add writes to master
#
--
connection
node_3
CREATE
TABLE
t1
(
id
bigint
primary
key
,
msg
varchar
(
100
))
engine
=
innodb
;
--
disable_query_log
INSERT
INTO
t1
SELECT
seq
,
'test'
from
seq_1_to_10000
;
--
enable_query_log
SELECT
COUNT
(
*
)
AS
EXPECT_10000
FROM
t1
;
--
connection
node_2
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
't1'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
10000
FROM
t1
;
--
source
include
/
wait_condition
.
inc
SELECT
COUNT
(
*
)
>
0
AS
EXPECT_1
FROM
mysql
.
gtid_slave_pos
;
SELECT
COUNT
(
*
)
AS
EXPECT_10000
FROM
t1
;
--
connection
node_1
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
't1'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
10000
FROM
t1
;
--
source
include
/
wait_condition
.
inc
SELECT
COUNT
(
*
)
>
0
AS
EXPECT_1
FROM
mysql
.
gtid_slave_pos
;
SELECT
COUNT
(
*
)
AS
EXPECT_10000
FROM
t1
;
--
connection
node_2
--
echo
# Verify that graceful shutdown succeeds.
--
source
include
/
shutdown_mysqld
.
inc
--
echo
# Force SST
--
remove_file
$MYSQLTEST_VARDIR
/
mysqld
.
2
/
data
/
grastate
.
dat
--
connection
node_1
--
echo
# Waiting until node_2 is not part of cluster anymore
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
1
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_size'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
'Primary'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_status'
;
--
source
include
/
wait_condition
.
inc
# Add writes to master
--
connection
node_3
--
disable_query_log
INSERT
INTO
t1
SELECT
seq
,
'test'
from
seq_20001_to_30000
;
--
enable_query_log
SELECT
COUNT
(
*
)
AS
EXPECT_20000
FROM
t1
;
--
connection
node_2
--
echo
# Start node_2 again
--
source
include
/
start_mysqld
.
inc
--
echo
¤
Wait
until
node_2
is
back
on
cluster
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
'Primary'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_status'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
2
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_cluster_size'
;
--
source
include
/
wait_condition
.
inc
--
let
$wait_condition
=
SELECT
VARIABLE_VALUE
=
'ON'
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
WHERE
VARIABLE_NAME
=
'wsrep_ready'
;
--
source
include
/
wait_condition
.
inc
--
connection
node_2
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
20000
FROM
t1
;
--
source
include
/
wait_condition
.
inc
SELECT
COUNT
(
*
)
>
0
AS
EXPECT_1
FROM
mysql
.
gtid_slave_pos
;
SELECT
COUNT
(
*
)
AS
EXPECT_20000
FROM
t1
;
--
connection
node_1
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
20000
FROM
t1
;
--
source
include
/
wait_condition
.
inc
SELECT
COUNT
(
*
)
>
0
AS
EXPECT_1
FROM
mysql
.
gtid_slave_pos
;
SELECT
COUNT
(
*
)
AS
EXPECT_20000
FROM
t1
;
--
connection
node_3
SELECT
COUNT
(
*
)
AS
EXPECT_20000
FROM
t1
;
#
# Cleanup
#
--
connection
node_3
drop
table
t1
;
--
connection
node_2
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
0
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
't1'
;
--
source
include
/
wait_condition
.
inc
--
connection
node_1
--
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
0
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
't1'
;
--
source
include
/
wait_condition
.
inc
--
connection
node_2
STOP
SLAVE
;
RESET
SLAVE
ALL
;
--
connection
node_3
RESET
MASTER
;
--
connection
node_1
--
disconnect
node_3
--
source
include
/
auto_increment_offset_restore
.
inc
--
source
include
/
galera_end
.
inc
--
echo
# End of test
mysql-test/suite/rpl/t/rpl_parallel_optimistic_until.test
View file @
3fee1b44
...
...
@@ -263,13 +263,34 @@ BEGIN;
START
SLAVE
IO_THREAD
;
--
source
include
/
wait_for_slave_io_to_start
.
inc
# The following test sets the stop coordinate
is set
to inside the first event
# The following test sets the stop coordinate to inside the first event
# of a relay log that holds events of a transaction started in an earlier log.
# Peek the stop position in the middle of trx1, not even on a event boundary.
--
let
$pos_until
=
255
--
let
$file_rl
=
slave
-
relay
-
bin
.
000003
--
let
$binlog_file
=
$file_rl
# Wait for the IO thread to write the trx1 to the relaylog before querying it.
# (wait_for_slave_param.inc isn't flexible enough, so do it manually.)
--
let
$continue
=
1
--
let
$count
=
600
while
(
$continue
)
{
--
let
$cur_file
=
query_get_value
(
SHOW
SLAVE
STATUS
,
'Master_Log_File'
,
1
)
--
let
$cur_pos
=
query_get_value
(
SHOW
SLAVE
STATUS
,
'Read_Master_Log_Pos'
,
1
)
--
let
$continue
=
`SELECT '$cur_file' = '$fil_1' AND $cur_pos < $pos_trx1`
if
(
$continue
)
{
--
dec
$count
if
(
!
$count
)
{
--
echo
****
ERROR
:
timeout
waiting
for
Read_Master_Log_Pos
(
$cur_pos
)
>=
$pos_trx1
(
file
=
'$cur_file'
)
****
"
--die Timeout waiting for IO thread to write master events to the relaylog
}
--sleep 0.1
}
}
--let
$pos_xid
=508
--let
$info
= query_get_value(SHOW RELAYLOG EVENTS IN '
$file_rl
' FROM
$pos_xid
LIMIT 1, Info, 1)
...
...
mysys/my_sync.c
View file @
3fee1b44
...
...
@@ -49,13 +49,6 @@ void thr_set_sync_wait_callback(void (*before_wait)(void),
(which is correct behaviour, if we know that the other thread synced the
file before closing)
MY_SYNC_FILESIZE is useful when syncing a file after it has been extended.
On Linux, fdatasync() on ext3/ext4 file systems does not properly flush
to disk the inode data required to preserve the added data across a crash
(this looks to be a bug). But when a file is extended, inode data will most
likely need flushing in any case, so passing MY_SYNC_FILESIZE as flags
is not likely to be any slower, and will be crash safe on Linux ext3/ext4.
RETURN
0 ok
-1 error
...
...
@@ -88,12 +81,8 @@ int my_sync(File fd, myf my_flags)
DBUG_PRINT
(
"info"
,(
"fcntl(F_FULLFSYNC) failed, falling back"
));
#endif
#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
if
(
!
(
my_flags
&
MY_SYNC_FILESIZE
))
res
=
fdatasync
(
fd
);
else
{
#endif
#if defined(HAVE_FSYNC)
res
=
fdatasync
(
fd
);
#elif defined(HAVE_FSYNC)
res
=
fsync
(
fd
);
if
(
res
==
-
1
&&
errno
==
ENOLCK
)
res
=
0
;
/* Result Bug in Old FreeBSD */
...
...
@@ -102,9 +91,6 @@ int my_sync(File fd, myf my_flags)
#else
#error Cannot find a way to sync a file, durability in danger
res
=
0
;
/* No sync (strange OS) */
#endif
#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
}
#endif
}
while
(
res
==
-
1
&&
errno
==
EINTR
);
...
...
sql/backup.cc
View file @
3fee1b44
...
...
@@ -393,8 +393,7 @@ static bool backup_block_commit(THD *thd)
if
(
mysql_bin_log
.
is_open
())
{
mysql_mutex_lock
(
mysql_bin_log
.
get_log_lock
());
mysql_file_sync
(
mysql_bin_log
.
get_log_file
()
->
file
,
MYF
(
MY_WME
|
MY_SYNC_FILESIZE
));
mysql_file_sync
(
mysql_bin_log
.
get_log_file
()
->
file
,
MYF
(
MY_WME
));
mysql_mutex_unlock
(
mysql_bin_log
.
get_log_lock
());
}
thd
->
clear_error
();
...
...
sql/field_conv.cc
View file @
3fee1b44
...
...
@@ -531,6 +531,40 @@ static void do_expand_string(Copy_field *copy)
}
/*
Copy from a Field_varstring with length_bytes==1
into another Field_varstring with length_bytes==1
when the target column is not shorter than the source column.
We don't need to calculate the prefix in this case. It works for
- non-compressed and compressed columns
- single byte and multi-byte character sets
*/
static
void
do_varstring1_no_truncation
(
Copy_field
*
copy
)
{
uint
length
=
(
uint
)
*
(
uchar
*
)
copy
->
from_ptr
;
DBUG_ASSERT
(
length
<=
copy
->
to_length
-
1
);
*
(
uchar
*
)
copy
->
to_ptr
=
(
uchar
)
length
;
memcpy
(
copy
->
to_ptr
+
1
,
copy
->
from_ptr
+
1
,
length
);
}
/*
Copy from a Field_varstring with length_bytes==2
into another Field_varstring with length_bytes==2
when the target column is not shorter than the source column.
We don't need to calculate the prefix in this case. It works for
- non-compressed and compressed columns
- single byte and multi-byte character sets
*/
static
void
do_varstring2_no_truncation
(
Copy_field
*
copy
)
{
uint
length
=
uint2korr
(
copy
->
from_ptr
);
DBUG_ASSERT
(
length
<=
copy
->
to_length
-
HA_KEY_BLOB_LENGTH
);
int2store
(
copy
->
to_ptr
,
length
);
memcpy
(
copy
->
to_ptr
+
HA_KEY_BLOB_LENGTH
,
copy
->
from_ptr
+
HA_KEY_BLOB_LENGTH
,
length
);
}
static
void
do_varstring1
(
Copy_field
*
copy
)
{
uint
length
=
(
uint
)
*
(
uchar
*
)
copy
->
from_ptr
;
...
...
@@ -775,6 +809,21 @@ Field::Copy_func *Field_varstring::get_copy_func(const Field *from) const
length_bytes
!=
((
const
Field_varstring
*
)
from
)
->
length_bytes
||
!
compression_method
()
!=
!
from
->
compression_method
())
return
do_field_string
;
if
(
field_length
>=
from
->
field_length
)
return
length_bytes
==
1
?
do_varstring1_no_truncation
:
do_varstring2_no_truncation
;
if
(
compression_method
())
{
/*
Truncation is going to happen, so we need to calculate prefixes.
Can't calculate prefixes directly on compressed data,
need to go through val_str() to uncompress.
*/
return
do_field_string
;
}
return
length_bytes
==
1
?
(
from
->
charset
()
->
mbmaxlen
==
1
?
do_varstring1
:
do_varstring1_mb
)
:
(
from
->
charset
()
->
mbmaxlen
==
1
?
do_varstring2
:
do_varstring2_mb
);
...
...
sql/log.cc
View file @
3fee1b44
...
...
@@ -3943,7 +3943,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
bytes_written
+=
description_event_for_queue
->
data_written
;
}
if
(
flush_io_cache
(
&
log_file
)
||
mysql_file_sync
(
log_file
.
file
,
MYF
(
MY_WME
|
MY_SYNC_FILESIZE
)))
mysql_file_sync
(
log_file
.
file
,
MYF
(
MY_WME
)))
goto
err
;
my_off_t
offset
=
my_b_tell
(
&
log_file
);
...
...
@@ -3981,7 +3981,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
strlen
(
log_file_name
))
||
my_b_write
(
&
index_file
,
(
uchar
*
)
"
\n
"
,
1
)
||
flush_io_cache
(
&
index_file
)
||
mysql_file_sync
(
index_file
.
file
,
MYF
(
MY_WME
|
MY_SYNC_FILESIZE
)))
mysql_file_sync
(
index_file
.
file
,
MYF
(
MY_WME
)))
goto
err
;
#ifdef HAVE_REPLICATION
...
...
@@ -4121,7 +4121,7 @@ static bool copy_up_file_and_fill(IO_CACHE *index_file, my_off_t offset)
}
/* The following will either truncate the file or fill the end with \n' */
if
(
mysql_file_chsize
(
file
,
offset
-
init_offset
,
'\n'
,
MYF
(
MY_WME
))
||
mysql_file_sync
(
file
,
MYF
(
MY_WME
|
MY_SYNC_FILESIZE
)))
mysql_file_sync
(
file
,
MYF
(
MY_WME
)))
goto
err
;
/* Reset data in old index cache */
...
...
@@ -4917,7 +4917,7 @@ int MYSQL_BIN_LOG::sync_purge_index_file()
if
(
unlikely
((
error
=
flush_io_cache
(
&
purge_index_file
)))
||
unlikely
((
error
=
my_sync
(
purge_index_file
.
file
,
MYF
(
MY_WME
|
MY_SYNC_FILESIZE
)))))
MYF
(
MY_WME
)))))
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
...
...
@@ -5629,7 +5629,7 @@ bool MYSQL_BIN_LOG::flush_and_sync(bool *synced)
if
(
sync_period
&&
++
sync_counter
>=
sync_period
)
{
sync_counter
=
0
;
err
=
mysql_file_sync
(
fd
,
MYF
(
MY_WME
|
MY_SYNC_FILESIZE
));
err
=
mysql_file_sync
(
fd
,
MYF
(
MY_WME
));
if
(
synced
)
*
synced
=
1
;
#ifndef DBUG_OFF
...
...
@@ -6409,7 +6409,7 @@ MYSQL_BIN_LOG::write_state_to_file()
log_inited
=
false
;
if
((
err
=
end_io_cache
(
&
cache
)))
goto
err
;
if
((
err
=
mysql_file_sync
(
file_no
,
MYF
(
MY_WME
|
MY_SYNC_FILESIZE
))))
if
((
err
=
mysql_file_sync
(
file_no
,
MYF
(
MY_WME
))))
goto
err
;
goto
end
;
...
...
@@ -10167,7 +10167,7 @@ bool MYSQL_BIN_LOG::truncate_and_remove_binlogs(const char *file_name,
error
=
mysql_file_chsize
(
index_file
.
file
,
index_file_offset
,
'\n'
,
MYF
(
MY_WME
));
if
(
!
error
)
error
=
mysql_file_sync
(
index_file
.
file
,
MYF
(
MY_WME
|
MY_SYNC_FILESIZE
));
error
=
mysql_file_sync
(
index_file
.
file
,
MYF
(
MY_WME
));
if
(
error
)
{
sql_print_error
(
"Failed to truncate binlog index "
...
...
@@ -10209,7 +10209,7 @@ bool MYSQL_BIN_LOG::truncate_and_remove_binlogs(const char *file_name,
/* Change binlog file size to truncate_pos */
error
=
mysql_file_chsize
(
file
,
pos
,
0
,
MYF
(
MY_WME
));
if
(
!
error
)
error
=
mysql_file_sync
(
file
,
MYF
(
MY_WME
|
MY_SYNC_FILESIZE
));
error
=
mysql_file_sync
(
file
,
MYF
(
MY_WME
));
if
(
error
)
{
sql_print_error
(
"Failed to truncate the "
...
...
sql/rpl_gtid.cc
View file @
3fee1b44
...
...
@@ -28,6 +28,10 @@
#include "rpl_rli.h"
#include "slave.h"
#include "log_event.h"
#ifdef WITH_WSREP
#include "wsrep_mysqld.h" // wsrep_thd_is_local
#include "wsrep_trans_observer.h" // wsrep_start_trx_if_not_started
#endif
const
LEX_CSTRING
rpl_gtid_slave_state_table_name
=
{
STRING_WITH_LEN
(
"gtid_slave_pos"
)
};
...
...
@@ -693,10 +697,18 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
#ifdef WITH_WSREP
/*
Updates in slave state table should not be appended to galera transaction
writeset.
We should replicate local gtid_slave_pos updates to other nodes.
In applier we should not append them to galera
writeset.
*/
thd
->
wsrep_ignore_table
=
true
;
if
(
WSREP_ON_
&&
wsrep_thd_is_local
(
thd
))
{
thd
->
wsrep_ignore_table
=
false
;
wsrep_start_trx_if_not_started
(
thd
);
}
else
{
thd
->
wsrep_ignore_table
=
true
;
}
#endif
if
(
!
in_transaction
)
...
...
@@ -862,9 +874,20 @@ rpl_slave_state::gtid_delete_pending(THD *thd,
#ifdef WITH_WSREP
/*
Updates in slave state table should not be appended to galera transaction
writeset.
We should replicate local gtid_slave_pos updates to other nodes.
In applier we should not append them to galera
writeset.
*/
if
(
WSREP_ON_
&&
wsrep_thd_is_local
(
thd
)
&&
thd
->
wsrep_cs
().
state
()
!=
wsrep
::
client_state
::
s_none
)
{
if
(
thd
->
wsrep_trx
().
active
()
==
false
)
{
if
(
thd
->
wsrep_next_trx_id
()
==
WSREP_UNDEFINED_TRX_ID
)
thd
->
set_query_id
(
next_query_id
());
wsrep_start_transaction
(
thd
,
thd
->
wsrep_next_trx_id
());
}
thd
->
wsrep_ignore_table
=
false
;
}
thd
->
wsrep_ignore_table
=
true
;
#endif
...
...
sql/slave.cc
View file @
3fee1b44
...
...
@@ -5563,6 +5563,8 @@ pthread_handler_t handle_slave_sql(void *arg)
mysql_mutex_unlock
(
&
rli
->
data_lock
);
#ifdef WITH_WSREP
wsrep_open
(
thd
);
if
(
WSREP_ON_
)
wsrep_wait_ready
(
thd
);
if
(
wsrep_before_command
(
thd
))
{
WSREP_WARN
(
"Slave SQL wsrep_before_command() failed"
);
...
...
sql/wsrep_mysqld.cc
View file @
3fee1b44
/* Copyright (c) 2008, 202
2
Codership Oy <http://www.codership.com>
/* Copyright (c) 2008, 202
3
Codership Oy <http://www.codership.com>
Copyright (c) 2020, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
...
...
@@ -3742,6 +3742,30 @@ bool wsrep_consistency_check(THD *thd)
return
thd
->
wsrep_consistency_check
==
CONSISTENCY_CHECK_RUNNING
;
}
// Wait until wsrep has reached ready state
void
wsrep_wait_ready
(
THD
*
thd
)
{
mysql_mutex_lock
(
&
LOCK_wsrep_ready
);
while
(
!
wsrep_ready
)
{
WSREP_INFO
(
"Waiting to reach ready state"
);
mysql_cond_wait
(
&
COND_wsrep_ready
,
&
LOCK_wsrep_ready
);
}
WSREP_INFO
(
"ready state reached"
);
mysql_mutex_unlock
(
&
LOCK_wsrep_ready
);
}
void
wsrep_ready_set
(
bool
ready_value
)
{
WSREP_DEBUG
(
"Setting wsrep_ready to %d"
,
ready_value
);
mysql_mutex_lock
(
&
LOCK_wsrep_ready
);
wsrep_ready
=
ready_value
;
// Signal if we have reached ready state
if
(
wsrep_ready
)
mysql_cond_signal
(
&
COND_wsrep_ready
);
mysql_mutex_unlock
(
&
LOCK_wsrep_ready
);
}
/*
Commit an empty transaction.
...
...
sql/wsrep_mysqld.h
View file @
3fee1b44
/* Copyright 2008-202
2
Codership Oy <http://www.codership.com>
/* Copyright 2008-202
3
Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -597,6 +597,8 @@ enum wsrep::streaming_context::fragment_unit wsrep_fragment_unit(ulong unit);
wsrep
::
key
wsrep_prepare_key_for_toi
(
const
char
*
db
,
const
char
*
table
,
enum
wsrep
::
key
::
type
type
);
void
wsrep_wait_ready
(
THD
*
thd
);
void
wsrep_ready_set
(
bool
ready_value
);
#else
/* !WITH_WSREP */
/* These macros are needed to compile MariaDB without WSREP support
...
...
sql/wsrep_priv.h
View file @
3fee1b44
/* Copyright 2010 Codership Oy <http://www.codership.com>
/* Copyright 2010
-2023
Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -22,8 +22,6 @@
#include "wsrep_api.h"
#include "wsrep/server_state.hpp"
my_bool
wsrep_ready_set
(
my_bool
x
);
ssize_t
wsrep_sst_prepare
(
void
**
msg
);
wsrep_cb_status
wsrep_sst_donate_cb
(
void
*
app_ctx
,
void
*
recv_ctx
,
...
...
sql/wsrep_server_service.cc
View file @
3fee1b44
...
...
@@ -347,6 +347,7 @@ void Wsrep_server_service::log_state_change(
case
Wsrep_server_state
:
:
s_synced
:
wsrep_ready
=
TRUE
;
WSREP_INFO
(
"Synchronized with group, ready for connections"
);
wsrep_ready_set
(
true
);
/* fall through */
case
Wsrep_server_state
:
:
s_joined
:
case
Wsrep_server_state
:
:
s_donor
:
...
...
@@ -354,16 +355,16 @@ void Wsrep_server_service::log_state_change(
break
;
case
Wsrep_server_state
:
:
s_connected
:
wsrep_cluster_status
=
"non-Primary"
;
wsrep_ready
=
FALSE
;
wsrep_ready
_set
(
false
)
;
wsrep_connected
=
TRUE
;
break
;
case
Wsrep_server_state
:
:
s_disconnected
:
wsrep_ready
=
FALSE
;
wsrep_ready
_set
(
false
)
;
wsrep_connected
=
FALSE
;
wsrep_cluster_status
=
"Disconnected"
;
break
;
default:
wsrep_ready
=
FALSE
;
wsrep_ready
_set
(
false
)
;
wsrep_cluster_status
=
"non-Primary"
;
break
;
}
...
...
wsrep-lib
@
173693f2
Subproject commit
7dafce8403d4088ddc8748f2e08eae13b1f225b6
Subproject commit
173693f2eeb61054424233fe85fde4086bed36be
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