You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metron.apache.org by merrimanr <gi...@git.apache.org> on 2017/06/01 15:05:27 UTC

[GitHub] metron pull request #603: METRON-569: Enrichment topology duplicates message...

GitHub user merrimanr opened a pull request:

    https://github.com/apache/metron/pull/603

    METRON-569: Enrichment topology duplicates messages

    ## Contributor Comments
    This issue was discovered a while ago but a PR with a fix was never accepted.  In summary, the JoinBolt is acking the last tuple of a split message instead of the tuple containing the original message sent directly from the SplitBolt.  This is a problem because the tuple with the original message is anchored in the SplitBolt and the other tuples that go to enrichment bolts are not.
    
    The major change in this PR involves storing the tuples in the cache instead of just the message.  This way the tuple from the SplitBolt can be retrieved and acked once all the parts have been received in the JoinBolt.  
    
    A couple other minor changes are also included.  I refactored the JoinBoltTest to make it easier to follow and maintain.  If anyone thinks this is worse than what we currently have I can revert that.  I also bumped up the default cache sizes for the JoinBolts from 10,000 to 100,000.  The low initial cache size was causing failures in full dev if I let it run for a while.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [ ] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [ ] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/merrimanr/incubator-metron tuple-fix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/603.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #603
    
----
commit c9ef4f3d9bf023801754267716f108af96827077
Author: merrimanr <me...@gmail.com>
Date:   2017-05-18T15:17:11Z

    added logging for unexpected cache issues

commit 35f9d6878e07ed604212b0af1877b57cad5871e2
Author: merrimanr <me...@gmail.com>
Date:   2017-05-22T20:04:52Z

    Merge remote-tracking branch 'mirror/master' into tuple-fix

commit 8c99f70c871a150d7d763eb5c16716f01f3bec06
Author: merrimanr <me...@gmail.com>
Date:   2017-05-22T20:05:23Z

    saving tuples instead of messages

commit 99ee88697d853aae0f57904660f3ebaf9ea39dee
Author: merrimanr <me...@gmail.com>
Date:   2017-05-22T20:15:30Z

    resolve compile errors

commit b87889f8b3814b8b98569fd2441fc0aa6dbb58e5
Author: merrimanr <me...@gmail.com>
Date:   2017-05-31T19:59:09Z

    updated unit tests

commit 6cd343ede3f9a95d8ad4ed04e7cf323ba2706d55
Author: merrimanr <me...@gmail.com>
Date:   2017-05-31T20:00:44Z

    Merge remote-tracking branch 'mirror/master' into tuple-fix
    
    # Conflicts:
    #	metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/JoinBolt.java

commit ed5a19728998afb97eb5fc7f11e1a8a1b806be2b
Author: merrimanr <me...@gmail.com>
Date:   2017-06-01T14:26:59Z

    Resolved merge conflicts and changed default join cache size to 100000

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #603: METRON-569: Enrichment topology duplicates messages

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/603
  
    +1 by inspection, great catch!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #603: METRON-569: Enrichment topology duplicates message...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/603#discussion_r120116377
  
    --- Diff: metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/JoinBolt.java ---
    @@ -141,11 +141,12 @@ public void execute(Tuple tuple) {
             collector.emit( "message"
                           , tuple
                           , new Values( key
    -                                  , joinMessages(streamMessageMap)
    +                                  , joinMessages(streamMessageMap, this.messageGetStrategy)
                                       )
                           );
             cache.invalidate(key);
    -        collector.ack(tuple);
    +        Tuple messageTuple = streamMessageMap.get("message:");
    +        collector.ack(messageTuple);
    --- End diff --
    
    Sounds good!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #603: METRON-569: Enrichment topology duplicates message...

Posted by merrimanr <gi...@git.apache.org>.
Github user merrimanr commented on a diff in the pull request:

    https://github.com/apache/metron/pull/603#discussion_r120115152
  
    --- Diff: metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/JoinBolt.java ---
    @@ -141,11 +141,12 @@ public void execute(Tuple tuple) {
             collector.emit( "message"
                           , tuple
                           , new Values( key
    -                                  , joinMessages(streamMessageMap)
    +                                  , joinMessages(streamMessageMap, this.messageGetStrategy)
                                       )
                           );
             cache.invalidate(key);
    -        collector.ack(tuple);
    +        Tuple messageTuple = streamMessageMap.get("message:");
    +        collector.ack(messageTuple);
    --- End diff --
    
    I don't believe so.  The tuple that comes straight from the SplitBolt (the "message" stream) is the only tuple that is anchored.  Tuples that go to EnrichmentBolts are not anchored.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #603: METRON-569: Enrichment topology duplicates message...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/603#discussion_r120106060
  
    --- Diff: metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/JoinBolt.java ---
    @@ -141,11 +141,12 @@ public void execute(Tuple tuple) {
             collector.emit( "message"
                           , tuple
                           , new Values( key
    -                                  , joinMessages(streamMessageMap)
    +                                  , joinMessages(streamMessageMap, this.messageGetStrategy)
                                       )
                           );
             cache.invalidate(key);
    -        collector.ack(tuple);
    +        Tuple messageTuple = streamMessageMap.get("message:");
    +        collector.ack(messageTuple);
    --- End diff --
    
    Do we need to ack every tuple in `streamMessageMap`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #603: METRON-569: Enrichment topology duplicates message...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/metron/pull/603


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---