Skip to content

Commit

Permalink
MDEV-14868 MariaDB server crashes after using ROLLBACK TO when encryp…
Browse files Browse the repository at this point in the history
…t_tmp_files=ON

Fix reinit_io_cache(WRITE_CACHE) with non-zero seek_offset.
Run encryption.tempfiles with and without binlog checksums.
  • Loading branch information
vuvova committed Feb 8, 2018
1 parent 47d1679 commit 60dfe12
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions mysql-test/suite/encryption/t/tempfiles.combinations
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[none]
binlog-checksum=NONE

[crc32]
binlog-checksum=CRC32
2 changes: 1 addition & 1 deletion mysys/mf_iocache.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
info->read_end= info->buffer;
_my_b_encr_read(info, 0, 0); /* prefill the buffer */
info->write_pos= info->read_pos;
info->pos_in_file+= info->buffer_length;
info->seek_not_done=1;
}
}
else
Expand Down
5 changes: 3 additions & 2 deletions sql/mf_iocache_encr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)

if (info->seek_not_done)
{
DBUG_ASSERT(info->pos_in_file == 0);
DBUG_ASSERT(info->pos_in_file % info->buffer_length == 0);
size_t wpos= info->pos_in_file / info->buffer_length * crypt_data->block_length;

if ((mysql_file_seek(info->file, 0, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR))
if ((mysql_file_seek(info->file, wpos, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR))
{
info->error= -1;
DBUG_RETURN(1);
Expand Down

0 comments on commit 60dfe12

Please sign in to comment.