hbase git commit: HBASE-21127 TableRecordReader need to handle cursor result too

2018-09-05 Thread zghao
Repository: hbase
Updated Branches:
  refs/heads/branch-2.0 4bf313439 -> a8da63c74


HBASE-21127 TableRecordReader need to handle cursor result too


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/a8da63c7
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a8da63c7
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a8da63c7

Branch: refs/heads/branch-2.0
Commit: a8da63c742b151d445795b828fd6bed9013d41b6
Parents: 4bf3134
Author: Guanghao Zhang 
Authored: Fri Aug 31 11:25:09 2018 +0800
Committer: Guanghao Zhang 
Committed: Wed Sep 5 14:56:52 2018 +0800

--
 .../hbase/mapreduce/TableRecordReaderImpl.java  |   8 ++
 .../hbase/mapreduce/TestTableRecordReader.java  | 132 +++
 2 files changed, 140 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/a8da63c7/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
--
diff --git 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
index f8d13bd..20c7b94 100644
--- 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
+++ 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
@@ -240,12 +240,20 @@ public class TableRecordReaderImpl {
 if (value != null && value.isStale()) numStale++;
 numRestarts++;
   }
+
   if (value != null && value.size() > 0) {
 key.set(value.getRow());
 lastSuccessfulRow = key.get();
 return true;
   }
 
+  // Need handle cursor result
+  if (value != null && value.isCursor()) {
+key.set(value.getCursor().getRow());
+lastSuccessfulRow = key.get();
+return true;
+  }
+
   updateCounters();
   return false;
 } catch (IOException ioe) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/a8da63c7/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
--
diff --git 
a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
new file mode 100644
index 000..88e40a7
--- /dev/null
+++ 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mapreduce;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTestConst;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.regionserver.StoreScanner;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(MediumTests.class)
+public class TestTableRecordReader {
+  private final static HBaseTestingUtility TEST_UTIL = new 
HBaseTestingUtility();
+
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+  HBaseClassTestRule.forClass(TestTableRecordReader.class);
+
+  private static 

hbase git commit: HBASE-21127 TableRecordReader need to handle cursor result too

2018-09-05 Thread zghao
Repository: hbase
Updated Branches:
  refs/heads/branch-1.4 e88436798 -> 15f17302e


HBASE-21127 TableRecordReader need to handle cursor result too


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/15f17302
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/15f17302
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/15f17302

Branch: refs/heads/branch-1.4
Commit: 15f17302e47bbc3aeed3b84699a2859c30df8a84
Parents: e884367
Author: Guanghao Zhang 
Authored: Wed Sep 5 11:58:45 2018 +0800
Committer: Guanghao Zhang 
Committed: Wed Sep 5 14:49:30 2018 +0800

--
 .../hbase/mapreduce/TableRecordReaderImpl.java  |   8 ++
 .../hbase/mapreduce/TestTableRecordReader.java  | 126 +++
 2 files changed, 134 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/15f17302/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
index a8ed5f1..cd9877a 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
@@ -243,12 +243,20 @@ public class TableRecordReaderImpl {
 if (value != null && value.isStale()) numStale++;
 numRestarts++;
   }
+
   if (value != null && value.size() > 0) {
 key.set(value.getRow());
 lastSuccessfulRow = key.get();
 return true;
   }
 
+  // Need handle cursor result
+  if (value != null && value.isCursor()) {
+key.set(value.getCursor().getRow());
+lastSuccessfulRow = key.get();
+return true;
+  }
+
   updateCounters();
   return false;
 } catch (IOException ioe) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/15f17302/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
