storage/backend: Add a gauge to indicate if defrag is active (backport from 3.6)

This commit is contained in:
Geeta Gharpure
2021-10-06 11:01:07 -07:00
parent 1eac258f58
commit 85abf6e46d
2 changed files with 10 additions and 0 deletions

View File

@ -354,6 +354,8 @@ func (b *backend) Defrag() error {
func (b *backend) defrag() error {
now := time.Now()
isDefragActive.Set(1)
defer isDefragActive.Set(0)
// TODO: make this non-blocking?
// lock batchTx to ensure nobody is using previous tx, and then