Skip to content
Permalink
Browse files
merge 10.5 to 10.6
  • Loading branch information
vaintroub committed Jul 16, 2021
2 parents 461cac8 + fc2ec25 commit e7f4daf
Show file tree
Hide file tree
Showing 35 changed files with 442 additions and 49 deletions.
@@ -1,4 +1,5 @@
-- require include/have_pool_of_threads.require
--source include/not_aix.inc
--require include/have_pool_of_threads.require
disable_query_log;
show variables like 'thread_handling';
enable_query_log;
@@ -1 +1,2 @@
# run with and without threadpool
--source include/not_aix.inc
@@ -496,3 +496,22 @@ natural right outer join t3;
drop table t1,t2,t3;
set optimizer_prune_level=@mdev4270_opl;
set optimizer_search_depth=@mdev4270_osd;
#
# Bug #20939184:INNODB: UNLOCK ROW COULD NOT FIND A 2 MODE LOCK ON THE
# RECORD
#
CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, PRIMARY KEY (c1,c2) ) engine=innodb;
CREATE TABLE t2 (c1 INT, c2 INT, c3 INT, PRIMARY KEY (c1), KEY (c2)) engine=innodb;
INSERT INTO t1 VALUES (1,2,3),(2,3,4),(3,4,5);
INSERT INTO t2 SELECT * FROM t1;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
SELECT * FROM t1 LEFT JOIN t2 ON t1.c2=t2.c2 AND t2.c1=1 FOR UPDATE;
c1 c2 c3 c1 c2 c3
1 2 3 1 2 3
2 3 4 NULL NULL NULL
3 4 5 NULL NULL NULL
UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c2 AND t2.c1 = 3 SET t1.c3 = RAND()*10;
COMMIT;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
DROP TABLE t1,t2;
@@ -374,3 +374,20 @@ drop table t1,t2,t3;
set optimizer_prune_level=@mdev4270_opl;
set optimizer_search_depth=@mdev4270_osd;

--echo #
--echo # Bug #20939184:INNODB: UNLOCK ROW COULD NOT FIND A 2 MODE LOCK ON THE
--echo # RECORD
--echo #
CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, PRIMARY KEY (c1,c2) ) engine=innodb;
CREATE TABLE t2 (c1 INT, c2 INT, c3 INT, PRIMARY KEY (c1), KEY (c2)) engine=innodb;
INSERT INTO t1 VALUES (1,2,3),(2,3,4),(3,4,5);
INSERT INTO t2 SELECT * FROM t1;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
#unlocks rows in table t2 where c1 = 1
SELECT * FROM t1 LEFT JOIN t2 ON t1.c2=t2.c2 AND t2.c1=1 FOR UPDATE;
UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c2 AND t2.c1 = 3 SET t1.c3 = RAND()*10;
COMMIT;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
DROP TABLE t1,t2;

@@ -4,6 +4,7 @@

source include/not_embedded.inc;
source include/not_windows.inc;
source include/not_aix.inc;

# All these tests refer to configuration files that do not exist

