Skip to content

Commit

Permalink
Merge 10.5 into 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Mar 29, 2021
2 parents 0f6f729 + e8b7fce commit 2ad61c6
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 168 deletions.
5 changes: 5 additions & 0 deletions mysql-test/suite/innodb/r/group_commit_force_recovery.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE TABLE t1(a int) ENGINE=InnoDB;
INSERT INTO t1 SET a=1;
RESET MASTER;
DROP TABLE t1;
End of the tests.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--innodb-force-recovery=2
21 changes: 21 additions & 0 deletions mysql-test/suite/innodb/t/group_commit_force_recovery.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MDEV-24302 RESET MASTER hangs as Innodb does not report on binlog checkpoint
# Testing binlog checkpoint notification works under stringent condition
# set by innodb_force_recovery = 2.

--source include/have_innodb.inc
--source include/have_binlog_format_mixed.inc

# Binlog checkpoint notification consumers such as RESET MASTER
# receive one when lsn_0 at the time of the request is finally gets flushed
# flush_lsn >= lsn_0
# The bug situation was that when lsn_0 reflects a write of an internal innodb trx
# and RESET MASTER was not followed by any more user transaction
# it would hang.

CREATE TABLE t1(a int) ENGINE=InnoDB;
INSERT INTO t1 SET a=1;
RESET MASTER;

# final cleanup
DROP TABLE t1;
--echo End of the tests.
7 changes: 3 additions & 4 deletions sql/handler.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Corporation.
Copyright (c) 2009, 2021, 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
Expand Down Expand Up @@ -861,7 +861,7 @@ static my_bool commit_checkpoint_request_handlerton(THD *unused1, plugin_ref plu
void *cookie= st->cookie;
if (st->pre_hook)
(*st->pre_hook)(cookie);
(*hton->commit_checkpoint_request)(hton, cookie);
(*hton->commit_checkpoint_request)(cookie);
}
return FALSE;
}
Expand Down Expand Up @@ -2437,8 +2437,7 @@ int ha_recover(HASH *commit_list)
Called by engine to notify TC that a new commit checkpoint has been reached.
See comments on handlerton method commit_checkpoint_request() for details.
*/
void
commit_checkpoint_notify_ha(handlerton *hton, void *cookie)
void commit_checkpoint_notify_ha(void *cookie)
{
tc_log->commit_checkpoint_notify(cookie);
}
Expand Down
4 changes: 2 additions & 2 deletions sql/handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ struct handlerton
recovery. It uses that to reduce the work needed for any subsequent XA
recovery process.
*/
void (*commit_checkpoint_request)(handlerton *hton, void *cookie);
void (*commit_checkpoint_request)(void *cookie);
/*
"Disable or enable checkpointing internal to the storage engine. This is
used for FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT to ensure that
Expand Down Expand Up @@ -5255,7 +5255,7 @@ void trans_register_ha(THD *thd, bool all, handlerton *ht,

const char *get_canonical_filename(handler *file, const char *path,
char *tmp_path);
void commit_checkpoint_notify_ha(handlerton *hton, void *cookie);
void commit_checkpoint_notify_ha(void *cookie);

inline const LEX_CSTRING *table_case_name(HA_CREATE_INFO *info, const LEX_CSTRING *name)
{
Expand Down
8 changes: 5 additions & 3 deletions sql/sql_prepare.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3418,15 +3418,17 @@ static void mysql_stmt_execute_common(THD *thd,
if (!(stmt= find_prepared_statement(thd, stmt_id)))
{
char llbuf[22];
size_t length;
/*
Did not find the statement with the provided stmt_id.
Set thd->query_string with the stmt_id so the
audit plugin gets the meaningful notification.
*/
if (alloc_query(thd, llbuf, sizeof(llbuf)))
length= (size_t) (longlong10_to_str(stmt_id, llbuf, 10) - llbuf);
if (alloc_query(thd, llbuf, length + 1))
thd->set_query(0, 0);
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
llstr(stmt_id, llbuf), "mysqld_stmt_execute");
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), (int) length, llbuf,
"mysqld_stmt_execute");
DBUG_VOID_RETURN;
}

Expand Down
Loading

0 comments on commit 2ad61c6

Please sign in to comment.