[Commits] bb41f81: Fix Issue #3: SHOW TABLE STATUS shows Auto_increment=0

Sergei Petrunia psergey at askmonty.org
Tue Jul 15 21:28:22 EEST 2014


revision-id: bb41f81f7375acb942d18f3816f867da402c0f6a
parent(s): 02993579a07a7143a5eaad334216f0c0d616eb1b
committer: Sergei Petrunia
branch nick: webscalesql-5.6
timestamp: 2014-07-15 22:28:22 +0400
message:

Fix Issue #3: SHOW TABLE STATUS shows Auto_increment=0

-----------------------

 mysql-test/r/rocksdb.result   |   25 +++++++++++++++++++++++++
 mysql-test/t/rocksdb.test     |    9 +++++++++
 storage/rocksdb/ha_rocksdb.cc |    8 +++++---
 3 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/mysql-test/r/rocksdb.result b/mysql-test/r/rocksdb.result
index 6286bb0..1a82860 100644
--- a/mysql-test/r/rocksdb.result
+++ b/mysql-test/r/rocksdb.result
@@ -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;
diff --git a/mysql-test/t/rocksdb.test b/mysql-test/t/rocksdb.test
index 381795c..808c47c 100644
--- a/mysql-test/t/rocksdb.test
+++ b/mysql-test/t/rocksdb.test
@@ -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;
+
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index b47be0c..5654ebb 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -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);
 }
 
@@ -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;
   }
 }


More information about the commits mailing list