hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1584475 - /hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
Date Thu, 03 Apr 2014 23:58:27 GMT
Author: tedyu
Date: Thu Apr  3 23:58:26 2014
New Revision: 1584475

URL: http://svn.apache.org/r1584475
Log:
HBASE-10705 CompactionRequest#toString() may throw NullPointerException (Rekha Joshi)


Modified:
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java?rev=1584475&r1=1584474&r2=1584475&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
Thu Apr  3 23:58:26 2014
@@ -27,6 +27,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.hbase.regionserver.Store;
 import org.apache.hadoop.hbase.regionserver.StoreFile;
+import org.apache.hadoop.hbase.regionserver.StoreFile.Reader;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
 import org.apache.hadoop.util.StringUtils;
 
@@ -202,7 +203,8 @@ public class CompactionRequest implement
               }
           }), new Function<StoreFile, String>() {
             public String apply(StoreFile sf) {
-              return StringUtils.humanReadableInt(sf.getReader().length());
+              return StringUtils.humanReadableInt(
+                (sf.getReader() == null) ? 0 : sf.getReader().length());
             }
           }));
 
@@ -220,7 +222,8 @@ public class CompactionRequest implement
   private void recalculateSize() {
     long sz = 0;
     for (StoreFile sf : this.filesToCompact) {
-      sz += sf.getReader().length();
+      Reader r = sf.getReader();
+      sz += r == null ? 0 : r.length();
     }
     this.totalSize = sz;
   }



Mime
View raw message