satellite/metabase/metaloop: add as of system interval to stats
Table stats query should use AS OF SYSTEM INTERVAL in the query to optimize the behavior. Change-Id: Ie14f5441062d3d264bb3c626081e77d6edc7b724
This commit is contained in:
parent
9640cc2c06
commit
5f901c8066
@ -164,7 +164,7 @@ type Config struct {
|
|||||||
RateLimit float64 `help:"rate limit (default is 0 which is unlimited segments per second)" default:"0"`
|
RateLimit float64 `help:"rate limit (default is 0 which is unlimited segments per second)" default:"0"`
|
||||||
ListLimit int `help:"how many items to query in a batch" default:"2500" testDefault:"10000"`
|
ListLimit int `help:"how many items to query in a batch" default:"2500" testDefault:"10000"`
|
||||||
|
|
||||||
AsOfSystemInterval time.Duration `help:"as of system interval" default:"-5m"`
|
AsOfSystemInterval time.Duration `help:"as of system interval" releaseDefault:"-5m" devDefault:"-1us" testDefault:"-1us"`
|
||||||
|
|
||||||
SuspiciousProcessedRatio float64 `help:"ratio where to consider processed count as supicious" default:"0.03"`
|
SuspiciousProcessedRatio float64 `help:"ratio where to consider processed count as supicious" default:"0.03"`
|
||||||
}
|
}
|
||||||
@ -368,7 +368,9 @@ func (loop *Service) iterateDatabase(ctx context.Context, observers []*observerC
|
|||||||
finishObservers(observers)
|
finishObservers(observers)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
before, err := loop.metabaseDB.GetTableStats(ctx, metabase.GetTableStats{})
|
before, err := loop.metabaseDB.GetTableStats(ctx, metabase.GetTableStats{
|
||||||
|
AsOfSystemInterval: loop.config.AsOfSystemInterval,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
@ -382,7 +384,9 @@ func (loop *Service) iterateDatabase(ctx context.Context, observers []*observerC
|
|||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
after, err := loop.metabaseDB.GetTableStats(ctx, metabase.GetTableStats{})
|
after, err := loop.metabaseDB.GetTableStats(ctx, metabase.GetTableStats{
|
||||||
|
AsOfSystemInterval: loop.config.AsOfSystemInterval,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ type Config struct {
|
|||||||
RateLimit float64 `help:"rate limit (default is 0 which is unlimited segments per second)" default:"0"`
|
RateLimit float64 `help:"rate limit (default is 0 which is unlimited segments per second)" default:"0"`
|
||||||
ListLimit int `help:"how many items to query in a batch" default:"2500"`
|
ListLimit int `help:"how many items to query in a batch" default:"2500"`
|
||||||
|
|
||||||
AsOfSystemInterval time.Duration `help:"as of system interval" default:"-5m"`
|
AsOfSystemInterval time.Duration `help:"as of system interval" releaseDefault:"-5m" devDefault:"-1us" testDefault:"-1us"`
|
||||||
|
|
||||||
SuspiciousProcessedRatio float64 `help:"ratio where to consider processed count as supicious" default:"0.03"`
|
SuspiciousProcessedRatio float64 `help:"ratio where to consider processed count as supicious" default:"0.03"`
|
||||||
}
|
}
|
||||||
@ -339,7 +339,9 @@ func (loop *Service) iterateDatabase(ctx context.Context, observers []*observerC
|
|||||||
finishObservers(observers)
|
finishObservers(observers)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
before, err := loop.metabaseDB.GetTableStats(ctx, metabase.GetTableStats{})
|
before, err := loop.metabaseDB.GetTableStats(ctx, metabase.GetTableStats{
|
||||||
|
AsOfSystemInterval: loop.config.AsOfSystemInterval,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
@ -353,7 +355,9 @@ func (loop *Service) iterateDatabase(ctx context.Context, observers []*observerC
|
|||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
after, err := loop.metabaseDB.GetTableStats(ctx, metabase.GetTableStats{})
|
after, err := loop.metabaseDB.GetTableStats(ctx, metabase.GetTableStats{
|
||||||
|
AsOfSystemInterval: loop.config.AsOfSystemInterval,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Error.Wrap(err)
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user