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 A1DDF200CA5 for ; Sat, 10 Jun 2017 11:49:26 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A071D160BE6; Sat, 10 Jun 2017 09:49:26 +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 C03E6160BD7 for ; Sat, 10 Jun 2017 11:49:25 +0200 (CEST) Received: (qmail 92458 invoked by uid 500); 10 Jun 2017 09:49:25 -0000 Mailing-List: contact issues-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 issues@flink.apache.org Received: (qmail 92449 invoked by uid 99); 10 Jun 2017 09:49:24 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Jun 2017 09:49:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 86144C0944 for ; Sat, 10 Jun 2017 09:49:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.211 X-Spam-Level: X-Spam-Status: No, score=-99.211 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 7thaOHpcR9td for ; Sat, 10 Jun 2017 09:49:23 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id B4E815F2F1 for ; Sat, 10 Jun 2017 09:49:22 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 73BF7E0D3D for ; Sat, 10 Jun 2017 09:49:21 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 00F1A21E0E for ; Sat, 10 Jun 2017 09:49:19 +0000 (UTC) Date: Sat, 10 Jun 2017 09:49:19 +0000 (UTC) From: "mingleizhang (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (FLINK-6849) Refactor operator state backend and internal operator state hierarchy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 10 Jun 2017 09:49:26 -0000 [ https://issues.apache.org/jira/browse/FLINK-6849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16045475#comment-16045475 ] mingleizhang edited comment on FLINK-6849 at 6/10/17 9:48 AM: -------------------------------------------------------------- [~tzulitai] [~srichter] I just do a little refactor for the {{OperatorStateBackend}} interface by adding two method. And below is it's the first version sample code. Please helps to reiview and provide some suggestions for this change. Thanks. About what is relationship of opeartor state and keyed state. We can think it it just a partitioned operator state. :) {code}/** * Creates or retrieves a operator state backed by this state backend. * * @param namespaceSerializer The serializer used for the namespace type of the state. * @param stateDescriptor The identifier for the state. This contains name and can create a default state value. * * @param The type of the namespace. * @param The type of the state. * * @return A new operator state backed by this backend. * * @throws Exception Exceptions may occur during initialization of the state and should be forwarded. */ S getOrCreateOperatorState( TypeSerializer namespaceSerializer, StateDescriptor stateDescriptor) throws Exception; /** * Creates or retrieves a operator state backed by this backend. * * TODO: NOTE: This method does a lot of work caching / retrieving states just to update the namespace. * This method should be removed for the sake of namespaces being lazily fetched from the operator * state backend, or being set on the state directly. * * @param stateDescriptor The identifier for the state. This contains name and can create a default state value. * * @param The type of the namespace. * @param The type of the state. * * @return a new operator state backed by this backend. * * @throws Exception Exceptions may occur during initialization of the state and should be forwarded. */ S getOperatorState( N namespace, TypeSerializer namespaceSerializer, StateDescriptor stateDescriptor) throws Exception;{code} was (Author: mingleizhang): [~tzulitai] [~srichter] I just do a little refactor for the {{OperatorStateBackend}} interface by adding two method. And below is it's the first version sample code. Please helps to reiview and provide some suggestions for this change. Thanks. {code}/** * Creates or retrieves a operator state backed by this state backend. * * @param namespaceSerializer The serializer used for the namespace type of the state. * @param stateDescriptor The identifier for the state. This contains name and can create a default state value. * * @param The type of the namespace. * @param The type of the state. * * @return A new operator state backed by this backend. * * @throws Exception Exceptions may occur during initialization of the state and should be forwarded. */ S getOrCreateOperatorState( TypeSerializer namespaceSerializer, StateDescriptor stateDescriptor) throws Exception; /** * Creates or retrieves a operator state backed by this backend. * * TODO: NOTE: This method does a lot of work caching / retrieving states just to update the namespace. * This method should be removed for the sake of namespaces being lazily fetched from the operator * state backend, or being set on the state directly. * * @param stateDescriptor The identifier for the state. This contains name and can create a default state value. * * @param The type of the namespace. * @param The type of the state. * * @return a new operator state backed by this backend. * * @throws Exception Exceptions may occur during initialization of the state and should be forwarded. */ S getOperatorState( N namespace, TypeSerializer namespaceSerializer, StateDescriptor stateDescriptor) throws Exception;{code} > Refactor operator state backend and internal operator state hierarchy > --------------------------------------------------------------------- > > Key: FLINK-6849 > URL: https://issues.apache.org/jira/browse/FLINK-6849 > Project: Flink > Issue Type: Improvement > Components: State Backends, Checkpointing > Reporter: Tzu-Li (Gordon) Tai > > Currently, compared to the keyed state backends, the operator state backends, as well as operator state interfaces, lacks proper hierarchy. > One issue with this lack of hierarchy is that the general concerns of implementing state registration is different between the keyed and operator backends (aside from what is naturally different, such as namespace and key which is not relevant for the operator backend). For example, in the keyed backend hierarchy, {{AbstractKeyedStateBackend}} has caches that shortcuts re-accessing already registered state. This behaviour is missing in the operator backend hierarchy, and for example needs to be explicitly handled by the concrete {{DefaultOperatorStateBackend}} subclass implementation. > As of now, the need of a proper hierarchy also on the operator backend side might not be that prominent, but will mostly likely become more prominent as we wish to introduce more state structures for operator state (e.g. a {{MapState}} for operator state has already been discussed a few times already) as well as more options besides memory-backed operator state. -- This message was sent by Atlassian JIRA (v6.3.15#6346)