Skip to content

Commit

Permalink
"make format" against last 10 commits
Browse files Browse the repository at this point in the history
Summary: This helps Windows port to format their changes, as discussed. Might have formatted some other codes too becasue last 10 commits include more.

Test Plan: Build it.

Reviewers: anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, igor

Reviewed By: igor

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D41961
  • Loading branch information
siying committed Jul 13, 2015
1 parent 76d3cd3 commit f972864
Show file tree
Hide file tree
Showing 60 changed files with 1,975 additions and 2,184 deletions.
21 changes: 9 additions & 12 deletions db/c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2256,7 +2256,7 @@ void rocksdb_env_set_high_priority_background_threads(rocksdb_env_t* env, int n)
}

void rocksdb_env_join_all_threads(rocksdb_env_t* env) {
env->rep->WaitForJoin();
env->rep->WaitForJoin();
}

void rocksdb_env_destroy(rocksdb_env_t* env) {
Expand Down Expand Up @@ -2449,19 +2449,16 @@ extern void rocksdb_livefiles_destroy(
delete lf;
}

void rocksdb_get_options_from_string(
const rocksdb_options_t* base_options,
const char* opts_str, rocksdb_options_t* new_options,
char** errptr){
SaveError(errptr,
GetOptionsFromString(base_options->rep,
std::string(opts_str), &new_options->rep));
void rocksdb_get_options_from_string(const rocksdb_options_t* base_options,
const char* opts_str,
rocksdb_options_t* new_options,
char** errptr) {
SaveError(errptr,
GetOptionsFromString(base_options->rep, std::string(opts_str),
&new_options->rep));
}

void rocksdb_free(
void* ptr){
free(ptr);
}
void rocksdb_free(void* ptr) { free(ptr); }

} // end extern "C"

Expand Down
3 changes: 2 additions & 1 deletion db/compaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ const char* Compaction::InputLevelSummary(
is_first = false;
}
len += snprintf(scratch->buffer + len, sizeof(scratch->buffer) - len,
"%" ROCKSDB_PRIszt "@%d", input_level.size(), input_level.level);
"%" ROCKSDB_PRIszt "@%d", input_level.size(),
input_level.level);
}
snprintf(scratch->buffer + len, sizeof(scratch->buffer) - len,
" files to L%d", output_level());
Expand Down
4 changes: 1 addition & 3 deletions db/compaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ class Compaction {
bool IsTrivialMove() const;

// If true, then the compaction can be done by simply deleting input files.
bool deletion_compaction() const {
return deletion_compaction_;
}
bool deletion_compaction() const { return deletion_compaction_; }

// Add all inputs to this compaction as delete operations to *edit.
void AddInputDeletions(VersionEdit* edit);
Expand Down
4 changes: 2 additions & 2 deletions db/compaction_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void CompactionJob::ReportStartedCompaction(

ThreadStatusUtil::SetThreadOperationProperty(
ThreadStatus::COMPACTION_PROP_FLAGS,
compaction->is_manual_compaction() +
compaction->is_manual_compaction() +
(compaction->deletion_compaction() << 1));

ThreadStatusUtil::SetThreadOperationProperty(
Expand All @@ -263,7 +263,7 @@ void CompactionJob::ReportStartedCompaction(

if (compaction_job_stats_) {
compaction_job_stats_->is_manual_compaction =
compaction->is_manual_compaction();
compaction->is_manual_compaction();
}
}

Expand Down
4 changes: 1 addition & 3 deletions db/compaction_job_stats_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,5 @@ int main(int argc, char** argv) {

#else

int main(int argc, char** argv) {
return 0;
}
int main(int argc, char** argv) { return 0; }
#endif // !defined(IOS_CROSS_COMPILE)
11 changes: 4 additions & 7 deletions db/compaction_job_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,9 @@ void VerifyInitializationOfCompactionJobStats(
#endif // !defined(IOS_CROSS_COMPILE)
}

void VerifyCompactionJobStats(
const CompactionJobStats& compaction_job_stats,
const std::vector<FileMetaData*>& files,
size_t num_output_files) {
void VerifyCompactionJobStats(const CompactionJobStats& compaction_job_stats,
const std::vector<FileMetaData*>& files,
size_t num_output_files) {
ASSERT_GE(compaction_job_stats.elapsed_micros, 0U);
ASSERT_EQ(compaction_job_stats.num_input_files, files.size());
ASSERT_EQ(compaction_job_stats.num_output_files, num_output_files);
Expand Down Expand Up @@ -219,9 +218,7 @@ TEST_F(CompactionJobTest, Simple) {
ASSERT_OK(s);
mutex_.Unlock();

VerifyCompactionJobStats(
compaction_job_stats,
files, 1);
VerifyCompactionJobStats(compaction_job_stats, files, 1);

mock_table_factory_->AssertLatestFile(expected_results);
ASSERT_EQ(yield_callback_called, 20000);
Expand Down
8 changes: 5 additions & 3 deletions db/compaction_picker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,9 @@ bool CompactionPicker::SetupOtherInputs(
if (expanded1.size() == output_level_inputs->size() &&
!FilesInCompaction(expanded1)) {
Log(InfoLogLevel::INFO_LEVEL, ioptions_.info_log,
"[%s] Expanding@%d %" ROCKSDB_PRIszt "+%" ROCKSDB_PRIszt "(%" PRIu64 "+%" PRIu64
" bytes) to %" ROCKSDB_PRIszt "+%" ROCKSDB_PRIszt " (%" PRIu64 "+%" PRIu64 "bytes)\n",
"[%s] Expanding@%d %" ROCKSDB_PRIszt "+%" ROCKSDB_PRIszt "(%" PRIu64
"+%" PRIu64 " bytes) to %" ROCKSDB_PRIszt "+%" ROCKSDB_PRIszt
" (%" PRIu64 "+%" PRIu64 "bytes)\n",
cf_name.c_str(), input_level, inputs->size(),
output_level_inputs->size(), inputs0_size, inputs1_size,
expanded0.size(), expanded1.size(), expanded0_size, inputs1_size);
Expand Down Expand Up @@ -1225,7 +1226,8 @@ Compaction* UniversalCompactionPicker::PickCompaction(
return nullptr;
}
VersionStorageInfo::LevelSummaryStorage tmp;
LogToBuffer(log_buffer, 3072, "[%s] Universal: sorted runs files(%" ROCKSDB_PRIszt "): %s\n",
LogToBuffer(log_buffer, 3072,
"[%s] Universal: sorted runs files(%" ROCKSDB_PRIszt "): %s\n",
cf_name.c_str(), sorted_runs.size(),
vstorage->LevelSummary(&tmp));

Expand Down
6 changes: 3 additions & 3 deletions db/db_bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main() {
#include "utilities/merge_operators.h"

#ifdef OS_WIN
#include <io.h> // open/close
#include <io.h> // open/close
#endif

using GFLAGS::ParseCommandLineFlags;
Expand Down Expand Up @@ -3544,8 +3544,8 @@ class Benchmark {

char msg[100];
snprintf(msg, sizeof(msg),
"(reads:%" PRIu64 " merges:%" PRIu64 " total:%" PRIu64 " hits:%" \
PRIu64 " maxlength:%" ROCKSDB_PRIszt ")",
"(reads:%" PRIu64 " merges:%" PRIu64 " total:%" PRIu64
" hits:%" PRIu64 " maxlength:%" ROCKSDB_PRIszt ")",
num_gets, num_merges, readwrites_, num_hits, max_length);
thread->stats.AddMessage(msg);
}
Expand Down
10 changes: 5 additions & 5 deletions db/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1631,9 +1631,9 @@ Status DBImpl::CompactFilesImpl(
CompactionJob compaction_job(
job_context->job_id, c.get(), db_options_, env_options_, versions_.get(),
&shutting_down_, log_buffer, directories_.GetDbDir(),
directories_.GetDataDir(c->output_path_id()), stats_,
snapshots_.GetAll(), table_cache_, std::move(yield_callback),
&event_logger_, c->mutable_cf_options()->paranoid_file_checks, dbname_,
directories_.GetDataDir(c->output_path_id()), stats_, snapshots_.GetAll(),
table_cache_, std::move(yield_callback), &event_logger_,
c->mutable_cf_options()->paranoid_file_checks, dbname_,
nullptr); // Here we pass a nullptr for CompactionJobStats because
// CompactFiles does not trigger OnCompactionCompleted(),
// which is the only place where CompactionJobStats is
Expand Down Expand Up @@ -2602,8 +2602,8 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress, JobContext* job_context,
versions_.get(), &shutting_down_, log_buffer, directories_.GetDbDir(),
directories_.GetDataDir(c->output_path_id()), stats_,
snapshots_.GetAll(), table_cache_, std::move(yield_callback),
&event_logger_, c->mutable_cf_options()->paranoid_file_checks,
dbname_, &compaction_job_stats);
&event_logger_, c->mutable_cf_options()->paranoid_file_checks, dbname_,
&compaction_job_stats);
compaction_job.Prepare();

mutex_.Unlock();
Expand Down
Loading

0 comments on commit f972864

Please sign in to comment.