Remove period shard maintenance goroutine
This is no longer used in tsm and just peridocially locks everything for no reason now.pull/5963/head
parent
ae2360df7c
commit
992c78ee22
|
@ -38,9 +38,6 @@ type Engine interface {
|
|||
DeleteMeasurement(name string, seriesKeys []string) error
|
||||
SeriesCount() (n int, err error)
|
||||
|
||||
// PerformMaintenance will get called periodically by the store
|
||||
PerformMaintenance()
|
||||
|
||||
// Format will return the format for the engine
|
||||
Format() EngineFormat
|
||||
|
||||
|
|
|
@ -102,10 +102,6 @@ func NewEngine(path string, walPath string, opt tsdb.EngineOptions) tsdb.Engine
|
|||
// Path returns the path the engine was opened with.
|
||||
func (e *Engine) Path() string { return e.path }
|
||||
|
||||
// PerformMaintenance is for periodic maintenance of the store. A no-op for b1
|
||||
func (e *Engine) PerformMaintenance() {
|
||||
}
|
||||
|
||||
// Index returns the database index.
|
||||
func (e *Engine) Index() *tsdb.DatabaseIndex {
|
||||
e.mu.Lock()
|
||||
|
|
|
@ -122,12 +122,6 @@ func NewShard(id uint64, index *DatabaseIndex, path string, walPath string, opti
|
|||
// Path returns the path set on the shard when it was created.
|
||||
func (s *Shard) Path() string { return s.path }
|
||||
|
||||
// PerformMaintenance gets called periodically to have the engine perform
|
||||
// any maintenance tasks like WAL flushing and compaction
|
||||
func (s *Shard) PerformMaintenance() {
|
||||
s.engine.PerformMaintenance()
|
||||
}
|
||||
|
||||
// Open initializes and opens the shard's store.
|
||||
func (s *Shard) Open() error {
|
||||
if err := func() error {
|
||||
|
|
|
@ -90,7 +90,6 @@ func (s *Store) Open() error {
|
|||
return err
|
||||
}
|
||||
|
||||
go s.periodicMaintenance()
|
||||
s.opened = true
|
||||
|
||||
return nil
|
||||
|
@ -567,41 +566,6 @@ func (s *Store) deleteSeries(database string, seriesKeys []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// periodicMaintenance is the method called in a goroutine on the opening of the store
|
||||
// to perform periodic maintenance of the shards.
|
||||
func (s *Store) periodicMaintenance() {
|
||||
t := time.NewTicker(maintenanceCheckInterval)
|
||||
for {
|
||||
select {
|
||||
case <-t.C:
|
||||
s.performMaintenance()
|
||||
case <-s.closing:
|
||||
t.Stop()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// performMaintenance loops through shards and executes any maintenance
|
||||
// tasks. Those tasks should run in their own goroutines if they will
|
||||
// take significant time.
|
||||
func (s *Store) performMaintenance() {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
for _, sh := range s.shards {
|
||||
s.performMaintenanceOnShard(sh)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Store) performMaintenanceOnShard(shard *Shard) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
s.Logger.Printf("recovered error in maintenance on shard %d", shard.id)
|
||||
}
|
||||
}()
|
||||
shard.PerformMaintenance()
|
||||
}
|
||||
|
||||
// ExpandSources expands regex sources and removes duplicates.
|
||||
// NOTE: sources must be normalized (db and rp set) before calling this function.
|
||||
func (s *Store) ExpandSources(sources influxql.Sources) (influxql.Sources, error) {
|
||||
|
|
Loading…
Reference in New Issue