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 C6D36200C6D for ; Sun, 7 May 2017 13:41:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C55C6160BB1; Sun, 7 May 2017 11:41:09 +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 E45D8160B9A for ; Sun, 7 May 2017 13:41:08 +0200 (CEST) Received: (qmail 12176 invoked by uid 500); 7 May 2017 11:41:08 -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 12167 invoked by uid 99); 7 May 2017 11:41:07 -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; Sun, 07 May 2017 11:41:07 +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 9547CC0898 for ; Sun, 7 May 2017 11:41:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, 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 t6EPcECXFn5Q for ; Sun, 7 May 2017 11:41:06 +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 863E95F24C for ; Sun, 7 May 2017 11:41:06 +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 D3FA4E0940 for ; Sun, 7 May 2017 11:41:05 +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 E0A5621DEC for ; Sun, 7 May 2017 11:41:04 +0000 (UTC) Date: Sun, 7 May 2017 11:41:04 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-5823) Store Checkpoint Root Metadata in StateBackend (not in HA custom store) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 07 May 2017 11:41:10 -0000 [ https://issues.apache.org/jira/browse/FLINK-5823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15999800#comment-15999800 ] ASF GitHub Bot commented on FLINK-5823: --------------------------------------- Github user StephanEwen commented on a diff in the pull request: https://github.com/apache/flink/pull/3522#discussion_r115140655 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/state/CheckpointMetadataStreamFactory.java --- @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.state; + +import org.apache.flink.core.fs.FSDataOutputStream; + +import java.io.IOException; + +import static org.apache.flink.util.Preconditions.checkNotNull; + +/** + * The {@link CheckpointMetadataStreamFactory} creates streams to write checkpoint metadata, + * similar as the {@link CheckpointStreamFactory} creates streams to write checkpoint data. + */ +public interface CheckpointMetadataStreamFactory { + + /** + * Creates a stream to write the metadata for the particular checkpoint that this factory + * belongs to. + * + * @return The metadata output stream for this factory's checkpoint. + * @throws IOException Thrown, if the stream could not be opened. + */ + CheckpointMetadataOutputStream createCheckpointStateOutputStream() throws IOException; + + /** + * Gets the location (as a string pointer) where the metadata factory + * The interpretation of the pointer is up to the implementation of the state backend. + * + *

In case of high-availability setups, the target location pointer is stored + * in the "ground-truth" store for checkpoint recovery. + * + * @return The checkpoint location pointer. + */ + String getTargetLocation(); + + // ------------------------------------------------------------------------ + + /** + * A dedicated output stream for persisting checkpoint metadata. Upon completion, this returns + * the state handle to the persisted metadata, plus the external pointer that can be used + * to restore from that checkpoint. + */ + abstract class CheckpointMetadataOutputStream extends FSDataOutputStream { + + /** + * Closes the metadata stream and gets the external pointer to the checkpoint and a + * handle that can create an input stream producing the data written to this stream. + * + * @return The pointer and state handle with access to the written metadata. + * @throws IOException Thrown, if the stream cannot be closed. + */ + public abstract StreamHandleAndPointer closeAndGetPointerHandle() throws IOException; + } + + // ------------------------------------------------------------------------ + + /** + * A combination of a {@code StreamStateHandle} and an external pointer (in the form of a String). + */ + final class StreamHandleAndPointer { --- End diff -- The idea of the pointer is to have a state-backend independent string that indicates a checkpoint location. I picked a string, because the location is ultimately passed as a string, either from the user command `flink run -s ` or from ZooKeeper' "last completed checkpoint" entry. Introducing the `StreamHandleAndPointer` here spares the code from having to reason about state backend specific file handles. We can change that at some point, but for the breadth of changes already in this PR, this helped reduce the scope a bit. > Store Checkpoint Root Metadata in StateBackend (not in HA custom store) > ----------------------------------------------------------------------- > > Key: FLINK-5823 > URL: https://issues.apache.org/jira/browse/FLINK-5823 > Project: Flink > Issue Type: Sub-task > Components: State Backends, Checkpointing > Reporter: Stephan Ewen > Assignee: Stephan Ewen > Fix For: 1.3.0 > > -- This message was sent by Atlassian JIRA (v6.3.15#6346)