Skip to content

Commit 7560a27

Browse files
author
Paweł Andruszkiewicz
committed
BUG#37158908 Dump may hang when executing a binlog consistency check
When running a dump on an active instance with the `consistent` option set to true, using an account which lacks privileges to execute FLUSH TABLES WITH READ LOCK, shell runs some additional consistency checks and validates executed statements using the information from binlogs. If this validation was triggered because binlog file/position has changed and more than one binlog file needed to be examined for executed statements, Shell could hang while running this consistency check. Due to a bug, all binlog events were checked, and some of them had an empty Info field, which caused Shell to enter an infinite loop. As a fix, only non-empty Query events are checked. Additionally, GRANT and REVOKE statements are also flagged as unsafe, if consistency check detects them, an exception is thrown. Change-Id: Ife4c7df74b02c596c65acb2b9fe76e46a54fea33
1 parent 05b3449 commit 7560a27

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

modules/util/dump/dumper.cc

+7-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ bool check_if_transactions_are_ddl_safe(
284284
mysqlshdk::utils::SQL_iterator it(sql);
285285
const auto token = it.next_token();
286286

287-
if (shcore::str_caseeq(token, "ALTER", "CREATE", "DROP") ||
287+
if (shcore::str_caseeq(token, "ALTER", "CREATE", "DROP", "GRANT",
288+
"REVOKE") ||
288289
(shcore::str_caseeq(token, "RENAME", "TRUNCATE") &&
289290
shcore::str_caseeq(it.next_token(), "TABLE"))) {
290291
is_safe = false;
@@ -321,6 +322,11 @@ bool check_if_transactions_are_ddl_safe(
321322
return false;
322323
}
323324

325+
if (event.info.empty() ||
326+
!shcore::str_caseeq(event.event_type, "Query")) {
327+
return true;
328+
}
329+
324330
if (include_gtid(gtid) && !is_ddl_safe(event.info)) {
325331
is_safe = false;
326332
return false;

0 commit comments

Comments
 (0)