From cae09d8b8451f43664ff5fafa67c98af45ef9669 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Mon, 22 Jun 2020 11:57:22 -0700 Subject: [PATCH] crawler: Wait max 1 second (#9894) Add 1-second timeout to crawler wait. This will make the crawler able to run, albeit very, very slowly on high load servers. --- cmd/xl-storage.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/xl-storage.go b/cmd/xl-storage.go index f4e7bb816..07a3d1d26 100644 --- a/cmd/xl-storage.go +++ b/cmd/xl-storage.go @@ -60,8 +60,10 @@ const ( readAheadBufSize = 1 << 20 // Wait interval to check if active IO count is low - // to proceed crawling to compute data usage + // to proceed crawling to compute data usage. + // Wait up to lowActiveIOWaitMaxN times. lowActiveIOWaitTick = 100 * time.Millisecond + lowActiveIOWaitMaxN = 10 // XL metadata file carries per object metadata. xlStorageFormatFile = "xl.meta" @@ -357,8 +359,16 @@ func (s *xlStorage) IsLocal() bool { } func (s *xlStorage) waitForLowActiveIO() { + max := lowActiveIOWaitMaxN for atomic.LoadInt32(&s.activeIOCount) >= s.maxActiveIOCount { time.Sleep(lowActiveIOWaitTick) + max-- + if max == 0 { + if intDataUpdateTracker.debug { + logger.Info("waitForLowActiveIO: waited %d times, resuming", lowActiveIOWaitMaxN) + } + break + } } }