Skip to content

Commit

Permalink
Fix coverity issues in include/rocksdb
Browse files Browse the repository at this point in the history
Summary:
include/rocksdb/metadata.h:
struct ColumnFamilyMetaData {

CID 1322804 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
2. uninit_member: Non-static class member file_count is not initialized in this constructor nor in any functions that it calls.

struct SstFileMetaData {
        2. uninit_member: Non-static class member size is not initialized in this constructor nor in any functions that it calls.
        4. uninit_member: Non-static class member smallest_seqno is not initialized in this constructor nor in any functions that it calls.
        6. uninit_member: Non-static class member largest_seqno is not initialized in this constructor nor in any functions that it calls.
        8. uninit_member: Non-static class member num_reads_sampled is not initialized in this constructor nor in any functions that it calls.

CID 1322807 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
10. uninit_member: Non-static class member being_compacted is not initialized in this constructor nor in any functions that it calls.

include/rocksdb/sst_file_writer.h:
struct ExternalSstFileInfo {
        2. uninit_member: Non-static class member sequence_number is not initialized in this constructor nor in any functions that it calls.
        4. uninit_member: Non-static class member file_size is not initialized in this constructor nor in any functions that it calls.
        6. uninit_member: Non-static class member num_entries is not initialized in this constructor nor in any functions that it calls.

CID 1351697 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
8. uninit_member: Non-static class member version is not initialized in this constructor nor in any functions that it calls.
 31  ExternalSstFileInfo() {}

include/rocksdb/utilities/transaction.h:
explicit Transaction(const TransactionDB* db) {}
        2. uninit_member: Non-static class member log_number_ is not initialized in this constructor nor in any functions that it calls.

CID 1396133 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
4. uninit_member: Non-static class member field txn_state_._M_i is not initialized in this constructor nor in any functions that it calls.
473  Transaction() {}
Closes facebook#3100

Differential Revision: D6227651

Pulled By: sagar0

fbshipit-source-id: 5caa4a2cf9471d1f9c3c073f81473636e1f0aa14
  • Loading branch information
Prashant D authored and facebook-github-bot committed Nov 3, 2017
1 parent 62578d8 commit 602fe94
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
13 changes: 11 additions & 2 deletions include/rocksdb/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct SstFileMetaData;

// The metadata that describes a column family.
struct ColumnFamilyMetaData {
ColumnFamilyMetaData() : size(0), name("") {}
ColumnFamilyMetaData() : size(0), file_count(0), name("") {}
ColumnFamilyMetaData(const std::string& _name, uint64_t _size,
const std::vector<LevelMetaData>&& _levels) :
size(_size), name(_name), levels(_levels) {}
Expand Down Expand Up @@ -54,7 +54,16 @@ struct LevelMetaData {

// The metadata that describes a SST file.
struct SstFileMetaData {
SstFileMetaData() {}
SstFileMetaData()
: size(0),
name(""),
db_path(""),
smallest_seqno(0),
largest_seqno(0),
smallestkey(""),
largestkey(""),
num_reads_sampled(0),
being_compacted(false) {}
SstFileMetaData(const std::string& _file_name, const std::string& _path,
uint64_t _size, SequenceNumber _smallest_seqno,
SequenceNumber _largest_seqno,
Expand Down
10 changes: 9 additions & 1 deletion include/rocksdb/sst_file_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ class Comparator;
// ExternalSstFileInfo include information about sst files created
// using SstFileWriter.
struct ExternalSstFileInfo {
ExternalSstFileInfo() {}
ExternalSstFileInfo()
: file_path(""),
smallest_key(""),
largest_key(""),
sequence_number(0),
file_size(0),
num_entries(0),
version(0) {}

ExternalSstFileInfo(const std::string& _file_path,
const std::string& _smallest_key,
const std::string& _largest_key,
Expand Down
2 changes: 1 addition & 1 deletion include/rocksdb/utilities/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ class Transaction {

protected:
explicit Transaction(const TransactionDB* db) {}
Transaction() {}
Transaction() : log_number_(0), txn_state_(STARTED) {}

// the log in which the prepared section for this txn resides
// (for two phase commit)
Expand Down

0 comments on commit 602fe94

Please sign in to comment.