tidwall / tile38

Real-time Geospatial and Geofencing
https://tile38.com
MIT License
9.16k stars 569 forks source link

Autoshrink AOF in the background #74

Open tidwall opened 8 years ago

tidwall commented 8 years ago

When an AOF file gets too large it should automatically shrink. This can be done in a background routine in a similar manner as BuntDB.

https://github.com/tidwall/buntdb/blob/27d3577d74cea0b53b4261365f08a38eff9671be/buntdb.go#L106-L116 https://github.com/tidwall/buntdb/blob/27d3577d74cea0b53b4261365f08a38eff9671be/buntdb.go#L556-L559

Where AutoShrinkPercentage is 100%, and AutoShinkMinSize is 32MB.

This was mentioned in #73. We also needs more unit testing around the AOFSHRINK routine.

huangpeizhi commented 7 years ago

Hi, @tidwall

Because now I'm using TILE38 as fences in and out of the service, this application is run, so I'd like to know, AOFSHRINK not realize cases, is there any reliable way to clear the AOF log.

thanks!

tidwall commented 7 years ago

I'm closing this issue and pointing it to #73

tidwall commented 7 years ago

I'm reopening this issue and I plan on implementing this feature soon.

stephenlacy commented 6 years ago

@tidwall Any updates on when you would have time to implement this? I could take a swing at it.

tidwall commented 6 years ago

I have this mostly working in a private branch for v2, but I have yet to retrofit it into v1.

The logic/rules are pretty straightforward, and if you want to give it a go, I would be happy to go over with you what I have.