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/09 10:58:55 UTC

[GitHub] [incubator-seatunnel] ic4y opened a new pull request, #2706: [DEV][Api] Replace SeaTunnelContext with JobContext and remove singleton pattern

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

   <!--
   
   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
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   Since the new engine can run multiple jobs at the same time, the `SeaTunnelContext` of the previous singleton pattern mode is not applicable and will cause bugs, because each job needs to hold a `SeaTunnelContext`
   so replace `SeaTunnelContext` with `JobContext` and remove singleton pattern.
   
   After this pr merge, I will Cherry-Pick to the st-engine.
   
   
   
   ## Check list
   
   * [x] Code changed are covered with tests, or it does not need tests for reason:
   * [x] 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)
   * [x] 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] Hisoka-X merged pull request #2706: [DEV][Api] Replace SeaTunnelContext with JobContext and remove singleton pattern

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


-- 
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] laglangyue commented on pull request #2706: [DEV][Api] Replace SeaTunnelContext with JobContext and remove singleton pattern

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

   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 commented on a diff in pull request #2706: [DEV][Api] Replace SeaTunnelContext with JobContext and remove singleton pattern

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


##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/common/JobContext.java:
##########
@@ -80,7 +74,7 @@ public String getJobId() {
         return this.jobId;
     }
 
-    private SeaTunnelContext() {
+    public JobContext() {

Review Comment:
   I suggest put the constructor on top. 



##########
seatunnel-connectors-v2/connector-elasticsearch/src/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java:
##########
@@ -68,19 +70,19 @@ private static RestClientBuilder getRestClientBuilder(List<String> hosts, String
     }
 
     public static EsRestClient getInstance(List<String> hosts, String username, String password) {
-        if (restClient == null) {
+        if (REST_CLIENT == null) {

Review Comment:
   I think we need `double checked locking` here.



-- 
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] TyrantLucifer commented on a diff in pull request #2706: [DEV][Api] Replace SeaTunnelContext with JobContext and remove singleton pattern

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


##########
seatunnel-connectors-v2/connector-elasticsearch/src/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/config/SinkConfig.java:
##########
@@ -36,10 +36,10 @@ public class SinkConfig {
     public static final String MAX_RETRY_SIZE = "max_retry_size";
 
     public static void setValue(org.apache.seatunnel.shade.com.typesafe.config.Config pluginConfig){
-        if(pluginConfig.hasPath(MAX_BATCH_SIZE)){
+        if (pluginConfig.hasPath(MAX_BATCH_SIZE)){
             BulkConfig.MAX_BATCH_SIZE = pluginConfig.getInt(MAX_BATCH_SIZE);
         }
-        if(pluginConfig.hasPath(MAX_RETRY_SIZE)){
+        if (pluginConfig.hasPath(MAX_RETRY_SIZE)){

Review Comment:
   The same as above.



##########
seatunnel-connectors-v2/connector-elasticsearch/src/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/sink/ElasticsearchSinkWriter.java:
##########
@@ -42,7 +44,7 @@
 /**
  * ElasticsearchSinkWriter is a sink writer that will write {@link SeaTunnelRow} to Elasticsearch.
  */
-public class ElasticsearchSinkWriter<ElasticsearchSinkState> implements SinkWriter<SeaTunnelRow, ElasticsearchCommitInfo, ElasticsearchSinkState> {
+public class ElasticsearchSinkWriter<ElasticsearchSinkStateT> implements SinkWriter<SeaTunnelRow, ElasticsearchCommitInfo, ElasticsearchSinkStateT> {

Review Comment:
   Why change the class name?



##########
seatunnel-connectors-v2/connector-elasticsearch/src/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/config/SinkConfig.java:
##########
@@ -36,10 +36,10 @@ public class SinkConfig {
     public static final String MAX_RETRY_SIZE = "max_retry_size";
 
     public static void setValue(org.apache.seatunnel.shade.com.typesafe.config.Config pluginConfig){
-        if(pluginConfig.hasPath(MAX_BATCH_SIZE)){
+        if (pluginConfig.hasPath(MAX_BATCH_SIZE)){

Review Comment:
   `if (pluginConfig.hasPath(MAX_BATCH_SIZE)) {` is better.



-- 
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] ic4y commented on a diff in pull request #2706: [DEV][Api] Replace SeaTunnelContext with JobContext and remove singleton pattern

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


##########
seatunnel-connectors-v2/connector-elasticsearch/src/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java:
##########
@@ -68,19 +70,19 @@ private static RestClientBuilder getRestClientBuilder(List<String> hosts, String
     }
 
     public static EsRestClient getInstance(List<String> hosts, String username, String password) {
-        if (restClient == null) {
+        if (REST_CLIENT == null) {

Review Comment:
   @iture123 Please take a look



-- 
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] TyrantLucifer commented on pull request #2706: [DEV][Api] Replace SeaTunnelContext with JobContext and remove singleton pattern

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

   BTW, you should fix the test case error.
   
   ![image](https://user-images.githubusercontent.com/51053924/189801901-75af7923-77d3-492d-a123-b91fb803252e.png)
   


-- 
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] ic4y commented on a diff in pull request #2706: [DEV][Api] Replace SeaTunnelContext with JobContext and remove singleton pattern

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


##########
seatunnel-connectors-v2/connector-elasticsearch/src/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/sink/ElasticsearchSinkWriter.java:
##########
@@ -42,7 +44,7 @@
 /**
  * ElasticsearchSinkWriter is a sink writer that will write {@link SeaTunnelRow} to Elasticsearch.
  */
-public class ElasticsearchSinkWriter<ElasticsearchSinkState> implements SinkWriter<SeaTunnelRow, ElasticsearchCommitInfo, ElasticsearchSinkState> {
+public class ElasticsearchSinkWriter<ElasticsearchSinkStateT> implements SinkWriter<SeaTunnelRow, ElasticsearchCommitInfo, ElasticsearchSinkStateT> {

Review Comment:
   Because ElasticsearchSinkState does not meet the checkstyle specification



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