Skip to content

add API V3 keyspace identity protos#1458

Open
disksing wants to merge 16 commits into
masterfrom
apiv3
Open

add API V3 keyspace identity protos#1458
disksing wants to merge 16 commits into
masterfrom
apiv3

Conversation

@disksing

Copy link
Copy Markdown
Contributor

Summary

  • Add public API V3 KeyspaceIdentity schema and wire it through KV, PD, TSO, keyspace, GC, and related tenant-scoped protobuf APIs.
  • Preserve legacy keyspace_id fields for V1/V2 compatibility while documenting V3 identity semantics.
  • Update generated bindings and proto metadata for downstream API V3 consumers.

Validation

  • make proto-fmt
  • go build ./pkg/...
  • go test ./pkg/...
  • make check reached the expected proto.lock change prompt
  • cargo check is still blocked locally by the known libz/Xcode header issue

Signed-off-by: disksing <i@disksing.com>
@ti-chi-bot ti-chi-bot Bot requested a review from henrybw April 30, 2026 16:25
@ti-chi-bot ti-chi-bot Bot added the size/XXL label Apr 30, 2026
@disksing disksing changed the title [codex] add API V3 keyspace identity protos add API V3 keyspace identity protos Apr 30, 2026
disksing added 5 commits May 1, 2026 09:54
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
# Conflicts:
#	pkg/kvrpcpb/kvrpcpb.pb.go
#	pkg/pdpb/pdpb.pb.go

Signed-off-by: disksing <i@disksing.com>
Comment thread proto/pdpb.proto Outdated
Comment thread proto/autoid.proto
Comment thread proto/keyspacepb.proto Outdated
Comment thread proto/pdpb.proto Outdated
Comment thread proto/pdpb.proto Outdated
Comment thread proto/pdpb.proto Outdated
Comment thread proto/tsopb.proto Outdated
Comment thread proto/tsopb.proto Outdated
Comment thread proto/keyspacepb.proto Outdated
disksing and others added 10 commits June 11, 2026 09:19
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
# Conflicts:
#	pkg/keyspacepb/keyspacepb.pb.go
#	proto/keyspacepb.proto
#	scripts/proto.lock
@ti-chi-bot

ti-chi-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cfzjywxk, rleungx, tiancaiamao, windtalker, yudongusa for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@disksing disksing marked this pull request as ready for review July 8, 2026 04:27
@ti-chi-bot ti-chi-bot Bot requested a review from 0xPoe July 8, 2026 04:27
Comment thread proto/kvrpcpb.proto
// The keyspace that the request is sent to.
// NOTE: This field is only meaningful while the api_version is V2.
uint32 keyspace_id = 32;
oneof keyspace {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this existing scalar field into a oneof is source-incompatible for generated Go users even though the wire tag is preserved. Context.KeyspaceId disappears, and downstream PD/TiDB/client-go code constructs or reads this field directly, so upgrading kvproto would break V1/V2 callers that do not use V3. The legacy scalar should stay as a normal field and keyspace_identity should be added alongside it, as was done for AutoIDRequest and KeyspaceMeta.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fair point. I originally kept keyspace_id as a normal field and added keyspace_identity alongside it to minimize downstream Go source changes. Later I changed it to oneof based on review feedback, since semantically it is clearer that only one keyspace identifier should be set.

I think both directions are reasonable: parallel fields are more source-compatible, while oneof is clearer semantically. @sunxiaoguang what do you think? If we prefer minimizing downstream changes for kvrpcpb.Context, I can change this back to the parallel-field style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants