Commit fe1842d9 authored by unknown's avatar unknown

Symlinking of tables should not work.

Fixed error number handling bug in mysqltest.
Fixed that error number from insert delayed is reported correctly.
merged new vio code with old violite code.


client/mysqltest.c:
  Fixed bug that error numbers wasn't tested properly.
myisam/mi_check.c:
  Moved initialization of variables to avoid a bug.
myisam/mi_create.c:
  Fixed bug in symlink handling.
myisam/mi_test_all.sh:
  Fixed script so that it works.
myisam/myisamchk.c:
  Removed --no-symlinks option
mysql-test/mysql-test-run.sh:
  Cleaned up error message
mysql-test/t/bdb.test:
  Fixed wrong error numbers
mysql-test/t/err000001.test:
  Fixed wrong error numbers
mysql-test/t/innodb.test:
  Fixed wrong error numbers
mysql-test/t/overflow.test:
  Fixed wrong error numbers
mysql-test/t/status.test:
  Ensure that we are using myisam tables for the lock test.
mysys/my_delete.c:
  cleanup
mysys/my_symlink2.c:
  Added option to not overwrite files when using symlinks.
sql/Makefile.am:
  Moved vio to avoid link error.
sql/ha_myisam.cc:
  Fixed symlink handling.
sql/mysqld.cc:
  Changed --skip-symlinks to --skip-symlink
sql/sql_insert.cc:
  Fixed that error number from insert delayed is reported correctly
sql/sql_parse.cc:
  Fixed symlink handling.
sql/sql_table.cc:
  Fixed symlink handling.
vio/vio.c:
  cleanup
vio/viosocket.c:
  c
