flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From StefanRRichter <...@git.apache.org>
Subject [GitHub] flink pull request #2648: [FLINK-4844] Partitionable Raw Keyed/Operator Stat...
Date Tue, 18 Oct 2016 10:13:27 GMT
Github user StefanRRichter commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2648#discussion_r83822468
  
    --- Diff: flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OneInputStreamOperatorTestHarness.java
---
    @@ -199,30 +228,56 @@ public Environment getEnvironment() {
     	}
     
     	/**
    -	 * Calls
    -	 * {@link org.apache.flink.streaming.api.operators.StreamOperator#setup(StreamTask,
StreamConfig, Output)} ()}
    +	 * Calls {@link org.apache.flink.streaming.api.operators.StreamOperator#setup(StreamTask,
StreamConfig, Output)} ()}
     	 */
     	public void setup() throws Exception {
     		operator.setup(mockTask, config, new MockOutput());
     		setupCalled = true;
     	}
     
     	/**
    -	 * Calls {@link org.apache.flink.streaming.api.operators.StreamOperator#open()}. This
also
    -	 * calls {@link org.apache.flink.streaming.api.operators.StreamOperator#setup(StreamTask,
StreamConfig, Output)}
    +	 * Calls {@link org.apache.flink.streaming.api.operators.StreamOperator#initializeState(OperatorStateHandles)}.
    +	 * Calls {@link org.apache.flink.streaming.api.operators.StreamOperator#setup(StreamTask,
StreamConfig, Output)}
     	 * if it was not called before.
     	 */
    -	public void open() throws Exception {
    +	public void initializeState(OperatorStateHandles operatorStateHandles) throws Exception
{
     		if (!setupCalled) {
     			setup();
     		}
    +		operator.initializeState(operatorStateHandles);
    +		initializeCalled = true;
    +	}
    +
    +	/**
    +	 * Calls {@link org.apache.flink.streaming.api.operators.StreamOperator#open()}.
    +	 * Calls {@link org.apache.flink.streaming.api.operators.StreamOperator#initializeState(OperatorStateHandles)}
if it
    +	 * was not called before.
    +	 */
    +	public void open() throws Exception {
    +		if (!initializeCalled) {
    +			initializeState(null);
    +		}
     		operator.open();
     	}
     
     	/**
     	 *
     	 */
    -	public StreamStateHandle snapshot(long checkpointId, long timestamp) throws Exception
{
    +	public SnapshotInProgressSubtaskState snapshot(long checkpointId, long timestamp) throws
Exception {
    --- End diff --
    
    I think the idea of having a single method is nice, and if there is no special reason
why we should keep the old signature, I suggest to do it the other way around. `OperatorSnapshotResult`is
already a container for all operator states (except the legacy state that will be removed
in the near future). Using this removed the need for the multiplexing.
    
    However, `OperatorSnapshotResult` does not contain the legacy state anymore, so for the
time being, we might return a Tuple2 of both, or some special container class which could
also strip away the `RunnableFuture` part.
    
    What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message