HBASE-15720 Print row locks at the debug dump page
This commit is contained in:
parent
3d4f026702
commit
e8b37422c3
|
@ -5167,6 +5167,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
|||
rowLockContext.cleanUp();
|
||||
throw new IOException("Timed out waiting for lock for row: " + rowKey);
|
||||
}
|
||||
rowLockContext.setThreadName(Thread.currentThread().getName());
|
||||
return result;
|
||||
} catch (InterruptedException ie) {
|
||||
LOG.warn("Thread interrupted waiting for lock on row: " + rowKey);
|
||||
|
@ -5194,6 +5195,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
|||
}
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<HashedBytes, RowLockContext> getLockedRows() {
|
||||
return lockedRows;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
class RowLockContext {
|
||||
private final HashedBytes row;
|
||||
|
@ -5201,6 +5206,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
|||
final AtomicBoolean usable = new AtomicBoolean(true);
|
||||
final AtomicInteger count = new AtomicInteger(0);
|
||||
final Object lock = new Object();
|
||||
private String threadName;
|
||||
|
||||
RowLockContext(HashedBytes row) {
|
||||
this.row = row;
|
||||
|
@ -5239,12 +5245,17 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
|||
}
|
||||
}
|
||||
|
||||
public void setThreadName(String threadName) {
|
||||
this.threadName = threadName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RowLockContext{" +
|
||||
"row=" + row +
|
||||
", readWriteLock=" + readWriteLock +
|
||||
", count=" + count +
|
||||
", threadName=" + threadName +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.io.OutputStream;
|
|||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
@ -69,6 +68,10 @@ public class RSDumpServlet extends StateDumpServlet {
|
|||
out.println(LINE);
|
||||
TaskMonitor.get().dumpAsText(out);
|
||||
|
||||
out.println("\n\nRowLocks:");
|
||||
out.println(LINE);
|
||||
dumpRowLock(hrs, out);
|
||||
|
||||
out.println("\n\nExecutors:");
|
||||
out.println(LINE);
|
||||
dumpExecutors(hrs.getExecutorService(), out);
|
||||
|
@ -100,6 +103,22 @@ public class RSDumpServlet extends StateDumpServlet {
|
|||
out.flush();
|
||||
}
|
||||
|
||||
public static void dumpRowLock(HRegionServer hrs, PrintWriter out) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Region region : hrs.getOnlineRegions()) {
|
||||
HRegion hRegion = (HRegion)region;
|
||||
if (hRegion.getLockedRows().size() > 0) {
|
||||
for (HRegion.RowLockContext rowLockContext : hRegion.getLockedRows().values()) {
|
||||
sb.setLength(0);
|
||||
sb.append(hRegion.getTableDesc().getTableName()).append(",")
|
||||
.append(hRegion.getRegionInfo().getEncodedName()).append(",");
|
||||
sb.append(rowLockContext.toString());
|
||||
out.println(sb.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void dumpQueue(HRegionServer hrs, PrintWriter out)
|
||||
throws IOException {
|
||||
if (hrs.compactSplitThread != null) {
|
||||
|
|
Loading…
Reference in New Issue