private Optional getCommitIfInSnapshot()

in hbase-coprocessor/src/main/java/org/apache/omid/transaction/TransactionVisibilityFilterBase.java [149:186]


    private Optional<Long> getCommitIfInSnapshot(Cell v, boolean getShadowCellBeforeCT) throws IOException {
        Long cachedCommitTS = commitCache.get(v.getTimestamp());
        if (cachedCommitTS != null) {
            if (hbaseTransaction.getStartTimestamp() >= cachedCommitTS) {
                return Optional.of(cachedCommitTS);
            } else {
                return Optional.absent();
            }
        }
        if (snapshotFilter.getTSIfInTransaction(v, hbaseTransaction).isPresent()) {
            return Optional.of(v.getTimestamp());
        }

        if (getShadowCellBeforeCT) {

            // Try to get shadow cell from region
            final Get get = new Get(CellUtil.cloneRow(v));
            get.setTimestamp(v.getTimestamp()).readVersions(1);
            get.addColumn(CellUtil.cloneFamily(v), CellUtils.addShadowCellSuffixPrefix(CellUtils.FAMILY_DELETE_QUALIFIER));
            Result shadowCell = snapshotFilter.getTableAccessWrapper().get(get);

            if (!shadowCell.isEmpty()) {
                long commitTS = Bytes.toLong(CellUtil.cloneValue(shadowCell.rawCells()[0]));
                commitCache.put(v.getTimestamp(), commitTS);
                if (commitTS <= hbaseTransaction.getStartTimestamp()) {
                    return Optional.of(commitTS);
                }
            }
        }

        Optional<Long> commitTS = snapshotFilter.getTSIfInSnapshot(v, hbaseTransaction, commitCache);
        if (commitTS.isPresent()) {
            commitCache.put(v.getTimestamp(), commitTS.get());
        } else {
            commitCache.put(v.getTimestamp(), Long.MAX_VALUE);
        }
        return commitTS;
    }