Angust
14 Kwiecień 2021 10:55
41
Ile masz rekordów w tabeli ?
jolka
14 Kwiecień 2021 18:50
42
Brawo za cierpliwość
W tej wersji też jest migracja bazy i dlatego tyle to trwa… niestety.
Problem jest znany i dobra wiadomość jest taka, że to się zmieni, migracja bazy nie będzie wstrzymywała startu systemu - poprawkę robi nasz ulubiony developer Nick Koston, to chyba jedyny programista który coś optymalizuje w temacie zapisu do bazy w ha.
Tu masz szczegóły, będzie w kolejnej wersji lepiej:
home-assistant:dev
← bdraco:live_db_migrations
opened 01:20AM - 11 Apr 21 UTC
<!--
You are amazing! Thanks for contributing to our project!
Please, DO N… OT DELETE ANY TEXT from this template! (unless instructed).
-->
## Breaking change
<!--
If your PR contains a breaking change for existing users, it is important
to tell them what breaks, how to make it work again and why we did this.
This piece of text is published with the release notes, so it helps if you
write it towards our users, not us.
Note: Remove this section if this PR is NOT a breaking change.
-->
Run database migrations in the background after started event
<img width="466" alt="Screen Shot 2021-04-11 at 8 40 21 PM" src="https://user-images.githubusercontent.com/663432/114351340-2d79d400-9b06-11eb-95d1-f775e695f312.png">
- Database migrations no longer block startup
- The migration is started shortly after the started event since they are cpu intensive (mostly just sqlite since its in the same process) and we do not want to compete with startup.
- Events are queued and processed when the migration is completed
- There is a safety to start discarding events if more than ~30000 happen before migration is completed to avoid memory exhaustion
- A notification is shown when the migration is in progress "The database is being upgraded. Integrations such as logbook and history that read the database may return inconsistent results until the migration completes."
- The sqlite database recovery logic can now recover at point after setup including purge, migration, and event insert. In short we can _always_ (hopefully) recover and start a new db without a restart.
- The quick check is no longer performed on unclean shutdown since we can always recover live. The `db_integrity_check` option has been deprecated.
- Recorder `__init__.py` coverage increased to 98% 🎊
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [x] New feature (which adds functionality to an existing integration)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [x] Code quality improvements to existing code or addition of tests
## Example entry for `configuration.yaml`:
<!--
Supplying a configuration snippet, makes it easier for a maintainer to test
your PR. Furthermore, for new integrations, it gives an impression of how
the configuration would look like.
Note: Remove this section if this PR does not have an example entry.
-->
```yaml
# Example configuration.yaml
```
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes #47936
- This PR is related to issue:
- Link to documentation pull request: https://github.com/home-assistant/home-assistant.io/pull/17402
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [x] The code change is tested and works locally.
- [ ] Local tests pass. **Your PR cannot be merged unless tests pass**
- [ ] There is no commented out code in this PR.
- [ ] I have followed the [development checklist][dev-checklist]
- [ ] The code has been formatted using Black (`black --fast homeassistant tests`)
- [x] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [x] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
- [ ] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [ ] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] Untested files have been added to `.coveragerc`.
The integration reached or maintains the following [Integration Quality Scale][quality-scale]:
<!--
The Integration Quality Scale scores an integration on the code quality
and user experience. Each level of the quality scale consists of a list
of requirements. We highly recommend getting your integration scored!
-->
- [ ] No score or internal
- [ ] 🥈 Silver
- [ ] 🥇 Gold
- [ ] 🏆 Platinum
<!--
This project is very active and we have a high turnover of pull requests.
Unfortunately, the number of incoming pull requests is higher than what our
reviewers can review and merge so there is a long backlog of pull requests
waiting for review. You can help here!
By reviewing another pull request, you will help raise the code quality of
that pull request and the final review will be faster. This way the general
pace of pull request reviews will go up and your wait time will go down.
When picking a pull request to review, try to choose one that hasn't yet
been reviewed.
Thanks for helping out!
-->
To help with the load of incoming pull requests:
- [ ] I have reviewed two other [open pull requests][prs] in this repository.
[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/en/development_checklist.html
[manifest-docs]: https://developers.home-assistant.io/docs/en/creating_integration_manifest.html
[quality-scale]: https://developers.home-assistant.io/docs/en/next/integration_quality_scale_index.html
[docs-repository]: https://github.com/home-assistant/home-assistant.io
Ps
Na pocieszenie są tacy którym migracja bazy zajmuje 2 dni, nie jest to nic nadzwyczajnego
1 polubienie
jolka
14 Kwiecień 2021 19:12
43
Cino111:
Co to za dziwny błąd?
nie wiele z tego loga wynika, nie mam pojęcia o jaką integrację chodzi, kilka osób (78) zgłosiło coś podobnego:
https://github.com/home-assistant/core/search?q=line+277%2C+in+async_update_ha_state&type=issues
kknd
14 Kwiecień 2021 19:16
44
Cześć!
Ktoś jest mi w stanie powiedzieć co zadziało się na mojej DEV1 (piszę to w smutku oczekując na ponowną dostępność DEV3), że mam taki obraz w konsoli po aktualizacji do Ewy??
Z innej beczki - gdyby ktoś nie zauważył, ponownie na tindie.com dostępny jest zzh! CC2652R RF Stick
Iron
14 Kwiecień 2021 19:20
45
jolka:
Brawo za cierpliwość
W tej wersji też jest migracja bazy i dlatego tyle to trwa… niestety.
Problem jest znany i dobra wiadomość jest taka, że to się zmieni, migracja bazy nie będzie wstrzymywała startu systemu - poprawkę robi nasz ulubiony developer Nick Koston, to chyba jedyny programista który coś optymalizuje w temacie zapisu do bazy w ha.
Tu masz szczegóły, będzie w kolejnej wersji lepiej:
Nawet sam miałem zapytać o taką możliwość. logowanie zostaje wstrzymane do czasu migracji bazy ale HA uruchamia się normalnie… lub na czas migracji loguje do innej czy lokalnej bazy a później dołącza te rekordy do zmigrowanej bazy…
sdsi
14 Kwiecień 2021 19:27
46
kknd:
mam taki obraz w konsoli
co jest nie tak z tym obrazem? Ctrl - C powinno zadziałać.
Iron
14 Kwiecień 2021 19:31
47
Cytat Angust
Ile masz rekordów w tabeli ?
W states mam 8 746 027 rekordów
W events mam 8 803 067 rekordów
Początek logowania 14.02.2021 więc tylko 2 miesiące.
Oczywiście mam ograniczone eventy do tych niezbędnych.