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 07:19:21 UTC

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

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