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); } }
private static void commitColumns(Environment env, PrimaryRowColumn prc, List<Entry<Key, Value>> value, long commitTs, Map<ByteSequence, Mutation> mutations) { for (Entry<Key, Value> entry : value) { if (isPrimary(prc, entry.getKey())) { continue; } long lockTs = entry.getKey().getTimestamp() & ColumnConstants.TIMESTAMP_MASK; // TODO may be that a stronger sanity check that could be done here if (commitTs < lockTs) { throw new IllegalStateException("bad commitTs : " + entry.getKey() + " (" + commitTs + "<" + lockTs + ")"); } Mutation mut = getMutation(entry.getKey().getRowData(), mutations); Column col = SpanUtil.toRowColumn(entry.getKey()).getColumn(); LockValue lv = new LockValue(entry.getValue().get()); ColumnUtil.commitColumn(env, lv.isTrigger(), false, col, lv.isWrite(), lv.isDelete(), lockTs, commitTs, env.getObservers().keySet(), mut); } }
ObserverConfiguration observerConfig = env.getObservers().get(col); if (observerConfig == null) { observerConfig = env.getWeakObservers().get(col);