Parcourir la source

Converted two for-loops to while-loops.

Converted `for (;<condition>;)` to `while (<condition>)`.

PiperOrigin-RevId: 247950510
main
Chris Mumford il y a 5 ans
Parent
révision
1d0b101165
2 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. +1
    -1
      db/db_impl.cc
  2. +1
    -1
      db/version_set.cc

+ 1
- 1
db/db_impl.cc Voir le fichier

@ -903,7 +903,7 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) {
std::string current_user_key; std::string current_user_key;
bool has_current_user_key = false; bool has_current_user_key = false;
SequenceNumber last_sequence_for_key = kMaxSequenceNumber; SequenceNumber last_sequence_for_key = kMaxSequenceNumber;
for (; input->Valid() && !shutting_down_.load(std::memory_order_acquire);) {
while (input->Valid() && !shutting_down_.load(std::memory_order_acquire)) {
// Prioritize immutable compaction work // Prioritize immutable compaction work
if (has_imm_.load(std::memory_order_relaxed)) { if (has_imm_.load(std::memory_order_relaxed)) {
const uint64_t imm_start = env_->NowMicros(); const uint64_t imm_start = env_->NowMicros();

+ 1
- 1
db/version_set.cc Voir le fichier

@ -1532,7 +1532,7 @@ bool Compaction::IsBaseLevelForKey(const Slice& user_key) {
const Comparator* user_cmp = input_version_->vset_->icmp_.user_comparator(); const Comparator* user_cmp = input_version_->vset_->icmp_.user_comparator();
for (int lvl = level_ + 2; lvl < config::kNumLevels; lvl++) { for (int lvl = level_ + 2; lvl < config::kNumLevels; lvl++) {
const std::vector<FileMetaData*>& files = input_version_->files_[lvl]; const std::vector<FileMetaData*>& files = input_version_->files_[lvl];
for (; level_ptrs_[lvl] < files.size();) {
while (level_ptrs_[lvl] < files.size()) {
FileMetaData* f = files[level_ptrs_[lvl]]; FileMetaData* f = files[level_ptrs_[lvl]];
if (user_cmp->Compare(user_key, f->largest.user_key()) <= 0) { if (user_cmp->Compare(user_key, f->largest.user_key()) <= 0) {
// We've advanced far enough // We've advanced far enough

Chargement…
Annuler
Enregistrer