2016-02-10 00:12:00 +01:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2014-11-13 20:39:30 +01: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.
|
2017-04-28 02:50:56 +02:00
|
|
|
// This source code is also licensed under the GPLv2 license found in the
|
|
|
|
// COPYING file in the root directory of this source tree.
|
2014-11-13 20:39:30 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "rocksdb/status.h"
|
|
|
|
#include "rocksdb/iterator.h"
|
|
|
|
|
|
|
|
namespace rocksdb {
|
|
|
|
|
2015-10-13 00:06:38 +02:00
|
|
|
class InternalIterator;
|
2016-08-20 00:10:31 +02:00
|
|
|
class BlockHandle;
|
2015-10-13 00:06:38 +02:00
|
|
|
|
2014-11-13 20:39:30 +01:00
|
|
|
// Seek to the properties block.
|
|
|
|
// If it successfully seeks to the properties block, "is_found" will be
|
|
|
|
// set to true.
|
2015-10-13 00:06:38 +02:00
|
|
|
Status SeekToPropertiesBlock(InternalIterator* meta_iter, bool* is_found);
|
2014-11-13 20:39:30 +01:00
|
|
|
|
Shared dictionary compression using reference block
Summary:
This adds a new metablock containing a shared dictionary that is used
to compress all data blocks in the SST file. The size of the shared dictionary
is configurable in CompressionOptions and defaults to 0. It's currently only
used for zlib/lz4/lz4hc, but the block will be stored in the SST regardless of
the compression type if the user chooses a nonzero dictionary size.
During compaction, computes the dictionary by randomly sampling the first
output file in each subcompaction. It pre-computes the intervals to sample
by assuming the output file will have the maximum allowable length. In case
the file is smaller, some of the pre-computed sampling intervals can be beyond
end-of-file, in which case we skip over those samples and the dictionary will
be a bit smaller. After the dictionary is generated using the first file in a
subcompaction, it is loaded into the compression library before writing each
block in each subsequent file of that subcompaction.
On the read path, gets the dictionary from the metablock, if it exists. Then,
loads that dictionary into the compression library before reading each block.
Test Plan: new unit test
Reviewers: yhchiang, IslamAbdelRahman, cyan, sdong
Reviewed By: sdong
Subscribers: andrewkr, yoshinorim, kradhakrishnan, dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D52287
2016-04-28 02:36:03 +02:00
|
|
|
// Seek to the compression dictionary block.
|
|
|
|
// If it successfully seeks to the properties block, "is_found" will be
|
|
|
|
// set to true.
|
|
|
|
Status SeekToCompressionDictBlock(InternalIterator* meta_iter, bool* is_found);
|
|
|
|
|
2016-08-20 00:10:31 +02:00
|
|
|
// TODO(andrewkr) should not put all meta block in table_properties.h/cc
|
|
|
|
Status SeekToRangeDelBlock(InternalIterator* meta_iter, bool* is_found,
|
|
|
|
BlockHandle* block_handle);
|
|
|
|
|
2014-11-13 20:39:30 +01:00
|
|
|
} // namespace rocksdb
|