Search in sources :

Example 6 with VisitorStatistics

use of com.yahoo.vdslib.VisitorStatistics in project vespa by vespa-engine.

the class MessageBusVisitorSessionTestCase method testVisitingCompletedFromSufficientFirstPassHits.

@Test
public void testVisitingCompletedFromSufficientFirstPassHits() {
    VisitorParameters visitorParameters = createVisitorParameters("id.user==1234");
    visitorParameters.setMaxFirstPassHits(10);
    ReplyModifier replyModifier1 = (reply) -> {
        VisitorStatistics stats = new VisitorStatistics();
        stats.setBucketsVisited(1);
        stats.setDocumentsReturned(9);
        reply.setVisitorStatistics(stats);
        reply.setLastBucket(new BucketId(33, 1234 | (1L << 32)));
    };
    ReplyModifier replyModifier2 = (reply) -> {
        VisitorStatistics stats = new VisitorStatistics();
        stats.setBucketsVisited(1);
        stats.setDocumentsReturned(1);
        reply.setVisitorStatistics(stats);
        reply.setLastBucket(new BucketId(34, 1234 | (1L << 33)));
    };
    doTestEarlyCompletion(visitorParameters, replyModifier1, replyModifier2);
}
Also used : java.util(java.util) CyclicBarrier(java.util.concurrent.CyclicBarrier) com.yahoo.documentapi(com.yahoo.documentapi) com.yahoo.messagebus(com.yahoo.messagebus) DocumentId(com.yahoo.document.DocumentId) ParseException(com.yahoo.document.select.parser.ParseException) com.yahoo.documentapi.messagebus.protocol(com.yahoo.documentapi.messagebus.protocol) Test(org.junit.Test) Callable(java.util.concurrent.Callable) MessageBusVisitorSession(com.yahoo.documentapi.messagebus.MessageBusVisitorSession) Result(com.yahoo.messagebus.Result) Error(com.yahoo.messagebus.Error) RoutingTable(com.yahoo.messagebus.routing.RoutingTable) TimeUnit(java.util.concurrent.TimeUnit) Route(com.yahoo.messagebus.routing.Route) RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) Charset(java.nio.charset.Charset) VisitorStatistics(com.yahoo.vdslib.VisitorStatistics) LoadType(com.yahoo.documentapi.messagebus.loadtypes.LoadType) Assert(org.junit.Assert) RouteSpec(com.yahoo.messagebus.routing.RouteSpec) BucketId(com.yahoo.document.BucketId) Assert.assertEquals(org.junit.Assert.assertEquals) VisitorStatistics(com.yahoo.vdslib.VisitorStatistics) BucketId(com.yahoo.document.BucketId) Test(org.junit.Test)

Example 7 with VisitorStatistics

use of com.yahoo.vdslib.VisitorStatistics in project vespa by vespa-engine.

the class MessageBusVisitorSessionTestCase method testVisitingCompletedFromSecondPassHits.

@Test
public void testVisitingCompletedFromSecondPassHits() {
    VisitorParameters visitorParameters = createVisitorParameters("id.user==1234");
    visitorParameters.setMaxTotalHits(10);
    ReplyModifier replyModifier1 = (reply) -> {
        VisitorStatistics stats = new VisitorStatistics();
        stats.setBucketsVisited(1);
        stats.setDocumentsReturned(5);
        stats.setSecondPassDocumentsReturned(4);
        reply.setVisitorStatistics(stats);
        reply.setLastBucket(new BucketId(33, 1234 | (1L << 32)));
    };
    ReplyModifier replyModifier2 = (reply) -> {
        VisitorStatistics stats = new VisitorStatistics();
        stats.setBucketsVisited(1);
        stats.setSecondPassDocumentsReturned(1);
        reply.setVisitorStatistics(stats);
        reply.setLastBucket(new BucketId(34, 1234 | (1L << 33)));
    };
    doTestEarlyCompletion(visitorParameters, replyModifier1, replyModifier2);
}
Also used : java.util(java.util) CyclicBarrier(java.util.concurrent.CyclicBarrier) com.yahoo.documentapi(com.yahoo.documentapi) com.yahoo.messagebus(com.yahoo.messagebus) DocumentId(com.yahoo.document.DocumentId) ParseException(com.yahoo.document.select.parser.ParseException) com.yahoo.documentapi.messagebus.protocol(com.yahoo.documentapi.messagebus.protocol) Test(org.junit.Test) Callable(java.util.concurrent.Callable) MessageBusVisitorSession(com.yahoo.documentapi.messagebus.MessageBusVisitorSession) Result(com.yahoo.messagebus.Result) Error(com.yahoo.messagebus.Error) RoutingTable(com.yahoo.messagebus.routing.RoutingTable) TimeUnit(java.util.concurrent.TimeUnit) Route(com.yahoo.messagebus.routing.Route) RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) Charset(java.nio.charset.Charset) VisitorStatistics(com.yahoo.vdslib.VisitorStatistics) LoadType(com.yahoo.documentapi.messagebus.loadtypes.LoadType) Assert(org.junit.Assert) RouteSpec(com.yahoo.messagebus.routing.RouteSpec) BucketId(com.yahoo.document.BucketId) Assert.assertEquals(org.junit.Assert.assertEquals) VisitorStatistics(com.yahoo.vdslib.VisitorStatistics) BucketId(com.yahoo.document.BucketId) Test(org.junit.Test)

Aggregations

VisitorStatistics (com.yahoo.vdslib.VisitorStatistics)7 Test (org.junit.Test)6 BucketId (com.yahoo.document.BucketId)3 DocumentId (com.yahoo.document.DocumentId)3 ParseException (com.yahoo.document.select.parser.ParseException)3 com.yahoo.documentapi (com.yahoo.documentapi)3 MessageBusVisitorSession (com.yahoo.documentapi.messagebus.MessageBusVisitorSession)3 LoadType (com.yahoo.documentapi.messagebus.loadtypes.LoadType)3 com.yahoo.documentapi.messagebus.protocol (com.yahoo.documentapi.messagebus.protocol)3 com.yahoo.messagebus (com.yahoo.messagebus)3 Error (com.yahoo.messagebus.Error)3 Result (com.yahoo.messagebus.Result)3 Route (com.yahoo.messagebus.routing.Route)3 RouteSpec (com.yahoo.messagebus.routing.RouteSpec)3 RoutingTable (com.yahoo.messagebus.routing.RoutingTable)3 RoutingTableSpec (com.yahoo.messagebus.routing.RoutingTableSpec)3 Charset (java.nio.charset.Charset)3 java.util (java.util)3 Callable (java.util.concurrent.Callable)3 CyclicBarrier (java.util.concurrent.CyclicBarrier)3