@@ -0,0 +1,76 @@
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result
index 7b0ce27ead3..38176dcaa86 100644
--- a/mysql-test/main/mysqld--help.result
+++ b/mysql-test/main/mysqld--help.result
@@ -1301,8 +1301,6 @@ The following specify which files/extra groups are read (specified before remain
WHERE clause, or a LIMIT clause, or else they will
aborted. Prevents the common mistake of accidentally
deleting or updating every row in a table.
- --stack-trace Print a symbolic stack trace on failure
- (Defaults to on; use --skip-stack-trace to disable.)
--standard-compliant-cte
Allow only CTEs compliant to SQL standard
(Defaults to on; use --skip-standard-compliant-cte to disable.)
@@ -1367,39 +1365,6 @@ The following specify which files/extra groups are read (specified before remain
--thread-cache-size=#
How many threads we should keep in a cache for reuse.
These are freed after 5 minutes of idle time
- --thread-pool-dedicated-listener
- If set to 1,listener thread will not pick up queries
- --thread-pool-exact-stats
- If set to 1, provides better statistics in
- information_schema threadpool tables
- --thread-pool-idle-timeout=#
- Timeout in seconds for an idle thread in the thread
- pool.Worker thread will be shut down after timeout
- --thread-pool-max-threads=#
- Maximum allowed number of worker threads in the thread
- pool
- --thread-pool-oversubscribe=#
- How many additional active worker threads in a group are
- allowed.
- --thread-pool-prio-kickup-timer=#
- The number of milliseconds before a dequeued low-priority
- statement is moved to the high-priority queue
- --thread-pool-priority=name
- Threadpool priority. High priority connections usually
- start executing earlier than low priority.If priority set
- to 'auto', the the actual priority(low or high) is
- determined based on whether or not connection is inside
- transaction.
- --thread-pool-size=#
- Number of thread groups in the pool. This parameter is
- roughly equivalent to maximum number of concurrently
- executing threads (threads in a waiting state do not
- count as executing).
- --thread-pool-stall-limit=#
- Maximum query execution time in milliseconds,before an
- executing non-yielding thread is considered stalled.If a
- worker thread is stalled, additional worker thread may be
- created to handle remaining clients.
--thread-stack=# The stack size for each thread
--time-format=name The TIME format (ignored)
--tls-version=name TLS protocol version for secure connections.. Any
@@ -1788,7 +1753,6 @@ slow-query-log FALSE
sort-buffer-size 2097152
sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql-safe-updates FALSE
-stack-trace TRUE
standard-compliant-cte TRUE
stored-program-cache 256
strict-password-validation TRUE
@@ -1807,14 +1771,6 @@ tcp-keepalive-probes 0
tcp-keepalive-time 0
tcp-nodelay TRUE
thread-cache-size 151
-thread-pool-dedicated-listener FALSE
-thread-pool-exact-stats FALSE
-thread-pool-idle-timeout 60
-thread-pool-max-threads 65536
-thread-pool-oversubscribe 3
-thread-pool-prio-kickup-timer 1000
-thread-pool-priority auto
-thread-pool-stall-limit 500
thread-stack 299008
time-format %H:%i:%s
tmp-disk-table-size 18446744073709551615
@@ -1 +1 @@
--skip-stack-trace --skip-core-file
--loose-skip-stack-trace --skip-core-file
@@ -1,6 +1,7 @@
# uint global
--source include/not_windows.inc
--source include/not_embedded.inc
--source include/not_aix.inc
SET @start_global_value = @@global.thread_pool_idle_timeout;

#
@@ -1,5 +1,6 @@
--source include/not_windows.inc
--source include/not_embedded.inc
--source include/not_aix.inc

SET @global=@@global.thread_pool_idle_timeout;

@@ -1,5 +1,6 @@
# uint global
--source include/not_embedded.inc
--source include/not_aix.inc
SET @start_global_value = @@global.thread_pool_max_threads;

#
@@ -1,5 +1,6 @@
# uint global
--source include/not_embedded.inc
--source include/not_aix.inc

SET @global=@@global.thread_pool_max_threads;

@@ -1,6 +1,7 @@
# uint global
--source include/not_embedded.inc
--source include/windows.inc
--source include/not_aix.inc
SET @start_global_value = @@global.thread_pool_min_threads;

#
@@ -1,6 +1,7 @@
# uint global
--source include/not_windows.inc
--source include/not_embedded.inc
--source include/not_aix.inc
SET @start_global_value = @@global.thread_pool_oversubscribe;

#
@@ -1,5 +1,6 @@
--source include/not_windows.inc
--source include/not_embedded.inc
--source include/not_aix.inc

SET @global=@@global.thread_pool_oversubscribe;

@@ -1,5 +1,6 @@
# uint global
--source include/not_embedded.inc
--source include/not_aix.inc
SET @start_global_value = @@global.thread_pool_stall_limit;

#
@@ -1,5 +1,6 @@
# uint global
--source include/not_embedded.inc
--source include/not_aix.inc

SET @global=@@global.thread_pool_stall_limit;

@@ -179,14 +179,26 @@ my_bool my_net_init(NET *net, Vio *vio, void *thd, uint my_flags)
DBUG_RETURN(0);
}


/**
Allocate and assign new net buffer
@note In case of error the old buffer left
@retval TRUE error
@retval FALSE success
*/

my_bool net_allocate_new_packet(NET *net, void *thd, uint my_flags)
{
uchar *tmp;
DBUG_ENTER("net_allocate_new_packet");
if (!(net->buff=(uchar*) my_malloc(key_memory_NET_buff,
(size_t) net->max_packet +
NET_HEADER_SIZE + COMP_HEADER_SIZE + 1,
MYF(MY_WME | my_flags))))
if (!(tmp= (uchar*) my_malloc(key_memory_NET_buff,
(size_t) net->max_packet +
NET_HEADER_SIZE + COMP_HEADER_SIZE + 1,
MYF(MY_WME | my_flags))))
DBUG_RETURN(1);
net->buff= tmp;
net->buff_end=net->buff+net->max_packet;
net->write_pos=net->read_pos = net->buff;
DBUG_RETURN(0);
@@ -597,6 +597,7 @@ void Protocol::end_statement()
thd->get_stmt_da()->get_sqlstate());
break;
case Diagnostics_area::DA_EOF:
case Diagnostics_area::DA_EOF_BULK:
error= send_eof(thd->server_status,
thd->get_stmt_da()->statement_warn_count());
break;
@@ -709,7 +709,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
!table->prepare_triggers_for_delete_stmt_or_event())
will_batch= !table->file->start_bulk_delete();

