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 recorder data by default #12271

Merged
merged 1 commit into from
Feb 11, 2018

Conversation

amelchio
Copy link
Contributor

@amelchio amelchio commented Feb 10, 2018

Breaking change note:

Home Assistant now defaults to purge recorded history that is older than 10 days. If you want to keep your recorded data for longer than that, you must configure the number of days to retain before starting 0.64 for the first time, for example:

recorder:
  purge_keep_days: 30

If you want to keep the previous default of never deleting history, use this configuration:

recorder:
  purge_interval: 0

Description:

This is step 2 of the plan to purge recorder data by default. Step 1 was merged in #11976 with tweaks in #12220 and #12246.

The PR enables purge every ten days by default. This means that we can remove the explicit configuration from generated config that was introduced in 0.63.

The pre-0.64 behavior can be restored with this configuration:

recorder:
  purge_interval: 0

This can also be used to run the purging at predictable times, like at night:

recorder:
  purge_interval: 0

automation:
  - alias: "Purge database"
    trigger:
      platform: time
      at: '04:00:00'
    action:
      - service: recorder.purge

We always have a purge_keep_days value now so recorder.purge will default to using that.

Also, the recorder.purge service now supports an optional repack parameter that will do a vacuum for SQLite. I picked "repack" rather than "vacuum" or "optimize" (as it is called in MySQL) to get a generic word that does not sound too positive (because repacking can be pointless or even bad).

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#4643

Checklist:

  • The code change is tested and works locally.

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Local tests with tox run successfully.
  • Tests have been added to verify that the new code works.

@amelchio
Copy link
Contributor Author

I now added a documentation PR and a "breaking change note" so I believe this is good to go.

@balloob balloob merged commit 247edf1 into home-assistant:dev Feb 11, 2018
@balloob
Copy link
Member

balloob commented Feb 11, 2018

You only forgot the label :)

@balloob balloob mentioned this pull request Feb 22, 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.

3 participants