This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch api/tag-field-ttl
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git

commit 82ceca1a20d0860cabf2dcf5d399352e24c98383
Author: Gao Hongtao <[email protected]>
AuthorDate: Thu Nov 27 10:30:25 2025 +0000

    Add stage_names field
    
    Add the field to TagFamilySpec, TagSpec, FieldSpec, and TraceTagSpec
    for lifecycle stage retention control
---
 api/proto/banyandb/common/v1/common.proto   |  1 +
 api/proto/banyandb/database/v1/schema.proto | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/api/proto/banyandb/common/v1/common.proto 
b/api/proto/banyandb/common/v1/common.proto
index 644b08de..f5a076bb 100644
--- a/api/proto/banyandb/common/v1/common.proto
+++ b/api/proto/banyandb/common/v1/common.proto
@@ -91,6 +91,7 @@ message LifecycleStage {
   uint32 replicas = 7;
 }
 
+
 message ResourceOpts {
   // shard_num is the number of shards
   uint32 shard_num = 1 [(validate.rules).uint32.gt = 0];
diff --git a/api/proto/banyandb/database/v1/schema.proto 
b/api/proto/banyandb/database/v1/schema.proto
index d2359418..0fa0af7e 100644
--- a/api/proto/banyandb/database/v1/schema.proto
+++ b/api/proto/banyandb/database/v1/schema.proto
@@ -42,11 +42,29 @@ message TagFamilySpec {
   string name = 1 [(validate.rules).string.min_len = 1];
   // tags defines accepted tags
   repeated TagSpec tags = 2 [(validate.rules).repeated.min_items = 1];
+  // stage_names defines which lifecycle stages this tag family is retained in.
+  // If empty, the tag family is retained in all stages.
+  // Each value must match the name of a LifecycleStage in the parent Group's 
ResourceOpts.
+  repeated string stage_names = 3;
 }
 
 message TagSpec {
   string name = 1 [(validate.rules).string.min_len = 1];
   TagType type = 2 [(validate.rules).enum.defined_only = true];
+  // stage_names defines which lifecycle stages this tag is retained in.
+  // Semantics with TagFamilySpec.stage_names:
+  // - If TagFamilySpec.stage_names is empty and TagSpec.stage_names is empty,
+  //   the tag is retained in all stages.
+  // - If TagFamilySpec.stage_names is non-empty and TagSpec.stage_names is 
empty,
+  //   the tag is retained in all stages listed in TagFamilySpec.stage_names.
+  // - If TagSpec.stage_names is non-empty, the tag is retained only in the
+  //   intersection of TagFamilySpec.stage_names (or all stages if that is 
empty)
+  //   and TagSpec.stage_names.
+  // - Implementations SHOULD validate that TagSpec.stage_names does not 
contain
+  //   stages outside TagFamilySpec.stage_names when the latter is non-empty 
and
+  //   reject such schemas as invalid.
+  // Each value must match the name of a LifecycleStage in the parent Group's 
ResourceOpts.
+  repeated string stage_names = 3;
 }
 
 // Stream intends to store streaming data, for example, traces or logs
@@ -97,6 +115,10 @@ message FieldSpec {
   EncodingMethod encoding_method = 3 [(validate.rules).enum.defined_only = 
true];
   // compression_method indicates how to compress data during writing
   CompressionMethod compression_method = 4 [(validate.rules).enum.defined_only 
= true];
+  // stage_names defines which lifecycle stages this field is retained in.
+  // If empty, the field is retained in all stages.
+  // Each value must match the name of a LifecycleStage in the parent Group's 
ResourceOpts.
+  repeated string stage_names = 5;
 }
 
 // Measure intends to store data point
@@ -226,6 +248,10 @@ message TraceTagSpec {
   string name = 1 [(validate.rules).string.min_len = 1];
   // type is the type of the tag.
   TagType type = 2 [(validate.rules).enum.defined_only = true];
+  // stage_names defines which lifecycle stages this trace tag is retained in.
+  // If empty, the trace tag is retained in all stages.
+  // Each value must match the name of a LifecycleStage in the parent Group's 
ResourceOpts.
+  repeated string stage_names = 3;
 }
 
 // Trace defines a tracing-specific storage resource.

Reply via email to