--
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
new file mode 100644
index 000..c500405
--- /dev/null
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
@@ -0,0 +1,126 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mapreduce;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTestConst;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.regionserver.StoreScanner;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(MediumTests.class)
+public class TestTableRecordReader {
+  private final static HBaseTestingUtility TEST_UTIL = new 
HBaseTestingUtility();
+
+  private static TableName TABLE_NAME = 
TableName.valueOf("TestTableRecordReader");
+
+  private static int NUM_ROWS = 5;
+  private static byte[] ROW = Bytes.toBytes("testRow");
+  private static byte[][] ROWS = HTestConst.makeNAscii(ROW, NUM_ROWS);
+
+  

hbase git commit: HBASE-21127 TableRecordReader need to handle cursor result too

2018-09-05 Thread zghao
Repository: hbase
Updated Branches:
  refs/heads/branch-1 cf198a65e -> dbb634ad1


HBASE-21127 TableRecordReader need to handle cursor result too


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/dbb634ad
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/dbb634ad
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/dbb634ad

Branch: refs/heads/branch-1
Commit: dbb634ad1b82226993c844f41f39edb90382dcc7
Parents: cf198a6
Author: Guanghao Zhang 
Authored: Wed Sep 5 11:58:45 2018 +0800
Committer: Guanghao Zhang 
Committed: Wed Sep 5 14:46:59 2018 +0800

--
 .../hbase/mapreduce/TableRecordReaderImpl.java  |   8 ++
 .../hbase/mapreduce/TestTableRecordReader.java  | 126 +++
 2 files changed, 134 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/dbb634ad/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
index a8ed5f1..cd9877a 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
@@ -243,12 +243,20 @@ public class TableRecordReaderImpl {
 if (value != null && value.isStale()) numStale++;
 numRestarts++;
   }
+
   if (value != null && value.size() > 0) {
 key.set(value.getRow());
 lastSuccessfulRow = key.get();
 return true;
   }
 
+  // Need handle cursor result
+  if (value != null && value.isCursor()) {
+key.set(value.getCursor().getRow());
+lastSuccessfulRow = key.get();
+return true;
+  }
+
   updateCounters();
   return false;
 } catch (IOException ioe) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/dbb634ad/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
--
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
new file mode 100644
index 000..c500405
--- /dev/null
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
@@ -0,0 +1,126 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mapreduce;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTestConst;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.regionserver.StoreScanner;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(MediumTests.class)
+public class TestTableRecordReader {
+  private final static HBaseTestingUtility TEST_UTIL = new 
HBaseTestingUtility();
+
+  private static TableName TABLE_NAME = 
TableName.valueOf("TestTableRecordReader");
+
+  private static int NUM_ROWS = 5;
+  private static byte[] ROW = Bytes.toBytes("testRow");
+  private static byte[][] ROWS = HTestConst.makeNAscii(ROW, NUM_ROWS);
+
+  private 

hbase git commit: HBASE-21127 TableRecordReader need to handle cursor result too

2018-09-04 Thread zghao
Repository: hbase
Updated Branches:
  refs/heads/branch-2.1 c64814ec9 -> 198aa5dab


HBASE-21127 TableRecordReader need to handle cursor result too


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/198aa5da
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/198aa5da
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/198aa5da

Branch: refs/heads/branch-2.1
Commit: 198aa5dab48e8a6490ee23f4dc08fab7028ef699
Parents: c64814e
Author: Guanghao Zhang 
Authored: Fri Aug 31 11:25:09 2018 +0800
Committer: Guanghao Zhang 
Committed: Wed Sep 5 11:10:30 2018 +0800

--
 .../hbase/mapreduce/TableRecordReaderImpl.java  |   8 ++
 .../hbase/mapreduce/TestTableRecordReader.java  | 132 +++
 2 files changed, 140 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/198aa5da/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
--
diff --git 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
index f8d13bd..20c7b94 100644
--- 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
+++ 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
@@ -240,12 +240,20 @@ public class TableRecordReaderImpl {
 if (value != null && value.isStale()) numStale++;
 numRestarts++;
   }
+
   if (value != null && value.size() > 0) {
 key.set(value.getRow());
 lastSuccessfulRow = key.get();
 return true;
   }
 
+  // Need handle cursor result
+  if (value != null && value.isCursor()) {
+key.set(value.getCursor().getRow());
+lastSuccessfulRow = key.get();
+return true;
+  }
+
   updateCounters();
   return false;
 } catch (IOException ioe) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/198aa5da/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
