For hash based index, return true if prefix_extractor and prefix_extractor_block mismatch, false otherwise. This flag will be used as total_order_seek via NewIndexIterator
| 184 | // prefix_extractor_block mismatch, false otherwise. This flag will be used |
| 185 | // as total_order_seek via NewIndexIterator |
| 186 | bool PrefixExtractorChanged(const TablePropertiesBase* table_properties_base, |
| 187 | const SliceTransform* prefix_extractor) { |
| 188 | // BlockBasedTableOptions::kHashSearch requires prefix_extractor to be set. |
| 189 | // Turn off hash index in prefix_extractor is not set; if prefix_extractor |
| 190 | // is set but prefix_extractor_block is not set, also disable hash index |
| 191 | if (prefix_extractor == nullptr || table_properties_base == nullptr || |
| 192 | table_properties_base->prefix_extractor_name.empty()) { |
| 193 | return true; |
| 194 | } |
| 195 | |
| 196 | // prefix_extractor and prefix_extractor_block are both non-empty |
| 197 | if (table_properties_base->prefix_extractor_name.compare( |
| 198 | prefix_extractor->Name()) != 0) { |
| 199 | return true; |
| 200 | } else { |
| 201 | return false; |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | } // namespace |
| 206 |