You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by tillrohrmann <gi...@git.apache.org> on 2018/07/23 20:27:58 UTC

[GitHub] flink pull request #6398: [FLINK-9923][tests] Harden OneInputStreamTaskTest#...

GitHub user tillrohrmann opened a pull request:

    https://github.com/apache/flink/pull/6398

    [FLINK-9923][tests] Harden OneInputStreamTaskTest#testWatermarkMetrics

    ## What is the purpose of the change
    
    Convert the WatermarkGauge's field currentWatermark from long to AtomicLong because
    writes and reads can happen from different threads. Unfortunately, we cannot simply
    make it volatile because not all JVM support atomic writes to longs.
    
    cc @zentol.
    
    ## Does this pull request potentially affect one of the following parts:
    
      - Dependencies (does it add or upgrade a dependency): (no)
      - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
      - The serializers: (no)
      - The runtime per-record code paths (performance sensitive): (no)
      - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
      - The S3 file system connector: (no)
    
    ## Documentation
    
      - Does this pull request introduce a new feature? (no)
      - If yes, how is the feature documented? (not applicable)


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

    $ git pull https://github.com/tillrohrmann/flink fixOneInpuStreamTaskTest

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

    https://github.com/apache/flink/pull/6398.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 #6398
    
----
commit d46dd6f2ddf76d5dfcb1bed983f31542ddc771a3
Author: Till Rohrmann <tr...@...>
Date:   2018-07-23T20:25:25Z

    [FLINK-9923][tests] Harden OneInputStreamTaskTest#testWatermarkMetrics
    
    Convert the WatermarkGauge's field currentWatermark from long to AtomicLong because
    writes and reads can happen from different threads. Unfortunately, we cannot simply
    make it volatile because not all JVM support atomic writes to longs.

----


---

[GitHub] flink issue #6398: [FLINK-9923][tests] Harden OneInputStreamTaskTest#testWat...

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

    https://github.com/apache/flink/pull/6398
  
    well, that's a fairly general statement isn't it :/ 
    
    Unless we find any mention anywhere of a major JVM not adhering to the JLS in this regard, that is suited for Flink applications, I would go with a volatile long.
    
    Personally i never follow inspections at face value; we don't know how up-to-date this inspections or what information it is based on, which JVMs it applies to as it doesn't mention even a single example, and as with all JVM-/environment-specific inspections the applicability is questionable.


---

[GitHub] flink issue #6398: [FLINK-9923][tests] Harden OneInputStreamTaskTest#testWat...

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

    https://github.com/apache/flink/pull/6398
  
    I got this from an IntelliJ inspection warning which says
    >Reports fields of type long or double which are declared as volatile. While Java specifies that reads and writes from such fields are atomic, many JVM's have violated this specification. Unless you are certain of your JVM, it is better to synchronized access to such fields rather than declare them volatile.
    



---

[GitHub] flink issue #6398: [FLINK-9923][tests] Harden OneInputStreamTaskTest#testWat...

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

    https://github.com/apache/flink/pull/6398
  
    Thanks for the review @zentol. Merging this PR.


---

[GitHub] flink issue #6398: [FLINK-9923][tests] Harden OneInputStreamTaskTest#testWat...

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

    https://github.com/apache/flink/pull/6398
  
    Do you have a source for volatile longs not being supported in all JVM implementations? I'm asking since the (expected) behavior is defined in the [Java Language Specification](https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7).


---

[GitHub] flink issue #6398: [FLINK-9923][tests] Harden OneInputStreamTaskTest#testWat...

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

    https://github.com/apache/flink/pull/6398
  
    Given that the `WatermarkGauge` is not super critical, I'm ok with changing it to a `volatile long`. If the `OneInputStreamTask` should fail again with a similar problem, then we know that the used JVM is affected. I'll update the PR accordingly.


---

[GitHub] flink pull request #6398: [FLINK-9923][tests] Harden OneInputStreamTaskTest#...

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

    https://github.com/apache/flink/pull/6398


---