Commit 4bd94afb authored by Monty's avatar Monty

MDEV-32884 Make s3_debug dynamic

parent 18166e45
drop table if exists t1;
#
# MDEV-32884 Make s3_debug dynamic
#
create or replace table t1 (a int, b int, c varchar(1000), key (a), key(c)) engine=aria;
insert into t1 select seq, seq+10, repeat(char(65+ mod(seq, 20)),mod(seq,1000)) from seq_1_to_100;
alter table t1 engine=s3;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
`c` varchar(1000) DEFAULT NULL,
KEY `a` (`a`),
KEY `c` (`c`)
) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
select count(*) from t1;
count(*)
100
flush table t1;
NOT FOUND /storage-engine/s3_test_/ in mysqld.1.err
set @@global.s3_debug=1;
select count(*) from t1;
count(*)
100
set @@global.s3_debug=0;
FOUND 6 /storage-engine/s3_test_/ in mysqld.1.err
select count(*) from t1;
count(*)
100
drop table t1;
FOUND 6 /storage-engine/s3_test_/ in mysqld.1.err
--source include/have_s3.inc
--source include/have_sequence.inc
#
# Create unique database for running the tests
#
--source create_database.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
--echo #
--echo # MDEV-32884 Make s3_debug dynamic
--echo #
create or replace table t1 (a int, b int, c varchar(1000), key (a), key(c)) engine=aria;
insert into t1 select seq, seq+10, repeat(char(65+ mod(seq, 20)),mod(seq,1000)) from seq_1_to_100;
alter table t1 engine=s3;
show create table t1;
select count(*) from t1;
flush table t1;
--let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err
--let SEARCH_PATTERN=storage-engine/s3_test_
--source include/search_pattern_in_file.inc
set @@global.s3_debug=1;
select count(*) from t1;
set @@global.s3_debug=0;
--source include/search_pattern_in_file.inc
select count(*) from t1;
drop table t1;
--source include/search_pattern_in_file.inc
--source drop_database.inc
...@@ -195,7 +195,7 @@ static void get_options(int *argc, char ***argv) ...@@ -195,7 +195,7 @@ static void get_options(int *argc, char ***argv)
my_exit(-1); my_exit(-1);
} }
if (opt_s3_debug) if (opt_s3_debug)
ms3_debug(); ms3_debug(1);
} /* get_options */ } /* get_options */
......
...@@ -121,6 +121,29 @@ static void update_secret_key(MYSQL_THD thd, ...@@ -121,6 +121,29 @@ static void update_secret_key(MYSQL_THD thd,
} }
} }
static void update_s3_debug(MYSQL_THD thd,
struct st_mysql_sys_var *var
__attribute__((unused)),
void *var_ptr __attribute__((unused)),
const void *save)
{
char new_state= *(char *) save;
if (s3_debug != new_state)
{
s3_debug= new_state;
if (s3_hton) // If library is initalized
{
ms3_debug(new_state);
if (!new_state)
{
/* Ensure that all logging is written to log */
fflush(stderr);
}
}
}
}
/* Define system variables for S3 */ /* Define system variables for S3 */
static MYSQL_SYSVAR_ULONG(block_size, s3_block_size, static MYSQL_SYSVAR_ULONG(block_size, s3_block_size,
...@@ -129,9 +152,9 @@ static MYSQL_SYSVAR_ULONG(block_size, s3_block_size, ...@@ -129,9 +152,9 @@ static MYSQL_SYSVAR_ULONG(block_size, s3_block_size,
4*1024*1024, 65536, 16*1024*1024, 8192); 4*1024*1024, 65536, 16*1024*1024, 8192);
static MYSQL_SYSVAR_BOOL(debug, s3_debug, static MYSQL_SYSVAR_BOOL(debug, s3_debug,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG,
"Generates trace file from libmarias3 on stderr for debugging", "Generates trace file from libmarias3 on stderr for debugging",
0, 0, 0); 0, update_s3_debug, 0);
static MYSQL_SYSVAR_BOOL(slave_ignore_updates, s3_slave_ignore_updates, static MYSQL_SYSVAR_BOOL(slave_ignore_updates, s3_slave_ignore_updates,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
...@@ -1048,7 +1071,7 @@ static int ha_s3_init(void *p) ...@@ -1048,7 +1071,7 @@ static int ha_s3_init(void *p)
s3_pagecache.big_block_free= s3_free; s3_pagecache.big_block_free= s3_free;
s3_init_library(); s3_init_library();
if (s3_debug) if (s3_debug)
ms3_debug(); ms3_debug(1);
struct s3_func s3f_real = struct s3_func s3f_real =
{ {
......
Subproject commit 3846890513df0653b8919bc45a7600f9b55cab31 Subproject commit a81724ab07bd28e16bf431419c24b6362d5894fc
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