metron-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (METRON-1771) Update REST endpoints to support eventually consistent UI updates
Date Tue, 02 Oct 2018 15:32:00 GMT

    [ https://issues.apache.org/jira/browse/METRON-1771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16635697#comment-16635697
] 

ASF GitHub Bot commented on METRON-1771:
----------------------------------------

Github user merrimanr commented on a diff in the pull request:

    https://github.com/apache/metron/pull/1190#discussion_r222000643
  
    --- 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 --
    
    Upon further review, I'm not sure this is what we want.  This caused an integration test
to fail because the result from the first DAO did not contain a document or exception while
the result from the second DAO did contain a document.  Before this change, the document from
the second DAO would have been returned.  I think we want to return a document if possible,
even if all DAOs are not consistent.  Do you disagree?


> 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)

Mime
View raw message