kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [kafka] branch 2.0 updated: KAFKA-7253; The returned connector type is always null when creating connector (#5470)
Date Tue, 08 Jan 2019 16:57:41 GMT
This is an automated email from the ASF dual-hosted git repository.

jgus pushed a commit to branch 2.0
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.0 by this push:
     new dbaa152  KAFKA-7253; The returned connector type is always null when creating connector
(#5470)
dbaa152 is described below

commit dbaa15226bc8f7dfe300346dec55a93e61741db7
Author: Chia-Ping Tsai <chia7712@gmail.com>
AuthorDate: Wed Jan 9 00:52:42 2019 +0800

    KAFKA-7253; The returned connector type is always null when creating connector (#5470)
    
    The null map returned from the current snapshot causes the null type in response. The
connector class name can be taken from the config of request instead since we require the
config should contain the connector class name.
    
    Reviewers: Jason Gustafson <jason@confluent.io>
---
 .../apache/kafka/connect/runtime/distributed/DistributedHerder.java  | 4 ++--
 .../apache/kafka/connect/runtime/rest/entities/ConnectorInfo.java    | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java
index dc91f35..099f084 100644
--- a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java
@@ -555,9 +555,9 @@ public class DistributedHerder extends AbstractHerder implements Runnable
{
 
                         // Note that we use the updated connector config despite the fact
that we don't have an updated
                         // snapshot yet. The existing task info should still be accurate.
-                        Map<String, String> map = configState.connectorConfig(connName);
                         ConnectorInfo info = new ConnectorInfo(connName, config, configState.tasks(connName),
-                            map == null ? null : connectorTypeForClass(map.get(ConnectorConfig.CONNECTOR_CLASS_CONFIG)));
+                                // validateConnectorConfig have checked the existence of
CONNECTOR_CLASS_CONFIG
+                                connectorTypeForClass(config.get(ConnectorConfig.CONNECTOR_CLASS_CONFIG)));
                         callback.onCompletion(null, new Created<>(!exists, info));
                         return null;
                     }
diff --git a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/entities/ConnectorInfo.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/entities/ConnectorInfo.java
index 9a10d74..f36ee74 100644
--- a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/entities/ConnectorInfo.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/entities/ConnectorInfo.java
@@ -71,12 +71,13 @@ public class ConnectorInfo {
         ConnectorInfo that = (ConnectorInfo) o;
         return Objects.equals(name, that.name) &&
                 Objects.equals(config, that.config) &&
-                Objects.equals(tasks, that.tasks);
+                Objects.equals(tasks, that.tasks) &&
+                Objects.equals(type, that.type);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(name, config, tasks);
+        return Objects.hash(name, config, tasks, type);
     }
 
 }


Mime
View raw message