Setup recorder model relationships to avoid calling flush#40467
Merged
balloob merged 2 commits intohome-assistant:devfrom Sep 30, 2020
Merged
Setup recorder model relationships to avoid calling flush#40467balloob merged 2 commits intohome-assistant:devfrom
balloob merged 2 commits intohome-assistant:devfrom
Conversation
Member
Author
|
Opened #40468 for the flapping logbook test |
This was referenced Sep 22, 2020
When old_state_id was added, flush was now done after each state changed event. This turned out to be more expensive than expected and can be avoided with relationships.
6e88c79 to
6ec00db
Compare
balloob
approved these changes
Sep 30, 2020
Bre77
pushed a commit
to Bre77/core
that referenced
this pull request
Oct 1, 2020
21 tasks
This was referenced Nov 21, 2020
Closed
bdraco
added a commit
that referenced
this pull request
Nov 28, 2020
…t from under the recorder (#43610) * MariaDB doesn't purge #42402 This addresses #42402 Relationships within table "states" and between tables "states" and "events " #40467 prevent the purge from working correctly. The database increases w/o any purge. This proposal sets related indices to NULL and permits deleting of rows. Further explanations can be found here #42402 This proposal also allows to purge the tables "events" and "states" in any order. * Update models.py Corrected for Black style requirements * Update homeassistant/components/recorder/models.py Co-authored-by: J. Nick Koston <nick@koston.org> * Add the options to foreign key constraints * purge old states when database gets deleted out from under us * pylint Co-authored-by: J. Nick Koston <nick@koston.org>
rccoleman
pushed a commit
to rccoleman/core
that referenced
this pull request
Dec 4, 2020
…t from under the recorder (home-assistant#43610) * MariaDB doesn't purge home-assistant#42402 This addresses home-assistant#42402 Relationships within table "states" and between tables "states" and "events " home-assistant#40467 prevent the purge from working correctly. The database increases w/o any purge. This proposal sets related indices to NULL and permits deleting of rows. Further explanations can be found here home-assistant#42402 This proposal also allows to purge the tables "events" and "states" in any order. * Update models.py Corrected for Black style requirements * Update homeassistant/components/recorder/models.py Co-authored-by: J. Nick Koston <nick@koston.org> * Add the options to foreign key constraints * purge old states when database gets deleted out from under us * pylint Co-authored-by: J. Nick Koston <nick@koston.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
Setup recorder model relationships to avoid calling flush
When old_state_id was added, flush was now done after each
state changed event. This turned out to be more expensive
than expected and can be avoided with relationships.
In the
py-spyprovided in #40292 the two flames on the leftare calls to
flushType of change
Example entry for
configuration.yaml:# Example configuration.yamlAdditional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: