Java Code Examples for org.apache.hadoop.hbase.CoprocessorEnvironment

The following examples show how to use org.apache.hadoop.hbase.CoprocessorEnvironment. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hbase   Source File: MetaTableMetrics.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) throws IOException {
  observer = new ExampleRegionObserverMeta();
  if (env instanceof RegionCoprocessorEnvironment
      && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable() != null
      && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable()
        .equals(TableName.META_TABLE_NAME)) {
    RegionCoprocessorEnvironment regionCoprocessorEnv = (RegionCoprocessorEnvironment) env;
    registry = regionCoprocessorEnv.getMetricRegistryForRegionServer();
    LossyCounting.LossyCountingListener<String> listener = key -> {
      registry.remove(key);
      metrics.remove(key);
    };
    final Configuration conf = regionCoprocessorEnv.getConfiguration();
    clientMetricsLossyCounting = new LossyCounting<>("clientMetaMetrics", conf, listener);
    regionMetricsLossyCounting = new LossyCounting<>("regionMetaMetrics", conf, listener);
    // only be active mode when this region holds meta table.
    active = true;
  }
}
 
Example 2
Source Project: phoenix-omid   Source File: OmidCompactor.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) throws IOException {
    LOG.info("Starting compactor coprocessor");
    commitTableConf = new HBaseCommitTableConfig();
    String commitTableName = env.getConfiguration().get(COMMIT_TABLE_NAME_KEY);
    if (commitTableName != null) {
        commitTableConf.setTableName(commitTableName);
    }

    connection = RegionConnectionFactory
            .getConnection(RegionConnectionFactory.ConnectionType.COMPACTION_CONNECTION, (RegionCoprocessorEnvironment) env);
    commitTableClient = new HBaseCommitTable(connection, commitTableConf).getClient();
    retainNonTransactionallyDeletedCells =
            env.getConfiguration().getBoolean(HBASE_RETAIN_NON_TRANSACTIONALLY_DELETED_CELLS_KEY,
                    HBASE_RETAIN_NON_TRANSACTIONALLY_DELETED_CELLS_DEFAULT);
    LOG.info("Compactor coprocessor started");
}
 
Example 3
Source Project: hbase   Source File: MasterQuotasObserver.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void start(CoprocessorEnvironment ctx) throws IOException {
  this.conf = ctx.getConfiguration();
  this.quotasEnabled = QuotaUtil.isQuotaEnabled(conf);

  if (!(ctx instanceof MasterCoprocessorEnvironment)) {
    throw new CoprocessorException("Must be loaded on master.");
  }
  // if running on master
  MasterCoprocessorEnvironment mEnv = (MasterCoprocessorEnvironment) ctx;
  if (mEnv instanceof HasMasterServices) {
    this.masterServices = ((HasMasterServices) mEnv).getMasterServices();
  } else {
    throw new CoprocessorException("Must be loaded on a master having master services.");
  }
}
 
Example 4
Source Project: hbase   Source File: ConstraintProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void start(CoprocessorEnvironment environment) {
  // make sure we are on a region server
  if (!(environment instanceof RegionCoprocessorEnvironment)) {
    throw new IllegalArgumentException(
        "Constraints only act on regions - started in an environment that was not a region");
  }
  RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) environment;
  TableDescriptor desc = env.getRegion().getTableDescriptor();
  // load all the constraints from the HTD
  try {
    this.constraints = Constraints.getConstraints(desc, classloader);
  } catch (IOException e) {
    throw new IllegalArgumentException(e);
  }

  if (LOG.isInfoEnabled()) {
    LOG.info("Finished loading " + constraints.size()
        + " user Constraints on table: " + desc.getTableName());
  }

}
 
