Skip to content

[BEAM-2022] fix triggering for processing time timers#2782

Merged
asfgit merged 1 commit intoapache:masterfrom
tweise:BEAM-2022-processingTimeTimers
Apr 30, 2017
Merged

[BEAM-2022] fix triggering for processing time timers#2782
asfgit merged 1 commit intoapache:masterfrom
tweise:BEAM-2022-processingTimeTimers

Conversation

@tweise
Copy link
Contributor

@tweise tweise commented Apr 29, 2017

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

  • Make sure the PR title is formatted like:
    [BEAM-<Jira issue #>] Description of pull request
  • Make sure tests pass via mvn clean verify. (Even better, enable
    Travis-CI on your fork and ensure the whole test matrix passes).
  • Replace <Jira issue #> in the title with the actual Jira issue
    number, if there is one.
  • If this contribution is large, please file an Apache
    Individual Contributor License Agreement.

R: @kennknowles

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 69.698% when pulling eb86038 on tweise:BEAM-2022-processingTimeTimers into 47821ad on apache:master.

Copy link
Member

@kennknowles kennknowles left a comment

Choose a reason for hiding this comment

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

LGTM. Added a couple questions but feel free to merge, or I will when I have another minute.

}

@VisibleForTesting
protected TimerSet getTimerSet(TimeDomain domain) {
Copy link
Member

Choose a reason for hiding this comment

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

In a quick pass, I don't see this protected being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is required for the unit test. It could be package scope, but it cannot be private.

ComparisonChain chain =
ComparisonChain.start().compare(timerData.getTimerId(), timerId);
if (chain.result() == 0 && !timerData.getNamespace().equals(namespace)) {
// Obtaining the stringKey may be expensive; only do so if required
Copy link
Member

@kennknowles kennknowles Apr 29, 2017

Choose a reason for hiding this comment

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

The StateNamespace is supposed to do equals and hashCode right so that you only need to obtain the stringKey() for serialization purposes. So here I think you should just compare them directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Well, hmm. I guess keep it that way since there is probably some context for it. Perhaps it was a workaround for BEAM-1022 that was recently fixed.

@tweise
Copy link
Contributor Author

tweise commented Apr 29, 2017

@kennknowles once this is merged and we have the internal timers in shape, any thoughts on what it takes to address BEAM-1114 (perhaps as comment on that JIRA) ?

@kennknowles
Copy link
Member

I commented on the JIRA.

@asfgit asfgit merged commit eb86038 into apache:master Apr 30, 2017
processElement(t.getValue());
} catch (Exception e) {
Throwables.propagateIfPossible(e);
Throwables.throwIfUnchecked(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can 'throw new RuntimeException' be folded into throwIfUnchecked(e) ?
That way, code is simplified on the caller side.

private void processWatermark(ApexStreamTuple.WatermarkTuple<?> mark) {
this.inputWatermark = new Instant(mark.getTimestamp());
timerInternals.fireReadyTimers(this.inputWatermark.getMillis(),
this, TimeDomain.EVENT_TIME);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be TimeDomain.PROCESSING_TIME ?

if (timersForKey != null) {
try {
Slice timerBytes = new Slice(CoderUtils.encodeToByteArray(timerDataCoder, timerKey));
timersForKey.add(timerBytes);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why call remove() after add() ?
Looks like add() call can be omitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants