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'; ...@@ -2194,3 +2194,22 @@ SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::1';
f f
:: ::
DROP TABLE t1; 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 != ''; ...@@ -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 != '::';
SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::1'; SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::1';
DROP TABLE t1; 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 ...@@ -1113,9 +1113,14 @@ class Item_cache_inet6: public Item_cache
if (!example) if (!example)
return false; return false;
value_cached= true; value_cached= true;
null_value= example->val_native_with_conversion_result(current_thd, /*
&m_value, Merge comments: in 10.7 this code migrated to
type_handler()); 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; return true;
} }
String* val_str(String *to) String* val_str(String *to)
......
...@@ -44,6 +44,9 @@ my_bool _ma_read_cache(MARIA_HA *handler, IO_CACHE *info, uchar *buff, ...@@ -44,6 +44,9 @@ my_bool _ma_read_cache(MARIA_HA *handler, IO_CACHE *info, uchar *buff,
DBUG_ENTER("_ma_read_cache"); DBUG_ENTER("_ma_read_cache");
DBUG_ASSERT(!(info->myflags & MY_ENCRYPT)); 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) if (pos < info->pos_in_file)
{ {
read_length=length; read_length=length;
...@@ -95,14 +98,17 @@ my_bool _ma_read_cache(MARIA_HA *handler, IO_CACHE *info, uchar *buff, ...@@ -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 || if (!(flag & READING_HEADER) || (int) read_length == -1 ||
read_length+in_buff_length < 3) 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", DBUG_PRINT("error",
("Error %d reading next-multi-part block (Got %d bytes)", ("Error %d reading next-multi-part block (Got %d of %d bytes)",
my_errno, (int) read_length)); my_errno, (int) read_length, (int) length));
if (!my_errno || my_errno == HA_ERR_FILE_TOO_SHORT) if (!my_errno || my_errno == HA_ERR_FILE_TOO_SHORT)
{ {
if (!handler->in_check_table) if (!handler->in_check_table)
_ma_set_fatal_error(handler->s, HA_ERR_WRONG_IN_RECORD); _ma_set_fatal_error(handler->s, HA_ERR_FILE_TOO_SHORT);
else if (!my_errno)
my_errno= HA_ERR_WRONG_IN_RECORD; my_errno= HA_ERR_WRONG_IN_RECORD;
} }
DBUG_RETURN(1); DBUG_RETURN(1);
......
...@@ -553,7 +553,6 @@ void _ma_mark_file_crashed(MARIA_SHARE *share) ...@@ -553,7 +553,6 @@ void _ma_mark_file_crashed(MARIA_SHARE *share)
{ {
uchar buff[2]; uchar buff[2];
DBUG_ENTER("_ma_mark_file_crashed"); DBUG_ENTER("_ma_mark_file_crashed");
CRASH_IF_S3_TABLE(share);
share->state.changed|= STATE_CRASHED; share->state.changed|= STATE_CRASHED;
if (share->no_status_updates) if (share->no_status_updates)
...@@ -561,7 +560,6 @@ void _ma_mark_file_crashed(MARIA_SHARE *share) ...@@ -561,7 +560,6 @@ void _ma_mark_file_crashed(MARIA_SHARE *share)
mi_int2store(buff, share->state.changed); mi_int2store(buff, share->state.changed);
/* /*
We can ignore the errors, as if the mark failed, there isn't anything 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 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, ...@@ -2893,10 +2893,14 @@ static void read_big_block(PAGECACHE *pagecache,
if (pagecache->big_block_read(pagecache, &args, &block->hash_link->file, if (pagecache->big_block_read(pagecache, &args, &block->hash_link->file,
&data)) &data))
{ {
pagecache->big_block_free(&data);
pagecache_pthread_mutex_lock(&pagecache->cache_lock); pagecache_pthread_mutex_lock(&pagecache->cache_lock);
block_to_read->status|= PCBLOCK_ERROR; block_to_read->status|= PCBLOCK_ERROR;
block_to_read->error= (int16) my_errno; 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; goto error;
} }
...@@ -2980,6 +2984,7 @@ static void read_big_block(PAGECACHE *pagecache, ...@@ -2980,6 +2984,7 @@ static void read_big_block(PAGECACHE *pagecache,
block_to_read->status&= ~PCBLOCK_BIG_READ; block_to_read->status&= ~PCBLOCK_BIG_READ;
if (block_to_read != block) if (block_to_read != block)
{ {
/* Unlock the 'first block' in the big read */
remove_reader(block_to_read); remove_reader(block_to_read);
unreg_request(pagecache, block_to_read, 1); unreg_request(pagecache, block_to_read, 1);
} }
...@@ -2993,18 +2998,11 @@ static void read_big_block(PAGECACHE *pagecache, ...@@ -2993,18 +2998,11 @@ static void read_big_block(PAGECACHE *pagecache,
Read failed. Mark all readers waiting for the a block covered by the Read failed. Mark all readers waiting for the a block covered by the
big block that the read failed big block that the read failed
*/ */
for (offset= pagecache->block_size, page= page_to_read + 1; for (offset= 0, page= page_to_read + 1;
offset < data.length; offset < big_block_size_in_pages;
offset+= pagecache->block_size, page++) offset++)
{ {
DBUG_ASSERT(offset + pagecache->block_size <= data.length); if (page != our_page)
if (page == our_page)
{
DBUG_ASSERT(!(block->status & PCBLOCK_READ));
block->status|= PCBLOCK_ERROR;
block->error= (int16) my_errno;
}
else
{ {
PAGECACHE_BLOCK_LINK *bl; PAGECACHE_BLOCK_LINK *bl;
bl= find_block(pagecache, &block->hash_link->file, page, 1, 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