Commit 598500f1 authored by unknown's avatar unknown

Merge arjen@work.mysql.com:/home/bk/mysql-4.0

into co3064164-a.bitbike.com:c:/home/mysql-4.0


Docs/manual.texi:
  Auto merged
parents acb3b7eb ae686937
...@@ -33527,7 +33527,7 @@ The different table types are: ...@@ -33527,7 +33527,7 @@ The different table types are:
@item ISAM @tab The original table handler. @xref{ISAM}. @item ISAM @tab The original table handler. @xref{ISAM}.
@item InnoDB @tab Transaction-safe tables with row locking. @xref{InnoDB}. @item InnoDB @tab Transaction-safe tables with row locking. @xref{InnoDB}.
@item MERGE @tab A collection of MyISAM tables used as one table. @xref{MERGE}. @item MERGE @tab A collection of MyISAM tables used as one table. @xref{MERGE}.
@item MRG_MERGE @tab An alias for MERGE tables @item MRG_MyISAM @tab An alias for MERGE tables
@item MyISAM @tab The new binary portable table handler that is replacing ISAM. @xref{MyISAM}. @item MyISAM @tab The new binary portable table handler that is replacing ISAM. @xref{MyISAM}.
@end multitable @end multitable
@xref{Table types}. @xref{Table types}.
...@@ -1280,6 +1280,7 @@ int do_connect(struct st_query* q) ...@@ -1280,6 +1280,7 @@ int do_connect(struct st_query* q)
char buff[FN_REFLEN]; char buff[FN_REFLEN];
int con_port; int con_port;
int con_error; int con_error;
int free_con_sock = 0;
DBUG_ENTER("do_connect"); DBUG_ENTER("do_connect");
DBUG_PRINT("enter",("connect: %s",p)); DBUG_PRINT("enter",("connect: %s",p));
...@@ -1299,10 +1300,29 @@ int do_connect(struct st_query* q) ...@@ -1299,10 +1300,29 @@ int do_connect(struct st_query* q)
} }
else else
{ {
VAR* var_port, *var_sock;
p = safe_get_param(p, &con_port_str, "missing connection port"); p = safe_get_param(p, &con_port_str, "missing connection port");
if (*con_port_str == '$')
{
if (!(var_port = var_get(con_port_str, 0, 0)))
die("Unknown variable '%s'", con_port_str+1);
con_port = var_port->int_val;
}
else
con_port=atoi(con_port_str); con_port=atoi(con_port_str);
p = safe_get_param(p, &con_sock, "missing connection socket"); p = safe_get_param(p, &con_sock, "missing connection socket");
if (*con_sock == '$')
{
if (!(var_sock = var_get(con_sock, 0, 0)))
die("Unknown variable '%s'", con_sock+1);
if (!(con_sock = (char*)my_malloc(var_sock->str_val_len+1, MYF(0))))
die("Out of memory");
free_con_sock = 1;
memcpy(con_sock, var_sock->str_val, var_sock->str_val_len);
con_sock[var_sock->str_val_len] = 0;
}
} }
if (next_con == cons_end) if (next_con == cons_end)
die("Connection limit exhausted - increase MAX_CONS in mysqltest.c"); die("Connection limit exhausted - increase MAX_CONS in mysqltest.c");
...@@ -1310,20 +1330,21 @@ int do_connect(struct st_query* q) ...@@ -1310,20 +1330,21 @@ int do_connect(struct st_query* q)
die("Failed on mysql_init()"); die("Failed on mysql_init()");
if (opt_compress) if (opt_compress)
mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
if (con_sock) if (con_sock && !free_con_sock && *con_sock && *con_sock != FN_LIBCHAR)
con_sock=fn_format(buff, con_sock, TMPDIR, "",0); con_sock=fn_format(buff, con_sock, TMPDIR, "",0);
if (!con_db[0]) if (!con_db[0])
con_db=db; con_db=db;
if((con_error = safe_connect(&next_con->mysql, con_host, if((con_error = safe_connect(&next_con->mysql, con_host,
con_user, con_pass, con_user, con_pass,
con_db, con_port, con_sock))) con_db, con_port, *con_sock ? con_sock: 0)))
die("Could not open connection '%s': %s", con_name, die("Could not open connection '%s': %s", con_name,
mysql_error(&next_con->mysql)); mysql_error(&next_con->mysql));
if (!(next_con->name = my_strdup(con_name, MYF(MY_WME)))) if (!(next_con->name = my_strdup(con_name, MYF(MY_WME))))
die(NullS); die(NullS);
cur_con = next_con++; cur_con = next_con++;
if (free_con_sock)
my_free(con_sock, MYF(MY_WME));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -167,8 +167,8 @@ byte ft_get_word(byte **start, byte *end, FT_WORD *word, FTB_PARAM *param) ...@@ -167,8 +167,8 @@ byte ft_get_word(byte **start, byte *end, FT_WORD *word, FTB_PARAM *param)
if ((param->trunc=(doc<end && *doc == FTB_TRUNC))) if ((param->trunc=(doc<end && *doc == FTB_TRUNC)))
doc++; doc++;
if (word->len >= ft_min_word_len && word->len < ft_max_word_len && if (((word->len >= ft_min_word_len && !is_stopword(word->pos, word->len))
!is_stopword(word->pos, word->len)) || param->trunc) && word->len < ft_max_word_len)
{ {
*start=doc; *start=doc;
return 1; return 1;
......
connect (master,localhost,root,,test,0,master.sock); connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (master1,localhost,root,,test,0,master.sock); connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,localhost,root,,test,0,slave.sock); connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,localhost,root,,test,0,slave.sock); connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connection slave; connection slave;
--error 0,1199 --error 0,1199
!slave stop; !slave stop;
......
...@@ -151,6 +151,11 @@ while test $# -gt 0; do ...@@ -151,6 +151,11 @@ while test $# -gt 0; do
--verbose-manager) MANAGER_QUIET_OPT="" ;; --verbose-manager) MANAGER_QUIET_OPT="" ;;
--local) USE_RUNNING_SERVER="" ;; --local) USE_RUNNING_SERVER="" ;;
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;; --tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
--local-master)
MASTER_MYPORT=3306;
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --host=127.0.0.1 \
--port=$MYSQL_MYPORT"
LOCAL_MASTER=1 ;;
--master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;; --master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
--slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;; --slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
--manager-port=*) MYSQL_MANAGER_PORT=`$ECHO "$1" | $SED -e "s;--manager_port=;;"` ;; --manager-port=*) MYSQL_MANAGER_PORT=`$ECHO "$1" | $SED -e "s;--manager_port=;;"` ;;
...@@ -639,7 +644,9 @@ EOF ...@@ -639,7 +644,9 @@ EOF
start_master() start_master()
{ {
[ x$MASTER_RUNNING = 1 ] && return if [ x$MASTER_RUNNING = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
return
fi
# Remove old berkeley db log files that can confuse the server # Remove old berkeley db log files that can confuse the server
$RM -f $MASTER_MYDDIR/log.* $RM -f $MASTER_MYDDIR/log.*
# Remove stale binary logs # Remove stale binary logs
......
...@@ -167,11 +167,11 @@ void _downheap(register QUEUE *queue, uint idx) ...@@ -167,11 +167,11 @@ void _downheap(register QUEUE *queue, uint idx)
} }
static int queue_fix_cmp(QUEUE *queue, void *a, void *b) static int queue_fix_cmp(QUEUE *queue, void **a, void **b)
{ {
return queue->compare(queue->first_cmp_arg, return queue->compare(queue->first_cmp_arg,
(char*) a+queue->offset_to_key, (char*) (*a)+queue->offset_to_key,
(char*) b+queue->offset_to_key); (char*) (*b)+queue->offset_to_key);
} }
/* Fix heap when every element was changed */ /* Fix heap when every element was changed */
......
...@@ -467,8 +467,10 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, bool old_format) ...@@ -467,8 +467,10 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, bool old_format)
#endif #endif
{ {
char head[LOG_EVENT_HEADER_LEN]; char head[LOG_EVENT_HEADER_LEN];
uint header_size = old_format ? OLD_HEADER_LEN :
LOG_EVENT_HEADER_LEN;
LOCK_MUTEX; LOCK_MUTEX;
if (my_b_read(file, (byte *) head, sizeof(head))) if (my_b_read(file, (byte *) head, header_size ))
{ {
UNLOCK_MUTEX; UNLOCK_MUTEX;
return 0; return 0;
...@@ -485,7 +487,7 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, bool old_format) ...@@ -485,7 +487,7 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, bool old_format)
goto err; goto err;
} }
if (data_len < LOG_EVENT_HEADER_LEN) if (data_len < header_size)
{ {
error = "Event too small"; error = "Event too small";
goto err; goto err;
...@@ -498,9 +500,9 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, bool old_format) ...@@ -498,9 +500,9 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, bool old_format)
goto err; goto err;
} }
buf[data_len] = 0; buf[data_len] = 0;
memcpy(buf, head, LOG_EVENT_HEADER_LEN); memcpy(buf, head, header_size);
if(my_b_read(file, (byte*) buf + LOG_EVENT_HEADER_LEN, if(my_b_read(file, (byte*) buf + header_size,
data_len - LOG_EVENT_HEADER_LEN)) data_len - header_size))
{ {
error = "read error"; error = "read error";
goto err; goto err;
...@@ -653,11 +655,11 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -653,11 +655,11 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db)
Start_log_event::Start_log_event(const char* buf, Start_log_event::Start_log_event(const char* buf,
bool old_format) :Log_event(buf, old_format) bool old_format) :Log_event(buf, old_format)
{ {
binlog_version = uint2korr(buf + LOG_EVENT_HEADER_LEN + buf += (old_format) ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
ST_BINLOG_VER_OFFSET); binlog_version = uint2korr(buf+ST_BINLOG_VER_OFFSET);
memcpy(server_version, buf + ST_SERVER_VER_OFFSET + LOG_EVENT_HEADER_LEN, memcpy(server_version, buf+ST_SERVER_VER_OFFSET,
ST_SERVER_VER_LEN); ST_SERVER_VER_LEN);
created = uint4korr(buf + ST_CREATED_OFFSET + LOG_EVENT_HEADER_LEN); created = uint4korr(buf+ST_CREATED_OFFSET);
} }
int Start_log_event::write_data(IO_CACHE* file) int Start_log_event::write_data(IO_CACHE* file)
...@@ -675,13 +677,24 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len, ...@@ -675,13 +677,24 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len,
{ {
// the caller will ensure that event_len is what we have at // the caller will ensure that event_len is what we have at
// EVENT_LEN_OFFSET // EVENT_LEN_OFFSET
if(event_len < ROTATE_EVENT_OVERHEAD) int header_size = (old_format) ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
uint ident_offset;
if(event_len < header_size)
return; return;
buf += header_size;
pos = uint8korr(buf + R_POS_OFFSET + LOG_EVENT_HEADER_LEN); if (old_format)
{
ident_len = (uchar)(event_len - OLD_HEADER_LEN);
pos = 4;
ident_offset = 0;
}
else
{
ident_len = (uchar)(event_len - ROTATE_EVENT_OVERHEAD); ident_len = (uchar)(event_len - ROTATE_EVENT_OVERHEAD);
if (!(new_log_ident = (char*) my_memdup((byte*) buf + R_IDENT_OFFSET pos = uint8korr(buf + R_POS_OFFSET);
+ LOG_EVENT_HEADER_LEN, ident_offset = ROTATE_HEADER_LEN;
}
if (!(new_log_ident = (char*) my_memdup((byte*) buf + ident_offset,
(uint) ident_len, MYF(MY_WME)))) (uint) ident_len, MYF(MY_WME))))
return; return;
...@@ -717,22 +730,32 @@ Query_log_event::Query_log_event(const char* buf, int event_len, ...@@ -717,22 +730,32 @@ Query_log_event::Query_log_event(const char* buf, int event_len,
bool old_format): bool old_format):
Log_event(buf, old_format),data_buf(0), query(NULL), db(NULL) Log_event(buf, old_format),data_buf(0), query(NULL), db(NULL)
{ {
ulong data_len;
if (old_format)
{
if ((uint)event_len < OLD_HEADER_LEN + QUERY_HEADER_LEN)
return;
data_len = event_len - (QUERY_HEADER_LEN + OLD_HEADER_LEN);
buf += OLD_HEADER_LEN;
}
else
{
if ((uint)event_len < QUERY_EVENT_OVERHEAD) if ((uint)event_len < QUERY_EVENT_OVERHEAD)
return; return;
ulong data_len;
data_len = event_len - QUERY_EVENT_OVERHEAD; data_len = event_len - QUERY_EVENT_OVERHEAD;
buf += LOG_EVENT_HEADER_LEN;
}
exec_time = uint4korr(buf + Q_EXEC_TIME_OFFSET);
exec_time = uint4korr(buf + LOG_EVENT_HEADER_LEN + Q_EXEC_TIME_OFFSET); error_code = uint2korr(buf + Q_ERR_CODE_OFFSET);
error_code = uint2korr(buf + LOG_EVENT_HEADER_LEN + Q_ERR_CODE_OFFSET);
if (!(data_buf = (char*) my_malloc(data_len + 1, MYF(MY_WME)))) if (!(data_buf = (char*) my_malloc(data_len + 1, MYF(MY_WME))))
return; return;
memcpy(data_buf, buf + LOG_EVENT_HEADER_LEN + Q_DATA_OFFSET, data_len); memcpy(data_buf, buf + Q_DATA_OFFSET, data_len);
thread_id = uint4korr(buf + LOG_EVENT_HEADER_LEN + Q_THREAD_ID_OFFSET); thread_id = uint4korr(buf + Q_THREAD_ID_OFFSET);
db = data_buf; db = data_buf;
db_len = (uint)buf[LOG_EVENT_HEADER_LEN + Q_DB_LEN_OFFSET]; db_len = (uint)buf[Q_DB_LEN_OFFSET];
query=data_buf + db_len + 1; query=data_buf + db_len + 1;
q_len = data_len - 1 - db_len; q_len = data_len - 1 - db_len;
*((char*)query+q_len) = 0; *((char*)query+q_len) = 0;
...@@ -788,7 +811,7 @@ int Query_log_event::write_data(IO_CACHE* file) ...@@ -788,7 +811,7 @@ int Query_log_event::write_data(IO_CACHE* file)
Intvar_log_event::Intvar_log_event(const char* buf, bool old_format): Intvar_log_event::Intvar_log_event(const char* buf, bool old_format):
Log_event(buf, old_format) Log_event(buf, old_format)
{ {
buf += LOG_EVENT_HEADER_LEN; buf += (old_format) ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
type = buf[I_TYPE_OFFSET]; type = buf[I_TYPE_OFFSET];
val = uint8korr(buf+I_VAL_OFFSET); val = uint8korr(buf+I_VAL_OFFSET);
} }
...@@ -1031,19 +1054,22 @@ Load_log_event::Load_log_event(const char* buf, int event_len, ...@@ -1031,19 +1054,22 @@ Load_log_event::Load_log_event(const char* buf, int event_len,
{ {
if (!event_len) // derived class, will call copy_log_event() itself if (!event_len) // derived class, will call copy_log_event() itself
return; return;
copy_log_event(buf, event_len); copy_log_event(buf, event_len, old_format);
} }
int Load_log_event::copy_log_event(const char *buf, ulong event_len) int Load_log_event::copy_log_event(const char *buf, ulong event_len,
bool old_format)
{ {
uint data_len; uint data_len;
char* buf_end = (char*)buf + event_len; char* buf_end = (char*)buf + event_len;
thread_id = uint4korr(buf + L_THREAD_ID_OFFSET + LOG_EVENT_HEADER_LEN); const char* data_head = buf + ((old_format) ?
exec_time = uint4korr(buf + L_EXEC_TIME_OFFSET + LOG_EVENT_HEADER_LEN); OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN);
skip_lines = uint4korr(buf + L_SKIP_LINES_OFFSET + LOG_EVENT_HEADER_LEN); thread_id = uint4korr(data_head + L_THREAD_ID_OFFSET);
table_name_len = (uint)buf[L_TBL_LEN_OFFSET + LOG_EVENT_HEADER_LEN]; exec_time = uint4korr(data_head + L_EXEC_TIME_OFFSET);
db_len = (uint)buf[L_DB_LEN_OFFSET + LOG_EVENT_HEADER_LEN]; skip_lines = uint4korr(data_head + L_SKIP_LINES_OFFSET);
num_fields = uint4korr(buf + L_NUM_FIELDS_OFFSET + LOG_EVENT_HEADER_LEN); table_name_len = (uint)data_head[L_TBL_LEN_OFFSET];
db_len = (uint)data_head[L_DB_LEN_OFFSET];
num_fields = uint4korr(data_head + L_NUM_FIELDS_OFFSET);
int body_offset = get_data_body_offset(); int body_offset = get_data_body_offset();
if ((int) event_len < body_offset) if ((int) event_len < body_offset)
...@@ -1315,7 +1341,7 @@ Create_file_log_event::Create_file_log_event(const char* buf, int len): ...@@ -1315,7 +1341,7 @@ Create_file_log_event::Create_file_log_event(const char* buf, int len):
Load_log_event(buf,0,0),fake_base(0),block(0) Load_log_event(buf,0,0),fake_base(0),block(0)
{ {
int block_offset; int block_offset;
if (copy_log_event(buf,len)) if (copy_log_event(buf,len,0))
return; return;
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN + file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN +
+ LOAD_HEADER_LEN + CF_FILE_ID_OFFSET); + LOAD_HEADER_LEN + CF_FILE_ID_OFFSET);
......
...@@ -105,6 +105,7 @@ struct sql_ex_info ...@@ -105,6 +105,7 @@ struct sql_ex_info
/* event-specific post-header sizes */ /* event-specific post-header sizes */
#define LOG_EVENT_HEADER_LEN 19 #define LOG_EVENT_HEADER_LEN 19
#define OLD_HEADER_LEN 13
#define QUERY_HEADER_LEN (4 + 4 + 1 + 2) #define QUERY_HEADER_LEN (4 + 4 + 1 + 2)
#define LOAD_HEADER_LEN (4 + 4 + 4 + 1 +1 + 4) #define LOAD_HEADER_LEN (4 + 4 + 4 + 1 +1 + 4)
#define START_HEADER_LEN (2 + ST_SERVER_VER_LEN + 4) #define START_HEADER_LEN (2 + ST_SERVER_VER_LEN + 4)
...@@ -378,7 +379,7 @@ class Slave_log_event: public Log_event ...@@ -378,7 +379,7 @@ class Slave_log_event: public Log_event
class Load_log_event: public Log_event class Load_log_event: public Log_event
{ {
protected: protected:
int copy_log_event(const char *buf, ulong event_len); int copy_log_event(const char *buf, ulong event_len, bool old_format);
public: public:
ulong thread_id; ulong thread_id;
......
...@@ -389,9 +389,6 @@ static bool read_init_file(char *file_name); ...@@ -389,9 +389,6 @@ static bool read_init_file(char *file_name);
#ifdef __NT__ #ifdef __NT__
static pthread_handler_decl(handle_connections_namedpipes,arg); static pthread_handler_decl(handle_connections_namedpipes,arg);
#endif #endif
#ifdef __WIN__
static int get_service_parameters();
#endif
extern pthread_handler_decl(handle_slave,arg); extern pthread_handler_decl(handle_slave,arg);
#ifdef SET_RLIMIT_NOFILE #ifdef SET_RLIMIT_NOFILE
static uint set_maximum_open_files(uint max_file_limit); static uint set_maximum_open_files(uint max_file_limit);
...@@ -1677,14 +1674,6 @@ int main(int argc, char **argv) ...@@ -1677,14 +1674,6 @@ int main(int argc, char **argv)
mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */ mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */
set_options(); set_options();
#ifdef __WIN__
/* service parameters can be overwritten by options */
if (get_service_parameters())
{
my_message( 0, "Can't read MySQL service parameters", MYF(0) );
exit( 1 );
}
#endif
get_options(argc,argv); get_options(argc,argv);
if (opt_log || opt_update_log || opt_slow_log || opt_bin_log) if (opt_log || opt_update_log || opt_slow_log || opt_bin_log)
strcat(server_version,"-log"); strcat(server_version,"-log");
...@@ -4068,423 +4057,6 @@ static void get_options(int argc,char **argv) ...@@ -4068,423 +4057,6 @@ static void get_options(int argc,char **argv)
} }
#ifdef __WIN__
#ifndef KEY_SERVICE_PARAMETERS
#define KEY_SERVICE_PARAMETERS "SYSTEM\\CurrentControlSet\\Services\\MySql\\Parameters"
#endif
#define COPY_KEY_VALUE(value) if (copy_key_value(hParametersKey,&(value),lpszValue)) return 1
#define CHECK_KEY_TYPE(type,name) if ( type != dwKeyValueType ) { key_type_error(hParametersKey,name); return 1; }
#define SET_CHANGEABLE_VARVAL(varname) if (set_varval(hParametersKey,varname,szKeyValueName,dwKeyValueType,lpdwValue)) return 1;
static void key_type_error(HKEY hParametersKey,const char *szKeyValueName)
{
TCHAR szErrorMsg[512];
RegCloseKey( hParametersKey );
strxmov(szErrorMsg,TEXT("Value \""),
szKeyValueName,
TEXT("\" of registry key \"" KEY_SERVICE_PARAMETERS "\" has wrong type\n"),NullS);
fprintf(stderr, szErrorMsg); /* not unicode compatible */
}
static bool copy_key_value(HKEY hParametersKey, char **var, const char *value)
{
if (!(*var=my_strdup(value,MYF(MY_WME))))
{
RegCloseKey(hParametersKey);
fprintf(stderr, "Couldn't allocate memory for registry key value\n");
return 1;
}
return 0;
}
static bool set_varval(HKEY hParametersKey,const char *var,
const char *szKeyValueName, DWORD dwKeyValueType,
LPDWORD lpdwValue)
{
CHECK_KEY_TYPE(dwKeyValueType, szKeyValueName );
if (set_changeable_varval(var, *lpdwValue, changeable_vars))
{
TCHAR szErrorMsg [ 512 ];
RegCloseKey( hParametersKey );
strxmov(szErrorMsg,
TEXT("Value \""),
szKeyValueName,
TEXT("\" of registry key \"" KEY_SERVICE_PARAMETERS "\" is invalid\n"),NullS);
fprintf( stderr, szErrorMsg ); /* not unicode compatible */
return 1;
}
return 0;
}
static int get_service_parameters()
{
DWORD dwLastError;
HKEY hParametersKey;
DWORD dwIndex;
TCHAR szKeyValueName [ 256 ];
DWORD dwKeyValueName;
DWORD dwKeyValueType;
BYTE bKeyValueBuffer [ 512 ];
DWORD dwKeyValueBuffer;
LPDWORD lpdwValue = (LPDWORD) &bKeyValueBuffer[0];
LPCTSTR lpszValue = (LPCTSTR) &bKeyValueBuffer[0];
/* open parameters of service */
dwLastError = (DWORD) RegOpenKeyEx( HKEY_LOCAL_MACHINE,
TEXT(KEY_SERVICE_PARAMETERS), 0,
KEY_READ, &hParametersKey );
if ( dwLastError == ERROR_FILE_NOT_FOUND ) /* no parameters available */
return 0;
if ( dwLastError != ERROR_SUCCESS )
{
fprintf(stderr,"Can't open registry key \"" KEY_SERVICE_PARAMETERS "\" for reading\n" );
return 1;
}
/* enumerate all values of key */
dwIndex = 0;
dwKeyValueName = sizeof( szKeyValueName ) / sizeof( TCHAR );
dwKeyValueBuffer = sizeof( bKeyValueBuffer );
while ( (dwLastError = (DWORD) RegEnumValue(hParametersKey, dwIndex,
szKeyValueName, &dwKeyValueName,
NULL, &dwKeyValueType,
&bKeyValueBuffer[0],
&dwKeyValueBuffer))
!= ERROR_NO_MORE_ITEMS )
{
/* check if error occured */
if ( dwLastError != ERROR_SUCCESS )
{
RegCloseKey( hParametersKey );
fprintf( stderr, "Can't enumerate values of registry key \"" KEY_SERVICE_PARAMETERS "\"\n" );
return 1;
}
if ( lstrcmp(szKeyValueName, TEXT("BaseDir")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName);
strmov( mysql_home, lpszValue ); /* not unicode compatible */
}
else if ( lstrcmp(szKeyValueName, TEXT("BindAddress")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName);
my_bind_addr = (ulong) inet_addr( lpszValue );
if ( my_bind_addr == (ulong) INADDR_NONE )
{
struct hostent* ent;
if ( !(*lpszValue) )
{
char szHostName [ 256 ];
if ( gethostname(szHostName, sizeof(szHostName)) == SOCKET_ERROR )
{
RegCloseKey( hParametersKey );
fprintf( stderr, "Can't get my own hostname\n" );
return 1;
}
ent = gethostbyname( szHostName );
}
else ent = gethostbyname( lpszValue );
if ( !ent )
{
RegCloseKey( hParametersKey );
fprintf( stderr, "Can't resolve hostname!\n" );
return 1;
}
my_bind_addr = (ulong) ((in_addr*)ent->h_addr_list[0])->s_addr;
}
}
else if ( lstrcmp(szKeyValueName, TEXT("BigTables")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName);
if ( *lpdwValue )
thd_startup_options |= OPTION_BIG_TABLES;
else
thd_startup_options &= ~((ulong)OPTION_BIG_TABLES);
}
else if ( lstrcmp(szKeyValueName, TEXT("DataDir")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName );
strmov( mysql_real_data_home, lpszValue ); /* not unicode compatible */
}
else if ( lstrcmp(szKeyValueName, TEXT("Locking")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
my_disable_locking = !(*lpdwValue);
}
else if ( lstrcmp(szKeyValueName, TEXT("LogFile")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName );
opt_log = 1;
COPY_KEY_VALUE( opt_logname );
}
else if ( lstrcmp(szKeyValueName, TEXT("UpdateLogFile")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName );
opt_update_log = 1;
COPY_KEY_VALUE( opt_update_logname );
}
else if ( lstrcmp(szKeyValueName, TEXT("BinaryLogFile")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName );
opt_bin_log = 1;
COPY_KEY_VALUE( opt_bin_logname );
}
else if ( lstrcmp(szKeyValueName, TEXT("BinaryLogIndexFile")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName );
opt_bin_log = 1;
COPY_KEY_VALUE( opt_binlog_index_name );
}
else if ( lstrcmp(szKeyValueName, TEXT("ISAMLogFile")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName );
COPY_KEY_VALUE( myisam_log_filename );
opt_myisam_log=1;
}
else if ( lstrcmp(szKeyValueName, TEXT("LongLogFormat")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
if ( *lpdwValue )
opt_specialflag |= SPECIAL_LONG_LOG_FORMAT;
else
opt_specialflag &= ~((ulong)SPECIAL_LONG_LOG_FORMAT);
}
else if ( lstrcmp(szKeyValueName, TEXT("LowPriorityUpdates")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
if ( *lpdwValue )
{
thd_startup_options |= OPTION_LOW_PRIORITY_UPDATES;
low_priority_updates = 1;
}
else
{
thd_startup_options &= ~((ulong)OPTION_LOW_PRIORITY_UPDATES);
low_priority_updates = 0;
}
}
else if ( lstrcmp(szKeyValueName, TEXT("Port")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
mysql_port = (unsigned int) *lpdwValue;
}
else if ( lstrcmp(szKeyValueName, TEXT("OldProtocol")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
protocol_version = *lpdwValue ? PROTOCOL_VERSION - 1 : PROTOCOL_VERSION;
}
else if ( lstrcmp(szKeyValueName, TEXT("HostnameResolving")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
if ( !*lpdwValue )
opt_specialflag |= SPECIAL_NO_RESOLVE;
else
opt_specialflag &= ~((ulong)SPECIAL_NO_RESOLVE);
}
else if ( lstrcmp(szKeyValueName, TEXT("Networking")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
opt_disable_networking = !(*lpdwValue);
}
else if ( lstrcmp(szKeyValueName, TEXT("ShowDatabase")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
opt_skip_show_db = !(*lpdwValue);
}
else if ( lstrcmp(szKeyValueName, TEXT("HostnameCaching")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
if ( !*lpdwValue )
opt_specialflag |= SPECIAL_NO_HOST_CACHE;
else
opt_specialflag &= ~((ulong)SPECIAL_NO_HOST_CACHE);
}
else if ( lstrcmp(szKeyValueName, TEXT("ThreadPriority")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
if ( !(*lpdwValue) )
opt_specialflag |= SPECIAL_NO_PRIOR;
else
opt_specialflag &= ~((ulong)SPECIAL_NO_PRIOR);
}
else if ( lstrcmp(szKeyValueName, TEXT("NamedPipe")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName );
COPY_KEY_VALUE( mysql_unix_port );
}
else if ( lstrcmp(szKeyValueName, TEXT("TempDir")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName );
COPY_KEY_VALUE( mysql_tmpdir );
}
else if ( lstrcmp(szKeyValueName, TEXT("FlushTables")) == 0 )
{
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
#ifdef HAVE_NISAM
nisam_flush = 1;
#endif
myisam_flush= *lpdwValue ? 1 : 0;
}
else if ( lstrcmp(szKeyValueName, TEXT("BackLog")) == 0 )
{
SET_CHANGEABLE_VARVAL( "back_log" );
}
else if ( lstrcmp(szKeyValueName, TEXT("ConnectTimeout")) == 0 )
{
SET_CHANGEABLE_VARVAL( "connect_timeout" );
}
else if ( lstrcmp(szKeyValueName, TEXT("JoinBufferSize")) == 0 )
{
SET_CHANGEABLE_VARVAL( "join_buffer" );
}
else if ( lstrcmp(szKeyValueName, TEXT("KeyBufferSize")) == 0 )
{
SET_CHANGEABLE_VARVAL( "key_buffer" );
}
else if ( lstrcmp(szKeyValueName, TEXT("LongQueryTime")) == 0 )
{
SET_CHANGEABLE_VARVAL( "long_query_time" );
}
else if ( lstrcmp(szKeyValueName, TEXT("MaxAllowedPacket")) == 0 )
{
SET_CHANGEABLE_VARVAL( "max_allowed_packet" );
}
else if ( lstrcmp(szKeyValueName, TEXT("MaxConnections")) == 0 )
{
SET_CHANGEABLE_VARVAL( "max_connections" );
}
else if ( lstrcmp(szKeyValueName, TEXT("MaxUserConnections")) == 0 )
{
SET_CHANGEABLE_VARVAL( "max_user_connections" );
}
else if ( lstrcmp(szKeyValueName, TEXT("MaxConnectErrors")) == 0 )
{
SET_CHANGEABLE_VARVAL( "max_connect_errors" );
}
else if ( lstrcmp(szKeyValueName, TEXT("MaxInsertDelayedThreads")) == 0 )
{
SET_CHANGEABLE_VARVAL( "max_delayed_threads" );
}
else if ( lstrcmp(szKeyValueName, TEXT("MaxJoinSize")) == 0 )
{
SET_CHANGEABLE_VARVAL( "max_join_size" );
}
else if ( lstrcmp(szKeyValueName, TEXT("MaxSortLength")) == 0 )
{
SET_CHANGEABLE_VARVAL( "max_sort_length" );
}
else if ( lstrcmp(szKeyValueName, TEXT("NetBufferLength")) == 0 )
{
SET_CHANGEABLE_VARVAL( "net_buffer_length" );
}
else if ( lstrcmp(szKeyValueName, TEXT("RecordBufferSize")) == 0 )
{
SET_CHANGEABLE_VARVAL( "record_buffer" );
}
else if ( lstrcmp(szKeyValueName, TEXT("SortBufferSize")) == 0 )
{
SET_CHANGEABLE_VARVAL( "sort_buffer" );
}
else if ( lstrcmp(szKeyValueName, TEXT("TableCacheSize")) == 0 )
{
SET_CHANGEABLE_VARVAL( "table_cache" );
}
else if ( lstrcmp(szKeyValueName, TEXT("TmpTableSize")) == 0 )
{
SET_CHANGEABLE_VARVAL( "tmp_table_size" );
}
else if ( lstrcmp(szKeyValueName, TEXT("ThreadStackSize")) == 0 )
{
SET_CHANGEABLE_VARVAL( "thread_stack" );
}
else if ( lstrcmp(szKeyValueName, TEXT("WaitTimeout")) == 0 )
{
SET_CHANGEABLE_VARVAL( "wait_timeout" );
}
else if ( lstrcmp(szKeyValueName, TEXT("DelayedInsertTimeout"))
== 0 )
{
SET_CHANGEABLE_VARVAL( "delayed_insert_timeout" );
}
else if ( lstrcmp(szKeyValueName, TEXT("DelayedInsertLimit")) ==
0 )
{
SET_CHANGEABLE_VARVAL( "delayed_insert_limit" );
}
else if ( lstrcmp(szKeyValueName, TEXT("DelayedQueueSize")) == 0
)
{
SET_CHANGEABLE_VARVAL( "delayed_queue_size" );
}
else if ( lstrcmp(szKeyValueName, TEXT("FlushTime")) == 0 )
{
SET_CHANGEABLE_VARVAL( "flush_time" );
}
else if ( lstrcmp(szKeyValueName, TEXT("InteractiveTimeout")) ==
0 )
{
SET_CHANGEABLE_VARVAL( "interactive_timeout" );
}
else if ( lstrcmp(szKeyValueName, TEXT("LowerCaseTableNames"))
== 0 )
{
SET_CHANGEABLE_VARVAL( "lower_case_table_names" );
}
else if ( lstrcmp(szKeyValueName, TEXT("MaxHeapTableSize")) == 0
)
{
SET_CHANGEABLE_VARVAL( "max_heap_table_size" );
}
else if ( lstrcmp(szKeyValueName, TEXT("MaxTmpTables")) == 0 )
{
SET_CHANGEABLE_VARVAL( "max_tmp_tables" );
}
else if ( lstrcmp(szKeyValueName, TEXT("MaxWriteLockCount")) ==
0 )
{
SET_CHANGEABLE_VARVAL( "max_write_lock_count" );
}
else if ( lstrcmp(szKeyValueName, TEXT("NetRetryCount")) == 0 )
{
SET_CHANGEABLE_VARVAL( "net_retry_count" );
}
else if ( lstrcmp(szKeyValueName, TEXT("QueryBufferSize")) == 0
)
{
SET_CHANGEABLE_VARVAL( "query_buffer_size" );
}
else if ( lstrcmp(szKeyValueName, TEXT("ThreadConcurrency")) ==
0 )
{
SET_CHANGEABLE_VARVAL( "thread_concurrency" );
}
else
{
TCHAR szErrorMsg [ 512 ];
RegCloseKey( hParametersKey );
lstrcpy( szErrorMsg, TEXT("Value \"") );
lstrcat( szErrorMsg, szKeyValueName );
lstrcat( szErrorMsg, TEXT("\" of registry key \"" KEY_SERVICE_PARAMETERS "\" is not defined by MySQL\n") );
fprintf( stderr, szErrorMsg ); /* not unicode compatible */
return 1;
}
dwIndex++;
dwKeyValueName = sizeof( szKeyValueName ) / sizeof( TCHAR );
dwKeyValueBuffer = sizeof( bKeyValueBuffer );
}
RegCloseKey( hParametersKey );
/* paths are fixed by method get_options() */
return 0;
}
#endif
static char *get_relative_path(const char *path) static char *get_relative_path(const char *path)
{ {
if (test_if_hard_path(path) && if (test_if_hard_path(path) &&
......
...@@ -393,6 +393,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, ...@@ -393,6 +393,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
TABLE_LIST tables; TABLE_LIST tables;
int error= 1; int error= 1;
handler *file; handler *file;
uint save_options;
if (packet_len == packet_error) if (packet_len == packet_error)
{ {
...@@ -418,12 +419,17 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, ...@@ -418,12 +419,17 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
thd->current_tablenr = 0; thd->current_tablenr = 0;
thd->query_error = 0; thd->query_error = 0;
thd->net.no_send_ok = 1; thd->net.no_send_ok = 1;
/* we do not want to log create table statement */
save_options = thd->options;
thd->options &= ~OPTION_BIN_LOG;
thd->proc_info = "Creating table from master dump"; thd->proc_info = "Creating table from master dump";
// save old db in case we are creating in a different database // save old db in case we are creating in a different database
char* save_db = thd->db; char* save_db = thd->db;
thd->db = (char*)db; thd->db = (char*)db;
mysql_parse(thd, thd->query, packet_len); // run create table mysql_parse(thd, thd->query, packet_len); // run create table
thd->db = save_db; // leave things the way the were before thd->db = save_db; // leave things the way the were before
thd->options = save_options;
if (thd->query_error) if (thd->query_error)
goto err; // mysql_parse took care of the error send goto err; // mysql_parse took care of the error send
...@@ -1000,7 +1006,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -1000,7 +1006,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
int type_code = ev->get_type_code(); int type_code = ev->get_type_code();
int exec_res; int exec_res;
if (ev->server_id == ::server_id || if (ev->server_id == ::server_id ||
(slave_skip_counter && ev->get_type_code() != ROTATE_EVENT)) (slave_skip_counter && type_code != ROTATE_EVENT))
{ {
if(type_code == LOAD_EVENT) if(type_code == LOAD_EVENT)
skip_load_data_infile(net); skip_load_data_infile(net);
......
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