From issues-return-172140-archive-asf-public=cust-asf.ponee.io@flink.apache.org Sat Jun 16 16:15:08 2018 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 D7443180625 for ; Sat, 16 Jun 2018 16:15:07 +0200 (CEST) Received: (qmail 73599 invoked by uid 500); 16 Jun 2018 14:15:07 -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 73590 invoked by uid 99); 16 Jun 2018 14:15:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Jun 2018 14:15:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 8DBAF1A0848 for ; Sat, 16 Jun 2018 14:15:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 9xurawaJs8e6 for ; Sat, 16 Jun 2018 14:15:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id D295460DA6 for ; Sat, 16 Jun 2018 14:15:03 +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 F378BE0E3E for ; Sat, 16 Jun 2018 14:15:01 +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 8DE9821848 for ; Sat, 16 Jun 2018 14:15:00 +0000 (UTC) Date: Sat, 16 Jun 2018 14:15:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-9571) Switch to internal states in StateBinder MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-9571?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1651= 4790#comment-16514790 ]=20 ASF GitHub Bot commented on FLINK-9571: --------------------------------------- Github user sihuazhou commented on a diff in the pull request: https://github.com/apache/flink/pull/6173#discussion_r195903638 =20 --- Diff: flink-state-backends/flink-statebackend-rocksdb/src/main/java= /org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java --- @@ -1303,103 +1316,18 @@ private ColumnFamilyHandle createColumnFamily(= String stateName) throws IOExcepti =09} =20 =09@Override -=09protected InternalValueState createValueState( -=09=09TypeSerializer namespaceSerializer, -=09=09ValueStateDescriptor stateDesc) throws Exception { - -=09=09Tuple2> registerResult =3D -=09=09=09=09tryRegisterKvStateInformation(stateDesc, namespaceSerializ= er); - -=09=09return new RocksDBValueState<>( -=09=09=09=09registerResult.f0, -=09=09=09=09registerResult.f1.getNamespaceSerializer(), -=09=09=09=09registerResult.f1.getStateSerializer(), -=09=09=09=09stateDesc.getDefaultValue(), -=09=09=09=09this); -=09} - -=09@Override -=09protected InternalListState createListState( -=09=09TypeSerializer namespaceSerializer, -=09=09ListStateDescriptor stateDesc) throws Exception { - -=09=09Tuple2>> registerResult =3D -=09=09=09=09tryRegisterKvStateInformation(stateDesc, namespaceSerializ= er); - -=09=09return new RocksDBListState<>( -=09=09=09=09registerResult.f0, -=09=09=09=09registerResult.f1.getNamespaceSerializer(), -=09=09=09=09registerResult.f1.getStateSerializer(), -=09=09=09=09stateDesc.getDefaultValue(), -=09=09=09=09stateDesc.getElementSerializer(), -=09=09=09=09this); -=09} - -=09@Override -=09protected InternalReducingState createReducingState= ( -=09=09TypeSerializer namespaceSerializer, -=09=09ReducingStateDescriptor stateDesc) throws Exception { - -=09=09Tuple2> registerResult =3D -=09=09=09=09tryRegisterKvStateInformation(stateDesc, namespaceSerializ= er); - -=09=09return new RocksDBReducingState<>( -=09=09=09=09registerResult.f0, -=09=09=09=09registerResult.f1.getNamespaceSerializer(), -=09=09=09=09registerResult.f1.getStateSerializer(), -=09=09=09=09stateDesc.getDefaultValue(), -=09=09=09=09stateDesc.getReduceFunction(), -=09=09=09=09this); -=09} - -=09@Override -=09protected InternalAggregatingState = createAggregatingState( -=09=09TypeSerializer namespaceSerializer, -=09=09AggregatingStateDescriptor stateDesc) throws Exceptio= n { - -=09=09Tuple2> registerResult =3D -=09=09=09=09tryRegisterKvStateInformation(stateDesc, namespaceSerializ= er); - -=09=09return new RocksDBAggregatingState<>( -=09=09=09=09registerResult.f0, -=09=09=09=09registerResult.f1.getNamespaceSerializer(), -=09=09=09=09registerResult.f1.getStateSerializer(), -=09=09=09=09stateDesc.getDefaultValue(), -=09=09=09=09stateDesc.getAggregateFunction(), -=09=09=09=09this); -=09} - -=09@Override -=09protected InternalFoldingState createFold= ingState( +=09public IS createState( =09=09TypeSerializer namespaceSerializer, -=09=09FoldingStateDescriptor stateDesc) throws Exception { - -=09=09Tuple2> registerResult =3D -=09=09=09=09tryRegisterKvStateInformation(stateDesc, namespaceSerializ= er); - -=09=09return new RocksDBFoldingState<>( -=09=09=09=09registerResult.f0, -=09=09=09=09registerResult.f1.getNamespaceSerializer(), -=09=09=09=09registerResult.f1.getStateSerializer(), -=09=09=09=09stateDesc.getDefaultValue(), -=09=09=09=09stateDesc.getFoldFunction(), -=09=09=09=09this); -=09} - -=09@Override -=09protected InternalMapState createMapState= ( -=09=09TypeSerializer namespaceSerializer, -=09=09MapStateDescriptor stateDesc) throws Exception { - -=09=09Tuple2>> registerResult =3D -=09=09=09=09tryRegisterKvStateInformation(stateDesc, namespaceSerializ= er); - -=09=09return new RocksDBMapState<>( -=09=09=09=09registerResult.f0, -=09=09=09=09registerResult.f1.getNamespaceSerializer(), -=09=09=09=09registerResult.f1.getStateSerializer(), -=09=09=09=09stateDesc.getDefaultValue(), -=09=09=09=09this); +=09=09StateDescriptor stateDesc) throws Exception { +=09=09if (!STATE_FACTORIES.containsKey(stateDesc.getClass())) { +=09=09=09String message =3D String.format("State %s is not supported b= y %s", +=09=09=09=09stateDesc.getClass(), this.getClass()); +=09=09=09throw new UnsupportedOperationException(message); --- End diff -- =20 The exception type is a bit inconsistent, in other place throw `FlinkRu= ntimeException`, maybe it better to make this consistent. > Switch to internal states in StateBinder > ---------------------------------------- > > Key: FLINK-9571 > URL: https://issues.apache.org/jira/browse/FLINK-9571 > Project: Flink > Issue Type: Sub-task > Components: State Backends, Checkpointing > Affects Versions: 1.6.0 > Reporter: Andrey Zagrebin > Assignee: Andrey Zagrebin > Priority: Major > Fix For: 1.6.0 > > > The StateBinder factory for state objects is not a part of public API and= it produces in fact only internal states. > It=C2=A0can be changed it to produce internal state interfaces instead of= public API. > This=C2=A0can help to expose internal state API for internal components w= hich use the=C2=A0factory, e.g. for state TTL wrappers. -- This message was sent by Atlassian JIRA (v7.6.3#76005)