summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-09-26 13:34:38 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-09-26 13:34:38 +0300
commit6286a05d80f9911b7cd6ba57b04a6f67d39e499d (patch)
tree97a8a27c2d99a4474181e32602414d94944bfd80 /storage
parent0792aff161132fb953510555fe45544991dec95d (diff)
parent3c92050d1c907cc548e848d0ab2891a06681ad92 (diff)
downloadmariadb-git-6286a05d80f9911b7cd6ba57b04a6f67d39e499d.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/que/que0que.cc4
-rw-r--r--storage/innobase/row/row0log.cc6
-rw-r--r--storage/innobase/row/row0purge.cc2
-rw-r--r--storage/maria/ma_check.c2
-rw-r--r--storage/maria/ma_loghandler.c6
-rw-r--r--storage/maria/ma_pagecache.c17
-rw-r--r--storage/maria/unittest/ma_pagecache_single.c6
-rw-r--r--storage/myisam/mi_check.c2
-rw-r--r--storage/myisam/mi_create.c10
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc8
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result12
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test11
-rw-r--r--storage/spider/spd_group_by_handler.cc2
13 files changed, 60 insertions, 28 deletions
diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc
index 121eda36d6d..e70fdd9c522 100644
--- a/storage/innobase/que/que0que.cc
+++ b/storage/innobase/que/que0que.cc
@@ -800,7 +800,7 @@ que_node_get_containing_loop_node(
return(node);
}
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
/** Gets information of an SQL query graph node.
@return type description */
static MY_ATTRIBUTE((warn_unused_result, nonnull))
@@ -857,7 +857,7 @@ que_node_type_string(
return("UNKNOWN NODE TYPE");
}
}
-#endif /* !DBUG_OFF */
+#endif /* DBUG_TRACE */
/**********************************************************************//**
Performs an execution step on a query thread.
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 336b5a27cc2..42d37473755 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2021, MariaDB Corporation.
+Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -2173,6 +2173,7 @@ func_exit:
}
func_exit_committed:
ut_ad(mtr.has_committed());
+ ut_free(pcur.old_rec_buf);
if (error != DB_SUCCESS) {
/* Report the erroneous row using the new
@@ -2360,7 +2361,8 @@ func_exit_committed:
entry = row_build_index_entry(old_row, old_ext, index, heap);
if (!entry) {
ut_ad(0);
- return(DB_CORRUPTION);
+ error = DB_CORRUPTION;
+ goto func_exit_committed;
}
mtr_start(&mtr);
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index c00358eafa9..a268317c7c7 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2021, MariaDB Corporation.
+Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 70a1c976f46..38fd904e52e 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -1069,7 +1069,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
share->state.state.data_file_length) ||
(share->data_file_type == NO_RECORD && record != 0))
{
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
char llbuff2[22], llbuff3[22];
#endif
_ma_check_print_error(param,
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 31884e7de50..30c4d5454bc 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -2661,7 +2661,7 @@ static my_bool translog_buffer_flush(struct st_translog_buffer *buffer)
i < buffer->size;
i+= TRANSLOG_PAGE_SIZE, pg++)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
TRANSLOG_ADDRESS addr= (buffer->offset + i);
#endif
DBUG_PRINT("info", ("send log form %lu till %lu address: " LSN_FMT " "
@@ -2908,7 +2908,7 @@ static my_bool translog_page_validator(int res, PAGECACHE_IO_HOOK_ARGS *args)
uint flags;
uchar *page_pos;
TRANSLOG_FILE *data= (TRANSLOG_FILE *) args->data;
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
pgcache_page_no_t offset= page_no * TRANSLOG_PAGE_SIZE;
#endif
DBUG_ENTER("translog_page_validator");
@@ -3268,7 +3268,7 @@ static my_bool translog_get_last_page_addr(TRANSLOG_ADDRESS *addr,
my_off_t file_size;
uint32 file_no= LSN_FILE_NO(*addr);
TRANSLOG_FILE *file;
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
char buff[21];
#endif
DBUG_ENTER("translog_get_last_page_addr");
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index a2802d909c0..d1cfd578367 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -190,7 +190,7 @@ struct st_pagecache_hash_link
enum PCBLOCK_TEMPERATURE { PCBLOCK_COLD /*free*/ , PCBLOCK_WARM , PCBLOCK_HOT };
/* debug info */
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
static const char *page_cache_page_type_str[]=
{
/* used only for control page type changing during debugging */
@@ -225,8 +225,9 @@ static const char *page_cache_page_pin_str[]=
"unpinned -> pinned",
"pinned -> unpinned"
};
+#endif /* DBUG_TRACE */
-
+#ifndef DBUG_OFF
typedef struct st_pagecache_pin_info
{
struct st_pagecache_pin_info *next, **prev;
@@ -563,7 +564,7 @@ static void pagecache_debug_print _VARARGS((const char *fmt, ...));
#define KEYCACHE_DBUG_ASSERT(a) DBUG_ASSERT(a)
#endif /* defined(PAGECACHE_DEBUG) */
-#if defined(PAGECACHE_DEBUG) || !defined(DBUG_OFF)
+#if defined(PAGECACHE_DEBUG) || defined(DBUG_TRACE)
static my_thread_id pagecache_thread_id;
#define KEYCACHE_THREAD_TRACE(l) \
KEYCACHE_DBUG_PRINT(l,("|thread %lld",pagecache_thread_id))
@@ -581,7 +582,7 @@ static my_thread_id pagecache_thread_id;
#define KEYCACHE_THREAD_TRACE_BEGIN(l)
#define KEYCACHE_THREAD_TRACE_END(l)
#define KEYCACHE_THREAD_TRACE(l)
-#endif /* defined(PAGECACHE_DEBUG) || !defined(DBUG_OFF) */
+#endif /* defined(PAGECACHE_DEBUG) || defined(DBUG_TRACE) */
#define PCBLOCK_NUMBER(p, b) \
((uint) (((char*)(b)-(char *) p->block_root)/sizeof(PAGECACHE_BLOCK_LINK)))
@@ -3714,8 +3715,9 @@ uchar *pagecache_read(PAGECACHE *pagecache,
unlock_pin= lock_to_pin[buff==0][lock].unlock_pin;
PAGECACHE_BLOCK_LINK *fake_link;
my_bool reg_request;
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
char llbuf[22];
+#endif
DBUG_ENTER("pagecache_read");
DBUG_PRINT("enter", ("fd: %u page: %s buffer: %p level: %u "
"t:%s (%d)%s->%s %s->%s big block: %d",
@@ -3731,7 +3733,6 @@ uchar *pagecache_read(PAGECACHE *pagecache,
DBUG_ASSERT(buff != 0 || (buff == 0 && (unlock_pin == PAGECACHE_PIN ||
unlock_pin == PAGECACHE_PIN_LEFT_PINNED)));
DBUG_ASSERT(pageno < ((1ULL) << 40));
-#endif
if (!page_link)
page_link= &fake_link;
@@ -4375,8 +4376,9 @@ my_bool pagecache_write_part(PAGECACHE *pagecache,
my_bool error= 0;
int need_lock_change= write_lock_change_table[lock].need_lock_change;
my_bool reg_request;
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
char llbuf[22];
+#endif
DBUG_ENTER("pagecache_write_part");
DBUG_PRINT("enter", ("fd: %u page: %s level: %u type: %s lock: %s "
"pin: %s mode: %s offset: %u size %u",
@@ -4392,7 +4394,6 @@ my_bool pagecache_write_part(PAGECACHE *pagecache,
DBUG_ASSERT(offset + size <= pagecache->block_size);
DBUG_ASSERT(pageno < ((1ULL) << 40));
DBUG_ASSERT(pagecache->big_block_read == 0);
-#endif
if (!page_link)
page_link= &fake_link;
diff --git a/storage/maria/unittest/ma_pagecache_single.c b/storage/maria/unittest/ma_pagecache_single.c
index 4cd62c52d86..b0a259c85a4 100644
--- a/storage/maria/unittest/ma_pagecache_single.c
+++ b/storage/maria/unittest/ma_pagecache_single.c
@@ -661,14 +661,10 @@ err:
static void *test_thread(void *arg)
{
-#ifndef DBUG_OFF
- int param= *((int*) arg);
-#endif
-
my_thread_init();
{
DBUG_ENTER("test_thread");
- DBUG_PRINT("enter", ("param: %d", param));
+ DBUG_PRINT("enter", ("param: %d", *(int*) arg));
if (!simple_read_write_test() ||
!simple_read_change_write_read_test() ||
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index 16184a1b166..b4187ffc7dc 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -858,7 +858,7 @@ static int chk_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
}
if (record >= info->state->data_file_length)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
char llbuff2[22], llbuff3[22];
#endif
mi_check_print_error(param,"Found key at page %s that points to record outside datafile",llstr(page,llbuff));
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index 30537cef3e7..2837354f869 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -704,7 +704,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if (mi_state_info_write(file, &share.state, 2) ||
mi_base_info_write(file, &share.base))
goto err;
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
if ((uint) mysql_file_tell(file, MYF(0)) != base_pos + MI_BASE_INFO_SIZE)
{
uint pos=(uint) mysql_file_tell(file, MYF(0));
@@ -804,12 +804,12 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if (mi_recinfo_write(file, &recinfo[i]))
goto err;
-#ifndef DBUG_OFF
- if ((uint) mysql_file_tell(file, MYF(0)) != info_length)
+#ifdef DBUG_TRACE
{
uint pos= (uint) mysql_file_tell(file, MYF(0));
- DBUG_PRINT("warning",("info_length: %d != used_length: %d",
- info_length, pos));
+ if (pos != info_length)
+ DBUG_PRINT("warning",("info_length: %d != used_length: %d",
+ info_length, pos));
}
#endif
diff --git a/storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc b/storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc
new file mode 100644
index 00000000000..a5446a6188d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc
@@ -0,0 +1,8 @@
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect
+
+--exec echo "wait" > $_expect_file_name
+--shutdown_server
+--source include/wait_until_disconnected.inc
+--exec echo "restart" > $_expect_file_name
+--enable_reconnect
+--source include/wait_until_connected_again.inc
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result
new file mode 100644
index 00000000000..5715edf2bd6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result
@@ -0,0 +1,12 @@
+CREATE TABLE t (c INT);
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+FLUSH TABLES WITH READ LOCK;
+CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+SELECT * FROM t;
+c
+DROP TABLE t;
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test
new file mode 100644
index 00000000000..00d8ee73ebc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test
@@ -0,0 +1,11 @@
+CREATE TABLE t (c INT);
+SHOW CREATE TABLE t;
+FLUSH TABLES WITH READ LOCK;
+
+--error ER_CANT_UPDATE_WITH_READLOCK
+CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
+SELECT * FROM t;
+
+--source include/restart_spider.inc
+
+DROP TABLE t;
diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc
index 30d81b5a4ae..c7019eec360 100644
--- a/storage/spider/spd_group_by_handler.cc
+++ b/storage/spider/spd_group_by_handler.cc
@@ -1858,6 +1858,8 @@ group_by_handler *spider_create_group_by_handler(
{
for (order = query->order_by; order; order = order->next)
{
+ if ((*order->item)->type() == Item::SUM_FUNC_ITEM)
+ continue;
if (spider_db_print_item_type((*order->item), NULL, spider, NULL, NULL, 0,
roop_count, TRUE, fields_arg))
{