Skip to content

Commit

Permalink
store/copr: fix cannot find tiflash_compute node (pingcap#313)
Browse files Browse the repository at this point in the history
* store/copr: fix cannot find tiflash_compute node

Signed-off-by: guo-shaoge <[email protected]>
  • Loading branch information
guo-shaoge authored Mar 14, 2023
1 parent ba65916 commit 5fda872
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion store/copr/batch_coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ func filterAliveStoresHelper(ctx context.Context, stores []string, ttl time.Dura

func getTiFlashComputeRPCContextByConsistentHash(ids []tikv.RegionVerID, storesStr []string) (res []*tikv.RPCContext, err error) {
hasher := consistent.New()
hasher.NumberOfReplicas = 200
for _, addr := range storesStr {
hasher.Add(addr)
}
Expand Down Expand Up @@ -1313,11 +1314,15 @@ func buildBatchCopTasksConsistentHashForPD(bo *backoff.Backoffer,
}
getStoreElapsed = time.Since(getStoreStart)

storesStr := make([]string, 0, len(stores))
for _, s := range stores {
storesStr = append(storesStr, s.GetAddr())
}
var rpcCtxs []*tikv.RPCContext
if dispatchPolicy == tiflashcompute.DispatchPolicyRR {
rpcCtxs, err = getTiFlashComputeRPCContextByRoundRobin(regionIDs, stores)
} else if dispatchPolicy == tiflashcompute.DispatchPolicyConsistentHash {
rpcCtxs, err = cache.GetTiFlashComputeRPCContextByConsistentHash(bo.TiKVBackoffer(), regionIDs, stores)
rpcCtxs, err = getTiFlashComputeRPCContextByConsistentHash(regionIDs, storesStr)
} else {
err = errors.Errorf("unexpected dispatch policy %v", dispatchPolicy)
}
Expand Down

0 comments on commit 5fda872

Please sign in to comment.