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

[GitHub] flink pull request #5679: [FLINK-8916] Checkpointing Mode is always shown to...

GitHub user yanghua opened a pull request:

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

    [FLINK-8916] Checkpointing Mode is always shown to be "At Least Once" in Web UI

    ## What is the purpose of the change
    
    *This pull request add a customized serializer for checkpoint processing mode to support the Web UI's Presentation. *
    
    
    ## Brief change log
    
      - *Add a customized serializer for checkpoint processing mode*
    
    ## Verifying this change
    
    This change is already covered by existing tests*.
    
    ## Does this pull request potentially affect one of the following parts:
    
      - Dependencies (does it add or upgrade a dependency): (yes / **no**)
      - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
      - The serializers: (yes / **no** / don't know)
      - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
      - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
      - The S3 file system connector: (yes / **no** / don't know)
    
    ## Documentation
    
      - Does this pull request introduce a new feature? (yes / **no**)
      - If yes, how is the feature documented? (not applicable / docs / JavaDocs / **not documented**)


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

    $ git pull https://github.com/yanghua/flink FLINK-8916

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

    https://github.com/apache/flink/pull/5679.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 #5679
    
----
commit ff1370e7727d4c6e58f0ab249dcf58bff076c480
Author: yanghua <ya...@...>
Date:   2018-03-12T04:12:56Z

    [FLINK-8916] Checkpointing Mode is always shown to be "At Least Once" in Web UI

----


---

[GitHub] flink issue #5679: [FLINK-8916] Checkpointing Mode is always shown to be "At...

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

    https://github.com/apache/flink/pull/5679
  
    @zentol thank you for suggestion, please review again.


---

[GitHub] flink pull request #5679: [FLINK-8916] Checkpointing Mode is always shown to...

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

    https://github.com/apache/flink/pull/5679#discussion_r173742203
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/checkpoints/CheckpointConfigInfo.java ---
    @@ -143,10 +152,66 @@ public int hashCode() {
     	}
     
     	/**
    -	 * Processing mode.
    +	 * JSON serializer for {@link ProcessingMode}.
     	 */
    +	@JsonSerialize(using = ProcessingModeSerializer.class)
    +	@JsonDeserialize(using = ProcessingModeDeserializer.class)
     	public enum ProcessingMode {
    -		AT_LEAST_ONCE,
    -		EXACTLY_ONCE
    +		AT_LEAST_ONCE("at_least_once"),
    +		EXACTLY_ONCE("exactly_once");
    +
    +		private String value;
    +
    +		ProcessingMode(String value) {
    +			this.value = value;
    +		}
    +
    +		public String getValue() {
    +			return value;
    +		}
    +
    +		public static ProcessingMode fromString(String value) {
    --- End diff --
    
    these changes to the enum seem unnecessary


---

[GitHub] flink pull request #5679: [FLINK-8916] Checkpointing Mode is always shown to...

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

    https://github.com/apache/flink/pull/5679#discussion_r173741952
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/checkpoints/CheckpointConfigInfo.java ---
    @@ -143,10 +152,66 @@ public int hashCode() {
     	}
     
     	/**
    -	 * Processing mode.
    +	 * JSON serializer for {@link ProcessingMode}.
     	 */
    +	@JsonSerialize(using = ProcessingModeSerializer.class)
    +	@JsonDeserialize(using = ProcessingModeDeserializer.class)
     	public enum ProcessingMode {
    -		AT_LEAST_ONCE,
    -		EXACTLY_ONCE
    +		AT_LEAST_ONCE("at_least_once"),
    +		EXACTLY_ONCE("exactly_once");
    +
    +		private String value;
    +
    +		ProcessingMode(String value) {
    +			this.value = value;
    +		}
    +
    +		public String getValue() {
    +			return value;
    +		}
    +
    +		public static ProcessingMode fromString(String value) {
    +			for (ProcessingMode mode : ProcessingMode.values()) {
    +				if (mode.value.equalsIgnoreCase(value)) {
    +					return mode;
    +				}
    +			}
    +
    +			throw new IllegalArgumentException("No constant with value " + value + " found");
    +		}
    +
    +	}
    +
    +	/**
    +	 * JSON deserializer for {@link ProcessingMode}.
    +	 */
    +	public static class ProcessingModeSerializer extends StdSerializer<ProcessingMode> {
    +
    +		public ProcessingModeSerializer() {
    +			super(ProcessingMode.class);
    +		}
    +
    +		@Override
    +		public void serialize(ProcessingMode mode, JsonGenerator generator, SerializerProvider serializerProvider)
    +			throws IOException {
    +			generator.writeString(mode.getValue());
    --- End diff --
    
    replace with `generator.writeString(mode.name().toLowerCase())`


---

[GitHub] flink pull request #5679: [FLINK-8916] Checkpointing Mode is always shown to...

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

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


---

[GitHub] flink issue #5679: [FLINK-8916] Checkpointing Mode is always shown to be "At...

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

    https://github.com/apache/flink/pull/5679
  
    merging.


---

[GitHub] flink pull request #5679: [FLINK-8916] Checkpointing Mode is always shown to...

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

    https://github.com/apache/flink/pull/5679#discussion_r173742094
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/checkpoints/CheckpointConfigInfo.java ---
    @@ -143,10 +152,66 @@ public int hashCode() {
     	}
     
     	/**
    -	 * Processing mode.
    +	 * JSON serializer for {@link ProcessingMode}.
     	 */
    +	@JsonSerialize(using = ProcessingModeSerializer.class)
    +	@JsonDeserialize(using = ProcessingModeDeserializer.class)
     	public enum ProcessingMode {
    -		AT_LEAST_ONCE,
    -		EXACTLY_ONCE
    +		AT_LEAST_ONCE("at_least_once"),
    +		EXACTLY_ONCE("exactly_once");
    +
    +		private String value;
    +
    +		ProcessingMode(String value) {
    +			this.value = value;
    +		}
    +
    +		public String getValue() {
    +			return value;
    +		}
    +
    +		public static ProcessingMode fromString(String value) {
    +			for (ProcessingMode mode : ProcessingMode.values()) {
    +				if (mode.value.equalsIgnoreCase(value)) {
    +					return mode;
    +				}
    +			}
    +
    +			throw new IllegalArgumentException("No constant with value " + value + " found");
    +		}
    +
    +	}
    +
    +	/**
    +	 * JSON deserializer for {@link ProcessingMode}.
    +	 */
    +	public static class ProcessingModeSerializer extends StdSerializer<ProcessingMode> {
    +
    +		public ProcessingModeSerializer() {
    +			super(ProcessingMode.class);
    +		}
    +
    +		@Override
    +		public void serialize(ProcessingMode mode, JsonGenerator generator, SerializerProvider serializerProvider)
    +			throws IOException {
    +			generator.writeString(mode.getValue());
    +		}
     	}
    +
    +	/**
    +	 * Processing mode deserializer.
    +	 */
    +	public static class ProcessingModeDeserializer extends StdDeserializer<ProcessingMode> {
    +
    +		public ProcessingModeDeserializer() {
    +			super(ProcessingMode.class);
    +		}
    +
    +		@Override
    +		public ProcessingMode deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
    +			throws IOException {
    +			return ProcessingMode.fromString(jsonParser.getValueAsString());
    --- End diff --
    
    replace with `ProcessingMode.valueOf(jsonParser.getValueAsString.toUpperCase())`


---