Skip to content

Commit

Permalink
Fix coverity issues compaction_job, compaction_picker
Browse files Browse the repository at this point in the history
Summary:
db/compaction_job.cc:
  ReportStartedCompaction(compaction);

CID 1419863 (ceph#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 (ceph#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 (ceph#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 facebook#3091

Differential Revision: D6534558

Pulled By: yiwu-arbug

fbshipit-source-id: 5ada975956196d267b3f149386842af71eda7553
  • Loading branch information
Prashant D authored and facebook-github-bot committed Dec 11, 2017
1 parent e3814a8 commit 6a183d1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions db/compaction_job.cc
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion db/compaction_picker_universal.cc
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion db/dbformat.h
Expand Up @@ -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;
Expand Down

0 comments on commit 6a183d1

Please sign in to comment.