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

KAFKA-8007: Avoid copying on fetch in InMemoryWindowStore #6335

Merged
merged 5 commits into from
Mar 6, 2019

Conversation

ableegoldman
Copy link
Contributor

Rewrote the InMemoryWindowStore implementation by moving the work of a fetch to the iterator, and cleaned up the iterators as well.

Blocked by KAFKA-7918

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@ableegoldman
Copy link
Contributor Author

@ableegoldman
Copy link
Contributor Author

WIP planning to flesh out the unit tests given the increased complexity of the iterators, also looking into microbenchmarks to get a sense of the potential improvement here.

@mjsax mjsax added the streams label Feb 27, 2019
@guozhangwang
Copy link
Contributor

@ableegoldman is this ready to review now or is still WIP? If yes please feel free to edit the title to include WIP or DO NOT MERGE (you can always edit it back once ready), e.g. #3720

@ableegoldman
Copy link
Contributor Author

Waiting for #6328 to be merged so I can rebase for cleaner review, but yes it is ready

@ableegoldman
Copy link
Contributor Author

Call for review @guozhangwang @mjsax @vvcephei @bbejeck

@guozhangwang
Copy link
Contributor

@ableegoldman could you rebase the PR?

@ableegoldman
Copy link
Contributor Author

Rebased (thanks for merging #6328)

Copy link
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

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

One minor comment, otherwise LGTM!

final Windowed<Bytes> windowedK = new Windowed<>(key, new TimeWindow(startTimestamp, startTimestamp + windowSize));
return new KeyValue<>(windowedK, value);
long minLiveTime = Math.max(0L, this.observedStreamTime - this.retentionPeriod + 1);
for (final InMemoryWindowStoreIteratorWrapper it : openIterators) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch!

InMemoryWindowStoreIteratorWrapper(final Bytes keyFrom,
final Bytes keyTo,
final Iterator<Map.Entry<Long, ConcurrentNavigableMap<Bytes, byte[]>>> segmentIterator) {
this.allKeys = keyFrom == null;
Copy link
Contributor

Choose a reason for hiding this comment

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

To be more strict, should this be keyFrom == null && keyTo == null? I know that today they either are both null or neither are null, but it is future-risk vulnerable if we ever change the apis to allow null values on one side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point, will update

Copy link
Contributor

@bbejeck bbejeck left a comment

Choose a reason for hiding this comment

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

Thanks, @ableegoldman LGTM

@bbejeck
Copy link
Contributor

bbejeck commented Mar 1, 2019

Java 11 failed kafka.api.SaslSslAdminClientIntegrationTest.testMinimumRequestTimeouts
Java 8 failed kafka.api.SaslSslAdminClientIntegrationTest.testMinimumRequestTimeouts

retest this please

@mjsax
Copy link
Member

mjsax commented Mar 5, 2019

Test result already deleted. Java8 failed. Java11 passed.

Retest this please.

@bbejeck
Copy link
Contributor

bbejeck commented Mar 6, 2019

Since #6328 is merged, I'm going to merge this one now as well.

@bbejeck bbejeck merged commit 4788863 into apache:trunk Mar 6, 2019
@bbejeck
Copy link
Contributor

bbejeck commented Mar 6, 2019

Merged #6335 to trunk

pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
Rewrote the InMemoryWindowStore implementation by moving the work of a fetch to the iterator, and cleaned up the iterators as well.

Reviewers: Guozhang Wang <wangguoz@gmail.com>, Bill Bejeck <bbejeck@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants