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

feat: make delete dag dependent on current most recent squash job results #28243

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

fuziontech
Copy link
Member

@fuziontech fuziontech commented Feb 3, 2025

Problem

The delete job is quite dependent on the current state of the world of person overrides squashing

Changes

This makes the delete job dependent on the min _timestamp seen in person overrides table so that we only delete person events that have been squashed.

We do this by having a starting op that grabs the high watermark for person overrides and only deletes events before that.

image

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR modifies the person event deletion process to ensure it only processes events that have been properly squashed by the person overrides job.

  • Added get_oldest_person_override_timestamp operation in /dags/deletes.py to establish a high watermark for deletions
  • Modified squash_person_overrides job in /dags/person_overrides.py to pass timestamp through new pass_the_torch operation
  • Increased ClickHouse client timeout to 24 hours and added strict mutation sync settings in ClickhouseClusterResource
  • Added UUID-based ZooKeeper paths for table replication to prevent conflicts
  • Added comprehensive test coverage in /dags/tests/test_deletes.py to validate the new timestamp-dependent behavior

3 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile

dags/person_overrides.py Outdated Show resolved Hide resolved
dags/tests/test_deletes.py Show resolved Hide resolved
dags/tests/test_deletes.py Show resolved Hide resolved
dags/tests/test_deletes.py Outdated Show resolved Hide resolved
Comment on lines +276 to +278
query = f"""
SELECT min(_timestamp) FROM {PERSON_DISTINCT_ID_OVERRIDES_TABLE}
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: query could return NULL if table is empty, which would cause a runtime error when unpacking result

dags/deletes.py Outdated Show resolved Hide resolved
@fuziontech fuziontech requested a review from a team February 3, 2025 22:44
dags/deletes.py Outdated Show resolved Hide resolved
oops!

Co-authored-by: ted kaemming <[email protected]>
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.

2 participants