10225501448 李度 10225101546 陈胤遒 10215501422 高宇菲
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

173 lines
8.0 KiB

Release 1.18 Changes are: * Update version number to 1.18 * Replace the basic fprintf call with a call to fwrite in order to work around the apparent compiler optimization/rewrite failure that we are seeing with the new toolchain/iOS SDKs provided with Xcode6 and iOS8. * Fix ALL the header guards. * Createed a README.md with the LevelDB project description. * A new CONTRIBUTING file. * Don't implicitly convert uint64_t to size_t or int. Either preserve it as uint64_t, or explicitly cast. This fixes MSVC warnings about possible value truncation when compiling this code in Chromium. * Added a DumpFile() library function that encapsulates the guts of the "leveldbutil dump" command. This will allow clients to dump data to their log files instead of stdout. It will also allow clients to supply their own environment. * leveldb: Remove unused function 'ConsumeChar'. * leveldbutil: Remove unused member variables from WriteBatchItemPrinter. * OpenBSD, NetBSD and DragonflyBSD have _LITTLE_ENDIAN, so define PLATFORM_IS_LITTLE_ENDIAN like on FreeBSD. This fixes: * issue #143 * issue #198 * issue #249 * Switch from <cstdatomic> to <atomic>. The former never made it into the standard and doesn't exist in modern gcc versions at all. The later contains everything that leveldb was using from the former. This problem was noticed when porting to Portable Native Client where no memory barrier is defined. The fact that <cstdatomic> is missing normally goes unnoticed since memory barriers are defined for most architectures. * Make Hash() treat its input as unsigned. Before this change LevelDB files from platforms with different signedness of char were not compatible. This change fixes: issue #243 * Verify checksums of index/meta/filter blocks when paranoid_checks set. * Invoke all tools for iOS with xcrun. (This was causing problems with the new XCode 5.1.1 image on pulse.) * include <sys/stat.h> only once, and fix the following linter warning: "Found C system header after C++ system header" * When encountering a corrupted table file, return Status::Corruption instead of Status::InvalidArgument. * Support cygwin as build platform, patch is from https://code.google.com/p/leveldb/issues/detail?id=188 * Fix typo, merge patch from https://code.google.com/p/leveldb/issues/detail?id=159 * Fix typos and comments, and address the following two issues: * issue #166 * issue #241 * Add missing db synchronize after "fillseq" in the benchmark. * Removed unused variable in SeekRandom: value (issue #201)
пре 10 година
пре 9 година
Release 1.18 Changes are: * Update version number to 1.18 * Replace the basic fprintf call with a call to fwrite in order to work around the apparent compiler optimization/rewrite failure that we are seeing with the new toolchain/iOS SDKs provided with Xcode6 and iOS8. * Fix ALL the header guards. * Createed a README.md with the LevelDB project description. * A new CONTRIBUTING file. * Don't implicitly convert uint64_t to size_t or int. Either preserve it as uint64_t, or explicitly cast. This fixes MSVC warnings about possible value truncation when compiling this code in Chromium. * Added a DumpFile() library function that encapsulates the guts of the "leveldbutil dump" command. This will allow clients to dump data to their log files instead of stdout. It will also allow clients to supply their own environment. * leveldb: Remove unused function 'ConsumeChar'. * leveldbutil: Remove unused member variables from WriteBatchItemPrinter. * OpenBSD, NetBSD and DragonflyBSD have _LITTLE_ENDIAN, so define PLATFORM_IS_LITTLE_ENDIAN like on FreeBSD. This fixes: * issue #143 * issue #198 * issue #249 * Switch from <cstdatomic> to <atomic>. The former never made it into the standard and doesn't exist in modern gcc versions at all. The later contains everything that leveldb was using from the former. This problem was noticed when porting to Portable Native Client where no memory barrier is defined. The fact that <cstdatomic> is missing normally goes unnoticed since memory barriers are defined for most architectures. * Make Hash() treat its input as unsigned. Before this change LevelDB files from platforms with different signedness of char were not compatible. This change fixes: issue #243 * Verify checksums of index/meta/filter blocks when paranoid_checks set. * Invoke all tools for iOS with xcrun. (This was causing problems with the new XCode 5.1.1 image on pulse.) * include <sys/stat.h> only once, and fix the following linter warning: "Found C system header after C++ system header" * When encountering a corrupted table file, return Status::Corruption instead of Status::InvalidArgument. * Support cygwin as build platform, patch is from https://code.google.com/p/leveldb/issues/detail?id=188 * Fix typo, merge patch from https://code.google.com/p/leveldb/issues/detail?id=159 * Fix typos and comments, and address the following two issues: * issue #166 * issue #241 * Add missing db synchronize after "fillseq" in the benchmark. * Removed unused variable in SeekRandom: value (issue #201)
пре 10 година
пре 9 година
Release 1.18 Changes are: * Update version number to 1.18 * Replace the basic fprintf call with a call to fwrite in order to work around the apparent compiler optimization/rewrite failure that we are seeing with the new toolchain/iOS SDKs provided with Xcode6 and iOS8. * Fix ALL the header guards. * Createed a README.md with the LevelDB project description. * A new CONTRIBUTING file. * Don't implicitly convert uint64_t to size_t or int. Either preserve it as uint64_t, or explicitly cast. This fixes MSVC warnings about possible value truncation when compiling this code in Chromium. * Added a DumpFile() library function that encapsulates the guts of the "leveldbutil dump" command. This will allow clients to dump data to their log files instead of stdout. It will also allow clients to supply their own environment. * leveldb: Remove unused function 'ConsumeChar'. * leveldbutil: Remove unused member variables from WriteBatchItemPrinter. * OpenBSD, NetBSD and DragonflyBSD have _LITTLE_ENDIAN, so define PLATFORM_IS_LITTLE_ENDIAN like on FreeBSD. This fixes: * issue #143 * issue #198 * issue #249 * Switch from <cstdatomic> to <atomic>. The former never made it into the standard and doesn't exist in modern gcc versions at all. The later contains everything that leveldb was using from the former. This problem was noticed when porting to Portable Native Client where no memory barrier is defined. The fact that <cstdatomic> is missing normally goes unnoticed since memory barriers are defined for most architectures. * Make Hash() treat its input as unsigned. Before this change LevelDB files from platforms with different signedness of char were not compatible. This change fixes: issue #243 * Verify checksums of index/meta/filter blocks when paranoid_checks set. * Invoke all tools for iOS with xcrun. (This was causing problems with the new XCode 5.1.1 image on pulse.) * include <sys/stat.h> only once, and fix the following linter warning: "Found C system header after C++ system header" * When encountering a corrupted table file, return Status::Corruption instead of Status::InvalidArgument. * Support cygwin as build platform, patch is from https://code.google.com/p/leveldb/issues/detail?id=188 * Fix typo, merge patch from https://code.google.com/p/leveldb/issues/detail?id=159 * Fix typos and comments, and address the following two issues: * issue #166 * issue #241 * Add missing db synchronize after "fillseq" in the benchmark. * Removed unused variable in SeekRandom: value (issue #201)
пре 10 година
пре 9 година
Release 1.18 Changes are: * Update version number to 1.18 * Replace the basic fprintf call with a call to fwrite in order to work around the apparent compiler optimization/rewrite failure that we are seeing with the new toolchain/iOS SDKs provided with Xcode6 and iOS8. * Fix ALL the header guards. * Createed a README.md with the LevelDB project description. * A new CONTRIBUTING file. * Don't implicitly convert uint64_t to size_t or int. Either preserve it as uint64_t, or explicitly cast. This fixes MSVC warnings about possible value truncation when compiling this code in Chromium. * Added a DumpFile() library function that encapsulates the guts of the "leveldbutil dump" command. This will allow clients to dump data to their log files instead of stdout. It will also allow clients to supply their own environment. * leveldb: Remove unused function 'ConsumeChar'. * leveldbutil: Remove unused member variables from WriteBatchItemPrinter. * OpenBSD, NetBSD and DragonflyBSD have _LITTLE_ENDIAN, so define PLATFORM_IS_LITTLE_ENDIAN like on FreeBSD. This fixes: * issue #143 * issue #198 * issue #249 * Switch from <cstdatomic> to <atomic>. The former never made it into the standard and doesn't exist in modern gcc versions at all. The later contains everything that leveldb was using from the former. This problem was noticed when porting to Portable Native Client where no memory barrier is defined. The fact that <cstdatomic> is missing normally goes unnoticed since memory barriers are defined for most architectures. * Make Hash() treat its input as unsigned. Before this change LevelDB files from platforms with different signedness of char were not compatible. This change fixes: issue #243 * Verify checksums of index/meta/filter blocks when paranoid_checks set. * Invoke all tools for iOS with xcrun. (This was causing problems with the new XCode 5.1.1 image on pulse.) * include <sys/stat.h> only once, and fix the following linter warning: "Found C system header after C++ system header" * When encountering a corrupted table file, return Status::Corruption instead of Status::InvalidArgument. * Support cygwin as build platform, patch is from https://code.google.com/p/leveldb/issues/detail?id=188 * Fix typo, merge patch from https://code.google.com/p/leveldb/issues/detail?id=159 * Fix typos and comments, and address the following two issues: * issue #166 * issue #241 * Add missing db synchronize after "fillseq" in the benchmark. * Removed unused variable in SeekRandom: value (issue #201)
пре 10 година
Release 1.18 Changes are: * Update version number to 1.18 * Replace the basic fprintf call with a call to fwrite in order to work around the apparent compiler optimization/rewrite failure that we are seeing with the new toolchain/iOS SDKs provided with Xcode6 and iOS8. * Fix ALL the header guards. * Createed a README.md with the LevelDB project description. * A new CONTRIBUTING file. * Don't implicitly convert uint64_t to size_t or int. Either preserve it as uint64_t, or explicitly cast. This fixes MSVC warnings about possible value truncation when compiling this code in Chromium. * Added a DumpFile() library function that encapsulates the guts of the "leveldbutil dump" command. This will allow clients to dump data to their log files instead of stdout. It will also allow clients to supply their own environment. * leveldb: Remove unused function 'ConsumeChar'. * leveldbutil: Remove unused member variables from WriteBatchItemPrinter. * OpenBSD, NetBSD and DragonflyBSD have _LITTLE_ENDIAN, so define PLATFORM_IS_LITTLE_ENDIAN like on FreeBSD. This fixes: * issue #143 * issue #198 * issue #249 * Switch from <cstdatomic> to <atomic>. The former never made it into the standard and doesn't exist in modern gcc versions at all. The later contains everything that leveldb was using from the former. This problem was noticed when porting to Portable Native Client where no memory barrier is defined. The fact that <cstdatomic> is missing normally goes unnoticed since memory barriers are defined for most architectures. * Make Hash() treat its input as unsigned. Before this change LevelDB files from platforms with different signedness of char were not compatible. This change fixes: issue #243 * Verify checksums of index/meta/filter blocks when paranoid_checks set. * Invoke all tools for iOS with xcrun. (This was causing problems with the new XCode 5.1.1 image on pulse.) * include <sys/stat.h> only once, and fix the following linter warning: "Found C system header after C++ system header" * When encountering a corrupted table file, return Status::Corruption instead of Status::InvalidArgument. * Support cygwin as build platform, patch is from https://code.google.com/p/leveldb/issues/detail?id=188 * Fix typo, merge patch from https://code.google.com/p/leveldb/issues/detail?id=159 * Fix typos and comments, and address the following two issues: * issue #166 * issue #241 * Add missing db synchronize after "fillseq" in the benchmark. * Removed unused variable in SeekRandom: value (issue #201)
пре 10 година
  1. **LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.**
  2. [![Build Status](https://travis-ci.org/google/leveldb.svg?branch=master)](https://travis-ci.org/google/leveldb)
  3. Authors: Sanjay Ghemawat (sanjay@google.com) and Jeff Dean (jeff@google.com)
  4. # Features
  5. * Keys and values are arbitrary byte arrays.
  6. * Data is stored sorted by key.
  7. * Callers can provide a custom comparison function to override the sort order.
  8. * The basic operations are `Put(key,value)`, `Get(key)`, `Delete(key)`.
  9. * Multiple changes can be made in one atomic batch.
  10. * Users can create a transient snapshot to get a consistent view of data.
  11. * Forward and backward iteration is supported over the data.
  12. * Data is automatically compressed using the [Snappy compression library](http://google.github.io/snappy/).
  13. * External activity (file system operations etc.) is relayed through a virtual interface so users can customize the operating system interactions.
  14. # Documentation
  15. [LevelDB library documentation](https://rawgit.com/google/leveldb/master/doc/index.html) is online and bundled with the source code.
  16. # Limitations
  17. * This is not a SQL database. It does not have a relational data model, it does not support SQL queries, and it has no support for indexes.
  18. * Only a single process (possibly multi-threaded) can access a particular database at a time.
  19. * There is no client-server support builtin to the library. An application that needs such support will have to wrap their own server around the library.
  20. # Contributing to the leveldb Project
  21. The leveldb project welcomes contributions. leveldb's primary goal is to be
  22. a reliable and fast key/value store. Changes that are in line with the
  23. features/limitations outlined above, and meet the requirements below,
  24. will be considered.
  25. Contribution requirements:
  26. 1. **POSIX only**. We _generally_ will only accept changes that are both
  27. compiled, and tested on a POSIX platform - usually Linux. Very small
  28. changes will sometimes be accepted, but consider that more of an
  29. exception than the rule.
  30. 2. **Stable API**. We strive very hard to maintain a stable API. Changes that
  31. require changes for projects using leveldb _might_ be rejected without
  32. sufficient benefit to the project.
  33. 3. **Tests**: All changes must be accompanied by a new (or changed) test, or
  34. a sufficient explanation as to why a new (or changed) test is not required.
  35. ## Submitting a Pull Request
  36. Before any pull request will be accepted the author must first sign a
  37. Contributor License Agreement (CLA) at https://cla.developers.google.com/.
  38. In order to keep the commit timeline linear
  39. [squash](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Squashing-Commits)
  40. your changes down to a single commit and [rebase](https://git-scm.com/docs/git-rebase)
  41. on google/leveldb/master. This keeps the commit timeline linear and more easily sync'ed
  42. with the internal repository at Google. More information at GitHub's
  43. [About Git rebase](https://help.github.com/articles/about-git-rebase/) page.
  44. # Performance
  45. Here is a performance report (with explanations) from the run of the
  46. included db_bench program. The results are somewhat noisy, but should
  47. be enough to get a ballpark performance estimate.
  48. ## Setup
  49. We use a database with a million entries. Each entry has a 16 byte
  50. key, and a 100 byte value. Values used by the benchmark compress to
  51. about half their original size.
  52. LevelDB: version 1.1
  53. Date: Sun May 1 12:11:26 2011
  54. CPU: 4 x Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
  55. CPUCache: 4096 KB
  56. Keys: 16 bytes each
  57. Values: 100 bytes each (50 bytes after compression)
  58. Entries: 1000000
  59. Raw Size: 110.6 MB (estimated)
  60. File Size: 62.9 MB (estimated)
  61. ## Write performance
  62. The "fill" benchmarks create a brand new database, in either
  63. sequential, or random order. The "fillsync" benchmark flushes data
  64. from the operating system to the disk after every operation; the other
  65. write operations leave the data sitting in the operating system buffer
  66. cache for a while. The "overwrite" benchmark does random writes that
  67. update existing keys in the database.
  68. fillseq : 1.765 micros/op; 62.7 MB/s
  69. fillsync : 268.409 micros/op; 0.4 MB/s (10000 ops)
  70. fillrandom : 2.460 micros/op; 45.0 MB/s
  71. overwrite : 2.380 micros/op; 46.5 MB/s
  72. Each "op" above corresponds to a write of a single key/value pair.
  73. I.e., a random write benchmark goes at approximately 400,000 writes per second.
  74. Each "fillsync" operation costs much less (0.3 millisecond)
  75. than a disk seek (typically 10 milliseconds). We suspect that this is
  76. because the hard disk itself is buffering the update in its memory and
  77. responding before the data has been written to the platter. This may
  78. or may not be safe based on whether or not the hard disk has enough
  79. power to save its memory in the event of a power failure.
  80. ## Read performance
  81. We list the performance of reading sequentially in both the forward
  82. and reverse direction, and also the performance of a random lookup.
  83. Note that the database created by the benchmark is quite small.
  84. Therefore the report characterizes the performance of leveldb when the
  85. working set fits in memory. The cost of reading a piece of data that
  86. is not present in the operating system buffer cache will be dominated
  87. by the one or two disk seeks needed to fetch the data from disk.
  88. Write performance will be mostly unaffected by whether or not the
  89. working set fits in memory.
  90. readrandom : 16.677 micros/op; (approximately 60,000 reads per second)
  91. readseq : 0.476 micros/op; 232.3 MB/s
  92. readreverse : 0.724 micros/op; 152.9 MB/s
  93. LevelDB compacts its underlying storage data in the background to
  94. improve read performance. The results listed above were done
  95. immediately after a lot of random writes. The results after
  96. compactions (which are usually triggered automatically) are better.
  97. readrandom : 11.602 micros/op; (approximately 85,000 reads per second)
  98. readseq : 0.423 micros/op; 261.8 MB/s
  99. readreverse : 0.663 micros/op; 166.9 MB/s
  100. Some of the high cost of reads comes from repeated decompression of blocks
  101. read from disk. If we supply enough cache to the leveldb so it can hold the
  102. uncompressed blocks in memory, the read performance improves again:
  103. readrandom : 9.775 micros/op; (approximately 100,000 reads per second before compaction)
  104. readrandom : 5.215 micros/op; (approximately 190,000 reads per second after compaction)
  105. ## Repository contents
  106. See doc/index.html for more explanation. See doc/impl.html for a brief overview of the implementation.
  107. The public interface is in include/*.h. Callers should not include or
  108. rely on the details of any other header files in this package. Those
  109. internal APIs may be changed without warning.
  110. Guide to header files:
  111. * **include/db.h**: Main interface to the DB: Start here
  112. * **include/options.h**: Control over the behavior of an entire database,
  113. and also control over the behavior of individual reads and writes.
  114. * **include/comparator.h**: Abstraction for user-specified comparison function.
  115. If you want just bytewise comparison of keys, you can use the default
  116. comparator, but clients can write their own comparator implementations if they
  117. want custom ordering (e.g. to handle different character encodings, etc.)
  118. * **include/iterator.h**: Interface for iterating over data. You can get
  119. an iterator from a DB object.
  120. * **include/write_batch.h**: Interface for atomically applying multiple
  121. updates to a database.
  122. * **include/slice.h**: A simple module for maintaining a pointer and a
  123. length into some other byte array.
  124. * **include/status.h**: Status is returned from many of the public interfaces
  125. and is used to report success and various kinds of errors.
  126. * **include/env.h**:
  127. Abstraction of the OS environment. A posix implementation of this interface is
  128. in util/env_posix.cc
  129. * **include/table.h, include/table_builder.h**: Lower-level modules that most
  130. clients probably won't use directly