HBASE-3863 Fix failing TestHBaseFsck.testHBaseFsckMeta unit test

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1100095 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-05-06 06:25:29 +00:00
parent f046c79c41
commit 1bd0e5ff51
3 changed files with 28 additions and 21 deletions

View File

@ -311,7 +311,7 @@ public class MetaScanner {
return true;
}
};
metaScan(conf, visitor);
metaScan(conf, visitor, tablename);
return regions;
}

View File

@ -25,7 +25,6 @@ import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HServerAddress;
import org.apache.hadoop.hbase.NotServingRegionException;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
@ -104,8 +103,8 @@ public class HBaseFsckRepair {
HConnection connection = HConnectionManager.getConnection(conf);
boolean success = false;
try {
HRegionInterface rs = connection.getHRegionConnection(new HServerAddress(
server.getHostname(), server.getPort()));
HRegionInterface rs =
connection.getHRegionConnection(server.getHostname(), server.getPort());
rs.closeRegion(region, false);
long timeout = conf.getLong("hbase.hbck.close.timeout", 120000);
long expiration = timeout + System.currentTimeMillis();

View File

@ -19,27 +19,33 @@
*/
package org.apache.hadoop.hbase.util;
import static org.apache.hadoop.hbase.util.HBaseFsck.ErrorReporter.ERROR_CODE;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.*;
import org.apache.hadoop.hbase.client.*;
import org.apache.hadoop.hbase.ipc.HRegionInterface;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HServerAddress;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.util.HBaseFsck.ErrorReporter.ERROR_CODE;
import org.junit.BeforeClass;
import org.junit.Test;
public class TestHBaseFsck {
@ -142,8 +148,10 @@ public class TestHBaseFsck {
HTable tbl = TEST_UTIL.createTable(Bytes.toBytes("table2"), FAM);
HRegionInfo hriOrig = tbl.getRegionsInfo().keySet().iterator().next();
HServerAddress rsAddressOrig = tbl.getRegionsInfo().get(hriOrig);
Map<HRegionInfo, HServerAddress> hris = tbl.getRegionsInfo();
HRegionInfo hriOrig = hris.keySet().iterator().next();
Map<HRegionInfo, ServerName> locations = tbl.getRegionLocations();
ServerName rsAddressOrig = locations.get(hriOrig);
byte[][] startKeys = new byte[][]{
HConstants.EMPTY_BYTE_ARRAY,