@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); } }
public void putStateful(Put put, HTableInterface table) throws IOException { checkIfReadyToContinue(); try { DominoIface iface = table.coprocessorProxy(DominoIface.class, put.getRow()); DResult res = iface.put(put, startId, true); if (res != null) { throw new IOException(res.getErrMsg()); } addCommit(put.getRow(), false, table); } catch (IOException e) { readyToCommit = false; throw e; } catch (Throwable t) { readyToCommit = false; throw new IOException(t); } }
@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); } }
public void put(Put put, HTableInterface table) throws IOException { checkIfReadyToContinue(); try { DominoIface iface = table.coprocessorProxy(DominoIface.class, put.getRow()); DResult res = iface.put(put, startId, false); if (res != null) { throw new IOException(res.getErrMsg()); } addCommit(put.getRow(), false, table); } catch (IOException e) { readyToCommit = false; throw e; } catch (Throwable t) { readyToCommit = false; throw new IOException(t); } }
public Result get(Get get, HTableInterface table) throws IOException { checkIfReadyToContinue(); try { DominoIface iface = table.coprocessorProxy(DominoIface.class, get.getRow()); DResult res = iface.get(get, startId); if (res.getErrMsg() != null) { throw new IOException(res.getErrMsg()); } return res.getResult(); } catch (IOException e) { readyToCommit = false; throw e; } catch (Throwable t) { readyToCommit = false; throw new IOException(t); } }
@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); } }
public Result get(Get get, HTableInterface table) throws IOException { checkIfReadyToContinue(); try { DominoIface iface = table.coprocessorProxy(DominoIface.class, get.getRow()); DResult res = iface.get(get, startId); if (res.getErrMsg() != null) { throw new IOException(res.getErrMsg()); } return res.getResult(); } catch (IOException e) { disable(); throw e; } catch (Throwable t) { disable(); throw new IOException(t); } }