diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index e34b25ffda03c1a9268d73d1a289262b53c260d7..3fd4b9ce094dc5c371cb3d4d0d75a9d6c3205fd5 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -6286,7 +6286,7 @@ double ha_tokudb::read_time(
     double total_scan;
     double ret_val; 
     bool is_primary = (index == primary_key);
-    bool is_clustering = (table->key_info[index].flags & HA_CLUSTERING);
+    bool is_clustering;
 
     //
     // in case for hidden primary key, this is called
@@ -6295,6 +6295,8 @@ double ha_tokudb::read_time(
         ret_val = handler::read_time(index, ranges, rows);
         goto cleanup;
     }
+    
+    is_clustering = (table->key_info[index].flags & HA_CLUSTERING);
 
 
     //