summaryrefslogtreecommitdiff
path: root/storage/maria
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2022-06-06 17:41:46 +0300
committerMonty <monty@mariadb.org>2022-06-06 17:41:46 +0300
commit814c69ea306ca315b9fd8cef50ec5fbcd67e36e9 (patch)
treeef68972d9e1bf15820db1f75ed4e65afd7faf7b5 /storage/maria
parent4179f93d28035ea2798cb1c16feeaaef87ab4775 (diff)
parent4834a0d1fa683ae9cf786368efedc72e64dfbfe0 (diff)
downloadmariadb-git-814c69ea306ca315b9fd8cef50ec5fbcd67e36e9.tar.gz
Merge remote-tracking branch 'origin/10.5' into 10.6
Diffstat (limited to 'storage/maria')
-rw-r--r--storage/maria/ma_cache.c14
-rw-r--r--storage/maria/ma_locking.c2
-rw-r--r--storage/maria/ma_pagecache.c22
3 files changed, 20 insertions, 18 deletions
diff --git a/storage/maria/ma_cache.c b/storage/maria/ma_cache.c
index 764aad0788e..6684a1df20b 100644
--- a/storage/maria/ma_cache.c
+++ b/storage/maria/ma_cache.c
@@ -44,6 +44,9 @@ my_bool _ma_read_cache(MARIA_HA *handler, IO_CACHE *info, uchar *buff,
DBUG_ENTER("_ma_read_cache");
DBUG_ASSERT(!(info->myflags & MY_ENCRYPT));
+ if (unlikely(pos >= info->end_of_file) && (flag & READING_HEADER))
+ DBUG_RETURN(-1);
+
if (pos < info->pos_in_file)
{
read_length=length;
@@ -95,14 +98,17 @@ my_bool _ma_read_cache(MARIA_HA *handler, IO_CACHE *info, uchar *buff,
if (!(flag & READING_HEADER) || (int) read_length == -1 ||
read_length+in_buff_length < 3)
{
+ if ((flag & READING_HEADER) && read_length + in_buff_length == 0)
+ DBUG_RETURN(-1); /* End of file */
+
DBUG_PRINT("error",
- ("Error %d reading next-multi-part block (Got %d bytes)",
- my_errno, (int) read_length));
+ ("Error %d reading next-multi-part block (Got %d of %d bytes)",
+ my_errno, (int) read_length, (int) length));
if (!my_errno || my_errno == HA_ERR_FILE_TOO_SHORT)
{
if (!handler->in_check_table)
- _ma_set_fatal_error(handler->s, HA_ERR_WRONG_IN_RECORD);
- else
+ _ma_set_fatal_error(handler->s, HA_ERR_FILE_TOO_SHORT);
+ if (!my_errno)
my_errno= HA_ERR_WRONG_IN_RECORD;
}
DBUG_RETURN(1);
diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c
index d5985a68c13..e53c3759f13 100644
--- a/storage/maria/ma_locking.c
+++ b/storage/maria/ma_locking.c
@@ -553,7 +553,6 @@ void _ma_mark_file_crashed(MARIA_SHARE *share)
{
uchar buff[2];
DBUG_ENTER("_ma_mark_file_crashed");
- CRASH_IF_S3_TABLE(share);
share->state.changed|= STATE_CRASHED;
if (share->no_status_updates)
@@ -561,7 +560,6 @@ void _ma_mark_file_crashed(MARIA_SHARE *share)
mi_int2store(buff, share->state.changed);
-
/*
We can ignore the errors, as if the mark failed, there isn't anything
else we can do; The user should already have got an error that the
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index 6efc8173915..de85ec51deb 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -2893,10 +2893,14 @@ static void read_big_block(PAGECACHE *pagecache,
if (pagecache->big_block_read(pagecache, &args, &block->hash_link->file,
&data))
{
+ pagecache->big_block_free(&data);
pagecache_pthread_mutex_lock(&pagecache->cache_lock);
block_to_read->status|= PCBLOCK_ERROR;
block_to_read->error= (int16) my_errno;
- pagecache->big_block_free(&data);
+
+ /* Handle the block that we originally wanted with read */
+ block->status|= PCBLOCK_ERROR;
+ block->error= block_to_read->error;
goto error;
}
@@ -2980,6 +2984,7 @@ end:
block_to_read->status&= ~PCBLOCK_BIG_READ;
if (block_to_read != block)
{
+ /* Unlock the 'first block' in the big read */
remove_reader(block_to_read);
unreg_request(pagecache, block_to_read, 1);
}
@@ -2993,18 +2998,11 @@ error:
Read failed. Mark all readers waiting for the a block covered by the
big block that the read failed
*/
- for (offset= pagecache->block_size, page= page_to_read + 1;
- offset < data.length;
- offset+= pagecache->block_size, page++)
+ for (offset= 0, page= page_to_read + 1;
+ offset < big_block_size_in_pages;
+ offset++)
{
- DBUG_ASSERT(offset + pagecache->block_size <= data.length);
- if (page == our_page)
- {
- DBUG_ASSERT(!(block->status & PCBLOCK_READ));
- block->status|= PCBLOCK_ERROR;
- block->error= (int16) my_errno;
- }
- else
+ if (page != our_page)
{
PAGECACHE_BLOCK_LINK *bl;
bl= find_block(pagecache, &block->hash_link->file, page, 1,