private static void checkIfTransactionOutOfDate(byte[] row, HTableWrapper tableWrapper, long startId, List<KeyValue> mergedVersionList, Integer lockId) throws TransactionOutOfDateException, IOException { int verCount = DominoConst.MAX_VERSION < mergedVersionList.size() ? DominoConst.MAX_VERSION : mergedVersionList.size(); if (verCount == DominoConst.MAX_VERSION && mergedVersionList.get(verCount - 1).getTimestamp() > startId) { throw new TransactionOutOfDateException("Transaction out of date."); } if (verCount > 0) return; Get allVer = new Get(row); allVer.addColumn(DominoConst.INNER_FAMILY, DominoConst.VERSION_COL); allVer.setMaxVersions(); Result res = tableWrapper.get(allVer, lockId); List<KeyValue> vers = res.getColumn(DominoConst.INNER_FAMILY, DominoConst.VERSION_COL); if (vers.size() >= DominoConst.MAX_VERSION && vers.get(vers.size() - 1).getTimestamp() > startId) { throw new TransactionOutOfDateException("Transaction out of date."); } }
@SuppressWarnings("deprecation") @Override public DResult get(Get get, long startId) throws IOException { if (get.hasFamilies()) get.addFamily(DominoConst.INNER_FAMILY); get.setTimeRange(0, startId + 1); // [x, y) get.setMaxVersions(); Result preRead = region.get(get); List<KeyValue> status = preRead.getColumn(DominoConst.INNER_FAMILY, DominoConst.STATUS_COL); if (status == null || status.size() == 0) { Result ret = MVCC.handleResult(this, getTrxMetaTable(), preRead, startId, null); return new DResult(ret, null); } Integer lockId = region.getLock(null, get.getRow(), true); try { Result r = MVCC.handleResult(this, getTrxMetaTable(), region.get(get, lockId), startId, lockId); return new DResult(r, null); } catch (TransactionOutOfDateException oode) { return new DResult(null, oode.getMessage()); } catch (InvalidRowStatusException e) { return new DResult(null, e.getMessage()); } finally { region.releaseRowLock(lockId); } }