aboutsummaryrefslogtreecommitdiff
path: root/weed/storage
diff options
context:
space:
mode:
Diffstat (limited to 'weed/storage')
-rw-r--r--weed/storage/erasure_coding/ec_shard.go4
-rw-r--r--weed/storage/volume.go2
-rw-r--r--weed/storage/volume_loading.go3
-rw-r--r--weed/storage/volume_vacuum.go2
4 files changed, 11 insertions, 0 deletions
diff --git a/weed/storage/erasure_coding/ec_shard.go b/weed/storage/erasure_coding/ec_shard.go
index 2009beb9c..bcfa2c721 100644
--- a/weed/storage/erasure_coding/ec_shard.go
+++ b/weed/storage/erasure_coding/ec_shard.go
@@ -6,6 +6,7 @@ import (
"path"
"strconv"
+ "github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
)
@@ -36,6 +37,8 @@ func NewEcVolumeShard(dirname string, collection string, id needle.VolumeId, sha
}
v.ecdFileSize = ecdFi.Size()
+ stats.VolumeServerEcShardCounter.Inc()
+
return
}
@@ -78,6 +81,7 @@ func (shard *EcVolumeShard) Close() {
func (shard *EcVolumeShard) Destroy() {
os.Remove(shard.FileName() + ToExt(int(shard.ShardId)))
+ stats.VolumeServerEcShardCounter.Dec()
}
func (shard *EcVolumeShard) ReadAt(buf []byte, offset int64) (int, error) {
diff --git a/weed/storage/volume.go b/weed/storage/volume.go
index 44e96015e..f3d5b9922 100644
--- a/weed/storage/volume.go
+++ b/weed/storage/volume.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
+ "github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
"os"
@@ -102,6 +103,7 @@ func (v *Volume) Close() {
if v.dataFile != nil {
_ = v.dataFile.Close()
v.dataFile = nil
+ stats.VolumeServerVolumeCounter.Dec()
}
}
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go
index 51fbe12e5..4c7b93418 100644
--- a/weed/storage/volume_loading.go
+++ b/weed/storage/volume_loading.go
@@ -5,6 +5,7 @@ import (
"os"
"time"
+ "github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
"github.com/syndtr/goleveldb/leveldb/opt"
@@ -116,6 +117,8 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
}
}
+ stats.VolumeServerVolumeCounter.Inc()
+
return e
}
diff --git a/weed/storage/volume_vacuum.go b/weed/storage/volume_vacuum.go
index f89f2cf0a..6e8d3a861 100644
--- a/weed/storage/volume_vacuum.go
+++ b/weed/storage/volume_vacuum.go
@@ -6,6 +6,7 @@ import (
"time"
"github.com/chrislusf/seaweedfs/weed/glog"
+ "github.com/chrislusf/seaweedfs/weed/stats"
idx2 "github.com/chrislusf/seaweedfs/weed/storage/idx"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
. "github.com/chrislusf/seaweedfs/weed/storage/types"
@@ -52,6 +53,7 @@ func (v *Volume) CommitCompact() error {
glog.V(0).Infof("fail to close volume %d", v.Id)
}
v.dataFile = nil
+ stats.VolumeServerVolumeCounter.Dec()
var e error
if e = v.makeupDiff(v.FileName()+".cpd", v.FileName()+".cpx", v.FileName()+".dat", v.FileName()+".idx"); e != nil {