import com.google.common.base.Preconditions;
import com.google.common.primitives.UnsignedLong;
import com.google.common.util.concurrent.FutureCallback;
+import java.util.List;
import java.util.Optional;
import java.util.SortedSet;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
private RuntimeException lastBatchedModificationsException;
private int totalBatchedModificationsReceived;
+ private int totalOperationsProcessed;
private ShardDataTreeCohort cohort;
private boolean doImmediateCommit;
private ActorRef replySender;
return totalBatchedModificationsReceived;
}
+ int getTotalOperationsProcessed() {
+ return totalOperationsProcessed;
+ }
+
RuntimeException getLastBatchedModificationsException() {
return lastBatchedModificationsException;
}
@SuppressWarnings("checkstyle:IllegalCatch")
- void applyModifications(final Iterable<Modification> modifications) {
+ void applyModifications(final List<Modification> modifications) {
totalBatchedModificationsReceived++;
if (lastBatchedModificationsException == null) {
+ totalOperationsProcessed += modifications.size();
for (Modification modification : modifications) {
try {
modification.apply(transaction.getSnapshot());
}
if (log.isDebugEnabled()) {
- log.debug("{}: Readying Tx {}, client version {}", name,
- batched.getTransactionId(), batched.getVersion());
+ log.debug("{}: Readying Tx {} of {} operations, client version {}", name,
+ batched.getTransactionId(), cohortEntry.getTotalOperationsProcessed(), batched.getVersion());
}
cohortEntry.setDoImmediateCommit(batched.isDoCommitOnReady());
ShardDataTreeCohort finishTransaction(final ReadWriteShardDataTreeTransaction transaction,
final java.util.Optional<SortedSet<String>> participatingShardNames) {
final DataTreeModification snapshot = transaction.getSnapshot();
+ final TransactionIdentifier id = transaction.getIdentifier();
+ LOG.debug("{}: readying transaction {}", logContext, id);
snapshot.ready();
+ LOG.debug("{}: transaction {} ready", logContext, id);
return createReadyCohort(transaction.getIdentifier(), snapshot, participatingShardNames);
}
final SimpleShardDataTreeCohort current = entry.cohort;
Verify.verify(cohort.equals(current), "Attempted to pre-commit %s while %s is pending", cohort, current);
- LOG.debug("{}: Preparing transaction {}", logContext, current.getIdentifier());
+ final TransactionIdentifier currentId = current.getIdentifier();
+ LOG.debug("{}: Preparing transaction {}", logContext, currentId);
final DataTreeCandidateTip candidate;
try {
candidate = tip.prepare(cohort.getDataTreeModification());
+ LOG.debug("{}: Transaction {} candidate ready", logContext, currentId);
} catch (RuntimeException e) {
failPreCommit(e);
return;
pendingTransactions.remove();
pendingCommits.add(entry);
- LOG.debug("{}: Transaction {} prepared", logContext, current.getIdentifier());
+ LOG.debug("{}: Transaction {} prepared", logContext, currentId);
cohort.successfulPreCommit(candidate);