Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F2ADA200D52 for ; Fri, 17 Nov 2017 10:47:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id F0E36160BF8; Fri, 17 Nov 2017 09:47:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4BAD3160BFB for ; Fri, 17 Nov 2017 10:47:04 +0100 (CET) Received: (qmail 46333 invoked by uid 500); 17 Nov 2017 09:47:03 -0000 Mailing-List: contact jira-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@kafka.apache.org Delivered-To: mailing list jira@kafka.apache.org Received: (qmail 46235 invoked by uid 99); 17 Nov 2017 09:47:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Nov 2017 09:47:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 91F37180FA1 for ; Fri, 17 Nov 2017 09:47:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Eo-SuDwHUc1W for ; Fri, 17 Nov 2017 09:47:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 24ECE5FD01 for ; Fri, 17 Nov 2017 09:47:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B4985E0DDB for ; Fri, 17 Nov 2017 09:47:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 6CAB0240E2 for ; Fri, 17 Nov 2017 09:47:00 +0000 (UTC) Date: Fri, 17 Nov 2017 09:47:00 +0000 (UTC) From: =?utf-8?Q?S=C3=B6nke_Liebau_=28JIRA=29?= To: jira@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (KAFKA-5563) Clarify handling of connector name in config MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 17 Nov 2017 09:47:05 -0000 [ https://issues.apache.org/jira/browse/KAFKA-5563?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1625= 6744#comment-16256744 ]=20 S=C3=B6nke Liebau commented on KAFKA-5563: ------------------------------------- As KAFKA-4930 is approaching a stable state I looked at this again and foun= d that a check like this is already implemented for [updating a connectorco= nfig|https://github.com/apache/kafka/blob/e31c0c9bdbad432bc21b583bd3c084f05= 323f642/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest= /resources/ConnectorsResource.java#L135]=20 I've prepared a pull request that moves this check into a small helper func= tion and call this from the createConnector method as well.=20 I've also tested merging this with the PR for 4930 which works nicely (for = now), if any problems occur I'll rebase whichever PR gets merged later. > Clarify handling of connector name in config=20 > --------------------------------------------- > > Key: KAFKA-5563 > URL: https://issues.apache.org/jira/browse/KAFKA-5563 > Project: Kafka > Issue Type: Bug > Components: KafkaConnect > Affects Versions: 0.11.0.0 > Reporter: S=C3=B6nke Liebau > Assignee: S=C3=B6nke Liebau > Priority: Minor > > The connector name is currently being stored in two places, once at the r= oot level of the connector and once in the config: > {code:java} > { > =09"name": "test", > =09"config": { > =09=09"connector.class": "org.apache.kafka.connect.tools.MockSinkConnecto= r", > =09=09"tasks.max": "3", > =09=09"topics": "test-topic", > =09=09"name": "test" > =09}, > =09"tasks": [ > =09=09{ > =09=09=09"connector": "test", > =09=09=09"task": 0 > =09=09} > =09] > } > {code} > If no name is provided in the "config" element, then the name from the ro= ot level is [copied there when the connector is being created|https://githu= b.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafk= a/connect/runtime/rest/resources/ConnectorsResource.java#L95]. If however a= name is provided in the config then it is not touched, which means it is p= ossible to create a connector with a different name at the root level and i= n the config like this: > {code:java} > { > =09"name": "test1", > =09"config": { > =09=09"connector.class": "org.apache.kafka.connect.tools.MockSinkConnecto= r", > =09=09"tasks.max": "3", > =09=09"topics": "test-topic", > =09=09"name": "differentname" > =09}, > =09"tasks": [ > =09=09{ > =09=09=09"connector": "test1", > =09=09=09"task": 0 > =09=09} > =09] > } > {code} > I am not aware of any issues that this currently causes, but it is at lea= st confusing and probably not intended behavior and definitely bears potent= ial for bugs, if different functions take the name from different places. > Would it make sense to add a check to reject requests that provide differ= ent names in the request and the config section? -- This message was sent by Atlassian JIRA (v6.4.14#64029)