summaryrefslogtreecommitdiff
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
parent4179f93d28035ea2798cb1c16feeaaef87ab4775 (diff)
parent4834a0d1fa683ae9cf786368efedc72e64dfbfe0 (diff)
downloadmariadb-git-814c69ea306ca315b9fd8cef50ec5fbcd67e36e9.tar.gz
Merge remote-tracking branch 'origin/10.5' into 10.6
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.result19
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.test18
-rw-r--r--plugin/type_inet/sql_type_inet.cc11
-rw-r--r--storage/maria/ma_cache.c14
-rw-r--r--storage/maria/ma_locking.c2
-rw-r--r--storage/maria/ma_pagecache.c22
6 files changed, 65 insertions, 21 deletions
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
index 0ac5f666b86..9f3b8a9715e 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
@@ -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;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
index 6a5db1ad43f..ef8399d981f 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
@@ -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;
diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc
index 10ccca2da75..488a569ef7d 100644
--- a/plugin/type_inet/sql_type_inet.cc
+++ b/plugin/type_inet/sql_type_inet.cc
@@ -1113,9 +1113,14 @@ public:
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)
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,