forked from TrueCloudLab/frostfs-node
[#1337] blobovniczatree: Add rebuild by overflow
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
a61201a987
commit
edb1747af7
2 changed files with 82 additions and 3 deletions
|
@ -172,7 +172,7 @@ func (b *Blobovniczas) selectDBsDoNotMatchFillPercent(ctx context.Context, targe
|
|||
continue
|
||||
}
|
||||
path := filepath.Join(lvlPath, e.Name())
|
||||
resettlementRequired, err := b.fillPercentIsLow(path, target)
|
||||
resettlementRequired, err := b.rebuildBySize(path, target)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
@ -187,14 +187,19 @@ func (b *Blobovniczas) selectDBsDoNotMatchFillPercent(ctx context.Context, targe
|
|||
return result, nil
|
||||
}
|
||||
|
||||
func (b *Blobovniczas) fillPercentIsLow(path string, target int) (bool, error) {
|
||||
func (b *Blobovniczas) rebuildBySize(path string, targetFillPercent int) (bool, error) {
|
||||
shDB := b.getBlobovnicza(path)
|
||||
blz, err := shDB.Open()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer shDB.Close()
|
||||
return blz.FillPercent() < target, nil
|
||||
fp := blz.FillPercent()
|
||||
// accepted fill percent defines as
|
||||
// |----|+++++++++++++++++|+++++++++++++++++|---------------
|
||||
// 0% target 100% 100+(100 - target)
|
||||
// where `+` - accepted fill percent, `-` - not accepted fill percent
|
||||
return fp < targetFillPercent || fp > 100+(100-targetFillPercent), nil
|
||||
}
|
||||
|
||||
func (b *Blobovniczas) rebuildDB(ctx context.Context, path string, meta common.MetaStorage, limiter common.ConcurrentWorkersLimiter) (uint64, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue