From 80178a5bc219eefd5e223a916a6aeb16fee358ca Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 19 May 2022 15:42:04 +0200 Subject: Fix and retry count and add an extra iteration to give more time for success --- zenserver/cache/structuredcachestore.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'zenserver/cache/structuredcachestore.cpp') diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index 6b7b73dcf..4edc13b4a 100644 --- a/zenserver/cache/structuredcachestore.cpp +++ b/zenserver/cache/structuredcachestore.cpp @@ -1769,7 +1769,7 @@ ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, c // We retry to move the file since it can be held open for read. // This happens if the server processes a Get request for the file or // if we are busy sending the file upstream - int RetryCount = 3; + int RetryCount = 4; do { Ec.clear(); @@ -1789,7 +1789,8 @@ ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, c if (!ExistingEc && (OldFileSize == NewFileSize)) { ZEN_INFO( - "Failed to move temporary file '{}' to '{}'. Target file has same size, assuming concurrent write of same value, " + "Failed to move temporary file '{}' to '{}' for '{}'. Target file has same size, assuming concurrent write of same " + "value, " "move " "failed with reason '{}'", DataFile.GetPath(), @@ -1865,9 +1866,8 @@ ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, c Ec.message()); // Semi arbitrary back-off - zen::Sleep(200 * (4 - RetryCount)); // Sleep at most for a total of 2 seconds - RetryCount--; - } while (RetryCount > 0); + zen::Sleep(200 * (5 - RetryCount)); // Sleep at most for a total of 3 seconds + } while (RetryCount-- > 0); throw std::system_error(Ec, fmt::format("Failed to finalize file '{}' for put in '{}'", DataFilePath.ToUtf8(), m_BucketDir)); } -- cgit v1.2.3