aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuo Lei <snipergg@163.com>2022-08-23 23:53:24 +0800
committerGitHub <noreply@github.com>2022-08-23 08:53:24 -0700
commit762dc219a6175d5c81968d817d41a16fb3a1163f (patch)
tree509e02a1e4d3bb622626e5d3143ff3fd5c1c3a0d
parent21a933c9329f80bb7bfe5dbfb09e5b4f1a736f29 (diff)
downloadseaweedfs-762dc219a6175d5c81968d817d41a16fb3a1163f.tar.xz
seaweedfs-762dc219a6175d5c81968d817d41a16fb3a1163f.zip
fix deletecount bug (#3499)
-rw-r--r--weed/storage/needle_map_metric.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/weed/storage/needle_map_metric.go b/weed/storage/needle_map_metric.go
index abf6b4b8b..3cda63dc5 100644
--- a/weed/storage/needle_map_metric.go
+++ b/weed/storage/needle_map_metric.go
@@ -7,7 +7,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/storage/idx"
. "github.com/seaweedfs/seaweedfs/weed/storage/types"
- "github.com/tylertreat/BoomFilters"
+ boom "github.com/tylertreat/BoomFilters"
)
type mapMetric struct {
@@ -106,7 +106,12 @@ func newNeedleMapMetricFromIndexFile(r *os.File) (mm *mapMetric, err error) {
}
mm.FileCounter++
- if bf.TestAndAdd(buf) {
+ if !bf.TestAndAdd(buf) {
+ // if !size.IsValid(), then this file is deleted already
+ if !size.IsValid() {
+ mm.DeletionCounter++
+ }
+ } else {
// deleted file
mm.DeletionCounter++
if size.IsValid() {