Skip to content

Commit

Permalink
HBASE-23596 HBCKServerCrashProcedure can double assign
Browse files Browse the repository at this point in the history
  • Loading branch information
saintstack committed Dec 19, 2019
1 parent 683ce0c commit f7a5314
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.apache.hadoop.hbase.MetaTableAccessor;
import org.apache.hadoop.hbase.ServerName;
Expand Down Expand Up @@ -84,12 +86,12 @@ List<RegionInfo> getRegionsOnCrashedServer(MasterProcedureEnv env) {
LOG.warn("No regions found in hbase:meta");
return ris;
}
List<RegionInfo> aggregate = ris == null || ris.isEmpty()?
new ArrayList<>(): new ArrayList<>(ris);
// Use a Set here in case same Region in master memory and in hbase:meta (the usual case!).
Set<RegionInfo> aggregate = ris == null || ris.isEmpty()? new HashSet<>(): new HashSet<>(ris);
int before = aggregate.size();
ps.stream().filter(p -> p.getSecond() != null && p.getSecond().equals(getServerName())).
forEach(p -> aggregate.add(p.getFirst()));
LOG.info("Found {} mentions of {} in hbase:meta", aggregate.size() - before, getServerName());
return aggregate;
return new ArrayList<RegionInfo>(aggregate);
}
}

0 comments on commit f7a5314

Please sign in to comment.