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 2437A200BBB for ; Thu, 10 Nov 2016 11:38:16 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 22C68160B01; Thu, 10 Nov 2016 10:38:16 +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 69FAF160AF6 for ; Thu, 10 Nov 2016 11:38:15 +0100 (CET) Received: (qmail 2607 invoked by uid 500); 10 Nov 2016 10:38:14 -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 2591 invoked by uid 99); 10 Nov 2016 10:38:13 -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, 10 Nov 2016 10:38:13 +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 62BF418061A for ; Thu, 10 Nov 2016 10:38:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.48 X-Spam-Level: X-Spam-Status: No, score=0.48 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=data-artisans-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id kSkJ9VyuuG_i for ; Thu, 10 Nov 2016 10:38:12 +0000 (UTC) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 6A0355FAE5 for ; Thu, 10 Nov 2016 10:38:11 +0000 (UTC) Received: by mail-wm0-f52.google.com with SMTP id a197so359283549wmd.0 for ; Thu, 10 Nov 2016 02:38:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=data-artisans-com.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=EIaXCIAYB8Cj+/lUYb8Y2SlHmZrR9E85Aw6jTl4tX0Y=; b=fTfmuj9wjDe/K39HrzFAAAeq/gRYwroxXJDeBx1RZeG4Q1SK4QSGouYJ7g8SrVrjZ9 n8xac/3mPOqf08gA9Ycmihskne6A5AaN6y76x7xdBXzdHJHyeNEg9z5c3iUhjc7difBH +2QG8+tG+5vWFlsYQuWQkaK6bRdJLxvydQZco6eFmwqBZ7/z6pmdPc29mS6StFBNk7Zb FIqQ2inu9yM9ThVwn3sWfI4PKXGSDqnmtSUcmOAngA57Crqrqfe8CrW1f9gpL/1OzfV4 UoXYfiXPdTnIC7TxEgYYQNJeQav2KtbiK5J/Suw+1CWoQ2IF6zsMVY0EbfIm2OZhp2Fx ASOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=EIaXCIAYB8Cj+/lUYb8Y2SlHmZrR9E85Aw6jTl4tX0Y=; b=dm+O15rU4vx7fG5icLN8WqfVR03CUDY1JpDztf3EH6r+FEsFqGW8+tbX+N5qwBcQxW ne4tyf9EEMKUToPbTX9D5AG7C35/R6THTWaUqsKOnRQMesBrbpG13vV6jpR98eG0t8dT hA0+3tBx63LM5mYyiB9c1FIVhiPP2rzsl1kbZdYQOxLD5WYXVa6wT6LVCPw4bQF0XtsR EGIegKovatbP9Fqz/WgUr0orHoUyZ5wQBTt9M/SDvBotBsHlwmZGlhxUupK1tkFbpytJ X+d6rMnPX46WPJLYAaL/Zii6UFICn/iiTLwP9VjUge4at7B7mb6O8Ilnlujl85k/ord/ paSQ== X-Gm-Message-State: ABUngveXIqYnQFXWRDapizvkfS3g+Afu6q+DJgAxoYlpRLWtrxzu+DGQVfSeCoZmyROPNHEG X-Received: by 10.28.145.85 with SMTP id t82mr5371439wmd.40.1478774258314; Thu, 10 Nov 2016 02:37:38 -0800 (PST) Received: from ?IPv6:2a02:8109:8080:f84:987c:c7b1:3d6c:31c7? ([2a02:8109:8080:f84:987c:c7b1:3d6c:31c7]) by smtp.gmail.com with ESMTPSA id g17sm4683496wjs.38.2016.11.10.02.37.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Nov 2016 02:37:37 -0800 (PST) From: Kostas Kloudas Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: [DISCUSS] Adding a dispose() method in the RichFunction. Message-Id: <30754B18-717E-4AC4-B215-9E39E112D84F@data-artisans.com> Date: Thu, 10 Nov 2016 11:37:36 +0100 To: dev@flink.apache.org X-Mailer: Apple Mail (2.3251) archived-at: Thu, 10 Nov 2016 10:38:16 -0000 Hello, I would like to propose the addition of a dispose() method, in addition = to the=20 already existing close(), in the RichFunction interface. This will align = the lifecycle=20 of a RichFunction, with that of an Operator. After this, the code paths = followed=20 when finishing successfully and when cancelling, will be totally = distinct. Semantically, close() will be responsible for guaranteeing semantic = correctness=20 of the job when the job terminates successfully, while dispose() will be = responsible=20 for taking care of system clean up both when terminating gracefully and = when=20 cancelling, e.g. freeing resources like db connections.=20 Currently, most functions use close() with the semantics of dispose() as = the only=20 thing they do is freeing up resources. A nice example where this leads = to confusion=20 is the case of the BucketingSink/RollingSink where at close(), data that = is not committed is marked as "pending" (semantic correctness of the job). In = this case,=20 and given that there is no distinction between close() and dispose(), = this method is=20 called by the AbstractUdfStreamOperator both when successfully finishing = a job and=20 when something went wrong during execution. This is essentially a = compromise,=20 as the close() should mark this data as "committed" when successfully = terminating,=20 but it cannot as it can also be called when an exception was thrown. Let me know what you think, Kostas=20=