hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1157324 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/mapred/TableRecordReaderImpl.java src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
Date Sat, 13 Aug 2011 05:21:38 GMT
Author: stack
Date: Sat Aug 13 05:21:38 2011
New Revision: 1157324

URL: http://svn.apache.org/viewvc?rev=1157324&view=rev
Log:
HBASE-4196 TableRecordReader may skip first row of region

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapred/TableRecordReaderImpl.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1157324&r1=1157323&r2=1157324&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sat Aug 13 05:21:38 2011
@@ -433,6 +433,7 @@ Release 0.90.5 - Unreleased
                or server includes binary-encoded data (Jonathan Hsieh)
    HBASE-4168  A client continues to try and connect to a powered down
                regionserver (Anirudh Todi)
+   HBASE-4196  TableRecordReader may skip first row of region (Ming Ma)
 
 Release 0.90.4 - August 10, 2011
 

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapred/TableRecordReaderImpl.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapred/TableRecordReaderImpl.java?rev=1157324&r1=1157323&r2=1157324&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapred/TableRecordReaderImpl.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapred/TableRecordReaderImpl.java Sat
Aug 13 05:21:38 2011
@@ -44,7 +44,7 @@ public class TableRecordReaderImpl {
 
   private byte [] startRow;
   private byte [] endRow;
-  private byte [] lastRow;
+  private byte [] lastSuccessfulRow;
   private Filter trrRowFilter;
   private ResultScanner scanner;
   private HTable htable;
@@ -175,16 +175,26 @@ public class TableRecordReaderImpl {
     Result result;
     try {
       result = this.scanner.next();
-    } catch (UnknownScannerException e) {
+    } catch (IOException e) {
       LOG.debug("recovered from " + StringUtils.stringifyException(e));
-      restart(lastRow);
-      this.scanner.next();    // skip presumed already mapped row
+      if (lastSuccessfulRow == null) {
+        LOG.warn("We are restarting the first next() invocation," +
+            " if your mapper's restarted a few other times like this" +
+            " then you should consider killing this job and investigate" +
+            " why it's taking so long.");
+      }
+      if (lastSuccessfulRow == null) {
+        restart(startRow);
+      } else {
+        restart(lastSuccessfulRow);
+        this.scanner.next();    // skip presumed already mapped row
+      }
       result = this.scanner.next();
     }
 
     if (result != null && result.size() > 0) {
       key.set(result.getRow());
-      lastRow = key.get();
+      lastSuccessfulRow = key.get();
       Writables.copyWritable(result, value);
       return true;
     }

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java?rev=1157324&r1=1157323&r2=1157324&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
Sat Aug 13 05:21:38 2011
@@ -42,7 +42,7 @@ public class TableRecordReaderImpl {
   private ResultScanner scanner = null;
   private Scan scan = null;
   private HTable htable = null;
-  private byte[] lastRow = null;
+  private byte[] lastSuccessfulRow = null;
   private ImmutableBytesWritable key = null;
   private Result value = null;
 
@@ -132,20 +132,23 @@ public class TableRecordReaderImpl {
       value = this.scanner.next();
     } catch (IOException e) {
       LOG.debug("recovered from " + StringUtils.stringifyException(e));
-      if (lastRow == null) {
+      if (lastSuccessfulRow == null) {
         LOG.warn("We are restarting the first next() invocation," +
             " if your mapper's restarted a few other times like this" +
             " then you should consider killing this job and investigate" +
             " why it's taking so long.");
-        lastRow = scan.getStartRow();
       }
-      restart(lastRow);
-      scanner.next();    // skip presumed already mapped row
+      if (lastSuccessfulRow == null) {
+        restart(scan.getStartRow());
+      } else {
+        restart(lastSuccessfulRow);
+        scanner.next();    // skip presumed already mapped row
+      }
       value = scanner.next();
     }
     if (value != null && value.size() > 0) {
       key.set(value.getRow());
-      lastRow = key.get();
+      lastSuccessfulRow = key.get();
       return true;
     }
     return false;



Mime
View raw message