Revision: 7699
http://bigdata.svn.sourceforge.net/bigdata/?rev=7699&view=rev
Author: thompsonbry
Date: 2013-12-30 15:05:21 +0000 (Mon, 30 Dec 2013)
Log Message:
-----------
Modified Name2Addr.handleCommit() to use the ExecutionExceptions pattern and to log each error.
See #788 (Name2Addr does not report all root causes if the commit fails)
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/journal/Name2Addr.java
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/journal/Name2Addr.java
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/journal/Name2Addr.java 2013-12-30 15:02:24 UTC (rev 7698)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/journal/Name2Addr.java 2013-12-30 15:05:21 UTC (rev 7699)
@@ -36,6 +36,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Properties;
@@ -80,6 +81,7 @@
import com.bigdata.rawstore.IRawStore;
import com.bigdata.resources.IndexManager;
import com.bigdata.resources.ResourceManager;
+import com.bigdata.util.concurrent.ExecutionExceptions;
import com.ibm.icu.text.Collator;
import cutthecrap.utils.striterators.Filter;
@@ -738,6 +740,7 @@
}
// for each entry in the snapshot of the commit list.
+ final List<Throwable> causes = new LinkedList<Throwable>();
for (Future<CommitIndexTask> f : futures) {
try {
@@ -775,11 +778,13 @@
} catch (InterruptedException e) {
- throw new RuntimeException(e);
+ log.error("l.name: " + e, e);
+ causes.add(e);
} catch (ExecutionException e) {
- throw new RuntimeException(e);
+ log.error("l.name: " + e, e);
+ causes.add(e);
}
@@ -842,6 +847,17 @@
// // set commitTime on the btree (transient field).
// l.btree.setLastCommitTime(commitTime);
+ } // next Future.
+
+ /*
+ * If there were any errors, then throw an exception listing them.
+ */
+ if (!causes.isEmpty()) {
+ // Throw exception back to the leader.
+ if (causes.size() == 1)
+ throw new RuntimeException(causes.get(0));
+ throw new RuntimeException("nerrors=" + causes.size(),
+ new ExecutionExceptions(causes));
}
// and flushes out this btree as well.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|