IndexClause clause = new IndexClause(Arrays.asList(expression),
ByteBufferUtil.bytes(startOffset),
session.getKeysPerCall());
List<KeySlice> results = null;
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;
for (int t = 0; t < session.getRetryTimes(); t++)
{
if (success)
break;
try
{
results = client.get_indexed_slices(parent, clause, predicate, session.getConsistencyLevel());
success = (results.size() != 0);
}
catch (Exception e)
{
exceptionMessage = getExceptionMessage(e);
success = false;
}
}
if (!success)
{
error(String.format("Operation [%d] retried %d times - error on calling get_indexed_slices for offset %s %s%n",
index,
session.getRetryTimes(),
startOffset,
(exceptionMessage == null) ? "" : "(" + exceptionMessage + ")"));
}
received += results.size();
// convert max key found back to an integer, and increment it
startOffset = String.format(format, (1 + getMaxKey(results)));
session.operations.getAndIncrement();
session.keys.getAndAdd(results.size());
context.stop();
}
}