WIP: Blobtree substorage #645
7 changed files with 55 additions and 43 deletions
|
@ -808,7 +808,7 @@ func (c *cfg) getSubstorageOpts(shCfg shardCfg) []blobstor.SubStorage {
|
|||
if c.metricsCollector != nil {
|
||||
blobTreeOpts = append(blobTreeOpts,
|
||||
blobovniczatree.WithMetrics(
|
||||
lsmetrics.NewBlobovniczaTreeMetrics(sRead.path, c.metricsCollector.BlobobvnizcaTreeMetrics()),
|
||||
lsmetrics.NewBlobovniczaTreeMetrics(sRead.path, c.metricsCollector.BlobovniczaTreeMetrics()),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ func TestBlobovnicza(t *testing.T) {
|
|||
testPutGet(t, blz, oidtest.Address(), objSizeLim, nil, nil)
|
||||
}
|
||||
|
||||
// blobovnizca accepts object event if full
|
||||
// blobovnicza accepts object event if full
|
||||
testPutGet(t, blz, oidtest.Address(), 1024, func(err error) bool {
|
||||
return err == nil
|
||||
}, nil)
|
||||
|
|
|
@ -50,7 +50,7 @@ func (b *Blobovniczas) Close() error {
|
|||
b.dbCache.Close() // order important
|
||||
b.activeDBManager.Close()
|
||||
b.commondbManager.Close()
|
||||
|
||||
b.metrics.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// Put saves object in the maximum weight blobobnicza.
|
||||
// Put saves object in the maximum weight blobovnicza.
|
||||
//
|
||||
// returns error if could not save object in any blobovnicza.
|
||||
func (b *Blobovniczas) Put(ctx context.Context, prm common.PutPrm) (common.PutRes, error) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/metrics"
|
||||
)
|
||||
|
||||
func NewBlobovniczaTreeMetrics(path string, m metrics_impl.BlobobvnizcaMetrics) blobovniczatree.Metrics {
|
||||
func NewBlobovniczaTreeMetrics(path string, m metrics_impl.BlobovniczaMetrics) blobovniczatree.Metrics {
|
||||
return &blobovniczaTreeMetrics{
|
||||
path: path,
|
||||
shardID: undefined,
|
||||
|
@ -19,7 +19,7 @@ func NewBlobovniczaTreeMetrics(path string, m metrics_impl.BlobobvnizcaMetrics)
|
|||
type blobovniczaTreeMetrics struct {
|
||||
shardID string
|
||||
path string
|
||||
m metrics_impl.BlobobvnizcaMetrics
|
||||
m metrics_impl.BlobovniczaMetrics
|
||||
}
|
||||
|
||||
func (m *blobovniczaTreeMetrics) Blobovnicza() blobovnicza.Metrics {
|
||||
|
@ -35,48 +35,48 @@ func (m *blobovniczaTreeMetrics) SetParentID(parentID string) {
|
|||
}
|
||||
|
||||
func (m *blobovniczaTreeMetrics) SetMode(readOnly bool) {
|
||||
m.m.SetBlobobvnizcaTreeMode(m.shardID, m.path, readOnly)
|
||||
m.m.SetBlobovniczaTreeMode(m.shardID, m.path, readOnly)
|
||||
}
|
||||
|
||||
func (m *blobovniczaTreeMetrics) Close() {
|
||||
m.m.CloseBlobobvnizcaTree(m.shardID, m.path)
|
||||
m.m.CloseBlobovniczaTree(m.shardID, m.path)
|
||||
}
|
||||
|
||||
func (m *blobovniczaTreeMetrics) Delete(d time.Duration, success, withStorageID bool) {
|
||||
m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Delete", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID})
|
||||
m.m.BlobovniczaTreeMethodDuration(m.shardID, m.path, "Delete", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID})
|
||||
}
|
||||
|
||||
func (m *blobovniczaTreeMetrics) Exists(d time.Duration, success, withStorageID bool) {
|
||||
m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Exists", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID})
|
||||
m.m.BlobovniczaTreeMethodDuration(m.shardID, m.path, "Exists", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID})
|
||||
}
|
||||
|
||||
func (m *blobovniczaTreeMetrics) GetRange(d time.Duration, size int, success, withStorageID bool) {
|
||||
m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "GetRange", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID})
|
||||
m.m.BlobovniczaTreeMethodDuration(m.shardID, m.path, "GetRange", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID})
|
||||
if success {
|
||||
m.m.AddBlobobvnizcaTreeGet(m.shardID, m.path, size)
|
||||
m.m.AddBlobovniczaTreeGet(m.shardID, m.path, size)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *blobovniczaTreeMetrics) Get(d time.Duration, size int, success, withStorageID bool) {
|
||||
m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Get", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID})
|
||||
m.m.BlobovniczaTreeMethodDuration(m.shardID, m.path, "Get", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID})
|
||||
if success {
|
||||
m.m.AddBlobobvnizcaTreeGet(m.shardID, m.path, size)
|
||||
m.m.AddBlobovniczaTreeGet(m.shardID, m.path, size)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *blobovniczaTreeMetrics) Iterate(d time.Duration, success bool) {
|
||||
m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Iterate", d, success, metrics_impl.NullBool{})
|
||||
m.m.BlobovniczaTreeMethodDuration(m.shardID, m.path, "Iterate", d, success, metrics_impl.NullBool{})
|
||||
}
|
||||
|
||||
func (m *blobovniczaTreeMetrics) Put(d time.Duration, size int, success bool) {
|
||||
m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Put", d, success, metrics_impl.NullBool{})
|
||||
m.m.BlobovniczaTreeMethodDuration(m.shardID, m.path, "Put", d, success, metrics_impl.NullBool{})
|
||||
if success {
|
||||
m.m.AddBlobobvnizcaTreePut(m.shardID, m.path, size)
|
||||
m.m.AddBlobovniczaTreePut(m.shardID, m.path, size)
|
||||
}
|
||||
}
|
||||
|
||||
type blobovniczaMetrics struct {
|
||||
m metrics_impl.BlobobvnizcaMetrics
|
||||
m metrics_impl.BlobovniczaMetrics
|
||||
shardID func() string
|
||||
path string
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@ import (
|
|||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
type BlobobvnizcaMetrics interface {
|
||||
SetBlobobvnizcaTreeMode(shardID, path string, readOnly bool)
|
||||
CloseBlobobvnizcaTree(shardID, path string)
|
||||
BlobobvnizcaTreeMethodDuration(shardID, path string, method string, d time.Duration, success bool, withStorageID NullBool)
|
||||
AddBlobobvnizcaTreePut(shardID, path string, size int)
|
||||
AddBlobobvnizcaTreeGet(shardID, path string, size int)
|
||||
type BlobovniczaMetrics interface {
|
||||
SetBlobovniczaTreeMode(shardID, path string, readOnly bool)
|
||||
CloseBlobovniczaTree(shardID, path string)
|
||||
BlobovniczaTreeMethodDuration(shardID, path string, method string, d time.Duration, success bool, withStorageID NullBool)
|
||||
AddBlobovniczaTreePut(shardID, path string, size int)
|
||||
AddBlobovniczaTreeGet(shardID, path string, size int)
|
||||
|
||||
AddOpenBlobovniczaSize(shardID, path string, size uint64)
|
||||
SubOpenBlobovniczaSize(shardID, path string, size uint64)
|
||||
|
@ -78,11 +78,11 @@ func newBlobovnicza() *blobovnicza {
|
|||
}
|
||||
}
|
||||
|
||||
func (b *blobovnicza) SetBlobobvnizcaTreeMode(shardID, path string, readOnly bool) {
|
||||
func (b *blobovnicza) SetBlobovniczaTreeMode(shardID, path string, readOnly bool) {
|
||||
b.treeMode.SetMode(shardID, path, modeFromBool(readOnly))
|
||||
}
|
||||
|
||||
func (b *blobovnicza) CloseBlobobvnizcaTree(shardID, path string) {
|
||||
func (b *blobovnicza) CloseBlobovniczaTree(shardID, path string) {
|
||||
b.treeMode.SetMode(shardID, path, closedMode)
|
||||
b.treeReqDuration.DeletePartialMatch(prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
|
@ -96,9 +96,21 @@ func (b *blobovnicza) CloseBlobobvnizcaTree(shardID, path string) {
|
|||
shardIDLabel: shardID,
|
||||
pathLabel: path,
|
||||
})
|
||||
b.treeOpenSize.DeletePartialMatch(prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
pathLabel: path,
|
||||
})
|
||||
b.treeOpenItems.DeletePartialMatch(prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
pathLabel: path,
|
||||
})
|
||||
b.treeOpenCounter.DeletePartialMatch(prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
pathLabel: path,
|
||||
})
|
||||
}
|
||||
|
||||
func (b *blobovnicza) BlobobvnizcaTreeMethodDuration(shardID, path string, method string, d time.Duration, success bool, withStorageID NullBool) {
|
||||
func (b *blobovnicza) BlobovniczaTreeMethodDuration(shardID, path string, method string, d time.Duration, success bool, withStorageID NullBool) {
|
||||
b.treeReqDuration.With(prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
pathLabel: path,
|
||||
|
@ -108,14 +120,14 @@ func (b *blobovnicza) BlobobvnizcaTreeMethodDuration(shardID, path string, metho
|
|||
}).Observe(d.Seconds())
|
||||
}
|
||||
|
||||
func (b *blobovnicza) AddBlobobvnizcaTreePut(shardID, path string, size int) {
|
||||
func (b *blobovnicza) AddBlobovniczaTreePut(shardID, path string, size int) {
|
||||
b.treePut.With(prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
pathLabel: path,
|
||||
}).Add(float64(size))
|
||||
}
|
||||
|
||||
func (b *blobovnicza) AddBlobobvnizcaTreeGet(shardID, path string, size int) {
|
||||
func (b *blobovnicza) AddBlobovniczaTreeGet(shardID, path string, size int) {
|
||||
b.treeGet.With(prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
pathLabel: path,
|
||||
|
|
|
@ -16,7 +16,7 @@ type NodeMetrics struct {
|
|||
epoch prometheus.Gauge
|
||||
fstree *fstreeMetrics
|
||||
blobstore *blobstoreMetrics
|
||||
blobobvnizca *blobovnicza
|
||||
blobovnicza *blobovnicza
|
||||
metabase *metabaseMetrics
|
||||
pilorama *piloramaMetrics
|
||||
grpc *grpcServerMetrics
|
||||
|
@ -40,17 +40,17 @@ func NewNodeMetrics() *NodeMetrics {
|
|||
Name: "epoch",
|
||||
Help: "Current epoch as seen by inner-ring node.",
|
||||
}),
|
||||
fstree: newFSTreeMetrics(),
|
||||
blobstore: newBlobstoreMetrics(),
|
||||
blobobvnizca: newBlobovnicza(),
|
||||
metabase: newMetabaseMetrics(),
|
||||
pilorama: newPiloramaMetrics(),
|
||||
grpc: newGrpcServerMetrics(),
|
||||
policer: newPolicerMetrics(),
|
||||
morphClient: newMorphClientMetrics(),
|
||||
morphCache: newMorphCacheMetrics(namespace),
|
||||
log: logger.NewLogMetrics(namespace),
|
||||
blobTree: newBlobTreeMetrics(),
|
||||
fstree: newFSTreeMetrics(),
|
||||
blobstore: newBlobstoreMetrics(),
|
||||
blobovnicza: newBlobovnicza(),
|
||||
metabase: newMetabaseMetrics(),
|
||||
pilorama: newPiloramaMetrics(),
|
||||
grpc: newGrpcServerMetrics(),
|
||||
policer: newPolicerMetrics(),
|
||||
morphClient: newMorphClientMetrics(),
|
||||
morphCache: newMorphCacheMetrics(namespace),
|
||||
log: logger.NewLogMetrics(namespace),
|
||||
blobTree: newBlobTreeMetrics(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,8 @@ func (m *NodeMetrics) Blobstore() BlobstoreMetrics {
|
|||
return m.blobstore
|
||||
}
|
||||
|
||||
func (m *NodeMetrics) BlobobvnizcaTreeMetrics() BlobobvnizcaMetrics {
|
||||
return m.blobobvnizca
|
||||
func (m *NodeMetrics) BlobovniczaTreeMetrics() BlobovniczaMetrics {
|
||||
return m.blobovnicza
|
||||
}
|
||||
|
||||
func (m *NodeMetrics) MetabaseMetrics() MetabaseMetrics {
|
||||
|
|
Loading…
Reference in a new issue