Skip to content

Commit

Permalink
Make code more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
yangce committed Mar 28, 2017
1 parent a33f027 commit 85c9c3d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/nameserver/namespace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -728,14 +728,13 @@ bool NameSpace::RebuildBlockMap(std::function<void (const FileInfo&)> callback)
}
LOG(INFO, "Check orphan done, %lu entries", orphan_entrys.size());
if (FLAGS_remove_orphan_entry) {
for (std::vector<std::pair<std::string, std::string> >::iterator it =
orphan_entrys.begin(); it != orphan_entrys.end(); ++it) {
for (auto& it : orphan_entrys) {
int64_t entry_id;
std::string name;
DecodingStoreKey((*it).first, &entry_id, &name);
DecodingStoreKey(it.first, &entry_id, &name);
FileInfo file_info;
file_info.ParseFromArray((*it).second.data(), (*it).second.size());
db_->Delete(leveldb::WriteOptions(), (*it).first);
file_info.ParseFromArray(it.second.data(), it.second.size());
db_->Delete(leveldb::WriteOptions(), it.first);
LOG(INFO, "Remove orphan entry E%ld", entry_id);
}
}
Expand Down

0 comments on commit 85c9c3d

Please sign in to comment.