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: add node roles to del dag #28155

Merged
merged 2 commits into from
Jan 31, 2025
Merged

feat: add node roles to del dag #28155

merged 2 commits into from
Jan 31, 2025

Conversation

fuziontech
Copy link
Member

Problem

We have Node roles now, let's use them to target where we are running certain queries in delete dag

Changes

added a few functions I'm sure greptile will see 👀

👉 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 enhances ClickHouse cluster operations by introducing node role-based query execution in the deletion DAG system.

  • Added any_host_by_role method in /posthog/clickhouse/cluster.py to execute operations on specific node types
  • Modified /dags/deletes.py to target worker nodes specifically for deletion operations using map_hosts_by_role
  • Potential edge case in any_host_by_role where it may raise StopIteration if no host matches the specified role
  • Added role-based filtering in map_hosts_by_role with host.host_cluster_role == node_role.value.lower()
  • Improved deletion workflow by ensuring operations run only on appropriate worker nodes rather than all cluster nodes

2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

posthog/clickhouse/cluster.py Outdated Show resolved Hide resolved
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@fuziontech fuziontech enabled auto-merge (squash) January 31, 2025 18:15
@fuziontech fuziontech merged commit 5d6ab53 into master Jan 31, 2025
92 checks passed
@fuziontech fuziontech deleted the use_node_roles_del_dag branch January 31, 2025 19:05
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.

3 participants