mirror of https://github.com/apache/cassandra
Merge 6bf2cd8ef6 into 10557d7ffe
This commit is contained in:
commit
7ce26dc499
|
|
@ -23,6 +23,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||||
|
import org.apache.cassandra.db.filter.TombstoneOverwhelmingException;
|
||||||
import org.apache.cassandra.db.partitions.UnfilteredPartitionIterator;
|
import org.apache.cassandra.db.partitions.UnfilteredPartitionIterator;
|
||||||
import org.apache.cassandra.dht.AbstractBounds;
|
import org.apache.cassandra.dht.AbstractBounds;
|
||||||
import org.apache.cassandra.dht.Token;
|
import org.apache.cassandra.dht.Token;
|
||||||
|
|
@ -90,7 +91,7 @@ public class ReadCommandVerbHandler implements IVerbHandler<ReadCommand>
|
||||||
}
|
}
|
||||||
catch (RejectException e)
|
catch (RejectException e)
|
||||||
{
|
{
|
||||||
if (!command.isTrackingWarnings())
|
if (!command.isTrackingWarnings() || e instanceof TombstoneOverwhelmingException)
|
||||||
throw e;
|
throw e;
|
||||||
|
|
||||||
// make sure to log as the exception is swallowed
|
// make sure to log as the exception is swallowed
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ import org.apache.cassandra.db.filter.ClusteringIndexSliceFilter;
|
||||||
import org.apache.cassandra.db.filter.ColumnFilter;
|
import org.apache.cassandra.db.filter.ColumnFilter;
|
||||||
import org.apache.cassandra.db.filter.DataLimits;
|
import org.apache.cassandra.db.filter.DataLimits;
|
||||||
import org.apache.cassandra.db.filter.RowFilter;
|
import org.apache.cassandra.db.filter.RowFilter;
|
||||||
|
import org.apache.cassandra.db.filter.LocalReadSizeTooLargeException;
|
||||||
|
import org.apache.cassandra.db.filter.TombstoneOverwhelmingException;
|
||||||
import org.apache.cassandra.db.partitions.UnfilteredPartitionIterator;
|
import org.apache.cassandra.db.partitions.UnfilteredPartitionIterator;
|
||||||
import org.apache.cassandra.exceptions.InvalidRequestException;
|
import org.apache.cassandra.exceptions.InvalidRequestException;
|
||||||
import org.apache.cassandra.locator.InetAddressAndPort;
|
import org.apache.cassandra.locator.InetAddressAndPort;
|
||||||
|
|
@ -146,6 +148,39 @@ public class ReadCommandVerbHandlerTest
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = TombstoneOverwhelmingException.class)
|
||||||
|
public void tombstoneExceptionPropagatesWithoutWarningTracking()
|
||||||
|
{
|
||||||
|
ReadCommand command = new TombstoneThrowingReadCommand(metadata);
|
||||||
|
handler.doVerb(Message.builder(READ_REQ, command)
|
||||||
|
.from(peer())
|
||||||
|
.withId(messageId())
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = TombstoneOverwhelmingException.class)
|
||||||
|
public void tombstoneExceptionPropagatesWithWarningTracking()
|
||||||
|
{
|
||||||
|
ReadCommand command = new TombstoneThrowingReadCommand(metadata);
|
||||||
|
handler.doVerb(Message.builder(READ_REQ, command)
|
||||||
|
.from(peer())
|
||||||
|
.withFlag(MessageFlag.TRACK_WARNINGS)
|
||||||
|
.withId(messageId())
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void rejectExceptionSwallowedWithWarningTracking()
|
||||||
|
{
|
||||||
|
ReadCommand command = new RejectThrowingReadCommand(metadata);
|
||||||
|
handler.doVerb(Message.builder(READ_REQ, command)
|
||||||
|
.from(peer())
|
||||||
|
.withFlag(MessageFlag.TRACK_WARNINGS)
|
||||||
|
.withId(messageId())
|
||||||
|
.build());
|
||||||
|
// If we reach here without an exception, the RejectException was correctly swallowed
|
||||||
|
}
|
||||||
|
|
||||||
private static int messageId()
|
private static int messageId()
|
||||||
{
|
{
|
||||||
return random.nextInt();
|
return random.nextInt();
|
||||||
|
|
@ -199,6 +234,62 @@ public class ReadCommandVerbHandlerTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class TombstoneThrowingReadCommand extends SinglePartitionReadCommand
|
||||||
|
{
|
||||||
|
TombstoneThrowingReadCommand(TableMetadata metadata)
|
||||||
|
{
|
||||||
|
super(metadata.epoch,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
PotentialTxnConflicts.DISALLOW,
|
||||||
|
metadata,
|
||||||
|
FBUtilities.nowInSeconds(),
|
||||||
|
ColumnFilter.all(metadata),
|
||||||
|
RowFilter.none(),
|
||||||
|
DataLimits.NONE,
|
||||||
|
KEY,
|
||||||
|
new ClusteringIndexSliceFilter(Slices.ALL, false),
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UnfilteredPartitionIterator executeLocally(ReadExecutionController executionController)
|
||||||
|
{
|
||||||
|
throw new TombstoneOverwhelmingException(1000, "test_query", metadata(), KEY, Clustering.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class RejectThrowingReadCommand extends SinglePartitionReadCommand
|
||||||
|
{
|
||||||
|
RejectThrowingReadCommand(TableMetadata metadata)
|
||||||
|
{
|
||||||
|
super(metadata.epoch,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
PotentialTxnConflicts.DISALLOW,
|
||||||
|
metadata,
|
||||||
|
FBUtilities.nowInSeconds(),
|
||||||
|
ColumnFilter.all(metadata),
|
||||||
|
RowFilter.none(),
|
||||||
|
DataLimits.NONE,
|
||||||
|
KEY,
|
||||||
|
new ClusteringIndexSliceFilter(Slices.ALL, false),
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UnfilteredPartitionIterator executeLocally(ReadExecutionController executionController)
|
||||||
|
{
|
||||||
|
throw new LocalReadSizeTooLargeException("test read size too large");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static DecoratedKey key(TableMetadata metadata, int key)
|
private static DecoratedKey key(TableMetadata metadata, int key)
|
||||||
{
|
{
|
||||||
return metadata.partitioner.decorateKey(ByteBufferUtil.bytes(key));
|
return metadata.partitioner.decorateKey(ByteBufferUtil.bytes(key));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue