Skip to content

KAFKA-13785: [10/N][emit final] more unit test for session store and disable cache for emit final sliding window - #12370

Merged
guozhangwang merged 3 commits into
apache:trunkfrom
lihaosky:session-test-sw-disable-cache
Jul 12, 2022
Merged

KAFKA-13785: [10/N][emit final] more unit test for session store and disable cache for emit final sliding window#12370
guozhangwang merged 3 commits into
apache:trunkfrom
lihaosky:session-test-sw-disable-cache

Conversation

@lihaosky

Copy link
Copy Markdown
Contributor
  1. Added more unit test for RocksDBTimeOrderedSessionStore and RocksDBTimeOrderedSessionSegmentedBytesStore
  2. Disable cache for sliding window if emit strategy is ON_WINDOW_CLOSE

Committer Checklist (excluded from commit message)

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

@mjsax mjsax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall LGTM.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this call? I thought we only add tests in this PR? Is the feature not completed yet and we need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Want to make it explicit in case default is caching enabled. I can remove it if you think it's unnecessary.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe @guozhangwang can chime in?

I am happy both ways I guess, but we should keep it consistent if possible.

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.

We would only default at the Materialized level, so the if condition should be sufficient even if it's default to turn on caching, but nevertheless making it explicit seems fine.

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.

We would only default at the Materialized level, so the if condition should be sufficient even if it's default to turn on caching, but nevertheless making it explicit seems fine.

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.

Just wondering, since we are leveraging on the inherited abstract session bytes store test, are there any test cases below that can be moved there or even are duplicates?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For shouldRemoveExpired, the RocksDB version has different params for session window.

For shouldNotExpireFromOpenIterator, it's not supported in RocksDBSessionStore

For shouldMatchPositionAfterPut, the RocksDB version has different cast than InMemorySessionStore.

So we could put shouldRemoveExpired and shouldMatchPositionAfterPut in parent class and add different logic depending on store type. We can also leave it here. wdyt?

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.

Sounds great!

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.

This is for line 52 above: should we rename that function to a more meaningful one? maybe getParamStoreType?

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.

Could we also add a "miss" case for fetchSession here?

@guozhangwang

Copy link
Copy Markdown
Contributor

@lihaosky Thanks for your PR, I made a pass on it.

@lihaosky
lihaosky force-pushed the session-test-sw-disable-cache branch from 54d2cbe to 0229a14 Compare July 8, 2022 01:10
@guozhangwang

Copy link
Copy Markdown
Contributor

LGTM! I'm merging to trunk now.

@guozhangwang
guozhangwang merged commit b5d4fa7 into apache:trunk Jul 12, 2022
@lihaosky
lihaosky deleted the session-test-sw-disable-cache branch August 15, 2022 20:46
lihaosky added a commit to confluentinc/kafka that referenced this pull request Aug 18, 2022
…disable cache for emit final sliding window (apache#12370)

1. Added more unit test for RocksDBTimeOrderedSessionStore and RocksDBTimeOrderedSessionSegmentedBytesStore
2. Disable cache for sliding window if emit strategy is ON_WINDOW_CLOSE

Reviewers: Matthias J. Sax <matthias@confluent.io>, Guozhang Wang <wangguoz@gmail.com>
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.

3 participants