Search in sources :

Example 1 with TableCounts

use of org.apache.accumulo.master.state.TableCounts 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;
}
Also used : RootTable(org.apache.accumulo.core.metadata.RootTable) Table(org.apache.accumulo.core.client.impl.Table) ReplicationTable(org.apache.accumulo.core.replication.ReplicationTable) MetadataTable(org.apache.accumulo.core.metadata.MetadataTable) TableManager(org.apache.accumulo.server.tables.TableManager) TableCounts(org.apache.accumulo.master.state.TableCounts) TableState(org.apache.accumulo.core.master.state.tables.TableState)

Example 2 with TableCounts

use of org.apache.accumulo.master.state.TableCounts in project accumulo by apache.

the class Master method assignedOrHosted.

private int assignedOrHosted(Table.ID tableId) {
    int result = 0;
    for (TabletGroupWatcher watcher : watchers) {
        TableCounts count = watcher.getStats(tableId);
        result += count.hosted() + count.assigned();
    }
    return result;
}
Also used : TableCounts(org.apache.accumulo.master.state.TableCounts)

Aggregations

TableCounts (org.apache.accumulo.master.state.TableCounts)2 Table (org.apache.accumulo.core.client.impl.Table)1 TableState (org.apache.accumulo.core.master.state.tables.TableState)1 MetadataTable (org.apache.accumulo.core.metadata.MetadataTable)1 RootTable (org.apache.accumulo.core.metadata.RootTable)1 ReplicationTable (org.apache.accumulo.core.replication.ReplicationTable)1 TableManager (org.apache.accumulo.server.tables.TableManager)1