Merge branch '10.5' into '10.6'

This commit is contained in:
Julius Goryavsky 2024-12-13 01:45:35 +01:00
commit 155203c352
17 changed files with 153 additions and 131 deletions

View File

@ -208,6 +208,23 @@ use `a
b`;
SET timestamp=1234567890;
select count(*) from mysql.global_priv where length(priv)>2
#
# MDEV-31366 Assertion `thd->start_time' failed in bool LOGGER::slow_log_print(THD*, const char*, size_t, ulonglong)
#
TRUNCATE mysql.slow_log;
SET global log_output='TABLE';
SET timestamp=0.99;
SET long_query_time=0.00001;
SELECT SLEEP(0.1);
SLEEP(0.1)
0
SELECT COUNT(*)>0 AS c1 FROM mysql.slow_log;
c1
1
SET global log_output=default;
SET timestamp=default;
SET long_query_time=default;
TRUNCATE mysql.slow_log;
# End of 10.5 tests
#
# MDEV-34251 Conditional jump or move depends on uninitialised value in

View File

@ -224,6 +224,21 @@ let SEARCH_PATTERN= use \`a\n.*2;
let SEARCH_OUTPUT=matches;
source include/search_pattern_in_file.inc;
--echo #
--echo # MDEV-31366 Assertion `thd->start_time' failed in bool LOGGER::slow_log_print(THD*, const char*, size_t, ulonglong)
--echo #
TRUNCATE mysql.slow_log;
SET global log_output='TABLE';
SET timestamp=0.99;
SET long_query_time=0.00001;
SELECT SLEEP(0.1);
SELECT COUNT(*)>0 AS c1 FROM mysql.slow_log;
SET global log_output=default;
SET timestamp=default;
SET long_query_time=default;
TRUNCATE mysql.slow_log;
--echo # End of 10.5 tests
--echo #

View File

@ -2037,7 +2037,7 @@ SUCCESS
execute stmt;
Warnings:
Note 1050 Table 't2' already exists
call p_verify_reprepare_count(1);
call p_verify_reprepare_count(0);
SUCCESS
select * from t2;

View File

@ -1686,7 +1686,7 @@ drop table t2;
execute stmt;
call p_verify_reprepare_count(0);
execute stmt;
call p_verify_reprepare_count(1);
call p_verify_reprepare_count(0);
select * from t2;
execute stmt;
call p_verify_reprepare_count(0);

View File

@ -10,6 +10,5 @@
#
##############################################################################
galera_sequences : MDEV-32561 WSREP FSM failure: no such a transition REPLICATING -> COMMITTED
galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback()
galera_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback()

View File

@ -314,3 +314,14 @@ NEXTVAL(t)
connection node_1;
DROP TABLE t1;
DROP SEQUENCE t;
MDEV-33245 SIGSEGV in wsrep_check_sequence | Sql_cmd_alter_sequence::execute
CREATE TABLE t (a INT) ENGINE=InnoDB;
INSERT INTO t VALUES (0);
CREATE TABLE t1 (c VARCHAR) ENGINE=InnoDB;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ENGINE=InnoDB' at line 1
ALTER SEQUENCE IF EXISTS t MINVALUE=1;
ERROR 42000: This version of MariaDB doesn't yet support 'CACHE without INCREMENT BY 0 in Galera cluster'
DROP TABLE t;
End of 10.5 tests

View File

@ -341,3 +341,18 @@ SELECT NEXTVAL(t);
--connection node_1
DROP TABLE t1;
DROP SEQUENCE t;
--echo
--echo MDEV-33245 SIGSEGV in wsrep_check_sequence | Sql_cmd_alter_sequence::execute
--echo
CREATE TABLE t (a INT) ENGINE=InnoDB;
INSERT INTO t VALUES (0);
--error ER_PARSE_ERROR
CREATE TABLE t1 (c VARCHAR) ENGINE=InnoDB;
--error ER_NOT_SUPPORTED_YET
ALTER SEQUENCE IF EXISTS t MINVALUE=1;
DROP TABLE t;
--echo End of 10.5 tests

View File

@ -250,7 +250,7 @@ my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements)
if (!(new_ptr= (uchar *) my_malloc(array->m_psi_key, size *
array->size_of_element,
MYF(array->malloc_flags | MY_WME))))
DBUG_RETURN(0);
DBUG_RETURN(TRUE);
memcpy(new_ptr, array->buffer,
array->elements * array->size_of_element);
array->malloc_flags&= ~MY_INIT_BUFFER_USED;

View File