parent c866beb5
...@@ -352,7 +352,9 @@ static void abort_not_supported_test() ...@@ -352,7 +352,9 @@ static void abort_not_supported_test()
static void verbose_msg(const char* fmt, ...) static void verbose_msg(const char* fmt, ...)
{ {
va_list args; va_list args;
if (!verbose) return; DBUG_ENTER("verbose_msg");
if (!verbose)
DBUG_VOID_RETURN;
va_start(args, fmt); va_start(args, fmt);
...@@ -360,6 +362,7 @@ static void verbose_msg(const char* fmt, ...) ...@@ -360,6 +362,7 @@ static void verbose_msg(const char* fmt, ...)
vfprintf(stderr, fmt, args); vfprintf(stderr, fmt, args);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
va_end(args); va_end(args);
DBUG_VOID_RETURN;
} }
...@@ -446,12 +449,12 @@ VAR* var_get(const char* var_name, const char** var_name_end, int raw) ...@@ -446,12 +449,12 @@ VAR* var_get(const char* var_name, const char** var_name_end, int raw)
{ {
const char* save_var_name = var_name, *end; const char* save_var_name = var_name, *end;
end = (var_name_end) ? *var_name_end : 0; end = (var_name_end) ? *var_name_end : 0;
while(isalnum(*var_name) || *var_name == '_') while (isvar(*var_name))
{ {
if(end && var_name == end) if(end && var_name == end)
break; break;
++var_name; ++var_name;
} }
if(var_name == save_var_name) if(var_name == save_var_name)
die("Empty variable"); die("Empty variable");
...@@ -1522,10 +1525,12 @@ void reject_dump(const char* record_file, char* buf, int size) ...@@ -1522,10 +1525,12 @@ void reject_dump(const char* record_file, char* buf, int size)
str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size); str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size);
} }
/* flags control the phased/stages of query execution to be performed /*
* flags control the phased/stages of query execution to be performed
* if QUERY_SEND bit is on, the query will be sent. If QUERY_REAP is on * if QUERY_SEND bit is on, the query will be sent. If QUERY_REAP is on
* the result will be read - for regular query, both bits must be on * the result will be read - for regular query, both bits must be on
*/ */
int run_query(MYSQL* mysql, struct st_query* q, int flags) int run_query(MYSQL* mysql, struct st_query* q, int flags)
{ {
MYSQL_RES* res = 0; MYSQL_RES* res = 0;
...@@ -1576,8 +1581,6 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) ...@@ -1576,8 +1581,6 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
if (q->abort_on_error) if (q->abort_on_error)
die("At line %u: query '%s' failed: %d: %s", start_lineno, query, die("At line %u: query '%s' failed: %d: %s", start_lineno, query,
mysql_errno(mysql), mysql_error(mysql)); mysql_errno(mysql), mysql_error(mysql));
/*die("At line %u: Failed in mysql_store_result for query '%s' (%d)",
start_lineno, query, mysql_errno(mysql));*/
else else
{ {
for (i=0 ; q->expected_errno[i] ; i++) for (i=0 ; q->expected_errno[i] ; i++)
...@@ -1587,13 +1590,15 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) ...@@ -1587,13 +1590,15 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
} }
if (i) if (i)
{ {
verbose_msg("query '%s' failed with wrong errno\ verbose_msg("query '%s' failed with wrong errno %d instead of %d...",
%d instead of %d...", q->query, mysql_errno(mysql), q->expected_errno[0]); q->query, mysql_errno(mysql), q->expected_errno[0]);
error=1;
goto end; goto end;
} }
verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql), verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql),
mysql_error(mysql)); mysql_error(mysql));
/* if we do not abort on error, failure to run the query does /*
if we do not abort on error, failure to run the query does
not fail the whole test case not fail the whole test case
*/ */
goto end; goto end;
...@@ -1754,11 +1759,11 @@ static void var_from_env(const char* name, const char* def_val) ...@@ -1754,11 +1759,11 @@ static void var_from_env(const char* name, const char* def_val)
static void init_var_hash() static void init_var_hash()
{ {
if(hash_init(&var_hash, 1024, 0, 0, get_var_key, var_free, MYF(0))) if (hash_init(&var_hash, 1024, 0, 0, get_var_key, var_free, MYF(0)))
die("Variable hash initialization failed"); die("Variable hash initialization failed");
var_from_env("MASTER_MYPORT", "9306"); var_from_env("MASTER_MYPORT", "9306");
var_from_env("SLAVE_MYPORT", "9307"); var_from_env("SLAVE_MYPORT", "9307");
var_from_env("MYSQL_TEST_DIR", ""); var_from_env("MYSQL_TEST_DIR", "/tmp");
} }
int main(int argc, char** argv) int main(int argc, char** argv)
......
...@@ -1102,6 +1102,10 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, ...@@ -1102,6 +1102,10 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
share->pack.header_length; share->pack.header_length;
got_error=1; got_error=1;
new_file= -1; new_file= -1;
sort_info->buff=0;
sort_info->buff_length=0;
sort_info->record=0;
if (!(param->testflag & T_SILENT)) if (!(param->testflag & T_SILENT))
{ {
printf("- recovering (with keycache) MyISAM-table '%s'\n",name); printf("- recovering (with keycache) MyISAM-table '%s'\n",name);
...@@ -1114,7 +1118,10 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, ...@@ -1114,7 +1118,10 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
if (init_io_cache(&param->read_cache,info->dfile, if (init_io_cache(&param->read_cache,info->dfile,
(uint) param->read_buffer_length, (uint) param->read_buffer_length,
READ_CACHE,share->pack.header_length,1,MYF(MY_WME))) READ_CACHE,share->pack.header_length,1,MYF(MY_WME)))
{
bzero(&info->rec_cache,sizeof(info->rec_cache));
goto err; goto err;
}
if (!rep_quick) if (!rep_quick)
if (init_io_cache(&info->rec_cache,-1,(uint) param->write_buffer_length, if (init_io_cache(&info->rec_cache,-1,(uint) param->write_buffer_length,
WRITE_CACHE, new_header_length, 1, WRITE_CACHE, new_header_length, 1,
...@@ -1122,7 +1129,6 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, ...@@ -1122,7 +1129,6 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
goto err; goto err;
info->opt_flag|=WRITE_CACHE_USED; info->opt_flag|=WRITE_CACHE_USED;
sort_info->start_recpos=0; sort_info->start_recpos=0;
sort_info->buff=0; sort_info->buff_length=0;
if (!(sort_info->record=(byte*) my_malloc((uint) share->base.pack_reclength, if (!(sort_info->record=(byte*) my_malloc((uint) share->base.pack_reclength,
MYF(0)))) MYF(0))))
{ {
......
...@@ -38,12 +38,13 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -38,12 +38,13 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
register uint i,j; register uint i,j;
File dfile,file; File dfile,file;
int errpos,save_errno; int errpos,save_errno;
myf create_flag;
uint fields,length,max_key_length,packed,pointer, uint fields,length,max_key_length,packed,pointer,
key_length,info_length,key_segs,options,min_key_length_skipp, key_length,info_length,key_segs,options,min_key_length_skipp,
base_pos,varchar_count,long_varchar_count,varchar_length, base_pos,varchar_count,long_varchar_count,varchar_length,
max_key_block_length,unique_key_parts,offset; max_key_block_length,unique_key_parts,offset;
ulong reclength, real_reclength,min_pack_length; ulong reclength, real_reclength,min_pack_length;
char buff[FN_REFLEN]; char filename[FN_REFLEN],linkname[FN_REFLEN], *linkname_ptr;
ulong pack_reclength; ulong pack_reclength;
ulonglong tot_length,max_rows; ulonglong tot_length,max_rows;
enum en_fieldtype type; enum en_fieldtype type;
...@@ -467,12 +468,31 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -467,12 +468,31 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
MI_EXTEND_BLOCK_LENGTH; MI_EXTEND_BLOCK_LENGTH;
if (! (flags & HA_DONT_TOUCH_DATA)) if (! (flags & HA_DONT_TOUCH_DATA))
share.state.create_time= (long) time((time_t*) 0); share.state.create_time= (long) time((time_t*) 0);
if (ci->index_file_name)
{
fn_format(filename, ci->index_file_name,"",MI_NAME_IEXT,4);
fn_format(linkname,name, "",MI_NAME_IEXT,4);
linkname_ptr=linkname;
/*
Don't create the table if the link or file exists to ensure that one
doesn't accidently destroy another table.
*/
create_flag=0;
}
else
{
fn_format(filename,name,"",MI_NAME_IEXT,(4+ (flags & HA_DONT_TOUCH_DATA) ?
32 : 0));
linkname_ptr=0;
/* Replace the current file */
create_flag=MY_DELETE_OLD;
}
if ((file= my_create_with_symlink(ci->index_file_name, if ((file= my_create_with_symlink(linkname_ptr,
fn_format(buff,name,"",MI_NAME_IEXT,4+ filename,
(ci->index_file_name ? 0 : 32)),
0, O_RDWR | O_TRUNC, 0, O_RDWR | O_TRUNC,
MYF(MY_WME | MY_DELETE_OLD))) < 0) MYF(MY_WME | create_flag))) < 0)
goto err; goto err;
errpos=1; errpos=1;
...@@ -481,8 +501,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -481,8 +501,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
#ifdef USE_RAID #ifdef USE_RAID
if (share.base.raid_type) if (share.base.raid_type)
{ {
(void) fn_format(buff,name,"",MI_NAME_DEXT,2+4); (void) fn_format(filename,name,"",MI_NAME_DEXT,2+4);
if ((dfile=my_raid_create(buff,0,O_RDWR | O_TRUNC, if ((dfile=my_raid_create(filename,0,O_RDWR | O_TRUNC,
share.base.raid_type, share.base.raid_type,
share.base.raid_chunks, share.base.raid_chunks,
share.base.raid_chunksize, share.base.raid_chunksize,
...@@ -492,11 +512,23 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -492,11 +512,23 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
else else
#endif #endif
{ {
(void) fn_format(buff,name,"",MI_NAME_DEXT,2+4 + if (ci->data_file_name)
(ci->data_file_name ? 0 : 32)); {
fn_format(filename, ci->data_file_name,"",MI_NAME_DEXT,4);
fn_format(linkname, name, "",MI_NAME_DEXT,4);
linkname_ptr=linkname;
create_flag=0;
}
else
{
fn_format(filename,name,"",MI_NAME_DEXT,4);
linkname_ptr=0;
create_flag=MY_DELETE_OLD;
}
if ((dfile= if ((dfile=
my_create_with_symlink(ci->data_file_name, buff, my_create_with_symlink(linkname_ptr, filename,
0,O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) 0,O_RDWR | O_TRUNC,
MYF(MY_WME | create_flag))) < 0)
goto err; goto err;
} }
errpos=3; errpos=3;
...@@ -517,14 +549,14 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -517,14 +549,14 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
/* Write key and keyseg definitions */ /* Write key and keyseg definitions */
for (i=0 ; i < share.base.keys - uniques; i++) for (i=0 ; i < share.base.keys - uniques; i++)
{ {
uint ft_segs=(keydefs[i].flag & HA_FULLTEXT) ? FT_SEGS : 0; /* SerG */ uint ft_segs=(keydefs[i].flag & HA_FULLTEXT) ? FT_SEGS : 0;
if (mi_keydef_write(file, &keydefs[i])) if (mi_keydef_write(file, &keydefs[i]))
goto err; goto err;
for (j=0 ; j < keydefs[i].keysegs-ft_segs ; j++) for (j=0 ; j < keydefs[i].keysegs-ft_segs ; j++)
if (mi_keyseg_write(file, &keydefs[i].seg[j])) if (mi_keyseg_write(file, &keydefs[i].seg[j]))
goto err; goto err;
for (j=0 ; j < ft_segs ; j++) /* SerG */ for (j=0 ; j < ft_segs ; j++)
{ {
MI_KEYSEG seg=ft_keysegs[j]; MI_KEYSEG seg=ft_keysegs[j];
seg.language= keydefs[i].seg[0].language; seg.language= keydefs[i].seg[0].language;
...@@ -605,24 +637,16 @@ err: ...@@ -605,24 +637,16 @@ err:
VOID(my_close(dfile,MYF(0))); VOID(my_close(dfile,MYF(0)));
/* fall through */ /* fall through */
case 2: case 2:
if (! (flags & HA_DONT_TOUCH_DATA))
{
/* QQ: Tnu should add a call to my_raid_delete() here */ /* QQ: Tnu should add a call to my_raid_delete() here */
VOID(fn_format(buff,name,"",MI_NAME_DEXT,2+4)); if (! (flags & HA_DONT_TOUCH_DATA))
my_delete(buff,MYF(0)); my_delete_with_symlink(fn_format(filename,name,"",MI_NAME_DEXT,2+4),
if (ci->data_file_name && strcmp(buff,ci->data_file_name)) MYF(0));
my_delete(ci->data_file_name,MYF(0));
}
/* fall through */ /* fall through */
case 1: case 1:
VOID(my_close(file,MYF(0))); VOID(my_close(file,MYF(0)));
if (! (flags & HA_DONT_TOUCH_DATA)) if (! (flags & HA_DONT_TOUCH_DATA))
{ my_delete_with_symlink(fn_format(filename,name,"",MI_NAME_IEXT,2+4),
VOID(fn_format(buff,name,"",MI_NAME_IEXT,2+4)); MYF(0));
my_delete(buff,MYF(0));
if (ci->index_file_name && strcmp(buff,ci->index_file_name))
my_delete(ci->index_file_name,MYF(0));
}
} }
my_free((char*) rec_per_key_part, MYF(0)); my_free((char*) rec_per_key_part, MYF(0));
DBUG_RETURN(my_errno=save_errno); /* return the fatal errno */ DBUG_RETURN(my_errno=save_errno); /* return the fatal errno */
......
#!/bin/sh
#
# Execute some simple basic test on MyISAM libary to check if things
# works at all.
silent="-s" silent="-s"
suffix=$MACH if test -f mi_test1$MACH ; then suffix=$MACH else suffix=""; fi
mi_test1$suffix $silent mi_test1$suffix $silent
myisamchk$suffix -se test1 myisamchk$suffix -se test1
mi_test1$suffix $silent -N -S mi_test1$suffix $silent -N -S
......
...@@ -183,7 +183,6 @@ static struct option long_options[] = ...@@ -183,7 +183,6 @@ static struct option long_options[] =
{"information", no_argument, 0, 'i'}, {"information", no_argument, 0, 'i'},
{"keys-used", required_argument, 0, 'k'}, {"keys-used", required_argument, 0, 'k'},
{"medium-check", no_argument, 0, 'm'}, {"medium-check", no_argument, 0, 'm'},
{"no-symlinks", no_argument, 0, 'l'},
{"quick", no_argument, 0, 'q'}, {"quick", no_argument, 0, 'q'},
{"read-only", no_argument, 0, 'T'}, {"read-only", no_argument, 0, 'T'},
{"recover", no_argument, 0, 'r'}, {"recover", no_argument, 0, 'r'},
...@@ -373,9 +372,6 @@ static void get_options(register int *argc,register char ***argv) ...@@ -373,9 +372,6 @@ static void get_options(register int *argc,register char ***argv)
case 'k': case 'k':
check_param.keys_in_use= (ulonglong) strtoll(optarg,NULL,10); check_param.keys_in_use= (ulonglong) strtoll(optarg,NULL,10);
break; break;
case 'l':
check_param.opt_follow_links=0;
break;
case 'm': case 'm':
check_param.testflag|= T_MEDIUM; /* Medium check */ check_param.testflag|= T_MEDIUM; /* Medium check */
break; break;
......
...@@ -99,8 +99,9 @@ export MYSQL_TEST_DIR ...@@ -99,8 +99,9 @@ export MYSQL_TEST_DIR
STD_DATA=$MYSQL_TEST_DIR/std_data STD_DATA=$MYSQL_TEST_DIR/std_data
hostname=`hostname` # Installed in the mysql privilege table hostname=`hostname` # Installed in the mysql privilege table
TESTDIR="$MYSQL_TEST_DIR/t/" TESTDIR="$MYSQL_TEST_DIR/t"
TESTSUFFIX=test TESTSUFFIX=test
TOT_SKIP=0
TOT_PASS=0 TOT_PASS=0
TOT_FAIL=0 TOT_FAIL=0
TOT_TEST=0 TOT_TEST=0
...@@ -359,8 +360,10 @@ report_stats () { ...@@ -359,8 +360,10 @@ report_stats () {
$ECHO "" $ECHO ""
$ECHO "The log files in $MYSQL_TEST_DIR/var/log may give you some hint" $ECHO "The log files in $MYSQL_TEST_DIR/var/log may give you some hint"
$ECHO "of what when wrong." $ECHO "of what when wrong."
$ECHO "If you want to report this error, please read first the documentation at" $ECHO ""
$ECHO "http://www.mysql.com/doc/M/y/MySQL_test_suite.html" $ECHO "Please follow the instructions outlined at"
$ECHO "http://www.mysql.com/doc/R/e/Reporting_mysqltest_bugs.html"
$ECHO "to find the reason to this problem and how to report this."
fi fi
} }
...@@ -640,7 +643,7 @@ run_testcase () ...@@ -640,7 +643,7 @@ run_testcase ()
timestr="$USERT $SYST $REALT" timestr="$USERT $SYST $REALT"
pname=`$ECHO "$tname "|$CUT -c 1-16` pname=`$ECHO "$tname "|$CUT -c 1-16`
RES="$pname $timestr" RES="$pname $timestr"
pass_inc skip_inc
$ECHO "$RES$RES_SPACE [ skipped ]" $ECHO "$RES$RES_SPACE [ skipped ]"
return return
fi fi
...@@ -747,7 +750,7 @@ run_testcase () ...@@ -747,7 +750,7 @@ run_testcase ()
$ECHO "Resuming Tests" $ECHO "Resuming Tests"
$ECHO "" $ECHO ""
else else
pass_inc skip_inc
$ECHO "$RES$RES_SPACE [ skipped ]" $ECHO "$RES$RES_SPACE [ skipped ]"
fi fi
fi fi
......
Variable_name Value
have_symlink YES
Table Op Msg_type Msg_text
test.t9 check status OK
Table Op Msg_type Msg_text
test.t9 optimize status OK
Table Op Msg_type Msg_text
test.t9 repair status OK
Table Create Table
t9 CREATE TABLE `t9` (
`a` int(11) NOT NULL auto_increment,
`b` char(16) NOT NULL default '',
`c` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
) TYPE=MyISAM
count(*)
16724
Table Create Table
t9 CREATE TABLE `t9` (
`a` int(11) NOT NULL auto_increment,
`b` char(16) NOT NULL default '',
`c` int(11) NOT NULL default '0',
`d` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
) TYPE=MyISAM
...@@ -686,7 +686,7 @@ drop table t1; ...@@ -686,7 +686,7 @@ drop table t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb; create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE; LOCK TABLES t1 WRITE;
--error 690 --error 1062
insert into t1 values (99,1,2,'D'),(1,1,2,'D'); insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1; select id from t1;
select id from t1; select id from t1;
...@@ -697,7 +697,7 @@ create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(3 ...@@ -697,7 +697,7 @@ create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(3
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE; LOCK TABLES t1 WRITE;
begin; begin;
--error 690 --error 1062
insert into t1 values (99,1,2,'D'),(1,1,2,'D'); insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1; select id from t1;
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
......
...@@ -10,7 +10,8 @@ create table t1 (a int); ...@@ -10,7 +10,8 @@ create table t1 (a int);
!$1054 select count(test.t1.b) from t1; !$1054 select count(test.t1.b) from t1;
!$1109 select count(not_existing_database.t1) from t1; !$1109 select count(not_existing_database.t1) from t1;
!$1109 select count(not_existing_database.t1.a) from t1; !$1109 select count(not_existing_database.t1.a) from t1;
!$1044 select count(not_existing_database.t1.a) from not_existing_database.t1; --error 1044,1146
select count(not_existing_database.t1.a) from not_existing_database.t1;
!$1054 select 1 from t1 order by 2; !$1054 select 1 from t1 order by 2;
!$1054 select 1 from t1 group by 2; !$1054 select 1 from t1 group by 2;
!$1054 select 1 from t1 order by t1.b; !$1054 select 1 from t1 order by t1.b;
......
...@@ -437,7 +437,7 @@ drop table t1; ...@@ -437,7 +437,7 @@ drop table t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb; create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE; LOCK TABLES t1 WRITE;
--error 690 --error 1062
insert into t1 values (99,1,2,'D'),(1,1,2,'D'); insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1; select id from t1;
select id from t1; select id from t1;
...@@ -448,7 +448,7 @@ create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(3 ...@@ -448,7 +448,7 @@ create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(3
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE; LOCK TABLES t1 WRITE;
begin; begin;
--error 690 --error 1062
insert into t1 values (99,1,2,'D'),(1,1,2,'D'); insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1; select id from t1;
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
......
connect (con1,localhost,boo,,); connect (con1,localhost,boo,,);
connection con1; connection con1;
-- error 1064; -- error 1064,1102
drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
...@@ -6,7 +6,7 @@ show status like 'Table_lock%'; ...@@ -6,7 +6,7 @@ show status like 'Table_lock%';
connection con1; connection con1;
SET SQL_LOG_BIN=0; SET SQL_LOG_BIN=0;
drop table if exists t1; drop table if exists t1;
create table t1(n int); create table t1(n int) type=myisam;
insert into t1 values(1); insert into t1 values(1);
connection con2; connection con2;
lock tables t1 read; lock tables t1 read;
......
-- require r/have_symlink.require
show variables like "have_symlink";
#
# First create little data to play with
#
drop table if exists t1,t2,t7,t8,t9;
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a));
create table t2 (a int not null auto_increment, b char(16) not null, primary key (a));
insert into t1 (b) values ("test"),("test1"),("test2"),("test3");
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
drop table t2;
#
# Start the test
# We use t9 here to not crash with tables generated by the backup test
#
eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp" index directory="$MYSQL_TEST_DIR/var/run";
insert into t9 select * from t1;
check table t9;
optimize table t9;
repair table t9;
alter table t9 add column c int not null;
show create table t9;
# Test renames
alter table t9 rename t8, add column d int not null;
alter table t8 rename t7;
rename table t7 to t9;
# Drop old t1 table, keep t9
drop table t1;
#
# Test error handling
# Note that we are using the above table t9 here!
#
--error 1103
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp";
# Check that we cannot link over a table from another database.
drop database if exists test_mysqltest;
create database test_mysqltest;
--error 1
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist";
--error 1103
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path";
--error 1
eval create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="$MYSQL_TEST_DIR/var/run";
--error 1
eval create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp";
# Check moving table t9 from default database to test_mysqltest;
# In this case the symlinks should be removed.
alter table t9 rename test_mysqltest.t9;
select count(*) from test_mysqltest.t9;
show create table test_mysqltest.t9;
drop database test_mysqltest;
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
MA 02111-1307, USA */ MA 02111-1307, USA */
#include "mysys_priv.h" #include "mysys_priv.h"
#include "mysys_err.h" #include "mysys_err.h"
int my_delete(const char *name, myf MyFlags) int my_delete(const char *name, myf MyFlags)
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
#include "mysys_priv.h" #include "mysys_priv.h"
#include "mysys_err.h"
#include <m_string.h> #include <m_string.h>
File my_create_with_symlink(const char *linkname, const char *filename, File my_create_with_symlink(const char *linkname, const char *filename,
...@@ -30,11 +31,27 @@ File my_create_with_symlink(const char *linkname, const char *filename, ...@@ -30,11 +31,27 @@ File my_create_with_symlink(const char *linkname, const char *filename,
{ {
File file; File file;
int tmp_errno; int tmp_errno;
/* Test if we should create a link */
int create_link=(linkname && strcmp(linkname,filename));
DBUG_ENTER("my_create_with_symlink"); DBUG_ENTER("my_create_with_symlink");
if (!(MyFlags & MY_DELETE_OLD))
{
if (!access(filename,F_OK))
{
my_error(EE_CANTCREATEFILE, MYF(0), filename, EEXIST);
DBUG_RETURN(-1);
}
if (create_link && !access(linkname,F_OK))
{
my_error(EE_CANTCREATEFILE, MYF(0), linkname, EEXIST);
DBUG_RETURN(-1);
}
}
if ((file=my_create(filename, createflags, access_flags, MyFlags)) >= 0) if ((file=my_create(filename, createflags, access_flags, MyFlags)) >= 0)
{ {
/* Test if we should create a link */ if (create_link)
if (linkname && strcmp(linkname,filename))
{ {
/* Delete old link/file */ /* Delete old link/file */
if (MyFlags & MY_DELETE_OLD) if (MyFlags & MY_DELETE_OLD)
......
...@@ -36,11 +36,11 @@ LDADD = ../isam/libnisam.a \ ...@@ -36,11 +36,11 @@ LDADD = ../isam/libnisam.a \
../myisam/libmyisam.a \ ../myisam/libmyisam.a \
../myisammrg/libmyisammrg.a \ ../myisammrg/libmyisammrg.a \
../heap/libheap.a \ ../heap/libheap.a \
../vio/libvio.a \
../mysys/libmysys.a \ ../mysys/libmysys.a \
../dbug/libdbug.a \ ../dbug/libdbug.a \
../regex/libregex.a \ ../regex/libregex.a \
../strings/libmystrings.a \ ../strings/libmystrings.a
../vio/libvio.a
mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \ mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \
@bdb_libs@ @innodb_libs@ @pstack_libs@ \ @bdb_libs@ @innodb_libs@ @pstack_libs@ \
......
...@@ -527,8 +527,8 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize) ...@@ -527,8 +527,8 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
int error=0; int error=0;
uint extra_testflag=0; uint extra_testflag=0;
bool optimize_done= !optimize, statistics_done=0; bool optimize_done= !optimize, statistics_done=0;
char fixed_name[FN_REFLEN];
const char *old_proc_info=thd->proc_info; const char *old_proc_info=thd->proc_info;
char fixed_name[FN_REFLEN];
MYISAM_SHARE* share = file->s; MYISAM_SHARE* share = file->s;
ha_rows rows= file->state->records; ha_rows rows= file->state->records;
DBUG_ENTER("ha_myisam::repair"); DBUG_ENTER("ha_myisam::repair");
...@@ -540,8 +540,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize) ...@@ -540,8 +540,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
param.thd=thd; param.thd=thd;
param.tmpdir=mysql_tmpdir; param.tmpdir=mysql_tmpdir;
param.out_flag=0; param.out_flag=0;
VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT, strmov(fixed_name,file->filename);
4+ (param.opt_follow_links ? 16 : 0)));
// Don't lock tables if we have used LOCK TABLE // Don't lock tables if we have used LOCK TABLE
if (!thd->locked_tables && mi_lock_database(file,F_WRLCK)) if (!thd->locked_tables && mi_lock_database(file,F_WRLCK))
...@@ -847,14 +846,14 @@ void ha_myisam::info(uint flag) ...@@ -847,14 +846,14 @@ void ha_myisam::info(uint flag)
/* /*
Set data_file_name and index_file_name to point at the symlink value Set data_file_name and index_file_name to point at the symlink value
if table is symlinked if table is symlinked (Ie; Real name is not same as generated name)
*/ */
data_file_name=index_file_name=0; data_file_name=index_file_name=0;
fn_format(name_buff, file->filename, "", MI_NAME_IEXT, 4); fn_format(name_buff, file->filename, "", MI_NAME_DEXT, 2);
if (!strcmp(name_buff, info.data_file_name)) if (strcmp(name_buff, info.data_file_name))
data_file_name=info.data_file_name; data_file_name=info.data_file_name;
strmov(fn_ext(name_buff),MI_NAME_DEXT); strmov(fn_ext(name_buff),MI_NAME_IEXT);
if (!strcmp(name_buff, info.index_file_name)) if (strcmp(name_buff, info.index_file_name))
index_file_name=info.index_file_name; index_file_name=info.index_file_name;
} }
if (flag & HA_STATUS_ERRKEY) if (flag & HA_STATUS_ERRKEY)
...@@ -1099,7 +1098,7 @@ int ha_myisam::create(const char *name, register TABLE *form, ...@@ -1099,7 +1098,7 @@ int ha_myisam::create(const char *name, register TABLE *form,
create_info.data_file_name= info->data_file_name; create_info.data_file_name= info->data_file_name;
create_info.index_file_name=info->index_file_name; create_info.index_file_name=info->index_file_name;
error=mi_create(fn_format(buff,name,"","",2+4+16), error=mi_create(fn_format(buff,name,"","",2+4),
form->keys,keydef, form->keys,keydef,
(uint) (recinfo_pos-recinfo), recinfo, (uint) (recinfo_pos-recinfo), recinfo,
0, (MI_UNIQUEDEF*) 0, 0, (MI_UNIQUEDEF*) 0,
......
...@@ -207,6 +207,7 @@ SHOW_COMP_OPTION have_ssl=SHOW_OPTION_YES; ...@@ -207,6 +207,7 @@ SHOW_COMP_OPTION have_ssl=SHOW_OPTION_YES;
#else #else
SHOW_COMP_OPTION have_ssl=SHOW_OPTION_NO; SHOW_COMP_OPTION have_ssl=SHOW_OPTION_NO;
#endif #endif
SHOW_COMP_OPTION have_symlink=SHOW_OPTION_YES;
static bool opt_skip_slave_start = 0; // if set, slave is not autostarted static bool opt_skip_slave_start = 0; // if set, slave is not autostarted
...@@ -2485,7 +2486,7 @@ enum options { ...@@ -2485,7 +2486,7 @@ enum options {
OPT_TEMP_POOL, OPT_DO_PSTACK, OPT_TX_ISOLATION, OPT_TEMP_POOL, OPT_DO_PSTACK, OPT_TX_ISOLATION,
OPT_GEMINI_FLUSH_LOG, OPT_GEMINI_RECOVER, OPT_GEMINI_FLUSH_LOG, OPT_GEMINI_RECOVER,
OPT_GEMINI_UNBUFFERED_IO, OPT_SKIP_SAFEMALLOC, OPT_GEMINI_UNBUFFERED_IO, OPT_SKIP_SAFEMALLOC,
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, OPT_REPORT_HOST, OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINK, OPT_REPORT_HOST,
OPT_REPORT_USER, OPT_REPORT_PASSWORD, OPT_REPORT_PORT, OPT_REPORT_USER, OPT_REPORT_PASSWORD, OPT_REPORT_PORT,
OPT_SHOW_SLAVE_AUTH_INFO OPT_SHOW_SLAVE_AUTH_INFO
}; };
...@@ -2623,7 +2624,7 @@ static struct option long_options[] = { ...@@ -2623,7 +2624,7 @@ static struct option long_options[] = {
{"skip-show-database", no_argument, 0, (int) OPT_SKIP_SHOW_DB}, {"skip-show-database", no_argument, 0, (int) OPT_SKIP_SHOW_DB},
{"skip-slave-start", no_argument, 0, (int) OPT_SKIP_SLAVE_START}, {"skip-slave-start", no_argument, 0, (int) OPT_SKIP_SLAVE_START},
{"skip-stack-trace", no_argument, 0, (int) OPT_SKIP_STACK_TRACE}, {"skip-stack-trace", no_argument, 0, (int) OPT_SKIP_STACK_TRACE},
{"skip-symlinks", no_argument, 0, (int) OPT_SKIP_SYMLINKS}, {"skip-symlink", no_argument, 0, (int) OPT_SKIP_SYMLINK},
{"skip-thread-priority", no_argument, 0, (int) OPT_SKIP_PRIOR}, {"skip-thread-priority", no_argument, 0, (int) OPT_SKIP_PRIOR},
{"sql-bin-update-same", no_argument, 0, (int) OPT_SQL_BIN_UPDATE_SAME}, {"sql-bin-update-same", no_argument, 0, (int) OPT_SQL_BIN_UPDATE_SAME},
#include "sslopt-longopts.h" #include "sslopt-longopts.h"
...@@ -2832,6 +2833,7 @@ struct show_var_st init_vars[]= { ...@@ -2832,6 +2833,7 @@ struct show_var_st init_vars[]= {
{"have_innodb", (char*) &have_innodb, SHOW_HAVE}, {"have_innodb", (char*) &have_innodb, SHOW_HAVE},
{"have_isam", (char*) &have_isam, SHOW_HAVE}, {"have_isam", (char*) &have_isam, SHOW_HAVE},
{"have_raid", (char*) &have_raid, SHOW_HAVE}, {"have_raid", (char*) &have_raid, SHOW_HAVE},
{"have_symlink", (char*) &have_symlink, SHOW_HAVE},
{"have_ssl", (char*) &have_ssl, SHOW_HAVE}, {"have_ssl", (char*) &have_ssl, SHOW_HAVE},
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
...@@ -3068,6 +3070,7 @@ static void usage(void) ...@@ -3068,6 +3070,7 @@ static void usage(void)
/* We have to break the string here because of VC++ limits */ /* We have to break the string here because of VC++ limits */
puts("\ puts("\
--skip-stack-trace Don't print a stack trace on failure\n\ --skip-stack-trace Don't print a stack trace on failure\n\
--skip-symlink Don't allow symlinking of tables\n\
--skip-show-database Don't allow 'SHOW DATABASE' commands\n\ --skip-show-database Don't allow 'SHOW DATABASE' commands\n\
--skip-thread-priority\n\ --skip-thread-priority\n\
Don't give threads different priorities.\n\ Don't give threads different priorities.\n\
...@@ -3454,6 +3457,7 @@ static void get_options(int argc,char **argv) ...@@ -3454,6 +3457,7 @@ static void get_options(int argc,char **argv)
myisam_concurrent_insert=0; myisam_concurrent_insert=0;
myisam_recover_options= HA_RECOVER_NONE; myisam_recover_options= HA_RECOVER_NONE;
my_disable_symlinks=1; my_disable_symlinks=1;
have_symlink=SHOW_OPTION_DISABLED;
ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED; ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED;
break; break;
case (int) OPT_SAFE: case (int) OPT_SAFE:
...@@ -3510,8 +3514,9 @@ static void get_options(int argc,char **argv) ...@@ -3510,8 +3514,9 @@ static void get_options(int argc,char **argv)
case (int) OPT_SKIP_STACK_TRACE: case (int) OPT_SKIP_STACK_TRACE:
test_flags|=TEST_NO_STACKTRACE; test_flags|=TEST_NO_STACKTRACE;
break; break;
case (int) OPT_SKIP_SYMLINKS: case (int) OPT_SKIP_SYMLINK:
my_disable_symlinks=1; my_disable_symlinks=1;
have_symlink=SHOW_OPTION_DISABLED;
break; break;
case (int) OPT_BIND_ADDRESS: case (int) OPT_BIND_ADDRESS:
if (optarg && isdigit(optarg[0])) if (optarg && isdigit(optarg[0]))
......
...@@ -642,7 +642,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list) ...@@ -642,7 +642,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
/* Copy error message and abort */ /* Copy error message and abort */
thd->fatal_error=1; thd->fatal_error=1;
strmov(thd->net.last_error,tmp->thd.net.last_error); strmov(thd->net.last_error,tmp->thd.net.last_error);
thd->net.last_errno=thd->net.last_errno; thd->net.last_errno=tmp->thd.net.last_errno;
} }
tmp->unlock(); tmp->unlock();
pthread_mutex_unlock(&LOCK_delayed_create); pthread_mutex_unlock(&LOCK_delayed_create);
......
...@@ -2903,11 +2903,9 @@ static bool append_file_to_dir(char **filename_ptr, char *table_name) ...@@ -2903,11 +2903,9 @@ static bool append_file_to_dir(char **filename_ptr, char *table_name)
/* Fix is using unix filename format on dos */ /* Fix is using unix filename format on dos */
strmov(buff,*filename_ptr); strmov(buff,*filename_ptr);
convert_dirname(buff); convert_dirname(buff);
if (!(ptr=sql_alloc(strlen(buff)+strlen(table_name+1)))) if (!(ptr=sql_alloc(strlen(buff)+strlen(table_name)+1)))
return 1; // End of memory return 1; // End of memory
*filename_ptr=ptr; *filename_ptr=ptr;
ptr=strmov(ptr,buff); strxmov(ptr,buff,table_name,NullS);
*ptr=FN_LIBCHAR;
strmov(ptr+1,table_name);
return 0; return 0;
} }
...@@ -1491,6 +1491,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1491,6 +1491,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
1); 1);
} }
} }
else
create_info->data_file_name=create_info->index_file_name=0;
if ((error=mysql_create_table(thd, new_db, tmp_name, if ((error=mysql_create_table(thd, new_db, tmp_name,
create_info, create_info,
......
...@@ -66,38 +66,40 @@ void vio_reset(Vio* vio, enum enum_vio_type type, ...@@ -66,38 +66,40 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe, my_socket sd, HANDLE hPipe,
my_bool localhost) my_bool localhost)
{ {
bzero((char*) vio, sizeof(Vio)); bzero((char*) vio, sizeof(*vio));
vio->type = type; vio->type = type;
vio->sd = sd; vio->sd = sd;
vio->hPipe = hPipe; vio->hPipe = hPipe;
vio->localhost= localhost; vio->localhost= localhost;
#ifdef HAVE_VIO #ifdef HAVE_VIO
if(type == VIO_TYPE_SSL){ if (type == VIO_TYPE_SSL)
vio->viodelete =vio_ssl_delete; {
vio->vioerrno =vio_ssl_errno; vio->viodelete =vio_ssl_delete;
vio->read =vio_ssl_read; vio->vioerrno =vio_ssl_errno;
vio->write =vio_ssl_write; vio->read =vio_ssl_read;
vio->fastsend =vio_ssl_fastsend; vio->write =vio_ssl_write;
vio->viokeepalive=vio_ssl_keepalive; vio->fastsend =vio_ssl_fastsend;
vio->should_retry=vio_ssl_should_retry; vio->viokeepalive =vio_ssl_keepalive;
vio->vioclose =vio_ssl_close; vio->should_retry =vio_ssl_should_retry;
vio->peer_addr =vio_ssl_peer_addr; vio->vioclose =vio_ssl_close;
vio->in_addr =vio_ssl_in_addr; vio->peer_addr =vio_ssl_peer_addr;
vio->poll_read =vio_ssl_poll_read; vio->in_addr =vio_ssl_in_addr;
} else { /* default is VIO_TYPE_TCPIP */ vio->poll_read =vio_ssl_poll_read;
vio->viodelete =vio_delete; }
vio->vioerrno =vio_errno; else /* default is VIO_TYPE_TCPIP */
vio->read =vio_read; {
vio->write =vio_write; vio->viodelete =vio_delete;
vio->fastsend =vio_fastsend; vio->vioerrno =vio_errno;
vio->viokeepalive=vio_keepalive; vio->read =vio_read;
vio->should_retry=vio_should_retry; vio->write =vio_write;
vio->vioclose =vio_close; vio->fastsend =vio_fastsend;
vio->peer_addr =vio_peer_addr; vio->viokeepalive =vio_keepalive;
vio->in_addr =vio_in_addr; vio->should_retry =vio_should_retry;
vio->poll_read =vio_poll_read; vio->vioclose =vio_close;
} vio->peer_addr =vio_peer_addr;
vio->in_addr =vio_in_addr;
vio->poll_read =vio_poll_read;
}
#endif /* HAVE_VIO */ #endif /* HAVE_VIO */
} }
...@@ -148,5 +150,3 @@ Vio *vio_new_win32pipe(HANDLE hPipe) ...@@ -148,5 +150,3 @@ Vio *vio_new_win32pipe(HANDLE hPipe)
} }
#endif #endif
...@@ -101,7 +101,7 @@ int vio_read(Vio * vio, gptr buf, int size) ...@@ -101,7 +101,7 @@ int vio_read(Vio * vio, gptr buf, int size)
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (r < 0) if (r < 0)
{ {
DBUG_PRINT("error", ("Got error %d during read",errno)); DBUG_PRINT("vio_error", ("Got error %d during read",errno));
} }
#endif /* DBUG_OFF */ #endif /* DBUG_OFF */
DBUG_PRINT("exit", ("%d", r)); DBUG_PRINT("exit", ("%d", r));
...@@ -129,7 +129,7 @@ int vio_write(Vio * vio, const gptr buf, int size) ...@@ -129,7 +129,7 @@ int vio_write(Vio * vio, const gptr buf, int size)
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (r < 0) if (r < 0)
{ {
DBUG_PRINT("error", ("Got error on write: %d",errno)); DBUG_PRINT("vio_error", ("Got error on write: %d",errno));
} }
#endif /* DBUG_OFF */ #endif /* DBUG_OFF */
DBUG_PRINT("exit", ("%d", r)); DBUG_PRINT("exit", ("%d", r));
...@@ -268,7 +268,7 @@ int vio_close(Vio * vio) ...@@ -268,7 +268,7 @@ int vio_close(Vio * vio)
} }
if (r) if (r)
{ {
DBUG_PRINT("error", ("close() failed, error: %d",errno)); DBUG_PRINT("vio_error", ("close() failed, error: %d",errno));
/* FIXME: error handling (not critical for MySQL) */ /* FIXME: error handling (not critical for MySQL) */
} }
vio->type= VIO_CLOSED; vio->type= VIO_CLOSED;
...@@ -310,8 +310,7 @@ my_bool vio_peer_addr(Vio * vio, char *buf) ...@@ -310,8 +310,7 @@ my_bool vio_peer_addr(Vio * vio, char *buf)
DBUG_PRINT("exit", ("getpeername, error: %d", errno)); DBUG_PRINT("exit", ("getpeername, error: %d", errno));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* FIXME */ my_inet_ntoa(vio->remote.sin_addr,buf);
/* my_inet_ntoa(vio->remote.sin_addr,buf); */
} }
DBUG_PRINT("exit", ("addr=%s", buf)); DBUG_PRINT("exit", ("addr=%s", buf));
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -349,4 +348,3 @@ my_bool vio_poll_read(Vio *vio,uint timeout) ...@@ -349,4 +348,3 @@ my_bool vio_poll_read(Vio *vio,uint timeout)
DBUG_RETURN(fds.revents & POLLIN ? 0 : 1); DBUG_RETURN(fds.revents & POLLIN ? 0 : 1);
#endif #endif
} }
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