Example 5
@Override
public void start(CoprocessorEnvironment e) throws IOException {
    try {
        region = (HRegion) ((RegionCoprocessorEnvironment) e).getRegion();
        String[] name = region.getTableDescriptor().getTableName().getNameAsString().split(":");
        if (name.length == 2) {
            namespace = name[0];
            tableName = name[1];
        }
        else {
            tableName = name[0];
        }
        regionName = region.getRegionInfo().getEncodedName();

        conf = HConfiguration.unwrapDelegate();
        rootDir = FSUtils.getRootDir(conf);
        fs = FSUtils.getCurrentFileSystem(conf);
        backupDir = new Path(rootDir, BackupRestoreConstants.BACKUP_DIR + "/data/splice/" + tableName + "/" + regionName);
        preparing = new AtomicBoolean(false);
        isCompacting = new AtomicBoolean(false);
        isSplitting = new AtomicBoolean(false);
    } catch (Throwable t) {
        throw CoprocessorUtils.getIOException(t);
    }
}
 
Example 6
Source Project: geowave   Source File: AggregationEndpoint.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(final CoprocessorEnvironment env) throws IOException {
  if (env instanceof RegionCoprocessorEnvironment) {
    this.env = (RegionCoprocessorEnvironment) env;
  } else {
    throw new CoprocessorException("Must be loaded on a table region!");
  }
}
 
Example 7
Source Project: hbase   Source File: TestCoprocessorInterface.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment e) {
  sharedData = ((RegionCoprocessorEnvironment)e).getSharedData();
  // using new String here, so that there will be new object on each invocation
  sharedData.putIfAbsent("test1", new Object());
  startCalled = true;
}
 
Example 8
Source Project: phoenix   Source File: MetaDataRegionObserver.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) throws IOException {
    // sleep a little bit to compensate time clock skew when SYSTEM.CATALOG moves
    // among region servers because we relies on server time of RS which is hosting
    // SYSTEM.CATALOG
    Configuration config = env.getConfiguration();
    long sleepTime = config.getLong(QueryServices.CLOCK_SKEW_INTERVAL_ATTRIB,
        QueryServicesOptions.DEFAULT_CLOCK_SKEW_INTERVAL);
    try {
        if(sleepTime > 0) {
            Thread.sleep(sleepTime);
        }
    } catch (InterruptedException ie) {
        Thread.currentThread().interrupt();
    }
    enableRebuildIndex =
            config.getBoolean(
                QueryServices.INDEX_FAILURE_HANDLING_REBUILD_ATTRIB,
                QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD);
    rebuildIndexTimeInterval =
            config.getLong(
                QueryServices.INDEX_FAILURE_HANDLING_REBUILD_INTERVAL_ATTRIB,
                QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD_INTERVAL);
    initialRebuildTaskDelay =
            config.getLong(
                QueryServices.INDEX_REBUILD_TASK_INITIAL_DELAY,
                QueryServicesOptions.DEFAULT_INDEX_REBUILD_TASK_INITIAL_DELAY);
}
 
Example 9
Source Project: phoenix-tephra   Source File: TransactionProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
    this.cacheSupplier = getTransactionStateCacheSupplier(env);
    this.cache = cacheSupplier.get();

    HTableDescriptor tableDesc = env.getRegion().getTableDesc();
    for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) {
      String columnTTL = columnDesc.getValue(TxConstants.PROPERTY_TTL);
      long ttl = 0;
      if (columnTTL != null) {
        try {
          ttl = Long.parseLong(columnTTL);
          LOG.info("Family " + columnDesc.getNameAsString() + " has TTL of " + columnTTL);
        } catch (NumberFormatException nfe) {
          LOG.warn("Invalid TTL value configured for column family " + columnDesc.getNameAsString() +
                     ", value = " + columnTTL);
        }
      }
      ttlByFamily.put(columnDesc.getName(), ttl);
    }

    this.allowEmptyValues = getAllowEmptyValues(env, tableDesc);
    this.txMaxLifetimeMillis = getTxMaxLifetimeMillis(env);
    this.readNonTxnData = Boolean.valueOf(tableDesc.getValue(TxConstants.READ_NON_TX_DATA));
    if (readNonTxnData) {
      LOG.info("Reading pre-existing data enabled for table " + tableDesc.getNameAsString());
    }
    initializePruneState(env);
  }
}
 
