yonigottesman commented on a change in pull request #59: [OMID-146] Fix consistensy of compaction when the commit time stamp has… URL: https://github.com/apache/incubator-omid/pull/59#discussion_r279189564
########## File path: hbase-coprocessor/src/main/java/org/apache/omid/transaction/CompactorScanner.java ########## @@ -228,43 +228,90 @@ private long getLowWatermarkFromCommitTable() throws IOException { } } - private Optional<CommitTimestamp> queryCommitTimestamp(Cell cell) throws IOException { - Optional<CommitTimestamp> cachedValue = commitCache.get(cell.getTimestamp()); - if (cachedValue != null) { - return cachedValue; - } + + private Result getShadowCell(byte[] row, byte[] family, byte[] qualifier, long timestamp) throws IOException { + Get g = new Get(row); + g.addColumn(family, qualifier); + g.setTimeStamp(timestamp); + Result r = hRegion.get(g); + return r; + } + + + private Optional<CommitTimestamp> getCommitTimestampWithRaces(Cell cell) throws IOException { try { + byte[] family = CellUtil.cloneFamily(cell); + byte[] qualifier = CellUtils.addShadowCellSuffixPrefix(cell.getQualifierArray(), + cell.getQualifierOffset(), + cell.getQualifierLength()); + // 2) Then check the commit table Optional<CommitTimestamp> ct = commitTableClient.getCommitTimestamp(cell.getTimestamp()).get(); if (ct.isPresent()) { - commitCache.put(cell.getTimestamp(), ct); - return Optional.of(ct.get()); - } else { - Get g = new Get(CellUtil.cloneRow(cell)); - byte[] family = CellUtil.cloneFamily(cell); - byte[] qualifier = CellUtils.addShadowCellSuffixPrefix(cell.getQualifierArray(), - cell.getQualifierOffset(), - cell.getQualifierLength()); - g.addColumn(family, qualifier); - g.setTimeStamp(cell.getTimestamp()); - Result r = hRegion.get(g); - if (r.containsColumn(family, qualifier)) { + if (ct.get().isValid()) { + return Optional.of(ct.get()); + } + // If invalid still should check sc because maybe we are in lowlatency mode. Review comment: or another scanner ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services