[ https://issues.apache.org/jira/browse/OMID-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16561024#comment-16561024 ]
ASF GitHub Bot commented on OMID-105: ------------------------------------- Github user yonigottesman commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r205961939 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -298,26 +291,62 @@ public CommitTimestamp locateCellCommitTimestamp(long cellStartTimestamp, long e return commitCache; } - private void buildFamilyDeletionCache(List<Cell> rawCells, Map<String, List<Cell>> familyDeletionCache) { - + private void buildFamilyDeletionCache(HBaseTransaction transaction, List<Cell> rawCells, Map<String, Long> familyDeletionCache, Map<Long, Long> commitCache, Map<String,byte[]> attributeMap) throws IOException { for (Cell cell : rawCells) { if (CellUtil.matchingQualifier(cell, CellUtils.FAMILY_DELETE_QUALIFIER) && CellUtil.matchingValue(cell, HConstants.EMPTY_BYTE_ARRAY)) { - String row = Bytes.toString(cell.getRow()); - List<Cell> cells = familyDeletionCache.get(row); - if (cells == null) { - cells = new ArrayList<>(); - familyDeletionCache.put(row, cells); + String family = Bytes.toString(cell.getFamily()); + String key = row + ":" + family; + + if (familyDeletionCache.containsKey(key)) + return; + + Optional<Long> commitTimeStamp = isCellInSnapshot(cell, transaction, commitCache); + + if (!commitTimeStamp.isPresent()) { + commitTimeStamp = isCellInTransaction(cell, transaction, commitCache); } - cells.add(cell); + if (commitTimeStamp.isPresent()) { + familyDeletionCache.put(key, commitTimeStamp.get()); + } else { + Cell lastCell = cell; + Map<Long, Long> cmtCache; + boolean foundCommitttedFamilyDeletion = false; + while (!foundCommitttedFamilyDeletion) { + + Get g = createPendingGet(lastCell, 3); + for (Map.Entry<String,byte[]> entry : attributeMap.entrySet()) { + g.setAttribute(entry.getKey(), entry.getValue()); + } + + Result result = tableAccessWrapper.get(g); + List<Cell> resultCells = result.listCells(); + if (resultCells == null) { + break; + } + + cmtCache = buildCommitCache(resultCells); + for (Cell c : resultCells) { + if (CellUtil.matchingQualifier(c, CellUtils.FAMILY_DELETE_QUALIFIER) && + CellUtil.matchingValue(c, HConstants.EMPTY_BYTE_ARRAY)) { + commitTimeStamp = isCellInSnapshot(c, transaction, cmtCache); + if (commitTimeStamp.isPresent()) { + familyDeletionCache.put(key, commitTimeStamp.get()); + foundCommitttedFamilyDeletion = true; + break; + } + lastCell = c; + } + } + } + } } } - } - private boolean isCellInTransaction(Cell kv, HBaseTransaction transaction, Map<Long, Long> commitCache) { + private Optional<Long> isCellInTransaction(Cell kv, HBaseTransaction transaction, Map<Long, Long> commitCache) { --- End diff -- rename function because we dont return boolean now. maybe: "getTSIfInTransaction" > Family deletion seek should continue when a tentative value is found > --------------------------------------------------------------------- > > Key: OMID-105 > URL: https://issues.apache.org/jira/browse/OMID-105 > Project: Apache Omid > Issue Type: Sub-task > Reporter: Ohad Shacham > Assignee: Ohad Shacham > Priority: Major > > > When a tentative family deletion marker is found. We need to continue looking > until we either find a committed one in the past or no committed family > deletion marker for this column is found. Otherwise, we might miss committed > family deletion markers that exists in a transaction snapshot. -- This message was sent by Atlassian JIRA (v7.6.3#76005)