Commit 05c9821a authored by vasil's avatar vasil

Fix Bug#25078 by always letting the replication thread on the slave

server to enter InnoDB. This can be made further customizable by the
user if we introduce a new config parameter. This will wait until
config parameters can be easily added.

Approved by:	Marko
parent ea62d3f3
......@@ -407,6 +407,23 @@ static SHOW_VAR innodb_status_variables[]= {
/* General functions */
/**********************************************************************
Returns true if the thread is the replication thread on the slave
server. Used in srv_conc_enter_innodb() to determine if the thread
should be allowed to enter InnoDB - the replication thread is treated
differently than other threads. Also used in
srv_conc_force_exit_innodb(). */
extern "C"
ibool
thd_is_replication_slave_thread(
/*============================*/
/* out: true if thd is the replication thread */
void* thd) /* in: thread handle (THD*) */
{
return((ibool)(((THD*)thd)->slave_thread));
}
/**********************************************************************
Save some CPU by testing the value of srv_thread_concurrency in inline
functions. */
......
#ifndef HA_INNODB_PROTOTYPES_H
#define HA_INNODB_PROTOTYPES_H
#include "univ.i" /* ulint, uint */
#include "m_ctype.h" /* CHARSET_INFO */
/* Prototypes for global functions in ha_innodb.cc that are called by
InnoDB's C-code. */
......@@ -19,4 +22,17 @@ innobase_convert_string(
CHARSET_INFO* from_cs,
uint* errors);
/**********************************************************************
Returns true if the thread is the replication thread on the slave
server. Used in srv_conc_enter_innodb() to determine if the thread
should be allowed to enter InnoDB - the replication thread is treated
differently than other threads. Also used in
srv_conc_force_exit_innodb(). */
ibool
thd_is_replication_slave_thread(
/*============================*/
/* out: true if thd is the replication thread */
void* thd); /* in: thread handle (THD*) */
#endif
......@@ -47,6 +47,7 @@ Created 10/8/1995 Heikki Tuuri
#include "dict0boot.h"
#include "srv0start.h"
#include "row0mysql.h"
#include "ha_prototypes.h"
/* This is set to TRUE if the MySQL user has set it in MySQL; currently
affects only FOREIGN KEY definition parsing */
......@@ -987,6 +988,17 @@ srv_conc_enter_innodb(
srv_conc_slot_t* slot = NULL;
ulint i;
if (trx->mysql_thd != NULL
&& thd_is_replication_slave_thread(trx->mysql_thd)) {
/* TODO Do something more interesting (based on a config
parameter). Some users what to give the replication
thread very low priority, see http://bugs.mysq.com/25078
This can be done by introducing
innodb_replication_delay(ms) config parameter */
return;
}
/* If trx has 'free tickets' to enter the engine left, then use one
such ticket */
......@@ -1162,6 +1174,12 @@ srv_conc_force_exit_innodb(
return;
}
if (trx->mysql_thd != NULL
&& thd_is_replication_slave_thread(trx->mysql_thd)) {
return;
}
if (trx->declared_to_be_inside_innodb == FALSE) {
return;
......
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