Skip to content

KAFKA-4671: Fix Streams window retention policy#2401

Closed
mjsax wants to merge 4 commits intoapache:trunkfrom
mjsax:kafka-4671-window-retention-policy
Closed

KAFKA-4671: Fix Streams window retention policy#2401
mjsax wants to merge 4 commits intoapache:trunkfrom
mjsax:kafka-4671-window-retention-policy

Conversation

@mjsax
Copy link
Copy Markdown
Member

@mjsax mjsax commented Jan 18, 2017

No description provided.

@mjsax
Copy link
Copy Markdown
Member Author

mjsax commented Jan 18, 2017

Extracted code changes from #2337

@dguy @enothereska @guozhangwang

Should go into 0.10.2, too.

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 18, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/994/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 18, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/992/
Test PASSed (JDK 7 and Scala 2.10).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 18, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/992/
Test PASSed (JDK 8 and Scala 2.12).

Copy link
Copy Markdown
Contributor

@dguy dguy left a comment

Choose a reason for hiding this comment

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

Just a general comment on the test names. I see you change some test names in JoinWindowsTest to be more descriptive - thanks.
However, in the other tests, i.e., SessionWindowsTest, TimeWindowsTest etc, we still have non-descriptive test names. It is great that we have the tests, but it is much better if we can just read the test names and work out what it is doing. This is why i almost always start the name of a test with should. I.e, what should it do? I'm sorry to bang on about this, but i find it super useful and important. If the test names are descriptive then you can usually understand what a class does without having to read the code.


@Override
public final boolean equals(Object o) {
public Windows<Window> until(final long duration) throws IllegalArgumentException {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Change return type to JoinWindows (same for all other classed inheriting from Windows)

@mjsax
Copy link
Copy Markdown
Member Author

mjsax commented Jan 20, 2017

Updated this.
@dguy @enothereska @guozhangwang

rename test methods
@mjsax mjsax force-pushed the kafka-4671-window-retention-policy branch from a84369f to 9488b66 Compare January 20, 2017 00:06
@asfbot
Copy link
Copy Markdown

asfbot commented Jan 20, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1052/
Test FAILed (JDK 7 and Scala 2.10).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 20, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1054/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 20, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1052/
Test PASSed (JDK 8 and Scala 2.12).

@mjsax
Copy link
Copy Markdown
Member Author

mjsax commented Jan 20, 2017

test this please

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 20, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1056/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 20, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1056/
Test PASSed (JDK 7 and Scala 2.10).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 20, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1058/
Test PASSed (JDK 8 and Scala 2.11).

Copy link
Copy Markdown
Contributor

@dguy dguy left a comment

Choose a reason for hiding this comment

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

Thanks @mjsax LGTM

@enothereska
Copy link
Copy Markdown
Contributor

LGTM


private final long gapMs;
private long maintainDurationMs;
private final long gap;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not clear why removing Ms suffix?

public TimeWindows advanceBy(long interval) {
return new TimeWindows(this.size, interval);
public TimeWindows advanceBy(final long advance) {
if (!(0 < advance && advance <= size)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: if (advance <= 0 || advance > size)

static final long DEFAULT_MAINTAIN_DURATION = 24 * 60 * 60 * 1000L; // one day (if time is represented as ms)

private long maintainDurationMs;
private long maintainDuration;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto above.

public JoinWindows until(final long duration) throws IllegalArgumentException {
if (duration < size()) {
throw new IllegalArgumentException("Window retention time (duration) cannot be smaller than the window " +
"size.");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: this can be a single line.

@mjsax
Copy link
Copy Markdown
Member Author

mjsax commented Jan 23, 2017

@guozhangwang Updated.

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 23, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1101/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 23, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1099/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 23, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1099/
Test PASSed (JDK 7 and Scala 2.10).

@mjsax
Copy link
Copy Markdown
Member Author

mjsax commented Jan 23, 2017

@guozhangwang Updated all variables with Ms suffix.

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 23, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1114/
Test FAILed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 23, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1114/
Test PASSed (JDK 7 and Scala 2.10).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 23, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1116/
Test PASSed (JDK 8 and Scala 2.11).

@guozhangwang
Copy link
Copy Markdown
Contributor

retest this please

asfgit pushed a commit that referenced this pull request Jan 24, 2017
Author: Matthias J. Sax <matthias@confluent.io>

Reviewers: Damian Guy, Eno Thereska, Guozhang Wang

Closes #2401 from mjsax/kafka-4671-window-retention-policy

(cherry picked from commit 7998759)
Signed-off-by: Guozhang Wang <wangguoz@gmail.com>
@asfgit asfgit closed this in 7998759 Jan 24, 2017
@guozhangwang
Copy link
Copy Markdown
Contributor

LGTM. Merged to trunk and 0.10.2.

@mjsax mjsax deleted the kafka-4671-window-retention-policy branch January 24, 2017 00:48
@asfbot
Copy link
Copy Markdown

asfbot commented Jan 24, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1125/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 24, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1127/
Test FAILed (JDK 8 and Scala 2.11).

@asfbot
Copy link
Copy Markdown

asfbot commented Jan 24, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1125/
Test PASSed (JDK 7 and Scala 2.10).

soenkeliebau pushed a commit to soenkeliebau/kafka that referenced this pull request Feb 7, 2017
Author: Matthias J. Sax <matthias@confluent.io>

Reviewers: Damian Guy, Eno Thereska, Guozhang Wang

Closes apache#2401 from mjsax/kafka-4671-window-retention-policy
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