@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); } }
@Override public DResult delete(byte[] row, long startId) throws IOException { Integer lockId = region.getLock(null, row, true); try { byte[] columnsWritten = MVCC.writeCheckRowStatus(this, getTrxMetaTable(), row, false, lockId, startId); Put deletePut = deletePut(row, startId, columnsWritten); mutateRow(deletePut, lockId); return null; } catch (InvalidRowStatusException e) { return new DResult(null, e.getMessage()); } finally { region.releaseRowLock(lockId); } }
@Override public DResult put(Put put, long startId, boolean locking) throws IOException { Integer lockId = region.getLock(null, put.getRow(), true); try { byte[] columnsWritten = MVCC.writeCheckRowStatus(this, getTrxMetaTable(), put.getRow(), locking, lockId, startId); Put innerPut = clonePut(put, startId, locking, columnsWritten); mutateRow(innerPut, lockId); return null; } catch (InvalidRowStatusException e) { return new DResult(null, e.getMessage()); } finally { region.releaseRowLock(lockId); } }