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));
}
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));
}
Aggregations