Gladys Assistant v4.10.2 is available with performance fixes and a database cleanup button!

Hello everyone!

Gladys Assistant v4.10.2 is available, an update that improves the way state history deletion works.

Background deletion of state history

Concretely, now when you save a device with the « Yes, keep states » button unchecked, Gladys will no longer be « stuck » for several minutes/hours if you have a lot of history to delete, because Gladys will delete states bit by bit in the background, in a non-blocking way.

To learn more, I detailed here how all that works:

Ability to run a manual database cleanup

Gladys uses SQLite as its database, and like many database systems, SQLite offers a VACUUM command (in French: le vide!) which will clean the database and remove from disk rows that are no longer used.

This allows reducing Gladys’s disk usage by rebuilding the database.

This is an operation that can be useful from time to time to save space, but it is slow to perform on large databases, and above all it is blocking: the DB is not accessible during the cleanup, and consequently Gladys isn’t either.

For this reason, I decided to add a « Clean the database » button in Gladys’s system settings, to allow those who wish to perform a manual cleanup whenever they want.

For now, I didn’t want to set up a scheduled cleanup, for the good reason that I want to avoid Gladys being unavailable at your place for 1 hour if you happen to have a very large database and a fairly slow disk (an SD card for example!), without knowing why. For the user, this would be seen as a crash!

This might be an evolution, but I think the cleanup must be able to be disabled if it is implemented, for those who seek high availability.

In the meantime, it’s manual and available in the system settings:

To learn more:

The full CHANGELOG is available here .

How to update?

If you installed Gladys with the official Raspberry Pi OS image, your instances will update automatically in the coming hours. This can take up to 24h, don’t panic.

If you installed Gladys with Docker, make sure you are using Watchtower (See the documentation )

3 Likes

Hello
Does this include taking into account the latest topics (I’m thinking of Tasmota temperatures/humidity…)?

Thanks

Good idea to think that way. It will allow everyone to manage the availability of their instance,

1 Like

Hi @Titou43! Which topic are you referring to in particular? (I’d appreciate a link to the specific thread/a specific PR)

This update has nothing to do with Tasmota :slight_smile:

I’m talking about this topic:

Hi @Titou43! I don’t know if @AlexTrovato had time to take a look, given the topic I don’t think so! You’ll have to be patient :slight_smile:

I was able to run a few tests and I can confirm on my end that Gladys no longer gets stuck!
Thanks @pierre-gilles :+1:

1 Like

I have indeed made progress on the temperature and humidity sensors.
I still need to prepare a test Docker image for validation.

EDIT : in fact it’s already been tested!

1 Like

Test in progress. Thanks for your changes; deleting, updating and adding equipment is now instantaneous despite the size of my database.

Being able to run a VACUUM manually is very handy, because it lets us control Gladys’ downtime.

2 Likes

Awesome!! Thanks for the feedback :slight_smile:

@pierre-gilles Well, in the end I don’t think all scenarios were taken into account for the blocking during data deletion.
Thanks to the integration of the Lixee TIC from the last update I tried to delete MQTT devices that I no longer

You were on the latest version of Gladys, right?

Yes in 4.12.

It may be related to another issue.
I’ll test this deletion on another Gladys instance and my database as soon as I can and I’ll let you know if I manage to reproduce it.

1 Like

My MQTT devices weren’t deleted (probably because of my reboot), so I’m starting to delete them again. This time I’m deleting only a single feature and Gladys freezes again! :disappointed_relieved:

I can reproduce the problem whenever you want — tell me what you

[quote=« _Will_71, post:14, topic:7555 »]
I can reproduce the problem whenever I want

Do you still have the database (db) from the other day? If not, I’ll resend it to you later today.

It’s the MQTT Linky device with one of the features removed, for example the index

I’d like you to send it back to me :slight_smile:

No problem, I’ll resend it to you today.