From 359beb9c96cd0651b38eb35bf6333c36e9e46c5c Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Fri, 22 May 2020 13:10:21 -0400 Subject: [PATCH] Suppressed logging self-correcting problems. It will start logging as an err if it does not self-correct after 10 attempts, and will escalate to crit after 20 attempts. Also fixed a silly error where it was checking the file size after it deleted the file. --- storage-manager/src/Synchronizer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/storage-manager/src/Synchronizer.cpp b/storage-manager/src/Synchronizer.cpp index 20bd39213..100a265ef 100644 --- a/storage-manager/src/Synchronizer.cpp +++ b/storage-manager/src/Synchronizer.cpp @@ -409,6 +409,7 @@ void Synchronizer::process(list::iterator name) s.unlock(); bool success = false; + int retryCount = 0; while (!success) { assert(!s.owns_lock()); @@ -434,8 +435,11 @@ void Synchronizer::process(list::iterator name) success = true; } catch(exception &e) { - logger->log(LOG_CRIT, "Synchronizer::process(): error sync'ing %s opFlags=%d, got '%s'. Retrying...", key.c_str(), - pending->opFlags, e.what()); + // these are often self-resolving, so we will suppress logging it for 10 iterations, then escalate + // to error, then to crit + if (++retryCount >= 10) + logger->log((retryCount < 20 ? LOG_ERR : LOG_CRIT), "Synchronizer::process(): error sync'ing %s opFlags=%d, got '%s'. Retrying...", key.c_str(), + pending->opFlags, e.what()); success = false; sleep(1); continue; @@ -706,7 +710,7 @@ void Synchronizer::synchronizeWithJournal(const string &sourceFile, list ostringstream oss; oss << "Synchronizer::synchronizeWithJournal(): detected a mismatch between file size and " << "length stored in the object name. object name = " << cloudKey << " length-in-name = " << - MetadataFile::getLengthFromKey(cloudKey) << " real-length = " << bf::file_size(oldCachePath); + MetadataFile::getLengthFromKey(cloudKey) << " real-length = " << oldSize; logger->log(LOG_WARNING, oss.str().c_str()); } }