/** {@inheritDoc} */ @Override public List<String> getTableNames() throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot get table names in Fiji instance %s in state %s.", this, state); return getMetaTable().listTables(); }
/** * Writes the new table layout to the meta-table. * * @param update Layout update to write to the meta-table. * @throws IOException on I/O error. */ private void writeMetaTable(TableLayoutDesc update) throws IOException { LOG.info("Updating layout for table {} from layout ID {} to layout ID {} in meta-table.", mTableURI, update.getReferenceLayout(), update.getLayoutId()); final String table = update.getName(); mNewLayout = mFiji.getMetaTable().updateTableLayout(table, update); }
/** {@inheritDoc} */ @Deprecated @Override public void createTable(String tableName, FijiTableLayout tableLayout, byte[][] splitKeys) throws IOException { if (getMetaTable().tableExists(tableName)) { final FijiURI tableURI = FijiURI.newBuilder(mURI).withTableName(tableName).build(); throw new FijiAlreadyExistsException(String.format( "Fiji table '%s' already exists.", tableURI), tableURI); } if (!tableName.equals(tableLayout.getName())) { throw new RuntimeException(String.format( "Table name from layout descriptor '%s' does match table name '%s'.", tableLayout.getName(), tableName)); } createTable(tableLayout.getDesc(), splitKeys); }
/** * Attempt to delete a table from this System_1_0 Fiji instance. * * @param tableName to delete * @throws IOException on unrecoverable error. */ private void deleteTableSystem_1_0(String tableName) throws IOException { // Delete from HBase. String hbaseTable = FijiManagedHBaseTableName.getFijiTableName(mURI.getInstance(), tableName).toString(); getHBaseAdmin().disableTable(hbaseTable); getHBaseAdmin().deleteTable(hbaseTable); // Delete from the meta table. getMetaTable().deleteTable(tableName); // If the table persists immediately after deletion attempt, then give up. if (getHBaseAdmin().tableExists(hbaseTable)) { LOG.warn("HBase table " + hbaseTable + " survives deletion attempt. Giving up..."); } }
final FijiMetaTable metaTable = getMetaTable();
if (getMetaTable().tableExists(tableLayout.getName())) { throw new FijiAlreadyExistsException( String.format("Fiji table '%s' already exists.", tableURI), tableURI); getMetaTable().updateTableLayout(tableLayout.getName(), tableLayout);
final FijiMetaTable metaTable = mFiji.getMetaTable();