[] gc: Wait for handlers on GC stopping

First wait for goroutine handles epoch events to not to get data race
on `gc.newEpochHandlers.cancelFunc`.

Then cancel handlers and wait for them.

Change-Id: I71f11f8526961f8356f582a95b10eb8340c0aedd
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2025-04-01 12:56:55 +03:00
parent bd1c18e117
commit e142d25fac
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0

View file

@ -227,6 +227,9 @@ func (gc *gc) stop(ctx context.Context) {
gc.log.Info(ctx, logs.ShardWaitingForGCWorkersToStop)
gc.wg.Wait()
gc.newEpochHandlers.cancelFunc()
gc.newEpochHandlers.prevGroup.Wait()
}
// iterates over metabase and deletes objects