Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Fix Issue #3: SHOW TABLE STATUS shows Auto_increment=0
Browse files Browse the repository at this point in the history
  • Loading branch information
spetrunia authored and Herman Lee committed Aug 27, 2015
1 parent 16670bd commit 3a6af9f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
25 changes: 25 additions & 0 deletions mysql-test/r/rocksdb.result
Original file line number Diff line number Diff line change
Expand Up @@ -1214,3 +1214,28 @@ i
2
3
drop table t1;
#
# Fix Issue #3: SHOW TABLE STATUS shows Auto_increment=0
#
create table t1 (i int primary key auto_increment) engine=RocksDB;
insert into t1 values (null),(null);
show table status like 't1';;
Name t1
Engine ROCKSDB
Version 10
Row_format Fixed
Rows 1000
Avg_row_length 0
Data_length 0
Max_data_length 0
Index_length 0
Data_free 0
Auto_increment 3
Create_time NULL
Update_time NULL
Check_time NULL
Collation latin1_swedish_ci
Checksum NULL
Create_options
Comment
drop table t1;
9 changes: 9 additions & 0 deletions mysql-test/t/rocksdb.test
Original file line number Diff line number Diff line change
Expand Up @@ -1092,3 +1092,12 @@ select * from t1;

drop table t1;

--echo #
--echo # Fix Issue #3: SHOW TABLE STATUS shows Auto_increment=0
--echo #
create table t1 (i int primary key auto_increment) engine=RocksDB;

insert into t1 values (null),(null);
--query_vertical show table status like 't1';
drop table t1;

8 changes: 5 additions & 3 deletions storage/rocksdb/ha_rocksdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,11 @@ int ha_rocksdb::info(uint flag)
dup_ref= pk_tuple; //TODO: this should store packed PK.
}

if (flag & HA_STATUS_AUTO)
{
stats.auto_increment_value= tbl_def->auto_incr_val;
}

DBUG_RETURN(0);
}

Expand Down Expand Up @@ -2431,9 +2436,6 @@ void ha_rocksdb::update_create_info(HA_CREATE_INFO *create_info)
{
if (!(create_info->used_fields & HA_CREATE_USED_AUTO))
{
table->file->info(HA_STATUS_AUTO);
// TODO: the following is basic, we need to actually
// store the specified value somewhere..
create_info->auto_increment_value= tbl_def->auto_incr_val;
}
}
Expand Down

0 comments on commit 3a6af9f

Please sign in to comment.