incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Exception handling is now cleaned up a bit. The logs should be happier.
Date Sun, 30 Jun 2013 22:54:21 GMT
Updated Branches:
  refs/heads/master 39fc3bad1 -> 2f3f45821


Exception handling is now cleaned up a bit.  The logs should be happier.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/2f3f4582
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/2f3f4582
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/2f3f4582

Branch: refs/heads/master
Commit: 2f3f458215d42b67b2e43ccf8b0f188e4015176b
Parents: 39fc3ba
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Jun 30 18:53:44 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Jun 30 18:53:44 2013 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/blur/manager/IndexManager.java | 12 ++++++++++++
 .../blur/manager/results/BlurResultIterableClient.java  |  6 ------
 .../org/apache/blur/thrift/BlurControllerServer.java    |  3 +++
 .../java/org/apache/blur/thrift/BlurShardServer.java    |  6 ------
 .../blur/utils/BlurExecutorCompletionService.java       |  6 +++++-
 .../org/apache/blur/lucene/search/IterablePaging.java   |  3 ++-
 6 files changed, 22 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2f3f4582/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java b/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java
index 637ef81..368aa75 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java
@@ -1116,6 +1116,18 @@ public class IndexManager {
         // context is null.
         return new BlurResultIterableSearcher(_running, rewrite, _table, shard, searcher,
_selector,
             _shardServerContext == null, _runSlow);
+      } catch (BlurException e) {
+        switch (_status.getQueryStatus().getState()) {
+        case INTERRUPTED:
+          e.setErrorType(ErrorType.QUERY_CANCEL);
+          throw e;
+        case BACK_PRESSURE_INTERRUPTED:
+          e.setErrorType(ErrorType.BACK_PRESSURE);
+          throw e;
+        default:
+          e.setErrorType(ErrorType.UNKNOWN);
+          throw e;
+        }
       } finally {
         _queriesInternalMeter.mark();
         _status.deattachThread(shard);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2f3f4582/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableClient.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableClient.java
b/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableClient.java
index 82e308d..462efdb 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableClient.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableClient.java
@@ -81,12 +81,6 @@ public class BlurResultIterableClient implements BlurResultIterable {
       _shardInfo.putAll(_results.shardInfo);
       _batch++;
     } catch (BlurException e) {
-      // ErrorType errorType = e.getErrorType();
-      // if (errorType == ErrorType.UNKNOWN) {
-      // LOG.error("Error during for [{0}]", e, _originalQuery);
-      // throw new RuntimeException(e);
-      // }
-      // LOG.info("Error during for [{0}]", e, _originalQuery);
       throw e;
     } catch (Exception e) {
       LOG.error("Error during for [{0}]", e, _originalQuery);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2f3f4582/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
index e60a5c9..06e1ac2 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
@@ -358,6 +358,9 @@ public class BlurControllerServer extends TableAdmin implements Iface
{
           }
         }
       } catch (Exception e) {
+        if (e instanceof BlurException) {
+          throw (BlurException) e;
+        }
         LOG.error("Unknown error during search of [table={0},blurQuery={1}]", e, table, blurQuery);
         throw new BException("Unknown error during search of [table={0},blurQuery={1}]",
e, table, blurQuery);
       }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2f3f4582/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
index fbff890..c7f18ac 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
@@ -121,14 +121,8 @@ public class BlurShardServer extends TableAdmin implements Iface {
         return _queryCache.cache(table, original,
             BlurUtil.convertToHits(hitsIterable, blurQuery, facetCounts, _dataFetch, blurQuery.selector,
this, table));
       } catch (BlurException e) {
-        
-        System.out.println("I got here 1!!!!!!!!!!!!");
-        
         throw e;
       } catch (Exception e) {
-        
-        System.out.println("I got here 2!!!!!!!!!!!!");
-        
         LOG.error("Unknown error during search of [table={0},searchQuery={1}]", e, table,
blurQuery);
         throw new BException(e.getMessage(), e);
       } finally {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2f3f4582/blur-core/src/main/java/org/apache/blur/utils/BlurExecutorCompletionService.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/utils/BlurExecutorCompletionService.java
b/blur-core/src/main/java/org/apache/blur/utils/BlurExecutorCompletionService.java
index 44327da..4d09e96 100644
--- a/blur-core/src/main/java/org/apache/blur/utils/BlurExecutorCompletionService.java
+++ b/blur-core/src/main/java/org/apache/blur/utils/BlurExecutorCompletionService.java
@@ -128,7 +128,11 @@ public class BlurExecutorCompletionService<T> extends ExecutorCompletionService<
     } catch (InterruptedException e) {
       throw new BException("Call interrupted [{0}]", e, Arrays.asList(parameters));
     } catch (ExecutionException e) {
-      throw new BException("Call execution exception [{0}]", e.getCause(), Arrays.asList(parameters));
+      Throwable cause = e.getCause();
+      if (cause instanceof BlurException) {
+        throw (BlurException) cause;
+      }
+      throw new BException("Call execution exception [{0}]", cause, Arrays.asList(parameters));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2f3f4582/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java b/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java
index 34eba06..1ae8f5b 100644
--- a/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java
+++ b/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java
@@ -168,6 +168,7 @@ public class IterablePaging implements BlurIterable<ScoreDoc, BlurException>
{
   }
 
   class PagingIterator implements BlurIterator<ScoreDoc, BlurException> {
+    private static final String STOP_EXECUTION_COLLECTOR_EXCEPTION = "StopExecutionCollectorException";
     private ScoreDoc[] scoreDocs;
     private int counter = 0;
     private int offset = 0;
@@ -192,7 +193,7 @@ public class IterablePaging implements BlurIterable<ScoreDoc, BlurException>
{
         TopDocs topDocs = collector.topDocs();
         scoreDocs = topDocs.scoreDocs;
       } catch (StopExecutionCollectorException e) {
-        throw new BlurException("Query was stopped", null, ErrorType.UNKNOWN);
+        throw new BlurException(STOP_EXECUTION_COLLECTOR_EXCEPTION, null, ErrorType.UNKNOWN);
       } catch (IOException e) {
         throw new BException("Unknown error during search call", e);
       }


Mime
View raw message