GitHub user sihuazhou opened a pull request:
https://github.com/apache/flink/pull/5578
Improve resource release for local recovery
## What is the purpose of the change
This PR fixes
[FLINK-8777](https://issues.apache.org/jira/browse/FLINK-8777). When recovery
from failed, `TaskLocalStateStoreImpl.retrieveLocalState()` will be invoked, we
can release all entry from `storedTaskStateByCheckpointID` that does not
satisfy `entry.checkpointID == checkpointID`, this can prevent the resource
leak when job loop in `local checkpoint completed => failed => local checkpoint
completed => failed ...`.
## Brief change log
- release resource in retrieveLocalState
- change the type of toDiscard from Map to a single entry.
## Verifying this change
This changes can be verified by the exists tests.
## 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)
## Documentation
- Does this pull request introduce a new feature? (no)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/sihuazhou/flink
improve_resource_release_for_local_recovery
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/5578.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 #5578
----
commit 223aa37e625e81e73ccb5543fedd99ea72723ead
Author: sihuazhou <summerleafs@...>
Date: 2018-02-26T02:46:51Z
release local-checkpoint-data in retrieveLocalState.
commit 5373b394aaac8ae5010a251ae80d3a3b6ee61dc3
Author: sihuazhou <summerleafs@...>
Date: 2018-02-26T02:54:53Z
change the type of toDiscard from Map to a single entry.
----
---