[Commits] 6f95268: Issue #14: post-review fixes: spelling, better comments and variable names

Sergei Petrunia psergey at askmonty.org
Fri Feb 20 18:42:17 EET 2015


revision-id: 6f952680026f72b9da52ed7afdd5f0054825a227
parent(s): 03ffc238b6b4b9f647f98da4c3cd21c24d9dea50
committer: Sergei Petrunia
branch nick: mysql-5.6-rocksdb-issue14-try2
timestamp: 2015-02-20 19:42:16 +0300
message:

Issue #14: post-review fixes: spelling, better comments and variable names

Test Plan: N/A

Reviewers: jonahcohen, maykov, hermanlee4, yoshinorim

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

---
 storage/rocksdb/ha_rocksdb.cc |   15 ++++++++++-----
 storage/rocksdb/ha_rocksdb.h  |    9 +++++++--
 storage/rocksdb/rdb_datadic.h |    8 ++++++++
 3 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 20594e4..7b31f06 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -1558,8 +1558,8 @@ void ha_rocksdb::convert_record_to_storage_format(rocksdb::Slice *packed_rec)
   
   for (uint i=0; i < table->s->fields; i++)
   {
-    /* Don't pack decode-able PK key parts */
-    if (field_enc[i].skip)
+    /* Don't pack decodable PK key parts */
+    if (field_enc[i].dont_store)
       continue;
 
     Field *field= table->field[i];
@@ -1664,7 +1664,7 @@ int ha_rocksdb::convert_record_from_storage_format(uchar * buf)
   
   for (uint i=0; i < table->s->fields; i++)
   {
-    if (field_enc[i].skip)
+    if (field_enc[i].dont_store)
       continue;
 
     Field *field= table->field[i];
@@ -1764,6 +1764,10 @@ int ha_rocksdb::convert_record_from_storage_format(uchar * buf)
 
 /*
   Setup data needed to convert table->record[] to and from record storage format.
+
+  @seealso 
+     ha_rocksdb::convert_record_to_storage_format,
+     ha_rocksdb::convert_record_from_storage_format
 */
 
 void ha_rocksdb::setup_field_converters()
@@ -1778,7 +1782,7 @@ void ha_rocksdb::setup_field_converters()
   for (i= 0; i < table->s->fields; i++)
   {
     Field *field= table->field[i];
-    field_enc[i].skip= false;
+    field_enc[i].dont_store= false;
 
     /*
       Check if this field is 
@@ -1792,10 +1796,11 @@ void ha_rocksdb::setup_field_converters()
       KEY *pk_info= &table->key_info[table->s->primary_key];
       for (uint kp= 0; kp < pk_info->user_defined_key_parts; kp++)
       {
+        /* key_part->fieldnr is counted from 1 */
         if (field->field_index + 1 == pk_info->key_part[kp].fieldnr)
         {
           if (pk_descr->can_unpack(kp))
-            field_enc[i].skip= true; /* Don't store */
+            field_enc[i].dont_store= true;
           break;
         }
       }
diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h
index c9f29e6..fa6489a 100644
--- a/storage/rocksdb/ha_rocksdb.h
+++ b/storage/rocksdb/ha_rocksdb.h
@@ -192,8 +192,13 @@ class ha_rocksdb: public handler
   */
   typedef struct st_field_encoder
   {
-    /* skip=true means this is decodeable part of PK and so not stored */
-    bool skip;
+    /* 
+      This is set to true for columns of Primary Key that can be decoded from
+      their mem-comparable form.
+      Since we can get them from the key part of RocksDB key->value pair, we
+      don't need to store them in the value part.
+    */
+    bool dont_store;
 
     uint null_offset;
     uchar null_mask;  // 0 means the field cannot be null
diff --git a/storage/rocksdb/rdb_datadic.h b/storage/rocksdb/rdb_datadic.h
index f8a780e..ff00b3a 100644
--- a/storage/rocksdb/rdb_datadic.h
+++ b/storage/rocksdb/rdb_datadic.h
@@ -49,7 +49,15 @@ public:
     if (len)
       ptr= &str.at(0);
     else
+    {
+      /* 
+        One can a create a Stream_reader for reading from an empty string
+        (although attempts to read anything will fail).
+        We must not access str.at(0), since len==0, we can set ptr to any
+        value.
+      */
       ptr= NULL;
+    }
   }
 
   Stream_reader(const rocksdb::Slice *slice)


More information about the commits mailing list