if (numProblems > 0)
banner(sb, "error", String.format("<a href='/problems'>Table Problems: %d Total</a>", numProblems));
}
static void doTableList(HttpServletRequest req, StringBuilder sb, Map<String,String> tidToNameMap) {
Table tableList = new Table("tableList", "Table List");
tableList.addSortableColumn("Table Name", new TableLinkType(), null);
tableList.addSortableColumn("State", new TableStateType(), null);
tableList.addSortableColumn("# Tablets", new NumberType<Integer>(), "Tables are broken down into ranges of rows called tablets.");
tableList.addSortableColumn("# Offline<br />Tablets", new NumberType<Integer>(0, 0), "Tablets unavailable for query or ingest. "
+ "May be a transient condition when tablets are moved for balancing.");
tableList.addSortableColumn("Entries", new NumberType<Long>(), "Key/value pairs over each instance, table or tablet.");
tableList.addSortableColumn("Entries<br />In Memory", new NumberType<Long>(),
"The total number of key/value pairs stored in memory and not yet written to disk");
tableList.addSortableColumn("Ingest", new NumberType<Long>(), "The number of Key/Value pairs inserted. Note that deletes are 'inserted'.");
tableList.addSortableColumn("Entries<br/>Read", new NumberType<Long>(),
"The number of Key/Value pairs read on the server side. Not all key values read may be returned to client because of filtering.");
tableList.addSortableColumn("Entries<br/>Returned", new NumberType<Long>(),
"The number of Key/Value pairs returned to clients during queries. This is <b>not</b> the number of scans.");
tableList.addSortableColumn("Hold Time", new DurationType(0l, 0l),
"The amount of time that ingest operations are suspended while waiting for data to be written to disk.");
tableList.addSortableColumn("Running<br />Scans", new CompactionsType("scans"),
"Information about the scans threads. Shows how many threads are running and how much work is queued for the threads.");
tableList.addSortableColumn("Minor<br />Compactions", new CompactionsType("minor"), "Flushing memory to disk is called a \"minor compaction.\" "
+ "Multiple tablets can be minor compacted simultaneously, but " + "" + "sometimes they must wait for resources to be available. These "
+ "tablets that are waiting for compaction are \"queued\" and are " + "indicated using parentheses. So <tt> 2 (3)</tt> indicates there are "
+ "two compactions running and three queued waiting for resources.");
tableList.addSortableColumn("Major<br />Compactions", new CompactionsType("major"),
"Gathering up many small files and rewriting them as one larger file is called a 'Major Compaction'. "
+ "Major Compactions are performed as a consequence of new files created from Minor Compactions and Bulk Load operations. "
+ "They reduce the number of files used during queries.");
SortedMap<String,TableInfo> tableStats = new TreeMap<String,TableInfo>();
if (Monitor.getMmi() != null && Monitor.getMmi().tableMap != null)
for (Entry<String,TableInfo> te : Monitor.getMmi().tableMap.entrySet())
tableStats.put(Tables.getPrintableTableNameFromId(tidToNameMap, te.getKey()), te.getValue());
Map<String,Double> compactingByTable = TableInfoUtil.summarizeTableStats(Monitor.getMmi());
TableManager tableManager = TableManager.getInstance();
for (Entry<String,String> tableName_tableId : Tables.getNameToIdMap(HdfsZooInstance.getInstance()).entrySet()) {
String tableName = tableName_tableId.getKey();
String tableId = tableName_tableId.getValue();
TableInfo tableInfo = tableStats.get(tableName);
Double holdTime = compactingByTable.get(tableId);
if (holdTime == null)
holdTime = new Double(0.);
TableRow row = tableList.prepareRow();
row.add(tableId);
row.add(tableManager.getTableState(tableId));
row.add(tableInfo == null ? null : tableInfo.tablets);
row.add(tableInfo == null ? null : tableInfo.tablets - tableInfo.onlineTablets);
row.add(tableInfo == null ? null : tableInfo.recs);
row.add(tableInfo == null ? null : tableInfo.recsInMemory);
row.add(tableInfo == null ? null : tableInfo.ingestRate);
row.add(tableInfo == null ? null : tableInfo.scanRate);
row.add(tableInfo == null ? null : tableInfo.queryRate);
row.add(holdTime.longValue());
row.add(tableInfo);
row.add(tableInfo);
row.add(tableInfo);
tableList.addRow(row);
}
tableList.generate(req, sb);
}