You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Zakelly (via GitHub)" <gi...@apache.org> on 2023/08/31 17:19:33 UTC
[GitHub] [flink] Zakelly opened a new pull request, #23344: [FLINK-30217] Replace ListState#clear along with following #add with a ListState#update
Zakelly opened a new pull request, #23344:
URL: https://github.com/apache/flink/pull/23344
## What is the purpose of the change
This PR replace ListState#clear along with following ListState#add with a ListState#update, which reduces the state access overhead for KeyedState and normalize the function calls for updating a ListState.
## Brief change log
Found the ListState#clear along with following ListState#add everywhere and did an equivalent replacement for these function calls. I tried my best to do the replacement and there may be omissions.
## 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): (yes / **no**)
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
- The serializers: (yes / **no** / don't know)
- The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / **no** / don't know)
- The S3 file system connector: (yes / **no** / don't know)
## Documentation
- Does this pull request introduce a new feature? (yes / **no**)
- If yes, how is the feature documented? (**not applicable** / docs / JavaDocs / not documented)
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] masteryhx closed pull request #23344: [FLINK-30217] Replace ListState#clear along with following #add/addAll with a ListState#update
Posted by "masteryhx (via GitHub)" <gi...@apache.org>.
masteryhx closed pull request #23344: [FLINK-30217] Replace ListState#clear along with following #add/addAll with a ListState#update
URL: https://github.com/apache/flink/pull/23344
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] Zakelly commented on pull request #23344: [FLINK-30217] Replace ListState#clear along with following #add with a ListState#update
Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on PR #23344:
URL: https://github.com/apache/flink/pull/23344#issuecomment-1702019270
@masteryhx Would you please take a look? Thanks a lot!
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] Zakelly commented on pull request #23344: [FLINK-30217] Replace ListState#clear along with following #add with a ListState#update
Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on PR #23344:
URL: https://github.com/apache/flink/pull/23344#issuecomment-1702423425
@flinkbot run azure
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] masteryhx commented on a diff in pull request #23344: [FLINK-30217] Replace ListState#clear along with following #add/addAll with a ListState#update
Posted by "masteryhx (via GitHub)" <gi...@apache.org>.
masteryhx commented on code in PR #23344:
URL: https://github.com/apache/flink/pull/23344#discussion_r1318247491
##########
flink-libraries/flink-state-processing-api/src/test/java/org/apache/flink/state/api/SavepointReaderITTestBase.java:
##########
@@ -293,11 +293,7 @@ public void processBroadcastElement(Integer value, Context ctx, Collector<Void>
@Override
public void snapshotState(FunctionSnapshotContext context) throws Exception {
- listState.clear();
-
- listState.addAll(elements);
-
- unionState.clear();
+ listState.update(elements);
unionState.addAll(elements);
Review Comment:
```suggestion
unionState.update(elements);
```
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/sort/StreamSortOperator.java:
##########
@@ -123,14 +123,12 @@ public void initializeState(StateInitializationContext context) throws Exception
@Override
public void snapshotState(StateSnapshotContext context) throws Exception {
super.snapshotState(context);
- // clear state first
- bufferState.clear();
List<Tuple2<RowData, Long>> dataToFlush = new ArrayList<>(inputBuffer.size());
inputBuffer.forEach((key, value) -> dataToFlush.add(Tuple2.of(key, value)));
// batch put
Review Comment:
```suggestion
// batch update
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] Zakelly commented on pull request #23344: [FLINK-30217] Replace ListState#clear along with following #add with a ListState#update
Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on PR #23344:
URL: https://github.com/apache/flink/pull/23344#issuecomment-1702402872
@masteryhx Thanks a lot for your review! I modified the doc you pointed out, and also replace the occurrence of "clear() + addAll()" with "update()".
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot commented on pull request #23344: [FLINK-30217] Replace ListState#clear along with following #add with a ListState#update
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #23344:
URL: https://github.com/apache/flink/pull/23344#issuecomment-1701453546
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "595ab2652e82da35e48d3df5b9c31cd555cd9966",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "595ab2652e82da35e48d3df5b9c31cd555cd9966",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 595ab2652e82da35e48d3df5b9c31cd555cd9966 UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] Zakelly commented on pull request #23344: [FLINK-30217] Replace ListState#clear along with following #add/addAll with a ListState#update
Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on PR #23344:
URL: https://github.com/apache/flink/pull/23344#issuecomment-1711002867
@masteryhx Good catch! Many thanks!
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org