- IOOptions opts;
- auto s = ReadFooterFromFile(opts, file, prefetch_buffer, file_size, &footer,
- table_magic_number);
- if (!s.ok()) {
- return s;
- }
-
- auto metaindex_handle = footer.metaindex_handle();
- BlockContents metaindex_contents;
- ReadOptions read_options;
- read_options.verify_checksums = false;
- PersistentCacheOptions cache_options;
-
- BlockFetcher block_fetcher(
- file, prefetch_buffer, footer, read_options, metaindex_handle,
- &metaindex_contents, ioptions, false /* decompress */,
- false /*maybe_compressed*/, BlockType::kMetaIndex,
- UncompressionDict::GetEmptyDict(), cache_options, memory_allocator);
- s = block_fetcher.ReadBlockContents();
- if (!s.ok()) {
- return s;
- }
- // property blocks are never compressed. Need to add uncompress logic if we
- // are to compress it.
- Block metaindex_block(std::move(metaindex_contents));
- std::unique_ptr<InternalIterator> meta_iter(metaindex_block.NewDataIterator(
- BytewiseComparator(), kDisableGlobalSequenceNumber));
-
- // -- Read property block
- bool found_properties_block = true;
- s = SeekToPropertiesBlock(meta_iter.get(), &found_properties_block);
+ Status s = FindMetaBlockInFile(file, file_size, table_magic_number, ioptions,
+ kPropertiesBlockName, &block_handle,
+ memory_allocator, prefetch_buffer, &footer);