mirror of https://github.com/apache/cassandra
Followup to 6916, don't try to snapshot readers that are opened early.
Patch by benedict; reviewed by marcuse for CASSANDRA-6916.
This commit is contained in:
parent
2a77695f3f
commit
33bc1e8f8e
|
|
@ -2144,7 +2144,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
||||||
{
|
{
|
||||||
for (SSTableReader ssTable : currentView.sstables)
|
for (SSTableReader ssTable : currentView.sstables)
|
||||||
{
|
{
|
||||||
if (predicate != null && !predicate.apply(ssTable))
|
if (ssTable.isOpenEarly || (predicate != null && !predicate.apply(ssTable)))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@ public class SSTableReader extends SSTable
|
||||||
* The age is in milliseconds since epoc and is local to this host.
|
* The age is in milliseconds since epoc and is local to this host.
|
||||||
*/
|
*/
|
||||||
public final long maxDataAge;
|
public final long maxDataAge;
|
||||||
|
public final boolean isOpenEarly;
|
||||||
|
|
||||||
// indexfile and datafile: might be null before a call to load()
|
// indexfile and datafile: might be null before a call to load()
|
||||||
private SegmentedFile ifile;
|
private SegmentedFile ifile;
|
||||||
|
|
@ -336,7 +337,8 @@ public class SSTableReader extends SSTable
|
||||||
metadata,
|
metadata,
|
||||||
partitioner,
|
partitioner,
|
||||||
System.currentTimeMillis(),
|
System.currentTimeMillis(),
|
||||||
statsMetadata);
|
statsMetadata,
|
||||||
|
false);
|
||||||
|
|
||||||
// special implementation of load to use non-pooled SegmentedFile builders
|
// special implementation of load to use non-pooled SegmentedFile builders
|
||||||
SegmentedFile.Builder ibuilder = new BufferedSegmentedFile.Builder();
|
SegmentedFile.Builder ibuilder = new BufferedSegmentedFile.Builder();
|
||||||
|
|
@ -384,7 +386,8 @@ public class SSTableReader extends SSTable
|
||||||
metadata,
|
metadata,
|
||||||
partitioner,
|
partitioner,
|
||||||
System.currentTimeMillis(),
|
System.currentTimeMillis(),
|
||||||
statsMetadata);
|
statsMetadata,
|
||||||
|
false);
|
||||||
|
|
||||||
// load index and filter
|
// load index and filter
|
||||||
long start = System.nanoTime();
|
long start = System.nanoTime();
|
||||||
|
|
@ -463,7 +466,8 @@ public class SSTableReader extends SSTable
|
||||||
IndexSummary isummary,
|
IndexSummary isummary,
|
||||||
IFilter bf,
|
IFilter bf,
|
||||||
long maxDataAge,
|
long maxDataAge,
|
||||||
StatsMetadata sstableMetadata)
|
StatsMetadata sstableMetadata,
|
||||||
|
boolean isOpenEarly)
|
||||||
{
|
{
|
||||||
assert desc != null && partitioner != null && ifile != null && dfile != null && isummary != null && bf != null && sstableMetadata != null;
|
assert desc != null && partitioner != null && ifile != null && dfile != null && isummary != null && bf != null && sstableMetadata != null;
|
||||||
return new SSTableReader(desc,
|
return new SSTableReader(desc,
|
||||||
|
|
@ -474,7 +478,8 @@ public class SSTableReader extends SSTable
|
||||||
isummary,
|
isummary,
|
||||||
bf,
|
bf,
|
||||||
maxDataAge,
|
maxDataAge,
|
||||||
sstableMetadata);
|
sstableMetadata,
|
||||||
|
isOpenEarly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -483,11 +488,13 @@ public class SSTableReader extends SSTable
|
||||||
CFMetaData metadata,
|
CFMetaData metadata,
|
||||||
IPartitioner partitioner,
|
IPartitioner partitioner,
|
||||||
long maxDataAge,
|
long maxDataAge,
|
||||||
StatsMetadata sstableMetadata)
|
StatsMetadata sstableMetadata,
|
||||||
|
boolean isOpenEarly)
|
||||||
{
|
{
|
||||||
super(desc, components, metadata, partitioner);
|
super(desc, components, metadata, partitioner);
|
||||||
this.sstableMetadata = sstableMetadata;
|
this.sstableMetadata = sstableMetadata;
|
||||||
this.maxDataAge = maxDataAge;
|
this.maxDataAge = maxDataAge;
|
||||||
|
this.isOpenEarly = isOpenEarly;
|
||||||
|
|
||||||
deletingTask = new SSTableDeletingTask(this);
|
deletingTask = new SSTableDeletingTask(this);
|
||||||
|
|
||||||
|
|
@ -524,9 +531,10 @@ public class SSTableReader extends SSTable
|
||||||
IndexSummary indexSummary,
|
IndexSummary indexSummary,
|
||||||
IFilter bloomFilter,
|
IFilter bloomFilter,
|
||||||
long maxDataAge,
|
long maxDataAge,
|
||||||
StatsMetadata sstableMetadata)
|
StatsMetadata sstableMetadata,
|
||||||
|
boolean isOpenEarly)
|
||||||
{
|
{
|
||||||
this(desc, components, metadata, partitioner, maxDataAge, sstableMetadata);
|
this(desc, components, metadata, partitioner, maxDataAge, sstableMetadata, isOpenEarly);
|
||||||
|
|
||||||
this.ifile = ifile;
|
this.ifile = ifile;
|
||||||
this.dfile = dfile;
|
this.dfile = dfile;
|
||||||
|
|
@ -947,7 +955,7 @@ public class SSTableReader extends SSTable
|
||||||
|
|
||||||
if (readMeterSyncFuture != null)
|
if (readMeterSyncFuture != null)
|
||||||
readMeterSyncFuture.cancel(false);
|
readMeterSyncFuture.cancel(false);
|
||||||
SSTableReader replacement = new SSTableReader(descriptor, components, metadata, partitioner, ifile, dfile, indexSummary.readOnlyClone(), bf, maxDataAge, sstableMetadata);
|
SSTableReader replacement = new SSTableReader(descriptor, components, metadata, partitioner, ifile, dfile, indexSummary.readOnlyClone(), bf, maxDataAge, sstableMetadata, isOpenEarly);
|
||||||
replacement.readMeter = this.readMeter;
|
replacement.readMeter = this.readMeter;
|
||||||
replacement.first = this.last.compareTo(newStart) > 0 ? newStart : this.last;
|
replacement.first = this.last.compareTo(newStart) > 0 ? newStart : this.last;
|
||||||
replacement.last = this.last;
|
replacement.last = this.last;
|
||||||
|
|
@ -1010,7 +1018,7 @@ public class SSTableReader extends SSTable
|
||||||
if (readMeterSyncFuture != null)
|
if (readMeterSyncFuture != null)
|
||||||
readMeterSyncFuture.cancel(false);
|
readMeterSyncFuture.cancel(false);
|
||||||
|
|
||||||
SSTableReader replacement = new SSTableReader(descriptor, components, metadata, partitioner, ifile, dfile, newSummary, bf, maxDataAge, sstableMetadata);
|
SSTableReader replacement = new SSTableReader(descriptor, components, metadata, partitioner, ifile, dfile, newSummary, bf, maxDataAge, sstableMetadata, isOpenEarly);
|
||||||
replacement.readMeter = this.readMeter;
|
replacement.readMeter = this.readMeter;
|
||||||
replacement.first = this.first;
|
replacement.first = this.first;
|
||||||
replacement.last = this.last;
|
replacement.last = this.last;
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,7 @@ public class SSTableWriter extends SSTable
|
||||||
components, metadata,
|
components, metadata,
|
||||||
partitioner, ifile,
|
partitioner, ifile,
|
||||||
dfile, iwriter.summary.build(partitioner, exclusiveUpperBoundOfReadableIndex),
|
dfile, iwriter.summary.build(partitioner, exclusiveUpperBoundOfReadableIndex),
|
||||||
iwriter.bf, maxDataAge, sstableMetadata);
|
iwriter.bf, maxDataAge, sstableMetadata, true);
|
||||||
|
|
||||||
// now it's open, find the ACTUAL last readable key (i.e. for which the data file has also been flushed)
|
// now it's open, find the ACTUAL last readable key (i.e. for which the data file has also been flushed)
|
||||||
sstable.first = getMinimalKey(first);
|
sstable.first = getMinimalKey(first);
|
||||||
|
|
@ -440,7 +440,8 @@ public class SSTableWriter extends SSTable
|
||||||
iwriter.summary.build(partitioner),
|
iwriter.summary.build(partitioner),
|
||||||
iwriter.bf,
|
iwriter.bf,
|
||||||
maxDataAge,
|
maxDataAge,
|
||||||
sstableMetadata);
|
sstableMetadata,
|
||||||
|
false);
|
||||||
sstable.first = getMinimalKey(first);
|
sstable.first = getMinimalKey(first);
|
||||||
sstable.last = getMinimalKey(last);
|
sstable.last = getMinimalKey(last);
|
||||||
// try to save the summaries to disk
|
// try to save the summaries to disk
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue