This is an automated email from the ASF dual-hosted git repository.
hanahmily 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 fc0424b3 Fix the bug that the log doesn't get config (#638)
fc0424b3 is described below
commit fc0424b32f12797248c8b2c175c65127d9cc41bd
Author: Gao Hongtao <[email protected]>
AuthorDate: Wed Apr 2 09:37:07 2025 +0800
Fix the bug that the log doesn't get config (#638)
Signed-off-by: Gao Hongtao <[email protected]>
---
banyand/backup/lifecycle/steps.go | 2 +-
banyand/queue/pub/pub.go | 13 +++++++++++--
banyand/queue/pub/pub_suite_test.go | 3 +--
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/banyand/backup/lifecycle/steps.go
b/banyand/backup/lifecycle/steps.go
index 5a519a2a..7816b881 100644
--- a/banyand/backup/lifecycle/steps.go
+++ b/banyand/backup/lifecycle/steps.go
@@ -147,7 +147,7 @@ func parseGroup(ctx context.Context, g *commonv1.Group,
nodeLabels map[string]st
if err = nodeSel.PreRun(ctx); err != nil {
return 0, nil, nil, errors.WithMessage(err, "failed to run node
selector")
}
- client := pub.New(nil)
+ client := pub.NewWithoutMetadata()
if g.Catalog == commonv1.Catalog_CATALOG_STREAM {
_ = grpc.NewClusterNodeRegistry(data.TopicStreamWrite, client,
nodeSel)
} else {
diff --git a/banyand/queue/pub/pub.go b/banyand/queue/pub/pub.go
index a55995b7..8d32d6a0 100644
--- a/banyand/queue/pub/pub.go
+++ b/banyand/queue/pub/pub.go
@@ -225,16 +225,25 @@ func New(metadata metadata.Repo) queue.Client {
registered: make(map[string]*databasev1.Node),
handlers: make(map[bus.Topic]schema.EventHandler),
closer: run.NewCloser(1),
- log: logger.GetLogger("server-queue-pub"),
}
}
+// NewWithoutMetadata returns a new queue client without metadata.
+func NewWithoutMetadata() queue.Client {
+ p := New(nil)
+ p.(*pub).log = logger.GetLogger("queue-client")
+ return p
+}
+
func (*pub) Name() string {
return "queue-client"
}
func (p *pub) PreRun(context.Context) error {
- p.metadata.RegisterHandler("queue-client", schema.KindNode, p)
+ if p.metadata != nil {
+ p.metadata.RegisterHandler("queue-client", schema.KindNode, p)
+ }
+ p.log = logger.GetLogger("server-queue-pub")
return nil
}
diff --git a/banyand/queue/pub/pub_suite_test.go
b/banyand/queue/pub/pub_suite_test.go
index 50ccfcc8..8a1001bb 100644
--- a/banyand/queue/pub/pub_suite_test.go
+++ b/banyand/queue/pub/pub_suite_test.go
@@ -215,8 +215,7 @@ func (m *mockHandler) OnDelete(_ schema.Metadata) {
}
func newPub() *pub {
- p := New(nil).(*pub)
- p.log = logger.GetLogger("pub")
+ p := NewWithoutMetadata().(*pub)
p.Register(data.TopicStreamWrite, &mockHandler{})
p.Register(data.TopicMeasureWrite, &mockHandler{})
return p