Skip to content

Commit

Permalink
MDEV-15458 Segfault in heap_scan() upon UPDATE after ADD SYSTEM VERSI…
Browse files Browse the repository at this point in the history
…ONING

heap_scan() makes info->next_block to be either an integer number
of share->block.records_in_block's or the total number of
records in the table. So when this total number or records changes,
info->next_block needs to be recalculated to take it into account.

This is a different fix for "Fixes a problem with heap when scanning and insert rows at the same time"
  • Loading branch information
vuvova committed Aug 20, 2019
1 parent 1ad70bf commit 6c06def
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion storage/heap/hp_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ int heap_scan(register HP_INFO *info, uchar *record)
}
else
{
info->next_block+=share->block.records_in_block;
/* increase next_block to the next records_in_block boundary */
ulong rem= info->next_block % share->block.records_in_block;
info->next_block+=share->block.records_in_block - rem;
if (info->next_block >= share->records+share->deleted)
{
info->next_block= share->records+share->deleted;
Expand Down

0 comments on commit 6c06def

Please sign in to comment.