forked from TrueCloudLab/frostfs-node
[#1907] shard: Return from Close
after GC has stopped
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
4fe1aad30f
commit
713fdab177
2 changed files with 10 additions and 0 deletions
|
@ -24,6 +24,7 @@ Changelog for NeoFS Node
|
||||||
- Correctly sign new epoch transaction in neofs-adm for a committee of more than 4 nodes (#1949)
|
- Correctly sign new epoch transaction in neofs-adm for a committee of more than 4 nodes (#1949)
|
||||||
- Inability to provide session to NeoFS CLI in a NeoFS-binary format (#1933)
|
- Inability to provide session to NeoFS CLI in a NeoFS-binary format (#1933)
|
||||||
- `neofs-adm` now works correctly with a committee of more than 4 nodes (#1949, #1959)
|
- `neofs-adm` now works correctly with a committee of more than 4 nodes (#1949, #1959)
|
||||||
|
- Closing a shard now waits until GC background workers stop (#1964)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
### Updated
|
### Updated
|
||||||
|
|
|
@ -65,6 +65,7 @@ type gc struct {
|
||||||
|
|
||||||
onceStop sync.Once
|
onceStop sync.Once
|
||||||
stopChannel chan struct{}
|
stopChannel chan struct{}
|
||||||
|
wg sync.WaitGroup
|
||||||
|
|
||||||
workerPool util.WorkerPool
|
workerPool util.WorkerPool
|
||||||
|
|
||||||
|
@ -103,11 +104,14 @@ func (gc *gc) init() {
|
||||||
gc.workerPool = gc.workerPoolInit(sz)
|
gc.workerPool = gc.workerPoolInit(sz)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gc.wg.Add(2)
|
||||||
go gc.tickRemover()
|
go gc.tickRemover()
|
||||||
go gc.listenEvents()
|
go gc.listenEvents()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gc *gc) listenEvents() {
|
func (gc *gc) listenEvents() {
|
||||||
|
defer gc.wg.Done()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
event, ok := <-gc.eventChan
|
event, ok := <-gc.eventChan
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -147,6 +151,8 @@ func (gc *gc) listenEvents() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gc *gc) tickRemover() {
|
func (gc *gc) tickRemover() {
|
||||||
|
defer gc.wg.Done()
|
||||||
|
|
||||||
timer := time.NewTimer(gc.removerInterval)
|
timer := time.NewTimer(gc.removerInterval)
|
||||||
defer timer.Stop()
|
defer timer.Stop()
|
||||||
|
|
||||||
|
@ -172,6 +178,9 @@ func (gc *gc) stop() {
|
||||||
gc.onceStop.Do(func() {
|
gc.onceStop.Do(func() {
|
||||||
gc.stopChannel <- struct{}{}
|
gc.stopChannel <- struct{}{}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
gc.log.Info("waiting for GC workers to stop...")
|
||||||
|
gc.wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterates over metabase and deletes objects
|
// iterates over metabase and deletes objects
|
||||||
|
|
Loading…
Reference in a new issue