Commit d2fdcd90 authored by msvensson@pilot.(none)'s avatar msvensson@pilot.(none)

Merge pilot.(none):/data/msvensson/mysql/work/my51-work

into  pilot.(none):/data/msvensson/mysql/mysql-5.1-new-maint
parents cd7fdee0 bde83389
This diff is collapsed.
...@@ -1920,6 +1920,20 @@ a b ...@@ -1920,6 +1920,20 @@ a b
2 Curly 2 Curly
drop table federated.t1; drop table federated.t1;
drop table federated.t1; drop table federated.t1;
Bug#18287 create federated table always times out, error 1159 ' '
Test that self-references work
create table federated.t1 (a int primary key);
create table federated.t2 (a int primary key)
ENGINE=FEDERATED
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
insert into federated.t1 (a) values (1);
select * from federated.t2;
a
1
drop table federated.t1, federated.t2;
CREATE TABLE federated.t1 (a INT PRIMARY KEY) DEFAULT CHARSET=utf8; CREATE TABLE federated.t1 (a INT PRIMARY KEY) DEFAULT CHARSET=utf8;
CREATE TABLE federated.t1 (a INT PRIMARY KEY) CREATE TABLE federated.t1 (a INT PRIMARY KEY)
ENGINE=FEDERATED ENGINE=FEDERATED
......
...@@ -96,4 +96,74 @@ ERROR HY000: You can't combine write-locking of system tables with other tables ...@@ -96,4 +96,74 @@ ERROR HY000: You can't combine write-locking of system tables with other tables
LOCK TABLES mysql.time_zone READ, mysql.proc WRITE; LOCK TABLES mysql.time_zone READ, mysql.proc WRITE;
ERROR HY000: You can't combine write-locking of system tables with other tables or lock types ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
DROP TABLE t1; DROP TABLE t1;
Bug#5719 impossible to lock VIEW
Just covering existing behaviour with tests.
Consistency has not been found here.
drop view if exists v_bug5719;
drop table if exists t1, t2, t3;
create table t1 (a int);
create temporary table t2 (a int);
create table t3 (a int);
create view v_bug5719 as select 1;
lock table v_bug5719 write;
select * from t1;
ERROR HY000: Table 't1' was not locked with LOCK TABLES
Allowed to select from a temporary talbe under LOCK TABLES
select * from t2;
a
select * from t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES
select * from v_bug5719;
1
1
drop view v_bug5719;
sic: did not left LOCK TABLES mode automatically
select * from t1;
ERROR HY000: Table 't1' was not locked with LOCK TABLES
unlock tables;
create view v_bug5719 as select * from t1;
lock tables v_bug5719 write;
select * from v_bug5719;
a
Allowed to use an underlying table under LOCK TABLES <view>
select * from t1;
a
Allowed to select from a temporary table under LOCK TABLES
select * from t2;
a
select * from t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES
drop table t1;
sic: left LOCK TABLES mode
select * from t3;
a
select * from v_bug5719;
ERROR HY000: View 'test.v_bug5719' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
unlock tables;
drop view v_bug5719;
When limitation to use temporary tables in views is removed, please
add a test that shows what happens under LOCK TABLES when a view
references a temporary table, is locked, and the underlying table
is dropped.
create view v_bug5719 as select * from t2;
ERROR HY000: View's SELECT refers to a temporary table 't2'
Cleanup.
drop table t2, t3;
End of 5.1 tests. End of 5.1 tests.
...@@ -95,3 +95,13 @@ alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 ...@@ -95,3 +95,13 @@ alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1
alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; // alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
unlock tables; unlock tables;
drop table t1; drop table t1;
create table t1 (i int);
lock table t1 read;
update t1 set i= 10;;
select * from t1;;
kill query ID;
i
ERROR 70100: Query execution was interrupted
unlock tables;
drop table t1;
End of 5.1 tests
...@@ -37,14 +37,14 @@ set session long_query_time=1; ...@@ -37,14 +37,14 @@ set session long_query_time=1;
select sleep(2); select sleep(2);
sleep(2) sleep(2)
0 0
select * from mysql.slow_log; select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
set global slow_query_log= ON; set global slow_query_log= ON;
set session long_query_time=1; set session long_query_time=1;
select sleep(2); select sleep(2);
sleep(2) sleep(2)
0 0
select * from mysql.slow_log; select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(2) TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(2)
show global variables show global variables
......
...@@ -1725,6 +1725,20 @@ drop table federated.t1; ...@@ -1725,6 +1725,20 @@ drop table federated.t1;
connection slave; connection slave;
drop table federated.t1; drop table federated.t1;
--echo
--echo Bug#18287 create federated table always times out, error 1159 ' '
--echo
--echo Test that self-references work
--echo
connection slave;
create table federated.t1 (a int primary key);
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.t2 (a int primary key)
ENGINE=FEDERATED
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
insert into federated.t1 (a) values (1);
select * from federated.t2;
drop table federated.t1, federated.t2;
# #
# BUG#29875 Disable support for transactions # BUG#29875 Disable support for transactions
......
...@@ -148,5 +148,70 @@ LOCK TABLES mysql.time_zone READ, mysql.proc WRITE; ...@@ -148,5 +148,70 @@ LOCK TABLES mysql.time_zone READ, mysql.proc WRITE;
DROP TABLE t1; DROP TABLE t1;
--echo
--echo Bug#5719 impossible to lock VIEW
--echo
--echo Just covering existing behaviour with tests.
--echo Consistency has not been found here.
--echo
--disable_warnings
drop view if exists v_bug5719;
drop table if exists t1, t2, t3;
--enable_warnings
create table t1 (a int);
create temporary table t2 (a int);
create table t3 (a int);
create view v_bug5719 as select 1;
lock table v_bug5719 write;
--error ER_TABLE_NOT_LOCKED
select * from t1;
--echo
--echo Allowed to select from a temporary talbe under LOCK TABLES
--echo
select * from t2;
--error ER_TABLE_NOT_LOCKED
select * from t3;
select * from v_bug5719;
drop view v_bug5719;
--echo
--echo sic: did not left LOCK TABLES mode automatically
--echo
--error ER_TABLE_NOT_LOCKED
select * from t1;
unlock tables;
create view v_bug5719 as select * from t1;
lock tables v_bug5719 write;
select * from v_bug5719;
--echo
--echo Allowed to use an underlying table under LOCK TABLES <view>
--echo
select * from t1;
--echo
--echo Allowed to select from a temporary table under LOCK TABLES
--echo
select * from t2;
--error ER_TABLE_NOT_LOCKED
select * from t3;
drop table t1;
--echo
--echo sic: left LOCK TABLES mode
--echo
select * from t3;
--error ER_VIEW_INVALID
select * from v_bug5719;
unlock tables;
drop view v_bug5719;
--echo
--echo When limitation to use temporary tables in views is removed, please
--echo add a test that shows what happens under LOCK TABLES when a view
--echo references a temporary table, is locked, and the underlying table
--echo is dropped.
--echo
--error ER_VIEW_SELECT_TMPTABLE
create view v_bug5719 as select * from t2;
--echo
--echo Cleanup.
--echo
drop table t2, t3;
--echo End of 5.1 tests. --echo End of 5.1 tests.
...@@ -270,3 +270,38 @@ drop table t1; ...@@ -270,3 +270,38 @@ drop table t1;
# End of 5.0 tests # End of 5.0 tests
#
# Bug #21281 "Pending write lock is incorrectly removed when its
# statement being KILLed"
#
create table t1 (i int);
connection locker;
lock table t1 read;
connection writer;
--send update t1 set i= 10;
connection reader;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Locked" and info = "update t1 set i= 10";
--source include/wait_condition.inc
--send select * from t1;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Locked" and info = "select * from t1";
--source include/wait_condition.inc
let $ID= `select id from information_schema.processlist where state = "Locked" and info = "update t1 set i= 10"`;
--replace_result $ID ID
eval kill query $ID;
connection reader;
--reap
connection writer;
--error ER_QUERY_INTERRUPTED
--reap
connection locker;
unlock tables;
connection default;
drop table t1;
--echo End of 5.1 tests
...@@ -28,7 +28,7 @@ connection con1; ...@@ -28,7 +28,7 @@ connection con1;
set session long_query_time=1; set session long_query_time=1;
select sleep(2); select sleep(2);
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
select * from mysql.slow_log; select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
connection default; connection default;
set global slow_query_log= ON; set global slow_query_log= ON;
...@@ -36,7 +36,7 @@ connection con1; ...@@ -36,7 +36,7 @@ connection con1;
set session long_query_time=1; set session long_query_time=1;
select sleep(2); select sleep(2);
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
select * from mysql.slow_log; select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
connection default; connection default;
show global variables show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
......
...@@ -384,6 +384,9 @@ static inline my_bool have_specific_lock(THR_LOCK_DATA *data, ...@@ -384,6 +384,9 @@ static inline my_bool have_specific_lock(THR_LOCK_DATA *data,
} }
static void wake_up_waiters(THR_LOCK *lock);
static enum enum_thr_lock_result static enum enum_thr_lock_result
wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
my_bool in_wait_list) my_bool in_wait_list)
...@@ -445,8 +448,13 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, ...@@ -445,8 +448,13 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
else else
wait->last=data->prev; wait->last=data->prev;
data->type= TL_UNLOCK; /* No lock */ data->type= TL_UNLOCK; /* No lock */
check_locks(data->lock, "killed or timed out wait_for_lock", 1);
wake_up_waiters(data->lock);
}
else
{
check_locks(data->lock, "aborted wait_for_lock", 0);
} }
check_locks(data->lock,"failed wait_for_lock",0);
} }
else else
{ {
...@@ -776,6 +784,26 @@ void thr_unlock(THR_LOCK_DATA *data) ...@@ -776,6 +784,26 @@ void thr_unlock(THR_LOCK_DATA *data)
lock->read_no_write_count--; lock->read_no_write_count--;
data->type=TL_UNLOCK; /* Mark unlocked */ data->type=TL_UNLOCK; /* Mark unlocked */
check_locks(lock,"after releasing lock",1); check_locks(lock,"after releasing lock",1);
wake_up_waiters(lock);
pthread_mutex_unlock(&lock->mutex);
DBUG_VOID_RETURN;
}
/**
@brief Wake up all threads which pending requests for the lock
can be satisfied.
@param lock Lock for which threads should be woken up
*/
static void wake_up_waiters(THR_LOCK *lock)
{
THR_LOCK_DATA *data;
enum thr_lock_type lock_type;
DBUG_ENTER("wake_up_waiters");
if (!lock->write.data) /* If no active write locks */ if (!lock->write.data) /* If no active write locks */
{ {
...@@ -827,11 +855,7 @@ void thr_unlock(THR_LOCK_DATA *data) ...@@ -827,11 +855,7 @@ void thr_unlock(THR_LOCK_DATA *data)
data=lock->write_wait.data; /* Free this too */ data=lock->write_wait.data; /* Free this too */
} }
if (data->type >= TL_WRITE_LOW_PRIORITY) if (data->type >= TL_WRITE_LOW_PRIORITY)
{ goto end;
check_locks(lock,"giving write lock",0);
pthread_mutex_unlock(&lock->mutex);
DBUG_VOID_RETURN;
}
/* Release possible read locks together with the write lock */ /* Release possible read locks together with the write lock */
} }
if (lock->read_wait.data) if (lock->read_wait.data)
...@@ -886,8 +910,7 @@ void thr_unlock(THR_LOCK_DATA *data) ...@@ -886,8 +910,7 @@ void thr_unlock(THR_LOCK_DATA *data)
free_all_read_locks(lock,0); free_all_read_locks(lock,0);
} }
end: end:
check_locks(lock,"thr_unlock",0); check_locks(lock, "after waking up waiters", 0);
pthread_mutex_unlock(&lock->mutex);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -1101,6 +1124,7 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread_id) ...@@ -1101,6 +1124,7 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread_id)
lock->write_wait.last= data->prev; lock->write_wait.last= data->prev;
} }
} }
wake_up_waiters(lock);
pthread_mutex_unlock(&lock->mutex); pthread_mutex_unlock(&lock->mutex);
DBUG_RETURN(found); DBUG_RETURN(found);
} }
......
...@@ -1705,7 +1705,7 @@ void Item_ident_for_show::make_field(Send_field *tmp_field) ...@@ -1705,7 +1705,7 @@ void Item_ident_for_show::make_field(Send_field *tmp_field)
tmp_field->type=field->type(); tmp_field->type=field->type();
tmp_field->flags= field->table->maybe_null ? tmp_field->flags= field->table->maybe_null ?
(field->flags & ~NOT_NULL_FLAG) : field->flags; (field->flags & ~NOT_NULL_FLAG) : field->flags;
tmp_field->decimals= 0; tmp_field->decimals= field->decimals();
} }
/**********************************************/ /**********************************************/
......
...@@ -2484,6 +2484,7 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table) ...@@ -2484,6 +2484,7 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
create_info->row_type= share->row_type; create_info->row_type= share->row_type;
create_info->default_table_charset= share->table_charset; create_info->default_table_charset= share->table_charset;
create_info->table_charset= 0; create_info->table_charset= 0;
create_info->comment= share->comment;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -16077,7 +16077,6 @@ static void test_bug24179() ...@@ -16077,7 +16077,6 @@ static void test_bug24179()
/* /*
Bug#28075 "COM_DEBUG crashes mysqld" Bug#28075 "COM_DEBUG crashes mysqld"
Note: Test disabled because of failure in PushBuild.
*/ */
static void test_bug28075() static void test_bug28075()
...@@ -16106,7 +16105,7 @@ static void test_bug27876() ...@@ -16106,7 +16105,7 @@ static void test_bug27876()
int rc; int rc;
MYSQL_RES *result; MYSQL_RES *result;
char utf8_func[] = unsigned char utf8_func[] =
{ {
0xd1, 0x84, 0xd1, 0x83, 0xd0, 0xbd, 0xd0, 0xba, 0xd1, 0x84, 0xd1, 0x83, 0xd0, 0xbd, 0xd0, 0xba,
0xd1, 0x86, 0xd0, 0xb8, 0xd0, 0xb9, 0xd0, 0xba, 0xd1, 0x86, 0xd0, 0xb8, 0xd0, 0xb9, 0xd0, 0xba,
...@@ -16114,7 +16113,7 @@ static void test_bug27876() ...@@ -16114,7 +16113,7 @@ static void test_bug27876()
0x00 0x00
}; };
char utf8_param[] = unsigned char utf8_param[] =
{ {
0xd0, 0xbf, 0xd0, 0xb0, 0xd1, 0x80, 0xd0, 0xb0, 0xd0, 0xbf, 0xd0, 0xb0, 0xd1, 0x80, 0xd0, 0xb0,
0xd0, 0xbc, 0xd0, 0xb5, 0xd1, 0x82, 0xd1, 0x8a, 0xd0, 0xbc, 0xd0, 0xb5, 0xd1, 0x82, 0xd1, 0x8a,
...@@ -16334,7 +16333,54 @@ static void test_bug29692() ...@@ -16334,7 +16333,54 @@ static void test_bug29692()
mysql_close(conn); mysql_close(conn);
} }
/**
Bug#29306 Truncated data in MS Access with decimal (3,1) columns in a VIEW
*/
static void test_bug29306()
{
MYSQL_FIELD *field;
int rc;
MYSQL_RES *res;
DBUG_ENTER("test_bug29306");
myheader("test_bug29306");
rc= mysql_query(mysql, "DROP TABLE IF EXISTS tab17557");
myquery(rc);
rc= mysql_query(mysql, "DROP VIEW IF EXISTS view17557");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE tab17557 (dd decimal (3,1))");
myquery(rc);
rc= mysql_query(mysql, "CREATE VIEW view17557 as SELECT dd FROM tab17557");
myquery(rc);
rc= mysql_query(mysql, "INSERT INTO tab17557 VALUES (7.6)");
myquery(rc);
/* Checking the view */
res= mysql_list_fields(mysql, "view17557", NULL);
while ((field= mysql_fetch_field(res)))
{
if (! opt_silent)
{
printf("field name %s\n", field->name);
printf("field table %s\n", field->table);
printf("field decimals %d\n", field->decimals);
if (field->decimals < 1)
printf("Error! No decimals! \n");
printf("\n\n");
}
DIE_UNLESS(field->decimals == 1);
}
mysql_free_result(res);
rc= mysql_query(mysql, "DROP TABLE tab17557");
myquery(rc);
rc= mysql_query(mysql, "DROP VIEW view17557");
myquery(rc);
DBUG_VOID_RETURN;
}
/* /*
Read and parse arguments and MySQL options from my.cnf Read and parse arguments and MySQL options from my.cnf
*/ */
...@@ -16626,6 +16672,7 @@ static struct my_tests_st my_tests[]= { ...@@ -16626,6 +16672,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug27592", test_bug27592 }, { "test_bug27592", test_bug27592 },
{ "test_bug29687", test_bug29687 }, { "test_bug29687", test_bug29687 },
{ "test_bug29692", test_bug29692 }, { "test_bug29692", test_bug29692 },
{ "test_bug29306", test_bug29306 },
{ 0, 0 } { 0, 0 }
}; };
......
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