-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix(flink): add close function in AbstractStreamWriteFunction #18743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,6 +176,14 @@ public void endInput() { | |
| this.inputEnded = true; | ||
| } | ||
|
|
||
| @Override | ||
| public void close() throws Exception { | ||
| if (this.writeClient != null) { | ||
| this.writeClient.close(); | ||
| } | ||
| super.close(); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 - AI-generated; verify before applying. React 👍/👎 to flag quality.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 Looking at the current diff, |
||
|
|
||
| // ------------------------------------------------------------------------- | ||
| // Getter/Setter | ||
| // ------------------------------------------------------------------------- | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 Should this also call
super.close()to chain to the parent (ProcessFunctionAdapter/RichFunction)? Subclasses likeStreamWriteFunctionandIndexWriteFunctioninvokesuper.close()at the end of their ownclose(), which now lands here — and stops, leaving anything the Flink base class needs to clean up unhandled. Wrapping thewriteClient.close()in a try/finally withsuper.close()in the finally would also ensure cleanup proceeds if the write client throws.- AI-generated; verify before applying. React 👍/👎 to flag quality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 The current diff already calls
super.close()at line 313, so the chaining concern looks addressed. The try/finally point still has merit though — ifwriteClient.close()throws,super.close()would be skipped. Worth noting that the siblingStreamWriteFunction.close()already uses this try/finally pattern formemorySegmentPool, so mirroring it here would be consistent.