@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);
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);
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,
.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;
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);
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);
@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();
@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());
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();
@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();
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);
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);
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();