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 CE6DB20049D for ; Wed, 9 Aug 2017 16:43:56 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CCC01169482; Wed, 9 Aug 2017 14:43:56 +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 EB597169480 for ; Wed, 9 Aug 2017 16:43:55 +0200 (CEST) Received: (qmail 31465 invoked by uid 500); 9 Aug 2017 14:43:54 -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 31451 invoked by uid 99); 9 Aug 2017 14:43:53 -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, 09 Aug 2017 14:43:53 +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 5DD8DC039E for ; Wed, 9 Aug 2017 14:43:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.401 X-Spam-Level: X-Spam-Status: No, score=-0.401 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_H2=-2.8, 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-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 lOuIGJpXrjfk for ; Wed, 9 Aug 2017 14:43:50 +0000 (UTC) Received: from mail-oi0-f44.google.com (mail-oi0-f44.google.com [209.85.218.44]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id A383C5FCC6 for ; Wed, 9 Aug 2017 14:43:49 +0000 (UTC) Received: by mail-oi0-f44.google.com with SMTP id e124so63461375oig.2 for ; Wed, 09 Aug 2017 07:43:49 -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:in-reply-to:references:from:date :message-id:subject:to; bh=rVE8GegMSlrWLUaAQS9xu39MdTT6Kw8LCILL0HNP1ZI=; b=mmN+P0fYpyU3MqxH2M2BYE7HrmfMgP0ccSxs6Nl3RsJF9fPd3MVL73ghqax7ttzzBn 8JhKHHw+GH/w7DsCJnvd3xrjztbt6SllBKUETtL8c5d+Dz5FVqEI2zjwgSmT/5KSt1qY VONPDxKVpXK3cAPD4D9jhlzgs49tGhIiVZKMyFnvczbvd7rDSYdNZLbrG/h3PzG+kizi 43xbPR4UPnJpnb02I1h9QkVkG/VRCIJ7TBPBv6bB2oiYaKSXuK5bkO7G4CjnTzUN6Ob/ XXS/jw1wFVW5EFEe/PhTys6kkJCPVsCOat8COGsBBFiMSe8OfOSIlSINS42U5Pp3lEJM /DKg== X-Gm-Message-State: AHYfb5h/Yo2wVc5Zu2XcXhSvq1DUs+CXuE6zznZaXaWeecVry5WgvpU2 uLkiWD3TqoM47D2LU2q7muvyPvkqo52x3CYWPQ== X-Received: by 10.202.7.65 with SMTP id 62mr8033890oih.81.1502289828510; Wed, 09 Aug 2017 07:43:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.187.100 with HTTP; Wed, 9 Aug 2017 07:43:08 -0700 (PDT) In-Reply-To: References: From: =?UTF-8?Q?S=C3=B6nke_Liebau?= Date: Wed, 9 Aug 2017 16:43:08 +0200 Message-ID: Subject: Re: [DISCUSS] KAFKA-4930 & KAFKA 4938 - Treatment of name parameter in create connector requests To: dev@kafka.apache.org Content-Type: multipart/alternative; boundary="94eb2c13f9909419640556531b66" archived-at: Wed, 09 Aug 2017 14:43:57 -0000 --94eb2c13f9909419640556531b66 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Could someone have a look at the PR for KAFKA-4930 if they get the chance (not necessarily you Gwen, just bumping in general)? I've updated it according to the latest comments a little while ago and would like to get this done, before I forget what I did in case more changes are necessary :) Thanks! Jira: https://issues.apache.org/jira/browse/KAFKA-4930 PR: https://github.com/apache/kafka/pull/2755 On Thu, Jul 6, 2017 at 8:19 PM, Gwen Shapira wrote: > This sounds great. I'll try to review later today :) > > On Thu, Jul 6, 2017 at 12:35 AM S=C3=B6nke Liebau > wrote: > > > I've updated the pull request to behave as follows: > > - reject create requests that contain no "name" element with a > > BadRequestException > > - reject name that are empty or contain illegal characters with a > > ConfigException > > - leave current logic around when to copy the name from the create > request > > to the config element intact > > - added unit tests for the validator to check that illegal characters > are > > correctly identified > > > > The list of illegal characters is the result of some quick testing I di= d, > > all of the characters in the list currently cause issues when used in a > > connector name (similar to KAFKA-4827), so this should not break anythi= ng > > that anybody relies on. > > I think we may want to start a larger discussion around connector names= , > > allowed characters, max length, .. to come up with an airtight set of > > rules that we can then enforce, I am sure this is currently not perfect > as > > is. > > > > Best regards, > > S=C3=B6nke > > > > On Wed, Jul 5, 2017 at 9:31 AM, S=C3=B6nke Liebau > > > wrote: > > > > > Hi, > > > > > > regarding "breaking existing functionality" .. yes...that was me > getting > > > confused about intended and existing functionality :) > > > You are right, this won't break anything that is currently working. > > > > > > I'll leave placement of "name" parameter as is and open a new issue t= o > > > clarify this later on. > > > > > > Kind regards, > > > S=C3=B6nke > > > > > > On Wed, Jul 5, 2017 at 5:41 AM, Gwen Shapira > wrote: > > > > > >> Hey, > > >> > > >> Nice research and summary. > > >> > > >> Regarding the ability to have a "nameless" connector - I'm pretty su= re > > 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 fo= r > > 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 i= n > > >> 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 nam= ed > > >> "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 shoul= d > > >> > 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 t= o > > >> 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 conf= ig > > >> object > > >> > and would thus grab the "wrong" one. > > >> > > > >> > Again, this may be intentional, so I am mostly looking for comment= s > 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 "nam= e" > > >> > 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 > > >> > > > >> > > > > > > > > > > > > -- > > > S=C3=B6nke Liebau > > > Partner > > > Tel. +49 179 7940878 <+49%20179%207940878> <+49%20179%207940878> > > > OpenCore GmbH & Co. KG - Thomas-Mann-Stra=C3=9Fe 8 - 22880 Wedel - Ge= rmany > > > > > > > > > > > -- > > S=C3=B6nke Liebau > > Partner > > Tel. +49 179 7940878 <+49%20179%207940878> > > OpenCore GmbH & Co. KG - Thomas-Mann-Stra=C3=9Fe 8 - 22880 Wedel - Germ= any > > > --=20 S=C3=B6nke Liebau Partner Tel. +49 179 7940878 OpenCore GmbH & Co. KG - Thomas-Mann-Stra=C3=9Fe 8 - 22880 Wedel - Germany --94eb2c13f9909419640556531b66--