You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "zhangshenghang (via GitHub)" <gi...@apache.org> on 2024/08/26 13:08:40 UTC
[PR] [Feature][Zeata] add event notify [seatunnel]
zhangshenghang opened a new pull request, #7501:
URL: https://github.com/apache/seatunnel/pull/7501
### Purpose of this pull request
- resolve #7485
@Hisoka-X
#### 1. **Source-related Classes**
| Class Name | Method | Introduced Event |
| --------------------| ------ | ----------------- |
| SourceFlowLifeCycle | open | ReaderOpenEvent |
| SourceFlowLifeCycle | close | ReaderCloseEvent |
| ParallelSource | open | ReaderOpenEvent |
| ParallelSource | close | ReaderCloseEvent |
| CoordinatedSource | open | ReaderOpenEvent |
| CoordinatedSource | close | ReaderCloseEvent |
| FlinkSourceReader | start | ReaderOpenEvent |
| FlinkSourceReader | close | ReaderCloseEvent |
#### 2. **Enumerator-related Classes**
| Class Name | Method | Introduced Event |
| ------------------------------- | -------------- | ------------------- |
| SourceSplitEnumeratorTask | stateProcess | EnumeratorOpenEvent |
| SourceSplitEnumeratorTask | close | EnumeratorCloseEvent|
| CoordinatedSource | open | EnumeratorOpenEvent |
| CoordinatedSource | close | EnumeratorCloseEvent|
| ParallelSource | open | EnumeratorOpenEvent |
| ParallelSource | close | EnumeratorCloseEvent|
| FlinkSourceEnumerator | start | EnumeratorOpenEvent |
| FlinkSourceEnumerator | close | EnumeratorCloseEvent|
#### 3. **Sink-related Classes**
| Class Name | Method | Introduced Event |
| -------------------------------| ------ | ----------------- |
| SinkFlowLifeCycle | close | WriterCloseEvent |
| MultiTableSinkWriter | close | WriterCloseEvent |
| FlinkSinkWriter | close | WriterCloseEvent |
| SparkDataWriter | commit | WriterCloseEvent |
| SeaTunnelSparkDataWriter | commit | WriterCloseEvent |
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released SeaTunnel versions or within the unreleased branches such as dev.
If no, write 'No'.
If you are adding/modifying connector documents, please follow our new specifications: https://github.com/apache/seatunnel/issues/4544.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If you are adding E2E test cases, maybe refer to https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/resources/mysqlcdc_to_mysql.conf, here is a good example.
-->
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License Notice according
[New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
* [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If you are contributing the connector code, please check that the following files are updated:
1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
* [ ] Update the [`release-note`](https://github.com/apache/seatunnel/blob/dev/release-note.md).
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Add event notify for all connector [seatunnel]
Posted by "wuchunfu (via GitHub)" <gi...@apache.org>.
wuchunfu merged PR #7501:
URL: https://github.com/apache/seatunnel/pull/7501
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Zeta] add event notify [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #7501:
URL: https://github.com/apache/seatunnel/pull/7501#discussion_r1732048924
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:
##########
@@ -75,6 +80,7 @@ public MultiTableSinkWriter(
BlockingQueue<SeaTunnelRow> queue = new LinkedBlockingQueue<>(1024);
Map<String, SinkWriter<SeaTunnelRow, ?, ?>> tableIdWriterMap = new HashMap<>();
Map<SinkIdentifier, SinkWriter<SeaTunnelRow, ?, ?>> sinkIdentifierMap = new HashMap<>();
+ Map<SinkIdentifier, SinkWriter.Context> sinkContextIdentifierMap = new HashMap<>();
Review Comment:
This variable useless?
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:
##########
@@ -267,26 +276,32 @@ public void abortPrepare() {
@Override
public void close() throws IOException {
- Throwable firstE = null;
+ final Throwable[] firstE = {null};
Review Comment:
Add comment for why use array.
##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/flow/SinkFlowLifeCycle.java:
##########
@@ -284,18 +287,11 @@ public void restoreState(List<ActionSubtaskState> actionStateList) throws Except
.collect(Collectors.toList());
}
if (states.isEmpty()) {
- this.writer =
- sinkAction
- .getSink()
- .createWriter(
- new SinkWriterContext(indexID, metricsContext, eventListener));
+ this.writerContext = new SinkWriterContext(indexID, metricsContext, eventListener);
Review Comment:
we can move it into outer of if statement.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Add event notify for all connector [seatunnel]
Posted by "zhangshenghang (via GitHub)" <gi...@apache.org>.
zhangshenghang commented on code in PR #7501:
URL: https://github.com/apache/seatunnel/pull/7501#discussion_r1732837230
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:
##########
@@ -75,6 +80,7 @@ public MultiTableSinkWriter(
BlockingQueue<SeaTunnelRow> queue = new LinkedBlockingQueue<>(1024);
Map<String, SinkWriter<SeaTunnelRow, ?, ?>> tableIdWriterMap = new HashMap<>();
Map<SinkIdentifier, SinkWriter<SeaTunnelRow, ?, ?>> sinkIdentifierMap = new HashMap<>();
+ Map<SinkIdentifier, SinkWriter.Context> sinkContextIdentifierMap = new HashMap<>();
Review Comment:
Yes, this may be a useless plan. I have already deleted it
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Add event notify for all connector [seatunnel]
Posted by "zhangshenghang (via GitHub)" <gi...@apache.org>.
zhangshenghang commented on code in PR #7501:
URL: https://github.com/apache/seatunnel/pull/7501#discussion_r1732814942
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:
##########
@@ -267,26 +276,32 @@ public void abortPrepare() {
@Override
public void close() throws IOException {
- Throwable firstE = null;
+ final Throwable[] firstE = {null};
Review Comment:
@Hisoka-X
The lambda expression uses constants, so it is modified to an array .
<img width="574" alt="image" src="https://github.com/user-attachments/assets/b691760d-a143-4e9f-a288-6f683e21a792">
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Add event notify for all connector [seatunnel]
Posted by "zhangshenghang (via GitHub)" <gi...@apache.org>.
zhangshenghang commented on code in PR #7501:
URL: https://github.com/apache/seatunnel/pull/7501#discussion_r1732829050
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:
##########
@@ -267,26 +276,32 @@ public void abortPrepare() {
@Override
public void close() throws IOException {
- Throwable firstE = null;
+ final Throwable[] firstE = {null};
Review Comment:
> I get it. I think you should add a comment for it
Ok, I have added it and am waiting to submit it along with other questions
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Add event notify for all connector [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #7501:
URL: https://github.com/apache/seatunnel/pull/7501#discussion_r1732824501
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:
##########
@@ -267,26 +276,32 @@ public void abortPrepare() {
@Override
public void close() throws IOException {
- Throwable firstE = null;
+ final Throwable[] firstE = {null};
Review Comment:
I get it. I think you should add a comment for it
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Add event notify for all connector [seatunnel]
Posted by "zhangshenghang (via GitHub)" <gi...@apache.org>.
zhangshenghang commented on code in PR #7501:
URL: https://github.com/apache/seatunnel/pull/7501#discussion_r1732832217
##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/flow/SinkFlowLifeCycle.java:
##########
@@ -284,18 +287,11 @@ public void restoreState(List<ActionSubtaskState> actionStateList) throws Except
.collect(Collectors.toList());
}
if (states.isEmpty()) {
- this.writer =
- sinkAction
- .getSink()
- .createWriter(
- new SinkWriterContext(indexID, metricsContext, eventListener));
+ this.writerContext = new SinkWriterContext(indexID, metricsContext, eventListener);
Review Comment:
You're right, it was my negligence
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org