fluo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] keith-turner closed pull request #1014: Improve async exception handling and quiet test
Date Thu, 01 Jan 1970 00:00:00 GMT
keith-turner closed pull request #1014: Improve async exception handling and quiet test
URL: https://github.com/apache/fluo/pull/1014
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
index f4ebacfa..d7a541fc 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
@@ -84,6 +84,8 @@
 import org.apache.fluo.core.util.Hex;
 import org.apache.fluo.core.util.SpanUtil;
 import org.apache.fluo.core.util.UtilWaitThread;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.apache.fluo.accumulo.util.ColumnConstants.PREFIX_MASK;
 import static org.apache.fluo.accumulo.util.ColumnConstants.RLOCK_PREFIX;
@@ -1164,7 +1166,7 @@ public boolean commitPrimaryColumn(CommitData cd, Stamp commitStamp)
{
           .andThen(new CommittedTestStep());
 
       firstStep.compose(cd).exceptionally(throwable -> {
-        cd.commitObserver.failed(throwable);
+        setFailed(cd, throwable);
         return null;
       });
       sco.waitForCommit();
@@ -1331,6 +1333,8 @@ public boolean processResults(CommitData cd, Iterator<Result>
results) throws Ex
 
   @VisibleForTesting
   public boolean finishCommit(CommitData cd, Stamp commitStamp) {
+    cd.commitObserver = new SyncCommitObserver();
+
     getStats().setCommitTs(commitStamp.getTxTimestamp());
 
     CommitStep firstStep = new DeleteLocksStep();
@@ -1481,6 +1485,16 @@ private CommitData setUpBeginCommitAsync(CommitData cd, AsyncCommitObserver
comm
     return cd;
   }
 
+  private void setFailed(CommitData cd, Throwable throwable) {
+    try {
+      cd.commitObserver.failed(throwable);
+    } catch (RuntimeException e) {
+      Logger log = LoggerFactory.getLogger(TransactionImpl.class);
+      log.error("Failed to set tx failure (startTs=" + startTs + ") cause ", e);
+      log.error("Failed to set tx failure (startTs=" + startTs + ") lost throwable ", throwable);
+    }
+  }
+
   private void beginCommitAsync(CommitData cd) {
 
     // Notification are written between GetCommitStampStep and CommitPrimaryStep for the
following
@@ -1505,7 +1519,7 @@ private void beginCommitAsync(CommitData cd) {
         .andThen(new DeleteLocksStep()).andThen(new FinishCommitStep());
 
     firstStep.compose(cd).exceptionally(throwable -> {
-      cd.commitObserver.failed(throwable);
+      setFailed(cd, throwable);
       return null;
     });
   }
@@ -1517,7 +1531,7 @@ private void beginCommitAsyncTest(CommitData cd) {
     firstStep.andThen(new LockOtherStep()).andThen(new CommittedTestStep());
 
     firstStep.compose(cd).exceptionally(throwable -> {
-      cd.commitObserver.failed(throwable);
+      setFailed(cd, throwable);
       return null;
     });
   }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message