mirror of
https://github.com/MariaDB/server.git
synced 2026-04-25 01:35:31 +02:00
Merge paul@bk-internal.mysql.com:/home/bk/mysql-4.1
into teton.kitebird.com:/home/paul/mysql-4.1
This commit is contained in:
commit
01620f1b17
50 changed files with 525 additions and 136 deletions
|
|
@ -640,3 +640,4 @@ vio/test-ssl
|
|||
vio/test-sslclient
|
||||
vio/test-sslserver
|
||||
vio/viotest-ssl
|
||||
INSTALL-WIN-SOURCE
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
|
|||
AC_INIT(sql/mysqld.cc)
|
||||
AC_CANONICAL_SYSTEM
|
||||
# The Docs Makefile.am parses this line!
|
||||
AM_INIT_AUTOMAKE(mysql, 4.1.1-alpha)
|
||||
AM_INIT_AUTOMAKE(mysql, 4.1.2-alpha)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
|
|
|
|||
|
|
@ -340,3 +340,38 @@ inline double ulonglong2double(ulonglong value)
|
|||
#define default_shared_memory_base_name "MYSQL"
|
||||
#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
|
||||
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
|
||||
|
||||
/* Define charsets you want */
|
||||
/* #undef HAVE_CHARSET_armscii8 */
|
||||
/* #undef HAVE_CHARSET_ascii */
|
||||
#define HAVE_CHARSET_big5 1
|
||||
#define HAVE_CHARSET_cp1250 1
|
||||
/* #undef HAVE_CHARSET_cp1251 */
|
||||
/* #undef HAVE_CHARSET_cp1256 */
|
||||
/* #undef HAVE_CHARSET_cp1257 */
|
||||
/* #undef HAVE_CHARSET_cp850 */
|
||||
/* #undef HAVE_CHARSET_cp852 */
|
||||
/* #undef HAVE_CHARSET_cp866 */
|
||||
/* #undef HAVE_CHARSET_dec8 */
|
||||
#define HAVE_CHARSET_euckr 1
|
||||
#define HAVE_CHARSET_gb2312 1
|
||||
#define HAVE_CHARSET_gbk 1
|
||||
/* #undef HAVE_CHARSET_greek */
|
||||
/* #undef HAVE_CHARSET_hebrew */
|
||||
/* #undef HAVE_CHARSET_hp8 */
|
||||
/* #undef HAVE_CHARSET_keybcs2 */
|
||||
/* #undef HAVE_CHARSET_koi8r */
|
||||
/* #undef HAVE_CHARSET_koi8u */
|
||||
#define HAVE_CHARSET_latin1 1
|
||||
#define HAVE_CHARSET_latin2 1
|
||||
/* #undef HAVE_CHARSET_latin5 */
|
||||
/* #undef HAVE_CHARSET_latin7 */
|
||||
/* #undef HAVE_CHARSET_macce */
|
||||
/* #undef HAVE_CHARSET_macroman */
|
||||
#define HAVE_CHARSET_sjis 1
|
||||
/* #undef HAVE_CHARSET_swe7 */
|
||||
#define HAVE_CHARSET_tis620 1
|
||||
#define HAVE_CHARSET_ucs2 1
|
||||
#define HAVE_CHARSET_ujis 1
|
||||
#define HAVE_CHARSET_utf8 1
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FT_QUERY_MAXLEN 1024
|
||||
#define HA_FT_MAXLEN 254
|
||||
#define HA_FT_MAXBYTELEN 254
|
||||
#define HA_FT_MAXCHARLEN (HA_FT_MAXBYTELEN/3)
|
||||
|
||||
typedef struct st_ft_info FT_INFO;
|
||||
struct _ft_vft
|
||||
|
|
|
|||
|
|
@ -124,6 +124,8 @@ enum enum_server_command
|
|||
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
|
||||
#define SERVER_STATUS_MORE_RESULTS 4 /* More results on server */
|
||||
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
|
||||
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
|
||||
#define SERVER_QUERY_NO_INDEX_USED 32
|
||||
|
||||
#define MYSQL_ERRMSG_SIZE 512
|
||||
#define NET_READ_TIMEOUT 30 /* Timeout on read */
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ static my_bool verbose;
|
|||
static char *query=NULL;
|
||||
static uint lengths[256];
|
||||
|
||||
#define MAX_LEN (HA_FT_MAXLEN+10)
|
||||
#define MAX_LEN (HA_FT_MAXBYTELEN+10)
|
||||
#define HOW_OFTEN_TO_WRITE 10000
|
||||
|
||||
static struct my_option my_long_options[] =
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "ftdefs.h"
|
||||
|
||||
ulong ft_min_word_len=4;
|
||||
ulong ft_max_word_len=HA_FT_MAXLEN;
|
||||
ulong ft_max_word_len=HA_FT_MAXCHARLEN;
|
||||
ulong ft_query_expansion_limit=5;
|
||||
const char *ft_boolean_syntax="+ -><()~*:\"\"&|";
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ const HA_KEYSEG ft_keysegs[FT_SEGS]={
|
|||
63, /* language (will be overwritten) */
|
||||
0, 0, 0, /* null_bit, bit_start, bit_end */
|
||||
HA_VAR_LENGTH | HA_PACK_KEY, /* flag */
|
||||
HA_FT_MAXLEN, /* length */
|
||||
HA_FT_MAXBYTELEN, /* length */
|
||||
HA_FT_WLEN, /* start */
|
||||
0, /* null_pos */
|
||||
NULL /* charset */
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
|
|||
uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr,
|
||||
my_off_t filepos)
|
||||
{
|
||||
byte buf[HA_FT_MAXLEN+16];
|
||||
byte buf[HA_FT_MAXBYTELEN+16];
|
||||
DBUG_ENTER("_ft_make_key");
|
||||
|
||||
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
|
||||
|
|
|
|||
|
|
@ -507,6 +507,36 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
|
|||
DBUG_RETURN(result);
|
||||
} /* chk_key */
|
||||
|
||||
static int chk_index_down(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
|
||||
my_off_t page, uchar *buff, ha_rows *keys,
|
||||
ha_checksum *key_checksum, uint level)
|
||||
{
|
||||
char llbuff[22],llbuff2[22];
|
||||
if (page > info->state->key_file_length || (page & (info->s->blocksize -1)))
|
||||
{
|
||||
my_off_t max_length=my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0));
|
||||
mi_check_print_error(param,"Wrong pagepointer: %s at page: %s",
|
||||
llstr(page,llbuff),llstr(page,llbuff2));
|
||||
|
||||
if (page+info->s->blocksize > max_length)
|
||||
goto err;
|
||||
info->state->key_file_length=(max_length &
|
||||
~ (my_off_t) (info->s->blocksize-1));
|
||||
}
|
||||
if (!_mi_fetch_keypage(info,keyinfo,page, DFLT_INIT_HITS,buff,0))
|
||||
{
|
||||
mi_check_print_error(param,"Can't read key from filepos: %s",
|
||||
llstr(page,llbuff));
|
||||
goto err;
|
||||
}
|
||||
param->key_file_blocks+=keyinfo->block_length;
|
||||
if (chk_index(param,info,keyinfo,page,buff,keys,key_checksum,level))
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Check if index is ok */
|
||||
|
||||
|
|
@ -553,27 +583,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
|
|||
if (nod_flag)
|
||||
{
|
||||
next_page=_mi_kpos(nod_flag,keypos);
|
||||
if (next_page > info->state->key_file_length ||
|
||||
(nod_flag && (next_page & (info->s->blocksize -1))))
|
||||
{
|
||||
my_off_t max_length=my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0));
|
||||
mi_check_print_error(param,"Wrong pagepointer: %s at page: %s",
|
||||
llstr(next_page,llbuff),llstr(page,llbuff2));
|
||||
|
||||
if (next_page+info->s->blocksize > max_length)
|
||||
goto err;
|
||||
info->state->key_file_length=(max_length &
|
||||
~ (my_off_t) (info->s->blocksize-1));
|
||||
}
|
||||
if (!_mi_fetch_keypage(info,keyinfo,next_page,
|
||||
DFLT_INIT_HITS,temp_buff,0))
|
||||
{
|
||||
mi_check_print_error(param,"Can't read key from filepos: %s",llstr(next_page,llbuff));
|
||||
goto err;
|
||||
}
|
||||
param->key_file_blocks+=keyinfo->block_length;
|
||||
if (chk_index(param,info,keyinfo,next_page,temp_buff,keys,key_checksum,
|
||||
level+1))
|
||||
if (chk_index_down(param,info,keyinfo,next_page,
|
||||
temp_buff,keys,key_checksum,level+1))
|
||||
goto err;
|
||||
}
|
||||
old_keypos=keypos;
|
||||
|
|
@ -615,6 +626,23 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
|
|||
memcpy((char*) info->lastkey,(char*) key,key_length);
|
||||
info->lastkey_length=key_length;
|
||||
record= _mi_dpos(info,0,key+key_length);
|
||||
if (keyinfo->flag & HA_FULLTEXT) /* special handling for ft2 */
|
||||
{
|
||||
uint off;
|
||||
int subkeys;
|
||||
get_key_full_length_rdonly(off, key);
|
||||
subkeys=ft_sintXkorr(key+off);
|
||||
if (subkeys < 0)
|
||||
{
|
||||
ha_rows tmp_keys=0;
|
||||
if (chk_index_down(param,info,&info->s->ft2_keyinfo,record,
|
||||
temp_buff,&tmp_keys,key_checksum,1))
|
||||
goto err;
|
||||
(*keys)+=tmp_keys-1;
|
||||
continue;
|
||||
}
|
||||
/* fall through */
|
||||
}
|
||||
if (record >= info->state->data_file_length)
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
|
|
@ -1979,7 +2007,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
|||
|
||||
sort_param.key_read=sort_ft_key_read;
|
||||
sort_param.key_write=sort_ft_key_write;
|
||||
sort_param.key_length+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXLEN;
|
||||
sort_param.key_length+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXBYTELEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2375,7 +2403,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
|
|||
total_key_length+=sort_param[i].key_length;
|
||||
|
||||
if (sort_param[i].keyinfo->flag & HA_FULLTEXT)
|
||||
sort_param[i].key_length+=FT_MAX_WORD_LEN_FOR_SORT-ft_max_word_len;
|
||||
sort_param[i].key_length+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXBYTELEN;
|
||||
}
|
||||
sort_info.total_keys=i;
|
||||
sort_param[0].master= 1;
|
||||
|
|
@ -3913,7 +3941,7 @@ static my_bool mi_too_big_key_for_sort(MI_KEYDEF *key, ha_rows rows)
|
|||
{
|
||||
uint key_maxlength=key->maxlength;
|
||||
if (key->flag & HA_FULLTEXT)
|
||||
key_maxlength+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXLEN;
|
||||
key_maxlength+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXBYTELEN;
|
||||
return (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
|
||||
((ulonglong) rows * key_maxlength >
|
||||
(ulonglong) myisam_max_temp_length));
|
||||
|
|
|
|||
|
|
@ -289,9 +289,9 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
|
|||
}
|
||||
|
||||
fulltext_keys++;
|
||||
key_length+= HA_FT_MAXLEN+HA_FT_WLEN;
|
||||
key_length+= HA_FT_MAXBYTELEN+HA_FT_WLEN;
|
||||
length++; /* At least one length byte */
|
||||
min_key_length_skipp+=HA_FT_MAXLEN;
|
||||
min_key_length_skipp+=HA_FT_MAXBYTELEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -322,11 +322,11 @@ static struct my_option my_long_options[] =
|
|||
{ "decode_bits", OPT_DECODE_BITS, "", (gptr*) &decode_bits,
|
||||
(gptr*) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
|
||||
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (gptr*) &ft_min_word_len,
|
||||
(gptr*) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXLEN,
|
||||
(gptr*) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
|
||||
0, 1, 0},
|
||||
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len,
|
||||
(gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXLEN, 10,
|
||||
HA_FT_MAXLEN, 0, 1, 0},
|
||||
(gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
|
||||
HA_FT_MAXCHARLEN, 0, 1, 0},
|
||||
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
|
|||
while ((maxbuffer= (int) (records/(keys-1)+1)) != skr);
|
||||
|
||||
if ((sort_keys=(uchar **)my_malloc(keys*(sort_length+sizeof(char*))+
|
||||
HA_FT_MAXLEN, MYF(0))))
|
||||
HA_FT_MAXBYTELEN, MYF(0))))
|
||||
{
|
||||
if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer,
|
||||
maxbuffer/2))
|
||||
|
|
@ -365,7 +365,7 @@ pthread_handler_decl(thr_find_all_keys,arg)
|
|||
}
|
||||
if ((sort_keys=(uchar **)my_malloc(keys*(sort_length+sizeof(char*))+
|
||||
((info->keyinfo->flag & HA_FULLTEXT) ?
|
||||
HA_FT_MAXLEN : 0), MYF(0))))
|
||||
HA_FT_MAXBYTELEN : 0), MYF(0))))
|
||||
{
|
||||
if (my_init_dynamic_array(&info->buffpek, sizeof(BUFFPEK),
|
||||
maxbuffer, maxbuffer/2))
|
||||
|
|
|
|||
|
|
@ -805,7 +805,7 @@ manager_launch()
|
|||
ident=$1
|
||||
shift
|
||||
if [ $USE_MANAGER = 0 ] ; then
|
||||
$@ >> $CUR_MYERR 2>&1 &
|
||||
echo $@ | /bin/sh >> $CUR_MYERR 2>&1 &
|
||||
sleep 2 #hack
|
||||
return
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ show variables like "ft\_%";
|
|||
Variable_name Value
|
||||
ft_boolean_syntax + -><()~*:""&|
|
||||
ft_min_word_len 4
|
||||
ft_max_word_len 254
|
||||
ft_max_word_len 84
|
||||
ft_query_expansion_limit 20
|
||||
ft_stopword_file (built-in)
|
||||
|
|
|
|||
24
mysql-test/r/init_connect.result
Normal file
24
mysql-test/r/init_connect.result
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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;
|
||||
24
mysql-test/r/rpl_init_slave.result
Normal file
24
mysql-test/r/rpl_init_slave.result
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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;
|
||||
show variables like 'init_slave';
|
||||
Variable_name Value
|
||||
init_slave set global max_connections=500
|
||||
show variables like 'max_connections';
|
||||
Variable_name Value
|
||||
max_connections 500
|
||||
reset master;
|
||||
show variables like 'init_slave';
|
||||
Variable_name Value
|
||||
init_slave
|
||||
show variables like 'max_connections';
|
||||
Variable_name Value
|
||||
max_connections 100
|
||||
set global init_connect="set @c=1";
|
||||
show variables like 'init_connect';
|
||||
Variable_name Value
|
||||
init_connect set @c=1
|
||||
stop slave;
|
||||
|
|
@ -823,3 +823,41 @@ count(*)
|
|||
13
|
||||
drop table t1,t2;
|
||||
set local tmp_table_size=default;
|
||||
create table t1 (a int, index (a), b int);
|
||||
insert t1 values (1,1),(2,2),(3,3),(4,4),(5,5);
|
||||
insert t1 select a+1, a+b from t1;
|
||||
insert t1 select a+1, a+b from t1;
|
||||
insert t1 select a+1, a+b from t1;
|
||||
insert t1 select a+1, a+b from t1;
|
||||
insert t1 select a+1, a+b from t1;
|
||||
FLUSH STATUS;
|
||||
show status like 'Slow_queries';
|
||||
Variable_name Value
|
||||
Slow_queries 0
|
||||
select count(*) from t1 where a=7;
|
||||
count(*)
|
||||
26
|
||||
show status like 'Slow_queries';
|
||||
Variable_name Value
|
||||
Slow_queries 0
|
||||
select count(*) from t1 where b=13;
|
||||
count(*)
|
||||
10
|
||||
show status like 'Slow_queries';
|
||||
Variable_name Value
|
||||
Slow_queries 1
|
||||
select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
|
||||
count(*)
|
||||
0
|
||||
26
|
||||
show status like 'Slow_queries';
|
||||
Variable_name Value
|
||||
Slow_queries 2
|
||||
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
|
||||
count(*)
|
||||
26
|
||||
10
|
||||
show status like 'Slow_queries';
|
||||
Variable_name Value
|
||||
Slow_queries 3
|
||||
drop table t1;
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ SELECT @@table_type;
|
|||
CREATE TABLE t1 (a int not null);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
--error 1284
|
||||
--error 1285
|
||||
SET SESSION table_type="gemini";
|
||||
SELECT @@table_type;
|
||||
CREATE TABLE t1 (a int not null);
|
||||
|
|
@ -277,7 +277,7 @@ SELECT @@table_type;
|
|||
CREATE TABLE t1 (a int not null);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
--error 1284
|
||||
--error 1285
|
||||
SET SESSION table_type="gemini";
|
||||
SELECT @@table_type;
|
||||
CREATE TABLE t1 (a int not null);
|
||||
|
|
|
|||
1
mysql-test/t/init_connect-master.opt
Normal file
1
mysql-test/t/init_connect-master.opt
Normal file
|
|
@ -0,0 +1 @@
|
|||
--set-variable=init_connect="set @a='a\0c'"
|
||||
34
mysql-test/t/init_connect.test
Normal file
34
mysql-test/t/init_connect.test
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#
|
||||
# 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;
|
||||
1
mysql-test/t/rpl_init_slave-slave.opt
Normal file
1
mysql-test/t/rpl_init_slave-slave.opt
Normal file
|
|
@ -0,0 +1 @@
|
|||
--init-slave="set global max_connections=500"
|
||||
26
mysql-test/t/rpl_init_slave.test
Normal file
26
mysql-test/t/rpl_init_slave.test
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
source include/master-slave.inc;
|
||||
|
||||
#
|
||||
# Test of init_slave variable
|
||||
#
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sleep 1;
|
||||
show variables like 'init_slave';
|
||||
show variables like 'max_connections';
|
||||
sync_with_master;
|
||||
reset master;
|
||||
connection master;
|
||||
show variables like 'init_slave';
|
||||
show variables like 'max_connections';
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
set global init_connect="set @c=1";
|
||||
show variables like 'init_connect';
|
||||
connection master;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
stop slave;
|
||||
1
mysql-test/t/union-master.opt
Normal file
1
mysql-test/t/union-master.opt
Normal file
|
|
@ -0,0 +1 @@
|
|||
--log-slow-queries --log-long-format --log-queries-not-using-indexes
|
||||
|
|
@ -416,9 +416,6 @@ create table t1 select _latin2"test" union select _latin2"testt" ;
|
|||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# conversion memory->disk table
|
||||
#
|
||||
#
|
||||
# conversion memory->disk table
|
||||
#
|
||||
|
|
@ -436,3 +433,26 @@ select count(*) from t1;
|
|||
select count(*) from t2;
|
||||
drop table t1,t2;
|
||||
set local tmp_table_size=default;
|
||||
|
||||
#
|
||||
# slow logging
|
||||
#
|
||||
create table t1 (a int, index (a), b int);
|
||||
insert t1 values (1,1),(2,2),(3,3),(4,4),(5,5);
|
||||
insert t1 select a+1, a+b from t1;
|
||||
insert t1 select a+1, a+b from t1;
|
||||
insert t1 select a+1, a+b from t1;
|
||||
insert t1 select a+1, a+b from t1;
|
||||
insert t1 select a+1, a+b from t1;
|
||||
FLUSH STATUS;
|
||||
show status like 'Slow_queries';
|
||||
select count(*) from t1 where a=7;
|
||||
show status like 'Slow_queries';
|
||||
select count(*) from t1 where b=13;
|
||||
show status like 'Slow_queries';
|
||||
select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
|
||||
show status like 'Slow_queries';
|
||||
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
|
||||
show status like 'Slow_queries';
|
||||
drop table t1;
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ set big_tables="OFFF";
|
|||
set unknown_variable=1;
|
||||
--error 1232
|
||||
set max_join_size="hello";
|
||||
--error 1284
|
||||
--error 1285
|
||||
set table_type=UNKNOWN_TABLE_TYPE;
|
||||
--error 1231
|
||||
set table_type=INNODB, big_tables=2;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ static void init_state_maps(CHARSET_INFO *cs)
|
|||
else if (my_isdigit(cs,i))
|
||||
state_map[i]=(uchar) MY_LEX_NUMBER_IDENT;
|
||||
#if defined(USE_MB) && defined(USE_MB_IDENT)
|
||||
else if (use_mb(cs) && (my_mbcharlen(cs, i)>1))
|
||||
else if (my_mbcharlen(cs, i)>1)
|
||||
state_map[i]=(uchar) MY_LEX_IDENT;
|
||||
#endif
|
||||
else if (!my_isgraph(cs,i))
|
||||
|
|
|
|||
|
|
@ -44,17 +44,16 @@ test-ATIS.sh Creation of 29 tables and a lot of selects on them.
|
|||
test-connect.sh Test how fast a connection to the server is.
|
||||
test-create.sh Test how fast a table is created.
|
||||
test-insert.sh Test create and fill of a table.
|
||||
test-wisconsin.sh This is a port of the PostgreSQL version of this
|
||||
benchmark.
|
||||
test-wisconsin.sh A port of the PostgreSQL version of this benchmark.
|
||||
run-all-tests Use this to run all tests. When all tests are run,
|
||||
use the --log --use-old option to get a RUN-file.
|
||||
use the --log and --use-old options to get a RUN-file.
|
||||
compare-results Generates a comparison table from different RUN files.
|
||||
server-cfg Contains the limit and functions for all supported
|
||||
server-cfg Contains the limits and functions for all supported
|
||||
SQL servers. If you want to add a new server, this
|
||||
should be the only file that neads to be changed.
|
||||
|
||||
|
||||
Most of the test should use portable SQL to make it possible to
|
||||
Most of the tests should use portable SQL to make it possible to
|
||||
compare different databases. Sometimes SQL extensions can make things
|
||||
a lot faster. In this case the test may use the extensions if the --fast
|
||||
option is used.
|
||||
|
|
|
|||
|
|
@ -177,50 +177,45 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
|
|||
#define TEST_SIGINT 1024 /* Allow sigint on threads */
|
||||
|
||||
/* options for select set by the yacc parser (stored in lex->options) */
|
||||
#define SELECT_DISTINCT 1
|
||||
#define SELECT_STRAIGHT_JOIN 2
|
||||
#define SELECT_DESCRIBE 4
|
||||
#define SELECT_SMALL_RESULT 8
|
||||
#define SELECT_BIG_RESULT 16
|
||||
#define OPTION_FOUND_ROWS 32
|
||||
#define OPTION_TO_QUERY_CACHE 64
|
||||
#define SELECT_NO_JOIN_CACHE 256 /* Intern */
|
||||
|
||||
#define OPTION_BIG_TABLES 512 /* for SQL OPTION */
|
||||
#define OPTION_BIG_SELECTS 1024 /* for SQL OPTION */
|
||||
#define OPTION_LOG_OFF 2048
|
||||
#define OPTION_UPDATE_LOG 4096 /* update log flag */
|
||||
#define TMP_TABLE_ALL_COLUMNS 8192
|
||||
#define OPTION_WARNINGS 16384
|
||||
#define OPTION_AUTO_IS_NULL 32768
|
||||
#define OPTION_FOUND_COMMENT 65536L
|
||||
#define OPTION_SAFE_UPDATES OPTION_FOUND_COMMENT*2
|
||||
#define OPTION_BUFFER_RESULT OPTION_SAFE_UPDATES*2
|
||||
#define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2
|
||||
#define OPTION_NOT_AUTOCOMMIT OPTION_BIN_LOG*2
|
||||
#define OPTION_BEGIN OPTION_NOT_AUTOCOMMIT*2
|
||||
#define OPTION_TABLE_LOCK OPTION_BEGIN*2
|
||||
#define OPTION_QUICK OPTION_TABLE_LOCK*2
|
||||
#define OPTION_QUOTE_SHOW_CREATE OPTION_QUICK*2
|
||||
#define OPTION_INTERNAL_SUBTRANSACTIONS OPTION_QUOTE_SHOW_CREATE*2
|
||||
|
||||
/* options for UNION set by the yacc parser (stored in unit->union_option) */
|
||||
#define UNION_ALL 1
|
||||
#define SELECT_DISTINCT (1L << 0)
|
||||
#define SELECT_STRAIGHT_JOIN (1L << 1)
|
||||
#define SELECT_DESCRIBE (1L << 2)
|
||||
#define SELECT_SMALL_RESULT (1L << 3)
|
||||
#define SELECT_BIG_RESULT (1L << 4)
|
||||
#define OPTION_FOUND_ROWS (1L << 5)
|
||||
#define OPTION_TO_QUERY_CACHE (1L << 6)
|
||||
#define SELECT_NO_JOIN_CACHE (1L << 7) /* Intern */
|
||||
#define OPTION_BIG_TABLES (1L << 8) /* for SQL OPTION */
|
||||
#define OPTION_BIG_SELECTS (1L << 9) /* for SQL OPTION */
|
||||
#define OPTION_LOG_OFF (1L << 10)
|
||||
#define OPTION_UPDATE_LOG (1L << 11) /* update log flag */
|
||||
#define TMP_TABLE_ALL_COLUMNS (1L << 12)
|
||||
#define OPTION_WARNINGS (1L << 13)
|
||||
#define OPTION_AUTO_IS_NULL (1L << 14)
|
||||
#define OPTION_FOUND_COMMENT (1L << 15)
|
||||
#define OPTION_SAFE_UPDATES (1L << 16)
|
||||
#define OPTION_BUFFER_RESULT (1L << 17)
|
||||
#define OPTION_BIN_LOG (1L << 18)
|
||||
#define OPTION_NOT_AUTOCOMMIT (1L << 19)
|
||||
#define OPTION_BEGIN (1L << 20)
|
||||
#define OPTION_TABLE_LOCK (1L << 21)
|
||||
#define OPTION_QUICK (1L << 22)
|
||||
#define OPTION_QUOTE_SHOW_CREATE (1L << 23)
|
||||
#define OPTION_INTERNAL_SUBTRANSACTIONS (1L << 24)
|
||||
|
||||
/* Set if we are updating a non-transaction safe table */
|
||||
#define OPTION_STATUS_NO_TRANS_UPDATE OPTION_INTERNAL_SUBTRANSACTIONS*2
|
||||
#define OPTION_STATUS_NO_TRANS_UPDATE (1L << 25)
|
||||
|
||||
/* The following is set when parsing the query */
|
||||
#define QUERY_NO_INDEX_USED OPTION_STATUS_NO_TRANS_UPDATE*2
|
||||
#define QUERY_NO_GOOD_INDEX_USED QUERY_NO_INDEX_USED*2
|
||||
/* The following can be set when importing tables in a 'wrong order'
|
||||
to suppress foreign key checks */
|
||||
#define OPTION_NO_FOREIGN_KEY_CHECKS QUERY_NO_GOOD_INDEX_USED*2
|
||||
#define OPTION_NO_FOREIGN_KEY_CHECKS (1L << 26)
|
||||
/* The following speeds up inserts to InnoDB tables by suppressing unique
|
||||
key checks in some cases */
|
||||
#define OPTION_RELAXED_UNIQUE_CHECKS OPTION_NO_FOREIGN_KEY_CHECKS*2
|
||||
#define SELECT_NO_UNLOCK ((ulong) OPTION_RELAXED_UNIQUE_CHECKS*2)
|
||||
/* NOTE: we have now used up all 32 bits of the OPTION flag! */
|
||||
#define OPTION_RELAXED_UNIQUE_CHECKS (1L << 27)
|
||||
#define SELECT_NO_UNLOCK (1L << 28)
|
||||
|
||||
/* options for UNION set by the yacc parser (stored in unit->union_option) */
|
||||
#define UNION_ALL 1
|
||||
|
||||
/* Bits for different SQL modes modes (including ANSI mode) */
|
||||
#define MODE_REAL_AS_FLOAT 1
|
||||
|
|
@ -559,6 +554,8 @@ bool wait_for_tables(THD *thd);
|
|||
bool table_is_used(TABLE *table, bool wait_for_name_lock);
|
||||
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 execute_init_command(THD *thd, sys_var_str *init_command_var,
|
||||
rw_lock_t *var_mutex);
|
||||
extern const Field *not_found_field;
|
||||
Field *find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
|
||||
TABLE_LIST **where, bool report_error);
|
||||
|
|
@ -851,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_slave_list, LOCK_active_mi, LOCK_manager,
|
||||
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_attr_t connection_attrib;
|
||||
extern I_List<THD> threads;
|
||||
|
|
|
|||
|
|
@ -316,7 +316,8 @@ char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN];
|
|||
char* log_error_file_ptr= log_error_file;
|
||||
char mysql_real_data_home[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];
|
||||
|
||||
|
|
@ -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_global_system_variables,
|
||||
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,
|
||||
COND_slave_start;
|
||||
pthread_cond_t COND_thread_cache,COND_flush_thread_cache;
|
||||
|
|
@ -923,6 +924,8 @@ void clean_up(bool print_message)
|
|||
MYF(MY_ALLOW_ZERO_PTR));
|
||||
if (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);
|
||||
#ifdef HAVE_REPLICATION
|
||||
my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
|
||||
|
|
@ -994,6 +997,8 @@ static void clean_up_mutexes()
|
|||
(void) pthread_cond_destroy(&COND_rpl_status);
|
||||
#endif
|
||||
(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_cond_destroy(&COND_thread_count);
|
||||
(void) pthread_cond_destroy(&COND_refresh);
|
||||
|
|
@ -2173,7 +2178,16 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
|||
global_system_variables.collation_database= 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_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))
|
||||
return 1;
|
||||
|
|
@ -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_active_mi, 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) pthread_cond_init(&COND_thread_count,NULL);
|
||||
(void) pthread_cond_init(&COND_refresh,NULL);
|
||||
|
|
@ -3597,7 +3613,7 @@ enum options_mysqld
|
|||
OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS,
|
||||
OPT_MAX_LENGTH_FOR_SORT_DATA,
|
||||
OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE,
|
||||
OPT_MAX_ERROR_COUNT, OPT_MAX_PREP_STMT,
|
||||
OPT_MAX_ERROR_COUNT,
|
||||
OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
|
||||
OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE,
|
||||
OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT,
|
||||
|
|
@ -3640,6 +3656,8 @@ enum options_mysqld
|
|||
OPT_EXPIRE_LOGS_DAYS,
|
||||
OPT_GROUP_CONCAT_MAX_LEN,
|
||||
OPT_DEFAULT_COLLATION,
|
||||
OPT_INIT_CONNECT,
|
||||
OPT_INIT_SLAVE,
|
||||
OPT_SECURE_AUTH,
|
||||
OPT_DATE_FORMAT,
|
||||
OPT_TIME_FORMAT,
|
||||
|
|
@ -3816,6 +3834,12 @@ Disable with --skip-bdb (will save memory).",
|
|||
(gptr*) &innobase_file_per_table,
|
||||
(gptr*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#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.",
|
||||
(gptr*) &opt_help, (gptr*) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
|
|
@ -4223,11 +4247,11 @@ replicating a LOAD DATA INFILE command.",
|
|||
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN,
|
||||
"The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
|
||||
(gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG,
|
||||
REQUIRED_ARG, 4, 1, HA_FT_MAXLEN, 0, 1, 0},
|
||||
REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, 0, 1, 0},
|
||||
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN,
|
||||
"The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
|
||||
(gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG,
|
||||
REQUIRED_ARG, HA_FT_MAXLEN, 10, HA_FT_MAXLEN, 0, 1, 0},
|
||||
REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, HA_FT_MAXCHARLEN, 0, 1, 0},
|
||||
{ "ft_query_expansion_limit", OPT_FT_QUERY_EXPANSION_LIMIT,
|
||||
"Number of best matches to use for query expansion",
|
||||
(gptr*) &ft_query_expansion_limit, (gptr*) &ft_query_expansion_limit, 0, GET_ULONG,
|
||||
|
|
@ -4386,11 +4410,6 @@ The minimum value for this variable is 4096.",
|
|||
(gptr*) &global_system_variables.max_length_for_sort_data,
|
||||
(gptr*) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
|
||||
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
|
||||
{"max_prepared_statements", OPT_MAX_PREP_STMT,
|
||||
"Max number of prepared_statements for a thread.",
|
||||
(gptr*) &global_system_variables.max_prep_stmt_count,
|
||||
(gptr*) &max_system_variables.max_prep_stmt_count, 0, GET_ULONG,
|
||||
REQUIRED_ARG, DEFAULT_PREP_STMT_COUNT, 0, ~0L, 0, 1, 0},
|
||||
{"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE,
|
||||
"If non-zero: relay log will be rotated automatically when the size exceeds this value; if zero (the default): when the size exceeds max_binlog_size. 0 expected, the minimum value for this variable is 4096.",
|
||||
(gptr*) &max_relay_log_size, (gptr*) &max_relay_log_size, 0, GET_ULONG,
|
||||
|
|
|
|||
|
|
@ -76,6 +76,10 @@ TYPELIB delay_key_write_typelib=
|
|||
static bool sys_check_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 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_autocommit(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",
|
|||
sys_check_charset,
|
||||
sys_update_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_client sys_character_set_client("character_set_client");
|
||||
sys_var_character_set_connection sys_character_set_connection("character_set_connection");
|
||||
|
|
@ -202,8 +212,6 @@ sys_var_thd_ha_rows sys_sql_max_join_size("sql_max_join_size",
|
|||
&SV::max_join_size,
|
||||
fix_max_join_size);
|
||||
#endif
|
||||
sys_var_thd_ulong sys_max_prep_stmt_count("max_prepared_statements",
|
||||
&SV::max_prep_stmt_count);
|
||||
sys_var_long_ptr sys_max_relay_log_size("max_relay_log_size",
|
||||
&max_relay_log_size,
|
||||
fix_max_relay_log_size);
|
||||
|
|
@ -437,6 +445,8 @@ sys_var *sys_variables[]=
|
|||
&sys_foreign_key_checks,
|
||||
&sys_group_concat_max_len,
|
||||
&sys_identity,
|
||||
&sys_init_connect,
|
||||
&sys_init_slave,
|
||||
&sys_insert_id,
|
||||
&sys_interactive_timeout,
|
||||
&sys_join_buffer_size,
|
||||
|
|
@ -462,7 +472,6 @@ sys_var *sys_variables[]=
|
|||
&sys_max_heap_table_size,
|
||||
&sys_max_join_size,
|
||||
&sys_max_length_for_sort_data,
|
||||
&sys_max_prep_stmt_count,
|
||||
&sys_max_relay_log_size,
|
||||
&sys_max_seeks_for_key,
|
||||
&sys_max_sort_length,
|
||||
|
|
@ -590,6 +599,8 @@ struct show_var_st init_vars[]= {
|
|||
{"have_openssl", (char*) &have_openssl, SHOW_HAVE},
|
||||
{"have_query_cache", (char*) &have_query_cache, SHOW_HAVE},
|
||||
{"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
|
||||
{"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG },
|
||||
{"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG },
|
||||
|
|
@ -653,7 +664,6 @@ struct show_var_st init_vars[]= {
|
|||
{sys_max_seeks_for_key.name, (char*) &sys_max_seeks_for_key, SHOW_SYS},
|
||||
{sys_max_length_for_sort_data.name, (char*) &sys_max_length_for_sort_data,
|
||||
SHOW_SYS},
|
||||
{sys_max_prep_stmt_count.name,(char*) &sys_max_prep_stmt_count, SHOW_SYS},
|
||||
{sys_max_sort_length.name, (char*) &sys_max_sort_length, SHOW_SYS},
|
||||
{sys_max_user_connections.name,(char*) &sys_max_user_connections, SHOW_SYS},
|
||||
{sys_max_tmp_tables.name, (char*) &sys_max_tmp_tables, SHOW_SYS},
|
||||
|
|
@ -760,6 +770,66 @@ bool sys_var::check(THD *thd, set_var *var)
|
|||
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
|
||||
one to change character sets
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ class sys_var_str :public sys_var
|
|||
{
|
||||
public:
|
||||
char *value; // Pointer to allocated string
|
||||
uint value_length;
|
||||
sys_check_func check_func;
|
||||
sys_update_func update_func;
|
||||
sys_set_default_func set_default_func;
|
||||
|
|
@ -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);
|
||||
ulong fix_sql_mode(ulong sql_mode);
|
||||
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);
|
||||
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
|
||||
NAMED_LIST **found);
|
||||
|
|
|
|||
12
sql/slave.cc
12
sql/slave.cc
|
|
@ -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_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 */
|
||||
|
||||
while (!sql_slave_killed(thd,rli))
|
||||
|
|
|
|||
|
|
@ -373,7 +373,6 @@ struct system_variables
|
|||
ulong max_error_count;
|
||||
ulong max_heap_table_size;
|
||||
ulong max_length_for_sort_data;
|
||||
ulong max_prep_stmt_count;
|
||||
ulong max_sort_length;
|
||||
ulong max_tmp_tables;
|
||||
ulong myisam_repair_threads;
|
||||
|
|
@ -505,6 +504,11 @@ public:
|
|||
// TODO: document the variables below
|
||||
MYSQL_LOCK *lock; /* Current locks */
|
||||
MYSQL_LOCK *locked_tables; /* Tables locked with LOCK */
|
||||
/*
|
||||
One thread can hold up to one named user-level lock. This variable
|
||||
points to a lock object if the lock is present. See item_func.cc and
|
||||
chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK.
|
||||
*/
|
||||
ULL *ull;
|
||||
PREP_STMT *last_prepared_stmt;
|
||||
#ifndef DBUG_OFF
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
|
|||
/* If running in safe sql mode, don't allow updates without keys */
|
||||
if (table->quick_keys.is_clear_all())
|
||||
{
|
||||
thd->lex.select_lex.options|=QUERY_NO_INDEX_USED;
|
||||
thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
|
||||
if (safe_update && !using_limit)
|
||||
{
|
||||
delete select;
|
||||
|
|
|
|||
|
|
@ -759,8 +759,7 @@ int READ_INFO::read_field()
|
|||
{
|
||||
chr = GET;
|
||||
#ifdef USE_MB
|
||||
if (use_mb(read_charset) &&
|
||||
(my_mbcharlen(read_charset, chr) >1 )&&
|
||||
if ((my_mbcharlen(read_charset, chr) > 1) &&
|
||||
to+my_mbcharlen(read_charset, chr) <= end_of_buff)
|
||||
{
|
||||
uchar* p = (uchar*)to;
|
||||
|
|
@ -946,7 +945,7 @@ int READ_INFO::next_line()
|
|||
{
|
||||
int chr = GET;
|
||||
#ifdef USE_MB
|
||||
if (use_mb(read_charset) && (my_mbcharlen(read_charset, chr) >1 ))
|
||||
if (my_mbcharlen(read_charset, chr) > 1)
|
||||
{
|
||||
for (int i=1;
|
||||
chr != my_b_EOF && i<my_mbcharlen(read_charset, chr);
|
||||
|
|
|
|||
|
|
@ -860,6 +860,37 @@ static int check_connection(THD *thd)
|
|||
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)
|
||||
{
|
||||
THD *thd=(THD*) arg;
|
||||
|
|
@ -932,9 +963,15 @@ pthread_handler_decl(handle_one_connection,arg)
|
|||
if (thd->client_capabilities & CLIENT_COMPRESS)
|
||||
net->compress=1; // Use compression
|
||||
|
||||
thd->proc_info=0; // Remove 'login'
|
||||
thd->command=COM_SLEEP;
|
||||
thd->version=refresh_version;
|
||||
thd->version= refresh_version;
|
||||
if (sys_init_connect.value && !(thd->master_access & SUPER_ACL))
|
||||
{
|
||||
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->init_for_queries();
|
||||
while (!net->error && net->vio != 0 && !thd->killed)
|
||||
|
|
@ -1203,7 +1240,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
thread_running++;
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
|
||||
thd->lex.select_lex.options=0; // We store status here
|
||||
thd->server_status&=
|
||||
~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED);
|
||||
switch (command) {
|
||||
case COM_INIT_DB:
|
||||
{
|
||||
|
|
@ -1635,8 +1673,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
|
||||
if ((ulong) (thd->start_time - thd->time_after_lock) >
|
||||
thd->variables.long_query_time ||
|
||||
((thd->lex.select_lex.options &
|
||||
(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED)) &&
|
||||
((thd->server_status &
|
||||
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
|
||||
(specialflag & SPECIAL_LOG_QUERIES_NOT_USING_INDEXES)))
|
||||
{
|
||||
long_query_count++;
|
||||
|
|
@ -3730,6 +3768,7 @@ mysql_init_query(THD *thd)
|
|||
lex->select_lex.prev= &lex->unit.slave;
|
||||
lex->select_lex.link_next= lex->select_lex.slave= lex->select_lex.next= 0;
|
||||
lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list);
|
||||
lex->select_lex.options=0;
|
||||
lex->describe= 0;
|
||||
lex->derived_tables= FALSE;
|
||||
lex->lock_option= TL_READ;
|
||||
|
|
|
|||
|
|
@ -3619,7 +3619,7 @@ make_join_readinfo(JOIN *join, uint options)
|
|||
/* These init changes read_record */
|
||||
if (tab->use_quick == 2)
|
||||
{
|
||||
select_lex->options|=QUERY_NO_GOOD_INDEX_USED;
|
||||
join->thd->server_status|=SERVER_QUERY_NO_GOOD_INDEX_USED;
|
||||
tab->read_first_record= join_init_quick_read_record;
|
||||
statistic_increment(select_range_check_count, &LOCK_status);
|
||||
}
|
||||
|
|
@ -3634,7 +3634,7 @@ make_join_readinfo(JOIN *join, uint options)
|
|||
}
|
||||
else
|
||||
{
|
||||
select_lex->options|=QUERY_NO_INDEX_USED;
|
||||
join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
|
||||
statistic_increment(select_scan_count, &LOCK_status);
|
||||
}
|
||||
}
|
||||
|
|
@ -3646,7 +3646,7 @@ make_join_readinfo(JOIN *join, uint options)
|
|||
}
|
||||
else
|
||||
{
|
||||
select_lex->options|=QUERY_NO_INDEX_USED;
|
||||
join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
|
||||
statistic_increment(select_full_join_count, &LOCK_status);
|
||||
}
|
||||
}
|
||||
|
|
@ -8926,7 +8926,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
|
|||
(ulong)join->select_lex, join->select_lex->type,
|
||||
message ? message : "NULL"));
|
||||
/* Don't log this into the slow query log */
|
||||
select_lex->options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED);
|
||||
thd->server_status&= ~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED);
|
||||
join->unit->offset_limit_cnt= 0;
|
||||
|
||||
if (message)
|
||||
|
|
|
|||
|
|
@ -1612,9 +1612,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
|||
break;
|
||||
}
|
||||
case SHOW_CHAR:
|
||||
pos= value;
|
||||
end= strend(pos);
|
||||
{
|
||||
if (!(pos= value))
|
||||
pos= "";
|
||||
end= strend(pos);
|
||||
break;
|
||||
}
|
||||
case SHOW_STARTTIME:
|
||||
nr= (long) (thd->query_start() - start_time);
|
||||
end= int10_to_str(nr, buff, 10);
|
||||
|
|
@ -1640,10 +1643,10 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
|||
break;
|
||||
case SHOW_CHAR_PTR:
|
||||
{
|
||||
if (!(pos= *(char**) value))
|
||||
pos= "";
|
||||
end= strend(pos);
|
||||
break;
|
||||
if (!(pos= *(char**) value))
|
||||
pos= "";
|
||||
end= strend(pos);
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_OPENSSL
|
||||
/* First group - functions relying on CTX */
|
||||
|
|
|
|||
|
|
@ -1539,7 +1539,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
|
||||
case HA_ADMIN_CORRUPT:
|
||||
protocol->store("error", 5, system_charset_info);
|
||||
protocol->store("Corrupt", 8, system_charset_info);
|
||||
protocol->store("Corrupt", 7, system_charset_info);
|
||||
fatal_error=1;
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ int mysql_update(THD *thd,
|
|||
/* If running in safe sql mode, don't allow updates without keys */
|
||||
if (table->quick_keys.is_clear_all())
|
||||
{
|
||||
thd->lex.select_lex.options|=QUERY_NO_INDEX_USED;
|
||||
thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
|
||||
if (safe_update && !using_limit)
|
||||
{
|
||||
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@
|
|||
#define TRANS_MEM_ROOT_PREALLOC 4096
|
||||
|
||||
#define DEFAULT_ERROR_COUNT 64
|
||||
#define DEFAULT_PREP_STMT_COUNT 64
|
||||
#define EXTRA_RECORDS 10 /* Extra records in sort */
|
||||
#define SCROLL_EXTRA 5 /* Extra scroll-rows. */
|
||||
#define FIELD_NAME_USED ((uint) 32768) /* Bit set if fieldname used */
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ static int ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
static int mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
|
||||
{
|
||||
return (isbig5head(c)? 2: 0);
|
||||
return (isbig5head(c)? 2 : 1);
|
||||
}
|
||||
|
||||
/* page 0 0xA140-0xC7FC */
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ static int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
static int mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (iseuc_kr(c) ? 2 : 0);
|
||||
return (iseuc_kr(c) ? 2 : 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ static int ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
static int mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (isgb2312head(c)? 2:0);
|
||||
return (isgb2312head(c)? 2 : 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2721,7 +2721,7 @@ static int ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
static int mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (isgbkhead(c)? 2:0);
|
||||
return (isgbkhead(c)? 2 : 1);
|
||||
}
|
||||
|
||||
/* page 0 0x8140-0xFE4F */
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ static int ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
static int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (issjishead((uchar) c) ? 2: 0);
|
||||
return (issjishead((uchar) c) ? 2 : 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ static int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
static int mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 0);
|
||||
return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
if cd @prefix@ ; then
|
||||
if [ ! -f data/mysql/db.frm ] ; then
|
||||
./scripts/mysql_install_db -IN-RPM
|
||||
./scripts/mysql_install_db --rpm
|
||||
fi
|
||||
|
||||
if [ -d data ] ; then
|
||||
|
|
|
|||
|
|
@ -470,6 +470,7 @@ fi
|
|||
%attr(755, root, root) %{_bindir}/myisamlog
|
||||
%attr(755, root, root) %{_bindir}/myisampack
|
||||
%attr(755, root, root) %{_bindir}/mysql_convert_table_format
|
||||
%attr(755, root, root) %{_bindir}/mysql_create_system_tables
|
||||
%attr(755, root, root) %{_bindir}/mysql_explain_log
|
||||
%attr(755, root, root) %{_bindir}/mysql_fix_extensions
|
||||
%attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables
|
||||
|
|
@ -568,6 +569,10 @@ fi
|
|||
# The spec file changelog only includes changes made to the spec file
|
||||
# itself
|
||||
%changelog
|
||||
* Fri Dec 05 2003 Lenz Grimmer <lenz@mysql.com>
|
||||
|
||||
- added missing file mysql_create_system_tables to the server subpackage
|
||||
|
||||
* Fri Nov 21 2003 Lenz Grimmer <lenz@mysql.com>
|
||||
|
||||
- removed dependency on MySQL-client from the MySQL-devel subpackage
|
||||
|
|
|
|||
|
|
@ -7955,7 +7955,12 @@ static void test_ts()
|
|||
|
||||
/*
|
||||
Test for bug #1500.
|
||||
XXX: despite that this bug is fixed, it spots mysqld code which is not
|
||||
working correctly yet: to fix all things properly we need to implement
|
||||
Item::cleanup() method for all items (as described in bugs #1663 and
|
||||
#1749). So don't be surprised in case valgrind barks on it.
|
||||
*/
|
||||
|
||||
static void test_bug1500()
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue