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 3e933b3980977803e990b35a7a29f3b69ad8e5e6 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/database/v1/schema.proto | 26 ++++++++++++++++++++++++++ docs/api-reference.md | 4 ++++ 2 files changed, 30 insertions(+) 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. diff --git a/docs/api-reference.md b/docs/api-reference.md index ff86ff51..b8482a3b 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -2284,6 +2284,7 @@ FieldSpec is the specification of field | field_type | [FieldType](#banyandb-database-v1-FieldType) | | field_type denotes the type of field value | | encoding_method | [EncodingMethod](#banyandb-database-v1-EncodingMethod) | | encoding_method indicates how to encode data during writing | | compression_method | [CompressionMethod](#banyandb-database-v1-CompressionMethod) | | compression_method indicates how to compress data during writing | +| stage_names | [string](#string) | repeated | 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. | @@ -2431,6 +2432,7 @@ Subject defines which stream or measure would generate indices | ----- | ---- | ----- | ----------- | | name | [string](#string) | | | | tags | [TagSpec](#banyandb-database-v1-TagSpec) | repeated | tags defines accepted tags | +| stage_names | [string](#string) | repeated | 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. | @@ -2447,6 +2449,7 @@ Subject defines which stream or measure would generate indices | ----- | ---- | ----- | ----------- | | name | [string](#string) | | | | type | [TagType](#banyandb-database-v1-TagType) | | | +| stage_names | [string](#string) | repeated | 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 inters [...] @@ -2509,6 +2512,7 @@ TraceTagSpec defines the specification of a tag in a trace. | ----- | ---- | ----- | ----------- | | name | [string](#string) | | name is the name of the tag. | | type | [TagType](#banyandb-database-v1-TagType) | | type is the type of the tag. | +| stage_names | [string](#string) | repeated | 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. |
