2016-02-10 00:12:00 +01:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2013-10-16 23:59:46 +02:00
|
|
|
// This source code is licensed under the BSD-style license found in the
|
|
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
//
|
2011-03-18 23:37:00 +01:00
|
|
|
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
|
2013-10-05 07:32:05 +02:00
|
|
|
#pragma once
|
2014-03-01 03:19:07 +01:00
|
|
|
|
2011-03-18 23:37:00 +01:00
|
|
|
#include <stdint.h>
|
2014-03-01 03:19:07 +01:00
|
|
|
#include <memory>
|
|
|
|
#include <utility>
|
RocksDB 2.8 to be able to read files generated by 2.6
Summary:
From 2.6 to 2.7, property block name is renamed from rocksdb.stats to rocksdb.properties. Older properties were not able to be loaded. In 2.8, we seem to have added some logic that uses property block without checking null pointers, which create segment faults.
In this patch, we fix it by:
(1) try rocksdb.stats if rocksdb.properties is not found
(2) add some null checking before consuming rep->table_properties
Test Plan: make sure a file generated in 2.7 couldn't be opened now can be opened.
Reviewers: haobo, igor, yhchiang
Reviewed By: igor
CC: ljin, xjin, dhruba, kailiu, leveldb
Differential Revision: https://reviews.facebook.net/D17961
2014-04-17 04:30:33 +02:00
|
|
|
#include <string>
|
2014-03-01 03:19:07 +01:00
|
|
|
|
2014-09-05 01:18:36 +02:00
|
|
|
#include "rocksdb/options.h"
|
2013-11-13 07:46:51 +01:00
|
|
|
#include "rocksdb/statistics.h"
|
2014-03-01 03:19:07 +01:00
|
|
|
#include "rocksdb/status.h"
|
|
|
|
#include "rocksdb/table.h"
|
2014-01-28 06:58:46 +01:00
|
|
|
#include "table/table_reader.h"
|
2014-11-13 20:39:30 +01:00
|
|
|
#include "table/table_properties_internal.h"
|
2013-09-02 08:23:40 +02:00
|
|
|
#include "util/coding.h"
|
Move rate_limiter, write buffering, most perf context instrumentation and most random kill out of Env
Summary: We want to keep Env a think layer for better portability. Less platform dependent codes should be moved out of Env. In this patch, I create a wrapper of file readers and writers, and put rate limiting, write buffering, as well as most perf context instrumentation and random kill out of Env. It will make it easier to maintain multiple Env in the future.
Test Plan: Run all existing unit tests.
Reviewers: anthony, kradhakrishnan, IslamAbdelRahman, yhchiang, igor
Reviewed By: igor
Subscribers: leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D42321
2015-07-18 01:16:11 +02:00
|
|
|
#include "util/file_reader_writer.h"
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2013-10-04 06:49:15 +02:00
|
|
|
namespace rocksdb {
|
2011-03-18 23:37:00 +01:00
|
|
|
|
|
|
|
class Block;
|
2014-07-31 01:34:35 +02:00
|
|
|
class BlockIter;
|
2011-03-18 23:37:00 +01:00
|
|
|
class BlockHandle;
|
2014-03-01 03:19:07 +01:00
|
|
|
class Cache;
|
|
|
|
class FilterBlockReader;
|
2014-09-08 19:37:05 +02:00
|
|
|
class BlockBasedFilterBlockReader;
|
|
|
|
class FullFilterBlockReader;
|
2012-04-17 17:36:46 +02:00
|
|
|
class Footer;
|
2014-03-01 03:19:07 +01:00
|
|
|
class InternalKeyComparator;
|
|
|
|
class Iterator;
|
2011-03-18 23:37:00 +01:00
|
|
|
class RandomAccessFile;
|
2012-04-17 17:36:46 +02:00
|
|
|
class TableCache;
|
2013-10-30 18:52:33 +01:00
|
|
|
class TableReader;
|
2014-03-01 03:19:07 +01:00
|
|
|
class WritableFile;
|
2014-01-24 19:57:15 +01:00
|
|
|
struct BlockBasedTableOptions;
|
2014-03-01 03:19:07 +01:00
|
|
|
struct EnvOptions;
|
|
|
|
struct ReadOptions;
|
2014-09-29 20:09:09 +02:00
|
|
|
class GetContext;
|
2015-10-13 00:06:38 +02:00
|
|
|
class InternalIterator;
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2013-01-20 11:07:13 +01:00
|
|
|
using std::unique_ptr;
|
|
|
|
|
2011-03-18 23:37:00 +01:00
|
|
|
// A Table is a sorted map from strings to strings. Tables are
|
2011-05-21 04:17:43 +02:00
|
|
|
// immutable and persistent. A Table may be safely accessed from
|
|
|
|
// multiple threads without external synchronization.
|
2013-10-30 18:52:33 +01:00
|
|
|
class BlockBasedTable : public TableReader {
|
2011-03-18 23:37:00 +01:00
|
|
|
public:
|
2013-10-10 20:43:24 +02:00
|
|
|
static const std::string kFilterBlockPrefix;
|
2014-09-08 19:37:05 +02:00
|
|
|
static const std::string kFullFilterBlockPrefix;
|
2013-10-10 20:43:24 +02:00
|
|
|
|
2011-03-28 22:43:44 +02:00
|
|
|
// Attempt to open the table that is stored in bytes [0..file_size)
|
|
|
|
// of "file", and read the metadata entries necessary to allow
|
|
|
|
// retrieving data from the table.
|
2011-03-18 23:37:00 +01:00
|
|
|
//
|
2013-10-30 18:52:33 +01:00
|
|
|
// If successful, returns ok and sets "*table_reader" to the newly opened
|
|
|
|
// table. The client should delete "*table_reader" when no longer needed.
|
|
|
|
// If there was an error while initializing the table, sets "*table_reader"
|
|
|
|
// to nullptr and returns a non-ok status.
|
2011-03-18 23:37:00 +01:00
|
|
|
//
|
Skip bottom-level filter block caching when hit-optimized
Summary:
When Get() or NewIterator() trigger file loads, skip caching the filter block if
(1) optimize_filters_for_hits is set and (2) the file is on the bottommost
level. Also skip checking filters under the same conditions, which means that
for a preloaded file or a file that was trivially-moved to the bottom level, its
filter block will eventually expire from the cache.
- added parameters/instance variables in various places in order to propagate the config ("skip_filters") from version_set to block_based_table_reader
- in BlockBasedTable::Rep, this optimization prevents filter from being loaded when the file is opened simply by setting filter_policy = nullptr
- in BlockBasedTable::Get/BlockBasedTable::NewIterator, this optimization prevents filter from being used (even if it was loaded already) by setting filter = nullptr
Test Plan:
updated unit test:
$ ./db_test --gtest_filter=DBTest.OptimizeFiltersForHits
will also run 'make check'
Reviewers: sdong, igor, paultuckfield, anthony, rven, kradhakrishnan, IslamAbdelRahman, yhchiang
Reviewed By: yhchiang
Subscribers: leveldb
Differential Revision: https://reviews.facebook.net/D51633
2015-12-23 19:15:07 +01:00
|
|
|
// @param file must remain live while this Table is in use.
|
|
|
|
// @param prefetch_index_and_filter can be used to disable prefetching of
|
|
|
|
// index and filter blocks at startup
|
|
|
|
// @param skip_filters Disables loading/accessing the filter block. Overrides
|
|
|
|
// prefetch_index_and_filter, so filter will be skipped if both are set.
|
2014-09-05 01:18:36 +02:00
|
|
|
static Status Open(const ImmutableCFOptions& ioptions,
|
|
|
|
const EnvOptions& env_options,
|
2014-01-24 19:57:15 +01:00
|
|
|
const BlockBasedTableOptions& table_options,
|
2014-01-27 22:53:22 +01:00
|
|
|
const InternalKeyComparator& internal_key_comparator,
|
Move rate_limiter, write buffering, most perf context instrumentation and most random kill out of Env
Summary: We want to keep Env a think layer for better portability. Less platform dependent codes should be moved out of Env. In this patch, I create a wrapper of file readers and writers, and put rate limiting, write buffering, as well as most perf context instrumentation and random kill out of Env. It will make it easier to maintain multiple Env in the future.
Test Plan: Run all existing unit tests.
Reviewers: anthony, kradhakrishnan, IslamAbdelRahman, yhchiang, igor
Reviewed By: igor
Subscribers: leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D42321
2015-07-18 01:16:11 +02:00
|
|
|
unique_ptr<RandomAccessFileReader>&& file,
|
|
|
|
uint64_t file_size, unique_ptr<TableReader>* table_reader,
|
Skip bottom-level filter block caching when hit-optimized
Summary:
When Get() or NewIterator() trigger file loads, skip caching the filter block if
(1) optimize_filters_for_hits is set and (2) the file is on the bottommost
level. Also skip checking filters under the same conditions, which means that
for a preloaded file or a file that was trivially-moved to the bottom level, its
filter block will eventually expire from the cache.
- added parameters/instance variables in various places in order to propagate the config ("skip_filters") from version_set to block_based_table_reader
- in BlockBasedTable::Rep, this optimization prevents filter from being loaded when the file is opened simply by setting filter_policy = nullptr
- in BlockBasedTable::Get/BlockBasedTable::NewIterator, this optimization prevents filter from being used (even if it was loaded already) by setting filter = nullptr
Test Plan:
updated unit test:
$ ./db_test --gtest_filter=DBTest.OptimizeFiltersForHits
will also run 'make check'
Reviewers: sdong, igor, paultuckfield, anthony, rven, kradhakrishnan, IslamAbdelRahman, yhchiang
Reviewed By: yhchiang
Subscribers: leveldb
Differential Revision: https://reviews.facebook.net/D51633
2015-12-23 19:15:07 +01:00
|
|
|
bool prefetch_index_and_filter = true,
|
|
|
|
bool skip_filters = false);
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2014-04-25 21:23:07 +02:00
|
|
|
bool PrefixMayMatch(const Slice& internal_key);
|
2013-08-13 23:04:56 +02:00
|
|
|
|
2011-03-18 23:37:00 +01:00
|
|
|
// Returns a new iterator over the table contents.
|
|
|
|
// The result of NewIterator() is initially invalid (caller must
|
|
|
|
// call one of the Seek methods on the iterator before using it).
|
Skip bottom-level filter block caching when hit-optimized
Summary:
When Get() or NewIterator() trigger file loads, skip caching the filter block if
(1) optimize_filters_for_hits is set and (2) the file is on the bottommost
level. Also skip checking filters under the same conditions, which means that
for a preloaded file or a file that was trivially-moved to the bottom level, its
filter block will eventually expire from the cache.
- added parameters/instance variables in various places in order to propagate the config ("skip_filters") from version_set to block_based_table_reader
- in BlockBasedTable::Rep, this optimization prevents filter from being loaded when the file is opened simply by setting filter_policy = nullptr
- in BlockBasedTable::Get/BlockBasedTable::NewIterator, this optimization prevents filter from being used (even if it was loaded already) by setting filter = nullptr
Test Plan:
updated unit test:
$ ./db_test --gtest_filter=DBTest.OptimizeFiltersForHits
will also run 'make check'
Reviewers: sdong, igor, paultuckfield, anthony, rven, kradhakrishnan, IslamAbdelRahman, yhchiang
Reviewed By: yhchiang
Subscribers: leveldb
Differential Revision: https://reviews.facebook.net/D51633
2015-12-23 19:15:07 +01:00
|
|
|
// @param skip_filters Disables loading/accessing the filter block
|
|
|
|
InternalIterator* NewIterator(const ReadOptions&, Arena* arena = nullptr,
|
|
|
|
bool skip_filters = false) override;
|
2013-10-29 01:54:09 +01:00
|
|
|
|
Skip bottom-level filter block caching when hit-optimized
Summary:
When Get() or NewIterator() trigger file loads, skip caching the filter block if
(1) optimize_filters_for_hits is set and (2) the file is on the bottommost
level. Also skip checking filters under the same conditions, which means that
for a preloaded file or a file that was trivially-moved to the bottom level, its
filter block will eventually expire from the cache.
- added parameters/instance variables in various places in order to propagate the config ("skip_filters") from version_set to block_based_table_reader
- in BlockBasedTable::Rep, this optimization prevents filter from being loaded when the file is opened simply by setting filter_policy = nullptr
- in BlockBasedTable::Get/BlockBasedTable::NewIterator, this optimization prevents filter from being used (even if it was loaded already) by setting filter = nullptr
Test Plan:
updated unit test:
$ ./db_test --gtest_filter=DBTest.OptimizeFiltersForHits
will also run 'make check'
Reviewers: sdong, igor, paultuckfield, anthony, rven, kradhakrishnan, IslamAbdelRahman, yhchiang
Reviewed By: yhchiang
Subscribers: leveldb
Differential Revision: https://reviews.facebook.net/D51633
2015-12-23 19:15:07 +01:00
|
|
|
// @param skip_filters Disables loading/accessing the filter block
|
2014-01-28 06:58:46 +01:00
|
|
|
Status Get(const ReadOptions& readOptions, const Slice& key,
|
Skip bottom-level filter block caching when hit-optimized
Summary:
When Get() or NewIterator() trigger file loads, skip caching the filter block if
(1) optimize_filters_for_hits is set and (2) the file is on the bottommost
level. Also skip checking filters under the same conditions, which means that
for a preloaded file or a file that was trivially-moved to the bottom level, its
filter block will eventually expire from the cache.
- added parameters/instance variables in various places in order to propagate the config ("skip_filters") from version_set to block_based_table_reader
- in BlockBasedTable::Rep, this optimization prevents filter from being loaded when the file is opened simply by setting filter_policy = nullptr
- in BlockBasedTable::Get/BlockBasedTable::NewIterator, this optimization prevents filter from being used (even if it was loaded already) by setting filter = nullptr
Test Plan:
updated unit test:
$ ./db_test --gtest_filter=DBTest.OptimizeFiltersForHits
will also run 'make check'
Reviewers: sdong, igor, paultuckfield, anthony, rven, kradhakrishnan, IslamAbdelRahman, yhchiang
Reviewed By: yhchiang
Subscribers: leveldb
Differential Revision: https://reviews.facebook.net/D51633
2015-12-23 19:15:07 +01:00
|
|
|
GetContext* get_context, bool skip_filters = false) override;
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2015-03-03 02:07:03 +01:00
|
|
|
// Pre-fetch the disk blocks that correspond to the key range specified by
|
|
|
|
// (kbegin, kend). The call will return return error status in the event of
|
|
|
|
// IO or iteration error.
|
|
|
|
Status Prefetch(const Slice* begin, const Slice* end) override;
|
|
|
|
|
2011-03-18 23:37:00 +01:00
|
|
|
// Given a key, return an approximate byte offset in the file where
|
|
|
|
// the data for that key begins (or would begin if the key were
|
|
|
|
// present in the file). The returned value is in terms of file
|
|
|
|
// bytes, and so includes effects like compression of the underlying data.
|
|
|
|
// E.g., the approximate offset of the last key in the table will
|
|
|
|
// be close to the file length.
|
2013-10-29 01:54:09 +01:00
|
|
|
uint64_t ApproximateOffsetOf(const Slice& key) override;
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2013-02-01 00:20:24 +01:00
|
|
|
// Returns true if the block for the specified key is in cache.
|
2014-06-20 10:23:02 +02:00
|
|
|
// REQUIRES: key is in this table && block cache enabled
|
2014-01-28 06:58:46 +01:00
|
|
|
bool TEST_KeyInCache(const ReadOptions& options, const Slice& key);
|
2013-02-01 00:20:24 +01:00
|
|
|
|
2013-06-14 02:25:09 +02:00
|
|
|
// Set up the table for Compaction. Might change some parameters with
|
|
|
|
// posix_fadvise
|
2013-10-29 01:54:09 +01:00
|
|
|
void SetupForCompaction() override;
|
|
|
|
|
2014-02-08 04:26:49 +01:00
|
|
|
std::shared_ptr<const TableProperties> GetTableProperties() const override;
|
2013-05-18 00:53:01 +02:00
|
|
|
|
2014-08-05 20:27:34 +02:00
|
|
|
size_t ApproximateMemoryUsage() const override;
|
|
|
|
|
2014-12-23 22:24:07 +01:00
|
|
|
// convert SST file to a human readable form
|
|
|
|
Status DumpTable(WritableFile* out_file) override;
|
|
|
|
|
2013-10-29 01:54:09 +01:00
|
|
|
~BlockBasedTable();
|
2013-10-10 20:43:24 +02:00
|
|
|
|
2014-02-20 00:38:57 +01:00
|
|
|
bool TEST_filter_block_preloaded() const;
|
2014-03-01 03:19:07 +01:00
|
|
|
bool TEST_index_reader_preloaded() const;
|
|
|
|
// Implementation of IndexReader will be exposed to internal cc file only.
|
|
|
|
class IndexReader;
|
2014-02-20 00:38:57 +01:00
|
|
|
|
2011-03-18 23:37:00 +01:00
|
|
|
private:
|
2013-11-13 07:46:51 +01:00
|
|
|
template <class TValue>
|
|
|
|
struct CachableEntry;
|
|
|
|
|
2011-03-18 23:37:00 +01:00
|
|
|
struct Rep;
|
|
|
|
Rep* rep_;
|
2013-06-14 02:25:09 +02:00
|
|
|
bool compaction_optimized_;
|
2013-10-10 20:43:24 +02:00
|
|
|
|
2014-04-26 23:15:43 +02:00
|
|
|
class BlockEntryIteratorState;
|
2014-07-31 01:34:35 +02:00
|
|
|
// input_iter: if it is not null, update this one and return it as Iterator
|
2015-10-13 00:06:38 +02:00
|
|
|
static InternalIterator* NewDataBlockIterator(
|
|
|
|
Rep* rep, const ReadOptions& ro, const Slice& index_value,
|
|
|
|
BlockIter* input_iter = nullptr);
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2014-03-01 03:19:07 +01:00
|
|
|
// For the following two functions:
|
|
|
|
// if `no_io == true`, we will not try to read filter/index from sst file
|
|
|
|
// were they not present in cache yet.
|
2013-11-13 07:46:51 +01:00
|
|
|
CachableEntry<FilterBlockReader> GetFilter(bool no_io = false) const;
|
|
|
|
|
2014-03-01 03:19:07 +01:00
|
|
|
// Get the iterator from the index reader.
|
2014-07-31 01:34:35 +02:00
|
|
|
// If input_iter is not set, return new Iterator
|
|
|
|
// If input_iter is set, update it and return it as Iterator
|
2013-11-13 07:46:51 +01:00
|
|
|
//
|
2014-03-01 03:19:07 +01:00
|
|
|
// Note: ErrorIterator with Status::Incomplete shall be returned if all the
|
|
|
|
// following conditions are met:
|
|
|
|
// 1. We enabled table_options.cache_index_and_filter_blocks.
|
|
|
|
// 2. index is not present in block cache.
|
|
|
|
// 3. We disallowed any io to be performed, that is, read_options ==
|
|
|
|
// kBlockCacheTier
|
2015-10-13 00:06:38 +02:00
|
|
|
InternalIterator* NewIndexIterator(const ReadOptions& read_options,
|
|
|
|
BlockIter* input_iter = nullptr);
|
2014-03-01 03:19:07 +01:00
|
|
|
|
|
|
|
// Read block cache from block caches (if set): block_cache and
|
|
|
|
// block_cache_compressed.
|
|
|
|
// On success, Status::OK with be returned and @block will be populated with
|
|
|
|
// pointer to the block as well as its block handle.
|
|
|
|
static Status GetDataBlockFromCache(
|
|
|
|
const Slice& block_cache_key, const Slice& compressed_block_cache_key,
|
|
|
|
Cache* block_cache, Cache* block_cache_compressed, Statistics* statistics,
|
|
|
|
const ReadOptions& read_options,
|
2015-01-15 01:24:24 +01:00
|
|
|
BlockBasedTable::CachableEntry<Block>* block, uint32_t format_version);
|
2014-03-01 03:19:07 +01:00
|
|
|
// Put a raw block (maybe compressed) to the corresponding block caches.
|
|
|
|
// This method will perform decompression against raw_block if needed and then
|
|
|
|
// populate the block caches.
|
|
|
|
// On success, Status::OK will be returned; also @block will be populated with
|
|
|
|
// uncompressed block and its cache handle.
|
2013-11-13 07:46:51 +01:00
|
|
|
//
|
2014-03-01 03:19:07 +01:00
|
|
|
// REQUIRES: raw_block is heap-allocated. PutDataBlockToCache() will be
|
|
|
|
// responsible for releasing its memory if error occurs.
|
|
|
|
static Status PutDataBlockToCache(
|
|
|
|
const Slice& block_cache_key, const Slice& compressed_block_cache_key,
|
|
|
|
Cache* block_cache, Cache* block_cache_compressed,
|
|
|
|
const ReadOptions& read_options, Statistics* statistics,
|
2015-01-15 01:24:24 +01:00
|
|
|
CachableEntry<Block>* block, Block* raw_block, uint32_t format_version);
|
2013-11-13 07:46:51 +01:00
|
|
|
|
2013-03-21 23:59:47 +01:00
|
|
|
// Calls (*handle_result)(arg, ...) repeatedly, starting with the entry found
|
|
|
|
// after a call to Seek(key), until handle_result returns false.
|
|
|
|
// May not make such a call if filter policy says that key is not present.
|
2012-04-17 17:36:46 +02:00
|
|
|
friend class TableCache;
|
2013-09-02 08:23:40 +02:00
|
|
|
friend class BlockBasedTableBuilder;
|
2012-04-17 17:36:46 +02:00
|
|
|
|
|
|
|
void ReadMeta(const Footer& footer);
|
2014-05-15 23:09:03 +02:00
|
|
|
|
|
|
|
// Create a index reader based on the index type stored in the table.
|
|
|
|
// Optionally, user can pass a preloaded meta_index_iter for the index that
|
|
|
|
// need to access extra meta blocks for index construction. This parameter
|
|
|
|
// helps avoid re-reading meta index block if caller already created one.
|
2015-10-13 00:06:38 +02:00
|
|
|
Status CreateIndexReader(
|
|
|
|
IndexReader** index_reader,
|
|
|
|
InternalIterator* preloaded_meta_index_iter = nullptr);
|
2012-04-17 17:36:46 +02:00
|
|
|
|
2015-02-03 02:42:57 +01:00
|
|
|
bool FullFilterKeyMayMatch(FilterBlockReader* filter,
|
|
|
|
const Slice& user_key) const;
|
|
|
|
|
2013-11-13 07:46:51 +01:00
|
|
|
// Read the meta block from sst.
|
2015-10-13 00:06:38 +02:00
|
|
|
static Status ReadMetaBlock(Rep* rep, std::unique_ptr<Block>* meta_block,
|
|
|
|
std::unique_ptr<InternalIterator>* iter);
|
2013-11-13 07:46:51 +01:00
|
|
|
|
|
|
|
// Create the filter from the filter block.
|
2015-09-03 00:36:47 +02:00
|
|
|
static FilterBlockReader* ReadFilter(Rep* rep, size_t* filter_size = nullptr);
|
2013-11-13 07:46:51 +01:00
|
|
|
|
2013-02-01 00:20:24 +01:00
|
|
|
static void SetupCacheKeyPrefix(Rep* rep);
|
|
|
|
|
2014-03-01 03:19:07 +01:00
|
|
|
explicit BlockBasedTable(Rep* rep)
|
|
|
|
: rep_(rep), compaction_optimized_(false) {}
|
|
|
|
|
2013-09-02 08:23:40 +02:00
|
|
|
// Generate a cache key prefix from the file
|
2013-12-03 20:17:58 +01:00
|
|
|
static void GenerateCachePrefix(Cache* cc,
|
2013-09-02 08:23:40 +02:00
|
|
|
RandomAccessFile* file, char* buffer, size_t* size);
|
2013-12-03 20:17:58 +01:00
|
|
|
static void GenerateCachePrefix(Cache* cc,
|
2013-09-02 08:23:40 +02:00
|
|
|
WritableFile* file, char* buffer, size_t* size);
|
|
|
|
|
|
|
|
// The longest prefix of the cache key used to identify blocks.
|
|
|
|
// For Posix files the unique ID is three varints.
|
|
|
|
static const size_t kMaxCacheKeyPrefixSize = kMaxVarint64Length*3+1;
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2014-12-23 22:24:07 +01:00
|
|
|
// Helper functions for DumpTable()
|
|
|
|
Status DumpIndexBlock(WritableFile* out_file);
|
|
|
|
Status DumpDataBlocks(WritableFile* out_file);
|
|
|
|
|
2013-10-29 01:54:09 +01:00
|
|
|
// No copying allowed
|
2013-10-30 18:52:33 +01:00
|
|
|
explicit BlockBasedTable(const TableReader&) = delete;
|
|
|
|
void operator=(const TableReader&) = delete;
|
|
|
|
};
|
|
|
|
|
2013-10-04 06:49:15 +02:00
|
|
|
} // namespace rocksdb
|