[ 
https://issues.apache.org/jira/browse/HBASE-15811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15279572#comment-15279572
 ] 

stack commented on HBASE-15811:
-------------------------------

This is a bit ugly. Its mvcc. If I immediately go back again when I get an 
empty result, it works. If I log the mvcc between the get that fails and the 
one that succeeds, we've moved on by a single point. Here is my hack patch:

{code}
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index e620c60..93319c3 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -6868,13 +6868,24 @@ public class HRegion implements HeapSize, 
PropagatingConfigurationObserver, Regi
     long before =  EnvironmentEdgeManager.currentTime();
     Scan scan = new Scan(get);

-    RegionScanner scanner = null;
-    try {
-      scanner = getScanner(scan);
-      scanner.next(results);
-    } finally {
-      if (scanner != null)
-        scanner.close();
+    long lastmvcc = -1l;
+    while (true) {
+      RegionScanner scanner = null;
+      try {
+        scanner = getScanner(scan);
+        scanner.next(results);
+        if (!results.isEmpty() && results.get(0).getRow() != null) {
+          if (lastmvcc != -1l) {
+            LOG.info("SPIN EXIT CURRENT MVCC " + scanner.getMvccReadPoint() + 
"; last mvcc=" + lastmvcc);
+          }
+          break;
+        }
+        lastmvcc = scanner.getMvccReadPoint();
+        LOG.info("SPIN EMPTY " + lastmvcc);
+      } finally {
+        if (scanner != null)
+          scanner.close();
+      }
     }
{code}

Here is the output:

{code}
 10 2016-05-10 22:25:18,283 INFO  
[B.defaultRpcServer.handler=45,queue=45,port=16020] regionserver.HRegion: SPIN 
EMPTY 662
 11 2016-05-10 22:25:18,284 INFO  
[B.defaultRpcServer.handler=45,queue=45,port=16020] regionserver.HRegion: SPIN 
EXIT CURRENT MVCC 663; last mvcc=662
 12 2016-05-10 22:25:18,286 INFO  
[B.defaultRpcServer.handler=45,queue=45,port=16020] regionserver.HRegion: SPIN 
EMPTY 666
 13 2016-05-10 22:25:18,286 INFO  
[B.defaultRpcServer.handler=45,queue=45,port=16020] regionserver.HRegion: SPIN 
EXIT CURRENT MVCC 667; last mvcc=666
 14 2016-05-10 22:25:18,287 INFO  
[B.defaultRpcServer.handler=45,queue=45,port=16020] regionserver.HRegion: SPIN 
EMPTY 666
 15 2016-05-10 22:25:18,288 INFO  
[B.defaultRpcServer.handler=45,queue=45,port=16020] regionserver.HRegion: SPIN 
EXIT CURRENT MVCC 667; last mvcc=666
{code}

... in other words, after getting new Scanner, we've moved the read point on by 
one so we see the Put that just happened.

> Batch Get after batch Put does not fetch all Cells
> --------------------------------------------------
>
>                 Key: HBASE-15811
>                 URL: https://issues.apache.org/jira/browse/HBASE-15811
>             Project: HBase
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 1.2.1
>            Reporter: stack
>            Assignee: stack
>         Attachments: Test.java
>
>
> A big batch put followed by a batch get does not always return all Cells put. 
> See attached test program by Robert Farr that reproduces the issue. It seems 
> to be an issue to do with a cluster of more than one machine. Running against 
> a single machine does not have the problem (though the single machine may 
> have many regions). Robert was unable to make his program fail with a single 
> machine only.
> I reproduced what Robert was seeing running his program. I was also unable to 
> make a single machine fail. In a batch of 1000 puts, I see one to three Gets 
> fail. I noticed too that if I wait a second after a fail and then re-get, the 
> Get succeeds.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to