cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aweisberg <...@git.apache.org>
Subject [GitHub] cassandra pull request #239: [CASSANDRA-14556] Optimize Streaming
Date Fri, 13 Jul 2018 22:19:17 GMT
Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/239#discussion_r202486107
  
    --- Diff: src/java/org/apache/cassandra/db/streaming/CassandraOutgoingFile.java ---
    @@ -114,13 +153,54 @@ 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);
    +        IStreamWriter writer;
    +        if (shouldStreamFullSSTable())
    +        {
    +            writer = new CassandraBlockStreamWriter(sstable, session, components);
    +        }
    +        else
    +        {
    +            writer = (header.compressionInfo == null) ?
    +                     new CassandraStreamWriter(sstable, header.sections, session) :
    +                     new CompressedCassandraStreamWriter(sstable, header.sections,
    +                                                         header.compressionInfo, session);
    +        }
             writer.write(out);
         }
     
    +    @VisibleForTesting
    +    public boolean shouldStreamFullSSTable()
    +    {
    +        return isFullSSTableTransfersEnabled && isFullyContained;
    +    }
    +
    +    @VisibleForTesting
    +    public boolean fullyContainedIn(List<Range<Token>> requestedRanges, SSTableReader
sstable)
    +    {
    +        if (requestedRanges == null)
    +            return false;
    +        try (KeyIterator iter = new KeyIterator(sstable.descriptor, sstable.metadata()))
    +        {
    +            while (iter.hasNext())
    +            {
    +                DecoratedKey key = iter.next();
    +                boolean foundFlag = false;
    +                for (Range<Token> r : requestedRanges)
    --- End diff --
    
    So in the vnodes case is this going to be 256 ranges by default? Should this be a binary
search instead of a scan?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message