satellite/metabase/metaloop: move loop under metabase

Currently the loop handling is heavily related to the metabase rather
than metainfo.

metainfo over time has become related to the "public API" for accessing
the metabase data.

Currently updates monkit.lock, because monkit monitoring does not handle
ScopeNamed correctly. Needs a followup change to monitoring check.

Change-Id: Ie50519991d718dfb872ec9a0176a82e732c97584
This commit is contained in:
Egon Elbre 2021-04-22 12:07:18 +03:00
parent ebc981291a
commit 4c9ed64f75
20 changed files with 28 additions and 25 deletions

View File

@ -18,8 +18,8 @@ import (
"storj.io/common/errs2"
"storj.io/common/memory"
"storj.io/storj/satellite/metabase/metaloop"
"storj.io/storj/satellite/metainfo"
"storj.io/storj/satellite/metainfo/metaloop"
)
var mon = monkit.Package()

View File

@ -61,11 +61,11 @@ storj.io/storj/satellite/gracefulexit."graceful_exit_success" Meter
storj.io/storj/satellite/gracefulexit."graceful_exit_successful_pieces_transfer_ratio" IntVal
storj.io/storj/satellite/gracefulexit."graceful_exit_transfer_piece_fail" Meter
storj.io/storj/satellite/gracefulexit."graceful_exit_transfer_piece_success" Meter
storj.io/storj/satellite/metabase/metaloop."objectsIterated" IntVal
storj.io/storj/satellite/metabase/metaloop."objectsProcessed" IntVal
storj.io/storj/satellite/metabase/metaloop."segmentsProcessed" IntVal
storj.io/storj/satellite/metabase/metaloop.*Service.RunOnce Task
storj.io/storj/satellite/metainfo."metainfo_rate_limit_exceeded" Event
storj.io/storj/satellite/metainfo/metaloop."objectsIterated" IntVal
storj.io/storj/satellite/metainfo/metaloop."objectsProcessed" IntVal
storj.io/storj/satellite/metainfo/metaloop."segmentsProcessed" IntVal
storj.io/storj/satellite/metainfo/metaloop.*Service.RunOnce Task
storj.io/storj/satellite/metainfo/piecedeletion."delete_batch_size" IntVal
storj.io/storj/satellite/metainfo/piecedeletion."deletion_pieces_unhandled_count" IntVal
storj.io/storj/satellite/orders."download_failed_not_enough_pieces_uplink" Meter

View File

