10225501448 李度 10225101546 陈胤遒 10215501422 高宇菲
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

61 wiersze
2.1 KiB

  1. File format
  2. ===========
  3. <beginning_of_file>
  4. [data block 1]
  5. [data block 2]
  6. ...
  7. [data block N]
  8. [meta block 1]
  9. ...
  10. [meta block K]
  11. [metaindex block]
  12. [index block]
  13. [Footer] (fixed size; starts at file_size - sizeof(Footer))
  14. <end_of_file>
  15. The file contains internal pointers. Each such pointer is called
  16. a BlockHandle and contains the following information:
  17. offset: varint64
  18. size: varint64
  19. (1) The sequence of key/value pairs in the file are stored in sorted
  20. order and partitioned into a sequence of data blocks. These blocks
  21. come one after another at the beginning of the file. Each data block
  22. is formatted according to the code in block_builder.cc, and then
  23. optionally compressed.
  24. (2) After the data blocks we store a bunch of meta blocks. The
  25. supported meta block types are described below. More meta block types
  26. may be added in the future. Each meta block is again formatted using
  27. block_builder.cc and then optionally compressed.
  28. (3) A "metaindex" block. It contains one entry for every other meta
  29. block where the key is the name of the meta block and the value is a
  30. BlockHandle pointing to that meta block.
  31. (4) An "index" block. This block contains one entry per data block,
  32. where the key is a string >= last key in that data block and before
  33. the first key in the successive data block. The value is the
  34. BlockHandle for the data block.
  35. (6) At the very end of the file is a fixed length footer that contains
  36. the BlockHandle of the metaindex and index blocks as well as a magic number.
  37. metaindex_handle: char[p]; // Block handle for metaindex
  38. index_handle: char[q]; // Block handle for index
  39. padding: char[40-p-q]; // 0 bytes to make fixed length
  40. // (40==2*BlockHandle::kMaxEncodedLength)
  41. magic: fixed64; // == 0xdb4775248b80fb57
  42. "stats" Meta Block
  43. ------------------
  44. This meta block contains a bunch of stats. The key is the name
  45. of the statistic. The value contains the statistic.
  46. TODO(postrelease): record following stats.
  47. data size
  48. index size
  49. key size (uncompressed)
  50. value size (uncompressed)
  51. number of entries
  52. number of data blocks