Search in sources :

Example 1 with AdminSlopStreamingVerifier

use of voldemort.cluster.failuredetector.AdminSlopStreamingVerifier in project voldemort by voldemort.

the class StreamingSlopPusherTest method testPushForHostSwap.

/**
     * 
     * Procedure: 1. bring up 2-node cluster; 2. set up slop pusher job with the
     * cluster info; 3. replace node 1 by simply changing its port-ids, update
     * the cluster metadata to whole cluster; 4. run slop pusher job and it has
     * to fail; 5. setCluster in FD and the slop pusher job has to succeed
     * 
     * @throws InterruptedException
     * @throws IOException
     */
@Test
public void testPushForHostSwap() throws InterruptedException, IOException {
    startServers(0, 1);
    // Put into slop store 0
    StorageEngine<ByteArray, Slop, byte[]> slopStoreNode0 = getVoldemortServer(0).getStoreRepository().getSlopStore().asSlopStore();
    // Generate slops for 1
    final List<Versioned<Slop>> entrySet = ServerTestUtils.createRandomSlops(1, 100, "test-replication-memory", "users", "test-replication-persistent", "test-readrepair-memory", "test-consistent", "test-consistent-with-pref-list");
    populateSlops(0, slopStoreNode0, entrySet);
    // replace node 1 and update metadata on all nodes
    replaceOneNode(1);
    Cluster oldCluster = cluster;
    // test if node 1 is down
    stopServersWithoutRemovingVoldemortHome(1);
    // slop should fail here
    new StreamingSlopPusherJob(getVoldemortServer(0).getStoreRepository(), getVoldemortServer(0).getMetadataStore(), new ThresholdFailureDetector(new FailureDetectorConfig().setCluster(oldCluster).setConnectionVerifier(new AdminSlopStreamingVerifier(oldCluster))), configs[0], new ScanPermitWrapper(1)).run();
    Thread.sleep(2000);
    assertFalse(verifySlopPushResult(entrySet, slopStoreNode0, 1));
    // test if node 1 is up
    startServers(1);
    // slop push should fail
    new StreamingSlopPusherJob(getVoldemortServer(0).getStoreRepository(), getVoldemortServer(0).getMetadataStore(), new ThresholdFailureDetector(new FailureDetectorConfig().setCluster(oldCluster).setConnectionVerifier(new AdminSlopStreamingVerifier(oldCluster))), configs[0], new ScanPermitWrapper(1)).run();
    Thread.sleep(2000);
    Assert.assertTrue(verifySlopPushResult(entrySet, slopStoreNode0, 1));
    // Check counts
    SlopStorageEngine slopEngine = getVoldemortServer(0).getStoreRepository().getSlopStore();
    assertEquals(slopEngine.getOutstandingTotal(), 0);
    assertEquals(slopEngine.getOutstandingByNode().get(1), new Long(0));
    assertEquals(slopEngine.getOutstandingByNode().get(2), new Long(0));
    stopServers(0, 1);
}
Also used : ThresholdFailureDetector(voldemort.cluster.failuredetector.ThresholdFailureDetector) Versioned(voldemort.versioning.Versioned) ScanPermitWrapper(voldemort.server.storage.ScanPermitWrapper) Cluster(voldemort.cluster.Cluster) StreamingSlopPusherJob(voldemort.server.scheduler.slop.StreamingSlopPusherJob) AdminSlopStreamingVerifier(voldemort.cluster.failuredetector.AdminSlopStreamingVerifier) FailureDetectorConfig(voldemort.cluster.failuredetector.FailureDetectorConfig) ByteArray(voldemort.utils.ByteArray) SlopStorageEngine(voldemort.store.slop.SlopStorageEngine) Slop(voldemort.store.slop.Slop) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Cluster (voldemort.cluster.Cluster)1 AdminSlopStreamingVerifier (voldemort.cluster.failuredetector.AdminSlopStreamingVerifier)1 FailureDetectorConfig (voldemort.cluster.failuredetector.FailureDetectorConfig)1 ThresholdFailureDetector (voldemort.cluster.failuredetector.ThresholdFailureDetector)1 StreamingSlopPusherJob (voldemort.server.scheduler.slop.StreamingSlopPusherJob)1 ScanPermitWrapper (voldemort.server.storage.ScanPermitWrapper)1 Slop (voldemort.store.slop.Slop)1 SlopStorageEngine (voldemort.store.slop.SlopStorageEngine)1 ByteArray (voldemort.utils.ByteArray)1 Versioned (voldemort.versioning.Versioned)1