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 AB96E200CCA for ; Wed, 5 Jul 2017 05:42:21 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AA856162469; Wed, 5 Jul 2017 03:42:21 +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 CB890162467 for ; Wed, 5 Jul 2017 05:42:20 +0200 (CEST) Received: (qmail 84959 invoked by uid 500); 5 Jul 2017 03:42:19 -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 84946 invoked by uid 99); 5 Jul 2017 03:42:19 -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; Wed, 05 Jul 2017 03:42:19 +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 BA64FC02C9 for ; Wed, 5 Jul 2017 03:42:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.296 X-Spam-Level: X-Spam-Status: No, score=-0.296 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.796, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=confluent-io.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 6B8SxHHjiE9o for ; Wed, 5 Jul 2017 03:42:16 +0000 (UTC) Received: from mail-yb0-f175.google.com (mail-yb0-f175.google.com [209.85.213.175]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id DBD495FB96 for ; Wed, 5 Jul 2017 03:42:10 +0000 (UTC) Received: by mail-yb0-f175.google.com with SMTP id e201so68362078ybb.1 for ; Tue, 04 Jul 2017 20:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=confluent-io.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=CY2kYIu5ivU9MgCHqImwQg8bzYAcp5qwp2DJijYGZRA=; b=f19ErTtBlbUjlvMP1cmtqLba55kKsyh3sOO3kmq5AAXnPX8P18v0y34YI+fVJrLXu4 gdkhAN8P2JRFU1HLYVQFU2kVa0jefZGeho1J7cH6U7GUMxTToVOx16YHVxwKp+sTyPwp NvUXmHt5JZlAASqAmedDcMCdueGq9vvwp2rLZhmOdKz4GrjzpOABB02b46SjAeeSFf6E QwViNHGIyJwypF5p1tH3DbTye6DyGuJBkQkzcKg3Gmf/jqHjJGtBLOlJsY5Jf9FTCODJ /07/Ltml3smQoFDGDuFmSiqM3A+ohOazGwHM0qAYdFYHWT17a69W3bj+B2Gzl4a4Citq FjXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=CY2kYIu5ivU9MgCHqImwQg8bzYAcp5qwp2DJijYGZRA=; b=mXYd0c6n26HHhBcccSBWKEldIvNhEn6TnaXvxiF4Dw+UxBJp3F2X+FrpeDXldqPPgA PbaZpxqRuPH1WPR7uUzdmtoLm9KNG+Z17aYJjwc5fzh26eDD19P6PlG55A4jXPvX2vvu BSeJ0225Zrs2CBc9wVlEKWMPEzYRXhxcUqs49itPSOfeI1CWtDBTCZA7fLnqxdeBVcDV dg5APIWA5rsWyJf6/Al9ivacwYSRQmRw7hfNPq64oRSG1y6apSq7P9nLqneKFXdVskLz nOiuU8bCiz5IOYrigzp3CTq5HMSLEN5ZiIehQX3I79lSmEfz5XNolZ9NQiYTEIBwhCHT GRXQ== X-Gm-Message-State: AKS2vOzprjQRzTDtVFBHMaIQM/+WTISEO6IkRkmWNUUiF6qS6uJG76bc ZIXe7Lr6dmgjxIw6YN7hLPba+Qf2qmdd X-Received: by 10.37.231.72 with SMTP id e69mr32958967ybh.88.1499226130472; Tue, 04 Jul 2017 20:42:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Gwen Shapira Date: Wed, 05 Jul 2017 03:41:59 +0000 Message-ID: Subject: Re: [DISCUSS] KAFKA-4930 & KAFKA 4938 - Treatment of name parameter in create connector requests To: Konstantine Karantasis , dev@kafka.apache.org Content-Type: multipart/alternative; boundary="94eb2c0a814cf204ea055389c835" archived-at: Wed, 05 Jul 2017 03:42:21 -0000 --94eb2c0a814cf204ea055389c835 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey, Nice research and summary. Regarding the ability to have a "nameless" connector - I'm pretty sure we never intended to allow that. I'm confused about breaking something that currently works though - since we get NPE, how will giving more intentional exceptions break anything? Regarding the placing of the name - inside or outside the config. It looks messy and I'm as confused as you are. I think Konstantine had some ideas how this should be resolved. I hope he responds, but I think that for your PR, just accept current mess as given... Gwen On Tue, Jul 4, 2017 at 3:28 AM S=C3=B6nke Liebau wrote: > 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 t= he > Exception are removed) functionality was to create a connector named "nul= l" > 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 connect= or > 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 provid= ed > 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 m= ay > be code out there that references the connector name from the config obje= ct > and would thus grab the "wrong" one. > > Again, this may be intentional, so I am mostly looking for comments on ho= w > 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 > --94eb2c0a814cf204ea055389c835--