[ 
https://issues.apache.org/jira/browse/CASSANDRA-14556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16559633#comment-16559633
 ] 

ASF GitHub Bot commented on CASSANDRA-14556:
--------------------------------------------

Github user iamaleksey commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/239#discussion_r205747034
  
    --- Diff: 
src/java/org/apache/cassandra/db/streaming/CassandraOutgoingFile.java ---
    @@ -114,11 +165,77 @@ public void write(StreamSession session, 
DataOutputStreamPlus out, int version)
             CassandraStreamHeader.serializer.serialize(header, out, version);
             out.flush();
     
    -        CassandraStreamWriter writer = header.compressionInfo == null ?
    -                                       new CassandraStreamWriter(sstable, 
header.sections, session) :
    -                                       new 
CompressedCassandraStreamWriter(sstable, header.sections,
    -                                                                           
header.compressionInfo, session);
    -        writer.write(out);
    +        if (shouldStreamEntireSSTable() && out instanceof 
ByteBufDataOutputStreamPlus)
    +        {
    +            CassandraBlockStreamWriter writer = new 
CassandraBlockStreamWriter(sstable, session, manifest);
    +            writer.write((ByteBufDataOutputStreamPlus) out);
    +        }
    +        else
    +        {
    +            CassandraStreamWriter writer = (header.compressionInfo == 
null) ?
    +                     new CassandraStreamWriter(sstable, header.sections, 
session) :
    +                     new CompressedCassandraStreamWriter(sstable, 
header.sections,
    +                                                         
header.compressionInfo, session);
    +            writer.write(out);
    +        }
    +    }
    +
    +    @VisibleForTesting
    +    public boolean shouldStreamEntireSSTable()
    +    {
    +        // don't stream if full sstable transfers are disabled or legacy 
counter shards are present
    +        if (!isZeroCopySSTableTransfersEnabled || 
ref.get().getSSTableMetadata().hasLegacyCounterShards)
    +            return false;
    +
    +        ColumnFamilyStore cfs = 
ColumnFamilyStore.getIfExists(getTableId());
    +
    +        if (cfs == null)
    +            return false;
    +
    +        AbstractCompactionStrategy compactionStrategy = 
cfs.getCompactionStrategyManager()
    +                                                           
.getCompactionStrategyFor(ref.get());
    +
    +        if (compactionStrategy instanceof LeveledCompactionStrategy)
    +            return contained(ranges, ref.get());
    +
    +        if (compactionStrategy instanceof SizeTieredCompactionStrategy)
    +        {
    +            return (ranges != null
    +                        && ranges.size() == 1
    +                        && ranges.get(0)
    +                                 .contains(new 
Range<>(ref.get().first.getToken(),
    --- End diff --
    
    Should be Bounds for the sstable, since range is (first, last] and sstable 
contains [first, last] (thanks @krummas). But on a higher level note, maybe 
just stick to LCS only for now, and enable STCS after we commit 
CASSANDRA-14568? We are going to do that in 4.0, so this temporary special case 
won't make it to a release anyway ¯\_(ツ)_/¯ 


> Optimize streaming path in Cassandra
> ------------------------------------
>
>                 Key: CASSANDRA-14556
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14556
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Streaming and Messaging
>            Reporter: Dinesh Joshi
>            Assignee: Dinesh Joshi
>            Priority: Major
>              Labels: Performance
>             Fix For: 4.x
>
>
> During streaming, Cassandra reifies the sstables into objects. This creates 
> unnecessary garbage and slows down the whole streaming process as some 
> sstables can be transferred as a whole file rather than individual 
> partitions. The objective of the ticket is to detect when a whole sstable can 
> be transferred and skip the object reification. We can also use a zero-copy 
> path to avoid bringing data into user-space on both sending and receiving 
> side.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to