Skip to content

Commit

Permalink
Add NewFileChecksumGenCrc32cFactory to file checksum (facebook#6688)
Browse files Browse the repository at this point in the history
Summary:
Add NewFileChecksumGenCrc32cFactory to file checksum public interface such that applications can use the build in crc32 checksum factory.
Pull Request resolved: facebook#6688

Test Plan: pass make asan_check

Reviewed By: riversand963

Differential Revision: D21006859

Pulled By: zhichao-cao

fbshipit-source-id: ea8a45196a8b77c310728ab05f6cc0f49f3baef0
  • Loading branch information
zhichao-cao authored and facebook-github-bot committed Apr 14, 2020
1 parent 41563b6 commit 38dfa40
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
### Bug Fixes
* Fix wrong result being read from ingested file. May happen when a key in the file happen to be prefix of another key also in the file. The issue can further cause more data corruption. The issue exists with rocksdb >= 5.0.0 since DB::IngestExternalFile() was introduced.

### Public API Change
* Add NewFileChecksumGenCrc32cFactory to the file checksum public API, such that the builtin Crc32c based file checksum generator factory can be used by applications.

### New Features
* Added support for pipelined & parallel compression optimization for `BlockBasedTableBuilder`. This optimization makes block building, block compression and block appending a pipeline, and uses multiple threads to accelerate block compression. Users can set `CompressionOptions::parallel_threads` greater than 1 to enable compression parallelism.
* Provide an allocator for memkind to be used with block cache. This is to work with memory technologies (Intel DCPMM is one such technology currently available) that require different libraries for allocation and management (such as PMDK and memkind). The high capacities available make it possible to provision large caches (up to several TBs in size) beyond what is achievable with DRAM.
Expand Down
6 changes: 6 additions & 0 deletions include/rocksdb/file_checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,10 @@ class FileChecksumList {
// Create a new file checksum list.
extern FileChecksumList* NewFileChecksumList();

// Return a shared_ptr of the builtin Crc32 based file checksum generatory
// factory object, which can be shared to create the Crc32c based checksum
// generator object.
extern std::shared_ptr<FileChecksumGenFactory>
GetFileChecksumGenCrc32cFactory();

} // namespace ROCKSDB_NAMESPACE
4 changes: 1 addition & 3 deletions tools/ldb_cmd_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,7 @@ TEST_F(LdbCmdTest, DumpFileChecksumCRC32) {
Options opts;
opts.env = env.get();
opts.create_if_missing = true;
FileChecksumGenCrc32cFactory* file_checksum_gen_factory =
new FileChecksumGenCrc32cFactory();
opts.file_checksum_gen_factory.reset(file_checksum_gen_factory);
opts.file_checksum_gen_factory = GetFileChecksumGenCrc32cFactory();

DB* db = nullptr;
std::string dbname = test::TmpDir();
Expand Down
6 changes: 6 additions & 0 deletions util/file_checksum_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ FileChecksumList* NewFileChecksumList() {
return checksum_list;
}

std::shared_ptr<FileChecksumGenFactory> GetFileChecksumGenCrc32cFactory() {
static std::shared_ptr<FileChecksumGenFactory> default_crc32c_gen_factory(
new FileChecksumGenCrc32cFactory());
return default_crc32c_gen_factory;
}

} // namespace ROCKSDB_NAMESPACE

0 comments on commit 38dfa40

Please sign in to comment.