Skip to content

Commit

Permalink
remove MAX_QUERY_SIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech committed Jul 26, 2024
1 parent 9288951 commit 7431a1e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
3 changes: 0 additions & 3 deletions posthog/models/async_deletion/async_deletion.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from django.db import models


MAX_QUERY_SIZE = 2_621_440


class DeletionType(models.IntegerChoices):
Team = 0
Person = 1
Expand Down
6 changes: 3 additions & 3 deletions posthog/models/async_deletion/delete_cohorts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any

from posthog.client import sync_execute
from posthog.models.async_deletion import AsyncDeletion, DeletionType, MAX_QUERY_SIZE
from posthog.models.async_deletion import AsyncDeletion, DeletionType
from posthog.models.async_deletion.delete import AsyncDeletionProcess, logger


Expand Down Expand Up @@ -29,7 +29,7 @@ def process(self, deletions: list[AsyncDeletion]):
WHERE {" OR ".join(conditions)}
""",
args,
settings={"max_query_size": MAX_QUERY_SIZE},
settings={},
)

def _verify_by_group(self, deletion_type: int, async_deletions: list[AsyncDeletion]) -> list[AsyncDeletion]:
Expand All @@ -50,7 +50,7 @@ def _verify_by_column(self, distinct_columns: str, async_deletions: list[AsyncDe
WHERE {" OR ".join(conditions)}
""",
args,
settings={"max_query_size": MAX_QUERY_SIZE},
settings={},
)
return {tuple(row) for row in clickhouse_result}

Expand Down
10 changes: 5 additions & 5 deletions posthog/models/async_deletion/delete_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from prometheus_client import Counter

from posthog.client import sync_execute
from posthog.models.async_deletion import AsyncDeletion, DeletionType, MAX_QUERY_SIZE
from posthog.models.async_deletion import AsyncDeletion, DeletionType
from posthog.models.async_deletion.delete import AsyncDeletionProcess, logger
from posthog.settings.data_stores import CLICKHOUSE_CLUSTER

Expand Down Expand Up @@ -66,7 +66,7 @@ def process(self, deletions: list[AsyncDeletion]):
WHERE {str_predicate}
""",
next_args,
settings={"max_query_size": MAX_QUERY_SIZE},
settings={},
)
# Reset the query predicate and predicate args
args = rest_args
Expand All @@ -80,7 +80,7 @@ def process(self, deletions: list[AsyncDeletion]):
WHERE {str_predicate}
""",
args,
settings={"max_query_size": MAX_QUERY_SIZE},
settings={},
)

# Team data needs to be deleted from other models as well, groups/persons handles deletions on a schema level
Expand All @@ -106,7 +106,7 @@ def process(self, deletions: list[AsyncDeletion]):
WHERE {" OR ".join(conditions)}
""",
args,
settings={"max_query_size": MAX_QUERY_SIZE},
settings={},
)

def _verify_by_group(self, deletion_type: int, async_deletions: list[AsyncDeletion]) -> list[AsyncDeletion]:
Expand All @@ -129,7 +129,7 @@ def _verify_by_column(self, distinct_columns: str, async_deletions: list[AsyncDe
WHERE {" OR ".join(conditions)}
""",
args,
settings={"max_query_size": MAX_QUERY_SIZE, "max_execution_time": 30 * 60},
settings={"max_execution_time": 30 * 60},
)
return {tuple(row) for row in clickhouse_result}

Expand Down
4 changes: 1 addition & 3 deletions posthog/models/async_deletion/delete_person.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from posthog.clickhouse.client import sync_execute

from posthog.models.async_deletion import MAX_QUERY_SIZE

from posthog.clickhouse.client.connection import Workload


def remove_deleted_person_data(mutations_sync=False):
settings = {"mutations_sync": 1 if mutations_sync else 0, "max_query_size": MAX_QUERY_SIZE}
settings = {"mutations_sync": 1 if mutations_sync else 0}
sync_execute(
"""
ALTER TABLE person
Expand Down

0 comments on commit 7431a1e

Please sign in to comment.