Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

conn: fix inaccurate region count #127

Merged
merged 3 commits into from
Dec 24, 2019
Merged
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion pkg/conn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/pingcap/tidb/domain"
"github.com/pingcap/tidb/session"
"github.com/pingcap/tidb/store/tikv"
"github.com/pingcap/tidb/util/codec"
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
Expand Down Expand Up @@ -182,7 +183,9 @@ func (mgr *Mgr) getRegionCountWith(
query := fmt.Sprintf(
"%s?start_key=%s&end_key=%s",
regionCountPrefix,
url.QueryEscape(string(startKey)), url.QueryEscape(string(endKey)))
// TiKV reports region start/end keys to PD in memcomparable-format.
url.QueryEscape(string(codec.EncodeBytes(nil, startKey))),
url.QueryEscape(string(codec.EncodeBytes(nil, endKey))))
v, e := get(ctx, addr, query, mgr.pdHTTP.cli)
if e != nil {
err = e
Expand Down