public TableManager getTableManager() { return context.getTableManager(); }
TabletGoalState getTableGoalState(KeyExtent extent) { TableState tableState = context.getTableManager().getTableState(extent.getTableId()); if (tableState == null) return TabletGoalState.DELETED; switch (tableState) { case DELETING: return TabletGoalState.DELETED; case OFFLINE: case NEW: return TabletGoalState.UNASSIGNED; default: return TabletGoalState.HOSTED; } }
/** * If migrating a tablet for a table that is offline, the migration can never succeed because no * tablet server will load the tablet. check for offline tables and remove their migrations. */ private void cleanupOfflineMigrations() { TableManager manager = context.getTableManager(); for (Table.ID tableId : Tables.getIdToNameMap(context).keySet()) { TableState state = manager.getTableState(tableId); if (state == TableState.OFFLINE) { clearMigrations(tableId); } } } }
private static int checkTablets(ServerContext context, Iterator<TabletLocationState> scanner, LiveTServerSet tservers) { int offline = 0; while (scanner.hasNext() && !System.out.checkError()) { TabletLocationState locationState = scanner.next(); TabletState state = locationState.getState(tservers.getCurrentServers()); if (state != null && state != TabletState.HOSTED && context.getTableManager() .getTableState(locationState.extent.getTableId()) != TableState.OFFLINE) { System.out .println(locationState + " is " + state + " #walogs:" + locationState.walogs.size()); offline++; } } return offline; } }
@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 = context.getTableManager(); for (Table.ID tableId : Tables.getIdToNameMap(context).keySet()) { TableState state = manager.getTableState(tableId); if (state != null) { if (state == TableState.ONLINE) result.add(tableId); } } return result; }
Table.ID tableId = Table.ID.of(parts[1]); String tabletDir = parts[2]; context.getTableManager().updateTableStateCache(tableId); TableState tableState = context.getTableManager().getTableState(tableId); if (tableState != null && tableState != TableState.DELETING) {
protected String getLoadBalancerClassNameForTable(Table.ID table) { TableState tableState = context.getTableManager().getTableState(table); if (tableState == null) return null; if (tableState.equals(TableState.ONLINE)) return this.context.getServerConfFactory().getTableConfiguration(table) .get(Property.TABLE_LOAD_BALANCER); return null; }
TableManager tableManager = Monitor.getContext().getTableManager();
TableState tableState = context.getTableManager().getTableState(tableId); if (tableState != TableState.OFFLINE) { log.info("Taking {} offline", tableName);
@Override public Repo<Master> call(long tid, Master env) throws Exception { if (tableInfo.getInitialTableState() == InitialTableState.OFFLINE) { env.getContext().getTableManager().transitionTableState(tableInfo.getTableId(), TableState.OFFLINE); } else { env.getContext().getTableManager().transitionTableState(tableInfo.getTableId(), TableState.ONLINE); } Utils.unreserveNamespace(env, tableInfo.getNamespaceId(), tid, false); Utils.unreserveTable(env, tableInfo.getTableId(), tid, true); env.getEventCoordinator().event("Created table %s ", tableInfo.getTableName()); if (tableInfo.getInitialSplitSize() > 0) { cleanupSplitFiles(env); } return null; }
TableManager manager = context.getTableManager(); for (Entry<Table.ID,TableCounts> entry : watcher.getStats().entrySet()) { Table.ID tableId = entry.getKey();
context.getTableManager().addObserver(this);