use of org.apache.cassandra.index.sasi.exceptions.TimeQuotaExceededException in project cassandra by apache.
the class SASIIndexTest method testSearchTimeouts.
@Test
public void testSearchTimeouts() {
final ByteBuffer firstName = UTF8Type.instance.decompose("first_name");
Map<String, Pair<String, Integer>> data1 = new HashMap<String, Pair<String, Integer>>() {
{
put("key1", Pair.create("Pavel", 14));
put("key2", Pair.create("Pavel", 26));
put("key3", Pair.create("Pavel", 27));
put("key4", Pair.create("Jason", 27));
}
};
ColumnFamilyStore store = loadData(data1, true);
RowFilter filter = RowFilter.create();
filter.add(store.metadata().getColumn(firstName), Operator.LIKE_CONTAINS, AsciiType.instance.fromString("a"));
ReadCommand command = PartitionRangeReadCommand.create(store.metadata(), FBUtilities.nowInSeconds(), ColumnFilter.all(store.metadata()), filter, DataLimits.NONE, DataRange.allData(store.metadata().partitioner));
try {
new QueryPlan(store, command, 0).execute(ReadExecutionController.empty());
Assert.fail();
} catch (TimeQuotaExceededException e) {
// correct behavior
} catch (Exception e) {
Assert.fail();
e.printStackTrace();
}
try (ReadExecutionController controller = command.executionController()) {
Set<String> rows = getKeys(new QueryPlan(store, command, DatabaseDescriptor.getRangeRpcTimeout(MILLISECONDS)).execute(controller));
assertRows(rows, "key1", "key2", "key3", "key4");
}
}
Aggregations