fix: Ensure hard-delete mode doesn't delete data it shouldn't when ACTIVATE_VERSION
messages are processed
#391
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.
What hard delete was previously doing wrong
As discussed in #340, hard delete deleted data that it shouldn't. This was caused by a
<=
where there should have been a<
.So why were the tests passing?
All ACTIVATE_VERSION messages were run before any records were synced. This is because RECORD messages were being batched until the end of the sync, whereas ACTIVATE_VERSION messages were processed as they arrived.
The intent of
test_activate_version_hard_delete
was to:Here's what was really happening:
My fix
I don't know if I fully understand the ACTIVATE_VERSION specification, so please correct me, but here's my change.
Drain the sink immediately before an ACTIVATE_VERSION message is processed for a sink. This means:
Closes #340