Example 10
Source Project: phoenix   Source File: UngroupedAggregateRegionObserver.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment e) throws IOException {
    // Can't use ClientKeyValueBuilder on server-side because the memstore expects to
    // be able to get a single backing buffer for a KeyValue.
    this.kvBuilder = GenericKeyValueBuilder.INSTANCE;
    /*
     * We need to create a copy of region's configuration since we don't want any side effect of
     * setting the RpcControllerFactory.
     */
    upsertSelectConfig = PropertiesUtil.cloneConfig(e.getConfiguration());
    /*
     * Till PHOENIX-3995 is fixed, we need to use the
     * InterRegionServerIndexRpcControllerFactory. Although this would cause remote RPCs to use
     * index handlers on the destination region servers, it is better than using the regular
     * priority handlers which could result in a deadlock.
     */
    upsertSelectConfig.setClass(RpcControllerFactory.CUSTOM_CONTROLLER_CONF_KEY,
        InterRegionServerIndexRpcControllerFactory.class, RpcControllerFactory.class);

    compactionConfig = ServerUtil.getCompactionConfig(e.getConfiguration());

    // For retries of index write failures, use the same # of retries as the rebuilder
    indexWriteConfig = PropertiesUtil.cloneConfig(e.getConfiguration());
    indexWriteConfig.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
        e.getConfiguration().getInt(QueryServices.INDEX_REBUILD_RPC_RETRIES_COUNTER,
            QueryServicesOptions.DEFAULT_INDEX_REBUILD_RPC_RETRIES_COUNTER));
    indexWriteProps = new ReadOnlyProps(indexWriteConfig.iterator());
}
 
Example 11
@Override
public void start(CoprocessorEnvironment e) throws IOException {
    try {
        SpliceLogUtils.trace(LOG, "starting %s", SIObserver.class);
        RegionCoprocessorEnvironment rce = (RegionCoprocessorEnvironment) e;
        TableName tableName = rce.getRegion().getTableDescriptor().getTableName();
        doesTableNeedSI(tableName);
        HBaseSIEnvironment env = HBaseSIEnvironment.loadEnvironment(new SystemClock(), ZkUtils.getRecoverableZooKeeper());
        SIDriver driver = env.getSIDriver();
        if (tableEnvMatch) {
            try{
                conglomId=Long.parseLong(tableName.getQualifierAsString());
            }catch(NumberFormatException nfe){
                SpliceLogUtils.warn(LOG,"Unable to parse conglomerate id for table %s",tableName);
                conglomId=-1;
            }
            operationStatusFactory = driver.getOperationStatusLib();
            //noinspection unchecked
            txnOperationFactory = new SimpleTxnOperationFactory(driver.getExceptionFactory(), HOperationFactory.INSTANCE);
            //noinspection unchecked
            Partition regionPartition = new RegionPartition((HRegion) rce.getRegion());
            region = new TxnRegion(regionPartition,
                    driver.getRollForward(),
                    driver.getReadResolver(regionPartition),
                    driver.getTxnSupplier(),
                    driver.getTransactor(),
                    driver.getOperationFactory()
            );
            Tracer.traceRegion(region.getTableName(), rce.getRegion());
        }

        ZKWatcher zk = ((RegionServerServices)((RegionCoprocessorEnvironment)e).getOnlineRegions()).getZooKeeper();
        this.authManager = TableAuthManager.getOrCreate(zk, e.getConfiguration());
        this.authTokenEnabled = driver.getConfiguration().getAuthenticationTokenEnabled();

    } catch (Throwable t) {
        throw CoprocessorUtils.getIOException(t);
    }
}
 
Example 12
Source Project: phoenix-tephra   Source File: TransactionProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
    this.cacheSupplier = getTransactionStateCacheSupplier(env);
    this.cache = cacheSupplier.get();

    HTableDescriptor tableDesc = env.getRegion().getTableDesc();
    for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) {
      String columnTTL = columnDesc.getValue(TxConstants.PROPERTY_TTL);
      long ttl = 0;
      if (columnTTL != null) {
        try {
          ttl = Long.parseLong(columnTTL);
          LOG.info("Family " + columnDesc.getNameAsString() + " has TTL of " + columnTTL);
        } catch (NumberFormatException nfe) {
          LOG.warn("Invalid TTL value configured for column family " + columnDesc.getNameAsString() +
                     ", value = " + columnTTL);
        }
      }
      ttlByFamily.put(columnDesc.getName(), ttl);
    }

    this.allowEmptyValues = getAllowEmptyValues(env, tableDesc);
    this.txMaxLifetimeMillis = getTxMaxLifetimeMillis(env);
    this.readNonTxnData = Boolean.valueOf(tableDesc.getValue(TxConstants.READ_NON_TX_DATA));
    if (readNonTxnData) {
      LOG.info("Reading pre-existing data enabled for table " + tableDesc.getNameAsString());
    }
    initializePruneState(env);
  }
}
 
