Skip to content

Fix purge with MariaDB / MySQL#11713

Merged
balloob merged 1 commit into
home-assistant:devfrom
tinloaf:fix_recorder
Jan 16, 2018
Merged

Fix purge with MariaDB / MySQL#11713
balloob merged 1 commit into
home-assistant:devfrom
tinloaf:fix_recorder

Conversation

@tinloaf
Copy link
Copy Markdown
Contributor

@tinloaf tinloaf commented Jan 16, 2018

Description:

Since #11039 (i.e., since 0.61), the recorder does not work for users of MariaDB / MySQL, because they behave strangely regarding subqueries (see also this thread: [0]).

This PR fixes this by completely removing subqueries. Instead, the IDs of protected states / events are passed via the SQL query. This might slow down purges a bit for systems which have seen a lot of different entity IDs.

I don't intend for this to be a permanent solution. I'll try to come up with something more efficient that also works with MariaDB and MySQL, but that will require more testing, and I'd like to fix this as quickly as possible.

[0] https://groups.google.com/forum/#!topic/sqlalchemy/T-X9gxuoqA8

Related issue (if applicable): fixes #11559

Checklist:

  • The code change is tested and works locally.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass

@tinloaf tinloaf closed this Jan 16, 2018
@tinloaf tinloaf reopened this Jan 16, 2018
@balloob
Copy link
Copy Markdown
Member

balloob commented Jan 16, 2018

Ran tests locally, all good 👍

@balloob balloob merged commit 5a26d4c into home-assistant:dev Jan 16, 2018
balloob pushed a commit that referenced this pull request Jan 16, 2018
@balloob balloob mentioned this pull request Jan 16, 2018
@home-assistant home-assistant locked and limited conversation to collaborators May 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recorder Query Errors

4 participants