mirror of https://github.com/milvus-io/milvus.git
fix: close of wal is block when recovery (#41326)
issue: #41307 Signed-off-by: chyezh <chyezh@outlook.com>pull/41233/merge
parent
43d982bd11
commit
c893344289
|
@ -95,8 +95,8 @@ func (w *roWALAdaptorImpl) Close() {
|
|||
// begin to close the wal.
|
||||
w.Logger().Info("wal begin to close...")
|
||||
w.lifetime.SetState(typeutil.LifetimeStateStopped)
|
||||
w.lifetime.Wait()
|
||||
close(w.available)
|
||||
w.lifetime.Wait()
|
||||
|
||||
w.Logger().Info("wal begin to close scanners...")
|
||||
|
||||
|
|
|
@ -112,8 +112,11 @@ func (w *walAdaptorImpl) Append(ctx context.Context, msg message.MutableMessage)
|
|||
select {
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
case <-w.available:
|
||||
return nil, status.NewOnShutdownError("wal is on shutdown")
|
||||
case <-w.interceptorBuildResult.Interceptor.Ready():
|
||||
}
|
||||
|
||||
// Setup the term of wal.
|
||||
msg = msg.WithWALTerm(w.Channel().Term)
|
||||
|
||||
|
@ -184,13 +187,12 @@ func (w *walAdaptorImpl) Close() {
|
|||
w.Logger().Info("wal begin to close, start graceful close...")
|
||||
// graceful close the interceptors before wal closing.
|
||||
w.interceptorBuildResult.GracefulCloseFunc()
|
||||
|
||||
w.Logger().Info("wal graceful close done, wait for operation to be finished...")
|
||||
|
||||
// begin to close the wal.
|
||||
w.lifetime.SetState(typeutil.LifetimeStateStopped)
|
||||
w.lifetime.Wait()
|
||||
close(w.available)
|
||||
w.lifetime.Wait()
|
||||
|
||||
w.Logger().Info("wal begin to close scanners...")
|
||||
|
||||
|
|
Loading…
Reference in New Issue