You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2009/01/06 04:22:40 UTC
svn commit: r731817 - in /hadoop/hbase/trunk: CHANGES.txt
src/java/org/apache/hadoop/hbase/client/HConnectionManager.java
src/webapps/master/WEB-INF/web.xml
Author: apurtell
Date: Mon Jan 5 19:22:40 2009
New Revision: 731817
URL: http://svn.apache.org/viewvc?rev=731817&view=rev
Log:
HBASE-1101 NPE in HConnectionManager.processBatchOfRows
Modified:
hadoop/hbase/trunk/CHANGES.txt
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java
hadoop/hbase/trunk/src/webapps/master/WEB-INF/web.xml
Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=731817&r1=731816&r2=731817&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Mon Jan 5 19:22:40 2009
@@ -130,6 +130,7 @@
HBASE-1107 NPE in HStoreScanner.updateReaders
HBASE-1083 Will keep scheduling major compactions if last time one ran, we
didn't.
+ HBASE-1101 NPE in HConnectionManager$TableServers.processBatchOfRows
IMPROVEMENTS
HBASE-901 Add a limit to key length, check key and value length on client side
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=731817&r1=731816&r2=731817&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java Mon Jan 5 19:22:40 2009
@@ -872,32 +872,65 @@
}
return null;
}
-
+
+ private HRegionLocation
+ getRegionLocationForRowWithRetries(byte[] tableName, byte[] rowKey)
+ throws IOException {
+ getMaster();
+ List<Throwable> exceptions = new ArrayList<Throwable>();
+ HRegionLocation location = null;
+ int tries = 0;
+ boolean reload = false;
+ while (tries < numRetries) {
+ try {
+ location = getRegionLocation(tableName, rowKey, reload);
+ } catch (Throwable t) {
+ exceptions.add(t);
+ }
+ if (location != null) {
+ break;
+ }
+ reload = true;
+ tries++;
+ try {
+ Thread.sleep(getPauseTime(tries));
+ } catch (InterruptedException e) {
+ // continue
+ }
+ }
+ if (location == null) {
+ throw new RetriesExhaustedException("Some server",
+ HConstants.EMPTY_BYTE_ARRAY, rowKey, tries, exceptions);
+ }
+ return location;
+ }
+
public void processBatchOfRows(ArrayList<BatchUpdate> list, byte[] tableName)
throws IOException {
- // See HBASE-748 for pseudo code of this method
if (list.isEmpty()) {
return;
}
boolean retryOnlyOne = false;
+ int tries = 0;
Collections.sort(list);
List<BatchUpdate> tempUpdates = new ArrayList<BatchUpdate>();
- byte [] currentRegion = getRegionLocation(tableName, list.get(0).getRow(),
- false).getRegionInfo().getRegionName();
+ HRegionLocation location =
+ getRegionLocationForRowWithRetries(tableName, list.get(0).getRow());
+ byte [] currentRegion = location.getRegionInfo().getRegionName();
byte [] region = currentRegion;
boolean isLastRow = false;
- int tries = 0;
for (int i = 0; i < list.size() && tries < numRetries; i++) {
BatchUpdate batchUpdate = list.get(i);
tempUpdates.add(batchUpdate);
isLastRow = (i + 1) == list.size();
if (!isLastRow) {
- region = getRegionLocation(tableName, list.get(i + 1).getRow(), false)
- .getRegionInfo().getRegionName();
+ location = getRegionLocationForRowWithRetries(tableName,
+ list.get(i+1).getRow());
+ region = location.getRegionInfo().getRegionName();
}
if (!Bytes.equals(currentRegion, region) || isLastRow || retryOnlyOne) {
final BatchUpdate[] updates = tempUpdates.toArray(new BatchUpdate[0]);
- int index = getRegionServerForWithoutRetries(new ServerCallable<Integer>(
+ int index = getRegionServerWithRetries(new ServerCallable<Integer>(
this, tableName, batchUpdate.getRow()) {
public Integer call() throws IOException {
int i = server.batchUpdates(location.getRegionInfo()
@@ -926,8 +959,9 @@
}
i = i - updates.length + index;
retryOnlyOne = true;
- region = getRegionLocation(tableName, list.get(i + 1).getRow(),
- true).getRegionInfo().getRegionName();
+ location = getRegionLocationForRowWithRetries(tableName,
+ list.get(i + 1).getRow());
+ region = location.getRegionInfo().getRegionName();
}
else {
retryOnlyOne = false;
Modified: hadoop/hbase/trunk/src/webapps/master/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/webapps/master/WEB-INF/web.xml?rev=731817&r1=731816&r2=731817&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/webapps/master/WEB-INF/web.xml (original)
+++ hadoop/hbase/trunk/src/webapps/master/WEB-INF/web.xml Mon Jan 5 19:22:40 2009
@@ -15,13 +15,13 @@
</servlet>
<servlet>
- <servlet-name>org.apache.hadoop.hbase.generated.master.regionhistorian_jsp</servlet-name>
- <servlet-class>org.apache.hadoop.hbase.generated.master.regionhistorian_jsp</servlet-class>
+ <servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
+ <servlet-class>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-class>
</servlet>
<servlet>
- <servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
- <servlet-class>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-class>
+ <servlet-name>org.apache.hadoop.hbase.generated.master.regionhistorian_jsp</servlet-name>
+ <servlet-class>org.apache.hadoop.hbase.generated.master.regionhistorian_jsp</servlet-class>
</servlet>
<servlet-mapping>
@@ -30,13 +30,13 @@
</servlet-mapping>
<servlet-mapping>
- <servlet-name>org.apache.hadoop.hbase.generated.master.regionhistorian_jsp</servlet-name>
- <url-pattern>/regionhistorian.jsp</url-pattern>
+ <servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
+ <url-pattern>/table.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
- <servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
- <url-pattern>/table.jsp</url-pattern>
+ <servlet-name>org.apache.hadoop.hbase.generated.master.regionhistorian_jsp</servlet-name>
+ <url-pattern>/regionhistorian.jsp</url-pattern>
</servlet-mapping>
</web-app>