TransactionQueueManager queueManager = hstore_site.getTransactionQueueManager();
TransactionQueueManager.Debug queueManagerDebug = queueManager.getDebugContext();
HStoreThreadManager threadManager = hstore_site.getThreadManager();
HStoreThreadManager.Debug threadManagerDebug = threadManager.getDebugContext();
PartitionExecutorProfiler total = new PartitionExecutorProfiler();
// EXECUTION ENGINES
Map<Integer, String> partitionLabels = new HashMap<Integer, String>();
ObjectHistogram<Integer> invokedTxns = new ObjectHistogram<Integer>();
Long txn_id = null;
for (int partition : hstore_site.getLocalPartitionIds().values()) {
String partitionLabel = String.format("%02d", partition);
partitionLabels.put(partition, partitionLabel);
PartitionExecutor executor = hstore_site.getPartitionExecutor(partition);
if (executor == null) continue;
PartitionExecutor.Debug executorDebug = executor.getDebugContext();
PartitionExecutorProfiler profiler = executorDebug.getProfiler();
PartitionLockQueue lockQueue = queueManager.getLockQueue(partition);
// Queue Information
Map<String, Object> m = new LinkedHashMap<String, Object>();
// PartitionLockQueue
String queueStatus = String.format("%d queued / %3d blocked / %3d spec-exec / %3d restart\n",
lockQueue.size(),
executorDebug.getBlockedWorkCount(),
executorDebug.getBlockedSpecExecCount(),
queueManagerDebug.getRestartQueueSize()
);
queueStatus += String.format("%s [limit=%d, release=%d] %s",
lockQueue.getQueueState(),
lockQueue.getThrottleThreshold(),
lockQueue.getThrottleRelease(),
(lockQueue.isThrottled() ? "*THROTTLED* " : ""));
txn_id = queueManagerDebug.getCurrentTransaction(partition);
if (txn_id != null) {
AbstractTransaction ts = hstore_site.getTransaction(txn_id);
if (ts != null) {
PartitionCountingCallback<AbstractTransaction> callback = ts.getInitCallback();
if (callback != null) {
queueStatus += String.format("\nReceivedPartitions=%s / AllPartitions=%s",
callback.getReceivedPartitions(), callback.getPartitions());
}
}
}
m.put("Lock Queue", queueStatus);
if (profiler != null) {
String inner = String.format("%d current / %d processed\n%s",
executorDebug.getWorkQueueSize(),
profiler.numMessages.getSampleCount(),
profiler.numMessages.toString(30, 20));
m.put("Work Queue", inner);
} else {
m.put("Work Queue", String.format("%d current", executorDebug.getWorkQueueSize()));
}
txn_id = executorDebug.getCurrentTxnId();
m.put("Current Txn", String.format("%s / %s", (txn_id != null ? "#"+txn_id : "-"), executorDebug.getExecutionMode()));
AbstractTransaction current_dtxn = executorDebug.getCurrentDtxn();
m.put("Current DTXN", (current_dtxn == null ? "-" : current_dtxn));
txn_id = executorDebug.getLastExecutedTxnId();
m.put("Last Executed Txn", (txn_id != null ? "#"+txn_id : "-"));
txn_id = executorDebug.getLastCommittedTxnId();
m.put("Last Committed Txn", (txn_id != null ? "#"+txn_id : "-"));
// Partition Executor Profiler Info
if (hstore_conf.site.exec_profiling) {
PartitionExecutorProfiler lastProfiler = this.lastExecMeasurements.get(executor);
PartitionExecutorProfiler nextProfiler = new PartitionExecutorProfiler();
invokedTxns.put(partition, (int)profiler.txn_time.getInvocations());
AbstractProfiler profilers[] = { profiler, lastProfiler, nextProfiler, total };
for (ProfileMeasurement pm : profilers[0].getProfileMeasurements()) {
String name = pm.getName();