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

Wellington Chevreuil commented on HBASE-21596:
----------------------------------------------

Actually real issue is that scanners are not incrementing versions count for a 
given cell once it's found to be "version_deleted". This is fixable by applying 
the versions check before the delete check. Below a sample code change for the 
*MinorCompactionScanQueryMatcher* that would have this sorted:

{noformat}
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/MinorCompactionScanQueryMatcher.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/MinorCompactionScanQueryMatcher.java
index 2d60acea07..e938320b0a 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/MinorCompactionScanQueryMatcher.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/MinorCompactionScanQueryMatcher.java
@@ -52,12 +52,14 @@ public class MinorCompactionScanQueryMatcher extends 
CompactionScanQueryMatcher
       trackDelete(cell);
       return MatchCode.INCLUDE;
     }
-    returnCode = checkDeleted(deletes, cell);
-    if (returnCode != null) {
-      return returnCode;
+    returnCode = columns.checkVersions(cell, cell.getTimestamp(), typeByte,
+        mvccVersion > maxReadPointToTrackVersions);
+    if(returnCode == MatchCode.INCLUDE ||
+        returnCode == MatchCode.INCLUDE_AND_SEEK_NEXT_COL ||
+        returnCode == MatchCode.INCLUDE_AND_SEEK_NEXT_ROW) {
+      MatchCode deleteReturnCode = checkDeleted(deletes, cell);
+      return deleteReturnCode != null ? deleteReturnCode : returnCode;
     }
-    // Skip checking column since we do not remove column during compaction.
-    return columns.checkVersions(cell, cell.getTimestamp(), typeByte,
-      mvccVersion > maxReadPointToTrackVersions);
+    return returnCode;
   }
 }
{noformat}

More tests are needed and am working on a code reuse, as this check would be be 
needed in other scanners too. At least *NormalUserScanQueryMatcher* would 
require similar change.

> HBase Shell "delete" command can cause older versions to be shown even if 
> VERSIONS is configured as 1
> -----------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-21596
>                 URL: https://issues.apache.org/jira/browse/HBASE-21596
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Wellington Chevreuil
>            Assignee: Wellington Chevreuil
>            Priority: Minor
>
> HBase Shell delete command is supposed to operate over an specific TS. If no 
> TS is informed, it will assume the latest TS for the cell and put delete 
> marker for it. 
> However, for a CF with VERSIONS => 1, if multiple puts were performed for 
> same cell, there may be multiple cell versions on the memstore, so delete 
> would only be "delete marking" one of those, and causing the most recent no 
> marked one to be shown on gets/scans, which then contradicts the CF "VERSIONS 
> => 1" configuration.
> This issue is not seen with deleteall command or using Delete operation from 
> Java API.



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

Reply via email to