You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/11/23 20:59:35 UTC
[GitHub] [flink] rkhachatryan opened a new pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
rkhachatryan opened a new pull request #14184:
URL: https://github.com/apache/flink/pull/14184
## What is the purpose of the change
Reuse allocated memory segments between the iterations of an iterative job.
## Brief change log
- fix checkstyle and IDE warnings
- introduce a method to close `TempBarrier` without releasing memory
- add `TempBarrier` constructor argument to use preallocated memory
- use new method/argument in `BatchTask.resetAllInputs`
## Verifying this change
This change is already covered by existing 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): yes
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/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? no
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] AHeise merged pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
AHeise merged pull request #14184:
URL: https://github.com/apache/flink/pull/14184
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14184:
URL: https://github.com/apache/flink/pull/14184#issuecomment-732434148
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=9984",
"triggerID" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"triggerType" : "PUSH"
}, {
"hash" : "c5da44513c122deddcc354e16337a7fb7cd2370e",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10043",
"triggerID" : "c5da44513c122deddcc354e16337a7fb7cd2370e",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* c5da44513c122deddcc354e16337a7fb7cd2370e Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10043)
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run travis` re-run the last Travis build
- `@flinkbot run azure` re-run the last Azure build
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] StephanEwen commented on a change in pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
StephanEwen commented on a change in pull request #14184:
URL: https://github.com/apache/flink/pull/14184#discussion_r529540130
##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java
##########
@@ -893,21 +896,34 @@ protected void resetAllInputs() throws Exception {
}
} else {
// close the async barrier if there is one
- if (this.tempBarriers[i] != null) {
- this.tempBarriers[i].close();
- this.tempBarriers[i] = null;
- }
+ List<MemorySegment> allocated = tempBarriers[i] == null ? emptyList() :
+ tempBarriers[i].closeAndGetLeftoverMemory();
+ tempBarriers[i] = null;
- // recreate the local strategy
- initInputLocalStrategy(i);
+ try {
+ initInputLocalStrategy(i);
- if (this.inputIsAsyncMaterialized[i]) {
- final int pages = this.materializationMemory[i];
- @SuppressWarnings({ "unchecked", "rawtypes" })
- TempBarrier<?> barrier = new TempBarrier(this, getInput(i), this.inputSerializers[i], memMan, ioMan, pages);
- barrier.startReading();
- this.tempBarriers[i] = barrier;
- this.inputs[i] = null;
+ if (this.inputIsAsyncMaterialized[i]) {
+ final int pages = this.materializationMemory[i];
+ if (pages > allocated.size()) {
Review comment:
This condition seems the wrong way around.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14184:
URL: https://github.com/apache/flink/pull/14184#issuecomment-732434148
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=9984",
"triggerID" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b5cb5d73481a41652fe13e99b427d50d41cd73e1 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=9984)
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run travis` re-run the last Travis build
- `@flinkbot run azure` re-run the last Azure build
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot commented on pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14184:
URL: https://github.com/apache/flink/pull/14184#issuecomment-732424103
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.
## Automated Checks
Last check on commit b5cb5d73481a41652fe13e99b427d50d41cd73e1 (Mon Nov 23 21:02:22 UTC 2020)
**Warnings:**
* No documentation files were touched! Remember to keep the Flink docs up to date!
<sub>Mention the bot in a comment to re-run the automated checks.</sub>
## Review Progress
* ❓ 1. The [description] looks good.
* ❓ 2. There is [consensus] that the contribution should go into to Flink.
* ❓ 3. Needs [attention] from.
* ❓ 4. The change fits into the overall [architecture].
* ❓ 5. Overall code [quality] is good.
Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
- `@flinkbot approve all` to approve all aspects
- `@flinkbot approve-until architecture` to approve everything until `architecture`
- `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
- `@flinkbot disapprove architecture` to remove an approval you gave earlier
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] rkhachatryan commented on a change in pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
rkhachatryan commented on a change in pull request #14184:
URL: https://github.com/apache/flink/pull/14184#discussion_r529549147
##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java
##########
@@ -893,21 +896,34 @@ protected void resetAllInputs() throws Exception {
}
} else {
// close the async barrier if there is one
- if (this.tempBarriers[i] != null) {
- this.tempBarriers[i].close();
- this.tempBarriers[i] = null;
- }
+ List<MemorySegment> allocated = tempBarriers[i] == null ? emptyList() :
+ tempBarriers[i].closeAndGetLeftoverMemory();
+ tempBarriers[i] = null;
- // recreate the local strategy
- initInputLocalStrategy(i);
+ try {
+ initInputLocalStrategy(i);
- if (this.inputIsAsyncMaterialized[i]) {
- final int pages = this.materializationMemory[i];
- @SuppressWarnings({ "unchecked", "rawtypes" })
- TempBarrier<?> barrier = new TempBarrier(this, getInput(i), this.inputSerializers[i], memMan, ioMan, pages);
- barrier.startReading();
- this.tempBarriers[i] = barrier;
- this.inputs[i] = null;
+ if (this.inputIsAsyncMaterialized[i]) {
+ final int pages = this.materializationMemory[i];
+ if (pages > allocated.size()) {
Review comment:
You are right, thanks!
I changed it to just
```Preconditions.checkState(allocated.size() <= pages);```
(`pages` should never change as you pointed out, but some of the allocated segments might have been consumed, so it's `<=` and not `==`)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14184:
URL: https://github.com/apache/flink/pull/14184#issuecomment-732434148
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=9984",
"triggerID" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"triggerType" : "PUSH"
}, {
"hash" : "c5da44513c122deddcc354e16337a7fb7cd2370e",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "c5da44513c122deddcc354e16337a7fb7cd2370e",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b5cb5d73481a41652fe13e99b427d50d41cd73e1 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=9984)
* c5da44513c122deddcc354e16337a7fb7cd2370e UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run travis` re-run the last Travis build
- `@flinkbot run azure` re-run the last Azure build
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] StephanEwen commented on pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
StephanEwen commented on pull request #14184:
URL: https://github.com/apache/flink/pull/14184#issuecomment-733665361
Looks good to me, +1 to merge this
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot commented on pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14184:
URL: https://github.com/apache/flink/pull/14184#issuecomment-732434148
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b5cb5d73481a41652fe13e99b427d50d41cd73e1 UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run travis` re-run the last Travis build
- `@flinkbot run azure` re-run the last Azure build
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14184:
URL: https://github.com/apache/flink/pull/14184#issuecomment-732434148
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=9984",
"triggerID" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b5cb5d73481a41652fe13e99b427d50d41cd73e1 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=9984)
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run travis` re-run the last Travis build
- `@flinkbot run azure` re-run the last Azure build
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] AHeise commented on pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
AHeise commented on pull request #14184:
URL: https://github.com/apache/flink/pull/14184#issuecomment-733700200
Also LGTM. Merging.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #14184: [FLINK-19852][task] Reuse TempBarrier memory between iterations
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14184:
URL: https://github.com/apache/flink/pull/14184#issuecomment-732434148
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=9984",
"triggerID" : "b5cb5d73481a41652fe13e99b427d50d41cd73e1",
"triggerType" : "PUSH"
}, {
"hash" : "c5da44513c122deddcc354e16337a7fb7cd2370e",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10043",
"triggerID" : "c5da44513c122deddcc354e16337a7fb7cd2370e",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b5cb5d73481a41652fe13e99b427d50d41cd73e1 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=9984)
* c5da44513c122deddcc354e16337a7fb7cd2370e Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10043)
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run travis` re-run the last Travis build
- `@flinkbot run azure` re-run the last Azure build
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org