mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 12:01:42 +01:00
Merge narttu:/my/mysql-4.1 into mysql.com:/my/mysql-4.1
This commit is contained in:
commit
365fa6aec5
3 changed files with 79 additions and 0 deletions
|
@ -3870,6 +3870,14 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update)
|
||||||
if (!share->state.create_time)
|
if (!share->state.create_time)
|
||||||
share->state.create_time=share->state.check_time;
|
share->state.create_time=share->state.check_time;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
When tables are locked we haven't synched the share state and the
|
||||||
|
real state for a while so we better do it here before synching
|
||||||
|
the share state to disk. Only when table is write locked is it
|
||||||
|
necessary to perform this synch.
|
||||||
|
*/
|
||||||
|
if (info->lock_type == F_WRLCK)
|
||||||
|
share->state.state= *info->state;
|
||||||
if (mi_state_info_write(share->kfile,&share->state,1+2))
|
if (mi_state_info_write(share->kfile,&share->state,1+2))
|
||||||
goto err;
|
goto err;
|
||||||
share->changed=0;
|
share->changed=0;
|
||||||
|
|
32
mysql-test/r/analyze.result
Normal file
32
mysql-test/r/analyze.result
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
create table t1 (a bigint);
|
||||||
|
lock tables t1 write;
|
||||||
|
insert into t1 values(0);
|
||||||
|
analyze table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status OK
|
||||||
|
unlock tables;
|
||||||
|
check table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a bigint);
|
||||||
|
insert into t1 values(0);
|
||||||
|
lock tables t1 write;
|
||||||
|
delete from t1;
|
||||||
|
analyze table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status OK
|
||||||
|
unlock tables;
|
||||||
|
check table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a bigint);
|
||||||
|
insert into t1 values(0);
|
||||||
|
analyze table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status OK
|
||||||
|
check table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
drop table t1;
|
39
mysql-test/t/analyze.test
Normal file
39
mysql-test/t/analyze.test
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#
|
||||||
|
# Bug #10901 Analyze Table on new table destroys table
|
||||||
|
# This is minimal test case to get error
|
||||||
|
# The problem was that analyze table wrote the shared state to the file and this
|
||||||
|
# didn't include the inserts while locked. A check was needed to ensure that
|
||||||
|
# state information was not updated when executing analyze table for a locked table.
|
||||||
|
# The analyze table had to be within locks and check table had to be after unlocking
|
||||||
|
# since then it brings the wrong state from disk rather than from the currently
|
||||||
|
# correct internal state. The insert is needed since it changes the file state,
|
||||||
|
# number of records.
|
||||||
|
# The fix is to synchronise the state of the shared state and the current state before
|
||||||
|
# calling mi_state_info_write
|
||||||
|
#
|
||||||
|
create table t1 (a bigint);
|
||||||
|
lock tables t1 write;
|
||||||
|
insert into t1 values(0);
|
||||||
|
analyze table t1;
|
||||||
|
unlock tables;
|
||||||
|
check table t1;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
create table t1 (a bigint);
|
||||||
|
insert into t1 values(0);
|
||||||
|
lock tables t1 write;
|
||||||
|
delete from t1;
|
||||||
|
analyze table t1;
|
||||||
|
unlock tables;
|
||||||
|
check table t1;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
create table t1 (a bigint);
|
||||||
|
insert into t1 values(0);
|
||||||
|
analyze table t1;
|
||||||
|
check table t1;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue