Source:
public void testPassthrough(PipelineExecutionStrategy executionStrategy) { LocalExchangeFactory localExchangeFactory = new LocalExchangeFactory( FIXED_PASSTHROUGH_DISTRIBUTION, 2, TYPES, ImmutableList.of(), Optional.empty(), executionStrategy, new DataSize(retainedSizeOfPages(1), BYTE)); LocalExchangeSinkFactoryId localExchangeSinkFactoryId = localExchangeFactory.newSinkFactoryId(); localExchangeFactory.noMoreSinkFactories(); run(localExchangeFactory, executionStrategy, exchange -> { assertEquals(exchange.getBufferCount(), 2); assertExchangeTotalBufferedBytes(exchange, 0); LocalExchangeSinkFactory sinkFactory = exchange.getSinkFactory(localExchangeSinkFactoryId); LocalExchangeSink sinkA = sinkFactory.createSink(); LocalExchangeSink sinkB = sinkFactory.createSink(); assertSinkCanWrite(sinkA); assertSinkCanWrite(sinkB); sinkFactory.close(); sinkFactory.noMoreSinkFactories(); LocalExchangeSource sourceA = exchange.getSource(0); assertSource(sourceA, 0); LocalExchangeSource sourceB = exchange.getSource(1); assertSource(sourceB, 0); sinkA.addPage(createPage(0)); assertSource(sourceA, 1); assertSource(sourceB, 0); assertSinkWriteBlocked(sinkA); assertSinkCanWrite(sinkB); sinkB.addPage(createPage(1)); assertSource(sourceA, 1); assertSource(sourceB, 1); assertSinkWriteBlocked(sinkA); assertTrue(exchange.getBufferedBytes() >= retainedSizeOfPages(2)); assertRemovePage(sourceA, createPage(0)); assertSource(sourceA, 0); assertSinkCanWrite(sinkA); assertSinkWriteBlocked(sinkB); assertExchangeTotalBufferedBytes(exchange, 1); sinkA.finish(); assertSinkFinished(sinkA); assertSource(sourceB, 1); sourceA.finish(); sourceB.finish(); assertRemovePage(sourceB, createPage(1)); assertSourceFinished(sourceA); assertSourceFinished(sourceB); assertSinkFinished(sinkB); assertExchangeTotalBufferedBytes(exchange, 0); }); }

Target:
public void testPassthrough(PipelineExecutionStrategy executionStrategy) { LocalExchangeFactory localExchangeFactory = new LocalExchangeFactory( FIXED_PASSTHROUGH_DISTRIBUTION, 2, TYPES, ImmutableList.of(), Optional.empty(), executionStrategy, new DataSize(retainedSizeOfPages(1), BYTE)); LocalExchangeSinkFactoryId localExchangeSinkFactoryId = localExchangeFactory.newSinkFactoryId(); localExchangeFactory.noMoreSinkFactories(); run(localExchangeFactory, executionStrategy, exchange -> { assertEquals(exchange.getBufferCount(), 2); assertExchangeTotalBufferedBytes(exchange, 0); LocalExchangeSinkFactory sinkFactory = exchange.getSinkFactory(localExchangeSinkFactoryId); LocalExchangeSink sinkA = sinkFactory.createSink(); LocalExchangeSink sinkB = sinkFactory.createSink(); assertSinkCanWrite(sinkA); assertSinkCanWrite(sinkB); sinkFactory.close(); sinkFactory.noMoreSinkFactories(); LocalExchangeSource sourceA = exchange.getSource(0); assertSource(sourceA, 0); LocalExchangeSource sourceB = exchange.getSource(1); assertSource(sourceB, 0); sinkA.addPage(createPage(0)); assertSource(sourceA, 1); assertSource(sourceB, 0); assertSinkWriteBlocked(sinkA); assertSinkCanWrite(sinkB); sinkB.addPage(createPage(1)); assertSource(sourceA, 1); assertSource(sourceB, 1); assertSinkWriteBlocked(sinkA); assertExchangeTotalBufferedBytes(exchange, 2); assertRemovePage(sourceA, createPage(0)); assertSource(sourceA, 0); assertSinkCanWrite(sinkA); assertSinkWriteBlocked(sinkB); assertExchangeTotalBufferedBytes(exchange, 1); sinkA.finish(); assertSinkFinished(sinkA); assertSource(sourceB, 1); sourceA.finish(); sourceB.finish(); assertRemovePage(sourceB, createPage(1)); assertSourceFinished(sourceA); assertSourceFinished(sourceB); assertSinkFinished(sinkB); assertExchangeTotalBufferedBytes(exchange, 0); }); }