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

ASF GitHub Bot commented on BEAM-847:
-------------------------------------

GitHub user tgroh opened a pull request:

    https://github.com/apache/incubator-beam/pull/1210

    [BEAM-847] Use a Random Long instead of a Random UUID for Aggregator IDs

    Be sure to do all of the following to help us incorporate your contribution
    quickly and easily:
    
     - [ ] Make sure the PR title is formatted like:
       `[BEAM-<Jira issue #>] Description of pull request`
     - [ ] Make sure tests pass via `mvn clean verify`. (Even better, enable
           Travis-CI on your fork and ensure the whole test matrix passes).
     - [ ] Replace `<Jira issue #>` in the title with the actual Jira issue
           number, if there is one.
     - [ ] If this contribution is large, please file an Apache
           [Individual Contributor License 
Agreement](https://www.apache.org/licenses/icla.txt).
    
    ---
    
    Aggregator IDs are used to ensure that an Aggregator's identity is
    consistent across synchronization barriers. This is only relevant when
    constructing the map of Step -> Aggregator to enable querying, as the
    DoFns represented within the graph may be serialized. The identity has
    no impact on the interaction between the runner and aggregator, which is
    the responsibility of the ProcessContext object and
    setupDelegateAggregators.
    
    UUID#randomUUID uses a shared SecureRandom to create the bytes of the
    UUID; SecureRandom#nextBytes is a synchronized method, so regardless of
    the underlying source of randomness, only one random UUID can be
    generated at a time. Instead, use a random long to identify aggregators.
    This should be sufficient for user-created aggregators, and system
    aggregators should not care about the id.

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

    $ git pull https://github.com/tgroh/incubator-beam stop_using_random_uuids

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

    https://github.com/apache/incubator-beam/pull/1210.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 #1210
    
----
commit ed8ebc59b00aa3add17b7fbacd0b3629d58f4136
Author: Thomas Groh <[email protected]>
Date:   2016-10-27T17:19:03Z

    Use a Random Long instead of a Random UUID for Aggregator IDs
    
    Aggregator IDs are used to ensure that an Aggregator's identity is
    consistent across synchronization barriers. This is only relevant when
    constructing the map of Step -> Aggregator to enable querying, as the
    DoFns represented within the graph may be serialized. The identity has
    no impact on the interaction between the runner and aggregator, which is
    the responsibility of the ProcessContext object and
    setupDelegateAggregators.
    
    UUID#randomUUID uses a shared SecureRandom to create the bytes of the
    UUID; SecureRandom#nextBytes is a synchronized method, so regardless of
    the underlying source of randomness, only one random UUID can be
    generated at a time. Instead, use a random long to identify aggregators.
    This should be sufficient for user-created aggregators, and system
    aggregators should not care about the id.

----


> DelelgatingAggregator uses UUID.randomUUID, which uses a synchronized Random 
> method
> -----------------------------------------------------------------------------------
>
>                 Key: BEAM-847
>                 URL: https://issues.apache.org/jira/browse/BEAM-847
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-core, runner-dataflow, runner-direct, 
> runner-flink, sdk-java-core
>            Reporter: Thomas Groh
>            Assignee: Thomas Groh
>
> This normally would not be a problem, as users are expected to create 
> Aggregators in a non-performance-sensitive fashion. 
> {{GroupAlsoByWindowViaWindowSet}} also creates an {{Aggregator}}, and this is 
> a runner-provided {{DoFn}} (and may be created some arbitrary number of times 
> on workers); this call should not use a shared resource.
> As the IDs of an {{Aggregator}} are used only to ensure that an 
> {{Aggregator}} has a consistent identity across a serialization boundary, 
> used in the {{AggregatorPipelineExtractor}}, these can be less random so long 
> as they remain mostly unique.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to