1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-31646 Online alter applies binlog cache limit to cache writes

1. Make online disk writes unlimited, same as filesort does.
2. Make proper error handling -- in 32-bit build IO_CACHE capacity limit is
4GB, so it is quite possible to overfill there.
3. Event_log::write_cache complicated with event reparsing, and as it was
proven by QA, contains some mistakes. Rewrite introbuce a simpler and much
faster version, not featuring reparsing and therefore copying a whole
buffer at once. This also disables checksums and crypto.
4. Handle read_log_event errors correctly: error returned is -1 (eof
signal for alter table), and my_error is not called. Call my_error and
always return 1. There's no test for this, since it shouldn't happen,
see the next bullet.
5. An event could be written partially in case of error, if it's bigger
than the IO_CACHE buffer. Restore the position where it was before the
error was emitted.

As a result, online alter is untied of several binlog variables, which was
a second aim of this patch.
This commit is contained in:
Nikita Malyavin
2023-07-13 18:15:28 +04:00
committed by Sergei Golubchik
parent 2cecb5a638
commit d5e59c983f
5 changed files with 176 additions and 22 deletions

View File

@ -11666,8 +11666,14 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
{
const auto *descr_event= rgi->rli->relay_log.description_event_for_exec;
auto *ev= Log_event::read_log_event(log_file, descr_event, false);
if (!ev)
error= log_file->error;
if (unlikely(!ev))
{
if (error)
my_error(ER_IO_READ_ERROR,MYF(0), (ulong)EIO, strerror(EIO), "");
break;
}
DBUG_ASSERT(!error);
ev->thd= thd;
error= ev->apply_event(rgi);
@ -11680,7 +11686,7 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
} while(!error);
thd->pop_internal_handler();
return error;
return MY_TEST(error);
}
#endif