You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jm...@apache.org on 2013/02/20 18:48:20 UTC
svn commit: r1448318 [1/2] - in /hbase/branches/hbase-7290v2: ./
hbase-common/src/main/java/org/apache/hadoop/hbase/util/
hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/
hbase-it/src/test/java/org/apache/hadoop/hbase/ hbase-se...
Author: jmhsieh
Date: Wed Feb 20 17:48:19 2013
New Revision: 1448318
URL: http://svn.apache.org/r1448318
Log:
Merge online snapshot branch with trunk 2/20/13
Added:
hbase/branches/hbase-7290v2/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ReflectionUtils.java
- copied unchanged from r1448315, hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ReflectionUtils.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultStoreEngine.java
- copied unchanged from r1448315, hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultStoreEngine.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreEngine.java
- copied unchanged from r1448315, hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreEngine.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/ParallelSeekHandler.java
- copied unchanged from r1448315, hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/ParallelSeekHandler.java
Modified:
hbase/branches/hbase-7290v2/ (props changed)
hbase/branches/hbase-7290v2/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/TestBulkDeleteProtocol.java
hbase/branches/hbase-7290v2/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/RegionMovedException.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnection.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/EventHandler.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionPolicy.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactionPolicy.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactor.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java
hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
hbase/branches/hbase-7290v2/hbase-server/src/main/resources/hbase-default.xml
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestMetaReaderEditorNoCluster.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/client/HConnectionTestingUtility.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestLoadIncrementalHFiles.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestLoadIncrementalHFilesSplitRecovery.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestSecureLoadIncrementalHFiles.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestSecureLoadIncrementalHFilesSplitRecovery.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultCompactSelection.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/compactions/PerfTestCompactionPolicies.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestTablePermissions.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MockRegionServerServices.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
hbase/branches/hbase-7290v2/src/docbkx/configuration.xml
Propchange: hbase/branches/hbase-7290v2/
------------------------------------------------------------------------------
Merged /hbase/trunk:r1446174-1448315
Modified: hbase/branches/hbase-7290v2/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/TestBulkDeleteProtocol.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/TestBulkDeleteProtocol.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/TestBulkDeleteProtocol.java (original)
+++ hbase/branches/hbase-7290v2/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/TestBulkDeleteProtocol.java Wed Feb 20 17:48:19 2013
@@ -95,6 +95,7 @@ public class TestBulkDeleteProtocol {
rows++;
}
assertEquals(0, rows);
+ ht.close();
}
@Test
@@ -118,6 +119,7 @@ public class TestBulkDeleteProtocol {
rows++;
}
assertEquals(0, rows);
+ ht.close();
}
private long invokeBulkDeleteProtocol(byte[] tableName, final Scan scan, final int rowBatchSize,
@@ -147,6 +149,7 @@ public class TestBulkDeleteProtocol {
for (BulkDeleteResponse response : result.values()) {
noOfDeletedRows += response.getRowsDeleted();
}
+ ht.close();
return noOfDeletedRows;
}
@@ -177,6 +180,7 @@ public class TestBulkDeleteProtocol {
rows++;
}
assertEquals(90, rows);
+ ht.close();
}
@Test
@@ -205,6 +209,7 @@ public class TestBulkDeleteProtocol {
rows++;
}
assertEquals(100, rows);
+ ht.close();
}
@Test
@@ -235,6 +240,7 @@ public class TestBulkDeleteProtocol {
rows++;
}
assertEquals(100, rows);
+ ht.close();
}
@Test
@@ -282,6 +288,7 @@ public class TestBulkDeleteProtocol {
rows++;
}
assertEquals(100, rows);
+ ht.close();
}
@Test
@@ -328,6 +335,7 @@ public class TestBulkDeleteProtocol {
rows++;
}
assertEquals(100, rows);
+ ht.close();
}
@Test
@@ -412,6 +420,7 @@ public class TestBulkDeleteProtocol {
rows++;
}
assertEquals(100, rows);
+ ht.close();
}
private HTable createTable(byte[] tableName) throws IOException {
@@ -431,4 +440,4 @@ public class TestBulkDeleteProtocol {
put.add(FAMILY1, QUALIFIER3, value.getBytes());
return put;
}
-}
\ No newline at end of file
+}
Modified: hbase/branches/hbase-7290v2/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java (original)
+++ hbase/branches/hbase-7290v2/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java Wed Feb 20 17:48:19 2013
@@ -85,12 +85,12 @@ public class DistributedHBaseCluster ext
@Override
public AdminProtocol getAdminProtocol(ServerName serverName) throws IOException {
- return admin.getConnection().getAdmin(serverName.getHostname(), serverName.getPort());
+ return admin.getConnection().getAdmin(serverName);
}
@Override
public ClientProtocol getClientProtocol(ServerName serverName) throws IOException {
- return admin.getConnection().getClient(serverName.getHostname(), serverName.getPort());
+ return admin.getConnection().getClient(serverName);
}
@Override
@@ -193,7 +193,7 @@ public class DistributedHBaseCluster ext
return null;
}
- AdminProtocol client = connection.getAdmin(regionLoc.getHostname(), regionLoc.getPort());
+ AdminProtocol client = connection.getAdmin(regionLoc.getServerName());
ServerInfo info = ProtobufUtil.getServerInfo(client);
return ProtobufUtil.toServerName(info.getServerName());
}
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java Wed Feb 20 17:48:19 2013
@@ -33,42 +33,27 @@ import org.apache.hadoop.hbase.util.Addr
@InterfaceStability.Evolving
public class HRegionLocation implements Comparable<HRegionLocation> {
private final HRegionInfo regionInfo;
- private final String hostname;
- private final int port;
+ private final ServerName serverName;
private final long seqNum;
// Cache of the 'toString' result.
private String cachedString = null;
// Cache of the hostname + port
private String cachedHostnamePort;
- /**
- * Constructor
- * @param regionInfo the HRegionInfo for the region
- */
- public HRegionLocation(HRegionInfo regionInfo, final String hostname,
- final int port, final long seqNum) {
+ public HRegionLocation(HRegionInfo regionInfo, ServerName serverName, long seqNum) {
this.regionInfo = regionInfo;
- this.hostname = hostname;
- this.port = port;
+ this.serverName = serverName;
this.seqNum = seqNum;
}
/**
- * Test constructor w/o seqNum.
- */
- public HRegionLocation(HRegionInfo regionInfo, final String hostname, final int port) {
- this(regionInfo, hostname, port, 0);
- }
-
- /**
* @see java.lang.Object#toString()
*/
@Override
public synchronized String toString() {
if (this.cachedString == null) {
this.cachedString = "region=" + this.regionInfo.getRegionNameAsString() +
- ", hostname=" + this.hostname + ", port=" + this.port
- + ", seqNum=" + seqNum;
+ ", hostname=" + this.serverName + ", seqNum=" + seqNum;
}
return this.cachedString;
}
@@ -95,9 +80,7 @@ public class HRegionLocation implements
*/
@Override
public int hashCode() {
- int result = this.hostname.hashCode();
- result ^= this.port;
- return result;
+ return this.serverName.hashCode();
}
/** @return HRegionInfo */
@@ -106,11 +89,11 @@ public class HRegionLocation implements
}
public String getHostname() {
- return this.hostname;
+ return this.serverName.getHostname();
}
public int getPort() {
- return this.port;
+ return this.serverName.getPort();
}
public long getSeqNum() {
@@ -123,18 +106,16 @@ public class HRegionLocation implements
public synchronized String getHostnamePort() {
if (this.cachedHostnamePort == null) {
this.cachedHostnamePort =
- Addressing.createHostAndPortStr(this.hostname, this.port);
+ Addressing.createHostAndPortStr(this.getHostname(), this.getPort());
}
return this.cachedHostnamePort;
}
- //
- // Comparable
- //
+ public ServerName getServerName() {
+ return serverName;
+ }
public int compareTo(HRegionLocation o) {
- int result = this.hostname.compareTo(o.getHostname());
- if (result != 0) return result;
- return this.port - o.getPort();
+ return serverName.compareTo(o.getServerName());
}
}
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/RegionMovedException.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/RegionMovedException.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/RegionMovedException.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/RegionMovedException.java Wed Feb 20 17:48:19 2013
@@ -35,17 +35,19 @@ public class RegionMovedException extend
private final String hostname;
private final int port;
+ private final long startCode;
private final long locationSeqNum;
private static final String HOST_FIELD = "hostname=";
private static final String PORT_FIELD = "port=";
+ private static final String STARTCODE_FIELD = "startCode=";
private static final String LOCATIONSEQNUM_FIELD = "locationSeqNum=";
- public RegionMovedException(final String hostname, final int port,
- final long locationSeqNum) {
- super();
- this.hostname = hostname;
- this.port = port;
+
+ public RegionMovedException(ServerName serverName, long locationSeqNum) {
+ this.hostname = serverName.getHostname();
+ this.port = serverName.getPort();
+ this.startCode = serverName.getStartcode();
this.locationSeqNum = locationSeqNum;
}
@@ -57,6 +59,10 @@ public class RegionMovedException extend
return port;
}
+ public ServerName getServerName(){
+ return new ServerName(hostname, port, startCode);
+ }
+
public long getLocationSeqNum() {
return locationSeqNum;
}
@@ -69,22 +75,27 @@ public class RegionMovedException extend
public RegionMovedException(String s) {
int posHostname = s.indexOf(HOST_FIELD) + HOST_FIELD.length();
int posPort = s.indexOf(PORT_FIELD) + PORT_FIELD.length();
+ int posStartCode = s.indexOf(STARTCODE_FIELD) + STARTCODE_FIELD.length();
int posSeqNum = s.indexOf(LOCATIONSEQNUM_FIELD) + LOCATIONSEQNUM_FIELD.length();
String tmpHostname = null;
int tmpPort = -1;
+ long tmpStartCode = -1;
long tmpSeqNum = HConstants.NO_SEQNUM;
try {
// TODO: this whole thing is extremely brittle.
tmpHostname = s.substring(posHostname, s.indexOf(' ', posHostname));
- tmpPort = Integer.parseInt(s.substring(posPort, s.indexOf('.', posPort)));
+ tmpPort = Integer.parseInt(s.substring(posPort, s.indexOf(' ', posPort)));
+ tmpStartCode = Long.parseLong(s.substring(posStartCode, s.indexOf('.', posStartCode)));
tmpSeqNum = Long.parseLong(s.substring(posSeqNum, s.indexOf('.', posSeqNum)));
} catch (Exception ignored) {
- LOG.warn("Can't parse the hostname and the port from this string: " + s + ", continuing");
+ LOG.warn("Can't parse the hostname, port and startCode from this string: " +
+ s + ", continuing");
}
hostname = tmpHostname;
port = tmpPort;
+ startCode = tmpStartCode;
locationSeqNum = tmpSeqNum;
}
@@ -92,8 +103,8 @@ public class RegionMovedException extend
public String getMessage() {
// TODO: deserialization above depends on this. That is bad, but also means this
// should be modified carefully.
- return "Region moved to: " + HOST_FIELD + hostname + " " + PORT_FIELD + port + ". As of "
- + LOCATIONSEQNUM_FIELD + locationSeqNum + ".";
+ return "Region moved to: " + HOST_FIELD + hostname + " " + PORT_FIELD + port + " " +
+ STARTCODE_FIELD + startCode + ". As of " + LOCATIONSEQNUM_FIELD + locationSeqNum + ".";
}
/**
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java Wed Feb 20 17:48:19 2013
@@ -497,7 +497,7 @@ public class CatalogTracker {
}
AdminProtocol protocol = null;
try {
- protocol = connection.getAdmin(sn.getHostname(), sn.getPort());
+ protocol = connection.getAdmin(sn);
} catch (RetriesExhaustedException e) {
if (e.getCause() != null && e.getCause() instanceof ConnectException) {
// Catch this; presume it means the cached connection has gone bad.
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java Wed Feb 20 17:48:19 2013
@@ -556,7 +556,7 @@ public class HBaseAdmin implements Abort
// Wait until all regions deleted
ClientProtocol server =
- connection.getClient(firstMetaServer.getHostname(), firstMetaServer.getPort());
+ connection.getClient(firstMetaServer.getServerName());
for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
try {
@@ -1184,8 +1184,7 @@ public class HBaseAdmin implements Abort
"The servername cannot be null or empty.");
}
ServerName sn = new ServerName(serverName);
- AdminProtocol admin = this.connection.getAdmin(
- sn.getHostname(), sn.getPort());
+ AdminProtocol admin = this.connection.getAdmin(sn);
// Close the region without updating zk state.
CloseRegionRequest request =
RequestConverter.buildCloseRegionRequest(encodedRegionName, false);
@@ -1211,7 +1210,7 @@ public class HBaseAdmin implements Abort
public void closeRegion(final ServerName sn, final HRegionInfo hri)
throws IOException {
AdminProtocol admin =
- this.connection.getAdmin(sn.getHostname(), sn.getPort());
+ this.connection.getAdmin(sn);
// Close the region without updating zk state.
ProtobufUtil.closeRegion(admin, hri.getRegionName(), false);
}
@@ -1222,7 +1221,7 @@ public class HBaseAdmin implements Abort
public List<HRegionInfo> getOnlineRegions(
final ServerName sn) throws IOException {
AdminProtocol admin =
- this.connection.getAdmin(sn.getHostname(), sn.getPort());
+ this.connection.getAdmin(sn);
return ProtobufUtil.getOnlineRegions(admin);
}
@@ -1285,7 +1284,7 @@ public class HBaseAdmin implements Abort
private void flush(final ServerName sn, final HRegionInfo hri)
throws IOException {
AdminProtocol admin =
- this.connection.getAdmin(sn.getHostname(), sn.getPort());
+ this.connection.getAdmin(sn);
FlushRegionRequest request =
RequestConverter.buildFlushRegionRequest(hri.getRegionName());
try {
@@ -1455,7 +1454,7 @@ public class HBaseAdmin implements Abort
final boolean major, final byte [] family)
throws IOException {
AdminProtocol admin =
- this.connection.getAdmin(sn.getHostname(), sn.getPort());
+ this.connection.getAdmin(sn);
CompactRegionRequest request =
RequestConverter.buildCompactRegionRequest(hri.getRegionName(), major, family);
try {
@@ -1733,7 +1732,7 @@ public class HBaseAdmin implements Abort
private void split(final ServerName sn, final HRegionInfo hri,
byte[] splitPoint) throws IOException {
AdminProtocol admin =
- this.connection.getAdmin(sn.getHostname(), sn.getPort());
+ this.connection.getAdmin(sn);
ProtobufUtil.split(admin, hri, splitPoint);
}
@@ -1857,7 +1856,7 @@ public class HBaseAdmin implements Abort
String hostname = Addressing.parseHostname(hostnamePort);
int port = Addressing.parsePort(hostnamePort);
AdminProtocol admin =
- this.connection.getAdmin(hostname, port);
+ this.connection.getAdmin(new ServerName(hostname, port, 0));
StopServerRequest request = RequestConverter.buildStopServerRequest(
"Called by admin client " + this.connection.toString());
try {
@@ -1867,6 +1866,7 @@ public class HBaseAdmin implements Abort
}
}
+
/**
* @return cluster status
* @throws IOException if a remote or network exception occurs
@@ -1998,9 +1998,8 @@ public class HBaseAdmin implements Abort
public synchronized byte[][] rollHLogWriter(String serverName)
throws IOException, FailedLogCloseException {
ServerName sn = new ServerName(serverName);
- AdminProtocol admin = this.connection.getAdmin(
- sn.getHostname(), sn.getPort());
- RollWALWriterRequest request = RequestConverter.buildRollWALWriterRequest();;
+ AdminProtocol admin = this.connection.getAdmin(sn);
+ RollWALWriterRequest request = RequestConverter.buildRollWALWriterRequest();
try {
RollWALWriterResponse response = admin.rollWALWriter(null, request);
int regionCount = response.getRegionToFlushCount();
@@ -2060,7 +2059,7 @@ public class HBaseAdmin implements Abort
} else {
ServerName sn = regionServerPair.getSecond();
AdminProtocol admin =
- this.connection.getAdmin(sn.getHostname(), sn.getPort());
+ this.connection.getAdmin(sn);
GetRegionInfoRequest request = RequestConverter.buildGetRegionInfoRequest(
regionServerPair.getFirst().getRegionName(), true);
GetRegionInfoResponse response = admin.getRegionInfo(null, request);
@@ -2076,7 +2075,7 @@ public class HBaseAdmin implements Abort
try {
ServerName sn = pair.getSecond();
AdminProtocol admin =
- this.connection.getAdmin(sn.getHostname(), sn.getPort());
+ this.connection.getAdmin(sn);
GetRegionInfoRequest request = RequestConverter.buildGetRegionInfoRequest(
pair.getFirst().getRegionName(), true);
GetRegionInfoResponse response = admin.getRegionInfo(null, request);
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnection.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnection.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnection.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnection.java Wed Feb 20 17:48:19 2013
@@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.HTableDes
import org.apache.hadoop.hbase.MasterAdminProtocol;
import org.apache.hadoop.hbase.MasterMonitorProtocol;
import org.apache.hadoop.hbase.MasterNotRunningException;
+import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.catalog.CatalogTracker;
import org.apache.hadoop.hbase.client.coprocessor.Batch;
@@ -208,11 +209,23 @@ public interface HConnection extends Abo
* @param port RegionServer port
* @return proxy for HRegionServer
* @throws IOException if a remote or network exception occurs
- *
+ * @deprecated - use @link {#getAdmin(final ServerName serverName)} which takes into account
+ * the startCode
*/
+ @Deprecated
public AdminProtocol getAdmin(final String hostname, final int port)
throws IOException;
+
+ /**
+ * Establishes a connection to the region server at the specified address.
+ * @param serverName
+ * @return proxy for HRegionServer
+ * @throws IOException if a remote or network exception occurs
+ */
+ public AdminProtocol getAdmin(final ServerName serverName)
+ throws IOException;
+
/**
* Establishes a connection to the region server at the specified address, and return
* a region client protocol.
@@ -221,11 +234,25 @@ public interface HConnection extends Abo
* @param port RegionServer port
* @return ClientProtocol proxy for RegionServer
* @throws IOException if a remote or network exception occurs
- *
+ * @deprecated - use @link {#getClient(final ServerName serverName)} which takes into account
+ * the startCode
*/
+ @Deprecated
public ClientProtocol getClient(final String hostname, final int port)
throws IOException;
+
+ /**
+ * Establishes a connection to the region server at the specified address, and return
+ * a region client protocol.
+ *
+ * @param serverName
+ * @return ClientProtocol proxy for RegionServer
+ * @throws IOException if a remote or network exception occurs
+ *
+ */
+ public ClientProtocol getClient(final ServerName serverName) throws IOException;
+
/**
* Establishes a connection to the region server at the specified address.
* @param hostname RegionServer hostname
@@ -233,12 +260,24 @@ public interface HConnection extends Abo
* @param getMaster - do we check if master is alive
* @return proxy for HRegionServer
* @throws IOException if a remote or network exception occurs
+ * @deprecated use @link {#getAdmin(final ServerName serverName, boolean getMaster)}
+ * which takes into account the startCode.
*/
- public AdminProtocol getAdmin(final String hostname,
- final int port, boolean getMaster)
+ @Deprecated
+ public AdminProtocol getAdmin(final String hostname, final int port, boolean getMaster)
throws IOException;
/**
+ * Establishes a connection to the region server at the specified address.
+ * @param serverName
+ * @param getMaster - do we check if master is alive
+ * @return proxy for HRegionServer
+ * @throws IOException if a remote or network exception occurs
+ */
+ public AdminProtocol getAdmin(final ServerName serverName, boolean getMaster)
+ throws IOException;
+
+ /**
* Find region location hosting passed row
* @param tableName table name
* @param row Row to find.
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Wed Feb 20 17:48:19 2013
@@ -85,7 +85,6 @@ import org.apache.hadoop.hbase.protobuf.
import org.apache.hadoop.hbase.security.User;
import org.apache.hadoop.hbase.util.Addressing;
import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.util.SoftValueSortedMap;
import org.apache.hadoop.hbase.util.Triple;
@@ -959,8 +958,7 @@ public class HConnectionManager {
LOG.debug("Looked up root region location, connection=" + this +
"; serverName=" + ((servername == null) ? "null" : servername));
if (servername == null) return null;
- return new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, servername.getHostname(),
- servername.getPort(), 0);
+ return new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, servername, 0);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return null;
@@ -1008,8 +1006,8 @@ public class HConnectionManager {
return true; // don't cache it
}
// instantiate the location
- HRegionLocation loc = new HRegionLocation(regionInfo, serverName.getHostname(),
- serverName.getPort(), HRegionInfo.getSeqNumDuringOpen(result));
+ HRegionLocation loc = new HRegionLocation(regionInfo, serverName,
+ HRegionInfo.getSeqNumDuringOpen(result));
// cache this meta entry
cacheLocation(tableName, null, loc);
return true;
@@ -1063,7 +1061,7 @@ public class HConnectionManager {
// If null still, go around again.
if (metaLocation == null) continue;
ClientProtocol server =
- getClient(metaLocation.getHostname(), metaLocation.getPort());
+ getClient(metaLocation.getServerName());
Result regionInfoRow = null;
// This block guards against two threads trying to load the meta
@@ -1133,8 +1131,8 @@ public class HConnectionManager {
}
// Instantiate the location
- location = new HRegionLocation(regionInfo, serverName.getHostname(),
- serverName.getPort(), HRegionInfo.getSeqNumDuringOpen(regionInfoRow));
+ location = new HRegionLocation(regionInfo, serverName,
+ HRegionInfo.getSeqNumDuringOpen(regionInfoRow));
cacheLocation(tableName, null, location);
return location;
} catch (TableNotFoundException e) {
@@ -1218,7 +1216,7 @@ public class HConnectionManager {
return possibleRegion;
}
- // Passed all the way through, so we got nothin - complete cache miss
+ // Passed all the way through, so we got nothing - complete cache miss
return null;
}
@@ -1368,24 +1366,46 @@ public class HConnectionManager {
}
@Override
- public AdminProtocol getAdmin(final String hostname,
- final int port) throws IOException {
- return getAdmin(hostname, port, false);
+ @Deprecated
+ public AdminProtocol getAdmin(final String hostname, final int port) throws IOException {
+ return getAdmin(new ServerName(hostname, port, 0L));
+ }
+
+ @Override
+ public AdminProtocol getAdmin(final ServerName serverName)
+ throws IOException {
+ return getAdmin(serverName, false);
}
@Override
+ @Deprecated
public ClientProtocol getClient(final String hostname, final int port)
throws IOException {
return (ClientProtocol)getProtocol(hostname, port, clientClass);
}
@Override
+ public ClientProtocol getClient(final ServerName serverName)
+ throws IOException {
+ return (ClientProtocol)
+ getProtocol(serverName.getHostname(), serverName.getPort(), clientClass);
+ }
+
+ @Override
+ @Deprecated
public AdminProtocol getAdmin(final String hostname, final int port,
final boolean master)
throws IOException {
return (AdminProtocol)getProtocol(hostname, port, adminClass);
}
+ @Override
+ public AdminProtocol getAdmin(final ServerName serverName, final boolean master)
+ throws IOException {
+ return (AdminProtocol)getProtocol(
+ serverName.getHostname(), serverName.getPort(), adminClass);
+ }
+
/**
* Either the passed <code>isa</code> is null or <code>hostname</code>
* can be but not both.
@@ -1757,8 +1777,7 @@ public class HConnectionManager {
@Override
public void connect(boolean reload) throws IOException {
- server = connection.getClient(
- loc.getHostname(), loc.getPort());
+ server = connection.getClient(loc.getServerName());
}
};
return callable.withoutRetries();
@@ -1767,8 +1786,8 @@ public class HConnectionManager {
}
void updateCachedLocation(HRegionInfo hri, HRegionLocation source,
- String hostname, int port, long seqNum) {
- HRegionLocation newHrl = new HRegionLocation(hri, hostname, port, seqNum);
+ ServerName serverName, long seqNum) {
+ HRegionLocation newHrl = new HRegionLocation(hri, serverName, seqNum);
synchronized (this.cachedRegionLocations) {
cacheLocation(hri.getTableName(), source, newHrl);
}
@@ -1781,7 +1800,7 @@ public class HConnectionManager {
*/
void deleteCachedLocation(HRegionInfo hri, HRegionLocation source) {
boolean isStaleDelete = false;
- HRegionLocation oldLocation = null;
+ HRegionLocation oldLocation;
synchronized (this.cachedRegionLocations) {
Map<byte[], HRegionLocation> tableLocations =
getTableLocations(hri.getTableName());
@@ -1829,7 +1848,7 @@ public class HConnectionManager {
LOG.info("Region " + regionInfo.getRegionNameAsString() + " moved to " +
rme.getHostname() + ":" + rme.getPort() + " according to " + source.getHostnamePort());
updateCachedLocation(
- regionInfo, source, rme.getHostname(), rme.getPort(), rme.getLocationSeqNum());
+ regionInfo, source, rme.getServerName(), rme.getLocationSeqNum());
} else {
deleteCachedLocation(regionInfo, source);
}
@@ -2124,8 +2143,7 @@ public class HConnectionManager {
}
}
- public String getDescriptionAndClear()
- {
+ public String getDescriptionAndClear(){
if (exceptions.isEmpty()) {
return "";
}
@@ -2134,7 +2152,7 @@ public class HConnectionManager {
actions.clear();
addresses.clear();
return result;
- };
+ }
private RetriesExhaustedWithDetailsException makeException() {
return new RetriesExhaustedWithDetailsException(exceptions, actions, addresses);
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java Wed Feb 20 17:48:19 2013
@@ -87,8 +87,7 @@ public abstract class ServerCallable<T>
*/
public void connect(final boolean reload) throws IOException {
this.location = connection.getRegionLocation(tableName, row, reload);
- this.server = connection.getClient(location.getHostname(),
- location.getPort());
+ this.server = connection.getClient(location.getServerName());
}
/** @return the server name
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/EventHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/EventHandler.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/EventHandler.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/EventHandler.java Wed Feb 20 17:48:19 2013
@@ -76,7 +76,7 @@ public abstract class EventHandler imple
private EventHandlerListener listener;
// Time to wait for events to happen, should be kept short
- protected final int waitingTimeForEvents;
+ protected int waitingTimeForEvents;
private final Span parent;
@@ -146,7 +146,10 @@ public abstract class EventHandler imple
// Master controlled events to be executed on the master
M_SERVER_SHUTDOWN (70, ExecutorType.MASTER_SERVER_OPERATIONS), // Master is processing shutdown of a RS
M_META_SERVER_SHUTDOWN (72, ExecutorType.MASTER_META_SERVER_OPERATIONS), // Master is processing shutdown of RS hosting a meta region (-ROOT- or .META.).
- M_MASTER_RECOVERY (73, ExecutorType.MASTER_SERVER_OPERATIONS); // Master is processing recovery of regions found in ZK RIT
+ M_MASTER_RECOVERY (73, ExecutorType.MASTER_SERVER_OPERATIONS), // Master is processing recovery of regions found in ZK RIT
+
+ // RS controlled events to be executed on the RS
+ RS_PARALLEL_SEEK (80, ExecutorType.RS_PARALLEL_SEEK);
private final int code;
private final ExecutorService.ExecutorType executor;
@@ -193,8 +196,10 @@ public abstract class EventHandler imple
this.server = server;
this.eventType = eventType;
seqid = seqids.incrementAndGet();
- this.waitingTimeForEvents = server.getConfiguration().
- getInt("hbase.master.event.waiting.time", 1000);
+ if (server != null) {
+ this.waitingTimeForEvents = server.getConfiguration().
+ getInt("hbase.master.event.waiting.time", 1000);
+ }
}
public void run() {
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java Wed Feb 20 17:48:19 2013
@@ -92,7 +92,8 @@ public class ExecutorService {
RS_OPEN_META (22),
RS_CLOSE_REGION (23),
RS_CLOSE_ROOT (24),
- RS_CLOSE_META (25);
+ RS_CLOSE_META (25),
+ RS_PARALLEL_SEEK (26);
ExecutorType(int value) {}
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java Wed Feb 20 17:48:19 2013
@@ -2806,6 +2806,12 @@ public class AssignmentManager extends Z
+ " since it is not opening on the dead server any more: " + sn);
it.remove();
} else {
+ try{
+ // Delete the ZNode if exists
+ ZKAssign.deleteNodeFailSilent(watcher, hri);
+ } catch (KeeperException ke) {
+ server.abort("Unexpected ZK exception deleting node " + hri, ke);
+ }
// Mark the region closed and assign it again by SSH
regionStates.updateRegionState(hri, RegionState.State.CLOSED);
}
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java Wed Feb 20 17:48:19 2013
@@ -683,7 +683,7 @@ public class ServerManager {
AdminProtocol admin = this.serverConnections.get(sn);
if (admin == null) {
LOG.debug("New connection to " + sn.toString());
- admin = this.connection.getAdmin(sn.getHostname(), sn.getPort());
+ admin = this.connection.getAdmin(sn);
this.serverConnections.put(sn, admin);
}
return admin;
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Wed Feb 20 17:48:19 2013
@@ -1535,6 +1535,10 @@ public class HRegionServer implements Cl
conf.getInt("hbase.regionserver.executor.closeroot.threads", 1));
this.service.startExecutorService(ExecutorType.RS_CLOSE_META,
conf.getInt("hbase.regionserver.executor.closemeta.threads", 1));
+ if (conf.getBoolean(StoreScanner.STORESCANNER_PARALLEL_SEEK_ENABLE, false)) {
+ this.service.startExecutorService(ExecutorType.RS_PARALLEL_SEEK,
+ conf.getInt("hbase.storescanner.parallel.seek.threads", 10));
+ }
Threads.setDaemonThreadRunning(this.hlogRoller.getThread(), n + ".logRoller",
uncaughtExceptionHandler);
@@ -2552,8 +2556,7 @@ public class HRegionServer implements Cl
if (region == null) {
MovedRegionInfo moveInfo = getMovedRegion(encodedRegionName);
if (moveInfo != null) {
- throw new RegionMovedException(moveInfo.getServerName().getHostname(),
- moveInfo.getServerName().getPort(), moveInfo.getSeqNum());
+ throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
} else {
throw new NotServingRegionException("Region is not online: " + encodedRegionName);
}
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java Wed Feb 20 17:48:19 2013
@@ -153,7 +153,7 @@ public class HStore implements Store {
// Comparing KeyValues
private final KeyValue.KVComparator comparator;
- private Compactor compactor;
+ final Compactor compactor;
private OffPeakCompactions offPeakCompactions;
@@ -222,7 +222,8 @@ public class HStore implements Store {
"hbase.hstore.close.check.interval", 10*1000*1000 /* 10 MB */);
}
- this.storeFileManager = new DefaultStoreFileManager(this.comparator);
+ StoreEngine engine = StoreEngine.create(this, this.conf, this.comparator);
+ this.storeFileManager = engine.getStoreFileManager();
this.storeFileManager.loadFiles(loadStoreFiles());
// Initialize checksum type from name. The names are CRC32, CRC32C, etc.
@@ -241,9 +242,9 @@ public class HStore implements Store {
+ HStore.flush_retries_number);
}
}
- this.compactionPolicy = CompactionPolicy.create(this, conf);
+ this.compactionPolicy = engine.getCompactionPolicy();
// Get the compaction tool instance for this policy
- this.compactor = compactionPolicy.getCompactor();
+ this.compactor = engine.getCompactor();
}
/**
@@ -1672,6 +1673,7 @@ public class HStore implements Store {
}
@Override
+ // TODO: why is there this and also getNumberOfStorefiles?! Remove one.
public int getStorefilesCount() {
return this.storeFileManager.getStorefileCount();
}
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java Wed Feb 20 17:48:19 2013
@@ -25,6 +25,7 @@ import org.apache.hadoop.classification.
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.catalog.CatalogTracker;
+import org.apache.hadoop.hbase.executor.ExecutorService;
import org.apache.hadoop.hbase.ipc.RpcServer;
import org.apache.hadoop.hbase.regionserver.wal.HLog;
import org.apache.zookeeper.KeeperException;
@@ -92,4 +93,9 @@ public interface RegionServerServices ex
* @return The RegionServer's "Leases" service
*/
public Leases getLeases();
+
+ /**
+ * @return hbase executor service
+ */
+ public ExecutorService getExecutorService();
}
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java Wed Feb 20 17:48:19 2013
@@ -20,9 +20,11 @@
package org.apache.hadoop.hbase.regionserver;
import java.io.IOException;
+import java.io.InterruptedIOException;
import java.util.ArrayList;
import java.util.List;
import java.util.NavigableSet;
+import java.util.concurrent.CountDownLatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -31,8 +33,10 @@ import org.apache.hadoop.hbase.DoNotRetr
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.executor.ExecutorService;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.regionserver.ScanInfo;
+import org.apache.hadoop.hbase.regionserver.handler.ParallelSeekHandler;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
@@ -59,6 +63,11 @@ public class StoreScanner extends NonLaz
protected final boolean isGet;
protected final boolean explicitColumnQuery;
protected final boolean useRowColBloom;
+ /**
+ * A flag that enables StoreFileScanner parallel-seeking
+ */
+ protected boolean isParallelSeekEnabled = false;
+ protected ExecutorService executor;
protected final Scan scan;
protected final NavigableSet<byte[]> columns;
protected final long oldestUnexpiredTS;
@@ -66,6 +75,8 @@ public class StoreScanner extends NonLaz
/** We don't ever expect to change this, the constant is just for clarity. */
static final boolean LAZY_SEEK_ENABLED_BY_DEFAULT = true;
+ public static final String STORESCANNER_PARALLEL_SEEK_ENABLE =
+ "hbase.storescanner.parallel.seek.enable";
/** Used during unit testing to ensure that lazy seek does save seek ops */
protected static boolean lazySeekEnabledGlobally =
@@ -92,6 +103,17 @@ public class StoreScanner extends NonLaz
// for multi-row (non-"get") scans because this is not done in
// StoreFile.passesBloomFilter(Scan, SortedSet<byte[]>).
useRowColBloom = numCol > 1 || (!isGet && numCol == 1);
+ // The parallel-seeking is on :
+ // 1) the config value is *true*
+ // 2) store has more than one store file
+ if (store != null && ((HStore)store).getHRegion() != null
+ && store.getStorefilesCount() > 1) {
+ RegionServerServices rsService = ((HStore)store).getHRegion().getRegionServerServices();
+ if (rsService == null || !rsService.getConfiguration().getBoolean(
+ STORESCANNER_PARALLEL_SEEK_ENABLE, false)) return;
+ isParallelSeekEnabled = true;
+ executor = rsService.getExecutorService();
+ }
}
/**
@@ -127,8 +149,12 @@ public class StoreScanner extends NonLaz
scanner.requestSeek(matcher.getStartKey(), false, true);
}
} else {
- for (KeyValueScanner scanner : scanners) {
- scanner.seek(matcher.getStartKey());
+ if (!isParallelSeekEnabled) {
+ for (KeyValueScanner scanner : scanners) {
+ scanner.seek(matcher.getStartKey());
+ }
+ } else {
+ parallelSeek(scanners, matcher.getStartKey());
}
}
@@ -166,8 +192,12 @@ public class StoreScanner extends NonLaz
scanners = selectScannersFrom(scanners);
// Seek all scanners to the initial key
- for(KeyValueScanner scanner : scanners) {
- scanner.seek(matcher.getStartKey());
+ if (!isParallelSeekEnabled) {
+ for (KeyValueScanner scanner : scanners) {
+ scanner.seek(matcher.getStartKey());
+ }
+ } else {
+ parallelSeek(scanners, matcher.getStartKey());
}
// Combine all seeked scanners with a heap
@@ -193,8 +223,12 @@ public class StoreScanner extends NonLaz
Long.MAX_VALUE, earliestPutTs, oldestUnexpiredTS);
// Seek all scanners to the initial key
- for (KeyValueScanner scanner : scanners) {
- scanner.seek(matcher.getStartKey());
+ if (!isParallelSeekEnabled) {
+ for (KeyValueScanner scanner : scanners) {
+ scanner.seek(matcher.getStartKey());
+ }
+ } else {
+ parallelSeek(scanners, matcher.getStartKey());
}
heap = new KeyValueHeap(scanners, scanInfo.getComparator());
}
@@ -513,8 +547,12 @@ public class StoreScanner extends NonLaz
* could have done it now by storing the scan object from the constructor */
List<KeyValueScanner> scanners = getScannersNoCompaction();
- for(KeyValueScanner scanner : scanners) {
- scanner.seek(lastTopKey);
+ if (!isParallelSeekEnabled) {
+ for (KeyValueScanner scanner : scanners) {
+ scanner.seek(lastTopKey);
+ }
+ } else {
+ parallelSeek(scanners, lastTopKey);
}
// Combine all seeked scanners with a heap
@@ -546,9 +584,8 @@ public class StoreScanner extends NonLaz
checkReseek();
if (explicitColumnQuery && lazySeekEnabledGlobally) {
return heap.requestSeek(kv, true, useRowColBloom);
- } else {
- return heap.reseek(kv);
}
+ return heap.reseek(kv);
}
@Override
@@ -557,6 +594,44 @@ public class StoreScanner extends NonLaz
}
/**
+ * Seek storefiles in parallel to optimize IO latency as much as possible
+ * @param scanners the list {@link KeyValueScanner}s to be read from
+ * @param kv the KeyValue on which the operation is being requested
+ * @throws IOException
+ */
+ private void parallelSeek(final List<? extends KeyValueScanner>
+ scanners, final KeyValue kv) throws IOException {
+ if (scanners.isEmpty()) return;
+ int storeFileScannerCount = scanners.size();
+ CountDownLatch latch = new CountDownLatch(storeFileScannerCount);
+ List<ParallelSeekHandler> handlers =
+ new ArrayList<ParallelSeekHandler>(storeFileScannerCount);
+ for (KeyValueScanner scanner : scanners) {
+ if (scanner instanceof StoreFileScanner) {
+ ParallelSeekHandler seekHandler = new ParallelSeekHandler(scanner, kv,
+ MultiVersionConsistencyControl.getThreadReadPoint(), latch);
+ executor.submit(seekHandler);
+ handlers.add(seekHandler);
+ } else {
+ scanner.seek(kv);
+ latch.countDown();
+ }
+ }
+
+ try {
+ latch.await();
+ } catch (InterruptedException ie) {
+ throw new InterruptedIOException(ie.getMessage());
+ }
+
+ for (ParallelSeekHandler handler : handlers) {
+ if (handler.getErr() != null) {
+ throw new IOException(handler.getErr());
+ }
+ }
+ }
+
+ /**
* Used in testing.
* @return all scanners in no particular order
*/
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionPolicy.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionPolicy.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionPolicy.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionPolicy.java Wed Feb 20 17:48:19 2013
@@ -25,33 +25,22 @@ import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.conf.Configured;
-import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.StoreConfigInformation;
import org.apache.hadoop.hbase.regionserver.StoreFile;
-import org.apache.hadoop.util.ReflectionUtils;
/**
* A compaction policy determines how to select files for compaction,
* how to compact them, and how to generate the compacted files.
*/
@InterfaceAudience.Private
-public abstract class CompactionPolicy extends Configured {
-
- /**
- * The name of the configuration parameter that specifies
- * the class of a compaction policy that is used to compact
- * HBase store files.
- */
- public static final String COMPACTION_POLICY_KEY =
- "hbase.hstore.compaction.policy";
-
- private static final Class<? extends CompactionPolicy>
- DEFAULT_COMPACTION_POLICY_CLASS = DefaultCompactionPolicy.class;
-
- CompactionConfiguration comConf;
- Compactor compactor;
- HStore store;
+public abstract class CompactionPolicy {
+ protected CompactionConfiguration comConf;
+ protected StoreConfigInformation storeConfigInfo;
+
+ public CompactionPolicy(Configuration conf, StoreConfigInformation storeConfigInfo) {
+ this.storeConfigInfo = storeConfigInfo;
+ this.comConf = new CompactionConfiguration(conf, this.storeConfigInfo);
+ }
/**
* This is called before coprocessor preCompactSelection and should filter the candidates
@@ -107,68 +96,7 @@ public abstract class CompactionPolicy e
* Inform the policy that some configuration has been change,
* so cached value should be updated it any.
*/
- public void updateConfiguration() {
- if (getConf() != null && store != null) {
- comConf = new CompactionConfiguration(getConf(), store);
- }
- }
-
- /**
- * Get the compactor for this policy
- * @return the compactor for this policy
- */
- public Compactor getCompactor() {
- return compactor;
- }
-
- /**
- * Set the new configuration
- */
- @Override
public void setConf(Configuration conf) {
- super.setConf(conf);
- updateConfiguration();
- }
-
- /**
- * Upon construction, this method will be called with the HStore
- * to be governed. It will be called once and only once.
- */
- protected void configureForStore(HStore store) {
- this.store = store;
- updateConfiguration();
- }
-
- /**
- * Create the CompactionPolicy configured for the given HStore.
- * @param store
- * @param conf
- * @return a CompactionPolicy
- * @throws IOException
- */
- public static CompactionPolicy create(HStore store,
- Configuration conf) throws IOException {
- Class<? extends CompactionPolicy> clazz =
- getCompactionPolicyClass(store.getFamily(), conf);
- CompactionPolicy policy = ReflectionUtils.newInstance(clazz, conf);
- policy.configureForStore(store);
- return policy;
- }
-
- static Class<? extends CompactionPolicy> getCompactionPolicyClass(
- HColumnDescriptor family, Configuration conf) throws IOException {
- String className = conf.get(COMPACTION_POLICY_KEY,
- DEFAULT_COMPACTION_POLICY_CLASS.getName());
-
- try {
- Class<? extends CompactionPolicy> clazz =
- Class.forName(className).asSubclass(CompactionPolicy.class);
- return clazz;
- } catch (Exception e) {
- throw new IOException(
- "Unable to load configured region compaction policy '"
- + className + "' for column '" + family.getNameAsString()
- + "'", e);
- }
+ this.comConf = new CompactionConfiguration(conf, this.storeConfigInfo);
}
}
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java Wed Feb 20 17:48:19 2013
@@ -32,11 +32,11 @@ import org.apache.hadoop.hbase.regionser
@InterfaceAudience.Private
public abstract class Compactor {
- CompactionProgress progress;
- CompactionPolicy policy;
+ protected CompactionProgress progress;
+ protected Configuration conf;
- Compactor(final CompactionPolicy policy) {
- this.policy = policy;
+ Compactor(final Configuration conf) {
+ this.conf = conf;
}
/**
@@ -51,10 +51,6 @@ public abstract class Compactor {
public abstract List<Path> compact(final Collection<StoreFile> filesToCompact,
final boolean majorCompaction) throws IOException;
- public Configuration getConf() {
- return policy.getConf();
- }
-
public CompactionProgress getProgress() {
return this.progress;
}
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactionPolicy.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactionPolicy.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactionPolicy.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactionPolicy.java Wed Feb 20 17:48:19 2013
@@ -30,7 +30,10 @@ import java.util.Random;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.StoreConfigInformation;
import org.apache.hadoop.hbase.regionserver.StoreFile;
import org.apache.hadoop.hbase.regionserver.StoreUtils;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
@@ -49,8 +52,8 @@ public class DefaultCompactionPolicy ext
private static final Log LOG = LogFactory.getLog(DefaultCompactionPolicy.class);
- public DefaultCompactionPolicy() {
- compactor = new DefaultCompactor(this);
+ public DefaultCompactionPolicy(Configuration conf, StoreConfigInformation storeConfigInfo) {
+ super(conf, storeConfigInfo);
}
@Override
@@ -78,12 +81,13 @@ public class DefaultCompactionPolicy ext
* @return subset copy of candidate list that meets compaction criteria
* @throws java.io.IOException
*/
+ @Override
public CompactSelection selectCompaction(List<StoreFile> candidateFiles,
final boolean isUserCompaction, final boolean mayUseOffPeak, final boolean forceMajor)
throws IOException {
// Preliminary compaction subject to filters
CompactSelection candidateSelection = new CompactSelection(candidateFiles);
- long cfTtl = this.store.getStoreFileTtl();
+ long cfTtl = this.storeConfigInfo.getStoreFileTtl();
if (!forceMajor) {
// If there are expired files, only select them so that compaction deletes them
if (comConf.shouldDeleteExpired() && (cfTtl != Long.MAX_VALUE)) {
@@ -326,7 +330,7 @@ public class DefaultCompactionPolicy ext
long now = System.currentTimeMillis();
if (lowTimestamp > 0l && lowTimestamp < (now - mcTime)) {
// Major compaction time has elapsed.
- long cfTtl = this.store.getStoreFileTtl();
+ long cfTtl = this.storeConfigInfo.getStoreFileTtl();
if (filesToCompact.size() == 1) {
// Single file
StoreFile sf = filesToCompact.iterator().next();
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactor.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactor.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactor.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactor.java Wed Feb 20 17:48:19 2013
@@ -26,6 +26,7 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
@@ -44,14 +45,16 @@ import org.apache.hadoop.util.StringUtil
/**
* Compact passed set of files.
- * Create an instance and then call {@ink #compact(Collection, boolean, long)}.
+ * Create an instance and then call {@link #compact(Collection, boolean)}.
*/
@InterfaceAudience.Private
-class DefaultCompactor extends Compactor {
+public class DefaultCompactor extends Compactor {
private static final Log LOG = LogFactory.getLog(DefaultCompactor.class);
+ private final Store store;
- DefaultCompactor(final CompactionPolicy policy) {
- super(policy);
+ public DefaultCompactor(final Configuration conf, final Store store) {
+ super(conf);
+ this.store = store;
}
/**
@@ -72,7 +75,6 @@ class DefaultCompactor extends Compactor
// Calculate maximum key count after compaction (for blooms)
// Also calculate earliest put timestamp if major compaction
int maxKeyCount = 0;
- Store store = policy.store;
long earliestPutTs = HConstants.LATEST_TIMESTAMP;
for (StoreFile file: filesToCompact) {
StoreFile.Reader r = file.getReader();
@@ -116,7 +118,7 @@ class DefaultCompactor extends Compactor
.getScannersForStoreFiles(filesToCompact, false, false, true);
// Get some configs
- int compactionKVMax = getConf().getInt(HConstants.COMPACTION_KV_MAX, 10);
+ int compactionKVMax = this.conf.getInt(HConstants.COMPACTION_KV_MAX, 10);
Compression.Algorithm compression = store.getFamily().getCompression();
// Avoid overriding compression setting for major compactions if the user
// has not specified it separately
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java Wed Feb 20 17:48:19 2013
@@ -764,7 +764,7 @@ public class ReplicationSource extends T
}
ServerName address =
currentPeers.get(random.nextInt(this.currentPeers.size()));
- return this.conn.getAdmin(address.getHostname(), address.getPort());
+ return this.conn.getAdmin(address);
}
/**
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java Wed Feb 20 17:48:19 2013
@@ -3031,7 +3031,7 @@ public class HBaseFsck extends Configure
errors.progress();
try {
AdminProtocol server =
- connection.getAdmin(rsinfo.getHostname(), rsinfo.getPort());
+ connection.getAdmin(rsinfo);
// list all online regions from this region server
List<HRegionInfo> regions = ProtobufUtil.getOnlineRegions(server);
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java Wed Feb 20 17:48:19 2013
@@ -149,7 +149,7 @@ public class HBaseFsckRepair {
public static void closeRegionSilentlyAndWait(HBaseAdmin admin,
ServerName server, HRegionInfo region) throws IOException, InterruptedException {
HConnection connection = admin.getConnection();
- AdminProtocol rs = connection.getAdmin(server.getHostname(), server.getPort());
+ AdminProtocol rs = connection.getAdmin(server);
ProtobufUtil.closeRegion(rs, region.getRegionName(), false);
long timeout = admin.getConfiguration()
.getLong("hbase.hbck.close.timeout", 120000);
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java Wed Feb 20 17:48:19 2013
@@ -124,7 +124,7 @@ public class MiniZooKeeperCluster {
// resulting in test failure (client timeout on first session).
// set env and directly in order to handle static init/gc issues
System.setProperty("zookeeper.preAllocSize", "100");
- FileTxnLog.setPreallocSize(100);
+ FileTxnLog.setPreallocSize(100 * 1024);
}
public int startup(File baseDir) throws IOException, InterruptedException {
Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/resources/hbase-default.xml
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/resources/hbase-default.xml?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/resources/hbase-default.xml (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/resources/hbase-default.xml Wed Feb 20 17:48:19 2013
@@ -442,6 +442,21 @@
</description>
</property>
<property>
+ <name>hbase.storescanner.parallel.seek.enable</name>
+ <value>false</value>
+ <description>
+ Enables StoreFileScanner parallel-seeking in StoreScanner,
+ a feature which can reduce response latency under special conditions.
+ </description>
+ </property>
+ <property>
+ <name>hbase.storescanner.parallel.seek.threads</name>
+ <value>10</value>
+ <description>
+ The default thread pool size if parallel-seeking feature enabled.
+ </description>
+ </property>
+ <property>
<name>hbase.mapreduce.hfileoutputformat.blocksize</name>
<value>65536</value>
<description>The mapreduce HFileOutputFormat writes storefiles/hfiles.
Modified: hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Wed Feb 20 17:48:19 2013
@@ -1867,6 +1867,11 @@ public class HBaseTestingUtility extends
return HFileSystem.get(conf);
}
+ public void waitTableAvailable(byte[] table)
+ throws InterruptedException, IOException {
+ waitTableAvailable(table, 30000);
+ }
+
public void waitTableAvailable(byte[] table, long timeoutMillis)
throws InterruptedException, IOException {
long startWait = System.currentTimeMillis();
@@ -1878,6 +1883,11 @@ public class HBaseTestingUtility extends
}
}
+ public void waitTableEnabled(byte[] table)
+ throws InterruptedException, IOException {
+ waitTableEnabled(table, 30000);
+ }
+
public void waitTableEnabled(byte[] table, long timeoutMillis)
throws InterruptedException, IOException {
long startWait = System.currentTimeMillis();
Modified: hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java Wed Feb 20 17:48:19 2013
@@ -37,24 +37,24 @@ public class TestHRegionLocation {
public void testHashAndEqualsCode() {
ServerName hsa1 = new ServerName("localhost", 1234, -1L);
HRegionLocation hrl1 = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO,
- hsa1.getHostname(), hsa1.getPort());
+ hsa1, HConstants.NO_SEQNUM);
HRegionLocation hrl2 = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO,
- hsa1.getHostname(), hsa1.getPort());
+ hsa1, HConstants.NO_SEQNUM);
assertEquals(hrl1.hashCode(), hrl2.hashCode());
assertTrue(hrl1.equals(hrl2));
HRegionLocation hrl3 = new HRegionLocation(HRegionInfo.ROOT_REGIONINFO,
- hsa1.getHostname(), hsa1.getPort());
+ hsa1, HConstants.NO_SEQNUM);
assertNotSame(hrl1, hrl3);
// They are equal because they have same location even though they are
// carrying different regions or timestamp.
assertTrue(hrl1.equals(hrl3));
ServerName hsa2 = new ServerName("localhost", 12345, -1L);
HRegionLocation hrl4 = new HRegionLocation(HRegionInfo.ROOT_REGIONINFO,
- hsa2.getHostname(), hsa2.getPort());
+ hsa2, HConstants.NO_SEQNUM);
// These have same HRI but different locations so should be different.
assertFalse(hrl3.equals(hrl4));
HRegionLocation hrl5 = new HRegionLocation(hrl4.getRegionInfo(),
- hrl4.getHostname(), hrl4.getPort(), hrl4.getSeqNum() + 1);
+ hrl4.getServerName(), hrl4.getSeqNum() + 1);
assertTrue(hrl4.equals(hrl5));
}
@@ -62,7 +62,7 @@ public class TestHRegionLocation {
public void testToString() {
ServerName hsa1 = new ServerName("localhost", 1234, -1L);
HRegionLocation hrl1 = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO,
- hsa1.getHostname(), hsa1.getPort());
+ hsa1, HConstants.NO_SEQNUM);
System.out.println(hrl1.toString());
}
@@ -70,10 +70,10 @@ public class TestHRegionLocation {
public void testCompareTo() {
ServerName hsa1 = new ServerName("localhost", 1234, -1L);
HRegionLocation hsl1 =
- new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, hsa1.getHostname(), hsa1.getPort());
+ new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, hsa1, HConstants.NO_SEQNUM);
ServerName hsa2 = new ServerName("localhost", 1235, -1L);
HRegionLocation hsl2 =
- new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, hsa2.getHostname(), hsa2.getPort());
+ new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, hsa2, HConstants.NO_SEQNUM);
assertTrue(hsl1.compareTo(hsl1) == 0);
assertTrue(hsl2.compareTo(hsl2) == 0);
int compare1 = hsl1.compareTo(hsl2);
Modified: hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java Wed Feb 20 17:48:19 2013
@@ -339,8 +339,7 @@ public class TestCatalogTracker {
Mockito.mock(AdminProtocol.class);
Mockito.when(implementation.getRegionInfo((RpcController)Mockito.any(),
(GetRegionInfoRequest)Mockito.any())).thenThrow(connectException);
- Mockito.when(connection.getAdmin(Mockito.anyString(),
- Mockito.anyInt(), Mockito.anyBoolean())).
+ Mockito.when(connection.getAdmin(Mockito.any(ServerName.class), Mockito.anyBoolean())).
thenReturn(implementation);
final CatalogTracker ct = constructAndStartCatalogTracker(connection);
try {
@@ -475,8 +474,8 @@ public class TestCatalogTracker {
* {@link HConnection#getConfiguration()} is called, a 'location' when
* {@link HConnection#getRegionLocation(byte[], byte[], boolean)} is called,
* and that returns the passed {@link AdminProtocol} instance when
- * {@link HConnection#getAdmin(String, int)} is called, returns the passed
- * {@link ClientProtocol} instance when {@link HConnection#getClient(String, int)}
+ * {@link HConnection#getAdmin(ServerName)} is called, returns the passed
+ * {@link ClientProtocol} instance when {@link HConnection#getClient(ServerName)}
* is called (Be sure call
* {@link HConnectionManager#deleteConnection(org.apache.hadoop.conf.Configuration)}
* when done with this mocked Connection.
@@ -489,8 +488,7 @@ public class TestCatalogTracker {
Mockito.doNothing().when(connection).close();
// Make it so we return any old location when asked.
final HRegionLocation anyLocation =
- new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO, SN.getHostname(),
- SN.getPort());
+ new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO, SN, HConstants.NO_SEQNUM);
Mockito.when(connection.getRegionLocation((byte[]) Mockito.any(),
(byte[]) Mockito.any(), Mockito.anyBoolean())).
thenReturn(anyLocation);
@@ -499,12 +497,12 @@ public class TestCatalogTracker {
thenReturn(anyLocation);
if (admin != null) {
// If a call to getHRegionConnection, return this implementation.
- Mockito.when(connection.getAdmin(Mockito.anyString(), Mockito.anyInt())).
+ Mockito.when(connection.getAdmin(Mockito.any(ServerName.class))).
thenReturn(admin);
}
if (client != null) {
// If a call to getClient, return this implementation.
- Mockito.when(connection.getClient(Mockito.anyString(), Mockito.anyInt())).
+ Mockito.when(connection.getClient(Mockito.any(ServerName.class))).
thenReturn(client);
}
return connection;
Modified: hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestMetaReaderEditorNoCluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestMetaReaderEditorNoCluster.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestMetaReaderEditorNoCluster.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestMetaReaderEditorNoCluster.java Wed Feb 20 17:48:19 2013
@@ -120,7 +120,7 @@ public class TestMetaReaderEditorNoClust
/**
* Test that MetaReader will ride over server throwing
* "Server not running" IOEs.
- * @see https://issues.apache.org/jira/browse/HBASE-3446
+ * @see @link {https://issues.apache.org/jira/browse/HBASE-3446}
* @throws IOException
* @throws InterruptedException
*/
@@ -133,7 +133,7 @@ public class TestMetaReaderEditorNoClust
// This is a servername we use in a few places below.
ServerName sn = new ServerName("example.com", 1234, System.currentTimeMillis());
- HConnection connection = null;
+ HConnection connection;
CatalogTracker ct = null;
try {
// Mock an ClientProtocol. Our mock implementation will fail a few
@@ -178,8 +178,7 @@ public class TestMetaReaderEditorNoClust
// Fix the location lookup so it 'works' though no network. First
// make an 'any location' object.
final HRegionLocation anyLocation =
- new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO, sn.getHostname(),
- sn.getPort());
+ new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO, sn, HConstants.NO_SEQNUM);
// Return the any location object when locateRegion is called in HTable
// constructor and when its called by ServerCallable (it uses getRegionLocation).
// The ugly format below comes of 'Important gotcha on spying real objects!' from
@@ -192,7 +191,7 @@ public class TestMetaReaderEditorNoClust
// Now shove our HRI implementation into the spied-upon connection.
Mockito.doReturn(implementation).
- when(connection).getClient(Mockito.anyString(), Mockito.anyInt());
+ when(connection).getClient(Mockito.any(ServerName.class));
// Now start up the catalogtracker with our doctored Connection.
ct = new CatalogTracker(zkw, null, connection, ABORTABLE);
Modified: hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/client/HConnectionTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/client/HConnectionTestingUtility.java?rev=1448318&r1=1448317&r2=1448318&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/client/HConnectionTestingUtility.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/test/java/org/apache/hadoop/hbase/client/HConnectionTestingUtility.java Wed Feb 20 17:48:19 2013
@@ -20,12 +20,11 @@ package org.apache.hadoop.hbase.client;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
-import org.apache.hadoop.hbase.client.AdminProtocol;
-import org.apache.hadoop.hbase.client.ClientProtocol;
import org.apache.hadoop.hbase.client.HConnectionManager.HConnectionImplementation;
import org.apache.hadoop.hbase.client.HConnectionManager.HConnectionKey;
import org.mockito.Mockito;
@@ -44,7 +43,7 @@ public class HConnectionTestingUtility {
* configuration instance. Minimally the mock will return
* <code>conf</conf> when {@link HConnection#getConfiguration()} is invoked.
* Be sure to shutdown the connection when done by calling
- * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
+ * {@link HConnectionManager#deleteConnection(HConnectionKey, boolean)} else it
* will stick around; this is probably not what you want.
* @param conf configuration
* @return HConnection object for <code>conf</code>
@@ -70,7 +69,7 @@ public class HConnectionTestingUtility {
* more of the popular {@link HConnection} methods so they do 'normal'
* operation (see return doc below for list). Be sure to shutdown the
* connection when done by calling
- * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
+ * {@link HConnectionManager#deleteConnection(HConnectionKey, boolean)} else it
* will stick around; this is probably not what you want.
*
* @param conf Configuration to use
@@ -86,10 +85,10 @@ public class HConnectionTestingUtility {
* {@link HConnection#getConfiguration()} is called, a 'location' when
* {@link HConnection#getRegionLocation(byte[], byte[], boolean)} is called,
* and that returns the passed {@link AdminProtocol} instance when
- * {@link HConnection#getAdmin(String, int)} is called, returns the passed
- * {@link ClientProtocol} instance when {@link HConnection#getClient(String, int)}
+ * {@link HConnection#getAdmin(ServerName)} is called, returns the passed
+ * {@link ClientProtocol} instance when {@link HConnection#getClient(ServerName)}
* is called (Be sure call
- * {@link HConnectionManager#deleteConnection(org.apache.hadoop.conf.Configuration, boolean)}
+ * {@link HConnectionManager#deleteConnection(HConnectionKey, boolean)}
* when done with this mocked Connection.
* @throws IOException
*/
@@ -100,7 +99,7 @@ public class HConnectionTestingUtility {
HConnection c = HConnectionTestingUtility.getMockedConnection(conf);
Mockito.doNothing().when(c).close();
// Make it so we return a particular location when asked.
- final HRegionLocation loc = new HRegionLocation(hri, sn.getHostname(), sn.getPort());
+ final HRegionLocation loc = new HRegionLocation(hri, sn, HConstants.NO_SEQNUM);
Mockito.when(c.getRegionLocation((byte[]) Mockito.any(),
(byte[]) Mockito.any(), Mockito.anyBoolean())).
thenReturn(loc);
@@ -108,12 +107,12 @@ public class HConnectionTestingUtility {
thenReturn(loc);
if (admin != null) {
// If a call to getAdmin, return this implementation.
- Mockito.when(c.getAdmin(Mockito.anyString(), Mockito.anyInt())).
+ Mockito.when(c.getAdmin(Mockito.any(ServerName.class))).
thenReturn(admin);
}
if (client != null) {
// If a call to getClient, return this client.
- Mockito.when(c.getClient(Mockito.anyString(), Mockito.anyInt())).
+ Mockito.when(c.getClient(Mockito.any(ServerName.class))).
thenReturn(client);
}
return c;
@@ -123,12 +122,13 @@ public class HConnectionTestingUtility {
* Get a Mockito spied-upon {@link HConnection} that goes with the passed
* <code>conf</code> configuration instance.
* Be sure to shutdown the connection when done by calling
- * {@link HConnectionManager#deleteConnection(Configuration, boolean)} else it
+ * {@link HConnectionManager#deleteConnection(HConnectionKey, boolean)} else it
* will stick around; this is probably not what you want.
* @param conf configuration
* @return HConnection object for <code>conf</code>
* @throws ZooKeeperConnectionException
- * @see http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)
+ * @see @link
+ * {http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)}
*/
public static HConnection getSpiedConnection(final Configuration conf)
throws ZooKeeperConnectionException {