public boolean isTableState(TableName tableName, TableState.State... states) { try { TableState tableState = getTableState(tableName); return tableState.isInStates(states); } catch (IOException e) { LOG.error("Unable to get table " + tableName + " state", e); // XXX: is it safe to just return false here? return false; } }
private boolean needSetLastPushedSequenceId(TableStateManager tsm, TableName tn) throws IOException { for (;;) { try { if (!tsm.getTableState(tn).isDisabling()) { return true; } Thread.sleep(SLEEP_INTERVAL_MS); } catch (TableStateNotFoundException e) { return false; } catch (InterruptedException e) { throw (IOException) new InterruptedIOException(e.getMessage()).initCause(e); } } }
private boolean needReopen(TableStateManager tsm, TableName tn) throws IOException { for (;;) { try { TableState state = tsm.getTableState(tn); if (state.isEnabled()) { return true; } if (!state.isEnabling()) { return false; } Thread.sleep(SLEEP_INTERVAL_MS); } catch (TableStateNotFoundException e) { return false; } catch (InterruptedException e) { throw (IOException) new InterruptedIOException(e.getMessage()).initCause(e); } } }
@Override public void checkTableModifiable(final TableName tableName) throws IOException, TableNotFoundException, TableNotDisabledException { if (isCatalogTable(tableName)) { throw new IOException("Can't modify catalog tables"); } checkTableExists(tableName); TableState ts = getTableStateManager().getTableState(tableName); if (!ts.isDisabled()) { throw new TableNotDisabledException("Not DISABLED; " + ts); } }
ts = getTableState(entry.getKey()); } catch (TableStateNotFoundException e) {
TableState tableState = master.getTableStateManager().getTableState(tableName); Map<RegionState.State, List<RegionInfo>> tableRegions = master.getAssignmentManager().getRegionStates()
public static void validateTableIsDisabled(final HMaster master, final TableName tableName) throws IOException { TableStateManager tsm = master.getTableStateManager(); assertTrue(tsm.getTableState(tableName).getState().equals(TableState.State.DISABLED)); }
public static void validateTableIsEnabled(final HMaster master, final TableName tableName) throws IOException { TableStateManager tsm = master.getTableStateManager(); assertTrue(tsm.getTableState(tableName).getState().equals(TableState.State.ENABLED)); }
@Override public GetTableStateResponse getTableState(RpcController controller, GetTableStateRequest request) throws ServiceException { try { master.checkServiceStarted(); TableName tableName = ProtobufUtil.toTableName(request.getTableName()); TableState ts = master.getTableStateManager().getTableState(tableName); GetTableStateResponse.Builder builder = GetTableStateResponse.newBuilder(); builder.setTableState(ts.convert()); return builder.build(); } catch (IOException e) { throw new ServiceException(e); } }
this.serverManager = new ServerManager(this); this.tableStateManager = Mockito.mock(TableStateManager.class); Mockito.when(this.tableStateManager.getTableState(Mockito.any())). thenReturn(new TableState(TableName.valueOf("AnyTableNameSetInMockMasterServcies"), TableState.State.ENABLED));
TableState ts = tsm.getTableState(tableName); if(!ts.isDisabled()){ LOG.info("Not DISABLED tableState={}; skipping enable; {}", ts.getState(), this);
/** * Update state of the table in meta only. This is required by hbck in some situations to cleanup * stuck assign/ unassign regions procedures for the table. * * @return previous state of the table */ @Override public GetTableStateResponse setTableStateInMeta(RpcController controller, SetTableStateInMetaRequest request) throws ServiceException { TableName tn = ProtobufUtil.toTableName(request.getTableName()); try { HBaseProtos.TableState prevState = this.master.getTableStateManager().getTableState(tn).convert(); this.master.getTableStateManager().setTableState(tn, TableState.convert(tn, request.getTableState()).getState()); return GetTableStateResponse.newBuilder().setTableState(prevState).build(); } catch (Exception e) { throw new ServiceException(e); } }
TableState ts = tsm.getTableState(tableName); if (!ts.isEnabled()) { LOG.info("Not ENABLED, state={}, skipping disable; {}", ts.getState(), this);
out.print( tableName.getQualifierAsString() ); out.write("</a></td>\n "); TableState tableState = master.getTableStateManager().getTableState(tableName); if(tableState.isDisabledOrDisabling()) {
TableName tn = getTableName(); TableStateManager tsm = master.getTableStateManager(); TableState ts = tsm.getTableState(tn); if (enabled) { if (!ts.isEnabledOrEnabling()) {
public static void validateTableIsEnabled(final HMaster master, final TableName tableName) throws IOException { TableStateManager tsm = master.getTableStateManager(); assertTrue(tsm.getTableState(tableName).getState().equals(TableState.State.ENABLED)); }
public static void validateTableIsDisabled(final HMaster master, final TableName tableName) throws IOException { TableStateManager tsm = master.getTableStateManager(); assertTrue(tsm.getTableState(tableName).getState().equals(TableState.State.DISABLED)); }
this.serverManager = new ServerManager(this); this.tableStateManager = Mockito.mock(TableStateManager.class); Mockito.when(this.tableStateManager.getTableState(Mockito.any())). thenReturn(new TableState(TableName.valueOf("AnyTableNameSetInMockMasterServcies"), TableState.State.ENABLED));