Skip to content

Commit

Permalink
cluster/store: start compaction loop when Opening store
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest committed Feb 29, 2024
1 parent 363fe1b commit f9c0151
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions internal/cluster/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,6 @@ type Store struct {
peersInfoPath string
dbPath string

restorePath string
restoreDoneCh chan struct{}

raft *raft.Raft // The consensus mechanism.
ly Layer
raftTn *NodeTransport
Expand Down Expand Up @@ -258,14 +255,14 @@ func NewStore(base *v1.Config, ly Layer) (*Store, error) {
uint64(base.GranuleSize),
),
)

return &Store{
ly: ly,
raftDir: base.Data,
snapshotDir: filepath.Join(base.Data, snapshotsDirName),
peersPath: filepath.Join(base.Data, peersPath),
peersInfoPath: filepath.Join(base.Data, peersInfoPath),
dbPath: filepath.Join(base.Data, dbName),
restoreDoneCh: make(chan struct{}),
logger: slog.Default().With("component", "store"),
notifyingNodes: make(map[string]*v1.Server),
ApplyTimeout: applyTimeout,
Expand All @@ -274,7 +271,7 @@ func NewStore(base *v1.Config, ly Layer) (*Store, error) {
}, nil
}

func (s *Store) Open() error {
func (s *Store) Open(ctx context.Context) error {
if s.open.Is() {
return ErrOpen
}
Expand Down Expand Up @@ -349,6 +346,7 @@ func (s *Store) Open() error {
return fmt.Errorf("creating the raft system failed: %s", err)
}
s.raft = ra
s.session.Start(ctx)
return nil
}

Expand Down

0 comments on commit f9c0151

Please sign in to comment.