--
diff --git 
a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
new file mode 100644
index 000..88e40a7
--- /dev/null
+++ 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mapreduce;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTestConst;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.regionserver.StoreScanner;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(MediumTests.class)
+public class TestTableRecordReader {
+  private final static HBaseTestingUtility TEST_UTIL = new 
HBaseTestingUtility();
+
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+  HBaseClassTestRule.forClass(TestTableRecordReader.class);
+
+  private static 

hbase git commit: HBASE-21127 TableRecordReader need to handle cursor result too

2018-09-04 Thread zghao
Repository: hbase
Updated Branches:
  refs/heads/branch-2 dee13ea40 -> d39be48f0


HBASE-21127 TableRecordReader need to handle cursor result too


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/d39be48f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d39be48f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d39be48f

Branch: refs/heads/branch-2
Commit: d39be48f04a07e6a44e810e9aae2e0ff71887087
Parents: dee13ea
Author: Guanghao Zhang 
Authored: Fri Aug 31 11:25:09 2018 +0800
Committer: Guanghao Zhang 
Committed: Wed Sep 5 10:41:02 2018 +0800

--
 .../hbase/mapreduce/TableRecordReaderImpl.java  |   8 ++
 .../hbase/mapreduce/TestTableRecordReader.java  | 132 +++
 2 files changed, 140 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/d39be48f/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
--
diff --git 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
index f8d13bd..20c7b94 100644
--- 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
+++ 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
@@ -240,12 +240,20 @@ public class TableRecordReaderImpl {
 if (value != null && value.isStale()) numStale++;
 numRestarts++;
   }
+
   if (value != null && value.size() > 0) {
 key.set(value.getRow());
 lastSuccessfulRow = key.get();
 return true;
   }
 
+  // Need handle cursor result
+  if (value != null && value.isCursor()) {
+key.set(value.getCursor().getRow());
+lastSuccessfulRow = key.get();
+return true;
+  }
+
   updateCounters();
   return false;
 } catch (IOException ioe) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/d39be48f/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
--
diff --git 
a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
new file mode 100644
index 000..88e40a7
--- /dev/null
+++ 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mapreduce;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTestConst;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.regionserver.StoreScanner;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(MediumTests.class)
+public class TestTableRecordReader {
+  private final static HBaseTestingUtility TEST_UTIL = new 
HBaseTestingUtility();
+
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+  HBaseClassTestRule.forClass(TestTableRecordReader.class);
+
+  private static 

hbase git commit: HBASE-21127 TableRecordReader need to handle cursor result too

2018-09-04 Thread zghao
Repository: hbase
Updated Branches:
  refs/heads/master b62ac3cb1 -> bb657c2d2


HBASE-21127 TableRecordReader need to handle cursor result too


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/bb657c2d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/bb657c2d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/bb657c2d

Branch: refs/heads/master
Commit: bb657c2d2e824bd32f1df1fc8a8051bf875b2ff7
Parents: b62ac3c
Author: Guanghao Zhang 
Authored: Fri Aug 31 11:25:09 2018 +0800
Committer: Guanghao Zhang 
Committed: Wed Sep 5 10:34:07 2018 +0800

--
 .../hbase/mapreduce/TableRecordReaderImpl.java  |   8 ++
 .../hbase/mapreduce/TestTableRecordReader.java  | 132 +++
 2 files changed, 140 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/bb657c2d/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
--
diff --git 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
index f8d13bd..20c7b94 100644
--- 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
+++ 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
@@ -240,12 +240,20 @@ public class TableRecordReaderImpl {
 if (value != null && value.isStale()) numStale++;
 numRestarts++;
   }
+
   if (value != null && value.size() > 0) {
 key.set(value.getRow());
 lastSuccessfulRow = key.get();
 return true;
   }
 
+  // Need handle cursor result
+  if (value != null && value.isCursor()) {
+key.set(value.getCursor().getRow());
+lastSuccessfulRow = key.get();
+return true;
+  }
+
   updateCounters();
   return false;
 } catch (IOException ioe) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/bb657c2d/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
--
diff --git 
a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
new file mode 100644
index 000..88e40a7
--- /dev/null
+++ 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableRecordReader.java
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mapreduce;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTestConst;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.regionserver.StoreScanner;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(MediumTests.class)
+public class TestTableRecordReader {
+  private final static HBaseTestingUtility TEST_UTIL = new 
HBaseTestingUtility();
+
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+  HBaseClassTestRule.forClass(TestTableRecordReader.class);
+
+  private static