fix short circuit if the compaction request from apiserver is disabled

Kubernetes-commit: 9fef30117f89830cc8b17610c359141b663844f1
This commit is contained in:
古九 2024-08-12 10:21:49 +08:00 committed by Kubernetes Publisher
parent 8beb81657f
commit e312f49d45
1 changed files with 4 additions and 0 deletions

View File

@ -378,6 +378,10 @@ func startCompactorOnce(c storagebackend.TransportConfig, interval time.Duration
compactorsMu.Lock()
defer compactorsMu.Unlock()
if interval == 0 {
// short circuit, if the compaction request from apiserver is disabled
return func() {}, nil
}
key := fmt.Sprintf("%v", c) // gives: {[server1 server2] keyFile certFile caFile}
if compactor, foundBefore := compactors[key]; !foundBefore || compactor.interval > interval {
compactorClient, err := newETCD3Client(c)