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

[GitHub] flink pull request #5930: [FLINK-9263][state] Fix concurrency problem in Def...

GitHub user sihuazhou opened a pull request:

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

    [FLINK-9263][state] Fix concurrency problem in DefaultOperatorStateBackend.

    ## What is the purpose of the change
    
    This PR fixes the concurrency problem in `DefaultOperatorStateBackend`, the reason for this bug is that when performing checkpoint we didn't create a true `deepCopy` of the `registeredOperatorStates` and `registeredBroadcastStates`.
    
    ## Brief change log
    
      - *create a truly deep copy of `registeredBroadcastStates` and `registeredOperatorStates` when performing checkpoint*
    
    
    ## Verifying this change
    
    This change is a trivial rework / code cleanup without any test coverage.
    
    ## 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: (yes)
      - The S3 file system connector: (no)
    
    ## Documentation
    
    no

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

    $ git pull https://github.com/sihuazhou/flink fixConcurrencyProblemInOperatorStateBackend

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

    https://github.com/apache/flink/pull/5930.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 #5930
    
----
commit 93aaa53ddb43f644fa572aedd914159f88516c84
Author: sihuazhou <su...@...>
Date:   2018-04-27T12:42:33Z

    fix concurrency problem in DefaultOperatorStateBackend.

----


---

[GitHub] flink issue #5930: [FLINK-9263][state] Fix concurrency problem in DefaultOpe...

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

    https://github.com/apache/flink/pull/5930
  
    Thanks, will merge this. There are still the `<>` missing on the new call, but I will just fix it for you when merging if you don't mind?


---

[GitHub] flink pull request #5930: [FLINK-9263][state] Fix concurrency problem in Def...

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

    https://github.com/apache/flink/pull/5930#discussion_r184709515
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/state/RegisteredBroadcastBackendStateMetaInfo.java ---
    @@ -52,6 +52,23 @@ public RegisteredBroadcastBackendStateMetaInfo(
     		this.valueSerializer = Preconditions.checkNotNull(valueSerializer);
     	}
     
    +	public RegisteredBroadcastBackendStateMetaInfo(RegisteredBroadcastBackendStateMetaInfo copy) {
    +
    +		Preconditions.checkNotNull(copy);
    +
    +		this.name = copy.name;
    +		this.assignmentMode = copy.assignmentMode;
    +		this.keySerializer = copy.keySerializer.duplicate();
    +		this.valueSerializer = copy.valueSerializer.duplicate();
    +	}
    +
    +	/**
    +	 * Creates a deep copy of the itself.
    +	 */
    +	public RegisteredBroadcastBackendStateMetaInfo deepCopy() {
    --- End diff --
    
    👍 


---

[GitHub] flink issue #5930: [FLINK-9263][state] Fix concurrency problem in DefaultOpe...

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

    https://github.com/apache/flink/pull/5930
  
    If we remove the use of raw types this fix is good to merge, thanks! 👍 


---

[GitHub] flink issue #5930: [FLINK-9263][state] Fix concurrency problem in DefaultOpe...

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

    https://github.com/apache/flink/pull/5930
  
    @StefanRRichter Thanks for your nice reviews, addressed your comments.


---

[GitHub] flink pull request #5930: [FLINK-9263][state] Fix concurrency problem in Def...

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

    https://github.com/apache/flink/pull/5930#discussion_r184708667
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/state/RegisteredBroadcastBackendStateMetaInfo.java ---
    @@ -52,6 +52,23 @@ public RegisteredBroadcastBackendStateMetaInfo(
     		this.valueSerializer = Preconditions.checkNotNull(valueSerializer);
     	}
     
    +	public RegisteredBroadcastBackendStateMetaInfo(RegisteredBroadcastBackendStateMetaInfo copy) {
    +
    +		Preconditions.checkNotNull(copy);
    +
    +		this.name = copy.name;
    +		this.assignmentMode = copy.assignmentMode;
    +		this.keySerializer = copy.keySerializer.duplicate();
    +		this.valueSerializer = copy.valueSerializer.duplicate();
    +	}
    +
    +	/**
    +	 * Creates a deep copy of the itself.
    +	 */
    +	public RegisteredBroadcastBackendStateMetaInfo deepCopy() {
    --- End diff --
    
    Should not return raw type as well, but `RegisteredOperatorBackendStateMetaInfo<S>`.


---

[GitHub] flink pull request #5930: [FLINK-9263][state] Fix concurrency problem in Def...

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

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


---

[GitHub] flink pull request #5930: [FLINK-9263][state] Fix concurrency problem in Def...

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

    https://github.com/apache/flink/pull/5930#discussion_r184708513
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/state/RegisteredBroadcastBackendStateMetaInfo.java ---
    @@ -52,6 +52,23 @@ public RegisteredBroadcastBackendStateMetaInfo(
     		this.valueSerializer = Preconditions.checkNotNull(valueSerializer);
     	}
     
    +	public RegisteredBroadcastBackendStateMetaInfo(RegisteredBroadcastBackendStateMetaInfo copy) {
    --- End diff --
    
    The code should not work with raw types when we can avoid it and use `RegisteredOperatorBackendStateMetaInfo<S> copy` as parameter.


---

[GitHub] flink issue #5930: [FLINK-9263][state] Fix concurrency problem in DefaultOpe...

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

    https://github.com/apache/flink/pull/5930
  
    Hi @StefanRRichter, Could you please have a look at this? 


---

[GitHub] flink issue #5930: [FLINK-9263][state] Fix concurrency problem in DefaultOpe...

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

    https://github.com/apache/flink/pull/5930
  
    @StefanRRichter Sure, that sounds good, thanks for your supplement.


---

[GitHub] flink pull request #5930: [FLINK-9263][state] Fix concurrency problem in Def...

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

    https://github.com/apache/flink/pull/5930#discussion_r184709505
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/state/RegisteredBroadcastBackendStateMetaInfo.java ---
    @@ -52,6 +52,23 @@ public RegisteredBroadcastBackendStateMetaInfo(
     		this.valueSerializer = Preconditions.checkNotNull(valueSerializer);
     	}
     
    +	public RegisteredBroadcastBackendStateMetaInfo(RegisteredBroadcastBackendStateMetaInfo copy) {
    --- End diff --
    
    👍 


---