nickwallen commented on a change in pull request #1269: METRON-1879 Allow 
Elasticsearch to Auto-Generate the Document ID
URL: https://github.com/apache/metron/pull/1269#discussion_r240813591
 
 

 ##########
 File path: 
metron-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/MultiIndexDao.java
 ##########
 @@ -226,18 +257,30 @@ public void init(AccessConfig config) {
 
   @Override
   public Document getLatest(final String guid, String sensorType) throws 
IOException {
-    List<DocumentContainer> output =
-            indices.parallelStream().map(dao -> {
-      try {
-        return new DocumentContainer(dao.getLatest(guid, sensorType));
-      } catch (Throwable e) {
-        return new DocumentContainer(e);
-      }
-    }).collect(Collectors.toList());
-
+    List<DocumentContainer> output = indices
+            .parallelStream()
+            .map(dao -> getLatest(dao, guid, sensorType))
+            .collect(Collectors.toList());
     return getLatestDocument(output);
   }
 
+  private DocumentContainer getLatest(IndexDao indexDao, String guid, String 
sensorType) {
+    DocumentContainer container;
+    try {
+      Document document = indexDao.getLatest(guid, sensorType);
+      container = new DocumentContainer(document);
+      LOG.debug("Found latest document; indexDao={}, guid={}, sensorType={}, 
document={}",
+              ClassUtils.getShortClassName(indexDao.getClass()), guid, 
sensorType, document);
+
+    } catch (Throwable e) {
+      container = new DocumentContainer(e);
+      LOG.error("Unable to find latest document; indexDao={}, error={}",
 
 Review comment:
   We had no logging to indicate when a particular IndexDao fails.  I ran into 
this and it took some effort to trace since we lacked logging.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to