You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by tillrohrmann <gi...@git.apache.org> on 2018/03/26 12:04:27 UTC

[GitHub] flink pull request #5764: [FLINK-8940] [flip6] Add support for dispose savep...

GitHub user tillrohrmann opened a pull request:

    https://github.com/apache/flink/pull/5764

    [FLINK-8940] [flip6] Add support for dispose savepoint

    ## What is the purpose of the change
    
    Adds an AsynchronousOperationHandler for disposing savepoints. The handler is registered
    under '/savepoint-disposal' and requires a SavepointDisposalRequest JSON object containing
    the path to the savepoint to be disposed. The RestClusterClient polls the status registered
    under '/savepoint-disposal/:triggerId' until the operation has been completed.
    
    cc @zentol 
    
    ## Brief change log
    
    - 
    
    ## Verifying this change
    
    - Added `RestClusterClientTest#testDisposeSavepoint`
    - Added `DispatcherTest#testSavepointDisposal`
    
    ## Does this pull request potentially affect one of the following parts:
    
      - Dependencies (does it add or upgrade a dependency): (no)
      - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
      - The serializers: (no)
      - The runtime per-record code paths (performance sensitive): (no)
      - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
      - The S3 file system connector: (no)
    
    ## Documentation
    
      - Does this pull request introduce a new feature? (no)
      - If yes, how is the feature documented? (not applicable)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tillrohrmann/flink disposeSavepoint

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/5764.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #5764
    
----

----


---

