Github user ohadshacham commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r206490639 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -298,26 +295,58 @@ 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); + if (CellUtils.isFamilyDeleteCell(cell)) { + String key = getRowFamilyString(cell); + + if (familyDeletionCache.containsKey(key)) + return; + + Optional<Long> commitTimeStamp = getTSIfInSnapshot(cell, transaction, commitCache); + + if (!commitTimeStamp.isPresent()) { + commitTimeStamp = getTSIfInTransaction(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 (CellUtils.isFamilyDeleteCell(c)) { + commitTimeStamp = getTSIfInSnapshot(c, transaction, cmtCache); --- End diff -- We start reading backward from the readTimeStamp, therefore, if the transaction wrote family deletion marker then we will find it in line 306.
---