Commit 00196be7 authored by Jimmy Yang's avatar Jimmy Yang

Fix bug #53165, Setting innodb_change_buffering=DEFAULT produces incorrect result.

rb://295 approved by Marko
parent 6327a4f0
...@@ -10542,6 +10542,34 @@ innodb_old_blocks_pct_update( ...@@ -10542,6 +10542,34 @@ innodb_old_blocks_pct_update(
*static_cast<const uint*>(save), TRUE); *static_cast<const uint*>(save), TRUE);
} }
/*************************************************************//**
Find the corresponding ibuf_use_t value that indexes into
innobase_change_buffering_values[] array for the input
change buffering option name.
@return corresponding IBUF_USE_* value for the input variable
name, or IBUF_USE_COUNT if not able to find a match */
static
ibuf_use_t
innodb_find_change_buffering_value(
/*===============================*/
const char* input_name) /*!< in: input change buffering
option name */
{
ulint use;
for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
use++) {
/* found a match */
if (!innobase_strcasecmp(
input_name, innobase_change_buffering_values[use])) {
return((ibuf_use_t)use);
}
}
/* Did not find any match */
return(IBUF_USE_COUNT);
}
/*************************************************************//** /*************************************************************//**
Check if it is a valid value of innodb_change_buffering. This function is Check if it is a valid value of innodb_change_buffering. This function is
registered as a callback with MySQL. registered as a callback with MySQL.
...@@ -10567,19 +10595,22 @@ innodb_change_buffering_validate( ...@@ -10567,19 +10595,22 @@ innodb_change_buffering_validate(
change_buffering_input = value->val_str(value, buff, &len); change_buffering_input = value->val_str(value, buff, &len);
if (change_buffering_input != NULL) { if (change_buffering_input != NULL) {
ulint use; ibuf_use_t use;
use = innodb_find_change_buffering_value(
change_buffering_input);
if (use != IBUF_USE_COUNT) {
/* Find a matching change_buffering option value. */
*static_cast<const char**>(save) =
innobase_change_buffering_values[use];
for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
use++) {
if (!innobase_strcasecmp(
change_buffering_input,
innobase_change_buffering_values[use])) {
*(ibuf_use_t*) save = (ibuf_use_t) use;
return(0); return(0);
} }
} }
}
/* No corresponding change buffering option for user supplied
"change_buffering_input" */
return(1); return(1);
} }
...@@ -10593,18 +10624,24 @@ innodb_change_buffering_update( ...@@ -10593,18 +10624,24 @@ innodb_change_buffering_update(
THD* thd, /*!< in: thread handle */ THD* thd, /*!< in: thread handle */
struct st_mysql_sys_var* var, /*!< in: pointer to struct st_mysql_sys_var* var, /*!< in: pointer to
system variable */ system variable */
void* var_ptr, /*!< out: where the void* var_ptr,/*!< out: where the
formal string goes */ formal string goes */
const void* save) /*!< in: immediate result const void* save) /*!< in: immediate result
from check function */ from check function */
{ {
ibuf_use_t use;
ut_a(var_ptr != NULL); ut_a(var_ptr != NULL);
ut_a(save != NULL); ut_a(save != NULL);
ut_a((*(ibuf_use_t*) save) < IBUF_USE_COUNT);
ibuf_use = *(const ibuf_use_t*) save; use = innodb_find_change_buffering_value(
*static_cast<const char*const*>(save));
ut_a(use < IBUF_USE_COUNT);
*(const char**) var_ptr = innobase_change_buffering_values[ibuf_use]; ibuf_use = use;
*static_cast<const char**>(var_ptr) =
*static_cast<const char*const*>(save);
} }
static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff) static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff)
...@@ -10959,7 +10996,7 @@ static MYSQL_SYSVAR_STR(change_buffering, innobase_change_buffering, ...@@ -10959,7 +10996,7 @@ static MYSQL_SYSVAR_STR(change_buffering, innobase_change_buffering,
"Buffer changes to reduce random access: " "Buffer changes to reduce random access: "
"OFF, ON, inserting, deleting, changing, or purging.", "OFF, ON, inserting, deleting, changing, or purging.",
innodb_change_buffering_validate, innodb_change_buffering_validate,
innodb_change_buffering_update, NULL); innodb_change_buffering_update, "all");
static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold, static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG,
......
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