if (returning)
/*
thd->get_stmt_da()->is_set() means first iteration of prepared statement
with array binding operation execution (non optimized so it is not
INSERT)
*/
if (returning && !thd->get_stmt_da()->is_set())
{
if (result->send_result_set_metadata(returning->item_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -371,7 +371,7 @@ Diagnostics_area::set_eof_status(THD *thd)
{
DBUG_ENTER("set_eof_status");
/* Only allowed to report eof if has not yet reported an error */
DBUG_ASSERT(! is_set());
DBUG_ASSERT(!is_set() || (m_status == DA_EOF_BULK && is_bulk_op()));
/*
In production, refuse to overwrite an error or a custom response
with an EOF packet.
@@ -384,11 +384,23 @@ Diagnostics_area::set_eof_status(THD *thd)
number of warnings, since they are not available to the client
anyway.
*/
m_statement_warn_count= (thd->spcont ?
0 :
current_statement_warn_count());
if (m_status == DA_EOF_BULK)
{
if (!thd->spcont)
m_statement_warn_count+= current_statement_warn_count();
}
else
{
if (thd->spcont)
{
m_statement_warn_count= 0;
m_affected_rows= 0;
}
else
m_statement_warn_count= current_statement_warn_count();
m_status= (is_bulk_op() ? DA_EOF_BULK : DA_EOF);
}

m_status= DA_EOF;
DBUG_VOID_RETURN;
}

@@ -970,6 +970,8 @@ class Diagnostics_area: public Sql_state_errno,
DA_EOF,
/** Set whenever one calls my_ok() in PS bulk mode. */
DA_OK_BULK,
/** Set whenever one calls my_eof() in PS bulk mode. */
DA_EOF_BULK,
/** Set whenever one calls my_error() or my_message(). */
DA_ERROR,
/** Set in case of a custom response, such as one from COM_STMT_PREPARE. */
@@ -1029,8 +1031,11 @@ class Diagnostics_area: public Sql_state_errno,
enum_diagnostics_status status() const { return m_status; }

const char *message() const
{ DBUG_ASSERT(m_status == DA_ERROR || m_status == DA_OK ||
m_status == DA_OK_BULK); return m_message; }
{
DBUG_ASSERT(m_status == DA_ERROR || m_status == DA_OK ||
m_status == DA_OK_BULK || m_status == DA_EOF_BULK);
return m_message;
}


uint sql_errno() const
@@ -1057,7 +1062,7 @@ class Diagnostics_area: public Sql_state_errno,
uint statement_warn_count() const
{
DBUG_ASSERT(m_status == DA_OK || m_status == DA_OK_BULK ||
m_status == DA_EOF);
m_status == DA_EOF ||m_status == DA_EOF_BULK );
return m_statement_warn_count;
}

@@ -710,6 +710,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
Name_resolution_context *context;
Name_resolution_context_state ctx_state;
SELECT_LEX *returning= thd->lex->has_returning() ? thd->lex->returning() : 0;
unsigned char *readbuff= NULL;

#ifndef EMBEDDED_LIBRARY
char *query= thd->query();
@@ -786,7 +787,25 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,

/* Prepares LEX::returing_list if it is not empty */
if (returning)
{
result->prepare(returning->item_list, NULL);
if (thd->is_bulk_op())
{
/*
It is RETURNING which needs network buffer to write result set and
it is array binfing which need network buffer to read parameters.
So we allocate yet another network buffer.
The old buffer will be freed at the end of operation.
*/
DBUG_ASSERT(thd->protocol == &thd->protocol_binary);
readbuff= thd->net.buff; // old buffer
if (net_allocate_new_packet(&thd->net, thd, MYF(MY_THREAD_SPECIFIC)))
{
readbuff= NULL; // failure, net_allocate_new_packet keeps old buffer
goto abort;
}
}
}

context= &thd->lex->first_select_lex()->context;
/*
@@ -1322,7 +1341,8 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
thd->lex->current_select->save_leaf_tables(thd);
thd->lex->current_select->first_cond_optimization= 0;
}

if (readbuff)
my_free(readbuff);
DBUG_RETURN(FALSE);

abort:
@@ -1336,6 +1356,8 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
if (!joins_freed)
free_underlaid_joins(thd, thd->lex->first_select_lex());
thd->abort_on_warning= 0;
if (readbuff)
my_free(readbuff);
DBUG_RETURN(retval);
}

0 comments on commit e7f4daf

Please sign in to comment.