region.startRegionOperation(); debugGitTag = region.getTableDesc().getValue(IRealizationConstants.HTableGitTag);
private static IndexBuilder getIndexBuilder(RegionCoprocessorEnvironment e) throws IOException { Configuration conf = e.getConfiguration(); Class<? extends IndexBuilder> builderClass = conf.getClass(Indexer.INDEX_BUILDER_CONF_KEY, null, IndexBuilder.class); try { IndexBuilder builder = builderClass.newInstance(); builder.setup(e); return builder; } catch (InstantiationException e1) { throw new IOException("Couldn't instantiate index builder:" + builderClass + ", disabling indexing on table " + e.getRegion().getTableDesc().getNameAsString()); } catch (IllegalAccessException e1) { throw new IOException("Couldn't instantiate index builder:" + builderClass + ", disabling indexing on table " + e.getRegion().getTableDesc().getNameAsString()); } }
for (byte[] family : this.env.getRegion().getTableDesc().getFamiliesKeys()) { state.addPendingUpdates(new KeyValue(deleteRow, family, null, now, KeyValue.Type.DeleteFamily));
@Override protected void configureForRegion(HRegion region) { super.configureForRegion(region); // read the prefix length from the table descriptor String delimiterString = region.getTableDesc().getValue(DELIMITER_KEY); if (delimiterString == null || delimiterString.length() == 0) { LOG.error(DELIMITER_KEY + " not specified for table " + region.getTableDesc().getTableName() + ". Using default RegionSplitPolicy"); return; } delimiter = Bytes.toBytes(delimiterString); }
/** * Create the FlushPolicy configured for the given table. */ public static FlushPolicy create(HRegion region, Configuration conf) throws IOException { Class<? extends FlushPolicy> clazz = getFlushPolicyClass(region.getTableDesc(), conf); FlushPolicy policy = ReflectionUtils.newInstance(clazz, conf); policy.configureForRegion(region); return policy; }
@Override public String getNamespace() { HTableDescriptor tableDesc = this.region.getTableDesc(); if (tableDesc == null) { return UNKNOWN; } return tableDesc.getTableName().getNamespaceAsString(); }
@Override public String getTableName() { HTableDescriptor tableDesc = this.region.getTableDesc(); if (tableDesc == null) { return UNKNOWN; } return tableDesc.getTableName().getQualifierAsString(); }
@Override public void run() { Preconditions.checkNotNull(server); if (server.isStopped() || (region.getTableDesc() != null && !region.getTableDesc().isCompactionEnabled())) { return; } doCompaction(user); }
/** * <pre> * Region-unittest,\x82\xB4\x85\xC2\x7F\xFF\xFE\xB6\xC9jNG\xEE!\x5C3\xBB\xAE\xA1:\x05\xA5\xA9x\xB0\xA1"8\x05\xFB(\xD2VY\xDB\x9A\x06\x09\xA9\x98\xC2\xE3\x8D=,1413960230654.aaf2a6c9f2c87c196f43497243bb2424. * RegionID-unittest,1413960230654 * </pre> */ protected String getLogHeader(){ HRegion region = this.getCurrentRegion(); return LOG.isDebugEnabled() ? String.format("Region-%s",region.getRegionNameAsString()): String.format("Region-%s,%d",region.getTableDesc().getNameAsString(),region.getRegionId()); }
@Override protected void configureForRegion(HRegion region) { super.configureForRegion(region); Configuration conf = getConf(); HTableDescriptor desc = region.getTableDesc(); if (desc != null) { this.flushSize = desc.getMemStoreFlushSize(); } if (this.flushSize <= 0) { this.flushSize = conf.getLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, HTableDescriptor.DEFAULT_MEMSTORE_FLUSH_SIZE); } }
@Override protected Supplier<TransactionStateCache> getTransactionStateCacheSupplier(RegionCoprocessorEnvironment env) { String tableName = env.getRegion().getTableDesc().getNameAsString(); String[] parts = tableName.split("\\.", 2); String tableNamespace = ""; if (parts.length > 0) { tableNamespace = parts[0]; } return new DefaultTransactionStateCacheSupplier(tableNamespace, env.getConfiguration()); }
protected Supplier<TransactionStateCache> getTransactionStateCacheSupplier(RegionCoprocessorEnvironment env) { String tableName = env.getRegion().getTableDesc().getNameAsString(); String[] parts = tableName.split("\\.", 2); String tableNamespace = ""; if (parts.length > 0) { tableNamespace = parts[0]; } return new DefaultTransactionStateCacheSupplier(tableNamespace, env.getConfiguration()); }
/** * Returns whether this region replica can accept writes. * @param region the HRegion object * @return whether the replica is read only */ public static boolean isReadOnly(HRegion region) { return region.getTableDesc().isReadOnly() || !isDefaultReplica(region.getRegionInfo()); }
@Override public void start(CoprocessorEnvironment env) { if (env instanceof RegionCoprocessorEnvironment) { String tableName = ((RegionCoprocessorEnvironment) env).getRegion().getTableDesc().getNameAsString(); String configTableName = QueueUtils.determineQueueConfigTableName(tableName); appName = HBaseQueueAdmin.getApplicationName(tableName); flowName = HBaseQueueAdmin.getFlowName(tableName); configCache = ConsumerConfigCache.getInstance(env.getConfiguration(), Bytes.toBytes(configTableName)); } }
@Override public void start(CoprocessorEnvironment e) throws IOException { if (e instanceof RegionCoprocessorEnvironment) { RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e; this.region = ((RegionCoprocessorEnvironment) e).getRegion(); HTableDescriptor tableDesc = region.getTableDesc(); this.state = new IncrementHandlerState(env, tableDesc); for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) { state.initFamily(columnDesc.getName(), convertFamilyValues(columnDesc.getValues())); } } }
@Override public void start(CoprocessorEnvironment e) throws IOException { if (e instanceof RegionCoprocessorEnvironment) { RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e; this.region = ((RegionCoprocessorEnvironment) e).getRegion(); HTableDescriptor tableDesc = region.getTableDesc(); this.state = new IncrementHandlerState(env, tableDesc); for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) { state.initFamily(columnDesc.getName(), convertFamilyValues(columnDesc.getValues())); } } }
@Override public void start(CoprocessorEnvironment e) throws IOException { if (e instanceof RegionCoprocessorEnvironment) { RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e; this.region = ((RegionCoprocessorEnvironment) e).getRegion(); HTableDescriptor tableDesc = region.getTableDesc(); this.state = new IncrementHandlerState(env, tableDesc); for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) { state.initFamily(columnDesc.getName(), convertFamilyValues(columnDesc.getValues())); } } }
@Override public void start(CoprocessorEnvironment e) throws IOException { if (e instanceof RegionCoprocessorEnvironment) { RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e; this.region = ((RegionCoprocessorEnvironment) e).getRegion(); HTableDescriptor tableDesc = region.getTableDesc(); this.state = new IncrementHandlerState(env, tableDesc); for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) { state.initFamily(columnDesc.getName(), convertFamilyValues(columnDesc.getValues())); } } }
@Override public void start(CoprocessorEnvironment e) throws IOException { if (e instanceof RegionCoprocessorEnvironment) { RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e; this.region = ((RegionCoprocessorEnvironment) e).getRegion(); HTableDescriptor tableDesc = region.getTableDesc(); this.state = new IncrementHandlerState(env, tableDesc); for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) { state.initFamily(columnDesc.getName(), convertFamilyValues(columnDesc.getValues())); } } }
private void writeRegionOpenMarker(WAL wal, long openSeqId) throws IOException { Map<byte[], List<Path>> storeFiles = getStoreFiles(); RegionEventDescriptor regionOpenDesc = ProtobufUtil.toRegionEventDescriptor( RegionEventDescriptor.EventType.REGION_OPEN, getRegionInfo(), openSeqId, getRegionServerServices().getServerName(), storeFiles); WALUtil.writeRegionEventMarker(wal, getTableDesc(), getRegionInfo(), regionOpenDesc, mvcc); }