use of org.apache.cassandra.net.ParamType in project cassandra by apache.
the class ReadCallback method onResponse.
@Override
public void onResponse(Message<ReadResponse> message) {
assertWaitingFor(message.from());
Map<ParamType, Object> params = message.header.params();
InetAddressAndPort from = message.from();
if (WarningContext.isSupported(params.keySet())) {
RequestFailureReason reason = getWarningContext().updateCounters(params, from);
if (reason != null) {
onFailure(message.from(), reason);
return;
}
}
resolver.preprocess(message);
/*
* Ensure that data is present and the response accumulator has properly published the
* responses it has received. This may result in not signaling immediately when we receive
* the minimum number of required results, but it guarantees at least the minimum will
* be accessible when we do signal. (see CASSANDRA-16807)
*/
if (resolver.isDataPresent() && resolver.responses.size() >= blockFor)
condition.signalAll();
}
use of org.apache.cassandra.net.ParamType in project cassandra by apache.
the class WarningContext method updateCounters.
public RequestFailureReason updateCounters(Map<ParamType, Object> params, InetAddressAndPort from) {
for (Map.Entry<ParamType, Object> entry : params.entrySet()) {
WarnAbortCounter counter = null;
RequestFailureReason reason = null;
switch(entry.getKey()) {
case ROW_INDEX_SIZE_ABORT:
reason = RequestFailureReason.READ_SIZE;
case ROW_INDEX_SIZE_WARN:
counter = rowIndexTooLarge;
break;
case LOCAL_READ_SIZE_ABORT:
reason = RequestFailureReason.READ_SIZE;
case LOCAL_READ_SIZE_WARN:
counter = localReadSize;
break;
case TOMBSTONE_ABORT:
reason = RequestFailureReason.READ_TOO_MANY_TOMBSTONES;
case TOMBSTONE_WARNING:
counter = tombstones;
break;
}
if (reason != null) {
counter.addAbort(from, ((Number) entry.getValue()).longValue());
return reason;
}
if (counter != null)
counter.addWarning(from, ((Number) entry.getValue()).longValue());
}
return null;
}
use of org.apache.cassandra.net.ParamType in project cassandra by apache.
the class MessageOutBench method setup.
@Setup
public void setup() {
DatabaseDescriptor.daemonInitialization();
UUID uuid = UUIDGen.getTimeUUID();
Map<ParamType, Object> parameters = new EnumMap<>(ParamType.class);
if (withParams) {
parameters.put(ParamType.TRACE_SESSION, uuid);
}
addr = InetAddressAndPort.getByAddress(InetAddresses.forString("127.0.73.101"));
msgOut = Message.builder(ECHO_REQ, NoPayload.noPayload).from(addr).build();
// 1k should be enough for everybody!
buf = Unpooled.buffer(1024, 1024);
}
Aggregations