Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
tangenta committed Apr 16, 2024
1 parent d1d2ec3 commit 7468d06
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions pkg/ddl/backfilling_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,14 @@ type indexIngestExternalWorker struct {
}

func (w *indexIngestExternalWorker) HandleTask(rs IndexRecordChunk, send func(IndexWriteResult)) {
defer w.indexIngestBaseWorker.recoverFromPanic(rs)
defer tidbutil.Recover(metrics.LblAddIndex, "indexIngestExternalWorkerRecover", func() {
w.ctx.onError(errors.New("met panic in indexIngestExternalWorker"))
}, false)
defer func() {
if rs.Chunk != nil {
w.srcChunkPool <- rs.Chunk
}
}()
w.indexIngestBaseWorker.HandleTask(rs, send)
}

Expand All @@ -638,7 +645,14 @@ type indexIngestLocalWorker struct {
}

func (w *indexIngestLocalWorker) HandleTask(rs IndexRecordChunk, send func(IndexWriteResult)) {
defer w.indexIngestBaseWorker.recoverFromPanic(rs)
defer tidbutil.Recover(metrics.LblAddIndex, "indexIngestLocalWorkerRecover", func() {
w.ctx.onError(errors.New("met panic in indexIngestLocalWorker"))
}, false)
defer func() {
if rs.Chunk != nil {
w.srcChunkPool <- rs.Chunk
}
}()
w.indexIngestBaseWorker.HandleTask(rs, send)
// needs to flush and import to avoid too much use of disk.
_, _, _, err := ingest.TryFlushAllIndexes(w.backendCtx, ingest.FlushModeAuto, w.indexIDs)
Expand All @@ -664,15 +678,6 @@ type indexIngestBaseWorker struct {
srcChunkPool chan *chunk.Chunk
}

func (w *indexIngestBaseWorker) recoverFromPanic(rs IndexRecordChunk) {
tidbutil.Recover(metrics.LblAddIndex, "handleIndexIngtestTaskWithRecover", func() {
w.ctx.onError(errors.New("met panic in indexIngestBaseWorker"))
}, false)
if rs.Chunk != nil {
w.srcChunkPool <- rs.Chunk
}
}

func (w *indexIngestBaseWorker) HandleTask(rs IndexRecordChunk, send func(IndexWriteResult)) {
failpoint.Inject("injectPanicForIndexIngest", func() {
panic("mock panic")
Expand Down

0 comments on commit 7468d06

Please sign in to comment.