Example 13
Source Project: phoenix   Source File: Indexer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void stop(CoprocessorEnvironment e) throws IOException {
  if (this.stopped) {
    return;
  }
  if (this.disabled) {
      return;
    }
  this.stopped = true;
  String msg = "Indexer is being stopped";
  this.builder.stop(msg);
  this.writer.stop(msg);
  this.recoveryWriter.stop(msg);
}
 
Example 14
Source Project: phoenix-tephra   Source File: TransactionProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
    this.cacheSupplier = getTransactionStateCacheSupplier(env);
    this.cache = cacheSupplier.get();

    HTableDescriptor tableDesc = env.getRegion().getTableDesc();
    for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) {
      String columnTTL = columnDesc.getValue(TxConstants.PROPERTY_TTL);
      long ttl = 0;
      if (columnTTL != null) {
        try {
          ttl = Long.parseLong(columnTTL);
          LOG.info("Family " + columnDesc.getNameAsString() + " has TTL of " + columnTTL);
        } catch (NumberFormatException nfe) {
          LOG.warn("Invalid TTL value configured for column family " + columnDesc.getNameAsString() +
                     ", value = " + columnTTL);
        }
      }
      ttlByFamily.put(columnDesc.getName(), ttl);
    }

    this.allowEmptyValues = getAllowEmptyValues(env, tableDesc);
    this.txMaxLifetimeMillis = getTxMaxLifetimeMillis(env);
    this.readNonTxnData = Boolean.valueOf(tableDesc.getValue(TxConstants.READ_NON_TX_DATA));
    if (readNonTxnData) {
      LOG.info("Reading pre-existing data enabled for table " + tableDesc.getNameAsString());
    }
    initializePruneState(env);
  }
}
 
Example 15
Source Project: phoenix-tephra   Source File: TransactionProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void stop(CoprocessorEnvironment e) throws IOException {
  try {
    resetPruneState();
  } finally {
    if (cacheSupplier != null) {
      cacheSupplier.release();
    }
  }
}
 
Example 16
Source Project: phoenix-tephra   Source File: TransactionProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
    this.cacheSupplier = getTransactionStateCacheSupplier(env);
    this.cache = cacheSupplier.get();

    HTableDescriptor tableDesc = env.getRegion().getTableDesc();
    for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) {
      String columnTTL = columnDesc.getValue(TxConstants.PROPERTY_TTL);
      long ttl = 0;
      if (columnTTL != null) {
        try {
          ttl = Long.parseLong(columnTTL);
          LOG.info("Family " + columnDesc.getNameAsString() + " has TTL of " + columnTTL);
        } catch (NumberFormatException nfe) {
          LOG.warn("Invalid TTL value configured for column family " + columnDesc.getNameAsString() +
                     ", value = " + columnTTL);
        }
      }
      ttlByFamily.put(columnDesc.getName(), ttl);
    }

    this.allowEmptyValues = getAllowEmptyValues(env, tableDesc);
    this.txMaxLifetimeMillis = getTxMaxLifetimeMillis(env);
    this.readNonTxnData = Boolean.valueOf(tableDesc.getValue(TxConstants.READ_NON_TX_DATA));
    if (readNonTxnData) {
      LOG.info("Reading pre-existing data enabled for table " + tableDesc.getNameAsString());
    }
    initializePruneState(env);
  }
}
 
Example 17
Source Project: phoenix-tephra   Source File: TransactionProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void stop(CoprocessorEnvironment e) throws IOException {
  try {
    resetPruneState();
  } finally {
    if (cacheSupplier != null) {
      cacheSupplier.release();
    }
  }
}
 
