You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/12/15 06:49:25 UTC

[GitHub] [shardingsphere] azexcy opened a new pull request, #22882: Refactor importer create at pipeline

azexcy opened a new pull request, #22882:
URL: https://github.com/apache/shardingsphere/pull/22882

   Related #22500 
   
   Changes proposed in this pull request:
     - Add Importer connector, prepare for subsequent cdc extensions
     - CDC `proto` updated 
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [ ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [ ] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [ ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [ ] I have added corresponding unit tests for my changes.
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on a diff in pull request #22882: Refactor importer create at pipeline

Posted by GitBox <gi...@apache.org>.
sandynz commented on code in PR #22882:
URL: https://github.com/apache/shardingsphere/pull/22882#discussion_r1049275556


##########
kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/importer/connector/ImporterConnector.java:
##########
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.data.pipeline.spi.importer.connector;
+
+/**
+ * Importer connector.
+ */
+public interface ImporterConnector {
+    
+    /**
+     * Get connector.
+     *
+     * @return connector
+     */
+    Object getConnector();
+    
+    /**
+     * Connector type.
+     *
+     * @return connector type.

Review Comment:
   `.` is not needed at the end of `param` and `return` javadoc



##########
kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/importer/connector/ImporterConnector.java:
##########
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.data.pipeline.spi.importer.connector;
+
+/**
+ * Importer connector.
+ */
+public interface ImporterConnector {
+    
+    /**
+     * Get connector.
+     *
+     * @return connector
+     */
+    Object getConnector();
+    
+    /**
+     * Connector type.
+     *
+     * @return connector type.
+     */
+    String getType();

Review Comment:
   Is `getType()` required?



##########
kernel/data-pipeline/cdc/protocol/src/main/proto/CDCResponseProtocol.proto:
##########
@@ -51,6 +51,22 @@ message CreateSubscriptionResult {
   bool existing = 2;
 }
 
+message NullValue {
+
+}
+
+message BigIntegerValue {
+  bytes value = 1;
+}
+
+message BigDecimalValue {
+  string value = 1;
+}
+
+message ClobValue {
+  string value = 1;
+}
+
 message FetchRecordResult {

Review Comment:
   Looks `FETCH_RECORDS` was removed in request protocol, does `FetchRecordResult` need to be updated?



##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DefaultImporter.java:
##########
@@ -79,11 +80,11 @@ public final class DefaultImporter extends AbstractLifecycleExecutor implements
     
     private volatile Statement batchDeleteStatement;
     
-    public DefaultImporter(final ImporterConfiguration importerConfig, final PipelineDataSourceManager dataSourceManager, final PipelineChannel channel,
+    public DefaultImporter(final ImporterConfiguration importerConfig, final ImporterConnector importerConnector, final PipelineChannel channel,
                            final PipelineJobProgressListener jobProgressListener) {

Review Comment:
   `ImporterConnector` is imported here. Some questions:
   1. Is there new type of Importer impl for CDC?
   2. If yes, it's better to update related factory `DefaultImporterCreator`. If no, is it enough to reuse `DefaultImporter`?



##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DefaultImporter.java:
##########
@@ -79,11 +80,11 @@ public final class DefaultImporter extends AbstractLifecycleExecutor implements
     
     private volatile Statement batchDeleteStatement;
     
-    public DefaultImporter(final ImporterConfiguration importerConfig, final PipelineDataSourceManager dataSourceManager, final PipelineChannel channel,
+    public DefaultImporter(final ImporterConfiguration importerConfig, final ImporterConnector importerConnector, final PipelineChannel channel,
                            final PipelineJobProgressListener jobProgressListener) {
         this.importerConfig = importerConfig;
         rateLimitAlgorithm = importerConfig.getRateLimitAlgorithm();
-        this.dataSourceManager = dataSourceManager;
+        this.dataSourceManager = (PipelineDataSourceManager) importerConnector.getConnector();

Review Comment:
   It's better not use type casting here if there's another way



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] codecov-commenter commented on pull request #22882: Refactor importer create at pipeline

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #22882:
URL: https://github.com/apache/shardingsphere/pull/22882#issuecomment-1352656265

   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/22882?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#22882](https://codecov.io/gh/apache/shardingsphere/pull/22882?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a73a4a1) into [master](https://codecov.io/gh/apache/shardingsphere/commit/a02296a5242fc28effe328662abe24a07974665c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a02296a) will **decrease** coverage by `0.03%`.
   > The diff coverage is `5.49%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #22882      +/-   ##
   ============================================
   - Coverage     49.38%   49.35%   -0.04%     
   + Complexity     2460     2459       -1     
   ============================================
     Files          4149     4152       +3     
     Lines         57920    57955      +35     
     Branches       9927     9928       +1     
   ============================================
   - Hits          28604    28603       -1     
   - Misses        26848    26884      +36     
     Partials       2468     2468              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/22882?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ingsphere/agent/bootstrap/ShardingSphereAgent.java](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvYm9vdHN0cmFwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9hZ2VudC9ib290c3RyYXAvU2hhcmRpbmdTcGhlcmVBZ2VudC5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...re/agent/core/plugin/PluginBootServiceManager.java](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS9wbHVnaW4vUGx1Z2luQm9vdFNlcnZpY2VNYW5hZ2VyLmphdmE=) | `0.00% <ø> (ø)` | |
   | [...phere/agent/core/plugin/advisor/AgentAdvisors.java](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS9wbHVnaW4vYWR2aXNvci9BZ2VudEFkdmlzb3JzLmphdmE=) | `58.33% <ø> (-1.67%)` | :arrow_down: |
   | [...phere/agent/core/transformer/AgentTransformer.java](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS90cmFuc2Zvcm1lci9BZ2VudFRyYW5zZm9ybWVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...efinition/BaseLoggingAdvisorDefinitionService.java](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvcGx1Z2lucy9sb2dnaW5nL2Jhc2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2FnZW50L3BsdWdpbi9sb2dnaW5nL2Jhc2UvZGVmaW5pdGlvbi9CYXNlTG9nZ2luZ0Fkdmlzb3JEZWZpbml0aW9uU2VydmljZS5qYXZh) | `0.00% <ø> (ø)` | |
   | [...ing/base/service/BaseLoggingPluginBootService.java](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvcGx1Z2lucy9sb2dnaW5nL2Jhc2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2FnZW50L3BsdWdpbi9sb2dnaW5nL2Jhc2Uvc2VydmljZS9CYXNlTG9nZ2luZ1BsdWdpbkJvb3RTZXJ2aWNlLmphdmE=) | `0.00% <ø> (ø)` | |
   | [...definition/PrometheusAdvisorDefinitionService.java](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvcGx1Z2lucy9tZXRyaWNzL3R5cGUvcHJvbWV0aGV1cy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvbWV0cmljcy9wcm9tZXRoZXVzL2RlZmluaXRpb24vUHJvbWV0aGV1c0Fkdmlzb3JEZWZpbml0aW9uU2VydmljZS5qYXZh) | `63.15% <ø> (ø)` | |
   | [...rometheus/service/PrometheusPluginBootService.java](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvcGx1Z2lucy9tZXRyaWNzL3R5cGUvcHJvbWV0aGV1cy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvbWV0cmljcy9wcm9tZXRoZXVzL3NlcnZpY2UvUHJvbWV0aGV1c1BsdWdpbkJvb3RTZXJ2aWNlLmphdmE=) | `66.66% <ø> (ø)` | |
   | [...ger/definition/JaegerAdvisorDefinitionService.java](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvcGx1Z2lucy90cmFjaW5nL3R5cGUvamFlZ2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9hZ2VudC9wbHVnaW4vdHJhY2luZy9qYWVnZXIvZGVmaW5pdGlvbi9KYWVnZXJBZHZpc29yRGVmaW5pdGlvblNlcnZpY2UuamF2YQ==) | `80.00% <ø> (ø)` | |
   | [...jaeger/service/JaegerTracingPluginBootService.java](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvcGx1Z2lucy90cmFjaW5nL3R5cGUvamFlZ2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9hZ2VudC9wbHVnaW4vdHJhY2luZy9qYWVnZXIvc2VydmljZS9KYWVnZXJUcmFjaW5nUGx1Z2luQm9vdFNlcnZpY2UuamF2YQ==) | `84.21% <ø> (ø)` | |
   | ... and [33 more](https://codecov.io/gh/apache/shardingsphere/pull/22882/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] azexcy commented on a diff in pull request #22882: Refactor importer create at pipeline

Posted by GitBox <gi...@apache.org>.
azexcy commented on code in PR #22882:
URL: https://github.com/apache/shardingsphere/pull/22882#discussion_r1049668952


##########
kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/importer/connector/ImporterConnector.java:
##########
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.data.pipeline.spi.importer.connector;
+
+/**
+ * Importer connector.
+ */
+public interface ImporterConnector {
+    
+    /**
+     * Get connector.
+     *
+     * @return connector
+     */
+    Object getConnector();
+    
+    /**
+     * Connector type.
+     *
+     * @return connector type.
+     */
+    String getType();

Review Comment:
   Improved, the `getType()` used for load SPI implemention



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz merged pull request #22882: Refactor importer create at pipeline

Posted by GitBox <gi...@apache.org>.
sandynz merged PR #22882:
URL: https://github.com/apache/shardingsphere/pull/22882


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org