From fc2157ae44ed05b36127c5284f171e286ffcc4dd Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Sat, 10 Jan 2009 00:59:30 +0000 Subject: [PATCH] HBASE-1114 Weird NPEs compacting git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@733213 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../hbase/regionserver/HRegionServer.java | 5 +++-- .../hadoop/hbase/regionserver/HStore.java | 6 ++++-- src/webapps/master/WEB-INF/web.xml | 18 +++++++++--------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2eee1f231ff..fc95740985f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -137,6 +137,7 @@ Release 0.19.0 - Unreleased IllegalStateException: Cannot set a region to be closed it it was not already marked as closing, Does not recover if HRS carrying -ROOT- goes down + HBASE-1114 Weird NPEs compacting IMPROVEMENTS HBASE-901 Add a limit to key length, check key and value length on client side diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index a17910b53f9..a3fc106846b 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -696,8 +696,9 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable { private boolean checkOOME(final Throwable e) { boolean stop = false; if (e instanceof OutOfMemoryError || - (e.getCause()!= null && e.getCause() instanceof OutOfMemoryError) || - e.getMessage().contains("java.lang.OutOfMemoryError")) { + (e.getCause() != null && e.getCause() instanceof OutOfMemoryError) || + (e.getMessage() != null && + e.getMessage().contains("java.lang.OutOfMemoryError"))) { LOG.fatal("OutOfMemoryError, aborting.", e); abort(); stop = true; diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HStore.java b/src/java/org/apache/hadoop/hbase/regionserver/HStore.java index 55096780036..b56df68a801 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HStore.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HStore.java @@ -866,8 +866,10 @@ public class HStore implements HConstants { return null; } int len = 0; - for (FileStatus fstatus:fs.listStatus(path)) { - len += fstatus.getLen(); + // listStatus can come back null. + FileStatus [] fss = this.fs.listStatus(path); + for (int ii = 0; fss != null && i < fss.length; ii++) { + len += fss[ii].getLen(); } fileSizes[i] = len; totalSize += len; diff --git a/src/webapps/master/WEB-INF/web.xml b/src/webapps/master/WEB-INF/web.xml index 6f1d7998038..2c7766d2c19 100644 --- a/src/webapps/master/WEB-INF/web.xml +++ b/src/webapps/master/WEB-INF/web.xml @@ -15,13 +15,13 @@ Automatically created by Tomcat JspC. - org.apache.hadoop.hbase.generated.master.table_jsp - org.apache.hadoop.hbase.generated.master.table_jsp + org.apache.hadoop.hbase.generated.master.regionhistorian_jsp + org.apache.hadoop.hbase.generated.master.regionhistorian_jsp - org.apache.hadoop.hbase.generated.master.regionhistorian_jsp - org.apache.hadoop.hbase.generated.master.regionhistorian_jsp + org.apache.hadoop.hbase.generated.master.table_jsp + org.apache.hadoop.hbase.generated.master.table_jsp @@ -29,15 +29,15 @@ Automatically created by Tomcat JspC. /master.jsp - - org.apache.hadoop.hbase.generated.master.table_jsp - /table.jsp - - org.apache.hadoop.hbase.generated.master.regionhistorian_jsp /regionhistorian.jsp + + org.apache.hadoop.hbase.generated.master.table_jsp + /table.jsp + +