Skip to content

Commit

Permalink
Merge pull request #509 from lylei/dead
Browse files Browse the repository at this point in the history
do not concider block lost if it is empty #508
  • Loading branch information
bluebore authored Oct 9, 2016
2 parents 17f5a8e + 6d699eb commit 07150c8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/nameserver/block_mapping.cc
Original file line number Diff line number Diff line change
Expand Up @@ -816,12 +816,17 @@ void BlockMapping::TryRecover(NSBlock* block) {
}
int64_t block_id = block->id;
if (block->replica.size() < block->expect_replica_num) {
if (block->replica.size() == 0 && block->recover_stat != kLost) {
LOG(INFO, "[TryRecover] lost block #%ld ", block_id);
lost_blocks_.insert(block_id);
SetState(block, kLost);
lo_pri_recover_.erase(block_id);
hi_pri_recover_.erase(block_id);
if (block->replica.size() == 0) {
if (block->block_size && block->recover_stat != kLost) {
LOG(INFO, "[TryRecover] lost block #%ld ", block_id);
lost_blocks_.insert(block_id);
SetState(block, kLost);
lo_pri_recover_.erase(block_id);
hi_pri_recover_.erase(block_id);
} else if (block->block_size == 0 && block->recover_stat == kLost) {
lost_blocks_.erase(block_id);
LOG(WARNING, "[TryRecover] empty block #%ld remove from lost", block_id);
}
} else if (block->replica.size() == 1 && block->recover_stat != kHiRecover) {
hi_pri_recover_.insert(block_id);
LOG(INFO, "[TryRecover] need more recover: #%ld %s->kHiRecover",
Expand Down

0 comments on commit 07150c8

Please sign in to comment.