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
3b5e2426
Commit
3b5e2426
authored
Mar 30, 2020
by
Jan Lindström
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'codership-10.2-MDEV-22021' into bb-10.2-MDEV-22021
parents
b11ff3d4
36e9cb54
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
131 additions
and
40 deletions
+131
-40
mysql-test/suite/galera/r/MDEV-22021.result
mysql-test/suite/galera/r/MDEV-22021.result
+55
-0
mysql-test/suite/galera/t/MDEV-22021.combinations
mysql-test/suite/galera/t/MDEV-22021.combinations
+4
-0
mysql-test/suite/galera/t/MDEV-22021.test
mysql-test/suite/galera/t/MDEV-22021.test
+60
-0
sql/log.cc
sql/log.cc
+0
-6
sql/transaction.cc
sql/transaction.cc
+6
-0
sql/wsrep_binlog.cc
sql/wsrep_binlog.cc
+0
-14
sql/wsrep_binlog.h
sql/wsrep_binlog.h
+0
-2
sql/wsrep_hton.cc
sql/wsrep_hton.cc
+6
-18
No files found.
mysql-test/suite/galera/r/MDEV-22021.result
0 → 100644
View file @
3b5e2426
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
START TRANSACTION;
INSERT INTO t1 VALUES (1);
SAVEPOINT sp1;
INSERT INTO t1 VALUES (2);
ROLLBACK TO SAVEPOINT sp1;
COMMIT;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
connection node_2;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
connection node_1;
DELETE FROM t1;
START TRANSACTION;
SAVEPOINT sp1;
INSERT INTO t1 VALUES (1);
SAVEPOINT sp2;
INSERT INTO t1 VALUES (2);
ROLLBACK TO SAVEPOINT sp2;
ROLLBACK TO SAVEPOINT sp1;
COMMIT;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
connection node_2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
connection node_1;
DELETE FROM t1;
START TRANSACTION;
SAVEPOINT sp1;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
SAVEPOINT sp2;
INSERT INTO t1 VALUES (5);
ROLLBACK TO SAVEPOINT sp2;
INSERT INTO t1 VALUES (6);
INSERT INTO t1 VALUES (7);
ROLLBACK TO SAVEPOINT sp1;
INSERT INTO t1 VALUES (8);
COMMIT;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
connection node_2;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
DROP TABLE t1;
mysql-test/suite/galera/t/MDEV-22021.combinations
0 → 100644
View file @
3b5e2426
[binlogoff]
[binlogon]
log-bin
mysql-test/suite/galera/t/MDEV-22021.test
0 → 100644
View file @
3b5e2426
#
# SAVEPOINT ROLLBACK can introduce incosistency in cluster.
#
--
source
include
/
galera_cluster
.
inc
CREATE
TABLE
t1
(
f1
INTEGER
PRIMARY
KEY
);
START
TRANSACTION
;
INSERT
INTO
t1
VALUES
(
1
);
SAVEPOINT
sp1
;
INSERT
INTO
t1
VALUES
(
2
);
ROLLBACK
TO
SAVEPOINT
sp1
;
COMMIT
;
SELECT
COUNT
(
*
)
=
1
FROM
t1
;
--
connection
node_2
SELECT
COUNT
(
*
)
=
1
FROM
t1
;
--
connection
node_1
DELETE
FROM
t1
;
START
TRANSACTION
;
SAVEPOINT
sp1
;
INSERT
INTO
t1
VALUES
(
1
);
SAVEPOINT
sp2
;
INSERT
INTO
t1
VALUES
(
2
);
ROLLBACK
TO
SAVEPOINT
sp2
;
ROLLBACK
TO
SAVEPOINT
sp1
;
COMMIT
;
SELECT
COUNT
(
*
)
=
0
FROM
t1
;
--
connection
node_2
SELECT
COUNT
(
*
)
=
0
FROM
t1
;
--
connection
node_1
DELETE
FROM
t1
;
START
TRANSACTION
;
SAVEPOINT
sp1
;
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t1
VALUES
(
2
);
INSERT
INTO
t1
VALUES
(
3
);
INSERT
INTO
t1
VALUES
(
4
);
SAVEPOINT
sp2
;
INSERT
INTO
t1
VALUES
(
5
);
ROLLBACK
TO
SAVEPOINT
sp2
;
INSERT
INTO
t1
VALUES
(
6
);
INSERT
INTO
t1
VALUES
(
7
);
ROLLBACK
TO
SAVEPOINT
sp1
;
INSERT
INTO
t1
VALUES
(
8
);
COMMIT
;
SELECT
COUNT
(
*
)
=
1
FROM
t1
;
--
connection
node_2
SELECT
COUNT
(
*
)
=
1
FROM
t1
;
DROP
TABLE
t1
;
sql/log.cc
View file @
3b5e2426
...
...
@@ -2209,9 +2209,6 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv)
int
error
=
1
;
DBUG_ENTER
(
"binlog_savepoint_set"
);
if
(
wsrep_emulate_bin_log
)
DBUG_RETURN
(
0
);
char
buf
[
1024
];
String
log_query
(
buf
,
sizeof
(
buf
),
&
my_charset_bin
);
...
...
@@ -2245,9 +2242,6 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
{
DBUG_ENTER
(
"binlog_savepoint_rollback"
);
if
(
wsrep_emulate_bin_log
)
DBUG_RETURN
(
0
);
/*
Write ROLLBACK TO SAVEPOINT to the binlog cache if we have updated some
non-transactional table. Otherwise, truncate the binlog cache starting
...
...
sql/transaction.cc
View file @
3b5e2426
...
...
@@ -614,6 +614,9 @@ bool trans_savepoint(THD *thd, LEX_STRING name)
if
(
thd
->
transaction
.
xid_state
.
check_has_uncommitted_xa
())
DBUG_RETURN
(
TRUE
);
if
(
WSREP_ON
)
wsrep_register_hton
(
thd
,
thd
->
in_multi_stmt_transaction_mode
());
sv
=
find_savepoint
(
thd
,
name
);
if
(
*
sv
)
/* old savepoint of the same name exists */
...
...
@@ -690,6 +693,9 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_STRING name)
if
(
thd
->
transaction
.
xid_state
.
check_has_uncommitted_xa
())
DBUG_RETURN
(
TRUE
);
if
(
WSREP_ON
)
wsrep_register_hton
(
thd
,
thd
->
in_multi_stmt_transaction_mode
());
/**
Checking whether it is safe to release metadata locks acquired after
savepoint, if rollback to savepoint is successful.
...
...
sql/wsrep_binlog.cc
View file @
3b5e2426
...
...
@@ -376,20 +376,6 @@ int wsrep_binlog_close_connection(THD* thd)
DBUG_RETURN
(
0
);
}
int
wsrep_binlog_savepoint_set
(
THD
*
thd
,
void
*
sv
)
{
if
(
!
wsrep_emulate_bin_log
)
return
0
;
int
rcode
=
binlog_hton
->
savepoint_set
(
binlog_hton
,
thd
,
sv
);
return
rcode
;
}
int
wsrep_binlog_savepoint_rollback
(
THD
*
thd
,
void
*
sv
)
{
if
(
!
wsrep_emulate_bin_log
)
return
0
;
int
rcode
=
binlog_hton
->
savepoint_rollback
(
binlog_hton
,
thd
,
sv
);
return
rcode
;
}
#if 0
void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache)
{
...
...
sql/wsrep_binlog.h
View file @
3b5e2426
...
...
@@ -54,7 +54,5 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
size_t
buf_len
);
int
wsrep_binlog_close_connection
(
THD
*
thd
);
int
wsrep_binlog_savepoint_set
(
THD
*
thd
,
void
*
sv
);
int
wsrep_binlog_savepoint_rollback
(
THD
*
thd
,
void
*
sv
);
#endif
/* WSREP_BINLOG_H */
sql/wsrep_hton.cc
View file @
3b5e2426
...
...
@@ -219,32 +219,20 @@ static int wsrep_prepare(handlerton *hton, THD *thd, bool all)
DBUG_RETURN
(
0
);
}
/*
Empty callbacks to support SAVEPOINT callbacks.
*/
static
int
wsrep_savepoint_set
(
handlerton
*
hton
,
THD
*
thd
,
void
*
sv
)
{
DBUG_ENTER
(
"wsrep_savepoint_set"
);
if
(
thd
->
wsrep_exec_mode
==
REPL_RECV
)
{
DBUG_RETURN
(
0
);
}
if
(
!
wsrep_emulate_bin_log
)
DBUG_RETURN
(
0
);
int
rcode
=
wsrep_binlog_savepoint_set
(
thd
,
sv
);
DBUG_RETURN
(
rcode
);
}
static
int
wsrep_savepoint_rollback
(
handlerton
*
hton
,
THD
*
thd
,
void
*
sv
)
{
DBUG_ENTER
(
"wsrep_savepoint_rollback"
);
if
(
thd
->
wsrep_exec_mode
==
REPL_RECV
)
{
DBUG_RETURN
(
0
);
}
if
(
!
wsrep_emulate_bin_log
)
DBUG_RETURN
(
0
);
int
rcode
=
wsrep_binlog_savepoint_rollback
(
thd
,
sv
);
DBUG_RETURN
(
rcode
);
}
static
int
wsrep_rollback
(
handlerton
*
hton
,
THD
*
thd
,
bool
all
)
...
...
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