@ -48,9 +48,9 @@ import (
"storj.io/storj/satellite/gracefulexit"
"storj.io/storj/satellite/inspector"
"storj.io/storj/satellite/mailservice"
"storj.io/storj/satellite/metabase/metaloop"
"storj.io/storj/satellite/metainfo"
"storj.io/storj/satellite/metainfo/expireddeletion"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metainfo/piecedeletion"
"storj.io/storj/satellite/metrics"
"storj.io/storj/satellite/nodestats"

View File

@ -16,7 +16,7 @@ import (
"storj.io/common/uuid"
"storj.io/storj/satellite/accounting"
"storj.io/storj/satellite/metabase"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
)
// Error is a standard error class for this package.

View File

@ -11,7 +11,7 @@ import (
"go.uber.org/zap"
"storj.io/common/sync2"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
)
// Chore populates reservoirs and the audit queue.

View File

@ -8,7 +8,7 @@ import (
"math/rand"
"storj.io/common/storj"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
)
var _ metaloop.Observer = (*Collector)(nil)

View File

@ -9,7 +9,7 @@ import (
"storj.io/common/uuid"
"storj.io/storj/satellite/metabase"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
)
const maxReservoirSize = 3

View File

@ -33,9 +33,9 @@ import (
"storj.io/storj/satellite/contact"
"storj.io/storj/satellite/gc"
"storj.io/storj/satellite/gracefulexit"
"storj.io/storj/satellite/metabase/metaloop"
"storj.io/storj/satellite/metainfo"
"storj.io/storj/satellite/metainfo/expireddeletion"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metrics"
"storj.io/storj/satellite/orders"
"storj.io/storj/satellite/overlay"

View File

@ -23,8 +23,8 @@ import (
"storj.io/storj/private/lifecycle"
version_checker "storj.io/storj/private/version/checker"
"storj.io/storj/satellite/gc"
"storj.io/storj/satellite/metabase/metaloop"
"storj.io/storj/satellite/metainfo"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/overlay"
)

View File

@ -13,7 +13,7 @@ import (
"storj.io/common/bloomfilter"
"storj.io/common/memory"
"storj.io/common/storj"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
)
var _ metaloop.Observer = (*PieceTracker)(nil)

View File

@ -16,7 +16,7 @@ import (
"storj.io/common/rpc"
"storj.io/common/storj"
"storj.io/common/sync2"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
"storj.io/storj/satellite/overlay"
"storj.io/uplink/private/piecestore"
)

View File

@ -13,7 +13,7 @@ import (
"storj.io/common/storj"
"storj.io/common/sync2"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
"storj.io/storj/satellite/overlay"
)

View File

@ -11,7 +11,7 @@ import (
"go.uber.org/zap"
"storj.io/common/storj"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
"storj.io/uplink/private/eestream"
)

View File

@ -239,11 +239,14 @@ func (loop *Service) Close() (err error) {
return nil
}
// monMetainfo is to preserve the monitoring names.
var monMetainfo = monkit.ScopeNamed("storj.io/storj/satellite/metainfo/metaloop")
// RunOnce goes through metainfo one time and sends information to observers.
//
// It is not safe to call this concurrently with Run.
func (loop *Service) RunOnce(ctx context.Context) (err error) {
defer mon.Task()(&ctx)(&err) //mon:locked
defer monMetainfo.Task()(&ctx)(&err) //mon:locked
var observers []*observerContext
@ -355,7 +358,7 @@ func iterateObjects(ctx context.Context, metabaseDB MetabaseDB, observers []*obs
}
objectsProcessed++
mon.IntVal("objectsProcessed").Observe(objectsProcessed) //mon:locked
monMetainfo.IntVal("objectsProcessed").Observe(objectsProcessed) //mon:locked
for {
// if context has been canceled exit. Otherwise, continue
@ -383,7 +386,7 @@ func iterateObjects(ctx context.Context, metabaseDB MetabaseDB, observers []*obs
}
segmentsProcessed++
mon.IntVal("segmentsProcessed").Observe(segmentsProcessed) //mon:locked
monMetainfo.IntVal("segmentsProcessed").Observe(segmentsProcessed) //mon:locked
}
@ -420,7 +423,7 @@ func iterateObjects(ctx context.Context, metabaseDB MetabaseDB, observers []*obs
}
timer.Stop()
mon.IntVal("objectsIterated").Observe(objectsIterated) //mon:locked
monMetainfo.IntVal("objectsIterated").Observe(objectsIterated) //mon:locked
objectsProcessed++
objectsMap[entry.StreamID] = entry

View File

@ -24,7 +24,7 @@ import (
"storj.io/storj/private/testplanet"
"storj.io/storj/satellite"
"storj.io/storj/satellite/metabase"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
"storj.io/uplink/private/multipart"
)

View File

@ -18,7 +18,7 @@ import (
"storj.io/common/uuid"
"storj.io/storj/private/dbutil"
"storj.io/storj/satellite/metabase"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
"storj.io/storj/satellite/metainfo/piecedeletion"
)

View File

@ -12,7 +12,7 @@ import (
"go.uber.org/zap"
"storj.io/common/sync2"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
)
var (

View File

@ -7,7 +7,7 @@ import (
"context"
"storj.io/common/uuid"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/metabase/metaloop"
)
// Counter implements the metainfo loop observer interface for data science metrics collection.

View File

@ -18,8 +18,8 @@ import (
"storj.io/common/sync2"
"storj.io/storj/satellite/internalpb"
"storj.io/storj/satellite/metabase"
"storj.io/storj/satellite/metabase/metaloop"
"storj.io/storj/satellite/metainfo"
"storj.io/storj/satellite/metainfo/metaloop"
"storj.io/storj/satellite/overlay"
"storj.io/storj/satellite/repair"
"storj.io/storj/satellite/repair/irreparable"