lujiajing1126 commented on code in PR #153:
URL:
https://github.com/apache/skywalking-banyandb/pull/153#discussion_r941985864
##########
banyand/tsdb/index/writer.go:
##########
@@ -76,36 +77,37 @@ func NewWriter(ctx context.Context, options WriterOptions)
*Writer {
}
w.shardNum = options.ShardNum
w.db = options.DB
+ w.enableGlobalIndex = options.EnableGlobalIndex
w.indexRuleIndex = partition.ParseIndexRuleLocators(options.Families,
options.IndexRules)
- w.ch = run.NewChan[Message](make(chan Message))
+ w.ch = make(chan Message)
w.bootIndexGenerator()
return w
}
func (s *Writer) Write(value Message) {
go func(m Message) {
- s.ch.Write(m)
+ s.ch <- m
}(value)
}
func (s *Writer) Close() error {
- return s.ch.Close()
Review Comment:
> We can use close to notify the receivers, not the senders. The senders
will be waiting to write. That is the purpose of this process.
Yes, we can use some stop channel to notify the receivers, but what about
the senders?
> They won't block the GC from collecting them.
From this issue, https://github.com/golang/go/issues/19702, Go may not be
clever enough
now to collect blocking goroutines.
--
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]