From issues-return-176434-archive-asf-public=cust-asf.ponee.io@flink.apache.org Tue Jul 10 18:06:05 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 23AA8180789 for ; Tue, 10 Jul 2018 18:06:03 +0200 (CEST) Received: (qmail 12879 invoked by uid 500); 10 Jul 2018 16:06:03 -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 12713 invoked by uid 99); 10 Jul 2018 16:06:03 -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; Tue, 10 Jul 2018 16:06:03 +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 D0E76CB4B6 for ; Tue, 10 Jul 2018 16:06:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, 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-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 21J6127PxEMI for ; Tue, 10 Jul 2018 16:06:02 +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 EA1125F494 for ; Tue, 10 Jul 2018 16:06:01 +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 32D0BE1320 for ; Tue, 10 Jul 2018 16:06: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 9376F243A1 for ; Tue, 10 Jul 2018 16:06:00 +0000 (UTC) Date: Tue, 10 Jul 2018 16:06:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-9750) Create new StreamingFileSink that works on Flink's FileSystem abstraction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-9750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16538855#comment-16538855 ] ASF GitHub Bot commented on FLINK-9750: --------------------------------------- Github user StephanEwen commented on a diff in the pull request: https://github.com/apache/flink/pull/6281#discussion_r201400623 --- Diff: flink-core/src/test/java/org/apache/flink/core/fs/AbstractResumableWriterTest.java --- @@ -0,0 +1,326 @@ +/* + * 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.core.fs; + +import org.apache.flink.core.io.SimpleVersionedSerializer; +import org.apache.flink.util.StringUtils; +import org.apache.flink.util.TestLogger; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; + +import static org.junit.Assert.fail; + +public abstract class AbstractResumableWriterTest extends TestLogger { + + private static final Random RND = new Random(); + + private static final String testData1 = "THIS IS A TEST 1."; + private static final String testData2 = "THIS IS A TEST 2."; + private static final String testData3 = "THIS IS A TEST 3."; + + private Path basePathForTest; + + private static FileSystem fileSystem; + + public abstract Path getBasePath() throws Exception; + + public abstract FileSystem initializeFileSystem(); + + public Path getBasePathForTest() { + return basePathForTest; + } + + private FileSystem getFileSystem() { + if (fileSystem == null) { + fileSystem = initializeFileSystem(); + } + return fileSystem; + } + + private ResumableWriter getNewFileSystemWriter() throws IOException { + return getFileSystem().createRecoverableWriter(); + } + + @Before + public void prepare() throws Exception { + basePathForTest = new Path(getBasePath(), randomName()); + getFileSystem().mkdirs(basePathForTest); + } + + @After + public void cleanup() throws Exception { + getFileSystem().delete(basePathForTest, true); + } + + @Test + public void testCloseWithNoData() throws Exception { + final ResumableWriter writer = getNewFileSystemWriter(); + + final Path testDir = getBasePathForTest(); + + final Path path = new Path(testDir + File.separator + "part-0"); --- End diff -- Avoid `File.separator` for cross platform path, use `new Path(testDir, "part-0");`. > Create new StreamingFileSink that works on Flink's FileSystem abstraction > ------------------------------------------------------------------------- > > Key: FLINK-9750 > URL: https://issues.apache.org/jira/browse/FLINK-9750 > Project: Flink > Issue Type: Sub-task > Components: Streaming Connectors > Reporter: Stephan Ewen > Assignee: Kostas Kloudas > Priority: Major > Labels: pull-request-available > Fix For: 1.6.0 > > > Using Flink's own file system abstraction means that we can add additional streaming/checkpointing related behavior. > In addition, the new StreamingFileSink should only rely on internal checkpointed state what files are possibly in progress or need to roll over, never assume enumeration of files in the file system. -- This message was sent by Atlassian JIRA (v7.6.3#76005)