Commit 30ae0cdc authored by serg@serg.mylan's avatar serg@serg.mylan

Merge bk-internal:/home/bk/mysql-3.23/

into serg.mylan:/usr/home/serg/Abk/mysql
parents 4aa1ec21 f88097ee
...@@ -5,6 +5,7 @@ bar@bar.mysql.r18.ru ...@@ -5,6 +5,7 @@ bar@bar.mysql.r18.ru
bar@bar.udmsearch.izhnet.ru bar@bar.udmsearch.izhnet.ru
bell@sanja.is.com.ua bell@sanja.is.com.ua
bk@admin.bk bk@admin.bk
guilhem@mysql.com
heikki@donna.mysql.fi heikki@donna.mysql.fi
heikki@hundin.mysql.fi heikki@hundin.mysql.fi
jani@hynda.mysql.fi jani@hynda.mysql.fi
...@@ -31,8 +32,10 @@ salle@geopard.(none) ...@@ -31,8 +32,10 @@ salle@geopard.(none)
salle@geopard.online.bg salle@geopard.online.bg
sasha@mysql.sashanet.com sasha@mysql.sashanet.com
serg@build.mysql2.com serg@build.mysql2.com
serg@serg.mylan
serg@serg.mysql.com serg@serg.mysql.com
serg@sergbook.mysql.com serg@sergbook.mysql.com
sinisa@rhols221.adsl.netsonic.fi sinisa@rhols221.adsl.netsonic.fi
vva@eagle.mysql.r18.ru
walrus@mysql.com walrus@mysql.com
zak@balfor.local zak@balfor.local
...@@ -30,4 +30,5 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, ...@@ -30,4 +30,5 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS, OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS,
OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE, OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE,
OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES, OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES,
OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_LOCAL_INFILE}; OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_LOCAL_INFILE,
OPT_DELETE_MASTER_LOGS};
...@@ -73,7 +73,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0, ...@@ -73,7 +73,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
ignore=0,opt_drop=0,opt_keywords=0,opt_lock=0,opt_compress=0, ignore=0,opt_drop=0,opt_keywords=0,opt_lock=0,opt_compress=0,
opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0, opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0, opt_alldbs=0,opt_create_db=0,opt_first_slave=0,
opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0; opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0,
opt_delete_master_logs=0;
static MYSQL mysql_connection,*sock=0; static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0, *current_host=0,*path=0,*fields_terminated=0,
...@@ -101,6 +102,7 @@ static struct option long_options[] = ...@@ -101,6 +102,7 @@ static struct option long_options[] =
{"debug", optional_argument, 0, '#'}, {"debug", optional_argument, 0, '#'},
{"default-character-set", required_argument, 0, OPT_DEFAULT_CHARSET}, {"default-character-set", required_argument, 0, OPT_DEFAULT_CHARSET},
{"delayed-insert", no_argument, 0, OPT_DELAYED}, {"delayed-insert", no_argument, 0, OPT_DELAYED},
{"delete-master-logs", no_argument, 0, OPT_DELETE_MASTER_LOGS},
{"disable-keys", no_argument, 0, 'K'}, {"disable-keys", no_argument, 0, 'K'},
{"extended-insert", no_argument, 0, 'e'}, {"extended-insert", no_argument, 0, 'e'},
{"fields-terminated-by", required_argument, 0, (int) OPT_FTB}, {"fields-terminated-by", required_argument, 0, (int) OPT_FTB},
...@@ -206,9 +208,12 @@ static void usage(void) ...@@ -206,9 +208,12 @@ static void usage(void)
--add-locks Add locks around insert statements.\n\ --add-locks Add locks around insert statements.\n\
--allow-keywords Allow creation of column names that are keywords.\n\ --allow-keywords Allow creation of column names that are keywords.\n\
--delayed-insert Insert rows with INSERT DELAYED.\n\ --delayed-insert Insert rows with INSERT DELAYED.\n\
--delete-master-logs Issue RESET MASTER on the master just after taking\n\
the dump, and before unlocking tables.\n\
This will automatically enable --first-slave.\n\
--master-data This will cause the master position and filename to \n\ --master-data This will cause the master position and filename to \n\
be appended to your output. This will automagically \n\ be appended to your output, before unlocking tables.\n\
enable --first-slave.\n\ This will automatically enable --first-slave.\n\
-F, --flush-logs Flush logs file in server before starting dump.\n\ -F, --flush-logs Flush logs file in server before starting dump.\n\
-f, --force Continue even if we get an sql-error.\n\ -f, --force Continue even if we get an sql-error.\n\
-h, --host=... Connect to host.\n"); -h, --host=... Connect to host.\n");
...@@ -317,6 +322,10 @@ static int get_options(int *argc,char ***argv) ...@@ -317,6 +322,10 @@ static int get_options(int *argc,char ***argv)
opt_master_data=1; opt_master_data=1;
opt_first_slave=1; opt_first_slave=1;
break; break;
case OPT_DELETE_MASTER_LOGS:
opt_delete_master_logs=1;
opt_first_slave=1;
break;
case OPT_AUTOCOMMIT: case OPT_AUTOCOMMIT:
opt_autocommit=1; opt_autocommit=1;
break; break;
...@@ -1489,6 +1498,11 @@ int main(int argc, char **argv) ...@@ -1489,6 +1498,11 @@ int main(int argc, char **argv)
if (opt_first_slave) if (opt_first_slave)
{ {
if (opt_delete_master_logs && mysql_query(sock, "FLUSH MASTER"))
{
my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s",
MYF(0), mysql_error(sock));
}
if (opt_master_data) if (opt_master_data)
{ {
if (mysql_query(sock, "SHOW MASTER STATUS") || if (mysql_query(sock, "SHOW MASTER STATUS") ||
...@@ -1511,11 +1525,6 @@ int main(int argc, char **argv) ...@@ -1511,11 +1525,6 @@ int main(int argc, char **argv)
mysql_free_result(master); mysql_free_result(master);
} }
} }
if (mysql_query(sock, "FLUSH MASTER"))
{
my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s",
MYF(0), mysql_error(sock));
}
if (mysql_query(sock, "UNLOCK TABLES")) if (mysql_query(sock, "UNLOCK TABLES"))
{ {
my_printf_error(0, "Error: Couldn't execute 'UNLOCK TABLES': %s", my_printf_error(0, "Error: Couldn't execute 'UNLOCK TABLES': %s",
......
...@@ -62,8 +62,8 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) ...@@ -62,8 +62,8 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
extra=ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+ extra=ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
MI_DYN_DELETE_BLOCK_HEADER+1; MI_DYN_DELETE_BLOCK_HEADER+1;
reclength=info->s->base.pack_reclength+ reclength= (info->s->base.pack_reclength+ info->s->base.pack_bits+
_my_calc_total_blob_length(info,record)+ extra; _my_calc_total_blob_length(info,record)+ extra);
if (reclength > MI_DYN_MAX_ROW_LENGTH) if (reclength > MI_DYN_MAX_ROW_LENGTH)
{ {
my_errno=HA_ERR_TO_BIG_ROW; my_errno=HA_ERR_TO_BIG_ROW;
......
...@@ -501,3 +501,13 @@ table type possible_keys key key_len ref rows Extra ...@@ -501,3 +501,13 @@ table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4 t1 ALL NULL NULL NULL NULL 4
Field Type Null Key Default Extra Field Type Null Key Default Extra
testint int(11) 1 testint int(11) 1
a b
1 1
102 2
103 3
4 4
5 5
6 6
7 7
8 8
9 9
...@@ -41,3 +41,6 @@ rate_code base_rate ...@@ -41,3 +41,6 @@ rate_code base_rate
cust 20 cust 20
rate_code base_rate rate_code base_rate
cust 20 cust 20
ID Value1 ID Value2
ID Value1 ID Value2
ID Value1 ID Value2
...@@ -537,3 +537,14 @@ drop table t1; ...@@ -537,3 +537,14 @@ drop table t1;
create table t1 (testint int not null default 1) type=innodb; create table t1 (testint int not null default 1) type=innodb;
desc t1; desc t1;
drop table t1; drop table t1;
#
# Check update with conflicting key
#
CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) type=innodb;
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
# We need the a < 1000 test here to quard against the halloween problems
UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
SELECT * from t1;
drop table t1;
...@@ -243,3 +243,17 @@ INSERT INTO t2 VALUES ('rivercats','cust',20); ...@@ -243,3 +243,17 @@ INSERT INTO t2 VALUES ('rivercats','cust',20);
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats'; SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats';
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith'; SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith';
drop table t1,t2; drop table t1,t2;
#
# Problem with internal list handling when reducing WHERE
#
CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, Value1 VARCHAR(255));
CREATE TABLE t2 (ID INTEGER NOT NULL PRIMARY KEY, Value2 VARCHAR(255));
INSERT INTO t1 VALUES (1, 'A');
INSERT INTO t2 VALUES (1, 'B');
SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND (Value1 = 'A' AND Value2 <> 'B');
SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND Value1 = 'A' AND Value2 <> 'B';
SELECT * FROM t1 NATURAL JOIN t2 WHERE (Value1 = 'A' AND Value2 <> 'B') AND 1;
drop table t1,t2;
...@@ -244,7 +244,7 @@ int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 ...@@ -244,7 +244,7 @@ int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
int, i999 int, i1000 int) row_format=dynamic; int, i999 int, i1000 int, b blob) row_format=dynamic;
insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
...@@ -283,6 +283,6 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...@@ -283,6 +283,6 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei");
drop table if exists t1; drop table if exists t1;
source include/master-slave.inc; source include/master-slave.inc;
connection master; connection master;
use test; use test;
drop database if exists d1; drop database if exists test_$1;
create database d1; create database test_$1;
create table d1.t1 ( n int); create table test_$1.t1 ( n int);
alter table d1.t1 add m int; alter table test_$1.t1 add m int;
insert into d1.t1 values (1,2); insert into test_$1.t1 values (1,2);
create table d1.t2 (n int); create table test_$1.t2 (n int);
insert into d1.t2 values (45); insert into test_$1.t2 values (45);
rename table d1.t2 to d1.t3, d1.t1 to d1.t2; rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
select * from d1.t2; select * from test_$1.t2;
select * from d1.t3; select * from test_$1.t3;
connection master; connection master;
drop database d1; drop database test_$1;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
...@@ -85,7 +85,7 @@ static my_bool get_word(struct simpleconfig_buf_st *fb, char *buf) ...@@ -85,7 +85,7 @@ static my_bool get_word(struct simpleconfig_buf_st *fb, char *buf)
endptr = fb->buf; endptr = fb->buf;
} }
while (!isspace(*endptr)) while (*endptr && !isspace(*endptr))
*buf++= *endptr++; *buf++= *endptr++;
*buf=0; *buf=0;
fb->p = endptr; fb->p = endptr;
......
...@@ -21,13 +21,18 @@ ...@@ -21,13 +21,18 @@
#include <stdarg.h> #include <stdarg.h>
#include <m_ctype.h> #include <m_ctype.h>
int my_snprintf(char* to, size_t n, const char* fmt, ...) int my_snprintf(char* to, size_t n, const char* fmt, ...)
{ {
int result;
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
return my_vsnprintf(to, n, fmt, args); result= my_vsnprintf(to, n, fmt, args);
va_end(args);
return result;
} }
int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
{ {
char *start=to, *end=to+n-1; char *start=to, *end=to+n-1;
...@@ -79,6 +84,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) ...@@ -79,6 +84,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
return (uint) (to - start); return (uint) (to - start);
} }
#ifdef MAIN #ifdef MAIN
static void my_printf(const char * fmt, ...) static void my_printf(const char * fmt, ...)
{ {
...@@ -92,6 +98,7 @@ static void my_printf(const char * fmt, ...) ...@@ -92,6 +98,7 @@ static void my_printf(const char * fmt, ...)
va_end(ar); va_end(ar);
} }
int main() int main()
{ {
......
...@@ -113,7 +113,7 @@ my_bool innobase_fast_shutdown = TRUE; ...@@ -113,7 +113,7 @@ my_bool innobase_fast_shutdown = TRUE;
2 : write to the log file at each commit, but flush to disk only once per 2 : write to the log file at each commit, but flush to disk only once per
second */ second */
long innobase_flush_log_at_trx_commit = 0; long innobase_flush_log_at_trx_commit = 1;
/* The following counter is used to convey information to InnoDB /* The following counter is used to convey information to InnoDB
about server activity: in selects it is not sensible to call about server activity: in selects it is not sensible to call
......
...@@ -953,7 +953,7 @@ int ha_myisam::create(const char *name, register TABLE *form, ...@@ -953,7 +953,7 @@ int ha_myisam::create(const char *name, register TABLE *form,
&keydef, form->keys*sizeof(MI_KEYDEF), &keydef, form->keys*sizeof(MI_KEYDEF),
&keyseg, &keyseg,
((form->key_parts + form->keys) * sizeof(MI_KEYSEG)), ((form->key_parts + form->keys) * sizeof(MI_KEYSEG)),
0))) NullS)))
DBUG_RETURN(1); DBUG_RETURN(1);
pos=form->key_info; pos=form->key_info;
......
...@@ -269,5 +269,13 @@ bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields) ...@@ -269,5 +269,13 @@ bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields)
return 1; return 1;
} }
} }
/*
If table handler has primary key as part of the index, check that primary
key is not updated
*/
if (idx != table->primary_key && table->primary_key < MAX_KEY &&
(table->file->option_flag() & HA_PRIMARY_KEY_IN_READ_INDEX))
return check_if_key_used(table, table->primary_key, fields);
return 0; return 0;
} }
...@@ -1067,6 +1067,8 @@ void sql_print_error(const char *format,...) ...@@ -1067,6 +1067,8 @@ void sql_print_error(const char *format,...)
char buff[1024]; char buff[1024];
my_vsnprintf(buff,sizeof(buff)-1,format,args); my_vsnprintf(buff,sizeof(buff)-1,format,args);
DBUG_PRINT("error",("%s",buff)); DBUG_PRINT("error",("%s",buff));
va_end(args);
va_start(args,format);
} }
#endif #endif
skr=time(NULL); skr=time(NULL);
......
...@@ -304,7 +304,7 @@ void Start_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -304,7 +304,7 @@ void Start_log_event::print(FILE* file, bool short_form, char* last_db)
print_header(file); print_header(file);
fprintf(file, "\tStart: binlog v %d, server v %s created ", binlog_version, fprintf(file, "\tStart: binlog v %d, server v %s created ", binlog_version,
server_version); server_version);
print_timestamp(file, (time_t*)&created); print_timestamp(file, &created);
fputc('\n', file); fputc('\n', file);
fflush(file); fflush(file);
} }
...@@ -671,9 +671,9 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -671,9 +671,9 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
fprintf(file, "LOAD DATA INFILE '%s' ", fname); fprintf(file, "LOAD DATA INFILE '%s' ", fname);
if(sql_ex.opt_flags && REPLACE_FLAG ) if(sql_ex.opt_flags & REPLACE_FLAG )
fprintf(file," REPLACE "); fprintf(file," REPLACE ");
else if(sql_ex.opt_flags && IGNORE_FLAG ) else if(sql_ex.opt_flags & IGNORE_FLAG )
fprintf(file," IGNORE "); fprintf(file," IGNORE ");
fprintf(file, "INTO TABLE %s ", table_name); fprintf(file, "INTO TABLE %s ", table_name);
...@@ -685,7 +685,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -685,7 +685,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
if(!(sql_ex.empty_flags & ENCLOSED_EMPTY)) if(!(sql_ex.empty_flags & ENCLOSED_EMPTY))
{ {
if(sql_ex.opt_flags && OPT_ENCLOSED_FLAG ) if(sql_ex.opt_flags & OPT_ENCLOSED_FLAG )
fprintf(file," OPTIONALLY "); fprintf(file," OPTIONALLY ");
fprintf(file, " ENCLOSED BY "); fprintf(file, " ENCLOSED BY ");
pretty_print_char(file, sql_ex.enclosed); pretty_print_char(file, sql_ex.enclosed);
......
...@@ -327,13 +327,13 @@ extern char server_version[SERVER_VERSION_LENGTH]; ...@@ -327,13 +327,13 @@ extern char server_version[SERVER_VERSION_LENGTH];
class Start_log_event: public Log_event class Start_log_event: public Log_event
{ {
public: public:
uint32 created; time_t created;
uint16 binlog_version; uint16 binlog_version;
char server_version[50]; char server_version[50];
Start_log_event() :Log_event(time(NULL)),binlog_version(BINLOG_VERSION) Start_log_event() :Log_event(time(NULL)),binlog_version(BINLOG_VERSION)
{ {
created = (uint32) when; created = (time_t) when;
memcpy(server_version, ::server_version, sizeof(server_version)); memcpy(server_version, ::server_version, sizeof(server_version));
} }
Start_log_event(IO_CACHE* file, time_t when_arg, uint32 server_id_arg) : Start_log_event(IO_CACHE* file, time_t when_arg, uint32 server_id_arg) :
...@@ -345,7 +345,7 @@ public: ...@@ -345,7 +345,7 @@ public:
binlog_version = uint2korr(buf+4); binlog_version = uint2korr(buf+4);
memcpy(server_version, buf + 6, sizeof(server_version)); memcpy(server_version, buf + 6, sizeof(server_version));
server_version[sizeof(server_version)-1]=0; server_version[sizeof(server_version)-1]=0;
created = uint4korr(buf + 6 + sizeof(server_version)); created = (time_t) uint4korr(buf + 6 + sizeof(server_version));
} }
Start_log_event(const char* buf); Start_log_event(const char* buf);
...@@ -354,7 +354,7 @@ public: ...@@ -354,7 +354,7 @@ public:
int write_data(IO_CACHE* file); int write_data(IO_CACHE* file);
int get_data_size() int get_data_size()
{ {
// sizeof(binlog_version) + sizeof(server_version) sizeof(created) // size(binlog_version) + sizeof(server_version) + size(created)
return 2 + sizeof(server_version) + 4; return 2 + sizeof(server_version) + 4;
} }
void print(FILE* file, bool short_form = 0, char* last_db = 0); void print(FILE* file, bool short_form = 0, char* last_db = 0);
......
...@@ -515,8 +515,6 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -515,8 +515,6 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
host ? host : "(Null)", host ? host : "(Null)",
db ? db : "(Null)", db ? db : "(Null)",
user ? user : "(Null)")); user ? user : "(Null)"));
thr_alarm_init(&alarmed);
thr_alarm(&alarmed,(uint) net_read_timeout,&alarm_buff);
bzero((char*) &mysql->options,sizeof(mysql->options)); bzero((char*) &mysql->options,sizeof(mysql->options));
net->vio = 0; /* If something goes wrong */ net->vio = 0; /* If something goes wrong */
...@@ -598,7 +596,11 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -598,7 +596,11 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
host=LOCAL_HOST; host=LOCAL_HOST;
sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host); sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host);
DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port)); DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port));
if ((sock = socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR) thr_alarm_init(&alarmed);
thr_alarm(&alarmed, net_read_timeout, &alarm_buff);
sock = (my_socket) socket(AF_INET,SOCK_STREAM,0);
thr_end_alarm(&alarmed);
if (sock == SOCKET_ERROR)
{ {
net->last_errno=CR_IPSOCK_ERROR; net->last_errno=CR_IPSOCK_ERROR;
sprintf(net->last_error,ER(net->last_errno),socket_errno); sprintf(net->last_error,ER(net->last_errno),socket_errno);
...@@ -641,12 +643,8 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -641,12 +643,8 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
socket_errno,host)); socket_errno,host));
net->last_errno= CR_CONN_HOST_ERROR; net->last_errno= CR_CONN_HOST_ERROR;
sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, socket_errno); sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, socket_errno);
if (thr_alarm_in_use(&alarmed))
thr_end_alarm(&alarmed);
goto error; goto error;
} }
if (thr_alarm_in_use(&alarmed))
thr_end_alarm(&alarmed);
} }
if (!net->vio || my_net_init(net, net->vio)) if (!net->vio || my_net_init(net, net->vio))
......
...@@ -785,7 +785,7 @@ void clean_up(bool print_message) ...@@ -785,7 +785,7 @@ void clean_up(bool print_message)
if (!opt_bootstrap) if (!opt_bootstrap)
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist (void) my_delete(pidfile_name,MYF(0)); // This may not always exist
#endif #endif
if (print_message) if (print_message && errmesg)
sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname); sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname);
x_free((gptr) my_errmsg[ERRMAPP]); /* Free messages */ x_free((gptr) my_errmsg[ERRMAPP]); /* Free messages */
my_thread_end(); my_thread_end();
...@@ -1433,8 +1433,12 @@ static void *signal_hand(void *arg __attribute__((unused))) ...@@ -1433,8 +1433,12 @@ static void *signal_hand(void *arg __attribute__((unused)))
my_thread_init(); // Init new thread my_thread_init(); // Init new thread
DBUG_ENTER("signal_hand"); DBUG_ENTER("signal_hand");
/* Setup alarm handler */ /*
init_thr_alarm(max_connections+max_insert_delayed_threads); Setup alarm handler
This should actually be '+ max_number_of_slaves' instead of +10,
but the +10 should be quite safe.
*/
init_thr_alarm(max_connections+max_insert_delayed_threads+10);
#if SIGINT != THR_KILL_SIGNAL #if SIGINT != THR_KILL_SIGNAL
(void) sigemptyset(&set); // Setup up SIGINT for debug (void) sigemptyset(&set); // Setup up SIGINT for debug
(void) sigaddset(&set,SIGINT); // For debugging (void) sigaddset(&set,SIGINT); // For debugging
......
...@@ -784,9 +784,6 @@ static int safe_sleep(THD* thd, int sec) ...@@ -784,9 +784,6 @@ static int safe_sleep(THD* thd, int sec)
*/ */
thr_alarm(&alarmed, 2 * nap_time,&alarm_buff); thr_alarm(&alarmed, 2 * nap_time,&alarm_buff);
sleep(nap_time); sleep(nap_time);
// if we wake up before the alarm goes off, hit the button
// so it will not wake up the wife and kids :-)
if (thr_alarm_in_use(&alarmed))
thr_end_alarm(&alarmed); thr_end_alarm(&alarmed);
if (slave_killed(thd)) if (slave_killed(thd))
...@@ -1100,9 +1097,9 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -1100,9 +1097,9 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
else else
{ {
enum enum_duplicates handle_dup = DUP_IGNORE; enum enum_duplicates handle_dup = DUP_IGNORE;
if(lev->sql_ex.opt_flags && REPLACE_FLAG) if(lev->sql_ex.opt_flags & REPLACE_FLAG)
handle_dup = DUP_REPLACE; handle_dup = DUP_REPLACE;
sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags && sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags &
DUMPFILE_FLAG ); DUMPFILE_FLAG );
String field_term(&lev->sql_ex.field_term, 1), String field_term(&lev->sql_ex.field_term, 1),
enclosed(&lev->sql_ex.enclosed, 1), enclosed(&lev->sql_ex.enclosed, 1),
...@@ -1139,7 +1136,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -1139,7 +1136,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
List<Item> fields; List<Item> fields;
lev->set_fields(fields); lev->set_fields(fields);
thd->slave_proxy_id = thd->thread_id; thd->slave_proxy_id = thread_id;
thd->net.vio = net->vio; thd->net.vio = net->vio;
// mysql_load will use thd->net to read the file // mysql_load will use thd->net to read the file
thd->net.pkt_nr = net->pkt_nr; thd->net.pkt_nr = net->pkt_nr;
......
...@@ -30,6 +30,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table) ...@@ -30,6 +30,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table)
char path[FN_REFLEN]; char path[FN_REFLEN];
int error; int error;
TABLE **table_ptr; TABLE **table_ptr;
my_bool lock_open_locked= 0;
DBUG_ENTER("generate_table"); DBUG_ENTER("generate_table");
thd->proc_info="generate_table"; thd->proc_info="generate_table";
...@@ -102,7 +103,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table) ...@@ -102,7 +103,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table)
error= ha_create_table(path,&create_info,1) ? -1 : 0; error= ha_create_table(path,&create_info,1) ? -1 : 0;
if (thd->locked_tables && reopen_tables(thd,1,0)) if (thd->locked_tables && reopen_tables(thd,1,0))
error= -1; error= -1;
VOID(pthread_mutex_unlock(&LOCK_open)); lock_open_locked= 1; // Unlock mutex before return
} }
if (!error) if (!error)
{ {
...@@ -114,6 +115,8 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table) ...@@ -114,6 +115,8 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table)
} }
send_ok(&thd->net); // This should return record count send_ok(&thd->net); // This should return record count
} }
if (lock_open_locked)
VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(error ? -1 : 0); DBUG_RETURN(error ? -1 : 0);
} }
......
...@@ -160,6 +160,8 @@ public: ...@@ -160,6 +160,8 @@ public:
*new_list.last=current->next; *new_list.last=current->next;
current->info=new_list.first->info; current->info=new_list.first->info;
current->next=new_list.first->next; current->next=new_list.first->next;
if (list->last == &current->next && new_list.elements > 1)
list->last= new_list.last;
list->elements+=new_list.elements-1; list->elements+=new_list.elements-1;
} }
return ret_value; // return old element return ret_value; // return old element
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
it can be compiled with the UNSIGNED and/or LONGLONG flag set it can be compiled with the UNSIGNED and/or LONGLONG flag set
*/ */
#define strtoll glob_strtoll /* Fix for True64 */
#include <global.h> #include <global.h>
#include "m_string.h" #include "m_string.h"
#include "m_ctype.h" #include "m_ctype.h"
......
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