mirror of https://github.com/apache/cassandra
Add test for RejectException swallow path when tracking warnings
Verifies that non-tombstone RejectExceptions (e.g., LocalReadSizeTooLargeException) are correctly swallowed and sent as empty success responses with MessageParams when TRACK_WARNINGS is enabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2150119324
commit
6bf2cd8ef6
|
|
@ -33,6 +33,7 @@ import org.apache.cassandra.db.filter.ClusteringIndexSliceFilter;
|
|||
import org.apache.cassandra.db.filter.ColumnFilter;
|
||||
import org.apache.cassandra.db.filter.DataLimits;
|
||||
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.exceptions.InvalidRequestException;
|
||||
|
|
@ -168,6 +169,18 @@ public class ReadCommandVerbHandlerTest
|
|||
.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()
|
||||
{
|
||||
return random.nextInt();
|
||||
|
|
@ -249,6 +262,34 @@ public class ReadCommandVerbHandlerTest
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return metadata.partitioner.decorateKey(ByteBufferUtil.bytes(key));
|
||||
|
|
|
|||
Loading…
Reference in New Issue