Final changes to documents are saved by the markProcessed, markFailed, markDiscarded etc methods. These methods should remove the document from the cache and save it to the database.
It is possible that modifications to documents can be lost entirely if the write to the database fails.
https://github.com/Findwise/Hydra/blob/master/database/src/main/java/com/findwise/hydra/CachingDocumentNIO.java#L121
DatabaseDocument<T> cached = cache.getDocumentById(d.getID());
if (cached != null) {
d.putAll(cached);
cache.remove(d.getID());
}
if (writer.markProcessed(d, stage)) {
return true;
}
return false;
Above, the document is first removed from the cache (if present), then the write is attempted. If the write returns false (i.e. fails), markProcessed returns false as well. This should mean that the document has not been saved and as such you would expect that the document in the cache would still be there.
From the code, it appears this is not the case.