You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/04/16 05:50:00 UTC

[GitHub] [skywalking-banyandb] lujiajing1126 commented on a diff in pull request #104: Make sure index rule ID is set by

lujiajing1126 commented on code in PR #104:
URL: https://github.com/apache/skywalking-banyandb/pull/104#discussion_r851590259


##########
banyand/metadata/schema/index.go:
##########
@@ -93,6 +96,9 @@ func (e *etcdSchemaRegistry) GetIndexRule(ctx context.Context, metadata *commonv
 	if err := e.get(ctx, formatIndexRuleKey(metadata), &entity); err != nil {
 		return nil, err
 	}
+	if entity.Metadata.Id == 0 {
+		return nil, errors.WithMessagef(ErrEmptyIndexRuleID, "index rule: %v", metadata)

Review Comment:
   Shall we return grpc status code since it it API related



##########
banyand/metadata/schema/index.go:
##########
@@ -108,12 +114,21 @@ func (e *etcdSchemaRegistry) ListIndexRule(ctx context.Context, opt ListOpt) ([]
 	}
 	entities := make([]*databasev1.IndexRule, 0, len(messages))
 	for _, message := range messages {
-		entities = append(entities, message.(*databasev1.IndexRule))
+		entity := message.(*databasev1.IndexRule)
+		if entity.Metadata.Id == 0 {
+			return nil, errors.WithMessagef(ErrEmptyIndexRuleID, "index rule: %v", entity.Metadata)

Review Comment:
   same here



##########
banyand/metadata/schema/index.go:
##########
@@ -19,16 +19,19 @@ package schema
 
 import (
 	"context"
+	"hash/crc32"
 
 	"google.golang.org/protobuf/proto"
 
 	commonv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1"
 	databasev1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
+	"github.com/pkg/errors"

Review Comment:
   the location of this import line is wrong



-- 
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: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org