hanahmily commented on code in PR #873:
URL: 
https://github.com/apache/skywalking-banyandb/pull/873#discussion_r2593159518


##########
pkg/partition/index.go:
##########
@@ -47,6 +48,27 @@ func ParseIndexRuleLocators(entity *databasev1.Entity, 
families []*databasev1.Ta
        for i := range entity.TagNames {
                locators.EntitySet[entity.TagNames[i]] = i + 1
        }
+
+       availableTags := make(map[string]struct{})
+       for i := range families {
+               for j := range families[i].Tags {
+                       availableTags[families[i].Tags[j].Name] = struct{}{}
+               }
+       }
+
+       for i := range indexRules {
+               if indexRules[i] == nil {
+                       continue
+               }
+               for j := range indexRules[i].Tags {
+                       tagName := indexRules[i].Tags[j]
+                       if _, exists := availableTags[tagName]; !exists {

Review Comment:
   Add test cases to cover the scenario: create an invalid index rule, try to 
write data to it. 



##########
banyand/metadata/schema/schema_update_test.go:
##########


Review Comment:
   Reserved tags of trace can not be deleted: trace_id, timestamp and span_id.



##########
banyand/measure/block.go:
##########
@@ -545,8 +548,16 @@ OUTER:
                        var foundTag bool
                        for i := range cf.columns {
                                if cf.columns[i].name == tagName {
-                                       for _, v := range 
cf.columns[i].values[idx:offset] {
-                                               t.Values = append(t.Values, 
mustDecodeTagValue(cf.columns[i].valueType, v))
+                                       schemaType, hasSchemaType := 
bc.schemaTagTypes[tagName]
+                                       if !hasSchemaType || 
cf.columns[i].valueType == schemaType {

Review Comment:
   Add test cases to conver: the unmatched type tag can not be retrieved.



##########
pkg/partition/index.go:
##########
@@ -47,6 +48,27 @@ func ParseIndexRuleLocators(entity *databasev1.Entity, 
families []*databasev1.Ta
        for i := range entity.TagNames {
                locators.EntitySet[entity.TagNames[i]] = i + 1
        }
+
+       availableTags := make(map[string]struct{})
+       for i := range families {
+               for j := range families[i].Tags {
+                       availableTags[families[i].Tags[j].Name] = struct{}{}
+               }
+       }
+
+       for i := range indexRules {
+               if indexRules[i] == nil {
+                       continue
+               }
+               for j := range indexRules[i].Tags {
+                       tagName := indexRules[i].Tags[j]
+                       if _, exists := availableTags[tagName]; !exists {
+                               logger.Warningf("index rule %q references 
removed tag %q which no longer exists in schema, ignoring this tag",

Review Comment:
   remove the indexRule from `indexRules`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to