/** * @return true if this region is from a system table */ public boolean isSystemTable() { return tableName.isSystemTable(); }
@Override public void setPriority(final TableName tn) { setPriority( tn != null && tn.isSystemTable() ? HConstants.SYSTEMTABLE_QOS : HConstants.NORMAL_QOS); }
/** * @return the region name */ @XmlAttribute public String getName() { byte [] tableNameAsBytes = Bytes.toBytes(this.table); TableName tableName = TableName.valueOf(tableNameAsBytes); byte [] nameAsBytes = HRegionInfo.createRegionName( tableName, this.startKey, this.id, !tableName.isSystemTable()); return Bytes.toString(nameAsBytes); }
@Override protected boolean shouldWaitClientAck(MasterProcedureEnv env) { // system tables are created on bootstrap internally by the system // the client does not know about this procedures. return !getTableName().isSystemTable(); }
/** * Check if a region belongs to some system table. * If so, the primary replica may be expected to be put on the master regionserver. */ public boolean shouldBeOnMaster(RegionInfo region) { return (this.maintenanceMode || this.onlySystemTablesOnMaster) && region.getTable().isSystemTable(); }
private void checkTableTypeAndThrowException(TableName name) throws IOException { if (name.isSystemTable()) { LOG.debug("Namespace auditor checks not performed for table " + name.getNameAsString()); } else { throw new HBaseIOException( name + " is being created even before namespace auditor has been initialized."); } }
AccessControlFilter(AuthManager mgr, User ugi, TableName tableName, Strategy strategy, Map<ByteRange, Integer> cfVsMaxVersions) { authManager = mgr; table = tableName; user = ugi; isSystemTable = tableName.isSystemTable(); this.strategy = strategy; this.cfVsMaxVersions = cfVsMaxVersions; this.prevFam = new SimpleMutableByteRange(); this.prevQual = new SimpleMutableByteRange(); }
protected static void deleteTableStates(final MasterProcedureEnv env, final TableName tableName) throws IOException { if (!tableName.isSystemTable()) { ProcedureSyncWait.getMasterQuotaManager(env).removeTableFromNamespaceQuota(tableName); } } }
@Override protected boolean waitInitialized(MasterProcedureEnv env) { if (getTableName().isSystemTable()) { // Creating system table is part of the initialization, so do not wait here. return false; } return super.waitInitialized(env); }
@Override public Entry filter(Entry entry) { if (entry.getKey().getTableName().isSystemTable()) { return null; } return entry; } }
@Override public void setPriority(TableName tn) { super.setPriority(tn); // ignore counts for system tables - it could change and we really only want to check on what // the client should change if (tn != null && !tn.isSystemTable()) { TABLE_PRIORITY.incrementAndGet(); } } }
/** * Returns the limiter associated to the specified user/table. * * @param ugi the user to limit * @param table the table to limit * @return the limiter associated to the specified user/table */ public QuotaLimiter getUserLimiter(final UserGroupInformation ugi, final TableName table) { if (table.isSystemTable()) { return NoopQuotaLimiter.get(); } return getUserQuotaState(ugi).getTableLimiter(table); }
TableBuilderBase(TableName tableName, ConnectionConfiguration connConf) { if (tableName == null) { throw new IllegalArgumentException("Given table name is null"); } this.tableName = tableName; this.operationTimeout = tableName.isSystemTable() ? connConf.getMetaOperationTimeout() : connConf.getOperationTimeout(); this.rpcTimeout = connConf.getRpcTimeout(); this.readRpcTimeout = connConf.getReadRpcTimeout(); this.writeRpcTimeout = connConf.getWriteRpcTimeout(); }
@Override public boolean preScannerNext(final ObserverContext<RegionCoprocessorEnvironment> e, final InternalScanner s, final List<Result> results, final int limit, final boolean hasMore) throws IOException { final TableName tableName = e.getEnvironment().getRegionInfo().getTable(); if (!tableName.isSystemTable() && (faults++ % 2) == 0) { LOG.debug(" Injecting fault in table=" + tableName + " scanner"); throw new IOException("injected fault"); } return hasMore; } }
@Override public void preCreateTableAction( final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableDescriptor desc, final RegionInfo[] regions) throws IOException { if (!desc.getTableName().isSystemTable() && !rsgroupHasServersOnline(desc)) { throw new HBaseIOException("No online servers in the rsgroup, which table " + desc.getTableName().getNameAsString() + " belongs to"); } }
@Override public void preOpen(ObserverContext<RegionCoprocessorEnvironment> c) throws IOException { try { if (!c.getEnvironment().getRegion().getRegionInfo().getTable().isSystemTable()) { LOG.info("begin to sleep"); Thread.sleep(10000); LOG.info("finish sleep"); } } catch (Throwable t) { } }
@Override public void preClose(ObserverContext<RegionCoprocessorEnvironment> c, boolean abortRequested) throws IOException { if (!c.getEnvironment().getRegion().getRegionInfo().getTable().isSystemTable()) { LOG.info("begin to sleep"); countDownLatch.countDown(); // Sleep here so we can stuck the RPC call Threads.sleep(10000); LOG.info("finish sleep"); } }
AsyncTableBuilderBase(TableName tableName, AsyncConnectionConfiguration connConf) { this.tableName = tableName; this.operationTimeoutNs = tableName.isSystemTable() ? connConf.getMetaOperationTimeoutNs() : connConf.getOperationTimeoutNs(); this.scanTimeoutNs = connConf.getScanTimeoutNs(); this.rpcTimeoutNs = connConf.getRpcTimeoutNs(); this.readRpcTimeoutNs = connConf.getReadRpcTimeoutNs(); this.writeRpcTimeoutNs = connConf.getWriteRpcTimeoutNs(); this.pauseNs = connConf.getPauseNs(); this.maxAttempts = retries2Attempts(connConf.getMaxRetries()); this.startLogErrorsCnt = connConf.getStartLogErrorsCnt(); }
@Override public void prePut(ObserverContext<RegionCoprocessorEnvironment> e, Put put, WALEdit edit, Durability durability) throws IOException { Region region = e.getEnvironment().getRegion(); if (!region.getRegionInfo().isMetaRegion() && !region.getRegionInfo().getTable().isSystemTable()) { // The put carries the TTL attribute if (put.getTTL() != Long.MAX_VALUE) { return; } throw new IOException("Operation does not have TTL set"); } } }
@Override public void prePut(ObserverContext<RegionCoprocessorEnvironment> e, Put put, WALEdit edit, Durability durability) throws IOException { Region region = e.getEnvironment().getRegion(); if (!region.getRegionInfo().isMetaRegion() && !region.getRegionInfo().getTable().isSystemTable()) { if (put.getAttribute(TEST_ATR_KEY) != null) { LOG.debug("allow any put to happen " + region.getRegionInfo().getRegionNameAsString()); } else { e.bypass(); } } } }