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
b0d9b338
Commit
b0d9b338
authored
Feb 03, 2020
by
Jan Lindström
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'codership-10.5-galera_sync_wait_upto' into 10.5
parents
287c1db7
fd6fff45
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
28 deletions
+42
-28
mysql-test/suite/galera/r/galera_sync_wait_upto.result
mysql-test/suite/galera/r/galera_sync_wait_upto.result
+1
-2
mysql-test/suite/galera/t/galera_sync_wait_upto.test
mysql-test/suite/galera/t/galera_sync_wait_upto.test
+4
-3
sql/item_strfunc.cc
sql/item_strfunc.cc
+8
-1
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+29
-22
No files found.
mysql-test/suite/galera/r/galera_sync_wait_upto.result
View file @
b0d9b338
...
...
@@ -16,11 +16,10 @@ WSREP_SYNC_WAIT_UPTO
1
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection node_2;
SELECT WSREP_SYNC_WAIT_UPTO_GTID('100-1-3');
connection node_1;
INSERT INTO t1 VALUES (2);
connection node_2;
WSREP_SYNC_WAIT_UPTO
_GTID('100-1-3')
WSREP_SYNC_WAIT_UPTO
1
connection node_1;
DROP TABLE t1;
mysql-test/suite/galera/t/galera_sync_wait_upto.test
View file @
b0d9b338
...
...
@@ -24,7 +24,9 @@ SELECT WSREP_SYNC_WAIT_UPTO_GTID('1-1-1,1-1-2');
# Expected starting seqno
--
let
$start_seqno
=
2
--
let
$last_seen_gtid
=
`SELECT WSREP_LAST_SEEN_GTID()`
--
let
$s1
=
`SELECT SUBSTR('$last_seen_gtid', LOCATE('-', '$last_seen_gtid') + LENGTH('-'))`
--
let
$start_seqno
=
`SELECT SUBSTR('$s1', LOCATE('-', '$s1') + LENGTH('-'))`
# If set to low value, expect no waiting
...
...
@@ -57,10 +59,9 @@ SELECT WSREP_SYNC_WAIT_UPTO_GTID('1-1-1,1-1-2');
--
disable_query_log
--
let
$wait_seqno
=
$start_seqno
--
inc
$wait_seqno
--
send_eval
SELECT
WSREP_SYNC_WAIT_UPTO_GTID
(
'100-1-$wait_seqno'
)
AS
WSREP_SYNC_WAIT_UPTO
--
enable_query_log
--
send_eval
SELECT
WSREP_SYNC_WAIT_UPTO_GTID
(
'100-1-$wait_seqno'
)
--
connection
node_1
INSERT
INTO
t1
VALUES
(
2
);
...
...
sql/item_strfunc.cc
View file @
b0d9b338
...
...
@@ -5297,6 +5297,7 @@ longlong Item_func_wsrep_sync_wait_upto::val_int()
uint
timeout
;
rpl_gtid
*
gtid_list
;
uint32
count
;
int
wait_gtid_ret
=
0
;
int
ret
=
1
;
if
(
args
[
0
]
->
null_value
)
...
...
@@ -5323,11 +5324,17 @@ longlong Item_func_wsrep_sync_wait_upto::val_int()
if
(
wsrep_check_gtid_seqno
(
gtid_list
[
0
].
domain_id
,
gtid_list
[
0
].
server_id
,
gtid_list
[
0
].
seq_no
))
{
if
(
wsrep_gtid_server
.
wait_gtid_upto
(
gtid_list
[
0
].
seq_no
,
timeout
))
wait_gtid_ret
=
wsrep_gtid_server
.
wait_gtid_upto
(
gtid_list
[
0
].
seq_no
,
timeout
);
if
((
wait_gtid_ret
==
ETIMEDOUT
)
||
(
wait_gtid_ret
==
ETIME
))
{
my_error
(
ER_LOCK_WAIT_TIMEOUT
,
MYF
(
0
),
func_name
());
ret
=
0
;
}
else
if
(
wait_gtid_ret
==
ENOMEM
)
{
my_error
(
ER_OUTOFMEMORY
,
MYF
(
0
),
func_name
());
ret
=
0
;
}
}
}
else
...
...
sql/wsrep_mysqld.h
View file @
b0d9b338
...
...
@@ -431,7 +431,7 @@ class Wsrep_gtid_server
}
int
wait_gtid_upto
(
const
uint64_t
seqno
,
uint
timeout
)
{
int
wait_result
;
int
wait_result
=
0
;
struct
timespec
wait_time
;
int
ret
=
0
;
mysql_cond_t
wait_cond
;
...
...
@@ -439,37 +439,44 @@ class Wsrep_gtid_server
set_timespec
(
wait_time
,
timeout
);
mysql_mutex_lock
(
&
LOCK_wsrep_gtid_wait_upto
);
std
::
multimap
<
uint64
,
mysql_cond_t
*>::
iterator
it
;
try
if
(
seqno
>
m_seqno
)
{
it
=
m_wait_map
.
insert
(
std
::
make_pair
(
seqno
,
&
wait_cond
));
}
catch
(
std
::
bad_alloc
&
e
)
{
return
0
;
}
while
((
m_committed_seqno
<
seqno
)
&&
!
m_force_signal
)
{
wait_result
=
mysql_cond_timedwait
(
&
wait_cond
,
&
LOCK_wsrep_gtid_wait_upto
,
&
wait_time
);
if
(
wait_result
==
ETIMEDOUT
||
wait_result
==
ETIME
)
try
{
ret
=
1
;
break
;
it
=
m_wait_map
.
insert
(
std
::
make_pair
(
seqno
,
&
wait_cond
));
}
catch
(
std
::
bad_alloc
&
e
)
{
ret
=
ENOMEM
;
}
while
(
!
ret
&&
(
m_committed_seqno
<
seqno
)
&&
!
m_force_signal
)
{
wait_result
=
mysql_cond_timedwait
(
&
wait_cond
,
&
LOCK_wsrep_gtid_wait_upto
,
&
wait_time
);
if
(
wait_result
==
ETIMEDOUT
||
wait_result
==
ETIME
)
{
ret
=
wait_result
;
break
;
}
}
if
(
ret
!=
ENOMEM
)
{
m_wait_map
.
erase
(
it
);
}
}
m_wait_map
.
erase
(
it
);
mysql_mutex_unlock
(
&
LOCK_wsrep_gtid_wait_upto
);
mysql_cond_destroy
(
&
wait_cond
);
return
ret
;
}
void
signal_waiters
(
uint64
seqno
,
bool
signal_all
)
{
mysql_mutex_lock
(
&
LOCK_wsrep_gtid_wait_upto
);
if
(
!
signal_all
&&
(
m_committed_seqno
>=
seqno
))
{
mysql_mutex_unlock
(
&
LOCK_wsrep_gtid_wait_upto
);
return
;
}
mysql_mutex_lock
(
&
LOCK_wsrep_gtid_wait_upto
);
m_force_signal
=
true
;
std
::
multimap
<
uint64
,
mysql_cond_t
*>::
iterator
it_end
;
std
::
multimap
<
uint64
,
mysql_cond_t
*>::
iterator
it_begin
;
...
...
@@ -481,16 +488,16 @@ class Wsrep_gtid_server
{
it_end
=
m_wait_map
.
upper_bound
(
seqno
);
}
if
(
m_committed_seqno
<
seqno
)
{
m_committed_seqno
=
seqno
;
}
for
(
it_begin
=
m_wait_map
.
begin
();
it_begin
!=
it_end
;
++
it_begin
)
{
mysql_cond_signal
(
it_begin
->
second
);
}
m_force_signal
=
false
;
mysql_mutex_unlock
(
&
LOCK_wsrep_gtid_wait_upto
);
if
(
m_committed_seqno
<
seqno
)
{
m_committed_seqno
=
seqno
;
}
}
private:
const
wsrep_server_gtid_t
m_undefined
=
{
0
,
0
,
0
};
...
...
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