use of org.apache.accumulo.server.tables.TableManager in project accumulo by apache.
the class Master method onlineTables.
@Override
public Set<Table.ID> onlineTables() {
Set<Table.ID> result = new HashSet<>();
if (getMasterState() != MasterState.NORMAL) {
if (getMasterState() != MasterState.UNLOAD_METADATA_TABLETS)
result.add(MetadataTable.ID);
if (getMasterState() != MasterState.UNLOAD_ROOT_TABLET)
result.add(RootTable.ID);
return result;
}
TableManager manager = TableManager.getInstance();
for (Table.ID tableId : Tables.getIdToNameMap(getInstance()).keySet()) {
TableState state = manager.getTableState(tableId);
if (state != null) {
if (state == TableState.ONLINE)
result.add(tableId);
}
}
return result;
}
use of org.apache.accumulo.server.tables.TableManager in project accumulo by apache.
the class TablesResource method getTables.
/**
* Generates a list of all the tables
*
* @return list with all tables
*/
@GET
public static TableInformationList getTables() {
TableInformationList tableList = new TableInformationList();
SortedMap<Table.ID, TableInfo> tableStats = new TreeMap<>();
if (Monitor.getMmi() != null && Monitor.getMmi().tableMap != null)
for (Map.Entry<String, TableInfo> te : Monitor.getMmi().tableMap.entrySet()) tableStats.put(Table.ID.of(te.getKey()), te.getValue());
Map<String, Double> compactingByTable = TableInfoUtil.summarizeTableStats(Monitor.getMmi());
TableManager tableManager = TableManager.getInstance();
// Add tables to the list
for (Map.Entry<String, Table.ID> entry : Tables.getNameToIdMap(HdfsZooInstance.getInstance()).entrySet()) {
String tableName = entry.getKey();
Table.ID tableId = entry.getValue();
TableInfo tableInfo = tableStats.get(tableId);
TableState tableState = tableManager.getTableState(tableId);
if (null != tableInfo && !tableState.equals(TableState.OFFLINE)) {
Double holdTime = compactingByTable.get(tableId.canonicalID());
if (holdTime == null)
holdTime = 0.;
tableList.addTable(new TableInformation(tableName, tableId, tableInfo, holdTime, tableState.name()));
} else {
tableList.addTable(new TableInformation(tableName, tableId, tableState.name()));
}
}
return tableList;
}
use of org.apache.accumulo.server.tables.TableManager in project accumulo by apache.
the class Master method displayUnassigned.
// The number of unassigned tablets that should be assigned: displayed on the monitor page
int displayUnassigned() {
int result = 0;
switch(getMasterState()) {
case NORMAL:
// Count offline tablets for online tables
for (TabletGroupWatcher watcher : watchers) {
TableManager manager = TableManager.getInstance();
for (Entry<Table.ID, TableCounts> entry : watcher.getStats().entrySet()) {
Table.ID tableId = entry.getKey();
TableCounts counts = entry.getValue();
TableState tableState = manager.getTableState(tableId);
if (tableState != null && tableState.equals(TableState.ONLINE)) {
result += counts.unassigned() + counts.assignedToDeadServers() + counts.assigned() + counts.suspended();
}
}
}
break;
case SAFE_MODE:
// Count offline tablets for the metadata table
for (TabletGroupWatcher watcher : watchers) {
TableCounts counts = watcher.getStats(MetadataTable.ID);
result += counts.unassigned() + counts.suspended();
}
break;
case UNLOAD_METADATA_TABLETS:
case UNLOAD_ROOT_TABLET:
for (TabletGroupWatcher watcher : watchers) {
TableCounts counts = watcher.getStats(MetadataTable.ID);
result += counts.unassigned() + counts.suspended();
}
break;
default:
break;
}
return result;
}
Aggregations