From 6a183d1ae82fe6a1098a308396fd663b28f70f16 Mon Sep 17 00:00:00 2001 From: Prashant D Date: Mon, 11 Dec 2017 11:48:47 -0800 Subject: [PATCH] Fix coverity issues compaction_job, compaction_picker Summary: db/compaction_job.cc: ReportStartedCompaction(compaction); CID 1419863 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member bottommost_level_ is not initialized in this constructor nor in any functions that it calls. db/compaction_picker_universal.cc: 7struct InputFileInfo { 2. uninit_member: Non-static class member level is not initialized in this constructor nor in any functions that it calls. CID 1405355 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 4. uninit_member: Non-static class member index is not initialized in this constructor nor in any functions that it calls. 38 InputFileInfo() : f(nullptr) {} db/dbformat.h: ParsedInternalKey() 84 : sequence(kMaxSequenceNumber) // Make code analyzer happy CID 1168095 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member type is not initialized in this constructor nor in any functions that it calls. 85 {} // Intentionally left uninitialized (for speed) Closes https://github.com/facebook/rocksdb/pull/3091 Differential Revision: D6534558 Pulled By: yiwu-arbug fbshipit-source-id: 5ada975956196d267b3f149386842af71eda7553 --- db/compaction_job.cc | 1 + db/compaction_picker_universal.cc | 2 +- db/dbformat.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/db/compaction_job.cc b/db/compaction_job.cc index 8886e18c469..112e6b45e40 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -297,6 +297,7 @@ CompactionJob::CompactionJob( snapshot_checker_(snapshot_checker), table_cache_(std::move(table_cache)), event_logger_(event_logger), + bottommost_level_(false), paranoid_file_checks_(paranoid_file_checks), measure_io_stats_(measure_io_stats), write_hint_(Env::WLTH_NOT_SET) { diff --git a/db/compaction_picker_universal.cc b/db/compaction_picker_universal.cc index 14533fbcdd2..29632b7457f 100644 --- a/db/compaction_picker_universal.cc +++ b/db/compaction_picker_universal.cc @@ -35,7 +35,7 @@ namespace { // and the index of the file in that level struct InputFileInfo { - InputFileInfo() : f(nullptr) {} + InputFileInfo() : f(nullptr), level(0), index(0) {} FileMetaData* f; size_t level; diff --git a/db/dbformat.h b/db/dbformat.h index ac021d945c4..884a72d379d 100644 --- a/db/dbformat.h +++ b/db/dbformat.h @@ -87,7 +87,7 @@ struct ParsedInternalKey { ParsedInternalKey() : sequence(kMaxSequenceNumber) // Make code analyzer happy - {} // Intentionally left uninitialized (for speed) + {} // Intentionally left uninitialized (for speed) ParsedInternalKey(const Slice& u, const SequenceNumber& seq, ValueType t) : user_key(u), sequence(seq), type(t) { } std::string DebugString(bool hex = false) const;