forked from TrueCloudLab/frostfs-node
[#421] Try using badger for the write-cache
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
65c72f3e0b
commit
1a0cb0f34a
56 changed files with 2234 additions and 747 deletions
31
pkg/local_object_storage/writecache/writecachebadger/gc.go
Normal file
31
pkg/local_object_storage/writecache/writecachebadger/gc.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
package writecachebadger
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
)
|
||||
|
||||
func (c *cache) runGCLoop() {
|
||||
c.wg.Add(1)
|
||||
|
||||
go func() {
|
||||
defer c.wg.Done()
|
||||
|
||||
t := time.NewTicker(c.gcInterval)
|
||||
defer t.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-c.closeCh:
|
||||
return
|
||||
case <-t.C:
|
||||
// 0.5 is the recommended value so that write amplification of the value log is 2.
|
||||
// See https://pkg.go.dev/github.com/dgraph-io/badger/v4#DB.RunValueLogGC for more info.
|
||||
for c.db.RunValueLogGC(0.5) == nil {
|
||||
c.log.Debug(logs.WritecacheDBValueLogGCRunCompleted)
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue