File format
===========
<beginning_of_file>
[data block 1]
[data block 2]
...
[data block N]
[meta block 1]
...
[meta block K]
[metaindex block]
[index block]
[Footer] (fixed size; starts at file_size - sizeof(Footer))
<end_of_file>
The file contains internal pointers. Each such pointer is called
a BlockHandle and contains the following information:
offset: varint64
size: varint64
See https://developers.google.com/protocol-buffers/docs/encoding#varints
for an explanation of varint64 format.
(1) The sequence of key/value pairs in the file are stored in sorted
order and partitioned into a sequence of data blocks. These blocks
come one after another at the beginning of the file. Each data block
is formatted according to the code in block_builder.cc, and then
optionally compressed.
(2) After the data blocks we store a bunch of meta blocks. The
supported meta block types are described below. More meta block types
may be added in the future. Each meta block is again formatted using
block_builder.cc and then optionally compressed.
(3) A "metaindex" block. It contains one entry for every other meta
block where the key is the name of the meta block and the value is a
BlockHandle pointing to that meta block.
(4) An "index" block. This block contains one entry per data block,
where the key is a string >= last key in that data block and before
the first key in the successive data block. The value is the
BlockHandle for the data block.
(6) At the very end of the file is a fixed length footer that contains
the BlockHandle of the metaindex and index blocks as well as a magic number.
metaindex_handle: char[p]; // Block handle for metaindex
index_handle: char[q]; // Block handle for index
padding: char[40-p-q]; // zeroed bytes to make fixed length
// (40==2*BlockHandle::kMaxEncodedLength)
magic: fixed64; // == 0xdb4775248b80fb57 (little-endian)
"filter" Meta Block
-------------------
If a "FilterPolicy" was specified when the database was opened, a
filter block is stored in each table. The "metaindex" block contains
an entry that maps from "filter.<N>" to the BlockHandle for the filter
block where "<N>" is the string returned by the filter policy's
"Name()" method.
The filter block stores a sequence of filters, where filter i contains
the output of FilterPolicy::CreateFilter() on all keys that are stored
in a block whose file offset falls within the range
[ i*base ... (i+1)*base-1 ]
Currently, "base" is 2KB. So for example, if blocks X and Y start in
the range [ 0KB .. 2KB-1 ], all of the keys in X and Y will be
converted to a filter by calling FilterPolicy::CreateFilter(), and the
resulting filter will be stored as the first filter in the filter
block.
The filter block is formatted as follows:
[filter 0]
[filter 1]
[filter 2]
...
[filter N-1]
[offset of filter 0] : 4 bytes
[offset of filter 1] : 4 bytes
[offset of filter 2] : 4 bytes
...
[offset of filter N-1] : 4 bytes
[offset of beginning of offset array] : 4 bytes
lg(base) : 1 byte
The offset array at the end of the filter block allows efficient
mapping from a data block offset to the corresponding filter.
"stats" Meta Block
------------------
This meta block contains a bunch of stats. The key is the name
of the statistic. The value contains the statistic.
TODO(postrelease): record following stats.
data size
index size
key size (uncompressed)
value size (uncompressed)
number of entries
number of data blocks
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
leveldb-1.7.0.tar.gz (131个子文件)
AUTHORS 193B
build_detect_platform 7KB
c_test.c 11KB
db_test.cc 56KB
version_set.cc 44KB
db_impl.cc 43KB
db_bench.cc 28KB
table_test.cc 23KB
db_bench_sqlite3.cc 22KB
env_posix.cc 18KB
c.cc 16KB
db_bench_tree_db.cc 16KB
crc32c.cc 15KB
log_test.cc 13KB
repair.cc 12KB
skiplist_test.cc 10KB
corruption_test.cc 10KB
memenv.cc 9KB
cache.cc 9KB
table.cc 8KB
table_builder.cc 8KB
db_iter.cc 8KB
block.cc 8KB
log_reader.cc 8KB
version_edit.cc 7KB
memenv_test.cc 7KB
coding_test.cc 5KB
version_set_test.cc 5KB
coding.cc 5KB
merger.cc 5KB
memtable.cc 5KB
histogram.cc 5KB
two_level_iterator.cc 5KB
cache_test.cc 5KB
format.cc 4KB
dbformat.cc 4KB
write_batch.cc 4KB
filename.cc 4KB
dbformat_test.cc 4KB
bloom_test.cc 4KB
filter_block_test.cc 4KB
block_builder.cc 4KB
table_cache.cc 3KB
write_batch_test.cc 3KB
filter_block.cc 3KB
filename_test.cc 3KB
bloom.cc 3KB
log_writer.cc 3KB
env_test.cc 2KB
comparator.cc 2KB
builder.cc 2KB
env.cc 2KB
arena.cc 2KB
status.cc 2KB
logging.cc 2KB
crc32c_test.cc 2KB
iterator.cc 2KB
arena_test.cc 2KB
testharness.cc 2KB
testutil.cc 1KB
port_posix.cc 1KB
version_edit_test.cc 1KB
hash.cc 980B
options.cc 764B
filter_policy.cc 333B
doc.css 1KB
.gitignore 61B
version_set.h 13KB
env.h 12KB
skiplist.h 11KB
c.h 10KB
dbformat.h 8KB
db_impl.h 7KB
options.h 7KB
atomic_pointer.h 7KB
db.h 6KB
testharness.h 5KB
port_example.h 5KB
coding.h 4KB
port_posix.h 4KB
log_reader.h 3KB
cache.h 3KB
iterator.h 3KB
table_builder.h 3KB
status.h 3KB
format.h 3KB
slice.h 3KB
version_edit.h 3KB
table.h 3KB
filter_policy.h 3KB
filename.h 3KB
posix_logger.h 3KB
memtable.h 3KB
comparator.h 2KB
filter_block.h 2KB
random.h 2KB
iterator_wrapper.h 2KB
table_cache.h 2KB
write_batch.h 2KB
arena.h 2KB
共 131 条
- 1
- 2
enic
- 粉丝: 52
- 资源: 169
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2023-04-06-项目笔记 - 第一百十五阶段 - 4.4.2.113全局变量的作用域-113 -2024.04.26
- 2023-04-06-项目笔记 - 第一百十五阶段 - 4.4.2.113全局变量的作用域-113 -2024.04.26
- htmlzwbjq_downyi.com.zip
- 无头单向非循环链表的实现(Test.c)
- 无头单向非循环链表的实现(SList.c)
- 浏览器重定向插件更新文件
- SSA-BP麻雀算法优化BP神经网络多特征分类预测(Matlab实现完整源码和数据)
- 粒子群算法优化BP神经网络PSO-BP的MATLAB代码(数值预测)
- 基于Springboot的一起看书平台.zip
- 无头单向非循环链表的实现(SList.h)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页