Search in sources :

Example 6 with ScheduledChore

use of org.apache.hadoop.hbase.ScheduledChore in project hbase by apache.

the class ChaosService method main.

public static void main(String[] args) throws Exception {
    Configuration conf = HBaseConfiguration.create();
    new GenericOptionsParser(conf, args);
    ChoreService choreChaosService = null;
    ScheduledChore authChore = AuthUtil.getAuthChore(conf);
    try {
        if (authChore != null) {
            choreChaosService = new ChoreService(ChaosConstants.CHORE_SERVICE_PREFIX);
            choreChaosService.scheduleChore(authChore);
        }
        execute(args, conf);
    } finally {
        if (authChore != null)
            choreChaosService.shutdown();
    }
}
Also used : ChoreService(org.apache.hadoop.hbase.ChoreService) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Configuration(org.apache.hadoop.conf.Configuration) ScheduledChore(org.apache.hadoop.hbase.ScheduledChore) GenericOptionsParser(org.apache.hadoop.util.GenericOptionsParser)

Example 7 with ScheduledChore

use of org.apache.hadoop.hbase.ScheduledChore in project hbase by apache.

the class TestServerNonceManager method testWalNonces.

@Test
public void testWalNonces() throws Exception {
    ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
    EnvironmentEdgeManager.injectEdge(edge);
    try {
        ServerNonceManager nm = createManager(6);
        ScheduledChore cleanup = nm.createCleanupScheduledChore(Mockito.mock(Stoppable.class));
        // Add nonces from WAL, including dups.
        edge.setValue(12);
        nm.reportOperationFromWal(NO_NONCE, 1, 8);
        nm.reportOperationFromWal(NO_NONCE, 2, 2);
        nm.reportOperationFromWal(NO_NONCE, 3, 5);
        nm.reportOperationFromWal(NO_NONCE, 3, 6);
        // WAL nonces should prevent cross-server conflicts.
        assertFalse(nm.startOperation(NO_NONCE, 1, createStoppable()));
        // Make sure we ignore very old nonces, but not borderline old nonces.
        assertTrue(nm.startOperation(NO_NONCE, 2, createStoppable()));
        assertFalse(nm.startOperation(NO_NONCE, 3, createStoppable()));
        // Make sure grace period is counted from recovery time.
        edge.setValue(17);
        cleanup.choreForTesting();
        assertFalse(nm.startOperation(NO_NONCE, 1, createStoppable()));
        assertFalse(nm.startOperation(NO_NONCE, 3, createStoppable()));
        edge.setValue(19);
        cleanup.choreForTesting();
        assertTrue(nm.startOperation(NO_NONCE, 1, createStoppable()));
        assertTrue(nm.startOperation(NO_NONCE, 3, createStoppable()));
    } finally {
        EnvironmentEdgeManager.reset();
    }
}
Also used : ScheduledChore(org.apache.hadoop.hbase.ScheduledChore) Stoppable(org.apache.hadoop.hbase.Stoppable) ManualEnvironmentEdge(org.apache.hadoop.hbase.util.ManualEnvironmentEdge) Test(org.junit.Test)

Aggregations

ScheduledChore (org.apache.hadoop.hbase.ScheduledChore)7 Test (org.junit.Test)4 ChoreService (org.apache.hadoop.hbase.ChoreService)3 Stoppable (org.apache.hadoop.hbase.Stoppable)2 Connection (org.apache.hadoop.hbase.client.Connection)2 ManualEnvironmentEdge (org.apache.hadoop.hbase.util.ManualEnvironmentEdge)2 Configuration (org.apache.hadoop.conf.Configuration)1 ExecutorStatusChore (org.apache.hadoop.hbase.ExecutorStatusChore)1 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)1 BalancerChore (org.apache.hadoop.hbase.master.balancer.BalancerChore)1 ClusterStatusChore (org.apache.hadoop.hbase.master.balancer.ClusterStatusChore)1 HFileCleaner (org.apache.hadoop.hbase.master.cleaner.HFileCleaner)1 LogCleaner (org.apache.hadoop.hbase.master.cleaner.LogCleaner)1 ReplicationBarrierCleaner (org.apache.hadoop.hbase.master.cleaner.ReplicationBarrierCleaner)1 CatalogJanitor (org.apache.hadoop.hbase.master.janitor.CatalogJanitor)1 GenericOptionsParser (org.apache.hadoop.util.GenericOptionsParser)1