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 CA70E200BB7 for ; Wed, 9 Nov 2016 14:23:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C91E6160AF7; Wed, 9 Nov 2016 13:23: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 1C664160AEE for ; Wed, 9 Nov 2016 14:23:03 +0100 (CET) Received: (qmail 24975 invoked by uid 500); 9 Nov 2016 13:23:02 -0000 Mailing-List: contact dev-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list dev@flink.apache.org Received: (qmail 24954 invoked by uid 99); 9 Nov 2016 13:23:02 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2016 13:23:02 +0000 Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 864541A06DC; Wed, 9 Nov 2016 13:23:02 +0000 (UTC) Received: by mail-it0-f45.google.com with SMTP id q124so156760963itd.1; Wed, 09 Nov 2016 05:23:02 -0800 (PST) X-Gm-Message-State: ABUngveb5bPuCobhTqy5G9iM3ESQFUyPaloE2gQDngVLdS/Eaj6ysCuqnHyRq1kXt9P4qB/hNLdf2IlmIG2fXg== X-Received: by 10.107.197.66 with SMTP id v63mr133188iof.119.1478697781820; Wed, 09 Nov 2016 05:23:01 -0800 (PST) MIME-Version: 1.0 From: Aljoscha Krettek Date: Wed, 09 Nov 2016 13:22:51 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: [DISCUSS] Changing Window Cleanup Semantics To: Dev , user Content-Type: multipart/alternative; boundary=94eb2c18a3de0405750540de28e8 archived-at: Wed, 09 Nov 2016 13:23:05 -0000 --94eb2c18a3de0405750540de28e8 Content-Type: text/plain; charset=UTF-8 Hi, I recently created https://issues.apache.org/jira/browse/FLINK-4994 to address what I think is a flaw in the window cleanup semantics. This has the possibility of affecting people so I'd like to get some opinions and also give people a heads-up. Before going into what I'm proposing in the issue, let's first see how window cleanup works in Flink 1.1. There are three pieces of state that need to be cleaned up: 1) window contents (the actual elements) 2) merging window set (only in case of merging windows) and 3) trigger state. The WindowOperator is responsible for cleaning the first two while the Trigger itself is responsible for the third. For this purpose we have the method Trigger.clear() that must clean up all state the Trigger created. In Flink 1.1 we clear 1 and 2 and call Trigger.clear() when either of two things happens: a Trigger returns PURGE (or FIRE_AND_PURGE, below I'll only say PURGE but mean both) or the allowed lateness expires (watermark passes the end of the window plus allowed lateness). This will lead to surprising results when you use session windows (as outlined in the linked issue) and people also seem to have been working around the fact that Trigger.clear() is called when PURGING because they want to clear the window contents but still keep some state in the trigger in case more elements arrive. For Flink 1.2 I'm proposing to not clear the merging window set on PURGE and also to not call Trigger.clear() on PURGE. Those two should only happen when we garbage collect the window, i.e. we reach the end of the allowed lateness. This will have the consequence that people who have been relying on cleanup to happen after a PURGE have to manually cleanup state now. I think it's still a good change, though, since it leads to more sane behaviour for merging windows. What do you think? There is also the possibility of adding a Trigger.onPurge() method that by default calls clean(), but in the long run I'd like to remove that again so at one point people have to adapt to the changes. In my opinion it's better to break this now and cleanly. Cheers, Aljoscha --94eb2c18a3de0405750540de28e8--