You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/09/20 13:58:39 UTC

[GitHub] [incubator-seatunnel] ashulin opened a new pull request, #2820: [hotfix][connector-v2] fix pulsar source exceptions

ashulin opened a new pull request, #2820:
URL: https://github.com/apache/incubator-seatunnel/pull/2820

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   1. fix the exception that pulsar discovering splits
   2. fix exactly-once exception
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   ## Check list
   
   * [ ] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


-- 
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


[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #2820: [hotfix][connector-v2] fix pulsar source exceptions

Posted by GitBox <gi...@apache.org>.
hailin0 commented on code in PR #2820:
URL: https://github.com/apache/incubator-seatunnel/pull/2820#discussion_r978339385


##########
seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/enumerator/PulsarSplitEnumerator.java:
##########
@@ -127,6 +130,20 @@ public void open() {
 
     @Override
     public void run() throws Exception {
+        if (partitionDiscoveryIntervalMs > 0) {
+            executor = new ScheduledThreadPoolExecutor(1, runnable -> {
+                Thread thread = new Thread(runnable);
+                thread.setDaemon(true);
+                thread.setName("pulsar-split-discovery-executor");
+                return thread;
+            });
+            executor.schedule(this::discoverySplits, partitionDiscoveryIntervalMs, TimeUnit.MILLISECONDS);

Review Comment:
   Use `try catch` wrap `this::discoverySplits` and log throwable message?



##########
seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/enumerator/PulsarSplitEnumerator.java:
##########
@@ -127,6 +130,20 @@ public void open() {
 
     @Override
     public void run() throws Exception {
+        if (partitionDiscoveryIntervalMs > 0) {
+            executor = new ScheduledThreadPoolExecutor(1, runnable -> {
+                Thread thread = new Thread(runnable);
+                thread.setDaemon(true);
+                thread.setName("pulsar-split-discovery-executor");
+                return thread;
+            });
+            executor.schedule(this::discoverySplits, partitionDiscoveryIntervalMs, TimeUnit.MILLISECONDS);

Review Comment:
   Submits a one-shot task? 
   
   ```java
   
   executor.scheduleWithFixedDelay(new Runnable() {
                       @Override
                       public void run() {
                           try {
                               this.discoverySplits();
                           } catch (Throwable e) {
                               log.error(..., e);
                           }
                       }
                   }, 0, partitionDiscoveryIntervalMs, TimeUnit.MILLISECONDS);
   ```



-- 
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


[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #2820: [hotfix][connector-v2] fix pulsar source exceptions

Posted by GitBox <gi...@apache.org>.
hailin0 commented on code in PR #2820:
URL: https://github.com/apache/incubator-seatunnel/pull/2820#discussion_r978344072


##########
seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/enumerator/PulsarSplitEnumerator.java:
##########
@@ -127,6 +130,20 @@ public void open() {
 
     @Override
     public void run() throws Exception {
+        if (partitionDiscoveryIntervalMs > 0) {
+            executor = new ScheduledThreadPoolExecutor(1, runnable -> {
+                Thread thread = new Thread(runnable);
+                thread.setDaemon(true);
+                thread.setName("pulsar-split-discovery-executor");
+                return thread;
+            });
+            executor.schedule(this::discoverySplits, partitionDiscoveryIntervalMs, TimeUnit.MILLISECONDS);

Review Comment:
   Submits a one-shot task? 
   
   ```java
   
   executor.scheduleAtFixedRate(new Runnable() {
                       @Override
                       public void run() {
                           try {
                               this.discoverySplits();
                           } catch (Throwable e) {
                               log.error(..., e);
                           }
                       }
                   }, 0, partitionDiscoveryIntervalMs, TimeUnit.MILLISECONDS);
   ```



-- 
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


[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #2820: [hotfix][connector-v2] fix pulsar source exceptions

Posted by GitBox <gi...@apache.org>.
hailin0 commented on code in PR #2820:
URL: https://github.com/apache/incubator-seatunnel/pull/2820#discussion_r975571354


##########
seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/enumerator/PulsarSplitEnumerator.java:
##########
@@ -127,6 +129,19 @@ public void open() {
 
     @Override
     public void run() throws Exception {
+        if (partitionDiscoveryIntervalMs > 0) {
+            new ScheduledThreadPoolExecutor(1, runnable -> {

Review Comment:
   How to close this thread pool when terminates a task?



-- 
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


[GitHub] [incubator-seatunnel] ashulin commented on a diff in pull request #2820: [hotfix][connector-v2] fix pulsar source exceptions

Posted by GitBox <gi...@apache.org>.
ashulin commented on code in PR #2820:
URL: https://github.com/apache/incubator-seatunnel/pull/2820#discussion_r975576375


##########
seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/enumerator/PulsarSplitEnumerator.java:
##########
@@ -127,6 +129,19 @@ public void open() {
 
     @Override
     public void run() throws Exception {
+        if (partitionDiscoveryIntervalMs > 0) {
+            new ScheduledThreadPoolExecutor(1, runnable -> {

Review Comment:
   Sorry, I forgot 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


[GitHub] [incubator-seatunnel] hailin0 commented on pull request #2820: [hotfix][connector-v2] fix pulsar source exceptions

Posted by GitBox <gi...@apache.org>.
hailin0 commented on PR #2820:
URL: https://github.com/apache/incubator-seatunnel/pull/2820#issuecomment-1255926162

   LGTM


-- 
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


[GitHub] [incubator-seatunnel] EricJoy2048 merged pull request #2820: [hotfix][connector-v2] fix pulsar source exceptions

Posted by GitBox <gi...@apache.org>.
EricJoy2048 merged PR #2820:
URL: https://github.com/apache/incubator-seatunnel/pull/2820


-- 
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