forked from TrueCloudLab/frostfs-node
[#1284] writecache: Allow to seal writecache async
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
68029d756e
commit
93d63e1632
10 changed files with 252 additions and 170 deletions
|
@ -178,6 +178,7 @@ func (s *Shard) Init(ctx context.Context) error {
|
|||
if !m.NoMetabase() {
|
||||
s.rb.Start(ctx, s.blobStor, s.metaBase, s.log)
|
||||
}
|
||||
s.writecacheSealCancel.Store(dummyCancel)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -350,6 +351,8 @@ func (s *Shard) Close() error {
|
|||
}
|
||||
|
||||
if s.hasWriteCache() {
|
||||
prev := s.writecacheSealCancel.Swap(notInitializedCancel)
|
||||
prev.cancel() // no need to wait: writecache.Seal and writecache.Close lock the same mutex
|
||||
components = append(components, s.writeCache)
|
||||
}
|
||||
|
||||
|
@ -428,6 +431,9 @@ func (s *Shard) lockExclusive() func() {
|
|||
cancelGC := val.(context.CancelFunc)
|
||||
cancelGC()
|
||||
}
|
||||
if c := s.writecacheSealCancel.Load(); c != nil {
|
||||
c.cancel()
|
||||
}
|
||||
s.m.Lock()
|
||||
s.setModeRequested.Store(false)
|
||||
return s.m.Unlock
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue