[Commits] 0299357: Fix Issue #1: AUTO_INCREMENT value doesn't survive server shutdown

Sergei Petrunia psergey at askmonty.org
Tue Jul 15 16:37:13 EEST 2014


revision-id: 02993579a07a7143a5eaad334216f0c0d616eb1b
parent(s): 8a57b6a084e211f4050d05935c937f5cf6424d64
committer: Sergei Petrunia
branch nick: webscalesql-5.6
timestamp: 2014-07-15 17:37:13 +0400
message:

Fix Issue #1: AUTO_INCREMENT value doesn't survive server shutdown

Use ha_rocksdb::open() should check table->found_next_number_field,
not table->next_number_field (like InnoDB does)

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

 mysql-test/r/rocksdb.result   |   13 +++++++++++++
 mysql-test/t/rocksdb.test     |   14 ++++++++++++++
 storage/rocksdb/ha_rocksdb.cc |    2 +-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/mysql-test/r/rocksdb.result b/mysql-test/r/rocksdb.result
index ab663d6..6286bb0 100644
--- a/mysql-test/r/rocksdb.result
+++ b/mysql-test/r/rocksdb.result
@@ -1201,3 +1201,16 @@ i
 2
 3
 drop table t2;
+# 
+# Fix Issue#2: AUTO_INCREMENT value doesn't survive server shutdown
+# 
+create table t1 (i int primary key auto_increment) engine=RocksDB;
+insert into t1 values (null);
+insert into t1 values (null);
+insert into t1 values (null);
+select * from t1;
+i
+1
+2
+3
+drop table t1;
diff --git a/mysql-test/t/rocksdb.test b/mysql-test/t/rocksdb.test
index 26745fa..381795c 100644
--- a/mysql-test/t/rocksdb.test
+++ b/mysql-test/t/rocksdb.test
@@ -1078,3 +1078,17 @@ insert into t2 values (null);
 select * from t2;
 drop table t2;
 
+--echo # 
+--echo # Fix Issue#2: AUTO_INCREMENT value doesn't survive server shutdown
+--echo # 
+create table t1 (i int primary key auto_increment) engine=RocksDB;
+
+insert into t1 values (null);
+insert into t1 values (null);
+--source include/restart_mysqld.inc
+
+insert into t1 values (null);
+select * from t1;
+
+drop table t1;
+
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index bec6d98..b47be0c 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -855,7 +855,7 @@ int ha_rocksdb::open(const char *name, int mode, uint test_if_locked)
   info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
   
   /* TODO: move the following to where TABLE_SHARE is opened: */
-  if (table->next_number_field)
+  if (table->found_next_number_field)
     load_auto_incr_value();
 
   DBUG_RETURN(0);


More information about the commits mailing list