Example 18
Source Project: phoenix-tephra   Source File: TransactionProcessor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
    this.cacheSupplier = getTransactionStateCacheSupplier(env);
    this.cache = cacheSupplier.get();

    HTableDescriptor tableDesc = env.getRegion().getTableDesc();
    for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) {
      String columnTTL = columnDesc.getValue(TxConstants.PROPERTY_TTL);
      long ttl = 0;
      if (columnTTL != null) {
        try {
          ttl = Long.parseLong(columnTTL);
          LOG.info("Family " + columnDesc.getNameAsString() + " has TTL of " + columnTTL);
        } catch (NumberFormatException nfe) {
          LOG.warn("Invalid TTL value configured for column family " + columnDesc.getNameAsString() +
                     ", value = " + columnTTL);
        }
      }
      ttlByFamily.put(columnDesc.getName(), ttl);
    }

    this.allowEmptyValues = getAllowEmptyValues(env, tableDesc);
    this.txMaxLifetimeMillis = getTxMaxLifetimeMillis(env);
    this.readNonTxnData = Boolean.valueOf(tableDesc.getValue(TxConstants.READ_NON_TX_DATA));
    if (readNonTxnData) {
      LOG.info("Reading pre-existing data enabled for table " + tableDesc.getNameAsString());
    }
    initializePruneState(env);
  }
}
 
Example 19
Source Project: hbase   Source File: ZooKeeperScanPolicyObserver.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) throws IOException {
  RegionCoprocessorEnvironment renv = (RegionCoprocessorEnvironment) env;
  try {
    this.cache = ((ZKDataHolder) renv.getSharedData().computeIfAbsent(ZKKEY, k -> {
      String ensemble = renv.getConfiguration().get(ZK_ENSEMBLE_KEY);
      int sessionTimeout =
          renv.getConfiguration().getInt(ZK_SESSION_TIMEOUT_KEY, ZK_SESSION_TIMEOUT_DEFAULT);
      return new ZKDataHolder(ensemble, sessionTimeout);
    })).acquire();
  } catch (Exception e) {
    throw new IOException(e);
  }
}
 
Example 20
Source Project: SolrCoprocessor   Source File: SolrRegionObserver.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment e) throws IOException {
	synchronized (SolrRegionObserver.class) {
		_startCount++;
		if (_startCount > 1) { //�Ѿ���ʼ�����
			return;
		}
	}

	init(e);
}
 
Example 21
Source Project: SolrCoprocessor   Source File: SolrRegionObserver.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void stop(CoprocessorEnvironment e) throws IOException {
	synchronized (SolrRegionObserver.class) {
		_startCount--;
		if (_startCount > 0) { //��������
			return;
		}
	}

	this.destroy(e);
}
 
Example 22
Source Project: hbase   Source File: TestAccessController3.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void stop(CoprocessorEnvironment env) {
  super.stop(env);
  if (callSuperTwice) {
    super.stop(env);
  }
}
 
Example 23
/**
 * Logs the start of the observer and runs the SpliceDriver if needed...
 */
@SuppressFBWarnings(value="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification="intentional")
@Override
public void start(CoprocessorEnvironment e) throws IOException{
    try {
        isHbaseJVM= true;
        lifecycleManager = startEngine(e);
        SpliceClient.isRegionServer = true;
    } catch (Throwable t) {
        throw CoprocessorUtils.getIOException(t);
    }
}
 
Example 24
Source Project: eagle   Source File: AggregateProtocolEndPoint.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) throws IOException {
    if (env instanceof RegionCoprocessorEnvironment) {
        this.env = (RegionCoprocessorEnvironment) env;
    } else {
        throw new CoprocessorException("Must be loaded on a table region!");
    }
}
 
