sipcapture / heplify-server

HEP Capture Server for HOMER
https://sipcapture.org
GNU Affero General Public License v3.0
184 stars 85 forks source link

disk usage protection in the case of incorrect retention policy #444

Closed aqsyonas closed 3 years ago

aqsyonas commented 3 years ago

This PR will avoid homer_data taking all of disk which might result into a messy situation in the case of incorrect retention policy.

lmangani commented 3 years ago

I feel like a % utilization threshold on the storage volume would be universally more useful as opposed to max disk space threshold.

aqsyonas commented 3 years ago

Thanks, for the suggestion. I will add % utilization here.

aqsyonas commented 3 years ago

@lmangani i have added percentage support in heplify-server along with maxusage. User can switch between both scheme by changing param DBUsageScheme between percentage and maxusage respectively

Suggestions are most welcome. !

negbie commented 3 years ago

Since the default value of DBUsageProtection in config.go is false I see no harm in merging this. I did not go over every line and tbh I don't really get the real benefit behind this but I guess you found usecases where this might be usefull. I'm just sceptical because you run this job every night and you check is curSize > configuredSize if so delete dropdays configured data. Mby I missed something from your PR but what happens if user has configured 7 days and after 1 day curSize is larger than configuredSize. You delete 7 day old partition which does not help. Again mby I missed something because I was in a hurry ;)

negbie commented 3 years ago

Yip saw that for loop but doesn't change what I was saying or am I wrong?

negbie commented 3 years ago

As I said since it's not enabled by default it won't hurt anybody. But normally inexperienced make such misstakes and here I think your PR wont help. Imagine a user set's drop days to 7 but after 1 day his DB is full.

adubovikov commented 3 years ago

As I said since it's not enabled by default it won't hurt anybody. But normally inexperienced make such misstakes and here I think your PR wont help. Image a user set's drop days to 7 but after 1 day his DB is full.

if I understood it correct, the routine will drop partitions untill the disk size will be lower than DB threadshold (i.e. 80%) ...

theoreticaly we can run this not daily but each 6 hours - it won't effect any perfomance issues because the partition drop is async process.