Commit 814c69ea authored by Monty's avatar Monty

Merge remote-tracking branch 'origin/10.5' into 10.6

parents 4179f93d 4834a0d1
......@@ -2194,3 +2194,22 @@ SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::1';
f
::
DROP TABLE t1;
#
# MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)"
#
CREATE TABLE companies (id INET6, name varchar(10));
INSERT INTO companies (id) values ('00::01');
CREATE TABLE divisions (company_id INET6);
INSERT INTO divisions (company_id) values ('00::01');
SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions);
id name
::1 NULL
UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions);
SELECT * FROM companies;
id name
::1 value
DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions);
SELECT * FROM companies;
id name
DROP TABLE divisions;
DROP TABLE companies;
......@@ -1612,3 +1612,21 @@ SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '';
SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::';
SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::1';
DROP TABLE t1;
--echo #
--echo # MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)"
--echo #
CREATE TABLE companies (id INET6, name varchar(10));
INSERT INTO companies (id) values ('00::01');
CREATE TABLE divisions (company_id INET6);
INSERT INTO divisions (company_id) values ('00::01');
SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions);
UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions);
SELECT * FROM companies;
DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions);
SELECT * FROM companies;
DROP TABLE divisions;
DROP TABLE companies;
......@@ -1113,9 +1113,14 @@ class Item_cache_inet6: public Item_cache
if (!example)
return false;
value_cached= true;
null_value= example->val_native_with_conversion_result(current_thd,
&m_value,
type_handler());
/*
Merge comments: in 10.7 this code migrated to
Item_cache_fbt in to sql/sql_type_fixedbin.h
*/
null_value_inside= null_value=
example->val_native_with_conversion_result(current_thd,
&m_value,
type_handler());
return true;
}
String* val_str(String *to)
......
......@@ -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);
......
......@@ -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
......
......@@ -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 @@ static void read_big_block(PAGECACHE *pagecache,
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 @@ static void read_big_block(PAGECACHE *pagecache,
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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment