Reduce amount of stack traces logged by ES exceptions and change indexing ! wildcard to "none".
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/dfaf344a Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/dfaf344a Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/dfaf344a Branch: refs/heads/asf-site Commit: dfaf344a0e294520e12f672be595b52c7c857330 Parents: 06caa25 Author: Michael Russo <mru...@apigee.com> Authored: Mon Apr 18 11:51:31 2016 +0100 Committer: Michael Russo <mru...@apigee.com> Committed: Mon Apr 18 11:51:31 2016 +0100 ---------------------------------------------------------------------- .../usergrid/corepersistence/CpEntityManager.java | 6 +++--- .../persistence/index/impl/EsEntityIndexImpl.java | 16 ++++++++-------- .../persistence/index/impl/FailureMonitorImpl.java | 2 +- .../collection/CollectionsResourceIT.java | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/dfaf344a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java index 750cf7b..73f5d5a 100644 --- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java +++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java @@ -627,7 +627,7 @@ public class CpEntityManager implements EntityManager { if ( collectionIndexingSchema.isPresent()) { Map jsonMapData = collectionIndexingSchema.get(); final ArrayList fields = (ArrayList) jsonMapData.get( "fields" ); - if ( fields.size() == 1 && fields.get(0).equals("!")) { + if ( fields.size() == 1 && fields.get(0).equals("none")) { skipIndexing = true; } } @@ -1819,9 +1819,9 @@ public class CpEntityManager implements EntityManager { wildCardArrayList.add( "*" ); schemaMap.put( "fields", wildCardArrayList ); - } else if ( fieldProperties.contains( "!" )) { + } else if ( fieldProperties.contains( "none" )) { ArrayList<String> wildCardArrayList = new ArrayList<>(); - wildCardArrayList.add( "!" ); + wildCardArrayList.add( "none" ); schemaMap.put( "fields", wildCardArrayList ); } else { http://git-wip-us.apache.org/repos/asf/usergrid/blob/dfaf344a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java index f5da29a..10ee91e 100644 --- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java +++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java @@ -439,7 +439,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData { searchResponse = srb.execute().actionGet(); } catch ( Throwable t ) { - logger.error( "Unable to communicate with Elasticsearch", t ); + logger.error( "Unable to communicate with Elasticsearch", t.getMessage() ); failureMonitor.fail( "Unable to execute batch", t ); throw t; } @@ -522,7 +522,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData { } } catch ( Throwable t ) { - logger.error( "Unable to communicate with Elasticsearch", t ); + logger.error( "Unable to communicate with Elasticsearch", t.getMessage() ); failureMonitor.fail( "Unable to execute batch", t ); throw t; } @@ -607,7 +607,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData { } } catch ( Throwable t ) { - logger.error( "Unable to communicate with Elasticsearch", t ); + logger.error( "Unable to communicate with Elasticsearch", t.getMessage() ); failureMonitor.fail( "Unable to execute batch", t ); throw t; } @@ -640,11 +640,11 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData { @Override public void onFailure( Throwable e ) { - logger.error( "failed on delete index", e ); + logger.error( "Failed on delete index", e.getMessage() ); } } ); return Observable.from( response ); - } ).doOnError( t -> logger.error( "Failed on delete application", t ) ); + } ).doOnError( t -> logger.error( "Failed on delete application", t.getMessage() ) ); } @@ -762,7 +762,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData { operation.doOp(); } catch ( Exception e ) { - logger.error( "Unable to execute operation, retrying", e ); + logger.error( "Unable to execute operation, retrying", e.getMessage() ); try { Thread.sleep( WAIT_TIME ); } catch ( InterruptedException ie ) { @@ -788,7 +788,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData { return Health.valueOf( chr.getStatus().name() ); } catch ( Exception ex ) { - logger.error( "Error connecting to ElasticSearch", ex ); + logger.error( "Error connecting to ElasticSearch", ex.getMessage() ); } // this is bad, red alert! @@ -812,7 +812,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData { return Health.valueOf( chr.getStatus().name() ); } catch ( Exception ex ) { - logger.error( "Error connecting to ElasticSearch", ex ); + logger.error( "Error connecting to ElasticSearch", ex.getMessage() ); } // this is bad, red alert! http://git-wip-us.apache.org/repos/asf/usergrid/blob/dfaf344a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/FailureMonitorImpl.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/FailureMonitorImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/FailureMonitorImpl.java index 943eabb..19749df 100644 --- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/FailureMonitorImpl.java +++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/FailureMonitorImpl.java @@ -74,7 +74,7 @@ public class FailureMonitorImpl implements FailureMonitor { final int maxCount = indexFig.getFailRefreshCount(); if ( fails > maxCount ) { - logger.error( "Unable to connect to elasticsearch. Reason is {}", message, throwable ); + logger.error( "Unable to connect to elasticsearch. Reason is {}", throwable.getMessage() ); logger.warn( "We have failed to connect to Elastic Search {} times. Max allowed is {}. Resetting connection", fails, maxCount ); esProvider.releaseClient(); http://git-wip-us.apache.org/repos/asf/usergrid/blob/dfaf344a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java ---------------------------------------------------------------------- diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java index b240629..8ed2154 100644 --- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java +++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java @@ -943,14 +943,14 @@ public class CollectionsResourceIT extends AbstractRestIT { /** - * Test that when schema is "!" entity gets saved but does not get indexed + * Test that when schema is "none" entity gets saved but does not get indexed */ @Test public void postCollectionSchemaWithWildcardIndexNone() throws Exception { // creating schema with no index wildcard and other fields that should be ignored ArrayList<String> indexingArray = new ArrayList<>( ); - indexingArray.add( "!" ); + indexingArray.add( "none" ); indexingArray.add( "one" ); indexingArray.add( "two" ); Entity payload = new Entity(); @@ -965,7 +965,7 @@ public class CollectionsResourceIT extends AbstractRestIT { Collection collection = app().collection( collectionName ).collection( "_index" ).get(); LinkedHashMap testCollectionSchema = (LinkedHashMap)collection.getResponse().getData(); ArrayList<String> schema = ( ArrayList<String> ) testCollectionSchema.get( "fields" ); - assertTrue( schema.contains( "!" ) ); + assertTrue( schema.contains( "none" ) ); assertFalse( schema.contains( "one" ) ); assertFalse( schema.contains( "two" ) );