Skip to content

Commit e9630e4

Browse files
author
Aditya A
committed
Bug #29717909 MEMORY LIFETIME OF VARIABLES BETWEEN CHECK AND UPDATE INCORRECTLY MANAGED
Post push fix 1) innodb_buffer_pool_filename variable cannot be set to null in Windows. The behavior is not consistent with Linux where there is no check function and it allows it be set as NULL. It is better not to allow it to be set as NULL in Linux as well for the following reasons (i) The purpose of the innodb_buffer_pool_filename is to specify the name of the file where the list of tablespace IDs and page IDs produced by innodb_buffer_pool_dump_at_shutdown or innodb_buffer_pool_dump_now should go. (ii) When set as NULL in Linux and when we turn on innodb_buffer_pool_dump_now it creates a file called "(null)" which is not correct. So as a fix we will not allow innodb_buffer_pool_filename to be set as NULL 2) Doxygen failure in declaring the function name Reviewed-by: Debarun Banerjee <debarun.banerjee@oracle.com>
1 parent 0b0c306 commit e9630e4

File tree

3 files changed

+39
-37
lines changed

3 files changed

+39
-37
lines changed

mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ drop table user_stopword_1, user_stopword_2;
2828
select @@innodb_buffer_pool_filename;
2929
@@innodb_buffer_pool_filename
3030
ib_buffer_pool
31-
set global innodb_buffer_pool_filename="hello";
31+
set @blah='hello';
32+
set global innodb_buffer_pool_filename = @blah;
3233
select @@innodb_buffer_pool_filename;
3334
@@innodb_buffer_pool_filename
3435
hello
@@ -37,9 +38,7 @@ select @@innodb_buffer_pool_filename;
3738
@@innodb_buffer_pool_filename
3839
bye
3940
set global innodb_buffer_pool_filename=NULL;
40-
select @@innodb_buffer_pool_filename;
41-
@@innodb_buffer_pool_filename
42-
NULL
41+
ERROR 42000: Variable 'innodb_buffer_pool_filename' can't be set to the value of 'NULL'
4342
set global innodb_buffer_pool_filename=default;
4443
select @@innodb_buffer_pool_filename;
4544
@@innodb_buffer_pool_filename

mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ drop table user_stopword_1, user_stopword_2;
2626
#Test innodb_buffer_pool_filename (global variable)
2727

2828
select @@innodb_buffer_pool_filename;
29-
set global innodb_buffer_pool_filename="hello";
29+
30+
set @blah='hello';
31+
set global innodb_buffer_pool_filename = @blah;
3032
select @@innodb_buffer_pool_filename;
3133

3234
set global innodb_buffer_pool_filename="bye";
3335
select @@innodb_buffer_pool_filename;
3436

37+
--error ER_WRONG_VALUE_FOR_VAR
3538
set global innodb_buffer_pool_filename=NULL;
36-
select @@innodb_buffer_pool_filename;
3739

3840
set global innodb_buffer_pool_filename=default;
3941
select @@innodb_buffer_pool_filename;

storage/innobase/handler/ha_innodb.cc

+32-31
Original file line numberDiff line numberDiff line change
@@ -494,20 +494,21 @@ ib_cb_t innodb_api_cb[] = {
494494
(ib_cb_t) ib_trx_read_only
495495
};
496496

497-
/*************************************************************//**
498-
Check whether valid argument given to innodb_ft_*_stopword_table.
497+
/**Check whether valid argument given to innobase_*_stopword_table.
499498
This function is registered as a callback with MySQL.
499+
@param[in] thd thread handle
500+
@param[in] var pointer to system variable
501+
@param[out] save immediate result for update function
502+
@param[in] value incoming string
500503
@return 0 for valid stopword table */
501504
static
502505
int
503506
innodb_stopword_table_validate(
504507
/*===========================*/
505-
THD* thd, /*!< in: thread handle */
506-
struct st_mysql_sys_var* var, /*!< in: pointer to system
507-
variable */
508-
void* save, /*!< out: immediate result
509-
for update function */
510-
struct st_mysql_value* value); /*!< in: incoming string */
508+
THD* thd,
509+
struct st_mysql_sys_var* var,
510+
void* save,
511+
struct st_mysql_value* value);
511512

512513
/** Validate passed-in "value" is a valid directory name.
513514
This function is registered as a callback with MySQL.
@@ -15271,7 +15272,6 @@ innodb_monitor_update(
1527115272
return;
1527215273
}
1527315274

15274-
#ifdef __WIN__
1527515275
/** Validate if passed-in "value" is a valid value for
1527615276
innodb_buffer_pool_filename. On Windows, file names with colon (:)
1527715277
are not allowed.
@@ -15297,32 +15297,33 @@ innodb_srv_buf_dump_filename_validate(
1529715297

1529815298
buf_name = value->val_str(value, buff, &len);
1529915299

15300-
if (buf_name) {
15301-
15302-
if (buf_name == buff) {
15303-
ut_ad(len <= OS_FILE_MAX_PATH);
15304-
/* Allocate from thd's memroot */
15305-
buf_name = thd_strmake(thd, buf_name, len);
15306-
}
15307-
15308-
if (is_filename_allowed(buf_name, len, FALSE)){
15309-
*static_cast<const char**>(save) = buf_name;
15310-
return(0);
15311-
} else {
15312-
push_warning_printf(thd,
15313-
Sql_condition::WARN_LEVEL_WARN,
15314-
ER_WRONG_ARGUMENTS,
15315-
"InnoDB: innodb_buffer_pool_filename "
15316-
"cannot have colon (:) in the file name.");
15300+
if (buf_name == NULL) {
15301+
return(1);
15302+
}
1531715303

15318-
}
15304+
if (buf_name == buff) {
15305+
ut_ad(len <= OS_FILE_MAX_PATH);
15306+
/* Allocate from thd's memroot */
15307+
buf_name = thd_strmake(thd, buf_name, len);
1531915308
}
1532015309

15321-
return(1);
15310+
#ifdef __WIN__
15311+
if (is_filename_allowed(buf_name, len, FALSE)){
15312+
*static_cast<const char**>(save) = buf_name;
15313+
return(0);
15314+
} else {
15315+
push_warning_printf(thd,
15316+
Sql_condition::WARN_LEVEL_WARN,
15317+
ER_WRONG_ARGUMENTS,
15318+
"InnoDB: innodb_buffer_pool_filename "
15319+
"cannot have colon (:) in the file name.");
15320+
return(1);
15321+
}
15322+
#else
15323+
*static_cast<const char**>(save) = buf_name;
15324+
return(0);
15325+
#endif
1532215326
}
15323-
#else /* __WIN__ */
15324-
# define innodb_srv_buf_dump_filename_validate NULL
15325-
#endif /* __WIN__ */
1532615327

1532715328
#ifdef UNIV_DEBUG
1532815329
static char* srv_buffer_pool_evict;

0 commit comments

Comments
 (0)