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

Xinjie Yu commented on HBASE-22003:
-----------------------------------

I am working on my own 2.2.0 branch and encountered the same issue when running 
UT.  

 

After some debugging, I found the timestamps of scan results are quite close. 
In most cases, the timestamp diff is only 1 ms.  
So I guess the root cause is:  
Some put operations are performed within 1ms when running UT in a single node. 
So some put may overwrite others. Finally the fetched versions count is not 
expected.  

I notice testVersionMismatchHBase14905 has tried to avoid such issue while 
testHBase14905 not.  

 

Attached is my patch for your guys' reference.   

I have verified this test for 50 times after patching in my env, and no flaky 
issue is observed.  

{code:java}
diff --git 
a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/replication/TestVerifyReplication.java
 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/replication/TestVerifyReplication.java
index 4ef1214e63..7d12cbcc6b 100644
--- 
a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/replication/TestVerifyReplication.java
+++ 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/replication/TestVerifyReplication.java
@@ -252,11 +252,12 @@ public class TestVerifyReplication extends 
TestReplicationBase {
     // normal Batch tests
     byte[] qualifierName = Bytes.toBytes("f1");
     Put put = new Put(Bytes.toBytes("r1"));
-    put.addColumn(famName, qualifierName, Bytes.toBytes("v1002"));
+    long ts = System.currentTimeMillis();
+    put.addColumn(famName, qualifierName, ts + 1, Bytes.toBytes("v1002"));
     htable1.put(put);
-    put.addColumn(famName, qualifierName, Bytes.toBytes("v1001"));
+    put.addColumn(famName, qualifierName, ts + 2, Bytes.toBytes("v1001"));
     htable1.put(put);
-    put.addColumn(famName, qualifierName, Bytes.toBytes("v1112"));
+    put.addColumn(famName, qualifierName, ts + 3, Bytes.toBytes("v1112"));
     htable1.put(put);
 
     Scan scan = new Scan();
@@ -291,9 +292,9 @@ public class TestVerifyReplication extends 
TestReplicationBase {
       }
     }
 
-    put.addColumn(famName, qualifierName, Bytes.toBytes("v1111"));
+    put.addColumn(famName, qualifierName, ts + 4, Bytes.toBytes("v1111"));
     htable2.put(put);
-    put.addColumn(famName, qualifierName, Bytes.toBytes("v1112"));
+    put.addColumn(famName, qualifierName, ts + 5, Bytes.toBytes("v1112"));
     htable2.put(put);
 
     scan = new Scan();
{code}

 

> Fix flaky test TestVerifyReplication.testHBase14905
> ---------------------------------------------------
>
>                 Key: HBASE-22003
>                 URL: https://issues.apache.org/jira/browse/HBASE-22003
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Guanghao Zhang
>            Assignee: Guanghao Zhang
>            Priority: Major
>
> [ERROR] Failures: 
> [ERROR] TestVerifyReplication.testHBase14905:246 expected:<3> but was:<2>
> [ERROR] Errors: 
> [ERROR] 
> org.apache.hadoop.hbase.replication.TestVerifyReplicationCrossDiffHdfs.org.apache.hadoop.hbase.replication.TestVerifyReplicationCrossDiffHdfs
> [ERROR] Run 1: TestVerifyReplicationCrossDiffHdfs.testVerifyRepBySnapshot:199 
> » TestTimedOut ...
> [ERROR] Run 2: 
> TestVerifyReplicationCrossDiffHdfs.org.apache.hadoop.hbase.replication.TestVerifyReplicationCrossDiffHdfs
>  »
>  
> It failed many time when i try all ut for branch-2.2.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to