You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/10/10 04:19:38 UTC

[skywalking-banyandb] branch main updated: Try to create the group if absent (#187)

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

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


The following commit(s) were added to refs/heads/main by this push:
     new 1f8e82c  Try to create the group if absent (#187)
1f8e82c is described below

commit 1f8e82cbbca96d3d89afb4524f899be8f75dda18
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Mon Oct 10 12:19:33 2022 +0800

    Try to create the group if absent (#187)
---
 pkg/schema/metadata.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pkg/schema/metadata.go b/pkg/schema/metadata.go
index 90400ec..5f631fc 100644
--- a/pkg/schema/metadata.go
+++ b/pkg/schema/metadata.go
@@ -279,7 +279,10 @@ func (sr *schemaRepo) LoadResource(metadata *commonv1.Metadata) (Resource, bool)
 func (sr *schemaRepo) storeResource(metadata *commonv1.Metadata) (Resource, error) {
 	group, ok := sr.LoadGroup(metadata.Group)
 	if !ok {
-		return nil, errors.Errorf("unknown group")
+		var err error
+		if group, err = sr.StoreGroup(&commonv1.Metadata{Name: metadata.Group}); err != nil {
+			return nil, errors.WithMessagef(err, "create unknown group:%s", metadata.Group)
+		}
 	}
 	stm, err := sr.resourceSupplier.ResourceSchema(sr.metadata, metadata)
 	if err != nil {