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

fix for reassign Table Keys faust-streaming#171 #174

Merged
merged 3 commits into from
Jul 23, 2021

Conversation

PJ-Schulz
Copy link
Contributor

Description

(Fixes #171)
When a key is removed from a table with table.pop(), a changelog entry is sent with a raw null value.

Before this change, on Table recovery, once a key was set to the raw null value, it would be deleted after iterating over the entire Changelog topic.
Now, before deletion, the value for this key is checked to see if it is really null. Otherwise it was assigned to a new value at a later time and will not be deleted

@@ -31,7 +31,9 @@ def apply_changelog_batch(
self._create_batch_iterator(to_delete.add, to_key, to_value, batch)
)
for key in to_delete:
delete_key(key, None)
# If the key was assigned a value again at a later time, it will not be deleted.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add a quick unit test to test this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added a test for this case. Until now there was no test for this use case.

@@ -31,7 +31,9 @@ def apply_changelog_batch(
self._create_batch_iterator(to_delete.add, to_key, to_value, batch)
)
for key in to_delete:
delete_key(key, None)
# If the key was assigned a value again at a later time, it will not be deleted.
if not self.data[key]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this an issue only for memory store? Rocksdb store does not have this issue AFAIK

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue is only for memory. When I look into the code for Rocksdb I don't recongnize that there can be the same error

@patkivikram patkivikram merged commit c1a6b0e into faust-streaming:master Jul 23, 2021
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.

Table Recovery deletes newly assigned keys
2 participants