@VisibleForTesting void logWarning(long lockHeldTime, long suppressed) { logger.warn(String.format("Lock held time above threshold: " + "lock identifier: %s " + "lockHeldTimeMs=%d ms. Suppressed %d lock warnings. " + "The stack trace is: %s" , name, lockHeldTime, suppressed, StringUtils.getStackTrace(Thread.currentThread()))); }
DataNode.LOG.warn(msg + "\n" + StringUtils.getStackTrace(thread)); throw new IOException(msg);
FSNamesystem.LOG.info("FSNamesystem read lock held for " + readLockIntervalMs + " ms via\n" + StringUtils.getStackTrace(Thread.currentThread()) + "\tNumber of suppressed read-lock reports: " + numSuppressedWarnings + "\n\tLongest read-lock held interval: " + longestLockHeldIntervalMs);
"held interval: {} \n\tTotal suppressed write-lock held time: {}", writeLockIntervalMs, StringUtils.getStackTrace(Thread.currentThread()), logAction.getCount() - 1, logAction.getStats(0).getMax(), logAction.getStats(0).getSum() - writeLockIntervalMs);
String msg = "Join on responder thread " + responder + " timed out"; LOG.warn(msg + "\n" + StringUtils.getStackTrace(responder)); throw new IOException(msg);
/** * Interrupt the writing thread and wait until it dies * @throws IOException the waiting is interrupted */ public void stopWriter(long xceiverStopTimeout) throws IOException { if (writer != null && writer != Thread.currentThread() && writer.isAlive()) { writer.interrupt(); try { writer.join(xceiverStopTimeout); if (writer.isAlive()) { final String msg = "Join on writer thread " + writer + " timed out"; DataNode.LOG.warn(msg + "\n" + StringUtils.getStackTrace(writer)); throw new IOException(msg); } } catch (InterruptedException e) { throw new IOException("Waiting for writer thread is interrupted."); } } }
/** * Interrupt the writing thread and wait until it dies * @throws IOException the waiting is interrupted */ public void stopWriter(long xceiverStopTimeout) throws IOException { if (writer != null && writer != Thread.currentThread() && writer.isAlive()) { writer.interrupt(); try { writer.join(xceiverStopTimeout); if (writer.isAlive()) { final String msg = "Join on writer thread " + writer + " timed out"; DataNode.LOG.warn(msg + "\n" + StringUtils.getStackTrace(writer)); throw new IOException(msg); } } catch (InterruptedException e) { throw new IOException("Waiting for writer thread is interrupted."); } } }
" no longer contains " + replica + ". refCount " + (replica.refCount - 1) + " -> " + replica.refCount + StringUtils.getStackTrace(Thread.currentThread())); LOG.trace(this + ": replica refCount " + (replica.refCount - 1) + " -> " + replica.refCount + StringUtils.getStackTrace(Thread.currentThread()));
" no longer contains " + replica + ". refCount " + (replica.refCount - 1) + " -> " + replica.refCount + StringUtils.getStackTrace(Thread.currentThread())); LOG.trace(this + ": replica refCount " + (replica.refCount - 1) + " -> " + replica.refCount + StringUtils.getStackTrace(Thread.currentThread()));
/** * Trim the eviction lists. */ private void trimEvictionMaps() { long now = Time.monotonicNow(); demoteOldEvictableMmaped(now); while (true) { long evictableSize = evictable.size(); long evictableMmappedSize = evictableMmapped.size(); if (evictableSize + evictableMmappedSize <= maxTotalSize) { return; } ShortCircuitReplica replica; if (evictableSize == 0) { replica = evictableMmapped.firstEntry().getValue(); } else { replica = evictable.firstEntry().getValue(); } if (LOG.isTraceEnabled()) { LOG.trace(this + ": trimEvictionMaps is purging " + replica + StringUtils.getStackTrace(Thread.currentThread())); } purge(replica); } }
/** * Allocate a new slot and register it. * * This function chooses an empty slot, initializes it, and then returns * the relevant Slot object. * * @return The new slot. */ synchronized public final Slot allocAndRegisterSlot( ExtendedBlockId blockId) { int idx = allocatedSlots.nextClearBit(0); if (idx >= slots.length) { throw new RuntimeException(this + ": no more slots are available."); } allocatedSlots.set(idx, true); Slot slot = new Slot(calculateSlotAddress(idx), blockId); slot.clear(); slot.makeValid(); slots[idx] = slot; if (LOG.isTraceEnabled()) { LOG.trace(this + ": allocAndRegisterSlot " + idx + ": allocatedSlots=" + allocatedSlots + StringUtils.getStackTrace(Thread.currentThread())); } return slot; }
/** * Allocate a new slot and register it. * * This function chooses an empty slot, initializes it, and then returns * the relevant Slot object. * * @return The new slot. */ synchronized public final Slot allocAndRegisterSlot( ExtendedBlockId blockId) { int idx = allocatedSlots.nextClearBit(0); if (idx >= slots.length) { throw new RuntimeException(this + ": no more slots are available."); } allocatedSlots.set(idx, true); Slot slot = new Slot(calculateSlotAddress(idx), blockId); slot.clear(); slot.makeValid(); slots[idx] = slot; if (LOG.isTraceEnabled()) { LOG.trace(this + ": allocAndRegisterSlot " + idx + ": allocatedSlots=" + allocatedSlots + StringUtils.getStackTrace(Thread.currentThread())); } return slot; }
/** * Trim the eviction lists. */ private void trimEvictionMaps() { long now = Time.monotonicNow(); demoteOldEvictableMmaped(now); while (true) { long evictableSize = evictable.size(); long evictableMmappedSize = evictableMmapped.size(); if (evictableSize + evictableMmappedSize <= maxTotalSize) { return; } ShortCircuitReplica replica; if (evictableSize == 0) { replica = evictableMmapped.firstEntry().getValue(); } else { replica = evictable.firstEntry().getValue(); } if (LOG.isTraceEnabled()) { LOG.trace(this + ": trimEvictionMaps is purging " + replica + StringUtils.getStackTrace(Thread.currentThread())); } purge(replica); } }
LOG.trace("demoteOldEvictable: demoting " + replica + ": " + rationale + ": " + StringUtils.getStackTrace(Thread.currentThread()));
FSNamesystem.LOG.info("FSNamesystem write lock held for " + writeLockIntervalMs + " ms via\n" + StringUtils.getStackTrace(Thread.currentThread()) + "\tNumber of suppressed write-lock reports: " + numSuppressedWarnings + "\n\tLongest write-lock held interval: " +
" no longer contains " + replica + ". refCount " + (replica.refCount - 1) + " -> " + replica.refCount + StringUtils.getStackTrace(Thread.currentThread())); LOG.trace(this + ": replica refCount " + (replica.refCount - 1) + " -> " + replica.refCount + StringUtils.getStackTrace(Thread.currentThread()));
/** * Allocate a new slot and register it. * * This function chooses an empty slot, initializes it, and then returns * the relevant Slot object. * * @return The new slot. */ synchronized public final Slot allocAndRegisterSlot( ExtendedBlockId blockId) { int idx = allocatedSlots.nextClearBit(0); if (idx >= slots.length) { throw new RuntimeException(this + ": no more slots are available."); } allocatedSlots.set(idx, true); Slot slot = new Slot(calculateSlotAddress(idx), blockId); slot.clear(); slot.makeValid(); slots[idx] = slot; if (LOG.isTraceEnabled()) { LOG.trace(this + ": allocAndRegisterSlot " + idx + ": allocatedSlots=" + allocatedSlots + StringUtils.getStackTrace(Thread.currentThread())); } return slot; }
if (LOG.isTraceEnabled()) { LOG.trace(this + ": registerSlot " + slotIdx + ": allocatedSlots=" + allocatedSlots + StringUtils.getStackTrace(Thread.currentThread()));
LOG.trace("demoteOldEvictable: demoting " + replica + ": " + rationale + ": " + StringUtils.getStackTrace(Thread.currentThread()));
/** * Trim the eviction lists. */ private void trimEvictionMaps() { long now = Time.monotonicNow(); demoteOldEvictableMmaped(now); while (true) { long evictableSize = evictable.size(); long evictableMmappedSize = evictableMmapped.size(); if (evictableSize + evictableMmappedSize <= maxTotalSize) { return; } ShortCircuitReplica replica; try { if (evictableSize == 0) { replica = (ShortCircuitReplica)evictableMmapped.get(evictableMmapped .firstKey()); } else { replica = (ShortCircuitReplica)evictable.get(evictable.firstKey()); } } catch (NoSuchElementException e) { break; } if (LOG.isTraceEnabled()) { LOG.trace(this + ": trimEvictionMaps is purging " + replica + StringUtils.getStackTrace(Thread.currentThread())); } purge(replica); } }