Commit b67b9126 authored by Ashish Agarwal's avatar Ashish Agarwal

Bug#11759349 -- Merge of patch from mysql-5.1.

parents 136802d7 3ef684e8
...@@ -51,6 +51,7 @@ typedef struct st_heapinfo /* Struct from heap_info */ ...@@ -51,6 +51,7 @@ typedef struct st_heapinfo /* Struct from heap_info */
uint reclength; /* Length of one record */ uint reclength; /* Length of one record */
int errkey; int errkey;
ulonglong auto_increment; ulonglong auto_increment;
time_t create_time;
} HEAPINFO; } HEAPINFO;
...@@ -147,6 +148,7 @@ typedef struct st_heap_share ...@@ -147,6 +148,7 @@ typedef struct st_heap_share
uint open_count; uint open_count;
uchar *del_link; /* Link to next block with del. rec */ uchar *del_link; /* Link to next block with del. rec */
char * name; /* Name of "memory-file" */ char * name; /* Name of "memory-file" */
time_t create_time;
THR_LOCK lock; THR_LOCK lock;
mysql_mutex_t intern_lock; /* Locking for use with _locking */ mysql_mutex_t intern_lock; /* Locking for use with _locking */
my_bool delete_on_close; my_bool delete_on_close;
......
...@@ -715,8 +715,8 @@ create table t1 (c char(10)) engine=memory; ...@@ -715,8 +715,8 @@ create table t1 (c char(10)) engine=memory;
create table t2 (c varchar(10)) engine=memory; create table t2 (c varchar(10)) engine=memory;
show table status like 't_'; show table status like 't_';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 0 11 0 # 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 MEMORY 10 Fixed 0 11 0 # 0 0 NULL # NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 0 12 0 # 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 MEMORY 10 Fixed 0 12 0 # 0 0 NULL # NULL NULL latin1_swedish_ci NULL
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256), CREATE TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY; KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY;
......
...@@ -460,57 +460,57 @@ insert into t2 values (1),(2); ...@@ -460,57 +460,57 @@ insert into t2 values (1),(2);
insert into t3 values (1,1),(2,2); insert into t3 values (1,1),(2,2);
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 MEMORY 10 Fixed 2 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 MEMORY 10 Fixed 2 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
t3 MEMORY 10 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t3 MEMORY 10 Fixed 2 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
insert into t1 values (3),(4); insert into t1 values (3),(4);
insert into t2 values (3),(4); insert into t2 values (3),(4);
insert into t3 values (3,3),(4,4); insert into t3 values (3,3),(4,4);
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 MEMORY 10 Fixed 4 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 MEMORY 10 Fixed 4 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
t3 MEMORY 10 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t3 MEMORY 10 Fixed 4 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
insert into t1 values (5); insert into t1 values (5);
insert into t2 values (5); insert into t2 values (5);
insert into t3 values (5,5); insert into t3 values (5,5);
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 MEMORY 10 Fixed 5 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 MEMORY 10 Fixed 5 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
t3 MEMORY 10 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t3 MEMORY 10 Fixed 5 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
delete from t1 where a=3; delete from t1 where a=3;
delete from t2 where b=3; delete from t2 where b=3;
delete from t3 where a=3; delete from t3 where a=3;
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL t1 MEMORY 10 Fixed 4 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL t2 MEMORY 10 Fixed 4 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
t3 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL t3 MEMORY 10 Fixed 4 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
truncate table t1; truncate table t1;
truncate table t2; truncate table t2;
truncate table t3; truncate table t3;
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
t3 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t3 MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
insert into t1 values (5); insert into t1 values (5);
insert into t2 values (5); insert into t2 values (5);
insert into t3 values (5,5); insert into t3 values (5,5);
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 MEMORY 10 Fixed 1 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 MEMORY 10 Fixed 1 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
t3 MEMORY 10 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL t3 MEMORY 10 Fixed 1 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
delete from t1 where a=5; delete from t1 where a=5;
delete from t2 where b=5; delete from t2 where b=5;
delete from t3 where a=5; delete from t3 where a=5;
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL t1 MEMORY 10 Fixed 0 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL t2 MEMORY 10 Fixed 0 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
t3 MEMORY 10 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL t3 MEMORY 10 Fixed 0 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
drop table t1, t2, t3; drop table t1, t2, t3;
create database mysqltest; create database mysqltest;
show create database mysqltest; show create database mysqltest;
...@@ -662,7 +662,7 @@ DROP TABLE t1; ...@@ -662,7 +662,7 @@ DROP TABLE t1;
flush tables; flush tables;
SHOW TABLE STATUS like 't1'; SHOW TABLE STATUS like 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 NULL NULL NULL NULL # # # # NULL NULL NULL NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm' t1 NULL NULL NULL NULL # # # # NULL NULL # NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm'
Warnings: Warnings:
Warning 1033 Incorrect information in file: './test/t1.frm' Warning 1033 Incorrect information in file: './test/t1.frm'
show create table t1; show create table t1;
...@@ -1334,7 +1334,7 @@ CREATE DATABASE ` ...@@ -1334,7 +1334,7 @@ CREATE DATABASE `
CREATE TABLE ``.`` (a int) ENGINE=Memory; CREATE TABLE ``.`` (a int) ENGINE=Memory;
SHOW TABLE STATUS FROM `` LIKE ''; SHOW TABLE STATUS FROM `` LIKE '';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
DROP DATABASE ``; DROP DATABASE ``;
show columns from `#mysql50#????????`; show columns from `#mysql50#????????`;
Got one of the listed errors Got one of the listed errors
......
...@@ -454,7 +454,7 @@ drop table t1; ...@@ -454,7 +454,7 @@ drop table t1;
# #
create table t1 (c char(10)) engine=memory; create table t1 (c char(10)) engine=memory;
create table t2 (c varchar(10)) engine=memory; create table t2 (c varchar(10)) engine=memory;
--replace_column 8 # --replace_column 8 # 12 #
show table status like 't_'; show table status like 't_';
drop table t1, t2; drop table t1, t2;
......
...@@ -295,37 +295,37 @@ CREATE TABLE t3 ( ...@@ -295,37 +295,37 @@ CREATE TABLE t3 (
insert into t1 values (1),(2); insert into t1 values (1),(2);
insert into t2 values (1),(2); insert into t2 values (1),(2);
insert into t3 values (1,1),(2,2); insert into t3 values (1,1),(2,2);
--replace_column 6 # 7 # 8 # 9 # --replace_column 6 # 7 # 8 # 9 # 12 #
show table status; show table status;
insert into t1 values (3),(4); insert into t1 values (3),(4);
insert into t2 values (3),(4); insert into t2 values (3),(4);
insert into t3 values (3,3),(4,4); insert into t3 values (3,3),(4,4);
--replace_column 6 # 7 # 8 # 9 # --replace_column 6 # 7 # 8 # 9 # 12 #
show table status; show table status;
insert into t1 values (5); insert into t1 values (5);
insert into t2 values (5); insert into t2 values (5);
insert into t3 values (5,5); insert into t3 values (5,5);
--replace_column 6 # 7 # 8 # 9 # --replace_column 6 # 7 # 8 # 9 # 12 #
show table status; show table status;
delete from t1 where a=3; delete from t1 where a=3;
delete from t2 where b=3; delete from t2 where b=3;
delete from t3 where a=3; delete from t3 where a=3;
--replace_column 6 # 7 # 8 # 9 # 10 # --replace_column 6 # 7 # 8 # 9 # 10 # 12 #
show table status; show table status;
truncate table t1; truncate table t1;
truncate table t2; truncate table t2;
truncate table t3; truncate table t3;
--replace_column 6 # 7 # 8 # 9 # --replace_column 6 # 7 # 8 # 9 # 12 #
show table status; show table status;
insert into t1 values (5); insert into t1 values (5);
insert into t2 values (5); insert into t2 values (5);
insert into t3 values (5,5); insert into t3 values (5,5);
--replace_column 6 # 7 # 8 # 9 # --replace_column 6 # 7 # 8 # 9 # 12 #
show table status; show table status;
delete from t1 where a=5; delete from t1 where a=5;
delete from t2 where b=5; delete from t2 where b=5;
delete from t3 where a=5; delete from t3 where a=5;
--replace_column 6 # 7 # 8 # 9 # 10 # --replace_column 6 # 7 # 8 # 9 # 10 # 12 #
show table status; show table status;
drop table t1, t2, t3; drop table t1, t2, t3;
...@@ -443,7 +443,7 @@ flush tables; ...@@ -443,7 +443,7 @@ flush tables;
# Create a junk frm file on disk # Create a junk frm file on disk
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ; system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ;
--replace_column 6 # 7 # 8 # 9 # --replace_column 6 # 7 # 8 # 9 # 12 #
SHOW TABLE STATUS like 't1'; SHOW TABLE STATUS like 't1';
--error ER_NOT_FORM_FILE --error ER_NOT_FORM_FILE
show create table t1; show create table t1;
...@@ -1073,7 +1073,7 @@ set names latin1; ...@@ -1073,7 +1073,7 @@ set names latin1;
SET NAMES latin1; SET NAMES latin1;
CREATE DATABASE ``; CREATE DATABASE ``;
CREATE TABLE ``.`` (a int) ENGINE=Memory; CREATE TABLE ``.`` (a int) ENGINE=Memory;
--replace_column 6 # 7 # 8 # 9 # --replace_column 6 # 7 # 8 # 9 # 12 #
SHOW TABLE STATUS FROM `` LIKE ''; SHOW TABLE STATUS FROM `` LIKE '';
DROP DATABASE ``; DROP DATABASE ``;
......
...@@ -416,6 +416,7 @@ int ha_heap::info(uint flag) ...@@ -416,6 +416,7 @@ int ha_heap::info(uint flag)
stats.index_file_length= hp_info.index_length; stats.index_file_length= hp_info.index_length;
stats.max_data_file_length= hp_info.max_records * hp_info.reclength; stats.max_data_file_length= hp_info.max_records * hp_info.reclength;
stats.delete_length= hp_info.deleted * hp_info.reclength; stats.delete_length= hp_info.deleted * hp_info.reclength;
stats.create_time= (ulong) hp_info.create_time;
if (flag & HA_STATUS_AUTO) if (flag & HA_STATUS_AUTO)
stats.auto_increment_value= hp_info.auto_increment; stats.auto_increment_value= hp_info.auto_increment;
/* /*
......
...@@ -186,6 +186,7 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, ...@@ -186,6 +186,7 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
share->auto_key= create_info->auto_key; share->auto_key= create_info->auto_key;
share->auto_key_type= create_info->auto_key_type; share->auto_key_type= create_info->auto_key_type;
share->auto_increment= create_info->auto_increment; share->auto_increment= create_info->auto_increment;
share->create_time= (long) time((time_t*) 0);
/* Must be allocated separately for rename to work */ /* Must be allocated separately for rename to work */
if (!(share->name= my_strdup(name,MYF(0)))) if (!(share->name= my_strdup(name,MYF(0))))
{ {
......
...@@ -53,6 +53,7 @@ int heap_info(reg1 HP_INFO *info,reg2 HEAPINFO *x, int flag ) ...@@ -53,6 +53,7 @@ int heap_info(reg1 HP_INFO *info,reg2 HEAPINFO *x, int flag )
x->index_length = info->s->index_length; x->index_length = info->s->index_length;
x->max_records = info->s->max_records; x->max_records = info->s->max_records;
x->errkey = info->errkey; x->errkey = info->errkey;
x->create_time = info->s->create_time;
if (flag & HA_STATUS_AUTO) if (flag & HA_STATUS_AUTO)
x->auto_increment= info->s->auto_increment + 1; x->auto_increment= info->s->auto_increment + 1;
DBUG_RETURN(0); DBUG_RETURN(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