Search in sources :

Example 1 with RegionServerServices

use of org.apache.hadoop.hbase.regionserver.RegionServerServices in project hbase by apache.

the class RegionStateStore method start.

void start() throws IOException {
    if (server instanceof RegionServerServices) {
        metaRegion = ((RegionServerServices) server).getFromOnlineRegions(HRegionInfo.FIRST_META_REGIONINFO.getEncodedName());
    }
    // When meta is not colocated on master
    if (metaRegion == null) {
        Configuration conf = server.getConfiguration();
        // Config to determine the no of HConnections to META.
        // A single Connection should be sufficient in most cases. Only if
        // you are doing lot of writes (>1M) to META,
        // increasing this value might improve the write throughput.
        multiHConnection = new MultiHConnection(conf, conf.getInt("hbase.regionstatestore.meta.connection", 1));
    }
    initialized = true;
}
Also used : MultiHConnection(org.apache.hadoop.hbase.util.MultiHConnection) RegionServerServices(org.apache.hadoop.hbase.regionserver.RegionServerServices) Configuration(org.apache.hadoop.conf.Configuration)

Example 2 with RegionServerServices

use of org.apache.hadoop.hbase.regionserver.RegionServerServices in project phoenix by apache.

the class IndexWriterUtils method getDefaultDelegateHTableFactory.

public static HTableFactory getDefaultDelegateHTableFactory(CoprocessorEnvironment env) {
    // create a simple delegate factory, setup the way we need
    Configuration conf = env.getConfiguration();
    // set the number of threads allowed per table.
    int htableThreads = conf.getInt(IndexWriterUtils.INDEX_WRITER_PER_TABLE_THREADS_CONF_KEY, IndexWriterUtils.DEFAULT_NUM_PER_TABLE_THREADS);
    LOG.trace("Creating HTableFactory with " + htableThreads + " threads for each HTable.");
    IndexManagementUtil.setIfNotSet(conf, HTABLE_THREAD_KEY, htableThreads);
    if (env instanceof RegionCoprocessorEnvironment) {
        RegionCoprocessorEnvironment e = (RegionCoprocessorEnvironment) env;
        RegionServerServices services = e.getRegionServerServices();
        if (services instanceof HRegionServer) {
            return new CoprocessorHConnectionTableFactory(conf, (HRegionServer) services);
        }
    }
    return new CoprocessorHTableFactory(env);
}
Also used : RegionCoprocessorEnvironment(org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment) RegionServerServices(org.apache.hadoop.hbase.regionserver.RegionServerServices) Configuration(org.apache.hadoop.conf.Configuration) CoprocessorHTableFactory(org.apache.phoenix.hbase.index.table.CoprocessorHTableFactory) HRegionServer(org.apache.hadoop.hbase.regionserver.HRegionServer)

Example 3 with RegionServerServices

use of org.apache.hadoop.hbase.regionserver.RegionServerServices in project hbase by apache.

the class TestReplicationSource method testAbortFalseOnErrorDoesntBlockMainThread.

/**
 * Test ReplicationSource keeps retrying startup indefinitely without blocking the main thread,
 * when <b>eplication.source.regionserver.abort</b> is set to false.
 */
@Test
public void testAbortFalseOnErrorDoesntBlockMainThread() throws IOException {
    Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
    ReplicationSource rs = new ReplicationSource();
    RegionServerServices rss = setupForAbortTests(rs, conf, FaultyReplicationEndpoint.class.getName());
    try {
        rs.startup();
        assertTrue(true);
    } finally {
        rs.terminate("Done");
        rss.stop("Done");
    }
}
Also used : RegionServerServices(org.apache.hadoop.hbase.regionserver.RegionServerServices) Configuration(org.apache.hadoop.conf.Configuration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Test(org.junit.Test)

Example 4 with RegionServerServices

use of org.apache.hadoop.hbase.regionserver.RegionServerServices in project hbase by apache.

the class TestReplicationSource method testAbortFalseOnError.

/**
 * Test ReplicationSource retries startup once an uncaught exception happens
 * during initialization and <b>eplication.source.regionserver.abort</b> is set to false.
 */
@Test
public void testAbortFalseOnError() throws IOException {
    Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
    conf.setBoolean("replication.source.regionserver.abort", false);
    ReplicationSource rs = new ReplicationSource();
    RegionServerServices rss = setupForAbortTests(rs, conf, FlakyReplicationEndpoint.class.getName());
    try {
        rs.startup();
        assertTrue(rs.isSourceActive());
        assertEquals(0, rs.getSourceMetrics().getSizeOfLogQueue());
        rs.enqueueLog(new Path("a.1" + META_WAL_PROVIDER_ID));
        assertEquals(0, rs.getSourceMetrics().getSizeOfLogQueue());
        rs.enqueueLog(new Path("a.1"));
        assertEquals(1, rs.getSourceMetrics().getSizeOfLogQueue());
    } finally {
        rs.terminate("Done");
        rss.stop("Done");
    }
}
Also used : Path(org.apache.hadoop.fs.Path) RegionServerServices(org.apache.hadoop.hbase.regionserver.RegionServerServices) Configuration(org.apache.hadoop.conf.Configuration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Test(org.junit.Test)

Example 5 with RegionServerServices

use of org.apache.hadoop.hbase.regionserver.RegionServerServices in project hbase by apache.

the class TestReplicationSource method testAbortTrueOnError.

/**
 * Test ReplicationSource retries startup once an uncaught exception happens
 * during initialization and <b>replication.source.regionserver.abort</b> is set to true.
 */
@Test
public void testAbortTrueOnError() throws IOException {
    Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
    ReplicationSource rs = new ReplicationSource();
    RegionServerServices rss = setupForAbortTests(rs, conf, FlakyReplicationEndpoint.class.getName());
    try {
        rs.startup();
        assertTrue(rs.isSourceActive());
        Waiter.waitFor(conf, 1000, () -> rss.isAborted());
        assertTrue(rss.isAborted());
        Waiter.waitFor(conf, 1000, () -> !rs.isSourceActive());
        assertFalse(rs.isSourceActive());
    } finally {
        rs.terminate("Done");
        rss.stop("Done");
    }
}
Also used : RegionServerServices(org.apache.hadoop.hbase.regionserver.RegionServerServices) Configuration(org.apache.hadoop.conf.Configuration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Test(org.junit.Test)

Aggregations

RegionServerServices (org.apache.hadoop.hbase.regionserver.RegionServerServices)26 Configuration (org.apache.hadoop.conf.Configuration)18 Test (org.junit.Test)17 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)15 HRegion (org.apache.hadoop.hbase.regionserver.HRegion)7 IOException (java.io.IOException)5 Path (org.apache.hadoop.fs.Path)5 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)5 RegionCoprocessorEnvironment (org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment)5 RegionCoprocessorHost (org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost)5 AtomicLong (java.util.concurrent.atomic.AtomicLong)4 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)4 ReplicationPeer (org.apache.hadoop.hbase.replication.ReplicationPeer)4 ReplicationPeerConfig (org.apache.hadoop.hbase.replication.ReplicationPeerConfig)4 TableName (org.apache.hadoop.hbase.TableName)3 HasRegionServerServices (org.apache.hadoop.hbase.coprocessor.HasRegionServerServices)3 ColumnFamilyDescriptor (org.apache.hadoop.hbase.client.ColumnFamilyDescriptor)2 Put (org.apache.hadoop.hbase.client.Put)2 Scan (org.apache.hadoop.hbase.client.Scan)2 SpaceQuotaStatus (org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot.SpaceQuotaStatus)2