use of org.apache.cassandra.db.RangeSliceReply in project eiger by wlloyd.
the class RangeSliceResponseResolver method resolve.
// Note: this would deserialize the response a 2nd time if getData was called first.
// (this is not currently an issue since we don't do read repair for range queries.)
public Iterable<Row> resolve() throws IOException {
ArrayList<RowIterator> iters = new ArrayList<RowIterator>(responses.size());
int n = 0;
for (Message response : responses) {
RangeSliceReply reply = RangeSliceReply.read(response.getMessageBody(), response.getVersion());
n = Math.max(n, reply.rows.size());
iters.add(new RowIterator(reply.rows.iterator(), response.getFrom()));
}
// for each row, compute the combination of all different versions seen, and repair incomplete versions
// TODO do we need to call close?
CloseableIterator<Row> iter = MergeIterator.get(iters, pairComparator, new Reducer());
List<Row> resolvedRows = new ArrayList<Row>(n);
while (iter.hasNext()) resolvedRows.add(iter.next());
return resolvedRows;
}
use of org.apache.cassandra.db.RangeSliceReply in project eiger by wlloyd.
the class RangeSliceVerbHandler method doVerb.
public void doVerb(Message message, String id) {
try {
if (StorageService.instance.isBootstrapMode()) {
/* Don't service reads! */
throw new RuntimeException("Cannot service reads while bootstrapping!");
}
RangeSliceCommand command = RangeSliceCommand.read(message);
ColumnFamilyStore cfs = Table.open(command.keyspace).getColumnFamilyStore(command.column_family);
RangeSliceReply reply = new RangeSliceReply(executeLocally(command));
Message response = reply.getReply(message);
if (logger.isDebugEnabled())
logger.debug("Sending " + reply + " to " + id + "@" + message.getFrom());
MessagingService.instance().sendReply(response, id, message.getFrom());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
use of org.apache.cassandra.db.RangeSliceReply in project eiger by wlloyd.
the class RangeSliceResponseResolver method getData.
public List<Row> getData() throws IOException {
Message response = responses.iterator().next();
RangeSliceReply reply = RangeSliceReply.read(response.getMessageBody(), response.getVersion());
return reply.rows;
}
Aggregations