public Optional tryToLocateCellCommitTimestamp()

in hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java [243:286]


    public Optional<Long> tryToLocateCellCommitTimestamp(long epoch,
                                                         Cell cell,
                                                         Map<Long, Long> commitCache,
                                                         boolean isLowLatency)
                    throws IOException {

        CommitTimestamp tentativeCommitTimestamp =
                locateCellCommitTimestamp(
                        cell.getTimestamp(),
                        epoch,
                        new CommitTimestampLocatorImpl(
                                new HBaseCellId(null,
                                        CellUtil.cloneRow(cell),
                                        CellUtil.cloneFamily(cell),
                                        CellUtil.cloneQualifier(cell),
                                        cell.getTimestamp()),
                                        commitCache,
                                        tableAccessWrapper),
                        isLowLatency);

        // If transaction that added the cell was invalidated
        if (!tentativeCommitTimestamp.isValid()) {
            return Optional.absent();
        }

        switch (tentativeCommitTimestamp.getLocation()) {
        case COMMIT_TABLE:
            // If the commit timestamp is found in the persisted commit table,
            // that means the writing process of the shadow cell in the post
            // commit phase of the client probably failed, so we heal the shadow
            // cell with the right commit timestamp for avoiding further reads to
            // hit the storage
            healShadowCell(cell, tentativeCommitTimestamp.getValue());
            return Optional.of(tentativeCommitTimestamp.getValue());
        case CACHE:
        case SHADOW_CELL:
            return Optional.of(tentativeCommitTimestamp.getValue());
        case NOT_PRESENT:
            return Optional.absent();
        default:
            assert (false);
            return Optional.absent();
        }
    }