-
Notifications
You must be signed in to change notification settings - Fork 76
Fix key deserialization propagation in windows #848
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bb17d36
Fix type hinting in expire_by_key
gwaramadze 1e8387a
Fix sliding windows
gwaramadze 1bd3c92
Fix tumbling/hopping windows with partition closing strategy
gwaramadze 8804957
Do not return key from expire_windows as it is not needed
gwaramadze 39a4395
Add explanation
gwaramadze fb1045b
Correct tests
gwaramadze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,8 +78,8 @@ def test_expire_windows_expired(self, windowed_rocksdb_store_factory, delete): | |
|
||
assert len(expired) == 2 | ||
assert expired == [ | ||
((0, 10), 1, [], prefix), | ||
((10, 20), 2, [], prefix), | ||
((0, 10), 1, []), | ||
((10, 20), 2, []), | ||
] | ||
|
||
with store.start_partition_transaction(0) as tx: | ||
|
@@ -131,8 +131,8 @@ def test_expire_windows_cached(self, windowed_rocksdb_store_factory, delete): | |
) | ||
assert len(expired) == 2 | ||
assert expired == [ | ||
((0, 10), 1, [], prefix), | ||
((10, 20), 2, [], prefix), | ||
((0, 10), 1, []), | ||
((10, 20), 2, []), | ||
] | ||
assert ( | ||
tx.get_window(start_ms=0, end_ms=10, prefix=prefix) == None | ||
|
@@ -193,7 +193,7 @@ def test_expire_windows_with_grace_expired(self, windowed_rocksdb_store_factory) | |
) | ||
|
||
assert len(expired) == 1 | ||
assert expired == [((0, 10), 1, [], prefix)] | ||
assert expired == [((0, 10), 1, [])] | ||
|
||
def test_expire_windows_with_grace_empty(self, windowed_rocksdb_store_factory): | ||
store = windowed_rocksdb_store_factory() | ||
|
@@ -328,9 +328,9 @@ def test_expire_windows_multiple_windows(self, windowed_rocksdb_store_factory): | |
) | ||
|
||
assert len(expired) == 3 | ||
assert expired[0] == ((0, 10), 1, [], prefix) | ||
assert expired[1] == ((10, 20), 1, [], prefix) | ||
assert expired[2] == ((20, 30), 1, [], prefix) | ||
Comment on lines
-331
to
-333
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was kinda testing that the same prefix is returned :) |
||
assert expired[0] == ((0, 10), 1, []) | ||
assert expired[1] == ((10, 20), 1, []) | ||
assert expired[2] == ((20, 30), 1, []) | ||
|
||
def test_get_latest_timestamp_update(self, windowed_rocksdb_store_factory): | ||
store = windowed_rocksdb_store_factory() | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we store an indicator about the prefix type, if it's a byte or something else ?
For migration, existing windows missing that information can try to deserialize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it's considerably more code, not sure if it's worth it.
Let's see what @daniil-quix thinks. But even if we decide to do this, it may be done as a separate optimisation; in the meantime, this will fix the bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm mostly worried about the performance hit of trying to deserialise every keys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some quick tests locally, and the performance hit actually depends on the value itself.
Two almost identical values
b'123123'
andb'{123123
take very different amounts of time: