Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
24 changes: 12 additions & 12 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5528,11 +5528,11 @@ def go_deps():
name = "com_github_pingcap_kvproto",
build_file_proto_mode = "disable_global",
importpath = "github.com/pingcap/kvproto",
sha256 = "c92084d6f9f39398a997ae0530e9e4a8acfc82b98ab17a1178c414293909f4fc",
strip_prefix = "github.com/pingcap/kvproto@v0.0.0-20260414083400-4388bfaaedab",
sha256 = "a3d3fd4f25b1de97c28f87b7faf4ba9fd86cae30b15e6007d76e66b6820089d7",
strip_prefix = "github.com/pingcap/kvproto@v0.0.0-20260601035955-b2b3bb492278",
urls = [
"https://cache.hawkingrei.com/gomod/github.com/pingcap/kvproto/com_github_pingcap_kvproto-v0.0.0-20260414083400-4388bfaaedab.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/pingcap/kvproto/com_github_pingcap_kvproto-v0.0.0-20260414083400-4388bfaaedab.zip",
"https://cache.hawkingrei.com/gomod/github.com/pingcap/kvproto/com_github_pingcap_kvproto-v0.0.0-20260601035955-b2b3bb492278.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/pingcap/kvproto/com_github_pingcap_kvproto-v0.0.0-20260601035955-b2b3bb492278.zip",
],
)
go_repository(
Expand Down Expand Up @@ -6596,23 +6596,23 @@ def go_deps():
build_tags = ["nextgen", "intest"],
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/client-go/v2",
sha256 = "c141a99a743835252241ccc913861f671f4aec654e4c5c1920ab1bdf4c3586b7",
strip_prefix = "github.com/tikv/client-go/v2@v2.0.8-0.20260511022933-fb7ee09992a7",
sha256 = "472a85fb7dccdeb0f69c6a96666a62fb41dacb73c15415707f323b9e82ba8378",
strip_prefix = "github.com/tikv/client-go/v2@v2.0.8-0.20260602013621-8804d7c60a7e",
urls = [
"https://cache.hawkingrei.com/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20260511022933-fb7ee09992a7.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20260511022933-fb7ee09992a7.zip",
"https://cache.hawkingrei.com/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20260602013621-8804d7c60a7e.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20260602013621-8804d7c60a7e.zip",
],
)
go_repository(
name = "com_github_tikv_pd_client",
build_tags = ["nextgen", "intest"],
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/pd/client",
sha256 = "82bae6c124099e1dd0cc921c8512f5581ace19506f9ab816d0c8eda35a7d316b",
strip_prefix = "github.com/tikv/pd/client@v0.0.0-20260404141330-8a6813497b52",
sha256 = "8f82128d68f3765fc4d71fa69b7f537cee62173968544b360786d480d6b17230",
strip_prefix = "github.com/tikv/pd/client@v0.0.0-20260601035915-3ef6a3b10c84",
urls = [
"https://cache.hawkingrei.com/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20260404141330-8a6813497b52.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20260404141330-8a6813497b52.zip",
"https://cache.hawkingrei.com/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20260601035915-3ef6a3b10c84.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20260601035915-3ef6a3b10c84.zip",
],
)
go_repository(
Expand Down
4 changes: 2 additions & 2 deletions dumpling/export/util_for_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (m *mockGCStatesClient) DeleteGCBarrier(_ context.Context, _ string) (*pdgc
return nil, nil
}

func (m *mockGCStatesClient) GetGCState(_ context.Context) (pdgc.GCState, error) {
func (m *mockGCStatesClient) GetGCState(_ context.Context, _ ...pdgc.GCStatesAPIOption) (pdgc.GCState, error) {
return pdgc.GCState{}, nil
}

Expand All @@ -57,7 +57,7 @@ func (m *mockGCStatesClient) DeleteGlobalGCBarrier(_ context.Context, _ string)
return nil, nil
}

func (m *mockGCStatesClient) GetAllKeyspacesGCStates(_ context.Context) (pdgc.ClusterGCStates, error) {
func (m *mockGCStatesClient) GetAllKeyspacesGCStates(_ context.Context, _ ...pdgc.GCStatesAPIOption) (pdgc.ClusterGCStates, error) {
return pdgc.ClusterGCStates{}, nil
}

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ require (
github.com/pingcap/errors v0.11.5-0.20260508054701-306e305bcf41
github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86
github.com/pingcap/fn v1.0.0
github.com/pingcap/kvproto v0.0.0-20260414083400-4388bfaaedab
github.com/pingcap/kvproto v0.0.0-20260601035955-b2b3bb492278
github.com/pingcap/log v1.1.1-0.20250917021125-19901e015dc9
github.com/pingcap/metering_sdk v0.0.0-20260324055927-14fead745f1d
github.com/pingcap/sysutil v1.0.1-0.20240311050922-ae81ee01f3a5
Expand All @@ -123,8 +123,8 @@ require (
github.com/stathat/consistent v1.0.0
github.com/stretchr/testify v1.11.1
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2
github.com/tikv/client-go/v2 v2.0.8-0.20260511022933-fb7ee09992a7
github.com/tikv/pd/client v0.0.0-20260404141330-8a6813497b52
github.com/tikv/client-go/v2 v2.0.8-0.20260602013621-8804d7c60a7e
github.com/tikv/pd/client v0.0.0-20260601035915-3ef6a3b10c84
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
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,8 @@ github.com/pingcap/fn v1.0.0/go.mod h1:u9WZ1ZiOD1RpNhcI42RucFh/lBuzTu6rw88a+oF2Z
github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989 h1:surzm05a8C9dN8dIUmo4Be2+pMRb6f55i+UIYrluu2E=
github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989/go.mod h1:O17XtbryoCJhkKGbT62+L2OlrniwqiGLSqrmdHCMzZw=
github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w=
github.com/pingcap/kvproto v0.0.0-20260414083400-4388bfaaedab h1:nZwtL+Fn+/EPaPby8D3b/elN2YNUZy1Mriuih/dwxqQ=
github.com/pingcap/kvproto v0.0.0-20260414083400-4388bfaaedab/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE=
github.com/pingcap/kvproto v0.0.0-20260601035955-b2b3bb492278 h1:VV03wSSG2XhOwhF79lvT88Z83lwzMT+aZHXrcCIN9B0=
github.com/pingcap/kvproto v0.0.0-20260601035955-b2b3bb492278/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE=
github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM=
github.com/pingcap/log v1.1.0/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=
github.com/pingcap/log v1.1.1-0.20250917021125-19901e015dc9 h1:qG9BSvlWFEE5otQGamuWedx9LRm0nrHvsQRQiW8SxEs=
Expand Down Expand Up @@ -893,10 +893,10 @@ github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
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.20260511022933-fb7ee09992a7 h1:DOYEd6c0WkPDO1RYIKVCEj771r8NGP5w9CWnOXIP7IU=
github.com/tikv/client-go/v2 v2.0.8-0.20260511022933-fb7ee09992a7/go.mod h1:rg9c3yf9lfQdj9rt5FvwRP9xDubUY6C9hyH4g9zFH1s=
github.com/tikv/pd/client v0.0.0-20260404141330-8a6813497b52 h1:fXIMowblD3qdfHXJYGJpe7SbBlTO4S9GPVZZvL3CPG8=
github.com/tikv/pd/client v0.0.0-20260404141330-8a6813497b52/go.mod h1:I2yRx/Yf8Y8kgM5f3VNp4a8fWpnjPC4TxWk554AY8bM=
github.com/tikv/client-go/v2 v2.0.8-0.20260602013621-8804d7c60a7e h1:uCI3pPDuqjG/HLCnj6neLKXviXUnQ46tAxNoq1NUato=
github.com/tikv/client-go/v2 v2.0.8-0.20260602013621-8804d7c60a7e/go.mod h1:VcMgE5O5f9aBgFrv7AQ3LGDNJ6Nlx7lJ+hmbkooC0YI=
github.com/tikv/pd/client v0.0.0-20260601035915-3ef6a3b10c84 h1:8gvjP484Hv4CNf4jKzdmQOm48hGP5wnEd86nrbVvn5o=
github.com/tikv/pd/client v0.0.0-20260601035915-3ef6a3b10c84/go.mod h1:GP9u8OBXqYQ6e43htjprZILrzn3tuogzkEEmmiNlzc4=
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/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
Expand Down
21 changes: 14 additions & 7 deletions pkg/store/mockstore/unistore/tikv/mock_pd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ func TestMockGCStatesManager(t *testing.T) {
ctl := m.GetGCInternalController(keyspaceID)
cli := m.GetGCStatesClient(keyspaceID)

s, err := cli.GetGCState(ctx)
s, err := cli.GetGCState(ctx, pdgc.ExcludeGCBarriers(false))
re.NoError(err)
re.Equal(uint64(0), s.GCSafePoint)
re.Equal(uint64(0), s.TxnSafePoint)
re.Empty(s.GCBarriers)
gcBarriers, err := s.GetGCBarriers()
re.NoError(err)
re.Empty(gcBarriers)

tspRes, err := ctl.AdvanceTxnSafePoint(ctx, 10)
re.NoError(err)
Expand All @@ -63,7 +65,9 @@ func TestMockGCStatesManager(t *testing.T) {
re.NoError(err)
re.Equal(uint64(9), s.GCSafePoint)
re.Equal(uint64(10), s.TxnSafePoint)
re.Empty(s.GCBarriers)
gcBarriers, err = s.GetGCBarriers()
re.NoError(err)
re.Empty(gcBarriers)

// Invalid arguments
_, err = cli.SetGCBarrier(ctx, "", 20, pdgc.TTLNeverExpire)
Expand All @@ -86,9 +90,10 @@ func TestMockGCStatesManager(t *testing.T) {
re.NoError(err)
re.Equal(uint64(9), s.GCSafePoint)
re.Equal(uint64(10), s.TxnSafePoint)
re.Len(s.GCBarriers, 1)
re.Equal("b2", s.GCBarriers[0].BarrierID)
re.Equal(uint64(25), s.GCBarriers[0].BarrierTS)
gcBarriers, err = s.GetGCBarriers()
re.Len(gcBarriers, 1)
re.Equal("b2", gcBarriers[0].BarrierID)
re.Equal(uint64(25), gcBarriers[0].BarrierTS)
Comment thread
coderabbitai[bot] marked this conversation as resolved.

tspRes, err = ctl.AdvanceTxnSafePoint(ctx, 30)
re.NoError(err)
Expand Down Expand Up @@ -117,6 +122,8 @@ func TestMockGCStatesManager(t *testing.T) {
re.NoError(err)
re.Equal(uint64(30), s.TxnSafePoint)
re.Equal(uint64(9), s.GCSafePoint)
re.Empty(s.GCBarriers)
gcBarriers, err = s.GetGCBarriers()
re.NoError(err)
re.Empty(gcBarriers)
}
}
19 changes: 10 additions & 9 deletions pkg/store/mockstore/unistore/tikv/mock_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -1229,27 +1229,28 @@ func (c gcStatesClient) DeleteGCBarrier(ctx context.Context, barrierID string) (
return c.inner.deleteGCBarrierImpl(ctx, c.keyspaceID, barrierID, startTime)
}

func (c gcStatesClient) GetGCState(ctx context.Context) (pdgc.GCState, error) {
func (c gcStatesClient) GetGCState(ctx context.Context, opts ...pdgc.GCStatesAPIOption) (pdgc.GCState, error) {
options := pdgc.DefaultGCStatesAPIOptions()
for _, o := range opts {
o(&options)
}

startTime := time.Now()

c.inner.mu.Lock()
defer c.inner.mu.Unlock()

internalState := c.inner.getGCState(c.keyspaceID)

res := pdgc.GCState{
KeyspaceID: c.keyspaceID,
TxnSafePoint: internalState.txnSafePoint,
GCSafePoint: internalState.gcSafePoint,
if options.ExcludeGCBarriers {
return pdgc.NewGCStateWithoutGCBarriers(c.keyspaceID, internalState.txnSafePoint, internalState.gcSafePoint), nil
}

gcBarriers := make([]*pdgc.GCBarrierInfo, 0, len(internalState.gcBarriers))
for barrierID, barrierTS := range internalState.gcBarriers {
gcBarriers = append(gcBarriers, pdgc.NewGCBarrierInfo(barrierID, barrierTS, pdgc.TTLNeverExpire, startTime))
}
res.GCBarriers = gcBarriers

return res, nil
return pdgc.NewGCStateWithGCBarriers(c.keyspaceID, internalState.txnSafePoint, internalState.gcSafePoint, gcBarriers), nil
}

func (c gcStatesClient) SetGlobalGCBarrier(ctx context.Context, barrierID string, barrierTS uint64, ttl time.Duration) (*pdgc.GlobalGCBarrierInfo, error) {
Expand All @@ -1260,6 +1261,6 @@ func (c gcStatesClient) DeleteGlobalGCBarrier(ctx context.Context, barrierID str
panic("unimplemented")
}

func (c gcStatesClient) GetAllKeyspacesGCStates(ctx context.Context) (pdgc.ClusterGCStates, error) {
func (c gcStatesClient) GetAllKeyspacesGCStates(ctx context.Context, opts ...pdgc.GCStatesAPIOption) (pdgc.ClusterGCStates, error) {
panic("unimplemented")
}
Loading