Example 25
@Override
public void start(CoprocessorEnvironment env) throws IOException{
    try {
        RegionCoprocessorEnvironment rce=(RegionCoprocessorEnvironment)env;
        HRegion region=(HRegion)rce.getRegion();
        HBaseSIEnvironment siEnv = HBaseSIEnvironment.loadEnvironment(new SystemClock(), ZkUtils.getRecoverableZooKeeper());
        SConfiguration configuration=siEnv.configuration();
        TableType table= EnvUtils.getTableType(configuration,rce);
        if(table.equals(TableType.TRANSACTION_TABLE)){
            TransactionResolver resolver=resolverRef.get();
            SIDriver driver=siEnv.getSIDriver();
            assert driver!=null:"SIDriver Cannot be null";
            long txnKeepAliveTimeout = configuration.getTransactionTimeout();
            @SuppressWarnings("unchecked") TxnPartition regionStore=new RegionTxnStore(region,
                    driver.getTxnSupplier(),
                    resolver,
                    txnKeepAliveTimeout,
                    new SystemClock());
            TimestampSource timestampSource=driver.getTimestampSource();
            int txnLockStrips = configuration.getTransactionLockStripes();
            lifecycleStore = new StripedTxnLifecycleStore(txnLockStrips,regionStore,
                    new RegionServerControl(region, (RegionServerServices)rce.getOnlineRegions()),timestampSource);
            isTxnTable=true;
        }
    } catch (Throwable t) {
        throw CoprocessorUtils.getIOException(t);
    }
}
 
Example 26
Source Project: hbase   Source File: RefreshHFilesEndpoint.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) throws IOException {
  if (env instanceof RegionCoprocessorEnvironment) {
    this.env = (RegionCoprocessorEnvironment) env;
  } else {
    throw new CoprocessorException("Must be loaded on a table region!");
  }
}
 
Example 27
Source Project: phoenix   Source File: ServerCachingEndpointImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) throws IOException {
  if (env instanceof RegionCoprocessorEnvironment) {
    this.env = (RegionCoprocessorEnvironment) env;
  } else {
    throw new CoprocessorException("Must be loaded on a table region!");
  }
}
 
Example 28
Source Project: phoenix   Source File: PhoenixAccessController.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) throws IOException {
    Configuration conf = env.getConfiguration();
    this.accessCheckEnabled = conf.getBoolean(QueryServices.PHOENIX_ACLS_ENABLED,
            QueryServicesOptions.DEFAULT_PHOENIX_ACLS_ENABLED);
        if (!this.accessCheckEnabled) {
            LOGGER.warn(
                    "PhoenixAccessController has been loaded with authorization checks disabled.");
        }
    this.execPermissionsCheckEnabled = conf.getBoolean(AccessControlConstants.EXEC_PERMISSION_CHECKS_KEY,
            AccessControlConstants.DEFAULT_EXEC_PERMISSION_CHECKS);
    if (env instanceof PhoenixMetaDataControllerEnvironment) {
        this.env = (PhoenixMetaDataControllerEnvironment)env;
    } else {
        throw new IllegalArgumentException(
                "Not a valid environment, should be loaded by PhoenixMetaDataControllerEnvironment");
    }

    ZKWatcher zk = null;
    RegionCoprocessorEnvironment regionEnv = this.env.getRegionCoprocessorEnvironment();
    if (regionEnv instanceof HasRegionServerServices) {
        zk = ((HasRegionServerServices) regionEnv).getRegionServerServices().getZooKeeper();
    }
    accessChecker = new AccessChecker(env.getConfiguration(), zk);
    // set the user-provider.
    this.userProvider = UserProvider.instantiate(env.getConfiguration());
    // init superusers and add the server principal (if using security)
    // or process owner as default super user.
    Superusers.initialize(env.getConfiguration());
}
 
Example 29
Source Project: phoenix   Source File: ServerCachingEndpointImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) throws IOException {
  if (env instanceof RegionCoprocessorEnvironment) {
    this.env = (RegionCoprocessorEnvironment) env;
  } else {
    throw new CoprocessorException("Must be loaded on a table region!");
  }
}
 
Example 30
Source Project: phoenix   Source File: Indexer.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void stop(CoprocessorEnvironment e) throws IOException {
  if (this.stopped) {
    return;
  }
  if (this.disabled) {
      super.stop(e);
      return;
    }
  this.stopped = true;
  String msg = "Indexer is being stopped";
  this.builder.stop(msg);
  this.writer.stop(msg);
  this.recoveryWriter.stop(msg);
}