[ https://issues.apache.org/jira/browse/METRON-1771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16610916#comment-16610916 ]
ASF GitHub Bot commented on METRON-1771: ---------------------------------------- Github user nickwallen commented on a diff in the pull request: https://github.com/apache/metron/pull/1190#discussion_r216733487 --- Diff: metron-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/MultiIndexDao.java --- @@ -121,20 +131,30 @@ public void addCommentToAlert(CommentAddRemoveRequest request, Document latest) if (exceptions.size() > 0) { throw new IOException(Joiner.on("\n").join(exceptions)); } + return newVersions.get(0); } @Override - public void removeCommentFromAlert(CommentAddRemoveRequest request) throws IOException { + public Document removeCommentFromAlert(CommentAddRemoveRequest request) throws IOException { Document latest = getLatest(request.getGuid(), request.getSensorType()); - removeCommentFromAlert(request, latest); + return removeCommentFromAlert(request, latest); } + /** + * Removes comments from an alert. Updates are written to each Dao in parallel with the assumption that all updates + * are identical. The first update to be applied is returned as the current version of the alert with comments removed. + * @param request Request to remove comments + * @param latest The latest version of the alert the comments will be removed from. + * @return The complete alert document with comments removed. + * @throws IOException + */ @Override - public void removeCommentFromAlert(CommentAddRemoveRequest request, Document latest) throws IOException { + public Document removeCommentFromAlert(CommentAddRemoveRequest request, Document latest) throws IOException { + final List<Document> newVersions = new ArrayList<>(); --- End diff -- Same here... If we do it this way, we just need to make this a thread-safe list. > Update REST endpoints to support eventually consistent UI updates > ----------------------------------------------------------------- > > Key: METRON-1771 > URL: https://issues.apache.org/jira/browse/METRON-1771 > Project: Metron > Issue Type: Improvement > Reporter: Ryan Merriman > Priority: Major > > Currently the REST endpoints that perform document updates either return > true/false or nothing. This puts the responsibility of retrieving the > updated state of the object on the client in a separate call or > optimistically applying the changes and reverting when an update fails. This > can be problematic if a client attempts to get the current state immediately > after an update and the change isn't visible yet in the back end. > Ideally they should return the updated state of the object, eliminating the > need to look up the updated state in a separate call. -- This message was sent by Atlassian JIRA (v7.6.3#76005)