Search in sources :

Example 6 with StaticThrottlePolicy

use of com.yahoo.messagebus.StaticThrottlePolicy in project vespa by vespa-engine.

the class OperationHandlerImplTest method visit_concurrency_is_1_by_default.

@Test
public void visit_concurrency_is_1_by_default() throws Exception {
    VisitorParameters params = generatedParametersFromVisitOptions(emptyVisitOptions());
    assertThat(params.getThrottlePolicy(), instanceOf(StaticThrottlePolicy.class));
    assertThat(((StaticThrottlePolicy) params.getThrottlePolicy()).getMaxPendingCount(), is((int) 1));
}
Also used : StaticThrottlePolicy(com.yahoo.messagebus.StaticThrottlePolicy) VisitorParameters(com.yahoo.documentapi.VisitorParameters) Test(org.junit.Test)

Example 7 with StaticThrottlePolicy

use of com.yahoo.messagebus.StaticThrottlePolicy in project vespa by vespa-engine.

the class OperationHandlerImplTest method visit_concurrency_is_propagated_to_visitor_parameters.

@Test
public void visit_concurrency_is_propagated_to_visitor_parameters() throws Exception {
    VisitorParameters params = generatedParametersFromVisitOptions(optionsBuilder().concurrency(3).build());
    assertThat(params.getThrottlePolicy(), instanceOf(StaticThrottlePolicy.class));
    assertThat(((StaticThrottlePolicy) params.getThrottlePolicy()).getMaxPendingCount(), is((int) 3));
}
Also used : StaticThrottlePolicy(com.yahoo.messagebus.StaticThrottlePolicy) VisitorParameters(com.yahoo.documentapi.VisitorParameters) Test(org.junit.Test)

Example 8 with StaticThrottlePolicy

use of com.yahoo.messagebus.StaticThrottlePolicy in project vespa by vespa-engine.

the class VdsVisitTestCase method testCommandLineLongOptions.

@Test
public void testCommandLineLongOptions() throws Exception {
    // short options testing (for options that do not collide with each other)
    String[] args = new String[] { "--datahandler", "foo.remote", "--selection", "'id.user=1234'", "--from", "5678", "--to", "9012", "--fieldset", "foodoc.bar,foodoc.baz", "--maxpending", "6000", "--maxbuckets", "5", "--progress", "foo-progress.txt", "--maxpendingsuperbuckets", "3", "--buckettimeout", "123456789", "--cluster", "kittens", "--visitinconsistentbuckets", "--visitlibrary", "fnord", "--libraryparam", "asdf", "rargh", "--libraryparam", "pinkie", "pie", "--processtime", "555", "--maxhits", "1001", "--maxtotalhits", "2002", "--tracelevel", "8", "--priority", "NORMAL_1", "--ordering", "ascending", "--skipbucketsonfatalerrors", "--abortonclusterdown", "--visitremoves", "--bucketspace", "outerspace" };
    VdsVisit.ArgumentParser parser = createMockArgumentParser();
    VdsVisit.VdsVisitParameters allParams = parser.parse(args);
    assertNotNull(allParams);
    VisitorParameters params = allParams.getVisitorParameters();
    assertNotNull(params);
    assertEquals("foo.remote", params.getRemoteDataHandler());
    assertEquals("'id.user=1234'", params.getDocumentSelection());
    assertEquals(5678, params.getFromTimestamp());
    assertEquals(9012, params.getToTimestamp());
    assertEquals("foodoc.bar,foodoc.baz", params.getFieldSet());
    assertEquals(6000, params.getMaxPending());
    assertEquals(5, params.getMaxBucketsPerVisitor());
    assertEquals("foo-progress.txt", params.getResumeFileName());
    assertEquals(123456789, params.getTimeoutMs());
    assertEquals(7 * 24 * 60 * 60 * 1000, allParams.getFullTimeout());
    assertEquals("kittens", allParams.getCluster());
    assertTrue(params.getThrottlePolicy() instanceof StaticThrottlePolicy);
    assertEquals(3, ((StaticThrottlePolicy) params.getThrottlePolicy()).getMaxPendingCount());
    assertTrue(params.visitInconsistentBuckets());
    assertEquals("fnord", params.getVisitorLibrary());
    // TODO: FIXME? multiple library params doesn't work
    assertTrue(Arrays.equals("rargh".getBytes(), params.getLibraryParameters().get("asdf")));
    // assertTrue(Arrays.equals("pie".getBytes(), params.getLibraryParameters().get("pinkie")));
    assertEquals(555, allParams.getProcessTime());
    assertEquals(1001, params.getMaxFirstPassHits());
    assertEquals(2002, params.getMaxTotalHits());
    assertEquals(8, params.getTraceLevel());
    assertEquals(DocumentProtocol.Priority.NORMAL_1, params.getPriority());
    assertEquals(OrderingSpecification.ASCENDING, params.getVisitorOrdering());
    assertTrue(allParams.getAbortOnClusterDown());
    assertTrue(params.visitRemoves());
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    PrintStream printStream = new PrintStream(outputStream);
    VdsVisit.verbosePrintParameters(allParams, printStream);
    printStream.flush();
    // the joys of running tests on windows
    String nl = System.getProperty("line.separator");
    assertEquals("Time out visitor after 123456789 ms." + nl + "Visiting documents matching: 'id.user=1234'" + nl + "Visiting bucket space: outerspace" + nl + "Visiting in the inclusive timestamp range 5678 - 9012." + nl + "Visiting field set foodoc.bar,foodoc.baz." + nl + "Visiting inconsistent buckets." + nl + "Including remove entries." + nl + "Tracking progress in file: foo-progress.txt" + nl + "Let visitor have maximum 6000 replies pending on data handlers per storage node visitor." + nl + "Visit maximum 5 buckets per visitor." + nl + "Sending data to data handler at: foo.remote" + nl + "Using visitor library 'fnord'." + nl + "Adding the following library specific parameters:" + nl + "  asdf = rargh" + nl + "Visitor priority NORMAL_1" + nl + "Skip visiting super buckets with fatal errors." + nl, outputStream.toString("utf-8"));
    args = new String[] { "--ordering", "descending" };
    allParams = parser.parse(args);
    params = allParams.getVisitorParameters();
    assertEquals(OrderingSpecification.DESCENDING, params.getVisitorOrdering());
}
Also used : PrintStream(java.io.PrintStream) StaticThrottlePolicy(com.yahoo.messagebus.StaticThrottlePolicy) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Aggregations

StaticThrottlePolicy (com.yahoo.messagebus.StaticThrottlePolicy)8 Test (org.junit.Test)5 VisitorParameters (com.yahoo.documentapi.VisitorParameters)3 StaticThrottlePolicySignature (com.yahoo.container.jdisc.messagebus.SessionCache.StaticThrottlePolicySignature)1 UnknownThrottlePolicySignature (com.yahoo.container.jdisc.messagebus.SessionCache.UnknownThrottlePolicySignature)1 DocumentAccessException (com.yahoo.documentapi.DocumentAccessException)1 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)1 SourceSessionParams (com.yahoo.messagebus.SourceSessionParams)1 ClusterDef (com.yahoo.vespaclient.ClusterDef)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1