From 647fcf3b6ed4fb42f462be03e71f6d8244f71056 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 6 Jul 2016 17:33:20 +0200 Subject: [PATCH] BUG-5280: do not pass SchemaContext to ShardCommitCoordinator ShardCommitCoordinator already has a reference to the ShardDataTree, there is no point in passing the same SchemaContext in. Change-Id: I307a0b1b744a3a134807799effbf434a111ff54b Signed-off-by: Robert Varga --- .../controller/cluster/datastore/Shard.java | 4 ++-- .../cluster/datastore/ShardCommitCoordinator.java | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index b6b7ae12c8..f9f4350e9e 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -464,7 +464,7 @@ public class Shard extends RaftActor { protected void handleBatchedModificationsLocal(BatchedModifications batched, ActorRef sender) { try { - commitCoordinator.handleBatchedModifications(batched, sender, this, store.getSchemaContext()); + commitCoordinator.handleBatchedModifications(batched, sender, this); } catch (Exception e) { LOG.error("{}: Error handling BatchedModifications for Tx {}", persistenceId(), batched.getTransactionID(), e); @@ -533,7 +533,7 @@ public class Shard extends RaftActor { boolean isLeaderActive = isLeaderActive(); if (isLeader() && isLeaderActive) { try { - commitCoordinator.handleReadyLocalTransaction(message, getSender(), this, store.getSchemaContext()); + commitCoordinator.handleReadyLocalTransaction(message, getSender(), this); } catch (Exception e) { LOG.error("{}: Error handling ReadyLocalTransaction for Tx {}", persistenceId(), message.getTransactionID(), e); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java index 822586e963..08ba31f79b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java @@ -170,14 +170,13 @@ final class ShardCommitCoordinator { * * @param batched the BatchedModifications message to process * @param sender the sender of the message - * @param shard the transaction's shard actor */ - void handleBatchedModifications(BatchedModifications batched, ActorRef sender, Shard shard, SchemaContext schema) { + void handleBatchedModifications(BatchedModifications batched, ActorRef sender, Shard shard) { CohortEntry cohortEntry = cohortCache.get(batched.getTransactionID()); if(cohortEntry == null) { cohortEntry = new CohortEntry(batched.getTransactionID(), dataTree.newReadWriteTransaction(batched.getTransactionID()), - cohortRegistry, schema, batched.getVersion()); + cohortRegistry, dataTree.getSchemaContext(), batched.getVersion()); cohortCache.put(cohortEntry.getTransactionID(), cohortEntry); } @@ -233,12 +232,11 @@ final class ShardCommitCoordinator { * @param sender the sender of the message * @param shard the transaction's shard actor */ - void handleReadyLocalTransaction(ReadyLocalTransaction message, ActorRef sender, Shard shard, - SchemaContext schema) { + void handleReadyLocalTransaction(ReadyLocalTransaction message, ActorRef sender, Shard shard) { final ShardDataTreeCohort cohort = new SimpleShardDataTreeCohort(dataTree, message.getModification(), message.getTransactionID()); - final CohortEntry cohortEntry = new CohortEntry(message.getTransactionID(), cohort, cohortRegistry, schema, - DataStoreVersions.CURRENT_VERSION); + final CohortEntry cohortEntry = new CohortEntry(message.getTransactionID(), cohort, cohortRegistry, + dataTree.getSchemaContext(), DataStoreVersions.CURRENT_VERSION); cohortCache.put(cohortEntry.getTransactionID(), cohortEntry); cohortEntry.setDoImmediateCommit(message.isDoCommitOnReady()); -- 2.36.6