heal: Persist MRF queue in the disk during shutdown (#19410)

This commit is contained in:
Anis Eleuch
2024-08-13 23:26:05 +01:00
committed by GitHub
parent e7a56f35b9
commit 51b1f41518
10 changed files with 649 additions and 84 deletions
+18
View File
@@ -23,11 +23,26 @@ import (
"net/http"
"os"
"strings"
"time"
"github.com/coreos/go-systemd/v22/daemon"
"github.com/minio/minio/internal/logger"
)
func shutdownHealMRFWithTimeout() {
const shutdownTimeout = time.Minute
finished := make(chan struct{})
go func() {
globalMRFState.shutdown()
close(finished)
}()
select {
case <-time.After(shutdownTimeout):
case <-finished:
}
}
func handleSignals() {
// Custom exit function
exit := func(success bool) {
@@ -50,6 +65,9 @@ func handleSignals() {
}
stopProcess := func() bool {
shutdownHealMRFWithTimeout() // this can take time sometimes, it needs to be executed
// before stopping s3 operations
// send signal to various go-routines that they need to quit.
cancelGlobalContext()