Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-5163] Ports the production functions to the new state abstraction. #2871

Closed
wants to merge 4 commits into from

Conversation

kl0u
Copy link
Contributor

@kl0u kl0u commented Nov 25, 2016

This includes the following functions:

  1. StatefulSequenceSource
  2. MessageAcknowledgingSourceBase
  3. FromElementsFunction
  4. ContinuousFileMonitoringFunction

Each of them is a separate commit, for ease of reviewing.
Most of the functions assume parallelism of 1. The only exception is the StatefulSequenceSource.

R @aljoscha

Copy link
Contributor

@aljoscha aljoscha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, very good set of commits! 👍

I had some style comments (about the state descriptor), feel free to ignore these. We should have a minimal checkpoint/restore test for the StatefulSequenceSource, though. Could call it StatefulSequenceSourceTest. These tests in SourceFunctionTest seem a bit weird/minimal.


private static final long serialVersionUID = 1L;

private static final Logger LOG = LoggerFactory.getLogger(ContinuousFileMonitoringFunction.class);

private static final String FILE_MONITORING_STATE_NAME = "file-monitoring-state";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this you could also have

private static final ListStateDescriptor<Long> STATE_DESCRIPTOR =
    new ListStateDescriptor<>("file-monitoring-state", LongSerializer.INSTANCE);

and then use this descriptor later directly instead of initialising with this field.

That's just a personal style nitpick. Your version is also fine. 😃

@@ -62,6 +73,9 @@
/** Flag to make the source cancelable */
private volatile boolean isRunning = true;

private transient ListState<Integer> checkpointedState;

private static final String FROM_ELEMENT_STATE_NAME = "from-element-state";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this you could also have

private static final ListStateDescriptor<Integer> STATE_DESCRIPTOR =
    new ListStateDescriptor<>("from-elements-state", IntSerializer.INSTANCE);

and then use this descriptor later directly instead of initialising with this field.

That's just a personal style nitpick. Your version is also fine. 😃

private volatile boolean isRunning = true;

private transient Deque<Long> valuesToEmit;

private static final String STATEFUL_SOURCE_STATE = "stateful-source-state";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this you could also have

private static final ListStateDescriptor<Long> STATE_DESCRIPTOR =
    new ListStateDescriptor<>("stateful-source-state", LongSerializer.INSTANCE);

and then use this descriptor later directly instead of initialising with this field.

That's just a personal style nitpick. Your version is also fine. 😃

@@ -52,12 +52,4 @@ public void fromCollectionTest() throws Exception {
Arrays.asList(1, 2, 3))));
assertEquals(expectedList, actualList);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to have a snapshot/restore test for this source, verifying that we see all the expected elements (no matter the order).


private static final long serialVersionUID = -8689291992192955579L;

private static final Logger LOG = LoggerFactory.getLogger(MessageAcknowledgingSourceBase.class);

private static final String MESSAGE_ACKNOWLEDGING_SOURCE_STATE = "message-acknowledging-source-state";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments on the other functions, I'm not writing it again ... 😉


this.interval = interval;
this.watchType = watchType;
this.readerParallelism = Math.max(readerParallelism, 1);
this.globalModificationTime = Long.MIN_VALUE;
}

public long getGlobalModificationTime() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably have @VisibleForTesting.

@aljoscha
Copy link
Contributor

@kl0u Looks even better now! 👍

I'm running a last time on travis and them I'm merging.

@kl0u
Copy link
Contributor Author

kl0u commented Dec 12, 2016

@aljoscha Thanks a lot for the review!

@aljoscha
Copy link
Contributor

I merged this, could you please close the PR and the issue?

Thanks for your work. 👍

@kl0u
Copy link
Contributor Author

kl0u commented Dec 13, 2016

@aljoscha Yes thanks a lot!

@kl0u kl0u closed this Dec 13, 2016
@kl0u kl0u deleted the dop1-source-rescaling branch March 15, 2017 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants