BUG 8422: Change tx handlers hard timeout 34/57134/2
authorTomas Cere <tcere@cisco.com>
Tue, 16 May 2017 10:40:35 +0000 (12:40 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 16 May 2017 13:16:44 +0000 (13:16 +0000)
This makes write-transactions/produce-transactions return an
RpcError upon reaching 2 minutes of waiting after the last
transaction is submitted in case the transactions arent timed out
from the frontend.

Change-Id: I20abbd02ed14e16d9e9a49f935113c0044e7c6d8
Signed-off-by: Tomas Cere <tcere@cisco.com>
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/ProduceTransactionsHandler.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/WriteTransactionsHandler.java

index 0d49a697d6d5b1227ee704bbb5099233b07cf05c..7ce2b8ded6562b6df6df571ca4c87dd2f14b7348 100644 (file)
@@ -143,8 +143,8 @@ public class ProduceTransactionsHandler implements Runnable {
         cursor.close();
 
         try {
         cursor.close();
 
         try {
-            tx.submit().checkedGet();
-        } catch (final TransactionCommitFailedException e) {
+            tx.submit().checkedGet(125, TimeUnit.SECONDS);
+        } catch (final TransactionCommitFailedException | TimeoutException e) {
             LOG.warn("Unable to fill the initial item list.", e);
             settableFuture.set(RpcResultBuilder.<ProduceTransactionsOutput>failed()
                     .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", e).build());
             LOG.warn("Unable to fill the initial item list.", e);
             settableFuture.set(RpcResultBuilder.<ProduceTransactionsOutput>failed()
                     .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", e).build());
@@ -192,7 +192,8 @@ public class ProduceTransactionsHandler implements Runnable {
             final ListenableFuture<List<Void>> allFutures = Futures.allAsList(futures);
 
             try {
             final ListenableFuture<List<Void>> allFutures = Futures.allAsList(futures);
 
             try {
-                allFutures.get(30, TimeUnit.SECONDS);
+                // Timeout from cds should be 2 minutes so leave some leeway.
+                allFutures.get(125, TimeUnit.SECONDS);
 
                 LOG.debug("All futures completed successfully.");
 
 
                 LOG.debug("All futures completed successfully.");
 
index e4236abc7b38adf6c55034d696ff2ad2e6e5ac32..c4abb391e64b94e59a5058d018d887af3e55d680 100644 (file)
@@ -189,8 +189,8 @@ public class WriteTransactionsHandler implements Runnable {
         tx.put(LogicalDatastoreType.CONFIGURATION, itemListId, mapBuilder.build());
 
         try {
         tx.put(LogicalDatastoreType.CONFIGURATION, itemListId, mapBuilder.build());
 
         try {
-            tx.submit().checkedGet();
-        } catch (final TransactionCommitFailedException e) {
+            tx.submit().checkedGet(125, TimeUnit.SECONDS);
+        } catch (final TransactionCommitFailedException | TimeoutException e) {
             LOG.warn("Unable to fill the initial item list.", e);
             settableFuture.set(RpcResultBuilder.<WriteTransactionsOutput>failed()
                     .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", e).build());
             LOG.warn("Unable to fill the initial item list.", e);
             settableFuture.set(RpcResultBuilder.<WriteTransactionsOutput>failed()
                     .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", e).build());
@@ -234,7 +234,8 @@ public class WriteTransactionsHandler implements Runnable {
             final ListenableFuture<List<Void>> allFutures = Futures.allAsList(futures);
 
             try {
             final ListenableFuture<List<Void>> allFutures = Futures.allAsList(futures);
 
             try {
-                allFutures.get(30, TimeUnit.SECONDS);
+                // Timeout from cds should be 2 minutes so leave some leeway.
+                allFutures.get(125, TimeUnit.SECONDS);
 
                 LOG.debug("All futures completed successfully.");
 
 
                 LOG.debug("All futures completed successfully.");