[Commits] ae98cf0: Issue #33: SELECT ... FROM rocksdb_table ORDER BY primary_key uses sorting

Sergei Petrunia psergey at askmonty.org
Tue Feb 24 19:06:53 EET 2015


revision-id: ae98cf040e9730342f27892da06d3b273b6c1369
parent(s): 43c740d78ca08b4be04cb5770dc44f9314793da6
committer: Sergei Petrunia
branch nick: mysql-5.6-rocksdb-issue33
timestamp: 2015-02-24 20:06:52 +0300
message:

Issue #33: SELECT ... FROM rocksdb_table ORDER BY primary_key uses sorting

Summary:
Fix the index properties returned by the storage engine:
- ha_rocksdb::primary_key_is_clustered()= true;
- ha_rocksdb::keys_to_use_for_scanning()= &key_map_full;

Test Plan: mtr

Reviewers: maykov, jonahcohen, hermanlee4, yoshinorim

Reviewed By: yoshinorim

Subscribers: jtolmer

Differential Revision: https://reviews.facebook.net/D33957

---
 mysql-test/r/rocksdb.result  |   11 +++++++++++
 mysql-test/t/rocksdb.test    |   11 +++++++++++
 storage/rocksdb/ha_rocksdb.h |    9 +++++++++
 3 files changed, 31 insertions(+)

diff --git a/mysql-test/r/rocksdb.result b/mysql-test/r/rocksdb.result
index 5e9402e..710f403 100644
--- a/mysql-test/r/rocksdb.result
+++ b/mysql-test/r/rocksdb.result
@@ -860,6 +860,7 @@ rocksdb_max_row_locks	1073741824
 rocksdb_max_total_wal_size	0
 rocksdb_no_block_cache	OFF
 rocksdb_paranoid_checks	ON
+rocksdb_perf_context_level	1
 rocksdb_rate_limiter_bytes_per_sec	0
 rocksdb_skip_log_error_on_recovery	OFF
 rocksdb_stats_dump_period_sec	3600
@@ -1666,3 +1667,13 @@ select (@var2 - @var1) < 12;
 (@var2 - @var1) < 12
 1
 drop table t0,t1;
+#
+# Issue #33: SELECT ... FROM rocksdb_table ORDER BY primary_key uses sorting
+#
+create table t1 (id int primary key, value int) engine=rocksdb;
+insert into t1 values (1,1),(2,2),(3,3);
+# The following must not use 'Using filesort':
+explain select * from t1 ORDER BY id;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	1000	Using filesort
+drop table t1;
diff --git a/mysql-test/t/rocksdb.test b/mysql-test/t/rocksdb.test
index 9ebe2ed..a078025 100644
--- a/mysql-test/t/rocksdb.test
+++ b/mysql-test/t/rocksdb.test
@@ -1317,3 +1317,14 @@ set @var2=(select variable_value
 select (@var2 - @var1) < 12;
 
 drop table t0,t1;
+
+--echo #
+--echo # Issue #33: SELECT ... FROM rocksdb_table ORDER BY primary_key uses sorting
+--echo #
+create table t1 (id int primary key, value int) engine=rocksdb;
+insert into t1 values (1,1),(2,2),(3,3);
+--echo # The following must not use 'Using filesort':
+explain select * from t1 ORDER BY id;
+
+drop table t1;
+
diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h
index 85929c4..6edf4d2 100644
--- a/storage/rocksdb/ha_rocksdb.h
+++ b/storage/rocksdb/ha_rocksdb.h
@@ -289,6 +289,15 @@ public:
   */
   ulong index_flags(uint inx, uint part, bool all_parts) const;
 
+  const key_map * keys_to_use_for_scanning()
+  {
+    return &key_map_full;
+  }
+  bool primary_key_is_clustered()
+  {
+    return true;
+  }
+
   int rename_table(const char *from, const char *to);
 
   int convert_record_from_storage_format(rocksdb::Slice *slice, uchar *buf);


More information about the commits mailing list