Skip to content

Commit e29ff14

Browse files
jkedgarfacebook-github-bot
authored andcommitted
Handle out-of-space on binlog cache file
Summary: The binlog cache file code is designed to handle an error that would cause binlog corruption. It does this by checking the error for a set of values that it expects and when it finds one it marks the cache to indicate an incident has occurred and this mark keeps it from writing corrupt entries to the binlog. Unfortunately, during an out-of-space event, there is a lower level error that gets set which is not being overwritten when we set the expected error. This means that when the code checks for the expected error it is not found - the original lower level error is found. This diff modifies the checking code to scan through all associated conditions (which is a list of all encountered errors) to see if the expected error is present anywhere in the list. This diff can be reverted if/when https://bugs.mysql.com/bug.php?id=72457 is resolved upstream. Reviewed By: hermanlee Differential Revision: D5021615 fbshipit-source-id: 65bcbc7
1 parent 8bae713 commit e29ff14

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

sql/binlog.cc

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3956,15 +3956,22 @@ bool MYSQL_BIN_LOG::check_write_error(THD *thd)
39563956
if (!thd->is_error())
39573957
DBUG_RETURN(checked);
39583958

3959-
switch (thd->get_stmt_da()->sql_errno())
3960-
{
3961-
case ER_TRANS_CACHE_FULL:
3962-
case ER_STMT_CACHE_FULL:
3963-
case ER_ERROR_ON_WRITE:
3964-
case ER_BINLOG_LOGGING_IMPOSSIBLE:
3965-
checked= TRUE;
3966-
break;
3959+
// Check all conditions for one that matches the expected error
3960+
const Sql_condition *err;
3961+
auto it= thd->get_stmt_da()->sql_conditions();
3962+
while ((err= it++) != nullptr && !checked)
3963+
{
3964+
switch (err->get_sql_errno())
3965+
{
3966+
case ER_TRANS_CACHE_FULL:
3967+
case ER_STMT_CACHE_FULL:
3968+
case ER_ERROR_ON_WRITE:
3969+
case ER_BINLOG_LOGGING_IMPOSSIBLE:
3970+
checked= TRUE;
3971+
break;
3972+
}
39673973
}
3974+
39683975
DBUG_PRINT("return", ("checked: %s", YESNO(checked)));
39693976
DBUG_RETURN(checked);
39703977
}

0 commit comments

Comments
 (0)