@Override protected Boolean rpcCall(int callTimeout) throws Exception { return MetaTableAccessor.tableExists(connection, tableName); } });
@Override protected TableName rpcCall(int callTimeout) throws Exception { if (!MetaTableAccessor.tableExists(connection, tableName)) { throw new TableNotFoundException(tableName); } return tableName; } });
private void checkTableExists(final TableName tableName) throws IOException, TableNotFoundException { if (!MetaTableAccessor.tableExists(getConnection(), tableName)) { throw new TableNotFoundException(tableName); } }
/********************************* Master related hooks **********************************/ @Override public void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException { // Need to create the new system table for labels here if (!MetaTableAccessor.tableExists(ctx.getEnvironment().getConnection(), LABELS_TABLE_NAME)) { HTableDescriptor labelsTable = new HTableDescriptor(LABELS_TABLE_NAME); HColumnDescriptor labelsColumn = new HColumnDescriptor(LABELS_TABLE_FAMILY); labelsColumn.setBloomFilterType(BloomType.NONE); labelsColumn.setBlockCacheEnabled(false); // We will cache all the labels. No need of normal // table block cache. labelsTable.addFamily(labelsColumn); // Let the "labels" table having only one region always. We are not expecting too many labels in // the system. labelsTable.setValue(HTableDescriptor.SPLIT_POLICY, DisabledRegionSplitPolicy.class.getName()); try (Admin admin = ctx.getEnvironment().getConnection().getAdmin()) { admin.createTable(labelsTable); } } }
/** * Check whether a table is modifiable - exists and either offline or online with config set * @param env MasterProcedureEnv * @throws IOException */ protected void checkTableModifiable(final MasterProcedureEnv env) throws IOException { // Checks whether the table exists if (!MetaTableAccessor.tableExists(env.getMasterServices().getConnection(), getTableName())) { throw new TableNotFoundException(getTableName()); } }
if (!MetaTableAccessor.tableExists(conn, table)) { LOG.warn("Table " + table + " does not exists, skipping it."); continue;
/** * Check whether a table is modifiable - exists and either offline or online with config set * @param env MasterProcedureEnv * @throws IOException */ @Override protected void checkTableModifiable(final MasterProcedureEnv env) throws IOException { // Checks whether the table exists if (!MetaTableAccessor.tableExists(env.getMasterServices().getConnection(), getTableName())) { throw new TableNotFoundException(getTableName()); } }
/** * Action before any real action of cloning from snapshot. * @param env MasterProcedureEnv * @throws IOException */ private void prepareClone(final MasterProcedureEnv env) throws IOException { final TableName tableName = getTableName(); if (MetaTableAccessor.tableExists(env.getMasterServices().getConnection(), tableName)) { throw new TableExistsException(getTableName()); } }
/** * Check quota to create table. * We add the table information to namespace state cache, assuming the operation will * pass. If the operation fails, then the next time namespace state chore runs * namespace state cache will be corrected. * * @param tName - The table name to check quota. * @param regions - Number of regions that will be added. * @throws IOException Signals that an I/O exception has occurred. */ public void checkQuotaToCreateTable(TableName tName, int regions) throws IOException { if (stateManager.isInitialized()) { // We do this check to fail fast. if (MetaTableAccessor.tableExists(this.masterServices.getConnection(), tName)) { throw new TableExistsException(tName); } stateManager.checkAndUpdateNamespaceTableCount(tName, regions); } else { checkTableTypeAndThrowException(tName); } }
@Test public void testTableExists() throws IOException { final TableName tableName = TableName.valueOf(name.getMethodName()); assertFalse(MetaTableAccessor.tableExists(connection, tableName)); UTIL.createTable(tableName, HConstants.CATALOG_FAMILY); assertTrue(MetaTableAccessor.tableExists(connection, tableName)); Admin admin = UTIL.getAdmin(); admin.disableTable(tableName); admin.deleteTable(tableName); assertFalse(MetaTableAccessor.tableExists(connection, tableName)); assertTrue(MetaTableAccessor.tableExists(connection, TableName.META_TABLE_NAME)); UTIL.createTable(tableName, HConstants.CATALOG_FAMILY); assertTrue(MetaTableAccessor.tableExists(connection, tableName)); admin.disableTable(tableName); admin.deleteTable(tableName); assertFalse(MetaTableAccessor.tableExists(connection, tableName)); }
public void start() throws IOException { // If the user doesn't want the quota support skip all the initializations. if (!QuotaUtil.isQuotaEnabled(masterServices.getConfiguration())) { LOG.info("Quota support disabled"); return; } // Create the quota table if missing if (!MetaTableAccessor.tableExists(masterServices.getConnection(), QuotaUtil.QUOTA_TABLE_NAME)) { LOG.info("Quota table not found. Creating..."); createQuotaTable(); } LOG.info("Initializing quota support"); namespaceLocks = new NamedLock<>(); tableLocks = new NamedLock<>(); userLocks = new NamedLock<>(); regionServerLocks = new NamedLock<>(); regionSizes = new ConcurrentHashMap<>(); namespaceQuotaManager = new NamespaceAuditor(masterServices); namespaceQuotaManager.start(); initialized = true; rpcThrottleStorage = new RpcThrottleStorage(masterServices.getZooKeeper(), masterServices.getConfiguration()); }
private boolean prepareCreate(final MasterProcedureEnv env) throws IOException { final TableName tableName = getTableName(); if (MetaTableAccessor.tableExists(env.getMasterServices().getConnection(), tableName)) { setFailure("master-create-table", new TableExistsException(getTableName())); return false; } // check that we have at least 1 CF if (tableDescriptor.getColumnFamilyCount() == 0) { setFailure("master-create-table", new DoNotRetryIOException("Table " + getTableName().toString() + " should have at least one column family.")); return false; } return true; }
if (MetaTableAccessor.tableExists(master.getConnection(), tableName)) { procId = restoreSnapshot(reqSnapshot, tableName, snapshot, snapshotTableDesc, nonceKey, restoreAcl);
if (!MetaTableAccessor.tableExists(env.getMasterServices().getConnection(), tableName)) { setFailure("master-enable-table", new TableNotFoundException(tableName)); canTableBeEnabled = false;
assertTrue(MetaTableAccessor.tableExists(master.getConnection(), tableName)); assertEquals(regions.length, countMetaRegions(master, tableName));
boolean tableExists = MetaTableAccessor.tableExists(regionServer.getConnection(), tableName); assertEquals("The specified table should be present.", true, tableExists); } while ((newRegions.contains(oldRegions.get(0)) || newRegions.contains(oldRegions.get(1))) || newRegions.size() != 4); tableExists = MetaTableAccessor.tableExists(regionServer.getConnection(), tableName); assertEquals("The specified table should be present.", true, tableExists);
setFailure("master-disable-table", new ConstraintException("Cannot disable catalog table")); canTableBeDisabled = false; } else if (!MetaTableAccessor.tableExists(env.getMasterServices().getConnection(), tableName)) { setFailure("master-disable-table", new TableNotFoundException(tableName)); canTableBeDisabled = false;
public static void validateTableDeletion( final HMaster master, final TableName tableName) throws IOException { // check filesystem final FileSystem fs = master.getMasterFileSystem().getFileSystem(); final Path tableDir = FSUtils.getTableDir(master.getMasterFileSystem().getRootDir(), tableName); assertFalse(fs.exists(tableDir)); // check meta assertFalse(MetaTableAccessor.tableExists(master.getConnection(), tableName)); assertEquals(0, countMetaRegions(master, tableName)); // check htd assertTrue("found htd of deleted table", master.getTableDescriptors().get(tableName) == null); }
if (!MetaTableAccessor.tableExists(env.getMasterServices().getConnection(), getTableName())) { throw new TableNotFoundException(getTableName());
final TableName tableName = getTableName(); if (!MetaTableAccessor.tableExists(env.getMasterServices().getConnection(), tableName)) { throw new TableNotFoundException(tableName);