mirror of https://github.com/facebook/rocksdb.git
Make "make analyze" happy
Summary: "make analyze" is reporting some errors. It's complicated to look but it seems to me that they are all false positive. Anyway, I think cleaning them up is a good idea. Some of the changes are hacky but I don't know a better way. Closes https://github.com/facebook/rocksdb/pull/2508 Differential Revision: D5341710 Pulled By: siying fbshipit-source-id: 6070e430e0e41a080ef441e05e8ec827d45efab6
This commit is contained in:
parent
01534db24c
commit
18c63af6ef
|
@ -142,7 +142,7 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
|
|||
WriteContext write_context;
|
||||
WriteThread::WriteGroup write_group;
|
||||
bool in_parallel_group = false;
|
||||
uint64_t last_sequence;
|
||||
uint64_t last_sequence = kMaxSequenceNumber;
|
||||
if (!concurrent_prepare_) {
|
||||
last_sequence = versions_->LastSequence();
|
||||
}
|
||||
|
@ -247,6 +247,7 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
|
|||
last_sequence = versions_->FetchAddLastToBeWrittenSequence(total_count);
|
||||
}
|
||||
}
|
||||
assert(last_sequence != kMaxSequenceNumber);
|
||||
const SequenceNumber current_sequence = last_sequence + 1;
|
||||
last_sequence += total_count;
|
||||
|
||||
|
|
|
@ -644,6 +644,7 @@ void DBIter::ReverseToBackward() {
|
|||
while (iter_->Valid() &&
|
||||
user_comparator_->Compare(ikey.user_key, saved_key_.GetUserKey()) >
|
||||
0) {
|
||||
assert(ikey.sequence != kMaxSequenceNumber);
|
||||
if (ikey.sequence > sequence_) {
|
||||
PERF_COUNTER_ADD(internal_recent_skipped_count, 1);
|
||||
} else {
|
||||
|
@ -956,6 +957,7 @@ void DBIter::FindPrevUserKey() {
|
|||
++num_skipped;
|
||||
}
|
||||
}
|
||||
assert(ikey.sequence != kMaxSequenceNumber);
|
||||
if (ikey.sequence > sequence_) {
|
||||
PERF_COUNTER_ADD(internal_recent_skipped_count, 1);
|
||||
} else {
|
||||
|
|
|
@ -80,7 +80,9 @@ struct ParsedInternalKey {
|
|||
SequenceNumber sequence;
|
||||
ValueType type;
|
||||
|
||||
ParsedInternalKey() { } // Intentionally left uninitialized (for speed)
|
||||
ParsedInternalKey()
|
||||
: sequence(kMaxSequenceNumber) // Make code analyzer happy
|
||||
{} // 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;
|
||||
|
|
|
@ -1230,7 +1230,7 @@ Status BlobDBImpl::CommonGet(const ColumnFamilyData* cfd, const Slice& key,
|
|||
}
|
||||
|
||||
// 0 - size
|
||||
if (!handle.size()) {
|
||||
if (!handle.size() && value != nullptr) {
|
||||
value->clear();
|
||||
return Status::OK();
|
||||
}
|
||||
|
|
|
@ -35,17 +35,7 @@ class BlobDBTest : public testing::Test {
|
|||
void Open(BlobDBOptionsImpl bdb_options = BlobDBOptionsImpl(),
|
||||
Options options = Options()) {
|
||||
options.create_if_missing = true;
|
||||
Reopen(bdb_options, options);
|
||||
}
|
||||
|
||||
void Reopen(BlobDBOptionsImpl bdb_options = BlobDBOptionsImpl(),
|
||||
Options options = Options()) {
|
||||
if (blob_db_) {
|
||||
delete blob_db_;
|
||||
blob_db_ = nullptr;
|
||||
}
|
||||
ASSERT_OK(BlobDB::Open(options, bdb_options, dbname_, &blob_db_));
|
||||
ASSERT_TRUE(blob_db_);
|
||||
}
|
||||
|
||||
void Destroy() {
|
||||
|
|
Loading…
Reference in New Issue