Search in sources :

Example 16 with Routing

use of io.crate.metadata.Routing in project crate by crate.

the class BlobShardCollectorProviderTest method testReadIsolation.

@Test
public void testReadIsolation() throws Exception {
    execute("create blob table b1 clustered into 1 shards with (number_of_replicas = 0)");
    upload("b1", "foo");
    upload("b1", "bar");
    ensureGreen();
    assertBusy(new Initializer());
    RoutedCollectPhase collectPhase = new RoutedCollectPhase(UUID.randomUUID(), 1, "collect", new Routing(ImmutableMap.of()), RowGranularity.SHARD, ImmutableList.of(), ImmutableList.of(), WhereClause.MATCH_ALL, DistributionInfo.DEFAULT_BROADCAST);
    // No read Isolation
    Iterable<Row> iterable = getBlobRows(collectPhase, false);
    assertThat(Iterables.size(iterable), is(2));
    upload("b1", "newEntry1");
    assertThat(Iterables.size(iterable), is(3));
    // Read isolation
    iterable = getBlobRows(collectPhase, true);
    assertThat(Iterables.size(iterable), is(3));
    upload("b1", "newEntry2");
    assertThat(Iterables.size(iterable), is(3));
}
Also used : Routing(io.crate.metadata.Routing) Row(io.crate.data.Row) RoutedCollectPhase(io.crate.planner.node.dql.RoutedCollectPhase) SQLHttpIntegrationTest(io.crate.integrationtests.SQLHttpIntegrationTest) Test(org.junit.Test)

Example 17 with Routing

use of io.crate.metadata.Routing in project crate by crate.

the class JobCollectContextTest method setUp.

@Before
public void setUp() throws Exception {
    localNodeId = "dummyLocalNodeId";
    collectPhase = Mockito.mock(RoutedCollectPhase.class);
    Routing routing = Mockito.mock(Routing.class);
    when(routing.containsShards(localNodeId)).thenReturn(true);
    when(collectPhase.routing()).thenReturn(routing);
    when(collectPhase.maxRowGranularity()).thenReturn(RowGranularity.DOC);
    jobCollectContext = new JobCollectContext(collectPhase, mock(MapSideDataCollectOperation.class), localNodeId, ramAccountingContext, new TestingBatchConsumer(), mock(SharedShardContexts.class));
}
Also used : Routing(io.crate.metadata.Routing) TestingBatchConsumer(io.crate.testing.TestingBatchConsumer) RoutedCollectPhase(io.crate.planner.node.dql.RoutedCollectPhase) Before(org.junit.Before)

Aggregations

Routing (io.crate.metadata.Routing)17 RoutedCollectPhase (io.crate.planner.node.dql.RoutedCollectPhase)10 Test (org.junit.Test)9 CrateUnitTest (io.crate.test.integration.CrateUnitTest)6 ImmutableList (com.google.common.collect.ImmutableList)4 Reference (io.crate.metadata.Reference)4 TableIdent (io.crate.metadata.TableIdent)4 Map (java.util.Map)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 Symbol (io.crate.analyze.symbol.Symbol)3 TestingBatchConsumer (io.crate.testing.TestingBatchConsumer)3 List (java.util.List)3 SharedShardContexts (io.crate.action.job.SharedShardContexts)2 InputColumn (io.crate.analyze.symbol.InputColumn)2 PartitionName (io.crate.metadata.PartitionName)2 NodeOperation (io.crate.operation.NodeOperation)2 JobsLogs (io.crate.operation.collect.stats.JobsLogs)2 MergePhase (io.crate.planner.node.dql.MergePhase)2 SysUpdateProjection (io.crate.planner.projection.SysUpdateProjection)2 Before (org.junit.Before)2