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

Purge tables in chunks to workaround galera limits #24

Merged
merged 1 commit into from
Oct 8, 2018

Conversation

rhafer
Copy link
Contributor

@rhafer rhafer commented Sep 26, 2018

Galera has limits around how many rows can be touched in single
transaction. This is also affects DELETE operations. So we need to limit
the deletes to a certain number of rows.

# DELETE ... LIMIT is MySQL specific and there is no way to
# express it in SQLalchemy other than using a raw query.
res = self.connection.execute(
'DELETE FROM `%s` LIMIT 10000' % table.name
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 10000? Isn't there a chance that user has it set to lower number by some config option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually the plan was to mark this WIP and adapt it to use the same chunksize as for the chunked writing passed in via parameter in (see #25 ).

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense

@rhafer rhafer added the WIP Work In Progress label Sep 27, 2018
@rhafer rhafer removed the WIP Work In Progress label Oct 5, 2018
Galera has limits around how many rows can be touched in single
transaction. This is also affects DELETE operations. So we need to limit
the deletes to a certain number of rows.
@rhafer rhafer merged commit 92e0821 into SUSE:master Oct 8, 2018
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.

None yet

2 participants