Skip to content

Conversation

@bretthoerner
Copy link
Contributor

SELECT side helps Citus, so it doesn't hit all shards.

DELETE side is required or Citus throws and error.

{'event_id__in': [i.id for i in instance_list]},
{
'event_id__in': [i.id for i in instance_list],
'project_id__in': {
Copy link
Contributor Author

@bretthoerner bretthoerner Nov 14, 2017

Choose a reason for hiding this comment

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

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

Copy link
Contributor

@mattrobenolt mattrobenolt left a comment

Choose a reason for hiding this comment

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

Let's hold off on this. If we end up needing to do anything Citus specific, we can do this in backend.

Copy link
Contributor

@mattrobenolt mattrobenolt left a comment

Choose a reason for hiding this comment

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

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants