From dev-return-100740-archive-asf-public=cust-asf.ponee.io@kafka.apache.org Thu Jan 3 20:16:31 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 1C796180608 for ; Thu, 3 Jan 2019 20:16:30 +0100 (CET) Received: (qmail 295 invoked by uid 500); 3 Jan 2019 19:16:29 -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 283 invoked by uid 99); 3 Jan 2019 19:16:29 -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; Thu, 03 Jan 2019 19:16:29 +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 BC52F180D9E for ; Thu, 3 Jan 2019 19:16:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.798 X-Spam-Level: * X-Spam-Status: No, score=1.798 tagged_above=-999 required=6.31 tests=[DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com 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 dUbretsg6RaM for ; Thu, 3 Jan 2019 19:16:27 +0000 (UTC) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 37CF360D2E for ; Thu, 3 Jan 2019 19:16:27 +0000 (UTC) Received: by mail-ot1-f52.google.com with SMTP id a11so30218308otr.10 for ; Thu, 03 Jan 2019 11:16:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=GpxF55KrJNPtVMarING5qtsZs8d37uNtsoiWkoVHlzQ=; b=ZkTD00or6q+2SEwB7Fe7zwjz4PaR8uTNLp1rUy+oVqErTTP6WbJHYQDmlqaT3U0aII EF9WOplmWmXqylD0FMDfI/kTKvKcCmROwtyJBpMEA7Ei9qRo4dwxjPHpCVwUL6C0PL2K FCvHNV4LzgL6asV096O8sCcDwFqRfEIZLRdK/MMuc+zRNGjxVq6asHdHod2q3hJglS4H Yxc/bJHDLRR4vkGMIGbpdeGC+UpzjOEGwCFT1+4hAp/qFyGtWjb15gqKn8bs3zFXKXJ9 dxsv2hYZxdN7cDsf/k9pIz176XgtxwBopRLsF3Wpfc1OZRDwSDDDDw3NPOQ7V/upUhS4 khrg== 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=GpxF55KrJNPtVMarING5qtsZs8d37uNtsoiWkoVHlzQ=; b=d3PHlrnq45sDFa43l4o0KrhQtkvi5adOrW/bfs4eh0a4eXrsWDtsMlTAk+sh8CIYH8 3BwZJ2xu/nIUMgpjtCAPcmDY4MW6r46Tqz9RgDycZLalJQnB36yNQjdw/w5SqIrXrabw +4CBla1oMIs8c0jyaV0j1YO+So+dO/uLOuMeeBeLQiHdpeF6KO06xwclVO+ym1Q11eHI Pkz6oQ/tlVmqaz+e0T6XloXPc8ZTMCGs6o18ztdepYbL2WCPstKTmyII59sfhlHHi7OR k2Fv3qTx0e78G6+IzV6y/KklT/E6ygmwpO4pZt+vrOU1D0rQLJteNIHx4mXvyqV3YcBK i6kw== X-Gm-Message-State: AJcUukdBaRXVdSme4guS5+4qITIUsgfzMfmvhQ0YGglP27LmnR8XiJbr I+aGr4F9e095DG3lL6qIdLzH6Zy0T7hRnMlj+mGNhpgQ X-Google-Smtp-Source: ALg8bN7us1dwElhjNf4tx+P4o4HdtvpFVuEL+Ag8Fs9YpvTaVFZu52hY/0b7sFKWr0kIikm8hByf8Rn773rUBrv42Tk= X-Received: by 2002:a9d:1b0:: with SMTP id e45mr35589211ote.16.1546542986244; Thu, 03 Jan 2019 11:16:26 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Guozhang Wang Date: Thu, 3 Jan 2019 11:16:15 -0800 Message-ID: Subject: Re: Suggestion to make 0 grace period the default for suppress To: dev Content-Type: multipart/alternative; boundary="000000000000533689057e929977" --000000000000533689057e929977 Content-Type: text/plain; charset="UTF-8" Thanks for reporting this Jingguo, personally I'd favor we change the default value of retention to 0 consistently, regardless of whether suppress is used, if we would ever consider changing it. Since it is a public API change (i.e. changing the default value), it should be discussed and voted via a KIP: https://cwiki.apache.org/confluence/display/KAFKA/Kafka+Improvement+Proposals Are you interested in creating one and drive the discussion? Guozhang On Sun, Dec 30, 2018 at 10:34 PM jingguo yao wrote: > [1] has the following code to demonstrate the usage of suppress method. > > KGroupedStream grouped = ...; > grouped > .windowedBy(TimeWindows.of(Duration.ofHours(1)).grace(ofMinutes(10))) > .count() > .suppress(Suppressed.untilWindowCloses(unbounded())) > .filter((windowedUserId, count) -> count < 3) > .toStream() > .foreach((windowedUserId, count) -> > sendAlert(windowedUserId.window(), windowedUserId.key(), count)); > > > If I remove the grace method invocation, I will have a one day > retention period. The following code in > org.apache.kafka.streams.kstream.TimeWindows causes this hehaviour: > > @SuppressWarnings("deprecation") // continuing to support > Windows#maintainMs/segmentInterval in fallback mode > @Override > public long gracePeriodMs() { > // NOTE: in the future, when we remove maintainMs, > // we should default the grace period to 24h to maintain the default > behavior, > // or we can default to (24h - size) if you want to be super accurate. > return grace != null ? grace.toMillis() : maintainMs() - size(); > } > > I think that it is better to use 0 grace period if > "suppress(Suppressed.untilWindowCloses(unbounded()))" exists. With the > suppress method invocation, people are expecting to see the final > window result when the window closes instead of wait to see the result > after the one-day period. Even if we have some reasons similar to ones > mentioned in the code comment, it is better to mention this hehaviour > somewhere in Kafka streams documentation. > > > [1] > http://kafka.apache.org/21/documentation/streams/developer-guide/dsl-api.html#window-final-resu > > > -- > Jingguo > -- -- Guozhang --000000000000533689057e929977--