Commit 1f409baf authored by monty@tik.mysql.fi's avatar monty@tik.mysql.fi

Changed compare in MyISAM to use my_pread()

Fixed that @VAR shows all decimals
Fixed problem with FLUSH TABLES and LOCK TABLE
CREATE ... SELECT now creates keys later
Reset AUTO_INCREMENT order if droping AUTO_INCREMENT key
parent b79da888
...@@ -284,3 +284,4 @@ support-files/mysql.spec ...@@ -284,3 +284,4 @@ support-files/mysql.spec
tags tags
tmp/* tmp/*
sql-bench/gif/* sql-bench/gif/*
sql-bench/graph-compare-results
monty@hundin.mysql.fi monty@tik.mysql.fi
This diff is collapsed.
...@@ -954,7 +954,7 @@ static int _nisam_cmp_buffer(File file, const byte *buff, ulong filepos, uint le ...@@ -954,7 +954,7 @@ static int _nisam_cmp_buffer(File file, const byte *buff, ulong filepos, uint le
{ {
if (my_read(file,temp_buff,next_length,MYF(MY_NABP))) if (my_read(file,temp_buff,next_length,MYF(MY_NABP)))
goto err; goto err;
if (memcmp((byte*) buff,temp_buff,IO_SIZE)) if (memcmp((byte*) buff,temp_buff,next_length))
DBUG_RETURN(1); DBUG_RETURN(1);
buff+=next_length; buff+=next_length;
length-= next_length; length-= next_length;
......
...@@ -1221,20 +1221,19 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos, ...@@ -1221,20 +1221,19 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos,
char temp_buff[IO_SIZE*2]; char temp_buff[IO_SIZE*2];
DBUG_ENTER("_mi_cmp_buffer"); DBUG_ENTER("_mi_cmp_buffer");
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
next_length= IO_SIZE*2 - (uint) (filepos & (IO_SIZE-1)); next_length= IO_SIZE*2 - (uint) (filepos & (IO_SIZE-1));
while (length > IO_SIZE*2) while (length > IO_SIZE*2)
{ {
if (my_read(file,temp_buff,next_length,MYF(MY_NABP))) if (my_pread(file,temp_buff,next_length,filepos, MYF(MY_NABP)) ||
memcmp((byte*) buff,temp_buff,next_length))
goto err; goto err;
if (memcmp((byte*) buff,temp_buff,IO_SIZE)) filepos+=next_length;
DBUG_RETURN(1);
buff+=next_length; buff+=next_length;
length-= next_length; length-= next_length;
next_length=IO_SIZE*2; next_length=IO_SIZE*2;
} }
if (my_read(file,temp_buff,length,MYF(MY_NABP))) if (my_pread(file,temp_buff,length,filepos,MYF(MY_NABP)))
goto err; goto err;
DBUG_RETURN(memcmp((byte*) buff,temp_buff,length)); DBUG_RETURN(memcmp((byte*) buff,temp_buff,length));
err: err:
......
...@@ -1010,7 +1010,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file, ...@@ -1010,7 +1010,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file,
{ {
ref_length=myisam->s->pack.ref_length; ref_length=myisam->s->pack.ref_length;
/* /*
We can't use my_pread() here because mi_rad_pack_record assumes We can't use my_pread() here because mi_read_rnd_pack_record assumes
position is ok position is ok
*/ */
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0))); VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
......
...@@ -27,3 +27,8 @@ n ...@@ -27,3 +27,8 @@ n
12 12
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize status OK test.t1 optimize status OK
i
1
2
3
4
@test @`select` @TEST @not_used @test @`select` @TEST @not_used
1 2 3 NULL 1 2 3 NULL
@test_int @test_double @test_string @test_string2 @select @test_int @test_double @test_string @test_string2 @select
10 0.00 abcdeghi abcdefghij NULL 10 1e-10 abcdeghi abcdefghij NULL
@test_int @test_double @test_string @test_string2 @test_int @test_double @test_string @test_string2
hello hello hello hello hello hello hello hello
@test_int @test_double @test_string @test_string2 @test_int @test_double @test_string @test_string2
...@@ -10,3 +10,5 @@ hellohello hellohello hellohello hellohello ...@@ -10,3 +10,5 @@ hellohello hellohello hellohello hellohello
NULL NULL NULL NULL NULL NULL NULL NULL
@t1:=(@t2:=1)+@t3:=4 @t1 @t2 @t3 @t1:=(@t2:=1)+@t3:=4 @t1 @t2 @t3
5 5 1 4 5 5 1 4
@t5
1.23456
...@@ -71,3 +71,14 @@ ALTER TABLE t1 ADD Column new_col int not null; ...@@ -71,3 +71,14 @@ ALTER TABLE t1 ADD Column new_col int not null;
UNLOCK TABLES; UNLOCK TABLES;
OPTIMIZE TABLE t1; OPTIMIZE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
#
# Drop and add an auto_increment column
#
create table t1 (i int unsigned not null auto_increment primary key);
insert into t1 values (null),(null),(null),(null);
alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
select * from t1;
drop table t1;
# #
# test variables # test variables
# #
set @`test`=1,@TEST=3,@select=2; set @`test`=1,@TEST=3,@select=2,@t5=1.23456;
select @test,@`select`,@TEST,@not_used; select @test,@`select`,@TEST,@not_used;
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL; set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
select @test_int,@test_double,@test_string,@test_string2,@select; select @test_int,@test_double,@test_string,@test_string2,@select;
...@@ -12,3 +12,5 @@ select @test_int,@test_double,@test_string,@test_string2; ...@@ -12,3 +12,5 @@ select @test_int,@test_double,@test_string,@test_string2;
set @test_int=null,@test_double=null,@test_string=null,@test_string2=null; set @test_int=null,@test_double=null,@test_string=null,@test_string2=null;
select @test_int,@test_double,@test_string,@test_string2; select @test_int,@test_double,@test_string,@test_string2;
select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3; select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
select @t5;
...@@ -69,7 +69,7 @@ uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset, ...@@ -69,7 +69,7 @@ uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */ DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
} }
if (MyFlags & (MY_NABP | MY_FNABP)) if (MyFlags & (MY_NABP | MY_FNABP))
DBUG_RETURN(0); /* Ok vid l{sning */ DBUG_RETURN(0); /* Read went ok; Return 0 */
DBUG_RETURN(readbytes); /* purecov: inspected */ DBUG_RETURN(readbytes); /* purecov: inspected */
} }
} /* my_pread */ } /* my_pread */
......
...@@ -23,7 +23,7 @@ bench_SCRIPTS = test-ATIS test-connect test-create test-insert \ ...@@ -23,7 +23,7 @@ bench_SCRIPTS = test-ATIS test-connect test-create test-insert \
test-big-tables test-select test-wisconsin \ test-big-tables test-select test-wisconsin \
test-alter-table graph-compare-results \ test-alter-table graph-compare-results \
bench-init.pl compare-results run-all-tests \ bench-init.pl compare-results run-all-tests \
server-cfg crash-me copy-db \ server-cfg crash-me copy-db
CLEANFILES = $(bench_SCRIPTS) CLEANFILES = $(bench_SCRIPTS)
EXTRA_SCRIPTS = test-ATIS.sh test-connect.sh test-create.sh \ EXTRA_SCRIPTS = test-ATIS.sh test-connect.sh test-create.sh \
test-insert.sh test-big-tables.sh test-select.sh \ test-insert.sh test-big-tables.sh test-select.sh \
......
...@@ -11,7 +11,7 @@ In this directory are the queries and raw data files used to populate ...@@ -11,7 +11,7 @@ In this directory are the queries and raw data files used to populate
the MySQL benchmarks. In order to run the benchmarks you should normally the MySQL benchmarks. In order to run the benchmarks you should normally
execute a command like the following: execute a command like the following:
run-all-tests --server=msyql --cmp=mysql,pg,solid --user=test --password=test --log run-all-tests --server=mysql --cmp=mysql,pg,solid --user=test --password=test --log
The above means that one wants to run the benchmark with MySQL. The limits The above means that one wants to run the benchmark with MySQL. The limits
should be taken from all of mysql,PostgreSQL and Solid. Login name and should be taken from all of mysql,PostgreSQL and Solid. Login name and
......
...@@ -1758,7 +1758,7 @@ Item_func_get_user_var::val_str(String *str) ...@@ -1758,7 +1758,7 @@ Item_func_get_user_var::val_str(String *str)
return NULL; return NULL;
switch (entry->type) { switch (entry->type) {
case REAL_RESULT: case REAL_RESULT:
str->set(*(double*) entry->value); str->set(*(double*) entry->value,decimals);
break; break;
case INT_RESULT: case INT_RESULT:
str->set(*(longlong*) entry->value); str->set(*(longlong*) entry->value);
......
...@@ -206,3 +206,6 @@ ...@@ -206,3 +206,6 @@
"Kunde inte starta en tråd för replikering", "Kunde inte starta en tråd för replikering",
"Användare '%-.64s' har redan 'max_user_connections' aktiva inloggningar", "Användare '%-.64s' har redan 'max_user_connections' aktiva inloggningar",
"Du kan endast använda konstant-uttryck med SET", "Du kan endast använda konstant-uttryck med SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
...@@ -389,6 +389,9 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, ...@@ -389,6 +389,9 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
thd->in_lock_tables=1; thd->in_lock_tables=1;
result=reopen_tables(thd,1,1); result=reopen_tables(thd,1,1);
thd->in_lock_tables=0; thd->in_lock_tables=0;
/* Set version for table */
for (TABLE *table=thd->open_tables; table ; table=table->next)
table->version=refresh_version;
} }
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));
if (if_wait_for_refresh) if (if_wait_for_refresh)
......
...@@ -1362,6 +1362,7 @@ select_create::prepare(List<Item> &values) ...@@ -1362,6 +1362,7 @@ select_create::prepare(List<Item> &values)
if (info.handle_duplicates == DUP_IGNORE || if (info.handle_duplicates == DUP_IGNORE ||
info.handle_duplicates == DUP_REPLACE) info.handle_duplicates == DUP_REPLACE)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->deactivate_non_unique_index((ha_rows) 0);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -1233,8 +1233,17 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1233,8 +1233,17 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
if (drop->type == Alter_drop::COLUMN && if (drop->type == Alter_drop::COLUMN &&
!my_strcasecmp(field->field_name, drop->name)) !my_strcasecmp(field->field_name, drop->name))
{
/* Reset auto_increment value if it was dropped */
if (MTYP_TYPENR(field->unireg_check) == Field::NEXT_NUMBER &&
!(create_info->used_fields & HA_CREATE_USED_AUTO))
{
create_info->auto_increment_value=0;
create_info->used_fields|=HA_CREATE_USED_AUTO;
}
break; break;
} }
}
if (drop) if (drop)
{ {
drop_it.remove(); drop_it.remove();
......
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