Commit 646a6005 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.1 into 10.2

parents 6b6c012f 67a03b7c
...@@ -122,7 +122,7 @@ ENDIF() ...@@ -122,7 +122,7 @@ ENDIF()
IF(UNIX) IF(UNIX)
SET(WITH_EXTRA_CHARSETS all CACHE STRING "") SET(WITH_EXTRA_CHARSETS all CACHE STRING "")
SET(PLUGIN_AUTH_PAM YES) SET(PLUGIN_AUTH_PAM YES CACHE BOOL "")
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(NOT IGNORE_AIO_CHECK) IF(NOT IGNORE_AIO_CHECK)
......
...@@ -1043,10 +1043,14 @@ inline_mysql_socket_accept ...@@ -1043,10 +1043,14 @@ inline_mysql_socket_accept
#else #else
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length); socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
#ifdef FD_CLOEXEC #ifdef FD_CLOEXEC
flags= fcntl(socket_accept.fd, F_GETFD); if (socket_accept.fd != INVALID_SOCKET)
if (flags != -1) { {
flags |= FD_CLOEXEC; flags= fcntl(socket_accept.fd, F_GETFD);
fcntl(socket_accept.fd, F_SETFD, flags); if (flags != -1)
{
flags |= FD_CLOEXEC;
fcntl(socket_accept.fd, F_SETFD, flags);
}
} }
#endif #endif
#endif #endif
...@@ -1065,10 +1069,14 @@ inline_mysql_socket_accept ...@@ -1065,10 +1069,14 @@ inline_mysql_socket_accept
#else #else
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length); socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
#ifdef FD_CLOEXEC #ifdef FD_CLOEXEC
flags= fcntl(socket_accept.fd, F_GETFD); if (socket_accept.fd != INVALID_SOCKET)
if (flags != -1) { {
flags |= FD_CLOEXEC; flags= fcntl(socket_accept.fd, F_GETFD);
fcntl(socket_accept.fd, F_SETFD, flags); if (flags != -1)
{
flags |= FD_CLOEXEC;
fcntl(socket_accept.fd, F_SETFD, flags);
}
} }
#endif #endif
#endif #endif
......
...@@ -52,3 +52,20 @@ body ...@@ -52,3 +52,20 @@ body
DROP FUNCTION IF EXISTS f1; DROP FUNCTION IF EXISTS f1;
Warnings: Warnings:
Note 1305 FUNCTION test.f1 does not exist Note 1305 FUNCTION test.f1 does not exist
#
# 10.1 Test
#
# MDEV-22654: Assertion `!is_set() || (m_status == DA_OK_BULK &&
# is_bulk_op())' failed in Diagnostics_area::set_ok_status on FUNCTION replace
#
SET GLOBAL log_bin_trust_function_creators=0;
CREATE FUNCTION f(c INT) RETURNS NUMERIC NO SQL RETURN 0;
CREATE OR REPLACE FUNCTION f(c INT) RETURNS INT RETURN 0;
ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
CREATE OR REPLACE FUNCTION sp1_thisisaveryverylongnamelongnameverylongname_thisisaveryverylongname234872934(a INT) RETURNS INT RETURN 0;
ERROR 42000: Identifier name 'sp1_thisisaveryverylongnamelongnameverylongname_thisisaveryverylongname234872934' is too long
DROP FUNCTION IF EXISTS f;
Warnings:
Note 1305 FUNCTION test.f does not exist
SET GLOBAL log_bin_trust_function_creators=1;
# End of 10.1 Test
...@@ -3301,6 +3301,61 @@ SET @@sort_buffer_size= @save_sort_buffer_size; ...@@ -3301,6 +3301,61 @@ SET @@sort_buffer_size= @save_sort_buffer_size;
SET @@max_sort_length= @save_max_sort_length; SET @@max_sort_length= @save_max_sort_length;
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-22390: Assertion `m_next_rec_ptr >= m_rawmem' failed in Filesort_buffer::spaceleft |
# SIGSEGV in __memmove_avx_unaligned_erms from my_b_write (on optimized)
#
SET @save_max_sort_length= @@max_sort_length;
SET @save_sort_buffer_size= @@sort_buffer_size;
SET @save_max_length_for_sort_data= @@max_length_for_sort_data;
SET max_sort_length=8;
SET sort_buffer_size=1024;
SET max_length_for_sort_data=7000;
CREATE TABLE t1(a VARCHAR(64), b VARCHAR(2048))DEFAULT CHARSET=utf8;
INSERT INTO t1 SELECT seq,seq from seq_1_to_100;
ANALYZE FORMAT=JSON SELECT * FROM t1 ORDER BY a LIMIT 5;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"read_sorted_file": {
"r_rows": 5,
"filesort": {
"sort_key": "t1.a",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_limit": 5,
"r_used_priority_queue": false,
"r_output_rows": 35,
"r_sort_passes": 1,
"r_buffer_size": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 100,
"r_rows": 100,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
}
}
}
}
SELECT * FROM t1 ORDER BY a LIMIT 5;
a b
1 1
10 10
100 100
11 11
12 12
SET max_sort_length= @save_max_sort_length;
SET sort_buffer_size= @save_sort_buffer_size;
SET max_length_for_sort_data= @save_max_length_for_sort_data;
DROP TABLE t1;
#
# MDEV-13994: Bad join results with orderby_uses_equalities=on # MDEV-13994: Bad join results with orderby_uses_equalities=on
# #
CREATE TABLE books ( CREATE TABLE books (
......
...@@ -16,3 +16,7 @@ SELECT * FROM t; ...@@ -16,3 +16,7 @@ SELECT * FROM t;
i i
1 1
DROP TABLE t; DROP TABLE t;
# shutdown server
# remove datadir
# xtrabackup move back
# restart server
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
let INNODB_PAGE_SIZE=`select @@innodb_page_size`; let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
let MYSQLD_DATADIR=`select @@datadir`; let MYSQLD_DATADIR=`select @@datadir`;
let $targetdir_old=$MYSQLTEST_VARDIR/tmp/backup_1;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir_old;
--enable_result_log
--source include/shutdown_mysqld.inc --source include/shutdown_mysqld.inc
perl; perl;
...@@ -50,3 +54,7 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir; ...@@ -50,3 +54,7 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir;
SELECT * FROM t; SELECT * FROM t;
DROP TABLE t; DROP TABLE t;
rmdir $targetdir; rmdir $targetdir;
let $targetdir= $targetdir_old;
exec $XTRABACKUP --prepare --target-dir=$targetdir;
--source include/restart_and_restore.inc
rmdir $targetdir_old;
...@@ -1214,8 +1214,8 @@ ...@@ -1214,8 +1214,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.48 -GLOBAL_VALUE 5.6.49
+GLOBAL_VALUE 5.6.47-87.0 +GLOBAL_VALUE 5.6.48-88.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
......
...@@ -684,8 +684,8 @@ ...@@ -684,8 +684,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.48 -GLOBAL_VALUE 5.6.49
+GLOBAL_VALUE 5.6.47-87.0 +GLOBAL_VALUE 5.6.48-88.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
......
source include/have_log_bin.inc;
SET timestamp=UNIX_TIMESTAMP('2014-09-30 08:00:00'); SET timestamp=UNIX_TIMESTAMP('2014-09-30 08:00:00');
CREATE FUNCTION f1(str char(20)) CREATE FUNCTION f1(str char(20))
...@@ -39,3 +41,25 @@ DROP FUNCTION IF EXISTS f1; ...@@ -39,3 +41,25 @@ DROP FUNCTION IF EXISTS f1;
SELECT body FROM mysql.proc WHERE name like 'f1'; SELECT body FROM mysql.proc WHERE name like 'f1';
DROP FUNCTION IF EXISTS f1; DROP FUNCTION IF EXISTS f1;
--echo #
--echo # 10.1 Test
--echo #
--echo # MDEV-22654: Assertion `!is_set() || (m_status == DA_OK_BULK &&
--echo # is_bulk_op())' failed in Diagnostics_area::set_ok_status on FUNCTION replace
--echo #
SET GLOBAL log_bin_trust_function_creators=0;
CREATE FUNCTION f(c INT) RETURNS NUMERIC NO SQL RETURN 0;
--error ER_BINLOG_UNSAFE_ROUTINE
CREATE OR REPLACE FUNCTION f(c INT) RETURNS INT RETURN 0;
--error ER_TOO_LONG_IDENT
CREATE OR REPLACE FUNCTION sp1_thisisaveryverylongnamelongnameverylongname_thisisaveryverylongname234872934(a INT) RETURNS INT RETURN 0;
DROP FUNCTION IF EXISTS f;
SET GLOBAL log_bin_trust_function_creators=1;
--echo # End of 10.1 Test
...@@ -2178,6 +2178,28 @@ SET @@sort_buffer_size= @save_sort_buffer_size; ...@@ -2178,6 +2178,28 @@ SET @@sort_buffer_size= @save_sort_buffer_size;
SET @@max_sort_length= @save_max_sort_length; SET @@max_sort_length= @save_max_sort_length;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-22390: Assertion `m_next_rec_ptr >= m_rawmem' failed in Filesort_buffer::spaceleft |
--echo # SIGSEGV in __memmove_avx_unaligned_erms from my_b_write (on optimized)
--echo #
SET @save_max_sort_length= @@max_sort_length;
SET @save_sort_buffer_size= @@sort_buffer_size;
SET @save_max_length_for_sort_data= @@max_length_for_sort_data;
SET max_sort_length=8;
SET sort_buffer_size=1024;
# needed to make sure we use addon fields
SET max_length_for_sort_data=7000;
CREATE TABLE t1(a VARCHAR(64), b VARCHAR(2048))DEFAULT CHARSET=utf8;
INSERT INTO t1 SELECT seq,seq from seq_1_to_100;
--source include/analyze-format.inc
ANALYZE FORMAT=JSON SELECT * FROM t1 ORDER BY a LIMIT 5;
SELECT * FROM t1 ORDER BY a LIMIT 5;
SET max_sort_length= @save_max_sort_length;
SET sort_buffer_size= @save_sort_buffer_size;
SET max_length_for_sort_data= @save_max_length_for_sort_data;
DROP TABLE t1;
--echo # --echo #
--echo # MDEV-13994: Bad join results with orderby_uses_equalities=on --echo # MDEV-13994: Bad join results with orderby_uses_equalities=on
--echo # --echo #
......
...@@ -283,6 +283,36 @@ ELSE() ...@@ -283,6 +283,36 @@ ELSE()
SET(WSREP_SOURCE SET(WSREP_SOURCE
wsrep_sst_common wsrep_sst_common
) )
SET (wsrep_sst_rsync_wan ${CMAKE_CURRENT_BINARY_DIR}/wsrep_sst_rsync_wan)
ADD_CUSTOM_COMMAND(
OUTPUT ${wsrep_sst_rsync_wan}
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
wsrep_sst_rsync
wsrep_sst_rsync_wan
)
ADD_CUSTOM_TARGET(symlink_wsrep_sst_rsync
ALL
DEPENDS ${wsrep_sst_rsync_wan}
)
INSTALL(
FILES ${wsrep_sst_rsync_wan}
DESTINATION ${INSTALL_BINDIR}
COMPONENT Server
)
FOREACH(file ${WSREP_SOURCE})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
IF(NOT ${file}_COMPONENT)
SET(${file}_COMPONENT Server)
ENDIF()
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/${file}
DESTINATION ${INSTALL_BINDIR}
COMPONENT ${${file}_COMPONENT}
)
ENDFOREACH()
ENDIF() ENDIF()
IF (NOT WITHOUT_SERVER) IF (NOT WITHOUT_SERVER)
SET(SERVER_SCRIPTS SET(SERVER_SCRIPTS
...@@ -334,35 +364,6 @@ ELSE() ...@@ -334,35 +364,6 @@ ELSE()
COMPONENT ${${file}_COMPONENT} COMPONENT ${${file}_COMPONENT}
) )
ENDFOREACH() ENDFOREACH()
SET (wsrep_sst_rsync_wan ${CMAKE_CURRENT_BINARY_DIR}/wsrep_sst_rsync_wan)
ADD_CUSTOM_COMMAND(
OUTPUT ${wsrep_sst_rsync_wan}
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
wsrep_sst_rsync
wsrep_sst_rsync_wan
)
ADD_CUSTOM_TARGET(symlink_wsrep_sst_rsync
ALL
DEPENDS ${wsrep_sst_rsync_wan}
)
INSTALL(
FILES ${wsrep_sst_rsync_wan}
DESTINATION ${INSTALL_BINDIR}
COMPONENT Server
)
FOREACH(file ${WSREP_SOURCE})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
IF(NOT ${file}_COMPONENT)
SET(${file}_COMPONENT Server)
ENDIF()
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/${file}
DESTINATION ${INSTALL_BINDIR}
COMPONENT ${${file}_COMPONENT}
)
ENDFOREACH()
ENDIF() ENDIF()
# Install libgcc as mylibgcc.a # Install libgcc as mylibgcc.a
......
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2015, MariaDB Copyright (c) 2009, 2020, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -248,7 +248,8 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort, ...@@ -248,7 +248,8 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
while (memory_available >= min_sort_memory) while (memory_available >= min_sort_memory)
{ {
ulonglong keys= memory_available / (param.rec_length + sizeof(char*)); ulonglong keys= memory_available / (param.rec_length + sizeof(char*));
param.max_keys_per_buffer= (uint) MY_MIN(num_rows, keys); param.max_keys_per_buffer= (uint) MY_MAX(MERGEBUFF2,
MY_MIN(num_rows, keys));
if (sort->alloc_sort_buffer(param.max_keys_per_buffer, param.rec_length)) if (sort->alloc_sort_buffer(param.max_keys_per_buffer, param.rec_length))
break; break;
size_t old_memory_available= memory_available; size_t old_memory_available= memory_available;
......
/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2012, 2020, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -106,7 +107,6 @@ uchar **Filesort_buffer::alloc_sort_buffer(uint num_records, ...@@ -106,7 +107,6 @@ uchar **Filesort_buffer::alloc_sort_buffer(uint num_records,
DBUG_SET("+d,simulate_out_of_memory");); DBUG_SET("+d,simulate_out_of_memory"););
buff_size= ((size_t)num_records) * (record_length + sizeof(uchar*)); buff_size= ((size_t)num_records) * (record_length + sizeof(uchar*));
set_if_bigger(buff_size, record_length * MERGEBUFF2);
if (!m_idx_array.is_null()) if (!m_idx_array.is_null())
{ {
......
...@@ -1081,7 +1081,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) ...@@ -1081,7 +1081,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
{ {
if (lex->create_info.or_replace()) if (lex->create_info.or_replace())
{ {
if ((ret= sp_drop_routine_internal(thd, type, lex->spname, table))) if (sp_drop_routine_internal(thd, type, lex->spname, table))
goto done; goto done;
} }
else if (lex->create_info.if_not_exists()) else if (lex->create_info.if_not_exists())
......
...@@ -116,6 +116,23 @@ BOOL exclude_service(mysqld_service_properties *props) ...@@ -116,6 +116,23 @@ BOOL exclude_service(mysqld_service_properties *props)
} }
static void get_datadir_from_ini(const char *ini, char *service_name, char *datadir, size_t sz)
{
*datadir= 0;
const char *sections[]= {service_name, "mysqld", "server", "mariadb",
"mariadbd"};
for (int i= 0; i < sizeof(sections) / sizeof(sections[0]); i++)
{
if (sections[i])
{
GetPrivateProfileStringA(sections[i], "datadir", NULL, datadir, sz, ini);
if (*datadir)
return;
}
}
}
/* /*
Retrieve some properties from windows mysqld service binary path. Retrieve some properties from windows mysqld service binary path.
We're interested in ini file location and datadir, and also in version of We're interested in ini file location and datadir, and also in version of
...@@ -135,6 +152,7 @@ int get_mysql_service_properties(const wchar_t *bin_path, ...@@ -135,6 +152,7 @@ int get_mysql_service_properties(const wchar_t *bin_path,
wchar_t **args= NULL; wchar_t **args= NULL;
int retval= 1; int retval= 1;
BOOL have_inifile; BOOL have_inifile;
char service_name[MAX_PATH];
props->datadir[0]= 0; props->datadir[0]= 0;
props->inifile[0]= 0; props->inifile[0]= 0;
...@@ -148,7 +166,7 @@ int get_mysql_service_properties(const wchar_t *bin_path, ...@@ -148,7 +166,7 @@ int get_mysql_service_properties(const wchar_t *bin_path,
{ {
/* /*
There are rare cases where service config does not have There are rare cases where service config does not have
--defaults-filein the binary parth . There services were registered with --defaults-file in the binary parth . There services were registered with
plain mysqld --install, the data directory is next to "bin" in this case. plain mysqld --install, the data directory is next to "bin" in this case.
*/ */
have_inifile= FALSE; have_inifile= FALSE;
...@@ -162,6 +180,9 @@ int get_mysql_service_properties(const wchar_t *bin_path, ...@@ -162,6 +180,9 @@ int get_mysql_service_properties(const wchar_t *bin_path,
goto end; goto end;
} }
/* Last parameter is the service name*/
wcstombs(service_name, args[numargs-1], MAX_PATH);
if(have_inifile && wcsncmp(args[1], L"--defaults-file=", 16) != 0) if(have_inifile && wcsncmp(args[1], L"--defaults-file=", 16) != 0)
goto end; goto end;
...@@ -193,8 +214,8 @@ int get_mysql_service_properties(const wchar_t *bin_path, ...@@ -193,8 +214,8 @@ int get_mysql_service_properties(const wchar_t *bin_path,
normalize_path(props->inifile, MAX_PATH); normalize_path(props->inifile, MAX_PATH);
if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES) if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES)
{ {
GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir, MAX_PATH, get_datadir_from_ini(props->inifile, service_name, props->datadir,
props->inifile); sizeof(props->datadir));
} }
else else
{ {
...@@ -243,8 +264,8 @@ int get_mysql_service_properties(const wchar_t *bin_path, ...@@ -243,8 +264,8 @@ int get_mysql_service_properties(const wchar_t *bin_path,
if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES) if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES)
{ {
/* Ini file found, get datadir from there */ /* Ini file found, get datadir from there */
GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir, get_datadir_from_ini(props->inifile, service_name, props->datadir,
MAX_PATH, props->inifile); sizeof(props->datadir));
} }
else else
{ {
......
...@@ -2508,7 +2508,7 @@ i_s_metrics_fill( ...@@ -2508,7 +2508,7 @@ i_s_metrics_fill(
time_diff = 0; time_diff = 0;
} }
/* Unless MONITOR__NO_AVERAGE is marked, we will need /* Unless MONITOR_NO_AVERAGE is set, we must
to calculate the average value. If this is a monitor set to calculate the average value. If this is a monitor set
owner marked by MONITOR_SET_OWNER, divide owner marked by MONITOR_SET_OWNER, divide
the value by another counter (number of calls) designated the value by another counter (number of calls) designated
...@@ -2516,8 +2516,9 @@ i_s_metrics_fill( ...@@ -2516,8 +2516,9 @@ i_s_metrics_fill(
Otherwise average the counter value by the time between the Otherwise average the counter value by the time between the
time that the counter is enabled and time it is disabled time that the counter is enabled and time it is disabled
or time it is sampled. */ or time it is sampled. */
if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE) if ((monitor_info->monitor_type
&& (monitor_info->monitor_type & MONITOR_SET_OWNER) & (MONITOR_NO_AVERAGE | MONITOR_SET_OWNER))
== MONITOR_SET_OWNER
&& monitor_info->monitor_related_id) { && monitor_info->monitor_related_id) {
mon_type_t value_start mon_type_t value_start
= MONITOR_VALUE_SINCE_START( = MONITOR_VALUE_SINCE_START(
...@@ -2533,18 +2534,18 @@ i_s_metrics_fill( ...@@ -2533,18 +2534,18 @@ i_s_metrics_fill(
fields[METRIC_AVG_VALUE_START]->set_null(); fields[METRIC_AVG_VALUE_START]->set_null();
} }
if (MONITOR_VALUE(monitor_info->monitor_related_id)) { if (mon_type_t related_value =
OK(fields[METRIC_AVG_VALUE_RESET]->store( MONITOR_VALUE(monitor_info->monitor_related_id)) {
MONITOR_VALUE(count) OK(fields[METRIC_AVG_VALUE_RESET]
/ MONITOR_VALUE( ->store(MONITOR_VALUE(count)
monitor_info->monitor_related_id), / related_value, false));
FALSE)); fields[METRIC_AVG_VALUE_RESET]->set_notnull();
} else { } else {
fields[METRIC_AVG_VALUE_RESET]->set_null(); fields[METRIC_AVG_VALUE_RESET]->set_null();
} }
} else if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE) } else if (!(monitor_info->monitor_type
&& !(monitor_info->monitor_type & (MONITOR_NO_AVERAGE
& MONITOR_DISPLAY_CURRENT)) { | MONITOR_DISPLAY_CURRENT))) {
if (time_diff != 0) { if (time_diff != 0) {
OK(fields[METRIC_AVG_VALUE_START]->store( OK(fields[METRIC_AVG_VALUE_START]->store(
(double) MONITOR_VALUE_SINCE_START( (double) MONITOR_VALUE_SINCE_START(
...@@ -3326,6 +3327,8 @@ i_s_fts_index_cache_fill( ...@@ -3326,6 +3327,8 @@ i_s_fts_index_cache_fill(
conv_str.f_len = sizeof word; conv_str.f_len = sizeof word;
conv_str.f_str = word; conv_str.f_str = word;
rw_lock_s_lock(&cache->lock);
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) { for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache; fts_index_cache_t* index_cache;
...@@ -3336,6 +3339,7 @@ i_s_fts_index_cache_fill( ...@@ -3336,6 +3339,7 @@ i_s_fts_index_cache_fill(
index_cache, thd, &conv_str, tables)); index_cache, thd, &conv_str, tables));
} }
rw_lock_s_unlock(&cache->lock);
dict_table_close(user_table, FALSE, FALSE); dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock); rw_lock_s_unlock(&dict_operation_lock);
......
...@@ -862,16 +862,18 @@ dict_table_x_lock_indexes( ...@@ -862,16 +862,18 @@ dict_table_x_lock_indexes(
/*======================*/ /*======================*/
dict_table_t* table) /*!< in: table */ dict_table_t* table) /*!< in: table */
{ {
dict_index_t* index;
ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(mutex_own(&dict_sys->mutex));
dict_index_t* clust_index = dict_table_get_first_index(table);
/* Loop through each index of the table and lock them */ /* Loop through each index of the table and lock them */
for (index = dict_table_get_first_index(table); for (dict_index_t* index = dict_table_get_next_index(clust_index);
index != NULL; index != NULL;
index = dict_table_get_next_index(index)) { index = dict_table_get_next_index(index)) {
rw_lock_x_lock(dict_index_get_lock(index)); rw_lock_x_lock(dict_index_get_lock(index));
} }
rw_lock_x_lock(dict_index_get_lock(clust_index));
} }
/*********************************************************************//** /*********************************************************************//**
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2019, MariaDB Corporation. Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -2553,7 +2553,7 @@ i_s_metrics_fill( ...@@ -2553,7 +2553,7 @@ i_s_metrics_fill(
time_diff = 0; time_diff = 0;
} }
/* Unless MONITOR__NO_AVERAGE is marked, we will need /* Unless MONITOR_NO_AVERAGE is set, we must
to calculate the average value. If this is a monitor set to calculate the average value. If this is a monitor set
owner marked by MONITOR_SET_OWNER, divide owner marked by MONITOR_SET_OWNER, divide
the value by another counter (number of calls) designated the value by another counter (number of calls) designated
...@@ -2561,8 +2561,9 @@ i_s_metrics_fill( ...@@ -2561,8 +2561,9 @@ i_s_metrics_fill(
Otherwise average the counter value by the time between the Otherwise average the counter value by the time between the
time that the counter is enabled and time it is disabled time that the counter is enabled and time it is disabled
or time it is sampled. */ or time it is sampled. */
if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE) if ((monitor_info->monitor_type
&& (monitor_info->monitor_type & MONITOR_SET_OWNER) & (MONITOR_NO_AVERAGE | MONITOR_SET_OWNER))
== MONITOR_SET_OWNER
&& monitor_info->monitor_related_id) { && monitor_info->monitor_related_id) {
mon_type_t value_start mon_type_t value_start
= MONITOR_VALUE_SINCE_START( = MONITOR_VALUE_SINCE_START(
...@@ -2578,18 +2579,18 @@ i_s_metrics_fill( ...@@ -2578,18 +2579,18 @@ i_s_metrics_fill(
fields[METRIC_AVG_VALUE_START]->set_null(); fields[METRIC_AVG_VALUE_START]->set_null();
} }
if (MONITOR_VALUE(monitor_info->monitor_related_id)) { if (mon_type_t related_value =
OK(fields[METRIC_AVG_VALUE_RESET]->store( MONITOR_VALUE(monitor_info->monitor_related_id)) {
MONITOR_VALUE(count) OK(fields[METRIC_AVG_VALUE_RESET]
/ MONITOR_VALUE( ->store(MONITOR_VALUE(count)
monitor_info->monitor_related_id), / related_value, false));
FALSE)); fields[METRIC_AVG_VALUE_RESET]->set_notnull();
} else { } else {
fields[METRIC_AVG_VALUE_RESET]->set_null(); fields[METRIC_AVG_VALUE_RESET]->set_null();
} }
} else if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE) } else if (!(monitor_info->monitor_type
&& !(monitor_info->monitor_type & (MONITOR_NO_AVERAGE
& MONITOR_DISPLAY_CURRENT)) { | MONITOR_DISPLAY_CURRENT))) {
if (time_diff) { if (time_diff) {
OK(fields[METRIC_AVG_VALUE_START]->store( OK(fields[METRIC_AVG_VALUE_START]->store(
(double) MONITOR_VALUE_SINCE_START( (double) MONITOR_VALUE_SINCE_START(
...@@ -3367,6 +3368,8 @@ i_s_fts_index_cache_fill( ...@@ -3367,6 +3368,8 @@ i_s_fts_index_cache_fill(
conv_str.f_len = sizeof word; conv_str.f_len = sizeof word;
conv_str.f_str = word; conv_str.f_str = word;
rw_lock_s_lock(&cache->lock);
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) { for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache; fts_index_cache_t* index_cache;
...@@ -3377,6 +3380,7 @@ i_s_fts_index_cache_fill( ...@@ -3377,6 +3380,7 @@ i_s_fts_index_cache_fill(
index_cache, thd, &conv_str, tables)); index_cache, thd, &conv_str, tables));
} }
rw_lock_s_unlock(&cache->lock);
dict_table_close(user_table, FALSE, FALSE); dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock); rw_lock_s_unlock(&dict_operation_lock);
......
...@@ -1026,16 +1026,18 @@ dict_table_x_lock_indexes( ...@@ -1026,16 +1026,18 @@ dict_table_x_lock_indexes(
/*======================*/ /*======================*/
dict_table_t* table) /*!< in: table */ dict_table_t* table) /*!< in: table */
{ {
dict_index_t* index;
ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(mutex_own(&dict_sys->mutex));
dict_index_t* clust_index = dict_table_get_first_index(table);
/* Loop through each index of the table and lock them */ /* Loop through each index of the table and lock them */
for (index = dict_table_get_first_index(table); for (dict_index_t* index = dict_table_get_next_index(clust_index);
index != NULL; index != NULL;
index = dict_table_get_next_index(index)) { index = dict_table_get_next_index(index)) {
rw_lock_x_lock(dict_index_get_lock(index)); rw_lock_x_lock(dict_index_get_lock(index));
} }
rw_lock_x_lock(dict_index_get_lock(clust_index));
} }
/*********************************************************************//** /*********************************************************************//**
......
...@@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri ...@@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6 #define INNODB_VERSION_MINOR 6
#define INNODB_VERSION_BUGFIX 47 #define INNODB_VERSION_BUGFIX 48
#ifndef PERCONA_INNODB_VERSION #ifndef PERCONA_INNODB_VERSION
#define PERCONA_INNODB_VERSION 87.0 #define PERCONA_INNODB_VERSION 88.0
#endif #endif
/* Enable UNIV_LOG_ARCHIVE in XtraDB */ /* Enable UNIV_LOG_ARCHIVE in XtraDB */
......
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