hanahmily commented on code in PR #654:
URL: 
https://github.com/apache/skywalking-banyandb/pull/654#discussion_r2061916162


##########
banyand/metadata/embeddedserver/server.go:
##########
@@ -82,10 +109,19 @@ func (s *server) PreRun(ctx context.Context) error {
 
 func (s *server) Serve() run.StopNotify {
        _ = s.Service.Serve()
+       s.RegisterDefrag()
        return s.metaServer.StoppingNotify()
 }
 
 func (s *server) GracefulStop() {
+       if s.scheduler != nil {
+               if !s.scheduler.Closed() {

Review Comment:
   ```suggestion
   ```
   
   You don't have to check if it has been closed.



##########
banyand/metadata/embeddedserver/server.go:
##########
@@ -103,3 +139,37 @@ func NewService(_ context.Context) (metadata.Service, 
error) {
        }
        return s, nil
 }
+
+func (s *server) RegisterDefrag() {

Review Comment:
   ```suggestion
   func (s *server) registerDefrag() {
   ```
   
   Please don't expose this function.



##########
banyand/metadata/embeddedserver/server.go:
##########
@@ -103,3 +139,37 @@ func NewService(_ context.Context) (metadata.Service, 
error) {
        }
        return s, nil
 }
+
+func (s *server) RegisterDefrag() {
+       var (
+               err        error
+               etcdLogger = logger.GetLogger().Named("etcd-server")
+               defrag     = func(_ time.Time, _ *logger.Logger) bool {

Review Comment:
   Please test the defragmentation (defrag) function:
   
   1. Extract the existing logic into a new, standalone function.
   2. Create a new defrag function that takes two parameters: "listenURL" and 
"ecli."
   3. Ensure that the function returns an error.
   
   Next, start the embedded server to verify that the defrag function does not 
return any errors.



-- 
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]

Reply via email to