public <T> T run(String ztxBulk, long tid, Callable<T> callable) throws Exception { synchronized (counts) { if (!arbitrator.transactionAlive(ztxBulk, tid)) { throw new Exception("Transaction " + tid + " of type " + ztxBulk + " is no longer active"); } AtomicInteger count = counts.get(tid); if (count == null) counts.put(tid, count = new AtomicInteger()); count.incrementAndGet(); } try { return callable.call(); } finally { synchronized (counts) { AtomicInteger count = counts.get(tid); if (count == null) { log.error("unexpected missing count for transaction" + tid); } else { if (count.decrementAndGet() == 0) counts.remove(tid); } } } }
@Override public boolean accept(Key k, Value v) { if (!k.isDeleted() && k.compareColumnFamily(TabletsSection.BulkFileColumnFamily.NAME) == 0) { long txid = Long.parseLong(v.toString()); Status status = bulkTxStatusCache.get(txid); if (status == null) { try { if (arbitrator.transactionComplete(Constants.BULK_ARBITRATOR_TYPE, txid)) { status = Status.INACTIVE; } else { status = Status.ACTIVE; } } catch (Exception e) { status = Status.ACTIVE; log.error("{}", e.getMessage(), e); } bulkTxStatusCache.put(txid, status); } return status == Status.ACTIVE; } return true; }
|| !getArbitrator().transactionAlive(Constants.BULK_ARBITRATOR_TYPE, tid)) { violations = addViolation(violations, 8);
if (otherTidCount > 0 || !dataFiles.equals(loadedFiles) || !getArbitrator().transactionAlive(Constants.BULK_ARBITRATOR_TYPE, tid)) { violations = addViolation(violations, 8);
@Override public boolean accept(Key k, Value v) { if (!k.isDeleted() && k.compareColumnFamily(Constants.METADATA_BULKFILE_COLUMN_FAMILY) == 0) { long txid = Long.valueOf(v.toString()); Status status = bulkTxStatusCache.get(txid); if (status == null) { try { if (arbitrator.transactionComplete(Constants.BULK_ARBITRATOR_TYPE, txid)) { status = Status.INACTIVE; } else { status = Status.ACTIVE; } } catch (Exception e) { status = Status.ACTIVE; log.error(e, e); } bulkTxStatusCache.put(txid, status); } return status == Status.ACTIVE; } return true; }