Skip to content

Commit def478c

Browse files
committed
store/copr: error on fulltext retry
1 parent 2ab51df commit def478c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

pkg/store/copr/batch_coprocessor.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,11 @@ func (b *batchCopIterator) handleTask(ctx context.Context, bo *Backoffer, task *
14071407

14081408
// Merge all ranges and request again.
14091409
func (b *batchCopIterator) retryBatchCopTask(ctx context.Context, bo *backoff.Backoffer, batchTask *batchCopTask) ([]*batchCopTask, error) {
1410+
// FullText batch cop tasks contain TableShardInfos only. They don't have regionInfos/PartitionTableRegions, so we
1411+
// cannot retry by rebuilding tasks with regions; return an error instead of silently producing an empty task set.
1412+
if batchTask.TableShardInfos != nil {
1413+
return nil, errors.New("tiflash_fts node is unavailable")
1414+
}
14101415
if batchTask.regionInfos != nil {
14111416
var ranges []kv.KeyRange
14121417
for _, ri := range batchTask.regionInfos {

pkg/store/copr/batch_coprocessor_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
"github.com/pingcap/errors"
2727
"github.com/pingcap/failpoint"
28+
"github.com/pingcap/kvproto/pkg/coprocessor"
2829
"github.com/pingcap/kvproto/pkg/metapb"
2930
"github.com/pingcap/tidb/pkg/kv"
3031
"github.com/pingcap/tidb/pkg/store/driver/backoff"
@@ -138,6 +139,18 @@ func TestBalanceBatchCopTaskWithEmptyTaskSet(t *testing.T) {
138139
}
139140
}
140141

142+
func TestRetryBatchCopTaskForFullTextReturnsError(t *testing.T) {
143+
it := &batchCopIterator{}
144+
bo := backoff.NewBackofferWithVars(context.Background(), 1, nil)
145+
task := &batchCopTask{
146+
TableShardInfos: []*coprocessor.TableShardInfos{{}},
147+
}
148+
ret, err := it.retryBatchCopTask(context.Background(), bo, task)
149+
require.Nil(t, ret)
150+
require.Error(t, err)
151+
require.Contains(t, err.Error(), "tiflash_fts node is unavailable")
152+
}
153+
141154
func TestDeepCopyStoreTaskMap(t *testing.T) {
142155
storeTasks1 := buildStoreTaskMap(10)
143156
for _, task := range storeTasks1 {

0 commit comments

Comments
 (0)