Skip to content

Commit

Permalink
support to ignore error when delete a task
Browse files Browse the repository at this point in the history
  • Loading branch information
SimFG committed Dec 4, 2024
1 parent f0f4597 commit 369b60f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions core/reader/replicate_channel_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ func (r *replicateChannelManager) AddPartition(ctx context.Context, dbInfo *mode
func (r *replicateChannelManager) StopReadCollection(ctx context.Context, info *pb.CollectionInfo) error {
for _, channel := range info.GetPhysicalChannelNames() {
handler := r.stopReadChannel(channel, info.ID)
if handler == nil {
continue
}
handler.Close()
}
r.collectionLock.Lock()
Expand Down
3 changes: 3 additions & 0 deletions server/cdc_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,9 @@ func (e *MetaCDC) Delete(req *request.DeleteRequest) (*request.DeleteResponse, e
_, ok := e.cdcTasks.data[req.TaskID]
e.cdcTasks.RUnlock()
if !ok {
if req.IgnoreNotFound {
return &request.DeleteResponse{}, nil
}
return nil, servererror.NewClientError("not found the task, task_id: " + req.TaskID)
}

Expand Down
3 changes: 2 additions & 1 deletion server/model/request/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ package request

//go:generate easytags $GOFILE json,mapstructure
type DeleteRequest struct {
TaskID string `json:"task_id" mapstructure:"task_id"`
TaskID string `json:"task_id" mapstructure:"task_id"`
IgnoreNotFound bool `json:"ignore_not_found" mapstructure:"ignore_not_found"`
}

type DeleteResponse struct{}

0 comments on commit 369b60f

Please sign in to comment.