[GitHub] flink pull request #5764: [FLINK-8940] [flip6] Add support for dispose savep...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5764#discussion_r177080326
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java ---
    @@ -534,6 +534,18 @@ public void start() throws Exception {
     		}
     	}
     
    +	public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath) {
    --- End diff --
    
    wrong commit


---

[GitHub] flink pull request #5764: [FLINK-8940] [flip6] Add support for dispose savep...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/5764


---

[GitHub] flink pull request #5764: [FLINK-8940] [flip6] Add support for dispose savep...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5764#discussion_r177319256
  
    --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/DispatcherTest.java ---
    @@ -344,6 +363,42 @@ public void testJobRecovery() throws Exception {
     		assertThat(jobIds, contains(jobGraph.getJobID()));
     	}
     
    +	/**
    +	 * Tests that we can dispose a savepoint.
    +	 */
    +	@Test
    +	public void testSavepointDisposal() throws Exception {
    +		final DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class);
    +
    +		dispatcherLeaderElectionService.isLeader(UUID.randomUUID()).get();
    +
    +		final URI externalPointer = createTestingSavepoint();
    +		final Path savepointPath = Paths.get(externalPointer);
    +
    +		assertThat(Files.exists(savepointPath), is(true));
    +
    +		dispatcherGateway.disposeSavepoint(externalPointer.toString(), TIMEOUT).get();
    +
    +		assertThat(Files.exists(savepointPath), is(false));
    +	}
    +
    +	@Nonnull
    +	public URI createTestingSavepoint() throws IOException, URISyntaxException {
    --- End diff --
    
    Will do


---

[GitHub] flink pull request #5764: [FLINK-8940] [flip6] Add support for dispose savep...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5764#discussion_r177080293
  
    --- Diff: flink-clients/src/test/java/org/apache/flink/client/program/rest/RestClusterClientTest.java ---
    @@ -536,6 +546,103 @@ public void testTriggerSavepoint() throws Exception {
     		}
     	}
     
    +	@Test
    +	public void testDisposeSavepoint() throws Exception {
    --- End diff --
    
    slipped into the wrong commit


---

[GitHub] flink pull request #5764: [FLINK-8940] [flip6] Add support for dispose savep...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5764#discussion_r177320486
  
    --- Diff: flink-clients/src/test/java/org/apache/flink/client/program/rest/RestClusterClientTest.java ---
    @@ -536,6 +546,103 @@ public void testTriggerSavepoint() throws Exception {
     		}
     	}
     
    +	@Test
    +	public void testDisposeSavepoint() throws Exception {
    --- End diff --
    
    Will correct it.


---

[GitHub] flink pull request #5764: [FLINK-8940] [flip6] Add support for dispose savep...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5764#discussion_r177319125
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/savepoints/SavepointDisposalRequest.java ---
    @@ -0,0 +1,47 @@
    +/*
    + * 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.rest.messages.job.savepoints;
    +
    +import org.apache.flink.runtime.rest.messages.RequestBody;
    +
    +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
    +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
    +
    +import javax.annotation.Nonnull;
    +
    +/**
    + * Request body for a savepoint disposal call.
    + */
    +public class SavepointDisposalRequest implements RequestBody {
    +
    +	private static final String FIELD_NAME_SAVEPOINT_PATH = "savepoint-path";
    +
    +	@JsonProperty(FIELD_NAME_SAVEPOINT_PATH)
    +	private final String savepointPath;
    +
    +	@JsonCreator
    +	public SavepointDisposalRequest(
    +		@JsonProperty(FIELD_NAME_SAVEPOINT_PATH) @Nonnull String savepointPath) {
    +		this.savepointPath = savepointPath;
    +	}
    +
    +	public String getSavepointPath() {
    --- End diff --
    
    Good catch, will addi t.


---

[GitHub] flink pull request #5764: [FLINK-8940] [flip6] Add support for dispose savep...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5764#discussion_r177083854
  
    --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/DispatcherTest.java ---
    @@ -344,6 +363,42 @@ public void testJobRecovery() throws Exception {
     		assertThat(jobIds, contains(jobGraph.getJobID()));
     	}
     
    +	/**
    +	 * Tests that we can dispose a savepoint.
    +	 */
    +	@Test
    +	public void testSavepointDisposal() throws Exception {
    +		final DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class);
    +
    +		dispatcherLeaderElectionService.isLeader(UUID.randomUUID()).get();
    +
    +		final URI externalPointer = createTestingSavepoint();
    +		final Path savepointPath = Paths.get(externalPointer);
    +
    +		assertThat(Files.exists(savepointPath), is(true));
    +
    +		dispatcherGateway.disposeSavepoint(externalPointer.toString(), TIMEOUT).get();
    +
    +		assertThat(Files.exists(savepointPath), is(false));
    +	}
    +
    +	@Nonnull
    +	public URI createTestingSavepoint() throws IOException, URISyntaxException {
    --- End diff --
    
    make private?


---

[GitHub] flink pull request #5764: [FLINK-8940] [flip6] Add support for dispose savep...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5764#discussion_r177320500
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java ---
    @@ -534,6 +534,18 @@ public void start() throws Exception {
     		}
     	}
     
    +	public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath) {
    --- End diff --
    
    Will correct it.


---

[GitHub] flink pull request #5764: [FLINK-8940] [flip6] Add support for dispose savep...

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5764#discussion_r177082615
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/savepoints/SavepointDisposalRequest.java ---
    @@ -0,0 +1,47 @@
    +/*
    + * 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.rest.messages.job.savepoints;
    +
    +import org.apache.flink.runtime.rest.messages.RequestBody;
    +
    +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
    +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
    +
    +import javax.annotation.Nonnull;
    +
    +/**
    + * Request body for a savepoint disposal call.
    + */
    +public class SavepointDisposalRequest implements RequestBody {
    +
    +	private static final String FIELD_NAME_SAVEPOINT_PATH = "savepoint-path";
    +
    +	@JsonProperty(FIELD_NAME_SAVEPOINT_PATH)
    +	private final String savepointPath;
    +
    +	@JsonCreator
    +	public SavepointDisposalRequest(
    +		@JsonProperty(FIELD_NAME_SAVEPOINT_PATH) @Nonnull String savepointPath) {
    +		this.savepointPath = savepointPath;
    +	}
    +
    +	public String getSavepointPath() {
    --- End diff --
    
    I would generally recommend annotating this method with `@JsonIgnore`. Getters that are not annotaed can interfere with the `@JsonProperty` annotation.


---

[GitHub] flink issue #5764: [FLINK-8940] [flip6] Add support for dispose savepoint

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the issue:

    https://github.com/apache/flink/pull/5764
  
    Thanks for the review @zentol. Addressed your comments. Merging this PR.


---