Skip to content

Commit 5d8558e

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 eb1e3d2 commit 5d8558e

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
@@ -532,6 +532,8 @@ enum ShardState {
532532
// Shared definition used by the collection meta, the rootcoord responses and
533533
// the in-memory routing tables.
534534
message CollectionShardInfo {
535+
// The time tick up to which this shard's WAL has been truncated; 0 when the
536+
// shard has never been truncated. Unrelated to routing.
535537
uint64 last_truncate_time_tick = 1;
536538
ShardState state = 2;
537539
// The shard's own vchannel name. Carried explicitly so a consumer can key a
@@ -544,10 +546,14 @@ message CollectionShardInfo {
544546
// not mistake another concurrent split's targets for its own). Empty unless
545547
// this shard is an in-progress split target.
546548
string source_vchannel = 6;
547-
// The routing predicate of this shard. The variant matches the collection's
548-
// routing_mode. A shard may own more than one piece (e.g. the cold remainder
549-
// after a hot tenant in the middle is carved out into its own shard), so each
550-
// variant carries a list; the lists of all shards tile the key space exactly.
549+
// The routing predicate of this shard. The variant is expected to match the
550+
// collection's routing_mode, but proto cannot enforce that agreement, and the
551+
// oneof may be unset on the wire (e.g. a legacy/hash-routed shard, which needs
552+
// no predicate); consumers must defend against an unset routing and not assume
553+
// the variant from routing_mode alone. A shard may own more than one piece
554+
// (e.g. the cold remainder after a hot tenant in the middle is carved out into
555+
// its own shard), so each variant carries a list; the lists of all shards tile
556+
// the key space exactly.
551557
oneof routing {
552558
RangeRouting range_routing = 3;
553559
HashRouting hash_routing = 4;
@@ -561,8 +567,12 @@ message RangeRouting {
561567
repeated RoutingKeyRange ranges = 1;
562568
}
563569

564-
// RoutingKeyRange is a half-open routing-key range [lower, upper). A nil bound
565-
// is unbounded (lower nil = -inf, upper nil = +inf).
570+
// RoutingKeyRange is a half-open routing-key range [lower, upper). A bound is
571+
// unbounded when it has length zero: an empty lower is -inf, an empty upper is
572+
// +inf. proto3 scalar bytes carry no field presence, so an unset bound and an
573+
// explicitly-empty []byte{} are indistinguishable on the wire and are both
574+
// treated as unbounded; consumers MUST test len(bound)==0, and the type cannot
575+
// represent an exactly-empty (zero-length, but present) bound.
566576
message RoutingKeyRange {
567577
bytes lower = 1;
568578
bytes upper = 2;

0 commit comments

Comments
 (0)