db: Add project_id to EventTag queries and deletes#6549
db: Add project_id to EventTag queries and deletes#6549bretthoerner wants to merge 1 commit intomasterfrom
Conversation
| {'event_id__in': [i.id for i in instance_list]}, | ||
| { | ||
| 'event_id__in': [i.id for i in instance_list], | ||
| 'project_id__in': { |
There was a problem hiding this comment.
master_1 | ERROR: cannot run DELETE command which targets multiple shards
master_1 | HINT: Consider using an equality filter on partition column "project_id" to target a single shard. If you'd like to run a multi-shard operation, use master_modify_multiple_shards().
master_1 | STATEMENT: DELETE FROM "sentry_eventtag" WHERE "id" IN (2)
Can't do IN across shards either. Deletion code will have to be refactored to allow for one query per project_id. Which sucks, because I think when we delete groups we're just iterating by date? So the project constantly varies. Will be a large refactor I think to get that correct/fast.
Other option: https://docs.citusdata.com/en/v7.0/reference/user_defined_functions.html#master-modify-multiple-shards
mattrobenolt
left a comment
There was a problem hiding this comment.
Let's hold off on this. If we end up needing to do anything Citus specific, we can do this in backend.
mattrobenolt
left a comment
There was a problem hiding this comment.
Let's punt on this now. Or at least revisit later. Since we can do DELETEs unqualified just fine. If anything, we just should address the SELECT queries.
SELECTside helps Citus, so it doesn't hit all shards.DELETEside is required or Citus throws and error.