hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r678918 - /hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java
Date Tue, 22 Jul 2008 21:48:03 GMT
Author: stack
Date: Tue Jul 22 14:48:03 2008
New Revision: 678918

URL: http://svn.apache.org/viewvc?rev=678918&view=rev
Log:
HBASE-761  IOE: Stream closed exception all over logs

Modified:
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java?rev=678918&r1=678917&r2=678918&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java Tue Jul 22
14:48:03 2008
@@ -23,6 +23,7 @@
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -861,8 +862,8 @@
    * us to throw out deleted values or obsolete versions.
    */
   private void compactHStoreFiles(final MapFile.Writer compactedOut,
-      final List<MapFile.Reader> readers) throws IOException {
-    
+      final List<MapFile.Reader> readers)
+  throws IOException {
     MapFile.Reader[] rdrs = readers.toArray(new MapFile.Reader[readers.size()]);
     try {
       HStoreKey[] keys = new HStoreKey[rdrs.length];
@@ -897,7 +898,7 @@
         // therefore the one whose value should make it out to the compacted
         // store file.
         int smallestKey = -1;
-        for(int i = 0; i < rdrs.length; i++) {
+        for (int i = 0; i < rdrs.length; i++) {
           if(done[i]) {
             continue;
           }
@@ -941,8 +942,7 @@
 
         // Advance the smallest key.  If that reader's all finished, then 
         // mark it as done.
-        if(!rdrs[smallestKey].next(keys[smallestKey],
-            vals[smallestKey])) {
+        if (!rdrs[smallestKey].next(keys[smallestKey], vals[smallestKey])) {
           done[smallestKey] = true;
           rdrs[smallestKey].close();
           rdrs[smallestKey] = null;
@@ -950,14 +950,16 @@
         }
       }
     } finally {
-      closeCompactionReaders(readers);
+      closeCompactionReaders(Arrays.asList(rdrs));
     }
   }
   
   private void closeCompactionReaders(final List<MapFile.Reader> rdrs) {
     for (MapFile.Reader r: rdrs) {
       try {
-        r.close();
+        if (r != null) {
+          r.close();
+        }
       } catch (IOException e) {
         LOG.warn("Exception closing reader for " + this.storeNameStr, e);
       }



Mime
View raw message