From d17d0376bf3747d17f328e2a78daa505d357e6dc Mon Sep 17 00:00:00 2001
From: Cedric CAFFY <cedric.caffy@cern.ch>
Date: Thu, 17 Oct 2019 17:28:51 +0200
Subject: [PATCH] Added symbolic link to the /var/tmp/cta-rados-locking.log
 file

---
 .../docker/ctafrontend/cc7/opt/run/bin/init_pod.sh           | 5 +++++
 objectstore/BackendRados.cpp                                 | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init_pod.sh b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init_pod.sh
index ba1881a5da..c5584914af 100755
--- a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init_pod.sh
+++ b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init_pod.sh
@@ -24,6 +24,11 @@ mkdir /var/log/tmp
 chmod 1777 /var/log/tmp
 echo '/var/log/tmp/%h-%t-%e-%p-%s.core' > /proc/sys/kernel/core_pattern
 
+# Creating the Rados performance locking file
+touch /var/log/cta-rados-locking.log
+#Creating the symbolic link to /var/log/cta-rados-locking.log
+ln -s /var/log/cta-rados-locking.log /var/tmp/cta-rados-locking.log
+
 echo -n "Fixing reverse DNS for $(hostname) for xrootd: "
 sed -i -c "s/^\($(hostname -i)\)\s\+.*$/\1 $(hostname -s).$(grep search /etc/resolv.conf | cut -d\  -f2) $(hostname -s)/" /etc/hosts
 echo "DONE"
diff --git a/objectstore/BackendRados.cpp b/objectstore/BackendRados.cpp
index 9908ee82ad..a67ce052f3 100644
--- a/objectstore/BackendRados.cpp
+++ b/objectstore/BackendRados.cpp
@@ -719,7 +719,9 @@ void BackendRados::lockBackoff(std::string name, uint64_t timeout_us, LockType l
   size_t backoff=1;
   utils::Timer t, timeoutTimer;
   RadosLockTimingLogger::Measurements timingMeasurements;
+  uint64_t nbTriesToLock = 0;
   while (true) {
+    nbTriesToLock++;
     TIMESTAMPEDPRINT(lockType==LockType::Shared?"Pre-lock (shared)":"Pre-lock (exclusive)");
     RadosTimeoutLogger rtl;
     if (lockType==LockType::Shared) {
@@ -745,7 +747,7 @@ void BackendRados::lockBackoff(std::string name, uint64_t timeout_us, LockType l
     }
     if (-EBUSY != rc) break;
     if (timeout_us && (timeoutTimer.usecs() > (int64_t)timeout_us)) {
-      throw exception::Exception("In BackendRados::lockBackoff(): timeout : timeout set = "+std::to_string(timeout_us)+"usec, time to lock the object : "+std::to_string(timeoutTimer.usecs())+"usec");
+      throw exception::Exception("In BackendRados::lockBackoff(): timeout : timeout set = "+std::to_string(timeout_us)+" usec, time to lock the object : "+std::to_string(timeoutTimer.usecs())+" usec, number of tries to lock = "+std::to_string(nbTriesToLock));
     }
     timespec ts;
     auto latencyUsecs=t.usecs();
-- 
GitLab