You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by zh...@apache.org on 2017/09/26 22:15:32 UTC
[geode] branch feature/GEODE-3273 updated: GEODE-3273: only catch
exception for user code
This is an automated email from the ASF dual-hosted git repository.
zhouxj pushed a commit to branch feature/GEODE-3273
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-3273 by this push:
new 4251d65 GEODE-3273: only catch exception for user code
4251d65 is described below
commit 4251d65985ce5b5976633779f53c515b7870e013
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Tue Sep 26 15:14:19 2017 -0700
GEODE-3273: only catch exception for user code
---
.../lucene/internal/repository/IndexRepositoryImpl.java | 7 ++-----
.../lucene/LuceneIndexMaintenanceIntegrationTest.java | 14 ++++++++++----
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
index 5381234..3eb6ba5 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
@@ -84,7 +84,7 @@ public class IndexRepositoryImpl implements IndexRepository {
writer.addDocuments(docs);
} catch (Exception e) {
stats.incFailedEntries();
- logger.info("Failed to create index " + value + " due to " + e.getMessage());
+ logger.info("Failed to add index for " + value + " due to " + e.getMessage());
} finally {
stats.endUpdate(start);
}
@@ -100,7 +100,7 @@ public class IndexRepositoryImpl implements IndexRepository {
writer.updateDocuments(keyTerm, docs);
} catch (Exception e) {
stats.incFailedEntries();
- logger.info("Failed to update index " + value + " due to " + e.getMessage());
+ logger.info("Failed to update index for " + value + " due to " + e.getMessage());
} finally {
stats.endUpdate(start);
}
@@ -112,9 +112,6 @@ public class IndexRepositoryImpl implements IndexRepository {
try {
Term keyTerm = SerializerUtil.toKeyTerm(key);
writer.deleteDocuments(keyTerm);
- } catch (Exception e) {
- stats.incFailedEntries();
- logger.info("Failed to delete index " + key + " due to " + e.getMessage());
} finally {
stats.endUpdate(start);
}
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java
index e658ccf..af2c120 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexMaintenanceIntegrationTest.java
@@ -132,7 +132,7 @@ public class LuceneIndexMaintenanceIntegrationTest extends LuceneIntegrationTest
@Test
public void serializerExceptionShouldNotImpactOtherEvents() throws Exception {
luceneService.createIndexFactory().setFields("title", "description")
- .setLuceneSerializer(new TestSerializer()).create(INDEX_NAME, REGION_NAME);
+ .setLuceneSerializer(new TestCatchingExceptionInSerializer("title 3")).create(INDEX_NAME, REGION_NAME);
Region region = createRegion(REGION_NAME, RegionShortcut.PARTITION);
region.put("object-1", new TestObject("title 1", "hello world"));
@@ -334,12 +334,18 @@ public class LuceneIndexMaintenanceIntegrationTest extends LuceneIntegrationTest
}
}
- private static class TestSerializer extends HeterogeneousLuceneSerializer {
+ private static class TestCatchingExceptionInSerializer extends HeterogeneousLuceneSerializer {
+
+ String match;
+
+ TestCatchingExceptionInSerializer(String match) {
+ this.match = match;
+ }
+
@Override
public Collection<Document> toDocuments(LuceneIndex index, Object value) {
-
TestObject testObject = (TestObject) value;
- if (testObject.title.equals("title 3")) {
+ if (testObject.title.equals(match)) {
throw new RuntimeException("Expected exception in Serializer:" + value);
} else {
return super.toDocuments(index, value);
--
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].