mirror of https://github.com/apache/cassandra
Fix LCS splitting sstables based on uncompressed length
patch by slebresne; reviewed by jbellis for CASSANDRA-4419
This commit is contained in:
parent
51a9fd131a
commit
787e0e6488
|
|
@ -10,6 +10,7 @@
|
|||
* Oversize integer in CQL throws NumberFormatException (CASSANDRA-4291)
|
||||
* Set gc_grace on index CF to 0 (CASSANDRA-4314)
|
||||
* fix 1.0.x node join to mixed version cluster, other nodes >= 1.1 (CASSANDRA-4195)
|
||||
* Fix LCS splitting sstable base on uncompressed size (CASSANDRA-4419)
|
||||
|
||||
|
||||
1.0.10
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ public class CompactionTask extends AbstractCompactionTask
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!nni.hasNext() || newSSTableSegmentThresholdReached(writer, position))
|
||||
if (!nni.hasNext() || newSSTableSegmentThresholdReached(writer))
|
||||
{
|
||||
SSTableReader toIndex = writer.closeAndOpenReader(getMaxDataAge(toCompact));
|
||||
cachedKeyMap.put(toIndex, cachedKeys);
|
||||
|
|
@ -229,7 +229,7 @@ public class CompactionTask extends AbstractCompactionTask
|
|||
}
|
||||
|
||||
//extensibility point for other strategies that may want to limit the upper bounds of the sstable segment size
|
||||
protected boolean newSSTableSegmentThresholdReached(SSTableWriter writer, long position)
|
||||
protected boolean newSSTableSegmentThresholdReached(SSTableWriter writer) throws IOException
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ public class LeveledCompactionTask extends CompactionTask
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean newSSTableSegmentThresholdReached(SSTableWriter writer, long position)
|
||||
protected boolean newSSTableSegmentThresholdReached(SSTableWriter writer) throws IOException
|
||||
{
|
||||
return position > sstableSizeInMB * 1024L * 1024L;
|
||||
return writer.getOnDiskFilePointer() > sstableSizeInMB * 1024L * 1024L;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -68,6 +68,12 @@ public class CompressedSequentialWriter extends SequentialWriter
|
|||
this.sstableMetadataCollector = sstableMetadataCollector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getOnDiskFilePointer() throws IOException
|
||||
{
|
||||
return out.getFilePointer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sync() throws IOException
|
||||
{
|
||||
|
|
|
|||
|
|
@ -382,6 +382,11 @@ public class SSTableWriter extends SSTable
|
|||
return dataFile.getFilePointer();
|
||||
}
|
||||
|
||||
public long getOnDiskFilePointer() throws IOException
|
||||
{
|
||||
return dataFile.getOnDiskFilePointer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulates writing the index and filter for an SSTable. The state of this object is not valid until it has been closed.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -211,6 +211,18 @@ public class SequentialWriter extends OutputStream
|
|||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current file pointer of the underlying on-disk file.
|
||||
* Note that since write works by buffering data, the value of this will increase by buffer
|
||||
* size and not every write to the writer will modify this value.
|
||||
* Furthermore, for compressed files, this value refers to compressed data, while the
|
||||
* writer getFilePointer() refers to uncompressedFile
|
||||
*/
|
||||
public long getOnDiskFilePointer() throws IOException
|
||||
{
|
||||
return getFilePointer();
|
||||
}
|
||||
|
||||
public long length() throws IOException
|
||||
{
|
||||
return Math.max(Math.max(current, out.length()), bufferOffset + validBufferBytes);
|
||||
|
|
|
|||
Loading…
Reference in New Issue