Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Compressor: backup vectors in queue using PostStop function #345

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/vald/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ compressor:
# compressor.revisionHistoryLimit -- number of old history to retain to allow rollback
revisionHistoryLimit: 2
# compressor.terminationGracePeriodSeconds -- duration in seconds pod needs to terminate gracefully
terminationGracePeriodSeconds: 30
terminationGracePeriodSeconds: 120
podPriority:
# compressor.podPriority.enabled -- compressor pod PriorityClass enabled
enabled: true
Expand Down
10 changes: 5 additions & 5 deletions pkg/manager/compressor/service/registerer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
type Registerer interface {
PreStart(ctx context.Context) error
Start(ctx context.Context) (<-chan error, error)
PreStop(ctx context.Context) error
PostStop(ctx context.Context) error
Register(ctx context.Context, meta *payload.Backup_MetaVector) error
RegisterMulti(ctx context.Context, metas *payload.Backup_MetaVectors) error
Len() uint64
Expand Down Expand Up @@ -75,8 +75,8 @@ func (r *registerer) Start(ctx context.Context) (<-chan error, error) {
return r.worker.Start(ctx)
}

func (r *registerer) PreStop(ctx context.Context) error {
log.Info("compressor registerer service prestop processing...")
func (r *registerer) PostStop(ctx context.Context) error {
log.Info("compressor registerer service poststop processing...")

r.worker.Pause()

Expand Down Expand Up @@ -104,11 +104,11 @@ func (r *registerer) PreStop(ctx context.Context) error {

err = r.forwardMetas(ctx)
if err != nil {
log.Errorf("compressor registerer service prestop failed: %v", err)
log.Errorf("compressor registerer service poststop failed: %v", err)
return err
}

log.Info("compressor registerer service prestop completed")
log.Info("compressor registerer service poststop completed")

return nil
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/manager/compressor/usecase/compressord.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,6 @@ func (r *run) Start(ctx context.Context) (<-chan error, error) {
}

func (r *run) PreStop(ctx context.Context) error {
if r.registerer != nil {
return r.registerer.PreStop(ctx)
}
return nil
}

Expand All @@ -308,5 +305,8 @@ func (r *run) Stop(ctx context.Context) error {
}

func (r *run) PostStop(ctx context.Context) error {
if r.registerer != nil {
return r.registerer.PostStop(ctx)
}
return nil
}