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

[skywalking-banyandb] branch bug-md created (now 38ec412)

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

hanahmily pushed a change to branch bug-md
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


      at 38ec412  Try to create the group if absent

This branch includes the following new commits:

     new 38ec412  Try to create the group if absent

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[skywalking-banyandb] 01/01: Try to create the group if absent

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 38ec4128bd9df1a209285845eccdd4e1aa90bc81
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Mon Oct 10 04:10:13 2022 +0000

    Try to create the group if absent
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
 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 {