Github user merrimanr commented on a diff in the pull request:
https://github.com/apache/metron/pull/1190#discussion_r222470180
--- Diff:
metron-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/MultiIndexDao.java
---
@@ -282,4 +276,27 @@ public Document getLatest(final String guid, String
sensorType) throws IOExcepti
public List<IndexDao> getIndices() {
return indices;
}
+
+ private Document getDocument(List<DocumentContainer> documentContainers)
throws IOException {
+ Document ret = null;
+ List<String> error = new ArrayList<>();
+ for(DocumentContainer dc : documentContainers) {
+ if(dc.getException().isPresent()) {
+ Throwable e = dc.getException().get();
+ error.add(e.getMessage() + "\n" + ExceptionUtils.getStackTrace(e));
+ }
+ else {
+ if(dc.getDocument().isPresent()) {
+ Document d = dc.getDocument().get();
+ if(ret == null || ret.getTimestamp() < d.getTimestamp()) {
+ ret = d;
+ }
+ }
+ }
+ }
--- End diff --
No problem, don't mind working it out here and now. The case that causes
the test to fail (although I'm not sure that was the intention of the test) is
where 2 DAOs are contained in a MultiIndexDao and the first DAO returns an
invalid result (no document or exception) while the second returns a valid
result. I don't know what would cause a document to be missing both a document
and an exception.
The question is what should happen when this unexpected condition does
happen? Should it blow up and throw and exception or return a document if at
least one DAO returns a valid one.
---