Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 6 additions & 6 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7247,13 +7247,13 @@ def go_deps():
build_tags = ["nextgen"],
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/pd/client",
sha256 = "8871f66bba0f4b2c1eaa3ddf1c0347d664f0cf89a50d6466a1a79b2577ad9c06",
strip_prefix = "github.com/tikv/pd/client@v0.0.0-20250611122655-29ead019cd09",
sha256 = "92ee1112ed270cdd4a3d1e40c32b8b9ea8d091d5efc95dd23c9dfc2393ab1441",
strip_prefix = "github.com/tikv/pd/client@v0.0.0-20250623084542-60788950a745",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20250611122655-29ead019cd09.zip",
"http://ats.apps.svc/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20250611122655-29ead019cd09.zip",
"https://cache.hawkingrei.com/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20250611122655-29ead019cd09.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20250611122655-29ead019cd09.zip",
"http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20250623084542-60788950a745.zip",
"http://ats.apps.svc/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20250623084542-60788950a745.zip",
"https://cache.hawkingrei.com/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20250623084542-60788950a745.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20250623084542-60788950a745.zip",
],
)
go_repository(
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ require (
github.com/tdakkota/asciicheck v0.4.1
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2
github.com/tikv/client-go/v2 v2.0.8-0.20250609073940-74c0a811505b
github.com/tikv/pd/client v0.0.0-20250611122655-29ead019cd09
github.com/tikv/pd/client v0.0.0-20250623084542-60788950a745
github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67
github.com/twmb/murmur3 v1.1.6
github.com/uber/jaeger-client-go v2.22.1+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,8 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
github.com/tikv/client-go/v2 v2.0.8-0.20250609073940-74c0a811505b h1:sgHt/P+UubqoqMlaNxlDvrfAM1F+WtXN60ViPg+zNhs=
github.com/tikv/client-go/v2 v2.0.8-0.20250609073940-74c0a811505b/go.mod h1:SWsAhPA9u76Zu5/jzzn+ad5Aj8PnCm2JM50KYCbLLTQ=
github.com/tikv/pd/client v0.0.0-20250611122655-29ead019cd09 h1:UuP58hQGvbdKxvsC2l1zqJmQu4xxMTgwGi8Sd8nLX1A=
github.com/tikv/pd/client v0.0.0-20250611122655-29ead019cd09/go.mod h1:yc63HG/FHgJNvfDPqMOciMtOju1QDYaxajqyN6rnFX0=
github.com/tikv/pd/client v0.0.0-20250623084542-60788950a745 h1:p6kmQprZcw3qC6yljdE/hPzkDULYH65v9BJJJp1doxs=
github.com/tikv/pd/client v0.0.0-20250623084542-60788950a745/go.mod h1:yc63HG/FHgJNvfDPqMOciMtOju1QDYaxajqyN6rnFX0=
github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67 h1:9LPGD+jzxMlnk5r6+hJnar67cgpDIz/iyD+rfl5r2Vk=
github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67/go.mod h1:mkjARE7Yr8qU23YcGMSALbIxTQ9r9QBVahQOBRfU460=
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
Expand Down
27 changes: 23 additions & 4 deletions pkg/domain/infosync/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ type InfoSyncer struct {
tiflashReplicaManager TiFlashReplicaManager
resourceManagerClient pd.ResourceManagerClient
infoCache infoschemaMinTS
tikvCodec tikv.Codec
}

// ServerInfo represents the server's basic information.
Expand Down Expand Up @@ -265,6 +266,7 @@ func GlobalInfoSyncerInit(
serverInfoPath: fmt.Sprintf("%s/%s", ServerInformationPath, id),
minStartTSPath: fmt.Sprintf("%s/%s", ServerMinStartTSPath, id),
infoCache: infoCache,
tikvCodec: codec,
}
is.info.Store(getServerInfo(id, serverIDGetter))
err := is.init(ctx, skipRegisterToDashBoard)
Expand Down Expand Up @@ -785,22 +787,39 @@ func (is *InfoSyncer) GetMinStartTS() uint64 {
return is.minStartTS
}

func (is *InfoSyncer) getEtcdClientForMinStartTS() *clientv3.Client {
// Note: this is a temporary implementation.
// In our future refactor plan, the SafePointKV and TiDB min start ts will be completely removed.

// Ignore nil tikvCodec, which may happen in some tests.
if is.tikvCodec == nil {
return is.unprefixedEtcdCli
}

if pd.IsKeyspaceUsingKeyspaceLevelGC(is.tikvCodec.GetKeyspaceMeta()) {
return is.etcdCli
}
return is.unprefixedEtcdCli
}

// storeMinStartTS stores self server min start timestamp to etcd.
func (is *InfoSyncer) storeMinStartTS(ctx context.Context) error {
if is.unprefixedEtcdCli == nil {
cli := is.getEtcdClientForMinStartTS()
if cli == nil {
return nil
}
return util.PutKVToEtcd(ctx, is.unprefixedEtcdCli, keyOpDefaultRetryCnt, is.minStartTSPath,
return util.PutKVToEtcd(ctx, cli, keyOpDefaultRetryCnt, is.minStartTSPath,
strconv.FormatUint(is.minStartTS, 10),
clientv3.WithLease(is.session.Lease()))
}

// RemoveMinStartTS removes self server min start timestamp from etcd.
func (is *InfoSyncer) RemoveMinStartTS() {
if is.unprefixedEtcdCli == nil {
cli := is.getEtcdClientForMinStartTS()
if cli == nil {
return
}
err := util.DeleteKeyFromEtcd(is.minStartTSPath, is.unprefixedEtcdCli, keyOpDefaultRetryCnt, keyOpDefaultTimeout)
err := util.DeleteKeyFromEtcd(is.minStartTSPath, cli, keyOpDefaultRetryCnt, keyOpDefaultTimeout)
if err != nil {
logutil.BgLogger().Error("remove minStartTS failed", zap.Error(err))
}
Expand Down