Merge "Fix potential issue with transaction timeouts"
authorMoiz Raja <moraja@cisco.com>
Fri, 6 Feb 2015 22:46:58 +0000 (22:46 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 6 Feb 2015 22:46:58 +0000 (22:46 +0000)
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java

index 3fc9c142c5e8b40daec717b3292fe1d52afcbf94..744e2c22c69a9de8f16ff048648fbd087066eb41 100644 (file)
@@ -321,7 +321,7 @@ public class Shard extends RaftActor {
                 Shard.this.persistData(getSender(), transactionID,
                         new ModificationPayload(cohortEntry.getModification()));
             }
-        } catch (InterruptedException | ExecutionException | IOException e) {
+        } catch (Exception e) {
             LOG.error(e, "{} An exception occurred while preCommitting transaction {}",
                     persistenceId(), cohortEntry.getTransactionID());
             shardMBean.incrementFailedTransactionsCount();
@@ -373,14 +373,14 @@ public class Shard extends RaftActor {
             shardMBean.incrementCommittedTransactionCount();
             shardMBean.setLastCommittedTransactionTime(System.currentTimeMillis());
 
-        } catch (InterruptedException | ExecutionException e) {
+        } catch (Exception e) {
             sender.tell(new akka.actor.Status.Failure(e), getSelf());
 
             LOG.error(e, "{}, An exception occurred while committing transaction {}", persistenceId(), transactionID);
             shardMBean.incrementFailedTransactionsCount();
+        } finally {
+            commitCoordinator.currentTransactionComplete(transactionID, true);
         }
-
-        commitCoordinator.currentTransactionComplete(transactionID, true);
     }
 
     private void handleCanCommitTransaction(final CanCommitTransaction canCommit) {
index 659acb745473af389480ff08e19cc68857add93a..165e272d8b09ca1631a94e7a1e7d14a4370bb595 100644 (file)
@@ -205,6 +205,7 @@ public class ShardCommitCoordinator {
             // Dequeue the next cohort entry waiting in the queue.
             currentCohortEntry = queuedCohortEntries.poll();
             if(currentCohortEntry != null) {
+                currentCohortEntry.updateLastAccessTime();
                 doCanCommit(currentCohortEntry);
             }
         }