private boolean isTriggerRow(Bytes row) { return notification != null && notification.getRow().equals(row); }
public boolean preCommit(CommitData cd) throws TableNotFoundException, AccumuloException, AccumuloSecurityException, AlreadyAcknowledgedException { if (notification != null) { // always want to throw already ack exception if collision, so process trigger first return preCommit(cd, notification.getRow(), notification.getColumn()); } else { Bytes prow = updates.keySet().iterator().next(); Map<Column, Bytes> colSet = updates.get(prow); Column pcol = colSet.keySet().iterator().next(); return preCommit(cd, prow, pcol); } }
public TracingTransaction(TransactionImpl tx, Notification notification, Class<?> clazz) { this.tx = tx; this.txid = tx.getStartTs(); this.notification = notification; this.clazz = clazz; if (log.isTraceEnabled()) { log.trace("txid: {} begin() thread: {}", txid, Thread.currentThread().getId()); if (notification != null) { log.trace("txid: {} trigger: {} {} {}", txid, enc(notification.getRow()), enc(notification.getColumn()), notification.getTimestamp()); } if (clazz != null) { log.trace("txid: {} class: {}", txid, clazz.getName()); } } }
public TransactionImpl(Environment env, Notification trigger, long startTs) { Preconditions.checkNotNull(env, "environment cannot be null"); Preconditions.checkArgument(startTs >= 0, "startTs cannot be negative"); this.env = env; this.stats = new TxStats(env); this.startTs = startTs; this.observedColumns = env.getObservers().keySet(); if (trigger != null && env.getWeakObservers().containsKey(trigger.getColumn())) { this.weakNotification = trigger; } else { this.notification = trigger; } if (notification != null) { Map<Column, Bytes> colUpdates = new HashMap<>(); colUpdates.put(notification.getColumn(), null); updates.put(notification.getRow(), colUpdates); } }
@Override public void commit() throws CommitException { try { tx.commit(); committed = true; log.trace("txid: {} commit() -> SUCCESSFUL commitTs: {}", txid, tx.getStats().getCommitTs()); } catch (CommitException ce) { log.trace("txid: {} commit() -> UNSUCCESSFUL commitTs: {}", txid, tx.getStats().getCommitTs()); if (!log.isTraceEnabled() && notification != null) { collisionLog.trace("txid: {} trigger: {} {} {}", txid, notification.getRow(), notification.getColumn(), notification.getTimestamp()); } if (!log.isTraceEnabled() && clazz != null) { collisionLog.trace("txid: {} class: {}", txid, clazz.getName()); } collisionLog.trace("txid: {} collisions: {}", txid, tx.getStats().getRejected()); throw ce; } }
@VisibleForTesting static boolean shouldProcess(Notification notification, int divisor, int remainder) { byte[] cfcq = NotificationUtil.encodeCol(notification.getColumn()); return NotificationHashFilter.accept( ByteUtil.toByteSequence((MutableBytes) notification.getRow()), new ArrayByteSequence(cfcq), divisor, remainder); }
observer.process(tx, notification.getRow(), notification.getColumn()); tx.commit(); status = TxResult.COMMITTED;
public Flutation newDelete(Environment env, long ts) { Flutation m = new Flutation(env, getRow()); ColumnVisibility cv = env.getSharedResources().getVisCache().getCV(getColumn()); m.put(ColumnConstants.NOTIFY_CF.toArray(), encodeCol(getColumn()), cv, encodeTs(ts, true), TransactionImpl.EMPTY); return m; }