From b578ca2e4dcc027e20b9cec14a8b4ecd8829ae69 Mon Sep 17 00:00:00 2001 From: Zitan Chen <11285749+gg814@users.noreply.github.com> Date: Wed, 12 Aug 2020 13:28:43 -0700 Subject: BackupEngine supports custom file checksums (#7085) Summary: A new option `std::shared_ptr backup_checksum_gen_factory` is added to `BackupableDBOptions`. This allows custom checksum functions to be used for creating, verifying, or restoring backups. Tests are added. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7085 Test Plan: Passed make check Reviewed By: pdillinger Differential Revision: D22390756 Pulled By: gg814 fbshipit-source-id: 3b7756ca444c2129844536b91c3ca09f53b6248f --- util/file_checksum_helper.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'util/file_checksum_helper.h') diff --git a/util/file_checksum_helper.h b/util/file_checksum_helper.h index d9a3c8e47..ce56f7353 100644 --- a/util/file_checksum_helper.h +++ b/util/file_checksum_helper.h @@ -49,8 +49,13 @@ class FileChecksumGenCrc32cFactory : public FileChecksumGenFactory { public: std::unique_ptr CreateFileChecksumGenerator( const FileChecksumGenContext& context) override { - return std::unique_ptr( - new FileChecksumGenCrc32c(context)); + if (context.requested_checksum_func_name.empty() || + context.requested_checksum_func_name == "FileChecksumCrc32c") { + return std::unique_ptr( + new FileChecksumGenCrc32c(context)); + } else { + return nullptr; + } } const char* Name() const override { return "FileChecksumGenCrc32cFactory"; } -- cgit v1.2.3-70-g09d2