| 82 | } |
| 83 | |
| 84 | void Table::ReadMeta(const Footer& footer) { |
| 85 | if (rep_->options.filter_policy == nullptr) { |
| 86 | return; // Do not need any metadata |
| 87 | } |
| 88 | |
| 89 | // TODO(sanjay): Skip this if footer.metaindex_handle() size indicates |
| 90 | // it is an empty block. |
| 91 | ReadOptions opt; |
| 92 | if (rep_->options.paranoid_checks) { |
| 93 | opt.verify_checksums = true; |
| 94 | } |
| 95 | BlockContents contents; |
| 96 | if (!ReadBlock(rep_->file, opt, footer.metaindex_handle(), &contents).ok()) { |
| 97 | // Do not propagate errors since meta info is not needed for operation |
| 98 | return; |
| 99 | } |
| 100 | Block* meta = new Block(contents); |
| 101 | |
| 102 | Iterator* iter = meta->NewIterator(BytewiseComparator()); |
| 103 | std::string key = "filter."; |
| 104 | key.append(rep_->options.filter_policy->Name()); |
| 105 | iter->Seek(key); |
| 106 | if (iter->Valid() && iter->key() == Slice(key)) { |
| 107 | ReadFilter(iter->value()); |
| 108 | } |
| 109 | delete iter; |
| 110 | delete meta; |
| 111 | } |
| 112 | |
| 113 | void Table::ReadFilter(const Slice& filter_handle_value) { |
| 114 | Slice v = filter_handle_value; |
no test coverage detected