Search in sources :

Example 6 with AsyncStreamingOutputPlus

use of org.apache.cassandra.net.AsyncStreamingOutputPlus in project cassandra by apache.

the class ZeroCopyStreamingBenchmark method blockStreamWriter.

@Benchmark
@BenchmarkMode(Mode.Throughput)
public void blockStreamWriter(BenchmarkState state) throws Exception {
    EmbeddedChannel channel = createMockNettyChannel();
    AsyncStreamingOutputPlus out = new AsyncStreamingOutputPlus(channel);
    state.blockStreamWriter.write(out);
    out.close();
    channel.finishAndReleaseAll();
}
Also used : AsyncStreamingOutputPlus(org.apache.cassandra.net.AsyncStreamingOutputPlus) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 7 with AsyncStreamingOutputPlus

use of org.apache.cassandra.net.AsyncStreamingOutputPlus in project cassandra by apache.

the class EntireSSTableStreamingCorrectFilesCountTest method test.

@Test
public void test() throws Exception {
    FileCountingStreamEventHandler streamEventHandler = new FileCountingStreamEventHandler();
    StreamSession session = setupStreamingSessionForTest(streamEventHandler);
    Collection<OutgoingStream> outgoingStreams = store.getStreamManager().createOutgoingStreams(session, rangesAtEndpoint, NO_PENDING_REPAIR, PreviewKind.NONE);
    session.addTransferStreams(outgoingStreams);
    AsyncStreamingOutputPlus out = constructDataOutputStream();
    for (OutgoingStream outgoingStream : outgoingStreams) {
        outgoingStream.write(session, out, MessagingService.VERSION_40);
        // verify hardlinks are removed after streaming
        Descriptor descriptor = ((CassandraOutgoingFile) outgoingStream).getRef().get().descriptor;
        assertTrue(descriptor.getTemporaryFiles().isEmpty());
    }
    int totalNumberOfFiles = session.transfers.get(store.metadata.id).getTotalNumberOfFiles();
    assertEquals(ComponentManifest.create(sstable.descriptor).components().size(), totalNumberOfFiles);
    assertEquals(streamEventHandler.fileNames.size(), totalNumberOfFiles);
}
Also used : CassandraOutgoingFile(org.apache.cassandra.db.streaming.CassandraOutgoingFile) AsyncStreamingOutputPlus(org.apache.cassandra.net.AsyncStreamingOutputPlus) Descriptor(org.apache.cassandra.io.sstable.Descriptor) RangesAtEndpoint(org.apache.cassandra.locator.RangesAtEndpoint) Test(org.junit.Test)

Aggregations

AsyncStreamingOutputPlus (org.apache.cassandra.net.AsyncStreamingOutputPlus)7 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)5 ByteBuf (io.netty.buffer.ByteBuf)3 StreamSession (org.apache.cassandra.streaming.StreamSession)3 Test (org.junit.Test)3 SSTableReader (org.apache.cassandra.io.sstable.format.SSTableReader)2 DataInputBuffer (org.apache.cassandra.io.util.DataInputBuffer)2 InetAddressAndPort (org.apache.cassandra.locator.InetAddressAndPort)2 StreamSummary (org.apache.cassandra.streaming.StreamSummary)2 StreamMessageHeader (org.apache.cassandra.streaming.messages.StreamMessageHeader)2 Benchmark (org.openjdk.jmh.annotations.Benchmark)2 BenchmarkMode (org.openjdk.jmh.annotations.BenchmarkMode)2 DefaultFileRegion (io.netty.channel.DefaultFileRegion)1 Queue (java.util.Queue)1 CassandraOutgoingFile (org.apache.cassandra.db.streaming.CassandraOutgoingFile)1 Descriptor (org.apache.cassandra.io.sstable.Descriptor)1 SSTableMultiWriter (org.apache.cassandra.io.sstable.SSTableMultiWriter)1 RangesAtEndpoint (org.apache.cassandra.locator.RangesAtEndpoint)1 SharedDefaultFileRegion (org.apache.cassandra.net.SharedDefaultFileRegion)1 OutgoingStream (org.apache.cassandra.streaming.OutgoingStream)1