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 46A19200CBB for ; Tue, 4 Jul 2017 12:28:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 45418160D1C; Tue, 4 Jul 2017 10:28:59 +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 8B2BD160D1B for ; Tue, 4 Jul 2017 12:28:58 +0200 (CEST) Received: (qmail 1199 invoked by uid 500); 4 Jul 2017 10:28:56 -0000 Mailing-List: contact dev-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list dev@kafka.apache.org Received: (qmail 1187 invoked by uid 99); 4 Jul 2017 10:28:56 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2017 10:28:56 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 196F5C08B5 for ; Tue, 4 Jul 2017 10:28:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=opencore.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id mQK1mQXiajNo for ; Tue, 4 Jul 2017 10:28:53 +0000 (UTC) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id EB9545F39D for ; Tue, 4 Jul 2017 10:28:52 +0000 (UTC) Received: by mail-oi0-f49.google.com with SMTP id p188so100182223oia.0 for ; Tue, 04 Jul 2017 03:28:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=x6QfXCOmZq81LC5SzaAEBCxmSAdni1Op2NQbre0627A=; b=NPfauZlgONaL52uHaLoJVcQji7xuQccArhOOetLKxRXLogFbtG7hQ062Awbm05Ss5i MtySVSmHs6R35ZUxAoq9YIPqp367b45Mo3dp77Wb2Xan4SK2JwGGgMzhZN+og3u93dRR ACf/uqyfaU/QYPWF34H0pPRG7t5azNZKbFiPNK8eYxfRlbZFsgO4ozdlIU2WLPiCxTwn JS4RbEuz+j0l6c8MOQzg11wghWxnxDcp+zn3VbEAjsff1Kr1xptILRNnhbAFpk+xUJpc nS1A+cHLlg2IF5zhmar10hURG/VO2RS45Sj5D+66HE1HW8LDpfziHbW1BQsivOY4i2a9 gEaQ== X-Gm-Message-State: AKS2vOxcE82aA58+uBF5iLtDlrZWjgheTy9dq9MUhLJK8J8m3T8Mf41T SD3A6xtVkW9vDn0PkbDnZPh6ksIxYPzntHI= X-Received: by 10.202.114.68 with SMTP id p65mr23373693oic.175.1499164131371; Tue, 04 Jul 2017 03:28:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.47.70 with HTTP; Tue, 4 Jul 2017 03:28:10 -0700 (PDT) From: =?UTF-8?Q?S=C3=B6nke_Liebau?= Date: Tue, 4 Jul 2017 12:28:10 +0200 Message-ID: Subject: [DISCUSS] KAFKA-4930 & KAFKA 4938 - Treatment of name parameter in create connector requests To: dev@kafka.apache.org Content-Type: multipart/alternative; boundary="001a1134edae82c63905537b59fb" archived-at: Tue, 04 Jul 2017 10:28:59 -0000 --001a1134edae82c63905537b59fb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable While working on KAFKA-4930 and KAFKA-4938 I came across some sort of fundamental questions about the rest api for creating connectors in Kafka Connect that I'd like to put up for discussion. Currently requests that do not contain a "name" element on the top level are not accepted by the API, but that is due to a NullPointerException [1] so not entirely intentional. Previous (and current if the lines causing the Exception are removed) functionality was to create a connector named "null" if that parameter was missing. I am not sure if this is a good thing, as for example that connector will be overwritten every time a new request without a name is sent, as opposed to the expected warning that a connector of that name already exists. I would propose to reject api calls without a name provided on the top level, but this might break requests that currently work, so should probably be mentioned in the release notes. ---- Additionally, the "name" parameter is also copied into the "config" sub-element of the connector request - unless a name parameter was provided there in the original request[2]. So this: { "name": "connectorname", "config": { "connector.class": "org.apache.kafka.connect.tools.MockSourceConnector"= , "tasks.max": "1", "topics": "test-topic" } } would become this: { "name": "connectorname", "config": { "name": "connectorname", "connector.class": "org.apache.kafka.connect.tools.MockSourceConnector"= , "tasks.max": "1", "topics": "test-topic" } } But a request that contains two different names like this: { "name": "connectorname", "config": { "name": "differentconnectorname", "connector.class": "org.apache.kafka.connect.tools.MockSourceConnector"= , "tasks.max": "1", "topics": "test-topic" } } would be allowed as is. This might be intentional behavior in order to enable Connectors to have a "name" parameter of their own - though I couldn't find any that do, but I think this has the potential for misunderstandings, especially as there may be code out there that references the connector name from the config object and would thus grab the "wrong" one. Again, this may be intentional, so I am mostly looking for comments on how to proceed here. My first instinct is to make the top-level "name" parameter mandatory as suggested above and then add a check to reject requests that contain a different "name" field in the config element. Any comments or thoughts welcome. TL/DR: Two questions up for discussion: 1. Should we reject api calls to create a connector that do not contain a "name" element on the top level? 2. Is there a use case where it makes sense to have different "name" elements in the connector config and as the connector name? Kind regards, S=C3=B6nke [1] https://github.com/apache/kafka/blob/trunk/connect/ runtime/src/main/java/org/apache/kafka/connect/runtime/rest/resources/ ConnectorsResource.java#L91 [2] https://github.com/apache/kafka/blob/trunk/connect/ runtime/src/main/java/org/apache/kafka/connect/runtime/rest/resources/ ConnectorsResource.java#L96 --001a1134edae82c63905537b59fb--