Cleanup IdManager and LockManager info messages 18/55218/4
authorAlon Kochba <alonko@hpe.com>
Wed, 19 Apr 2017 12:14:43 +0000 (15:14 +0300)
committerDavid Suarez <david.suarez.fuentes@ericsson.com>
Thu, 20 Apr 2017 16:10:47 +0000 (16:10 +0000)
These modules are very active and output a large number
of logs in INFO level, which should be DEBUG level.

Change-Id: Id260b124ffeefa8ccf58d2c021c5c75b8ac589ab
Signed-off-by: Alon Kochba <alonko@hpe.com>
idmanager/idmanager-impl/src/main/java/org/opendaylight/genius/idmanager/IdManager.java
lockmanager/lockmanager-impl/src/main/java/org/opendaylight/lockmanager/LockManager.java

index d185da9a2578651ffce562fe1bce1fb6782aecc0..7bb253f2fcfdad2db2e5d19f58e90269b8eea33f 100644 (file)
@@ -201,7 +201,7 @@ public class IdManager implements IdManagerService, IdManagerMonitor {
 
     @Override
     public Future<RpcResult<AllocateIdOutput>> allocateId(AllocateIdInput input) {
-        LOG.info("AllocateId called with input {}", input);
+        LOG.debug("AllocateId called with input {}", input);
         String idKey = input.getIdKey();
         String poolName = input.getPoolName();
         String localPoolName = idUtils.getLocalPoolName(poolName);
@@ -312,7 +312,7 @@ public class IdManager implements IdManagerService, IdManagerMonitor {
 
     private List<Long> allocateIdFromLocalPool(String parentPoolName, String localPoolName,
             String idKey, long size) throws OperationFailedException, IdManagerException {
-        LOG.info("Allocating id from local pool {}. Parent pool {}. Idkey {}", localPoolName, parentPoolName,
+        LOG.debug("Allocating id from local pool {}. Parent pool {}. Idkey {}", localPoolName, parentPoolName,
                     idKey);
         List<Long> newIdValuesList = new ArrayList<>();
         String uniqueIdKey = idUtils.getUniqueKey(parentPoolName, idKey);
@@ -337,7 +337,7 @@ public class IdManager implements IdManagerService, IdManagerMonitor {
         Optional<IdEntries> existingIdEntry = singleTxDB.syncReadOptional(CONFIGURATION, existingId);
         if (existingIdEntry.isPresent()) {
             newIdValuesList = existingIdEntry.get().getIdValue();
-            LOG.info("Existing ids {} for the key {} ", newIdValuesList, idKey);
+            LOG.debug("Existing ids {} for the key {} ", newIdValuesList, idKey);
             // Inform other waiting threads about this new value.
             futureIdValues.complete(newIdValuesList);
             // This is to avoid stale entries in the map. If this thread had populated the map,
@@ -571,7 +571,7 @@ public class IdManager implements IdManagerService, IdManagerMonitor {
                 .builder(IdPools.class).child(IdPool.class,
                         new IdPoolKey(parentIdPool.getPoolName())).child(ReleasedIdsHolder.class).build();
         releasedIdsBuilderParent.setAvailableIdCount(releasedIdsBuilderParent.getAvailableIdCount() - idCount);
-        LOG.info("Allocated {} ids from releasedIds of parent pool {}", idCount, parentIdPool);
+        LOG.debug("Allocated {} ids from releasedIds of parent pool {}", idCount, parentIdPool);
         tx.merge(CONFIGURATION, releasedIdsHolderInstanceIdentifier,
                 releasedIdsBuilderParent.build(), true);
         return idCount;
@@ -609,7 +609,7 @@ public class IdManager implements IdManagerService, IdManagerMonitor {
     private void releaseIdFromLocalPool(String parentPoolName, String localPoolName, String idKey)
             throws ReadFailedException, IdManagerException {
         String idLatchKey = idUtils.getUniqueKey(parentPoolName, idKey);
-        LOG.info("Releasing ID {} from pool {}", idKey, localPoolName);
+        LOG.debug("Releasing ID {} from pool {}", idKey, localPoolName);
         java.util.Optional.ofNullable(idUtils.releaseIdLatchMap.get(idLatchKey)).ifPresent(latch -> {
             try {
                 latch.await(10, TimeUnit.SECONDS);
@@ -638,13 +638,13 @@ public class IdManager implements IdManagerService, IdManagerMonitor {
         List<Long> idValuesList = existingIdEntry.getIdValue();
         IdLocalPool localIdPoolCache = localPool.get(parentPoolName);
         boolean isRemoved = newIdEntries.remove(existingIdEntry);
-        LOG.info("The entry {} is removed {}", existingIdEntry, isRemoved);
+        LOG.debug("The entry {} is removed {}", existingIdEntry, isRemoved);
         updateDelayedEntriesInLocalCache(idValuesList, parentPoolName, localIdPoolCache);
         IdHolderSyncJob poolSyncJob = new IdHolderSyncJob(localPoolName, localIdPoolCache.getReleasedIds(), broker,
                 idUtils);
         DataStoreJobCoordinator.getInstance().enqueueJob(localPoolName, poolSyncJob, IdUtils.RETRY_COUNT);
         scheduleCleanUpTask(localIdPoolCache, parentPoolName, parentIdPool.getBlockSize());
-        LOG.info("Released id ({}, {}) from pool {}", idKey, idValuesList, localPoolName);
+        LOG.debug("Released id ({}, {}) from pool {}", idKey, idValuesList, localPoolName);
         // Updating id entries in the parent pool. This will be used for restart scenario
         UpdateIdEntryJob job = new UpdateIdEntryJob(parentPoolName, localPoolName, idKey, null, broker, idUtils,
                         lockManager);
index 9af0c50223322da12d8d6a26e0ecc71d1008864b..a0763940a11345503c000ad110922ac0ad9e4e55 100644 (file)
@@ -60,13 +60,13 @@ public class LockManager implements LockManagerService {
     @Override
     public Future<RpcResult<Void>> lock(LockInput input) {
         String lockName = input.getLockName();
-        LOG.info("Locking {}", lockName);
+        LOG.debug("Locking {}", lockName);
         InstanceIdentifier<Lock> lockInstanceIdentifier = LockManagerUtils.getLockInstanceIdentifier(lockName);
         Lock lockData = LockManagerUtils.buildLockData(lockName);
         try {
             getLock(lockInstanceIdentifier, lockData);
             RpcResultBuilder<Void> lockRpcBuilder = RpcResultBuilder.success();
-            LOG.info("Acquired lock {}", lockName);
+            LOG.debug("Acquired lock {}", lockName);
             return Futures.immediateFuture(lockRpcBuilder.build());
         } catch (InterruptedException e) {
             RpcResultBuilder<Void> lockRpcBuilder = RpcResultBuilder.failed();
@@ -78,7 +78,7 @@ public class LockManager implements LockManagerService {
     @Override
     public Future<RpcResult<Void>> tryLock(TryLockInput input) {
         String lockName = input.getLockName();
-        LOG.info("Locking {}", lockName);
+        LOG.debug("Locking {}", lockName);
         long waitTime = input.getTime() == null ? DEFAULT_WAIT_TIME_IN_MILLIS * DEFAULT_RETRY_COUNT : input.getTime();
         TimeUnit timeUnit = input.getTimeUnit() == null ? TimeUnit.MILLISECONDS
                 : LockManagerUtils.convertToTimeUnit(input.getTimeUnit());
@@ -91,10 +91,10 @@ public class LockManager implements LockManagerService {
         try {
             if (getLock(lockInstanceIdentifier, lockData, retryCount)) {
                 lockRpcBuilder = RpcResultBuilder.success();
-                LOG.info("Acquired lock {}", lockName);
+                LOG.debug("Acquired lock {}", lockName);
             } else {
                 lockRpcBuilder = RpcResultBuilder.failed();
-                LOG.info("Failed to get lock {}", lockName);
+                LOG.error("Failed to get lock {}", lockName);
             }
         } catch (InterruptedException e) {
             lockRpcBuilder = RpcResultBuilder.failed();
@@ -106,7 +106,7 @@ public class LockManager implements LockManagerService {
     @Override
     public Future<RpcResult<Void>> unlock(UnlockInput input) {
         String lockName = input.getLockName();
-        LOG.info("Unlocking {}", lockName);
+        LOG.debug("Unlocking {}", lockName);
         InstanceIdentifier<Lock> lockInstanceIdentifier = LockManagerUtils.getLockInstanceIdentifier(lockName);
         unlock(lockName, lockInstanceIdentifier);
         RpcResultBuilder<Void> lockRpcBuilder = RpcResultBuilder.success();
@@ -118,7 +118,7 @@ public class LockManager implements LockManagerService {
         try {
             Optional<Lock> result = tx.read(LogicalDatastoreType.OPERATIONAL, lockInstanceIdentifier).get();
             if (!result.isPresent()) {
-                LOG.info("{} is already unlocked", lockName);
+                LOG.debug("{} is already unlocked", lockName);
                 return;
             }
             tx.delete(LogicalDatastoreType.OPERATIONAL, lockInstanceIdentifier);
@@ -141,8 +141,13 @@ public class LockManager implements LockManagerService {
                 if (readWriteLock(lockInstanceIdentifier, lockData)) {
                     return;
                 } else {
-                    LOG.info("Already locked for {} after waiting {}ms, try {}",
-                            lockName, DEFAULT_WAIT_TIME_IN_MILLIS, retry);
+                    if (retry >= 30) {
+                        LOG.debug("Already locked for {} after waiting {}ms, try {}",
+                                lockName, DEFAULT_WAIT_TIME_IN_MILLIS, retry);
+                    } else {
+                        LOG.warn("Already locked for {} after waiting {}ms, try {}",
+                                lockName, DEFAULT_WAIT_TIME_IN_MILLIS, retry);
+                    }
                 }
             } catch (ExecutionException e) {
                 LOG.error("Unable to acquire lock for {}, try {}", lockName, retry);
@@ -187,7 +192,7 @@ public class LockManager implements LockManagerService {
             ReadWriteTransaction tx = broker.newReadWriteTransaction();
             Optional<Lock> result = tx.read(LogicalDatastoreType.OPERATIONAL, lockInstanceIdentifier).get();
             if (!result.isPresent()) {
-                LOG.info("Writing lock lockData {}", lockData);
+                LOG.debug("Writing lock lockData {}", lockData);
                 tx.put(LogicalDatastoreType.OPERATIONAL, lockInstanceIdentifier, lockData, true);
                 CheckedFuture<Void, TransactionCommitFailedException> futures = tx.submit();
                 futures.get();