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

No repair/user notification when database corruption detected #113891

Open
rct opened this issue Mar 20, 2024 · 8 comments · May be fixed by #131367
Open

No repair/user notification when database corruption detected #113891

rct opened this issue Mar 20, 2024 · 8 comments · May be fixed by #131367

Comments

@rct
Copy link
Contributor

rct commented Mar 20, 2024

The problem

When home assistant detects database corruption and restarts with a new database, the user isn't notified via a repair or other notification. The user might not be aware that this has occurred until they notice missing history or have a reason to check the home assistant log.

It's great that Home Assistant fixes itself and restarts, but a user might not be aware of a problem for an extended period of time. This seems more likely to be detected overnight when recorder is doing db maintenance such as auto purge.

What version of Home Assistant Core has the issue?

core-2024.2.5

What was the last working version of Home Assistant Core?

core-2024.2.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

recorder

Link to integration documentation on our website

https://www.home-assistant.io/integrations/recorder/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Mar 19 08:12:18 hasswhb homeassistant[433]: 2024-03-19 04:12:18.622 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (sqlite3.DatabaseError) database disk image is malformed
Mar 19 08:12:18 hasswhb homeassistant[433]: [parameters: (11545035, 11545036, 11545037, 11545038, 11545039, 11545040, 11545041, 11545042, 11545043, 11545044, 11545045, 11545046, 11545047, 11545048, 11545049, 11545054, 11545050, 11545051, 11545052, 11545053, 11545055, 11545056, 11545057, 11545058, 11545063, 11545059, 11545060, 11545061, 11545062, 11545064, 11545065, 11545066, 11545067, 11545068, 11545069, 11545076, 11545070, 11545071, 11545072, 11545073, 11545074, 11545075, 11545077, 11545078, 11545079, 11545080, 11545081, 11545090, 11545082, 11545083 ... 3900 parameters truncated ... 11549191, 11549192, 11549193, 11549194, 11549195, 11549197, 11549198, 11549199, 11549200, 11549201, 11549202, 11549203, 11549204, 11549206, 11549207, 11549208, 11549209, 11549210, 11549211, 11549212, 11549214, 11549215, 11549216, 11549217, 11549218, 11549220, 11549221, 11549222, 11549223, 11549224, 11549225, 11549227, 11549228, 11549229, 11549230, 11549231, 11549232, 11549233, 11549234, 11549235, 11549236, 11549237, 11549238, 11549239, 11549240, 11549241, 11549242, 11549243, 11549245, 11549246)]
Mar 19 08:12:18 hasswhb homeassistant[433]: (Background on this error at: https://sqlalche.me/e/20/4xp6)
Mar 19 08:12:18 hasswhb homeassistant[433]: Traceback (most recent call last):
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
Mar 19 08:12:18 hasswhb homeassistant[433]:     self.dialect.do_execute(
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
Mar 19 08:12:18 hasswhb homeassistant[433]:     cursor.execute(statement, parameters)
Mar 19 08:12:18 hasswhb homeassistant[433]: sqlite3.DatabaseError: database disk image is malformed
Mar 19 08:12:18 hasswhb homeassistant[433]:
Mar 19 08:12:18 hasswhb homeassistant[433]: The above exception was the direct cause of the following exception:
Mar 19 08:12:18 hasswhb homeassistant[433]:
Mar 19 08:12:18 hasswhb homeassistant[433]: Traceback (most recent call last):
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 139, in session_scope
Mar 19 08:12:18 hasswhb homeassistant[433]:     yield session
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/purge.py", line 88, in purge_old_data
Mar 19 08:12:18 hasswhb homeassistant[433]:     has_more_to_purge |= _purge_states_and_attributes_ids(
Mar 19 08:12:18 hasswhb homeassistant[433]:                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/purge.py", line 204, in _purge_states_and_attributes_ids
Mar 19 08:12:18 hasswhb homeassistant[433]:     _purge_unused_attributes_ids(instance, session, attributes_ids_batch)
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/purge.py", line 374, in _purge_unused_attributes_ids
Mar 19 08:12:18 hasswhb homeassistant[433]:     _purge_batch_attributes_ids(instance, session, unused_attribute_ids_set)
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/purge.py", line 535, in _purge_batch_attributes_ids
Mar 19 08:12:18 hasswhb homeassistant[433]:     deleted_rows = session.execute(
Mar 19 08:12:18 hasswhb homeassistant[433]:                    ^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2308, in execute
Mar 19 08:12:18 hasswhb homeassistant[433]:     return self._execute_internal(
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2190, in _execute_internal
Mar 19 08:12:18 hasswhb homeassistant[433]:     result: Result[Any] = compile_state_cls.orm_execute_statement(
Mar 19 08:12:18 hasswhb homeassistant[433]:                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/bulk_persistence.py", line 1946, in orm_execute_statement
Mar 19 08:12:18 hasswhb homeassistant[433]:     return super().orm_execute_statement(
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
Mar 19 08:12:18 hasswhb homeassistant[433]:     result = conn.execute(
Mar 19 08:12:18 hasswhb homeassistant[433]:              ^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
Mar 19 08:12:18 hasswhb homeassistant[433]:     return meth(
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/lambdas.py", line 604, in _execute_on_connection
Mar 19 08:12:18 hasswhb homeassistant[433]:     return connection._execute_clauseelement(
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement
Mar 19 08:12:18 hasswhb homeassistant[433]:     ret = self._execute_context(
Mar 19 08:12:18 hasswhb homeassistant[433]:           ^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context
Mar 19 08:12:18 hasswhb homeassistant[433]:     return self._exec_single_context(
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context
Mar 19 08:12:18 hasswhb homeassistant[433]:     self._handle_dbapi_exception(
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2344, in _handle_dbapi_exception
Mar 19 08:12:18 hasswhb homeassistant[433]:     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
Mar 19 08:12:18 hasswhb homeassistant[433]:     self.dialect.do_execute(
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
Mar 19 08:12:18 hasswhb homeassistant[433]:     cursor.execute(statement, parameters)
Mar 19 08:12:18 hasswhb homeassistant[433]: sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) database disk image is malformed
Mar 19 08:12:18 hasswhb homeassistant[433]: [parameters: (11545035, 11545036, 11545037, 11545038, 11545039, 11545040, 11545041, 11545042, 11545043, 11545044, 11545045, 11545046, 11545047, 11545048, 11545049, 11545054, 11545050, 11545051, 11545052, 11545053, 11545055, 11545056, 11545057, 11545058, 11545063, 11545059, 11545060, 11545061, 11545062, 11545064, 11545065, 11545066, 11545067, 11545068, 11545069, 11545076, 11545070, 11545071, 11545072, 11545073, 11545074, 11545075, 11545077, 11545078, 11545079, 11545080, 11545081, 11545090, 11545082, 11545083 ... 3900 parameters truncated ... 11549191, 11549192, 11549193, 11549194, 11549195, 11549197, 11549198, 11549199, 11549200, 11549201, 11549202, 11549203, 11549204, 11549206, 11549207, 11549208, 11549209, 11549210, 11549211, 11549212, 11549214, 11549215, 11549216, 11549217, 11549218, 11549220, 11549221, 11549222, 11549223, 11549224, 11549225, 11549227, 11549228, 11549229, 11549230, 11549231, 11549232, 11549233, 11549234, 11549235, 11549236, 11549237, 11549238, 11549239, 11549240, 11549241, 11549242, 11549243, 11549245, 11549246)]
Mar 19 08:12:18 hasswhb homeassistant[433]: (Background on this error at: https://sqlalche.me/e/20/4xp6)
Mar 19 08:12:18 hasswhb homeassistant[433]: 2024-03-19 04:12:18.647 ERROR (Recorder) [homeassistant.components.recorder.core] Unrecoverable sqlite3 database corruption detected: (sqlite3.DatabaseError) database disk image is malformed
Mar 19 08:12:18 hasswhb homeassistant[433]: [parameters: (11545035, 11545036, 11545037, 11545038, 11545039, 11545040, 11545041, 11545042, 11545043, 11545044, 11545045, 11545046, 11545047, 11545048, 11545049, 11545054, 11545050, 11545051, 11545052, 11545053, 11545055, 11545056, 11545057, 11545058, 11545063, 11545059, 11545060, 11545061, 11545062, 11545064, 11545065, 11545066, 11545067, 11545068, 11545069, 11545076, 11545070, 11545071, 11545072, 11545073, 11545074, 11545075, 11545077, 11545078, 11545079, 11545080, 11545081, 11545090, 11545082, 11545083 ... 3900 parameters truncated ... 11549191, 11549192, 11549193, 11549194, 11549195, 11549197, 11549198, 11549199, 11549200, 11549201, 11549202, 11549203, 11549204, 11549206, 11549207, 11549208, 11549209, 11549210, 11549211, 11549212, 11549214, 11549215, 11549216, 11549217, 11549218, 11549220, 11549221, 11549222, 11549223, 11549224, 11549225, 11549227, 11549228, 11549229, 11549230, 11549231, 11549232, 11549233, 11549234, 11549235, 11549236, 11549237, 11549238, 11549239, 11549240, 11549241, 11549242, 11549243, 11549245, 11549246)]
Mar 19 08:12:18 hasswhb homeassistant[433]: (Background on this error at: https://sqlalche.me/e/20/4xp6)
Mar 19 08:12:18 hasswhb homeassistant[433]: Traceback (most recent call last):
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
Mar 19 08:12:18 hasswhb homeassistant[433]:     self.dialect.do_execute(
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
Mar 19 08:12:18 hasswhb homeassistant[433]:     cursor.execute(statement, parameters)
Mar 19 08:12:18 hasswhb homeassistant[433]: sqlite3.DatabaseError: database disk image is malformed
Mar 19 08:12:18 hasswhb homeassistant[433]:
Mar 19 08:12:18 hasswhb homeassistant[433]: The above exception was the direct cause of the following exception:
Mar 19 08:12:18 hasswhb homeassistant[433]:
Mar 19 08:12:18 hasswhb homeassistant[433]: Traceback (most recent call last):
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 926, in _process_one_task_or_event_or_recover
Mar 19 08:12:18 hasswhb homeassistant[433]:     return task.run(self)
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/tasks.py", line 112, in run
Mar 19 08:12:18 hasswhb homeassistant[433]:     if purge.purge_old_data(
Mar 19 08:12:18 hasswhb homeassistant[433]:        ^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 643, in wrapper
Mar 19 08:12:18 hasswhb homeassistant[433]:     return job(instance, *args, **kwargs)
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/purge.py", line 88, in purge_old_data
Mar 19 08:12:18 hasswhb homeassistant[433]:     has_more_to_purge |= _purge_states_and_attributes_ids(
Mar 19 08:12:18 hasswhb homeassistant[433]:                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/purge.py", line 204, in _purge_states_and_attributes_ids
Mar 19 08:12:18 hasswhb homeassistant[433]:     _purge_unused_attributes_ids(instance, session, attributes_ids_batch)
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/purge.py", line 374, in _purge_unused_attributes_ids
Mar 19 08:12:18 hasswhb homeassistant[433]:     _purge_batch_attributes_ids(instance, session, unused_attribute_ids_set)
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/src/homeassistant/homeassistant/components/recorder/purge.py", line 535, in _purge_batch_attributes_ids
Mar 19 08:12:18 hasswhb homeassistant[433]:     deleted_rows = session.execute(
Mar 19 08:12:18 hasswhb homeassistant[433]:                    ^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2308, in execute
Mar 19 08:12:18 hasswhb homeassistant[433]:     return self._execute_internal(
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2190, in _execute_internal
Mar 19 08:12:18 hasswhb homeassistant[433]:     result: Result[Any] = compile_state_cls.orm_execute_statement(
Mar 19 08:12:18 hasswhb homeassistant[433]:                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/bulk_persistence.py", line 1946, in orm_execute_statement
Mar 19 08:12:18 hasswhb homeassistant[433]:     return super().orm_execute_statement(
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
Mar 19 08:12:18 hasswhb homeassistant[433]:     result = conn.execute(
Mar 19 08:12:18 hasswhb homeassistant[433]:              ^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
Mar 19 08:12:18 hasswhb homeassistant[433]:     return meth(
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/lambdas.py", line 604, in _execute_on_connection
Mar 19 08:12:18 hasswhb homeassistant[433]:     return connection._execute_clauseelement(
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement
Mar 19 08:12:18 hasswhb homeassistant[433]:     ret = self._execute_context(
Mar 19 08:12:18 hasswhb homeassistant[433]:           ^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context
Mar 19 08:12:18 hasswhb homeassistant[433]:     return self._exec_single_context(
Mar 19 08:12:18 hasswhb homeassistant[433]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context
Mar 19 08:12:18 hasswhb homeassistant[433]:     self._handle_dbapi_exception(
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2344, in _handle_dbapi_exception
Mar 19 08:12:18 hasswhb homeassistant[433]:     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
Mar 19 08:12:18 hasswhb homeassistant[433]:     self.dialect.do_execute(
Mar 19 08:12:18 hasswhb homeassistant[433]:   File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
Mar 19 08:12:18 hasswhb homeassistant[433]:     cursor.execute(statement, parameters)
Mar 19 08:12:18 hasswhb homeassistant[433]: sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) database disk image is malformed
Mar 19 08:12:18 hasswhb homeassistant[433]: [parameters: (11545035, 11545036, 11545037, 11545038, 11545039, 11545040, 11545041, 11545042, 11545043, 11545044, 11545045, 11545046, 11545047, 11545048, 11545049, 11545054, 11545050, 11545051, 11545052, 11545053, 11545055, 11545056, 11545057, 11545058, 11545063, 11545059, 11545060, 11545061, 11545062, 11545064, 11545065, 11545066, 11545067, 11545068, 11545069, 11545076, 11545070, 11545071, 11545072, 11545073, 11545074, 11545075, 11545077, 11545078, 11545079, 11545080, 11545081, 11545090, 11545082, 11545083 ... 3900 parameters truncated ... 11549191, 11549192, 11549193, 11549194, 11549195, 11549197, 11549198, 11549199, 11549200, 11549201, 11549202, 11549203, 11549204, 11549206, 11549207, 11549208, 11549209, 11549210, 11549211, 11549212, 11549214, 11549215, 11549216, 11549217, 11549218, 11549220, 11549221, 11549222, 11549223, 11549224, 11549225, 11549227, 11549228, 11549229, 11549230, 11549231, 11549232, 11549233, 11549234, 11549235, 11549236, 11549237, 11549238, 11549239, 11549240, 11549241, 11549242, 11549243, 11549245, 11549246)]
Mar 19 08:12:18 hasswhb homeassistant[433]: (Background on this error at: https://sqlalche.me/e/20/4xp6)
Mar 19 08:12:18 hasswhb homeassistant[433]: 2024-03-19 04:12:18.744 ERROR (Recorder) [homeassistant.components.recorder.util] The system will rename the corrupt database file //config/home-assistant_v2.db to //config/home-assistant_v2.db.corrupt.2024-03-19T08:12:18.744760+00:00 in order to allow startup to proceed

Additional information

No response

@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (recorder) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of recorder can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign recorder Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


recorder documentation
recorder source
(message by IssueLinks)

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@rct
Copy link
Contributor Author

rct commented Jun 18, 2024

This is difficult to set up a test. As far as I know this issue is still open.

@scharrrfi
Copy link

I have the same issue every few weeks. So I have to recover the corrupt database and merge it with the new one. I see it every time on the Energy Dashboard.

It is possible so separate the statistic tables from the main database?

This will fix the problem if the corruption is not caused by the statistic tables. But is will be better, when home assistant tries to recover the whole database by itself, so it will no have to create a blank one. This should only happen, if the recover and/or a PRAGMA test after this will fail.

rlaunch added a commit to rlaunch/core that referenced this issue Nov 3, 2024
… SQLite database is re-created due to a corrupt database file. Updated unit tests to check issue is created.
@rlaunch
Copy link

rlaunch commented Nov 3, 2024

Hey @rct,

I created a PR for this feature, however it was rejected because repairs/issues need to be actionable. Unfortunately a database corruption is not easily fixable so it would not be possible to implement this feature as it stands.

Best,
Ryan

@rct
Copy link
Contributor Author

rct commented Nov 8, 2024

@rlaunch Thank you for your work on this.

I find that sort of thinking quite frustrating -- "the enemy of the good". So it is clearly better to leave the user in the dark struggling to figure out why things aren't behaving as expected. I get the arguments for architectural purity and consistency.

So would it be possible/acceptable to create a persistent notification to get the user's attention?

@rlaunch
Copy link

rlaunch commented Nov 10, 2024

Hey @rct ,

I think that makes sense, maybe fire an event off too to allow people to trigger automations off it if they need to.
Hopefully I'll have a bit of time next weekend to take a look at making those changes.

Best,
Ryan

@rlaunch rlaunch linked a pull request Nov 23, 2024 that will close this issue
19 tasks
@rlaunch
Copy link

rlaunch commented Nov 23, 2024

I had some time today to make the changes mentioned, and have raised it as PR #131367

Best,
Ryan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants