Fix function name format according to google style

Summary: Change the naming style of getter and setters according to Google C++ style in compaction.h file

Test Plan: Compilation success

Reviewers: sdong

Reviewed By: sdong

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D41265
main
Poornima Chozhiyath Raman 10 years ago
parent e2e3d84b2c
commit 4bed00a44b
  1. 2
      db/compaction.cc
  2. 14
      db/compaction.h
  3. 18
      db/compaction_job.cc
  4. 8
      db/db_impl.cc
  5. 6
      db/db_test.cc

@ -174,7 +174,7 @@ bool Compaction::IsTrivialMove() const {
} }
return (start_level_ != output_level_ && num_input_levels() == 1 && return (start_level_ != output_level_ && num_input_levels() == 1 &&
input(0, 0)->fd.GetPathId() == GetOutputPathId() && input(0, 0)->fd.GetPathId() == output_path_id() &&
InputCompressionMatchesOutput() && InputCompressionMatchesOutput() &&
TotalFileSize(grandparents_) <= max_grandparent_overlap_bytes_); TotalFileSize(grandparents_) <= max_grandparent_overlap_bytes_);
} }

@ -109,20 +109,20 @@ class Compaction {
} }
// Maximum size of files to build during this compaction. // Maximum size of files to build during this compaction.
uint64_t MaxOutputFileSize() const { return max_output_file_size_; } uint64_t max_output_file_size() const { return max_output_file_size_; }
// What compression for output // What compression for output
CompressionType OutputCompressionType() const { return output_compression_; } CompressionType output_compression() const { return output_compression_; }
// Whether need to write output file to second DB path. // Whether need to write output file to second DB path.
uint32_t GetOutputPathId() const { return output_path_id_; } uint32_t output_path_id() const { return output_path_id_; }
// Is this a trivial compaction that can be implemented by just // Is this a trivial compaction that can be implemented by just
// moving a single input file to the next level (no merging or splitting) // moving a single input file to the next level (no merging or splitting)
bool IsTrivialMove() const; bool IsTrivialMove() const;
// If true, then the compaction can be done by simply deleting input files. // If true, then the compaction can be done by simply deleting input files.
bool IsDeletionCompaction() const { bool deletion_compaction() const {
return deletion_compaction_; return deletion_compaction_;
} }
@ -150,13 +150,13 @@ class Compaction {
double score() const { return score_; } double score() const { return score_; }
// Is this compaction creating a file in the bottom most level? // Is this compaction creating a file in the bottom most level?
bool BottomMostLevel() { return bottommost_level_; } bool bottommost_level() { return bottommost_level_; }
// Does this compaction include all sst files? // Does this compaction include all sst files?
bool IsFullCompaction() { return is_full_compaction_; } bool is_full_compaction() { return is_full_compaction_; }
// Was this compaction triggered manually by the client? // Was this compaction triggered manually by the client?
bool IsManualCompaction() { return is_manual_compaction_; } bool is_manual_compaction() { return is_manual_compaction_; }
// Used when allow_trivial_move option is set in // Used when allow_trivial_move option is set in
// Universal compaction. If all the input files are // Universal compaction. If all the input files are

@ -238,12 +238,12 @@ void CompactionJob::ReportStartedCompaction(
// In the current design, a CompactionJob is always created // In the current design, a CompactionJob is always created
// for non-trivial compaction. // for non-trivial compaction.
assert(compaction->IsTrivialMove() == false || assert(compaction->IsTrivialMove() == false ||
compaction->IsManualCompaction() == true); compaction->is_manual_compaction() == true);
ThreadStatusUtil::SetThreadOperationProperty( ThreadStatusUtil::SetThreadOperationProperty(
ThreadStatus::COMPACTION_PROP_FLAGS, ThreadStatus::COMPACTION_PROP_FLAGS,
compaction->IsManualCompaction() + compaction->is_manual_compaction() +
(compaction->IsDeletionCompaction() << 1)); (compaction->deletion_compaction() << 1));
ThreadStatusUtil::SetThreadOperationProperty( ThreadStatusUtil::SetThreadOperationProperty(
ThreadStatus::COMPACTION_TOTAL_INPUT_BYTES, ThreadStatus::COMPACTION_TOTAL_INPUT_BYTES,
@ -263,7 +263,7 @@ void CompactionJob::ReportStartedCompaction(
if (compaction_job_stats_) { if (compaction_job_stats_) {
compaction_job_stats_->is_manual_compaction = compaction_job_stats_->is_manual_compaction =
compaction->IsManualCompaction(); compaction->is_manual_compaction();
} }
} }
@ -298,7 +298,7 @@ void CompactionJob::Prepare() {
} }
// Is this compaction producing files at the bottommost level? // Is this compaction producing files at the bottommost level?
bottommost_level_ = compact_->compaction->BottomMostLevel(); bottommost_level_ = compact_->compaction->bottommost_level();
} }
Status CompactionJob::Run() { Status CompactionJob::Run() {
@ -864,7 +864,7 @@ Status CompactionJob::ProcessKeyValueCompaction(int64_t* imm_micros,
// Close output file if it is big enough // Close output file if it is big enough
if (compact_->builder->FileSize() >= if (compact_->builder->FileSize() >=
compact_->compaction->MaxOutputFileSize()) { compact_->compaction->max_output_file_size()) {
status = FinishCompactionOutputFile(input); status = FinishCompactionOutputFile(input);
if (!status.ok()) { if (!status.ok()) {
break; break;
@ -1160,7 +1160,7 @@ Status CompactionJob::OpenCompactionOutputFile() {
uint64_t file_number = versions_->NewFileNumber(); uint64_t file_number = versions_->NewFileNumber();
// Make the output file // Make the output file
std::string fname = TableFileName(db_options_.db_paths, file_number, std::string fname = TableFileName(db_options_.db_paths, file_number,
compact_->compaction->GetOutputPathId()); compact_->compaction->output_path_id());
Status s = env_->NewWritableFile(fname, &compact_->outfile, env_options_); Status s = env_->NewWritableFile(fname, &compact_->outfile, env_options_);
if (!s.ok()) { if (!s.ok()) {
@ -1174,7 +1174,7 @@ Status CompactionJob::OpenCompactionOutputFile() {
} }
CompactionState::Output out; CompactionState::Output out;
out.number = file_number; out.number = file_number;
out.path_id = compact_->compaction->GetOutputPathId(); out.path_id = compact_->compaction->output_path_id();
out.smallest.Clear(); out.smallest.Clear();
out.largest.Clear(); out.largest.Clear();
out.smallest_seqno = out.largest_seqno = 0; out.smallest_seqno = out.largest_seqno = 0;
@ -1198,7 +1198,7 @@ Status CompactionJob::OpenCompactionOutputFile() {
compact_->builder.reset(NewTableBuilder( compact_->builder.reset(NewTableBuilder(
*cfd->ioptions(), cfd->internal_comparator(), *cfd->ioptions(), cfd->internal_comparator(),
cfd->int_tbl_prop_collector_factories(), compact_->outfile.get(), cfd->int_tbl_prop_collector_factories(), compact_->outfile.get(),
compact_->compaction->OutputCompressionType(), compact_->compaction->output_compression(),
cfd->ioptions()->compression_opts, skip_filters)); cfd->ioptions()->compression_opts, skip_filters));
LogFlush(db_options_.info_log); LogFlush(db_options_.info_log);
return s; return s;

@ -1617,7 +1617,7 @@ Status DBImpl::CompactFilesImpl(
assert(c); assert(c);
c->SetInputVersion(version); c->SetInputVersion(version);
// deletion compaction currently not allowed in CompactFiles. // deletion compaction currently not allowed in CompactFiles.
assert(!c->IsDeletionCompaction()); assert(!c->deletion_compaction());
auto yield_callback = [&]() { auto yield_callback = [&]() {
return CallFlushDuringCompaction( return CallFlushDuringCompaction(
@ -1628,7 +1628,7 @@ Status DBImpl::CompactFilesImpl(
CompactionJob compaction_job( CompactionJob compaction_job(
job_context->job_id, c.get(), db_options_, env_options_, versions_.get(), job_context->job_id, c.get(), db_options_, env_options_, versions_.get(),
&shutting_down_, log_buffer, directories_.GetDbDir(), &shutting_down_, log_buffer, directories_.GetDbDir(),
directories_.GetDataDir(c->GetOutputPathId()), stats_, directories_.GetDataDir(c->output_path_id()), stats_,
snapshots_.GetAll(), table_cache_, std::move(yield_callback), snapshots_.GetAll(), table_cache_, std::move(yield_callback),
&event_logger_, c->mutable_cf_options()->paranoid_file_checks, dbname_, &event_logger_, c->mutable_cf_options()->paranoid_file_checks, dbname_,
nullptr); // Here we pass a nullptr for CompactionJobStats because nullptr); // Here we pass a nullptr for CompactionJobStats because
@ -2504,7 +2504,7 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress, JobContext* job_context,
if (!c) { if (!c) {
// Nothing to do // Nothing to do
LogToBuffer(log_buffer, "Compaction nothing to do"); LogToBuffer(log_buffer, "Compaction nothing to do");
} else if (c->IsDeletionCompaction()) { } else if (c->deletion_compaction()) {
// TODO(icanadi) Do we want to honor snapshots here? i.e. not delete old // TODO(icanadi) Do we want to honor snapshots here? i.e. not delete old
// file if there is alive snapshot pointing to it // file if there is alive snapshot pointing to it
assert(c->num_input_files(1) == 0); assert(c->num_input_files(1) == 0);
@ -2597,7 +2597,7 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress, JobContext* job_context,
CompactionJob compaction_job( CompactionJob compaction_job(
job_context->job_id, c.get(), db_options_, env_options_, job_context->job_id, c.get(), db_options_, env_options_,
versions_.get(), &shutting_down_, log_buffer, directories_.GetDbDir(), versions_.get(), &shutting_down_, log_buffer, directories_.GetDbDir(),
directories_.GetDataDir(c->GetOutputPathId()), stats_, directories_.GetDataDir(c->output_path_id()), stats_,
snapshots_.GetAll(), table_cache_, std::move(yield_callback), snapshots_.GetAll(), table_cache_, std::move(yield_callback),
&event_logger_, c->mutable_cf_options()->paranoid_file_checks, &event_logger_, c->mutable_cf_options()->paranoid_file_checks,
dbname_, &compaction_job_stats); dbname_, &compaction_job_stats);

@ -12292,7 +12292,7 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel2) {
"LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) {
Compaction* compaction = reinterpret_cast<Compaction*>(arg); Compaction* compaction = reinterpret_cast<Compaction*>(arg);
if (compaction->output_level() == 4) { if (compaction->output_level() == 4) {
ASSERT_TRUE(compaction->OutputCompressionType() == kLZ4Compression); ASSERT_TRUE(compaction->output_compression() == kLZ4Compression);
num_lz4.fetch_add(1); num_lz4.fetch_add(1);
} }
}); });
@ -12327,10 +12327,10 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel2) {
"LevelCompactionPicker::PickCompaction:Return", [&](void* arg) { "LevelCompactionPicker::PickCompaction:Return", [&](void* arg) {
Compaction* compaction = reinterpret_cast<Compaction*>(arg); Compaction* compaction = reinterpret_cast<Compaction*>(arg);
if (compaction->output_level() == 4 && compaction->start_level() == 3) { if (compaction->output_level() == 4 && compaction->start_level() == 3) {
ASSERT_TRUE(compaction->OutputCompressionType() == kZlibCompression); ASSERT_TRUE(compaction->output_compression() == kZlibCompression);
num_zlib.fetch_add(1); num_zlib.fetch_add(1);
} else { } else {
ASSERT_TRUE(compaction->OutputCompressionType() == kLZ4Compression); ASSERT_TRUE(compaction->output_compression() == kLZ4Compression);
num_lz4.fetch_add(1); num_lz4.fetch_add(1);
} }
}); });

Loading…
Cancel
Save