utilities/backupable : Fix coverity issues

Summary:
1. Class BackupMeta
```
52      : timestamp_(0), size_(0), meta_filename_(meta_filename),

CID 1168103 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
2. uninit_member: Non-static class member sequence_number_ is not initialized in this constructor nor in any functions that it calls.
153        file_infos_(file_infos), env_(env) {}
```
2. class BackupEngineImpl
```
513  }
        7. uninit_member: Non-static class member latest_backup_id_ is not initialized in this constructor nor in any functions that it calls.

CID 1322803 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
9. uninit_member: Non-static class member latest_valid_backup_id_ is not initialized in this constructor nor in any functions that it calls.
514}
```
3. struct BackupAfterCopyOrCreateWorkItem
```
368  struct BackupAfterCopyOrCreateWorkItem {
369    std::future<CopyOrCreateResult> result;
        1. member_decl: Class member declaration for shared.
370    bool shared;
        3. member_decl: Class member declaration for needed_to_copy.
371    bool needed_to_copy;
        5. member_decl: Class member declaration for backup_env.
372    Env* backup_env;
373    std::string dst_path_tmp;
374    std::string dst_path;
375    std::string dst_relative;
        2. uninit_member: Non-static class member shared is not initialized in this constructor nor in any functions that it calls.
        4. uninit_member: Non-static class member needed_to_copy is not initialized in this constructor nor in any functions that it calls.

CID 1396122 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
6. uninit_member: Non-static class member backup_env is not initialized in this constructor nor in any functions that it calls.
376    BackupAfterCopyOrCreateWorkItem() {}
```
4. struct CopyOrCreateWorkItem
```
318  struct CopyOrCreateWorkItem {
319    std::string src_path;
320    std::string dst_path;
321    std::string contents;
        1. member_decl: Class member declaration for src_env.
322    Env* src_env;
        3. member_decl: Class member declaration for dst_env.
323    Env* dst_env;
        5. member_decl: Class member declaration for sync.
324    bool sync;
        7. member_decl: Class member declaration for rate_limiter.
325    RateLimiter* rate_limiter;
        9. member_decl: Class member declaration for size_limit.
326    uint64_t size_limit;
327    std::promise<CopyOrCreateResult> result;
328    std::function<void()> progress_callback;
329
        2. uninit_member: Non-static class member src_env is not initialized in this constructor nor in any functions that it calls.
        4. uninit_member: Non-static class member dst_env is not initialized in this constructor nor in any functions that it calls.
        6. uninit_member: Non-static class member sync is not initialized in this constructor nor in any functions that it calls.
        8. uninit_member: Non-static class member rate_limiter is not initialized in this constructor nor in any functions that it calls.

CID 1396123 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
10. uninit_member: Non-static class member size_limit is not initialized in this constructor nor in any functions that it calls.
330    CopyOrCreateWorkItem() {}
```
5. struct RestoreAfterCopyOrCreateWorkItem
```
struct RestoreAfterCopyOrCreateWorkItem {
410    std::future<CopyOrCreateResult> result;
        1. member_decl: Class member declaration for checksum_value.
411    uint32_t checksum_value;

CID 1396153 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
2. uninit_member: Non-static class member checksum_value is not initialized in this constructor nor in any functions that it calls.
412    RestoreAfterCopyOrCreateWorkItem() {}
```
Closes https://github.com/facebook/rocksdb/pull/3131

Differential Revision: D6428556

Pulled By: sagar0

fbshipit-source-id: a86675444543eff028e3cae6942197a143a112c4
main
Prashant D 7 years ago committed by Facebook Github Bot
parent 75d57a5d53
commit 81cf262ff5
  1. 28
      utilities/backupable/backupable_db.cc

@ -149,8 +149,8 @@ class BackupEngineImpl : public BackupEngine {
BackupMeta(const std::string& meta_filename, BackupMeta(const std::string& meta_filename,
std::unordered_map<std::string, std::shared_ptr<FileInfo>>* file_infos, std::unordered_map<std::string, std::shared_ptr<FileInfo>>* file_infos,
Env* env) Env* env)
: timestamp_(0), size_(0), meta_filename_(meta_filename), : timestamp_(0), sequence_number_(0), size_(0),
file_infos_(file_infos), env_(env) {} meta_filename_(meta_filename), file_infos_(file_infos), env_(env) {}
BackupMeta(const BackupMeta&) = delete; BackupMeta(const BackupMeta&) = delete;
BackupMeta& operator=(const BackupMeta&) = delete; BackupMeta& operator=(const BackupMeta&) = delete;
@ -327,7 +327,16 @@ class BackupEngineImpl : public BackupEngine {
std::promise<CopyOrCreateResult> result; std::promise<CopyOrCreateResult> result;
std::function<void()> progress_callback; std::function<void()> progress_callback;
CopyOrCreateWorkItem() {} CopyOrCreateWorkItem()
: src_path(""),
dst_path(""),
contents(""),
src_env(nullptr),
dst_env(nullptr),
sync(false),
rate_limiter(nullptr),
size_limit(0) {}
CopyOrCreateWorkItem(const CopyOrCreateWorkItem&) = delete; CopyOrCreateWorkItem(const CopyOrCreateWorkItem&) = delete;
CopyOrCreateWorkItem& operator=(const CopyOrCreateWorkItem&) = delete; CopyOrCreateWorkItem& operator=(const CopyOrCreateWorkItem&) = delete;
@ -373,7 +382,13 @@ class BackupEngineImpl : public BackupEngine {
std::string dst_path_tmp; std::string dst_path_tmp;
std::string dst_path; std::string dst_path;
std::string dst_relative; std::string dst_relative;
BackupAfterCopyOrCreateWorkItem() {} BackupAfterCopyOrCreateWorkItem()
: shared(false),
needed_to_copy(false),
backup_env(nullptr),
dst_path_tmp(""),
dst_path(""),
dst_relative("") {}
BackupAfterCopyOrCreateWorkItem(BackupAfterCopyOrCreateWorkItem&& o) BackupAfterCopyOrCreateWorkItem(BackupAfterCopyOrCreateWorkItem&& o)
ROCKSDB_NOEXCEPT { ROCKSDB_NOEXCEPT {
@ -409,7 +424,8 @@ class BackupEngineImpl : public BackupEngine {
struct RestoreAfterCopyOrCreateWorkItem { struct RestoreAfterCopyOrCreateWorkItem {
std::future<CopyOrCreateResult> result; std::future<CopyOrCreateResult> result;
uint32_t checksum_value; uint32_t checksum_value;
RestoreAfterCopyOrCreateWorkItem() {} RestoreAfterCopyOrCreateWorkItem()
: checksum_value(0) {}
RestoreAfterCopyOrCreateWorkItem(std::future<CopyOrCreateResult>&& _result, RestoreAfterCopyOrCreateWorkItem(std::future<CopyOrCreateResult>&& _result,
uint32_t _checksum_value) uint32_t _checksum_value)
: result(std::move(_result)), checksum_value(_checksum_value) {} : result(std::move(_result)), checksum_value(_checksum_value) {}
@ -495,6 +511,8 @@ BackupEngineImpl::BackupEngineImpl(Env* db_env,
const BackupableDBOptions& options, const BackupableDBOptions& options,
bool read_only) bool read_only)
: initialized_(false), : initialized_(false),
latest_backup_id_(0),
latest_valid_backup_id_(0),
stop_backup_(false), stop_backup_(false),
options_(options), options_(options),
db_env_(db_env), db_env_(db_env),

Loading…
Cancel
Save