HBASE-6608 Fix for HBASE-6160, META entries from daughters can be deleted before parent entries, shouldn't compare HRegionInfo's (Enis)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1374676 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-08-18 23:34:17 +00:00
parent 58cda3d938
commit 81f5222ab9
2 changed files with 10 additions and 5 deletions

View File

@ -153,14 +153,18 @@ class CatalogJanitor extends Chore {
// Now work on our list of found parents. See if any we can clean up.
int cleaned = 0;
HashSet<HRegionInfo> parentNotCleaned = new HashSet<HRegionInfo>(); //regions whose parents are still around
//regions whose parents are still around
HashSet<String> parentNotCleaned = new HashSet<String>();
for (Map.Entry<HRegionInfo, Result> e : splitParents.entrySet()) {
if (!parentNotCleaned.contains(e.getKey()) && cleanParent(e.getKey(), e.getValue())) {
if (!parentNotCleaned.contains(e.getKey().getEncodedName()) &&
cleanParent(e.getKey(), e.getValue())) {
cleaned++;
} else {
// We could not clean the parent, so it's daughters should not be cleaned either (HBASE-6160)
parentNotCleaned.add(getDaughterRegionInfo(e.getValue(), HConstants.SPLITA_QUALIFIER));
parentNotCleaned.add(getDaughterRegionInfo(e.getValue(), HConstants.SPLITB_QUALIFIER));
// We could not clean the parent, so its daughters should not be cleaned either(HBASE-6160)
parentNotCleaned.add(
getDaughterRegionInfo(e.getValue(), HConstants.SPLITA_QUALIFIER).getEncodedName());
parentNotCleaned.add(
getDaughterRegionInfo(e.getValue(), HConstants.SPLITB_QUALIFIER).getEncodedName());
}
}
if (cleaned != 0) {

View File

@ -542,6 +542,7 @@ public class TestCatalogJanitor {
final Map<HRegionInfo, Result> splitParents =
new TreeMap<HRegionInfo, Result>(new SplitParentFirstComparator());
splitParents.put(parent, makeResultFromHRegionInfo(parent, splita, splitb));
splita.setOffline(true); //simulate that splita goes offline when it is split
splitParents.put(splita, makeResultFromHRegionInfo(splita, splitaa, splitab));
CatalogJanitor janitor = spy(new CatalogJanitor(server, services));