-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix(hybrid-cloud): Adds support for cross database tombstones #69480
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(hybrid-cloud): Adds support for cross database tombstones #69480
Conversation
dce5a74
to
f1835b9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #69480 +/- ##
=======================================
Coverage 79.84% 79.84%
=======================================
Files 6466 6466
Lines 287413 287435 +22
Branches 49535 49538 +3
=======================================
+ Hits 229483 229507 +24
+ Misses 57508 57506 -2
Partials 422 422
|
0f318b8
to
5658dfa
Compare
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.
Looks correct to me.
watermark_batch: WatermarkBatch, | ||
) -> tuple[list[int], datetime.datetime]: | ||
""" | ||
Queries the database or databases if spanning multiple), and returns |
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.
Queries the database or databases if spanning multiple), and returns | |
Queries the database or databases if spanning multiple, and returns |
[cascade_data[0]["monitor"].id, cascade_data[1]["monitor"].id], | ||
), | ||
( | ||
{"low": in_order_tombstones[1].id, "up": in_order_tombstones[2].id}, | ||
[cascade_data[2]["monitor"].id], |
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.
If cascade_data
has four sets of data in it, and all four users were deleted why are only three monitors being deleted?
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.
Oh that's a good point, let me fix this to span 3 instead. I'll also add a case that tests that the full set is deleted if the watermark low is set to -1
5658dfa
to
0b6ecdc
Compare
Some manual testing notes:
Going to merge this change tomorrow now that the tombstone behavior has been tested. |
PR reverted: 6e7147f |
Adds cross-database tombstone deletion support
The current tombstone code performs a join between the model and
tombstone tables to construct a minimal set of IDs to update or delete
from the target table.
Because this isn't possible when the target model lives in a different
database (e.g. crons monitors), we have to take a 2 step approach:
watermarking batch.
target field
There are possible performance concerns with the model-side query, so
I've placed this behind a new option named
hyrid_cloud.allow_cross_db_tombstones
. If the flag is disabled and across db tombstone cleanup is attempted, an explicit exception is raised
noting why the cleanup failed.