Fixed nullptr deref and added assert
Summary: Fixes two minor issues in CompactionJob. CompactionJob::Run() dereferences log_buffer_ without a check, so this patch adds an assert in the constructor where log_buffer_ is assigned. compaction_job_stats_ can be null but ProcessKeyValueCompaction was dereferencing it without a check. Test Plan: make && make check Reviewers: sdong, rven, yhchiang, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D42231
This commit is contained in:
parent
1bc8eb8777
commit
ddad40e930
@ -211,6 +211,7 @@ CompactionJob::CompactionJob(
|
||||
yield_callback_(std::move(yield_callback)),
|
||||
event_logger_(event_logger),
|
||||
paranoid_file_checks_(paranoid_file_checks) {
|
||||
assert(log_buffer_ != nullptr);
|
||||
ThreadStatusUtil::SetColumnFamily(compact_->compaction->column_family_data());
|
||||
ThreadStatusUtil::SetThreadOperation(ThreadStatus::OP_COMPACTION);
|
||||
ReportStartedCompaction(compaction);
|
||||
@ -646,7 +647,7 @@ Status CompactionJob::ProcessKeyValueCompaction(int64_t* imm_micros,
|
||||
last_sequence_for_key = kMaxSequenceNumber;
|
||||
visible_in_snapshot = kMaxSequenceNumber;
|
||||
} else {
|
||||
if (ikey.type == kTypeDeletion) {
|
||||
if (compaction_job_stats_ != nullptr && ikey.type == kTypeDeletion) {
|
||||
compaction_job_stats_->num_input_deletion_records++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user