Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
a09d6409
Commit
a09d6409
authored
Dec 08, 2003
by
gluh@gluh.mysql.r18.ru
Browse files
Options
Browse Files
Download
Plain Diff
post-merge fixes
parents
d7f0cd24
b46d75f0
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
278 additions
and
14 deletions
+278
-14
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+1
-1
mysql-test/r/init_connect.result
mysql-test/r/init_connect.result
+24
-0
mysql-test/r/rpl_init_slave.result
mysql-test/r/rpl_init_slave.result
+23
-0
mysql-test/t/init_connect-master.opt
mysql-test/t/init_connect-master.opt
+1
-0
mysql-test/t/init_connect.test
mysql-test/t/init_connect.test
+34
-0
mysql-test/t/rpl_init_slave-slave.opt
mysql-test/t/rpl_init_slave-slave.opt
+1
-0
mysql-test/t/rpl_init_slave.test
mysql-test/t/rpl_init_slave.test
+26
-0
sql/mysql_priv.h
sql/mysql_priv.h
+3
-1
sql/mysqld.cc
sql/mysqld.cc
+27
-3
sql/set_var.cc
sql/set_var.cc
+74
-0
sql/set_var.h
sql/set_var.h
+3
-0
sql/slave.cc
sql/slave.cc
+12
-0
sql/sql_parse.cc
sql/sql_parse.cc
+40
-3
sql/sql_show.cc
sql/sql_show.cc
+9
-6
No files found.
mysql-test/mysql-test-run.sh
View file @
a09d6409
...
@@ -805,7 +805,7 @@ manager_launch()
...
@@ -805,7 +805,7 @@ manager_launch()
ident
=
$1
ident
=
$1
shift
shift
if
[
$USE_MANAGER
=
0
]
;
then
if
[
$USE_MANAGER
=
0
]
;
then
$@
>>
$CUR_MYERR
2>&1
&
echo
$@
| /bin/sh
>>
$CUR_MYERR
2>&1
&
sleep
2
#hack
sleep
2
#hack
return
return
fi
fi
...
...
mysql-test/r/init_connect.result
0 → 100644
View file @
a09d6409
select hex(@a);
hex(@a)
NULL
select hex(@a);
hex(@a)
610063
set global init_connect="set @a=2;set @b=3";
select @a, @b;
@a @b
2 3
set GLOBAL init_connect=DEFAULT;
select @a;
@a
NULL
set global init_connect="create table t1(a char(10));\
insert into t1 values ('\0');insert into t1 values('abc')";
select hex(a) from t1;
hex(a)
00
616263
set GLOBAL init_connect="adsfsdfsdfs";
select @a;
ERROR HY000: Lost connection to MySQL server during query
drop table t1;
mysql-test/r/rpl_init_slave.result
0 → 100644
View file @
a09d6409
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
reset master;
create table t1(n int);
insert into t1 values (@a), (@b);
select * from t1;
n
NULL
NULL
select * from t1;
n
1
2
set global init_connect="set @c=1";
show variables like 'init_connect';
Variable_name Value
init_connect set @c=1
drop table t1;
stop slave;
mysql-test/t/init_connect-master.opt
0 → 100644
View file @
a09d6409
--set-variable=init_connect="set @a='a\0c'"
mysql-test/t/init_connect.test
0 → 100644
View file @
a09d6409
#
# Test of init_connect variable
#
connect
(
con0
,
localhost
,
root
,,);
connection
con0
;
select
hex
(
@
a
);
connect
(
con1
,
localhost
,
user_1
,,);
connection
con1
;
select
hex
(
@
a
);
connection
con0
;
set
global
init_connect
=
"set @a=2;set @b=3"
;
connect
(
con2
,
localhost
,
user_1
,,);
connection
con2
;
select
@
a
,
@
b
;
connection
con0
;
set
GLOBAL
init_connect
=
DEFAULT
;
connect
(
con3
,
localhost
,
user_1
,,);
connection
con3
;
select
@
a
;
connection
con0
;
set
global
init_connect
=
"create table t1(a char(10));\
insert into t1 values ('
\0
');insert into t1 values('abc')"
;
connect
(
con4
,
localhost
,
user_1
,,);
connection
con4
;
select
hex
(
a
)
from
t1
;
connection
con0
;
set
GLOBAL
init_connect
=
"adsfsdfsdfs"
;
connect
(
con5
,
localhost
,
user_1
,,);
connection
con5
;
--
error
2013
select
@
a
;
connection
con0
;
drop
table
t1
;
mysql-test/t/rpl_init_slave-slave.opt
0 → 100644
View file @
a09d6409
--init-slave="set @a=1;set @b=2"
mysql-test/t/rpl_init_slave.test
0 → 100644
View file @
a09d6409
source
include
/
master
-
slave
.
inc
;
#
# Test of init_slave variable
#
save_master_pos
;
connection
slave
;
sync_with_master
;
reset
master
;
connection
master
;
create
table
t1
(
n
int
);
insert
into
t1
values
(
@
a
),
(
@
b
);
select
*
from
t1
;
save_master_pos
;
connection
slave
;
sync_with_master
;
select
*
from
t1
;
set
global
init_connect
=
"set @c=1"
;
show
variables
like
'init_connect'
;
connection
master
;
drop
table
t1
;
save_master_pos
;
connection
slave
;
sync_with_master
;
stop
slave
;
sql/mysql_priv.h
View file @
a09d6409
...
@@ -554,6 +554,8 @@ bool wait_for_tables(THD *thd);
...
@@ -554,6 +554,8 @@ bool wait_for_tables(THD *thd);
bool
table_is_used
(
TABLE
*
table
,
bool
wait_for_name_lock
);
bool
table_is_used
(
TABLE
*
table
,
bool
wait_for_name_lock
);
bool
drop_locked_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
bool
drop_locked_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
void
abort_locked_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
void
abort_locked_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
void
execute_init_command
(
THD
*
thd
,
sys_var_str
*
init_command_var
,
rw_lock_t
*
var_mutex
);
extern
const
Field
*
not_found_field
;
extern
const
Field
*
not_found_field
;
Field
*
find_field_in_tables
(
THD
*
thd
,
Item_ident
*
item
,
TABLE_LIST
*
tables
,
Field
*
find_field_in_tables
(
THD
*
thd
,
Item_ident
*
item
,
TABLE_LIST
*
tables
,
TABLE_LIST
**
where
,
bool
report_error
);
TABLE_LIST
**
where
,
bool
report_error
);
...
@@ -846,7 +848,7 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
...
@@ -846,7 +848,7 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
LOCK_delayed_status
,
LOCK_delayed_create
,
LOCK_crypt
,
LOCK_timezone
,
LOCK_delayed_status
,
LOCK_delayed_create
,
LOCK_crypt
,
LOCK_timezone
,
LOCK_slave_list
,
LOCK_active_mi
,
LOCK_manager
,
LOCK_slave_list
,
LOCK_active_mi
,
LOCK_manager
,
LOCK_global_system_variables
,
LOCK_user_conn
;
LOCK_global_system_variables
,
LOCK_user_conn
;
extern
rw_lock_t
LOCK_grant
;
extern
rw_lock_t
LOCK_grant
,
LOCK_sys_init_connect
,
LOCK_sys_init_slave
;
extern
pthread_cond_t
COND_refresh
,
COND_thread_count
,
COND_manager
;
extern
pthread_cond_t
COND_refresh
,
COND_thread_count
,
COND_manager
;
extern
pthread_attr_t
connection_attrib
;
extern
pthread_attr_t
connection_attrib
;
extern
I_List
<
THD
>
threads
;
extern
I_List
<
THD
>
threads
;
...
...
sql/mysqld.cc
View file @
a09d6409
...
@@ -316,7 +316,8 @@ char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN];
...
@@ -316,7 +316,8 @@ char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN];
char
*
log_error_file_ptr
=
log_error_file
;
char
*
log_error_file_ptr
=
log_error_file
;
char
mysql_real_data_home
[
FN_REFLEN
],
char
mysql_real_data_home
[
FN_REFLEN
],
language
[
LIBLEN
],
reg_ext
[
FN_EXTLEN
],
mysql_charsets_dir
[
FN_REFLEN
],
language
[
LIBLEN
],
reg_ext
[
FN_EXTLEN
],
mysql_charsets_dir
[
FN_REFLEN
],
max_sort_char
,
*
mysqld_user
,
*
mysqld_chroot
,
*
opt_init_file
;
max_sort_char
,
*
mysqld_user
,
*
mysqld_chroot
,
*
opt_init_file
,
*
opt_init_connect
,
*
opt_init_slave
;
const
char
*
opt_date_time_formats
[
3
];
const
char
*
opt_date_time_formats
[
3
];
...
@@ -375,7 +376,7 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count,
...
@@ -375,7 +376,7 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count,
LOCK_crypt
,
LOCK_bytes_sent
,
LOCK_bytes_received
,
LOCK_crypt
,
LOCK_bytes_sent
,
LOCK_bytes_received
,
LOCK_global_system_variables
,
LOCK_global_system_variables
,
LOCK_user_conn
,
LOCK_slave_list
,
LOCK_active_mi
;
LOCK_user_conn
,
LOCK_slave_list
,
LOCK_active_mi
;
rw_lock_t
LOCK_grant
;
rw_lock_t
LOCK_grant
,
LOCK_sys_init_connect
,
LOCK_sys_init_slave
;
pthread_cond_t
COND_refresh
,
COND_thread_count
,
COND_slave_stopped
,
pthread_cond_t
COND_refresh
,
COND_thread_count
,
COND_slave_stopped
,
COND_slave_start
;
COND_slave_start
;
pthread_cond_t
COND_thread_cache
,
COND_flush_thread_cache
;
pthread_cond_t
COND_thread_cache
,
COND_flush_thread_cache
;
...
@@ -923,6 +924,8 @@ void clean_up(bool print_message)
...
@@ -923,6 +924,8 @@ void clean_up(bool print_message)
MYF
(
MY_ALLOW_ZERO_PTR
));
MYF
(
MY_ALLOW_ZERO_PTR
));
if
(
defaults_argv
)
if
(
defaults_argv
)
free_defaults
(
defaults_argv
);
free_defaults
(
defaults_argv
);
my_free
(
sys_init_connect
.
value
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
(
sys_init_slave
.
value
,
MYF
(
MY_ALLOW_ZERO_PTR
));
free_tmpdir
(
&
mysql_tmpdir_list
);
free_tmpdir
(
&
mysql_tmpdir_list
);
#ifdef HAVE_REPLICATION
#ifdef HAVE_REPLICATION
my_free
(
slave_load_tmpdir
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
(
slave_load_tmpdir
,
MYF
(
MY_ALLOW_ZERO_PTR
));
...
@@ -994,6 +997,8 @@ static void clean_up_mutexes()
...
@@ -994,6 +997,8 @@ static void clean_up_mutexes()
(
void
)
pthread_cond_destroy
(
&
COND_rpl_status
);
(
void
)
pthread_cond_destroy
(
&
COND_rpl_status
);
#endif
#endif
(
void
)
pthread_mutex_destroy
(
&
LOCK_active_mi
);
(
void
)
pthread_mutex_destroy
(
&
LOCK_active_mi
);
(
void
)
rwlock_destroy
(
&
LOCK_sys_init_connect
);
(
void
)
rwlock_destroy
(
&
LOCK_sys_init_slave
);
(
void
)
pthread_mutex_destroy
(
&
LOCK_global_system_variables
);
(
void
)
pthread_mutex_destroy
(
&
LOCK_global_system_variables
);
(
void
)
pthread_cond_destroy
(
&
COND_thread_count
);
(
void
)
pthread_cond_destroy
(
&
COND_thread_count
);
(
void
)
pthread_cond_destroy
(
&
COND_refresh
);
(
void
)
pthread_cond_destroy
(
&
COND_refresh
);
...
@@ -2174,6 +2179,15 @@ static int init_common_variables(const char *conf_file_name, int argc,
...
@@ -2174,6 +2179,15 @@ static int init_common_variables(const char *conf_file_name, int argc,
global_system_variables
.
collation_connection
=
default_charset_info
;
global_system_variables
.
collation_connection
=
default_charset_info
;
global_system_variables
.
character_set_results
=
default_charset_info
;
global_system_variables
.
character_set_results
=
default_charset_info
;
global_system_variables
.
character_set_client
=
default_charset_info
;
global_system_variables
.
character_set_client
=
default_charset_info
;
global_system_variables
.
collation_connection
=
default_charset_info
;
sys_init_connect
.
value_length
=
0
;
if
((
sys_init_connect
.
value
=
opt_init_connect
))
sys_init_connect
.
value_length
=
strlen
(
opt_init_connect
);
sys_init_slave
.
value_length
=
0
;
if
((
sys_init_slave
.
value
=
opt_init_slave
))
sys_init_slave
.
value_length
=
strlen
(
opt_init_slave
);
if
(
use_temp_pool
&&
bitmap_init
(
&
temp_pool
,
0
,
1024
,
1
))
if
(
use_temp_pool
&&
bitmap_init
(
&
temp_pool
,
0
,
1024
,
1
))
return
1
;
return
1
;
...
@@ -2200,6 +2214,8 @@ static int init_thread_environment()
...
@@ -2200,6 +2214,8 @@ static int init_thread_environment()
(
void
)
pthread_mutex_init
(
&
LOCK_user_conn
,
MY_MUTEX_INIT_FAST
);
(
void
)
pthread_mutex_init
(
&
LOCK_user_conn
,
MY_MUTEX_INIT_FAST
);
(
void
)
pthread_mutex_init
(
&
LOCK_active_mi
,
MY_MUTEX_INIT_FAST
);
(
void
)
pthread_mutex_init
(
&
LOCK_active_mi
,
MY_MUTEX_INIT_FAST
);
(
void
)
pthread_mutex_init
(
&
LOCK_global_system_variables
,
MY_MUTEX_INIT_FAST
);
(
void
)
pthread_mutex_init
(
&
LOCK_global_system_variables
,
MY_MUTEX_INIT_FAST
);
(
void
)
my_rwlock_init
(
&
LOCK_sys_init_connect
,
NULL
);
(
void
)
my_rwlock_init
(
&
LOCK_sys_init_slave
,
NULL
);
(
void
)
my_rwlock_init
(
&
LOCK_grant
,
NULL
);
(
void
)
my_rwlock_init
(
&
LOCK_grant
,
NULL
);
(
void
)
pthread_cond_init
(
&
COND_thread_count
,
NULL
);
(
void
)
pthread_cond_init
(
&
COND_thread_count
,
NULL
);
(
void
)
pthread_cond_init
(
&
COND_refresh
,
NULL
);
(
void
)
pthread_cond_init
(
&
COND_refresh
,
NULL
);
...
@@ -3640,6 +3656,8 @@ enum options_mysqld
...
@@ -3640,6 +3656,8 @@ enum options_mysqld
OPT_EXPIRE_LOGS_DAYS
,
OPT_EXPIRE_LOGS_DAYS
,
OPT_GROUP_CONCAT_MAX_LEN
,
OPT_GROUP_CONCAT_MAX_LEN
,
OPT_DEFAULT_COLLATION
,
OPT_DEFAULT_COLLATION
,
OPT_INIT_CONNECT
,
OPT_INIT_SLAVE
,
OPT_SECURE_AUTH
,
OPT_SECURE_AUTH
,
OPT_DATE_FORMAT
,
OPT_DATE_FORMAT
,
OPT_TIME_FORMAT
,
OPT_TIME_FORMAT
,
...
@@ -3816,6 +3834,12 @@ Disable with --skip-bdb (will save memory).",
...
@@ -3816,6 +3834,12 @@ Disable with --skip-bdb (will save memory).",
(
gptr
*
)
&
innobase_file_per_table
,
(
gptr
*
)
&
innobase_file_per_table
,
(
gptr
*
)
&
innobase_file_per_table
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
(
gptr
*
)
&
innobase_file_per_table
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
#endif
/* End HAVE_INNOBASE_DB */
#endif
/* End HAVE_INNOBASE_DB */
{
"init-connect"
,
OPT_INIT_CONNECT
,
"Command(s) that are executed for each new connection"
,
(
gptr
*
)
&
opt_init_connect
,
(
gptr
*
)
&
opt_init_connect
,
0
,
GET_STR_ALLOC
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"init-slave"
,
OPT_INIT_SLAVE
,
"Command(s) that are executed when a slave connects to this master"
,
(
gptr
*
)
&
opt_init_slave
,
(
gptr
*
)
&
opt_init_slave
,
0
,
GET_STR_ALLOC
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"help"
,
'?'
,
"Display this help and exit."
,
{
"help"
,
'?'
,
"Display this help and exit."
,
(
gptr
*
)
&
opt_help
,
(
gptr
*
)
&
opt_help
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
(
gptr
*
)
&
opt_help
,
(
gptr
*
)
&
opt_help
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
0
},
...
...
sql/set_var.cc
View file @
a09d6409
...
@@ -76,6 +76,10 @@ TYPELIB delay_key_write_typelib=
...
@@ -76,6 +76,10 @@ TYPELIB delay_key_write_typelib=
static
bool
sys_check_charset
(
THD
*
thd
,
set_var
*
var
);
static
bool
sys_check_charset
(
THD
*
thd
,
set_var
*
var
);
static
bool
sys_update_charset
(
THD
*
thd
,
set_var
*
var
);
static
bool
sys_update_charset
(
THD
*
thd
,
set_var
*
var
);
static
void
sys_set_default_charset
(
THD
*
thd
,
enum_var_type
type
);
static
void
sys_set_default_charset
(
THD
*
thd
,
enum_var_type
type
);
static
bool
sys_update_init_connect
(
THD
*
,
set_var
*
);
static
void
sys_default_init_connect
(
THD
*
,
enum_var_type
type
);
static
bool
sys_update_init_slave
(
THD
*
,
set_var
*
);
static
void
sys_default_init_slave
(
THD
*
,
enum_var_type
type
);
static
bool
set_option_bit
(
THD
*
thd
,
set_var
*
var
);
static
bool
set_option_bit
(
THD
*
thd
,
set_var
*
var
);
static
bool
set_option_autocommit
(
THD
*
thd
,
set_var
*
var
);
static
bool
set_option_autocommit
(
THD
*
thd
,
set_var
*
var
);
static
bool
set_log_update
(
THD
*
thd
,
set_var
*
var
);
static
bool
set_log_update
(
THD
*
thd
,
set_var
*
var
);
...
@@ -113,6 +117,12 @@ sys_var_str sys_charset_system("character_set_system",
...
@@ -113,6 +117,12 @@ sys_var_str sys_charset_system("character_set_system",
sys_check_charset
,
sys_check_charset
,
sys_update_charset
,
sys_update_charset
,
sys_set_default_charset
);
sys_set_default_charset
);
sys_var_str
sys_init_connect
(
"init_connect"
,
0
,
sys_update_init_connect
,
sys_default_init_connect
);
sys_var_str
sys_init_slave
(
"init_slave"
,
0
,
sys_update_init_slave
,
sys_default_init_slave
);
sys_var_character_set_database
sys_character_set_database
(
"character_set_database"
);
sys_var_character_set_database
sys_character_set_database
(
"character_set_database"
);
sys_var_character_set_client
sys_character_set_client
(
"character_set_client"
);
sys_var_character_set_client
sys_character_set_client
(
"character_set_client"
);
sys_var_character_set_connection
sys_character_set_connection
(
"character_set_connection"
);
sys_var_character_set_connection
sys_character_set_connection
(
"character_set_connection"
);
...
@@ -435,6 +445,8 @@ sys_var *sys_variables[]=
...
@@ -435,6 +445,8 @@ sys_var *sys_variables[]=
&
sys_foreign_key_checks
,
&
sys_foreign_key_checks
,
&
sys_group_concat_max_len
,
&
sys_group_concat_max_len
,
&
sys_identity
,
&
sys_identity
,
&
sys_init_connect
,
&
sys_init_slave
,
&
sys_insert_id
,
&
sys_insert_id
,
&
sys_interactive_timeout
,
&
sys_interactive_timeout
,
&
sys_join_buffer_size
,
&
sys_join_buffer_size
,
...
@@ -587,6 +599,8 @@ struct show_var_st init_vars[]= {
...
@@ -587,6 +599,8 @@ struct show_var_st init_vars[]= {
{
"have_openssl"
,
(
char
*
)
&
have_openssl
,
SHOW_HAVE
},
{
"have_openssl"
,
(
char
*
)
&
have_openssl
,
SHOW_HAVE
},
{
"have_query_cache"
,
(
char
*
)
&
have_query_cache
,
SHOW_HAVE
},
{
"have_query_cache"
,
(
char
*
)
&
have_query_cache
,
SHOW_HAVE
},
{
"init_file"
,
(
char
*
)
&
opt_init_file
,
SHOW_CHAR_PTR
},
{
"init_file"
,
(
char
*
)
&
opt_init_file
,
SHOW_CHAR_PTR
},
{
"init_connect"
,
(
char
*
)
&
sys_init_connect
,
SHOW_SYS
},
{
"init_slave"
,
(
char
*
)
&
sys_init_slave
,
SHOW_SYS
},
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
{
"innodb_additional_mem_pool_size"
,
(
char
*
)
&
innobase_additional_mem_pool_size
,
SHOW_LONG
},
{
"innodb_additional_mem_pool_size"
,
(
char
*
)
&
innobase_additional_mem_pool_size
,
SHOW_LONG
},
{
"innodb_buffer_pool_size"
,
(
char
*
)
&
innobase_buffer_pool_size
,
SHOW_LONG
},
{
"innodb_buffer_pool_size"
,
(
char
*
)
&
innobase_buffer_pool_size
,
SHOW_LONG
},
...
@@ -756,6 +770,66 @@ bool sys_var::check(THD *thd, set_var *var)
...
@@ -756,6 +770,66 @@ bool sys_var::check(THD *thd, set_var *var)
Functions to check and update variables
Functions to check and update variables
*/
*/
/*
Update variables 'init_connect, init_slave'.
In case of 'DEFAULT' value
(for example: 'set GLOBAL init_connect=DEFAULT')
'var' parameter is NULL pointer.
*/
bool
update_sys_var_str
(
sys_var_str
*
var_str
,
rw_lock_t
*
var_mutex
,
set_var
*
var
)
{
char
*
res
=
0
,
*
old_value
;
uint
new_length
=
0
;
/* If the string is "", delete old init command */
if
(
var
&&
(
new_length
=
var
->
value
->
str_value
.
length
()))
{
if
(
!
(
res
=
my_strdup_with_length
(
var
->
value
->
str_value
.
ptr
(),
new_length
,
MYF
(
0
))))
return
1
;
}
/*
Replace the old value in such a way that the any thread using
the value will work.
*/
rw_wrlock
(
var_mutex
);
old_value
=
var_str
->
value
;
var_str
->
value
=
res
;
var_str
->
value_length
=
new_length
;
rw_unlock
(
var_mutex
);
my_free
(
old_value
,
MYF
(
MY_ALLOW_ZERO_PTR
));
return
0
;
}
static
bool
sys_update_init_connect
(
THD
*
thd
,
set_var
*
var
)
{
return
update_sys_var_str
(
&
sys_init_connect
,
&
LOCK_sys_init_connect
,
var
);
}
static
void
sys_default_init_connect
(
THD
*
thd
,
enum_var_type
type
)
{
update_sys_var_str
(
&
sys_init_connect
,
&
LOCK_sys_init_connect
,
0
);
}
static
bool
sys_update_init_slave
(
THD
*
thd
,
set_var
*
var
)
{
return
update_sys_var_str
(
&
sys_init_slave
,
&
LOCK_sys_init_slave
,
var
);
}
static
void
sys_default_init_slave
(
THD
*
thd
,
enum_var_type
type
)
{
update_sys_var_str
(
&
sys_init_slave
,
&
LOCK_sys_init_slave
,
0
);
}
/*
/*
The following 3 functions need to be changed in 4.1 when we allow
The following 3 functions need to be changed in 4.1 when we allow
one to change character sets
one to change character sets
...
...
sql/set_var.h
View file @
a09d6409
...
@@ -132,6 +132,7 @@ class sys_var_str :public sys_var
...
@@ -132,6 +132,7 @@ class sys_var_str :public sys_var
{
{
public:
public:
char
*
value
;
// Pointer to allocated string
char
*
value
;
// Pointer to allocated string
uint
value_length
;
sys_check_func
check_func
;
sys_check_func
check_func
;
sys_update_func
update_func
;
sys_update_func
update_func
;
sys_set_default_func
set_default_func
;
sys_set_default_func
set_default_func
;
...
@@ -803,6 +804,8 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list);
...
@@ -803,6 +804,8 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list);
void
fix_delay_key_write
(
THD
*
thd
,
enum_var_type
type
);
void
fix_delay_key_write
(
THD
*
thd
,
enum_var_type
type
);
ulong
fix_sql_mode
(
ulong
sql_mode
);
ulong
fix_sql_mode
(
ulong
sql_mode
);
extern
sys_var_str
sys_charset_system
;
extern
sys_var_str
sys_charset_system
;
extern
sys_var_str
sys_init_connect
;
extern
sys_var_str
sys_init_slave
;
CHARSET_INFO
*
get_old_charset_by_name
(
const
char
*
old_name
);
CHARSET_INFO
*
get_old_charset_by_name
(
const
char
*
old_name
);
gptr
find_named
(
I_List
<
NAMED_LIST
>
*
list
,
const
char
*
name
,
uint
length
,
gptr
find_named
(
I_List
<
NAMED_LIST
>
*
list
,
const
char
*
name
,
uint
length
,
NAMED_LIST
**
found
);
NAMED_LIST
**
found
);
...
...
sql/slave.cc
View file @
a09d6409
...
@@ -3159,6 +3159,18 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
...
@@ -3159,6 +3159,18 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
llstr
(
rli
->
group_master_log_pos
,
llbuff
),
rli
->
group_relay_log_name
,
llstr
(
rli
->
group_master_log_pos
,
llbuff
),
rli
->
group_relay_log_name
,
llstr
(
rli
->
group_relay_log_pos
,
llbuff1
));
llstr
(
rli
->
group_relay_log_pos
,
llbuff1
));
/* execute init_slave variable */
if
(
sys_init_slave
.
value
)
{
execute_init_command
(
thd
,
&
sys_init_slave
,
&
LOCK_sys_init_slave
);
if
(
thd
->
query_error
)
{
sql_print_error
(
"\
Slave SQL thread aborted. Can't execute init_slave query"
);
goto
err
;
}
}
/* Read queries from the IO/THREAD until this thread is killed */
/* Read queries from the IO/THREAD until this thread is killed */
while
(
!
sql_slave_killed
(
thd
,
rli
))
while
(
!
sql_slave_killed
(
thd
,
rli
))
...
...
sql/sql_parse.cc
View file @
a09d6409
...
@@ -860,6 +860,37 @@ static int check_connection(THD *thd)
...
@@ -860,6 +860,37 @@ static int check_connection(THD *thd)
return
check_user
(
thd
,
COM_CONNECT
,
passwd
,
passwd_len
,
db
,
true
);
return
check_user
(
thd
,
COM_CONNECT
,
passwd
,
passwd_len
,
db
,
true
);
}
}
void
execute_init_command
(
THD
*
thd
,
sys_var_str
*
init_command_var
,
rw_lock_t
*
var_mutex
)
{
Vio
*
save_vio
;
ulong
save_client_capabilities
;
thd
->
proc_info
=
"Execution of init_command"
;
/*
We need to lock init_command_var because
during execution of init_command_var query
values of init_command_var can't be changed
*/
rw_rdlock
(
var_mutex
);
thd
->
query
=
init_command_var
->
value
;
thd
->
query_length
=
init_command_var
->
value_length
;
save_client_capabilities
=
thd
->
client_capabilities
;
thd
->
client_capabilities
|=
CLIENT_MULTI_QUERIES
;
/*
We don't need return result of execution to client side.
To forbid this we should set thd->net.vio to 0.
*/
save_vio
=
thd
->
net
.
vio
;
thd
->
net
.
vio
=
0
;
dispatch_command
(
COM_QUERY
,
thd
,
thd
->
query
,
thd
->
query_length
+
1
);
rw_unlock
(
var_mutex
);
thd
->
client_capabilities
=
save_client_capabilities
;
thd
->
net
.
vio
=
save_vio
;
}
pthread_handler_decl
(
handle_one_connection
,
arg
)
pthread_handler_decl
(
handle_one_connection
,
arg
)
{
{
THD
*
thd
=
(
THD
*
)
arg
;
THD
*
thd
=
(
THD
*
)
arg
;
...
@@ -932,9 +963,15 @@ pthread_handler_decl(handle_one_connection,arg)
...
@@ -932,9 +963,15 @@ pthread_handler_decl(handle_one_connection,arg)
if
(
thd
->
client_capabilities
&
CLIENT_COMPRESS
)
if
(
thd
->
client_capabilities
&
CLIENT_COMPRESS
)
net
->
compress
=
1
;
// Use compression
net
->
compress
=
1
;
// Use compression
thd
->
proc_info
=
0
;
// Remove 'login'
thd
->
version
=
refresh_version
;
thd
->
command
=
COM_SLEEP
;
if
(
sys_init_connect
.
value
&&
!
(
thd
->
master_access
&
SUPER_ACL
))
thd
->
version
=
refresh_version
;
{
execute_init_command
(
thd
,
&
sys_init_connect
,
&
LOCK_sys_init_connect
);
if
(
thd
->
query_error
)
thd
->
killed
=
1
;
}
thd
->
proc_info
=
0
;
thd
->
set_time
();
thd
->
set_time
();
thd
->
init_for_queries
();
thd
->
init_for_queries
();
while
(
!
net
->
error
&&
net
->
vio
!=
0
&&
!
thd
->
killed
)
while
(
!
net
->
error
&&
net
->
vio
!=
0
&&
!
thd
->
killed
)
...
...
sql/sql_show.cc
View file @
a09d6409
...
@@ -1612,9 +1612,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
...
@@ -1612,9 +1612,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
break
;
break
;
}
}
case
SHOW_CHAR
:
case
SHOW_CHAR
:
pos
=
value
;
{
if
(
!
(
pos
=
value
))
pos
=
""
;
end
=
strend
(
pos
);
end
=
strend
(
pos
);
break
;
break
;
}
case
SHOW_STARTTIME
:
case
SHOW_STARTTIME
:
nr
=
(
long
)
(
thd
->
query_start
()
-
start_time
);
nr
=
(
long
)
(
thd
->
query_start
()
-
start_time
);
end
=
int10_to_str
(
nr
,
buff
,
10
);
end
=
int10_to_str
(
nr
,
buff
,
10
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment