Skip to content

Commit bcbdc95

Browse files
xiaocai2333claude
andcommitted
Clarify routing-key range and shard-info docs (review notes)
Address the review notes on CollectionShardInfo / RoutingKeyRange: - RoutingKeyRange: document that an unbounded bound is len==0 (proto3 bytes have no presence, so unset and explicitly-empty are indistinguishable on the wire; consumers must test len(bound)==0 and the type cannot represent an exactly zero-length present bound). - CollectionShardInfo.last_truncate_time_tick: document its meaning. - CollectionShardInfo.routing oneof: note that proto cannot enforce agreement with routing_mode and the oneof may be unset, so consumers must defend against an unset routing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
1 parent a3d55d8 commit bcbdc95

2 files changed

Lines changed: 32 additions & 12 deletions

File tree

go-api/schemapb/schema.pb.go

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/schema.proto

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,8 @@ enum ShardState {
569569
// Shared definition used by the collection meta, the rootcoord responses and
570570
// the in-memory routing tables.
571571
message CollectionShardInfo {
572+
// The time tick up to which this shard's WAL has been truncated; 0 when the
573+
// shard has never been truncated. Unrelated to routing.
572574
uint64 last_truncate_time_tick = 1;
573575
ShardState state = 2;
574576
// The shard's own vchannel name. Carried explicitly so a consumer can key a
@@ -581,10 +583,14 @@ message CollectionShardInfo {
581583
// not mistake another concurrent split's targets for its own). Empty unless
582584
// this shard is an in-progress split target.
583585
string source_vchannel = 6;
584-
// The routing predicate of this shard. The variant matches the collection's
585-
// routing_mode. A shard may own more than one piece (e.g. the cold remainder
586-
// after a hot tenant in the middle is carved out into its own shard), so each
587-
// variant carries a list; the lists of all shards tile the key space exactly.
586+
// The routing predicate of this shard. The variant is expected to match the
587+
// collection's routing_mode, but proto cannot enforce that agreement, and the
588+
// oneof may be unset on the wire (e.g. a legacy/hash-routed shard, which needs
589+
// no predicate); consumers must defend against an unset routing and not assume
590+
// the variant from routing_mode alone. A shard may own more than one piece
591+
// (e.g. the cold remainder after a hot tenant in the middle is carved out into
592+
// its own shard), so each variant carries a list; the lists of all shards tile
593+
// the key space exactly.
588594
oneof routing {
589595
RangeRouting range_routing = 3;
590596
HashRouting hash_routing = 4;
@@ -598,8 +604,12 @@ message RangeRouting {
598604
repeated RoutingKeyRange ranges = 1;
599605
}
600606

601-
// RoutingKeyRange is a half-open routing-key range [lower, upper). A nil bound
602-
// is unbounded (lower nil = -inf, upper nil = +inf).
607+
// RoutingKeyRange is a half-open routing-key range [lower, upper). A bound is
608+
// unbounded when it has length zero: an empty lower is -inf, an empty upper is
609+
// +inf. proto3 scalar bytes carry no field presence, so an unset bound and an
610+
// explicitly-empty []byte{} are indistinguishable on the wire and are both
611+
// treated as unbounded; consumers MUST test len(bound)==0, and the type cannot
612+
// represent an exactly-empty (zero-length, but present) bound.
603613
message RoutingKeyRange {
604614
bytes lower = 1;
605615
bytes upper = 2;

0 commit comments

Comments
 (0)