@ -6,8 +6,6 @@ IF(WIN32 OR WITHOUT_SERVER)
RETURN()
ENDIF()
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated-declarations")
INCLUDE_DIRECTORIES(libhsclient)
# Handlersocket client library. We do not distribute it,

View File

@ -9,6 +9,11 @@
#ifndef DENA_DATABASE_HPP
#define DENA_DATABASE_HPP
#ifdef __GNUC__
/* auto_ptr is deprecated */
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include <string>
#include <memory>
#include <vector>

View File

@ -19,6 +19,11 @@
#include "string_ref.hpp"
#include "string_buffer.hpp"
#ifdef __GNUC__
/* auto_ptr is deprecated */
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
namespace dena {
struct hstcpcli_filter {

View File

@ -1117,7 +1117,7 @@ get_openssl()
{
# If the OPENSSL_BINARY variable is already defined, just return:
if [ -n "${OPENSSL_BINARY+x}" ]; then
return
return 0
fi
# Let's look for openssl:
OPENSSL_BINARY=$(commandex 'openssl')
@ -1556,7 +1556,7 @@ cleanup_pid()
fi
done
elif ps -p $pid >/dev/null 2>&1; then
wsrep_log_warning "Unable to kill PID=$pid ($pid_file)"
wsrep_log_warning "Unable to kill PID=$pid${pid_file:+ ($pid_file)}"
return 1
fi
fi
@ -1863,6 +1863,8 @@ create_dirs()
cd "$OLD_PWD"
[ $simplify -ne 0 -a "$ar_log_dir" = "$DATA_DIR" ] && ar_log_dir=""
fi
return 0
}
wait_previous_sst()

View File

@ -439,17 +439,30 @@ get_transfer()
get_footprint()
{
cd "$DATA_DIR"
local payload_data=$(find $findopt . \
-regex '.*undo[0-9]+$\|.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \
-type f -print0 | du --files0-from=- --block-size=1 -c -s | \
awk 'END { print $1 }')
local payload_data
if [ "$OS" = 'Linux' ]; then
payload_data=$(find $findopt . \
-regex '.*undo[0-9]+$\|.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \
-type f -print0 | du --files0-from=- --bytes -c -s | \
awk 'END { print $1 }')
else
payload_data=$(find $findopt . \
-regex '.*undo[0-9]+$|.*\.ibd$|.*\.MYI$\.*\.MYD$|.*ibdata1$' \
-type f -print0 | xargs -0 stat -f '%z' | \
awk '{ sum += $1 } END { print sum }')
fi
local payload_undo=0
if [ -n "$ib_undo_dir" -a "$ib_undo_dir" != '.' -a \
"$ib_undo_dir" != "$DATA_DIR" -a -d "$ib_undo_dir" ]
then
cd "$ib_undo_dir"
payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \
du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }')
if [ "$OS" = 'Linux' ]; then
payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \
du --files0-from=- --bytes -c -s | awk 'END { print $1 }')
else
payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \
xargs -0 stat -f '%z' | awk '{ sum += $1 } END { print sum }')
fi
fi
cd "$OLD_PWD"
@ -676,24 +689,25 @@ cleanup_at_exit()
[ "$(pwd)" != "$OLD_PWD" ] && cd "$OLD_PWD"
if [ $estatus -ne 0 ]; then
wsrep_log_error "Removing $MAGIC_FILE file due to signal"
if [ "$WSREP_SST_OPT_ROLE" = 'donor' -o $estatus -ne 0 ]; then
if [ $estatus -ne 0 ]; then
wsrep_log_error "Removing $MAGIC_FILE file due to signal"
fi
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" || :
[ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE" || :
[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || :
fi
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
if [ -n "$BACKUP_PID" ]; then
if ps -p $BACKUP_PID >/dev/null 2>&1; then
wsrep_log_error \
"mariadb-backup process is still running. Killing..."
cleanup_pid $CHECK_PID
"SST streaming process is still running. Killing..."
cleanup_pid $BACKUP_PID
fi
fi
wsrep_log_info "Removing the sst_in_progress file"
wsrep_cleanup_progress_file
else
[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || :
fi
if [ -n "$progress" -a -p "$progress" ]; then
@ -1346,6 +1360,7 @@ else # joiner
[ -f "$DATA/xtrabackup_checkpoints" ] && rm -f "$DATA/xtrabackup_checkpoints"
[ -f "$DATA/xtrabackup_info" ] && rm -f "$DATA/xtrabackup_info"
[ -f "$DATA/xtrabackup_slave_info" ] && rm -f "$DATA/xtrabackup_slave_info"
[ -f "$DATA/xtrabackup_binlog_info" ] && rm -f "$DATA/xtrabackup_binlog_info"
[ -f "$DATA/xtrabackup_binlog_pos_innodb" ] && rm -f "$DATA/xtrabackup_binlog_pos_innodb"
TDATA="$DATA"

View File

@ -1334,7 +1334,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, size_t query_length,
user_host_buff);
DBUG_ASSERT(thd->start_utime);
DBUG_ASSERT(thd->start_time);
DBUG_ASSERT(thd->start_time || thd->start_time_sec_part);
query_utime= (current_utime - thd->start_utime);
lock_utime= (thd->utime_after_lock - thd->start_utime);
my_hrtime_t current_time= { hrtime_from_time(thd->start_time) +

View File

@ -76,12 +76,32 @@ static inline void output_core_info()
if ((fd= open("/proc/self/limits", O_RDONLY)) >= 0)
#endif
{
my_safe_printf_stderr("Resource Limits:\n");
while ((len= read(fd, (uchar*)buff, sizeof(buff))) > 0)
{
my_write_stderr(buff, len);
}
char *endline= buff;
ssize_t remain_len= len= read(fd, buff, sizeof(buff));
close(fd);
my_safe_printf_stderr("Resource Limits (excludes unlimited resources):\n");
/* first line, header */
endline= (char *) memchr(buff, '\n', remain_len);
if (endline)
{
endline++;
remain_len= buff + len - endline;
my_safe_printf_stderr("%.*s", (int) (endline - buff), buff);
while (remain_len > 27)
{
char *newendline= (char *) memchr(endline, '\n', remain_len);
if (!newendline)
break;
*newendline= '\0';
newendline++;
if (endline[26] != 'u') /* skip unlimited limits */
my_safe_printf_stderr("%s\n", endline);
remain_len-= newendline - endline;
endline= newendline;
}
}
}
#ifdef __linux__
if ((fd= open("/proc/sys/kernel/core_pattern", O_RDONLY)) >= 0)
@ -144,7 +164,6 @@ extern "C" sig_handler handle_fatal_signal(int sig)
We will try and print the query at the end of the signal handler, in case
we're wrong.
*/
bool print_invalid_query_pointer= false;
#endif
if (segfaulted)
@ -174,57 +193,19 @@ extern "C" sig_handler handle_fatal_signal(int sig)
goto end;
}
my_safe_printf_stderr("[ERROR] mysqld got " SIGNAL_FMT " ;\n",sig);
my_safe_printf_stderr("[ERROR] %s got " SIGNAL_FMT " ;\n", my_progname, sig);
my_safe_printf_stderr("%s",
"Sorry, we probably made a mistake, and this is a bug.\n\n"
"Your assistance in bug reporting will enable us to fix this for the next release.\n"
"To report this bug, see https://mariadb.com/kb/en/reporting-bugs\n\n");
my_safe_printf_stderr("%s",
"We will try our best to scrape up some info that will hopefully help\n"
"diagnose the problem, but since we have already crashed, \n"
"something is definitely wrong and this may fail.\n\n");
"To report this bug, see https://mariadb.com/kb/en/reporting-bugs about how to report\n"
"a bug on https://jira.mariadb.org/.\n\n"
"Please include the information from the server start above, to the end of the\n"
"information below.\n\n");
set_server_version(server_version, sizeof(server_version));
my_safe_printf_stderr("Server version: %s source revision: %s\n",
server_version, SOURCE_REVISION);
if (dflt_key_cache)
my_safe_printf_stderr("key_buffer_size=%zu\n",
dflt_key_cache->key_cache_mem_size);
my_safe_printf_stderr("read_buffer_size=%lu\n",
global_system_variables.read_buff_size);
my_safe_printf_stderr("max_used_connections=%lu\n",
max_used_connections);
if (thread_scheduler)
my_safe_printf_stderr("max_threads=%lu\n",
thread_scheduler->max_threads +
extra_max_connections);
my_safe_printf_stderr("thread_count=%u\n", THD_count::value());
if (dflt_key_cache && thread_scheduler)
{
size_t used_mem=
(dflt_key_cache->key_cache_mem_size +
(global_system_variables.read_buff_size +
(size_t) global_system_variables.sortbuff_size) *
(thread_scheduler->max_threads + extra_max_connections) +
(max_connections + extra_max_connections) * sizeof(THD)) / 1024;
my_safe_printf_stderr("It is possible that mysqld could use up to \n"
"key_buffer_size + "
"(read_buffer_size + sort_buffer_size)*max_threads = "
"%zu K bytes of memory\n", used_mem);
my_safe_printf_stderr("%s",
"Hope that's ok; if not, decrease some variables in "
"the equation.\n\n");
}
my_safe_printf_stderr("Server version: %s source revision: %s\n\n",
server_version, SOURCE_REVISION);
#ifdef WITH_WSREP
Wsrep_server_state::handle_fatal_signal();
@ -235,12 +216,14 @@ extern "C" sig_handler handle_fatal_signal(int sig)
if (opt_stack_trace)
{
my_safe_printf_stderr("Thread pointer: %p\n", thd);
my_safe_printf_stderr("%s",
"Attempting backtrace. You can use the following "
"information to find out\n"
"where mysqld died. If you see no messages after this, something went\n"
"terribly wrong...\n");
"The information page at "
"https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/\n"
"contains instructions to obtain a better version of the backtrace below.\n"
"Following these instructions will help MariaDB developers provide a fix quicker.\n\n"
"Attempting backtrace. Include this in the bug report.\n"
"(note: Retrieving this information may fail)\n\n");
my_safe_printf_stderr("Thread pointer: %p\n", thd);
my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL,
(ulong)my_thread_stack_size, 0);
}
@ -288,20 +271,12 @@ extern "C" sig_handler handle_fatal_signal(int sig)
kreason= "KILL_WAIT_TIMEOUT";
break;
}
my_safe_printf_stderr("%s", "\n"
"Trying to get some variables.\n"
"Some pointers may be invalid and cause the dump to abort.\n");
my_safe_printf_stderr("Query (%p): ", thd->query());
if (my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length())))
{
// Query was found invalid. We will try to print it at the end.
print_invalid_query_pointer= true;
}
my_safe_printf_stderr("\nConnection ID (thread ID): %lu\n",
(ulong) thd->thread_id);
my_safe_printf_stderr("Status: %s\n\n", kreason);
my_safe_printf_stderr("Status: %s\n", kreason);
my_safe_printf_stderr("Query (%p): ", thd->query());
my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length()));
my_safe_printf_stderr("%s", "Optimizer switch: ");
ulonglong optsw= thd->variables.optimizer_switch;
for (uint i= 0; optimizer_switch_names[i+1]; i++, optsw >>= 1)
@ -313,52 +288,9 @@ extern "C" sig_handler handle_fatal_signal(int sig)
}
my_safe_printf_stderr("%s", "\n\n");
}
my_safe_printf_stderr("%s",
"The manual page at "
"https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/ contains\n"
"information that should help you find out what is causing the crash.\n");
#endif /* HAVE_STACKTRACE */
#ifdef HAVE_INITGROUPS
if (calling_initgroups)
{
my_safe_printf_stderr("%s", "\n"
"This crash occurred while the server was calling initgroups(). This is\n"
"often due to the use of a mysqld that is statically linked against \n"
"glibc and configured to use LDAP in /etc/nsswitch.conf.\n"
"You will need to either upgrade to a version of glibc that does not\n"
"have this problem (2.3.4 or later when used with nscd),\n"
"disable LDAP in your nsswitch.conf, or use a "
"mysqld that is not statically linked.\n");
}
#endif
if (locked_in_memory)
{
my_safe_printf_stderr("%s", "\n"
"The \"--memlock\" argument, which was enabled, "
"uses system calls that are\n"
"unreliable and unstable on some operating systems and "
"operating-system versions (notably, some versions of Linux).\n"
"This crash could be due to use of those buggy OS calls.\n"
"You should consider whether you really need the "
"\"--memlock\" parameter and/or consult the OS distributer about "
"\"mlockall\" bugs.\n");
}
#ifdef HAVE_STACKTRACE
if (print_invalid_query_pointer)
{
my_safe_printf_stderr(
"\nWe think the query pointer is invalid, but we will try "
"to print it anyway. \n"
"Query: ");
my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length()));
my_safe_printf_stderr("\n\n");
}
#endif
output_core_info();
#ifdef HAVE_WRITE_CORE
if (test_flags & TEST_CORE_ON_SIGNAL)

View File

@ -7530,6 +7530,7 @@ alter:
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_ALTER_SEQUENCE;
lex->create_info.init();
DBUG_ASSERT(!lex->m_sql_cmd);
if (Lex->main_select_push())
MYSQL_YYABORT;

View File

@ -10029,7 +10029,14 @@ bool TABLE_LIST::is_the_same_definition(THD* thd, TABLE_SHARE *s)
tabledef_version.length= 0;
}
else
{
set_tabledef_version(s);
if (m_table_ref_type == TABLE_REF_NULL)
{
set_table_ref_id(s);
return TRUE;
}
}
return FALSE;
}