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

fix force flush timeout #16381

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
3 changes: 1 addition & 2 deletions pkg/vm/engine/tae/db/merge/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,9 @@ func (e *MergeExecutor) ExecuteFor(entry *catalog.TableEntry, policy Policy) {

factory := func(ctx *tasks.Context, txn txnif.AsyncTxn) (tasks.Task, error) {
task, err := jobs.NewMergeObjectsTask(ctx, txn, mobjs, e.rt, common.DefaultMaxOsizeObjMB*common.Const1MBytes)
task.AddObserver(e)
return task, err
}
task, err := e.rt.Scheduler.ScheduleMultiScopedTxnTask(nil, tasks.DataCompactionTask, scopes, factory)
task, err := e.rt.Scheduler.ScheduleMultiScopedTxnTaskWithObserver(nil, tasks.DataCompactionTask, scopes, factory, e)
if err != nil {
if err != tasks.ErrScheduleScopeConflict {
logutil.Infof("[Mergeblocks] Schedule error info=%v", err)
Expand Down
15 changes: 15 additions & 0 deletions pkg/vm/engine/tae/db/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/matrixorigin/matrixone/pkg/logutil"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/tasks"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/tasks/ops/base"
)

var (
Expand Down Expand Up @@ -100,6 +101,20 @@ func (s *taskScheduler) ScheduleMultiScopedTxnTask(
return
}

func (s *taskScheduler) ScheduleMultiScopedTxnTaskWithObserver(
ctx *tasks.Context,
taskType tasks.TaskType,
scopes []common.ID,
factory tasks.TxnTaskFactory,
observers ...base.Observer) (task tasks.Task, err error) {
task = NewScheduledTxnTask(ctx, s.db, taskType, scopes, factory)
for _, observer := range observers {
task.AddObserver(observer)
}
err = s.Schedule(task)
return
}

func (s *taskScheduler) CheckAsyncScopes(scopes []common.ID) (err error) {
dispatcher := s.Dispatchers[tasks.DataCompactionTask].(*asyncJobDispatcher)
dispatcher.Lock()
Expand Down
9 changes: 8 additions & 1 deletion pkg/vm/engine/tae/tables/jobs/flushobj.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,14 @@ func (task *flushObjTask) Execute(ctx context.Context) (err error) {
return err
}
if task.delta != nil {
_, err := writer.WriteTombstoneBatch(containers.ToCNBatch(task.delta))
cnBatch := containers.ToCNBatch(task.delta)
for _, vec := range cnBatch.Vecs {
if vec == nil {
// this task has been canceled
return nil
}
}
_, err := writer.WriteTombstoneBatch(cnBatch)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/vm/engine/tae/tasks/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type TaskScheduler interface {
Scheduler
ScheduleTxnTask(ctx *Context, taskType TaskType, factory TxnTaskFactory) (Task, error)
ScheduleMultiScopedTxnTask(ctx *Context, taskType TaskType, scopes []common.ID, factory TxnTaskFactory) (Task, error)
ScheduleMultiScopedTxnTaskWithObserver(ctx *Context, taskType TaskType, scopes []common.ID, factory TxnTaskFactory, observers ...iops.Observer) (Task, error)
ScheduleMultiScopedFn(ctx *Context, taskType TaskType, scopes []common.ID, fn FuncT) (Task, error)
ScheduleFn(ctx *Context, taskType TaskType, fn func() error) (Task, error)
ScheduleScopedFn(ctx *Context, taskType TaskType, scope *common.ID, fn func() error) (Task, error)
Expand Down
Loading