use of org.apache.cassandra.streaming.StreamState in project scylla-jmx by scylladb.
the class StreamStateCompositeData method fromCompositeData.
public static StreamState fromCompositeData(CompositeData cd) {
assert cd.getCompositeType().equals(COMPOSITE_TYPE);
Object[] values = cd.getAll(ITEM_NAMES);
UUID planId = UUID.fromString((String) values[0]);
String description = (String) values[1];
Set<SessionInfo> sessions = Sets.newHashSet(Iterables.transform(Arrays.asList((CompositeData[]) values[2]), input -> SessionInfoCompositeData.fromCompositeData(input)));
return new StreamState(planId, description, sessions);
}
use of org.apache.cassandra.streaming.StreamState in project cassandra by apache.
the class NetStats method execute.
@Override
public void execute(NodeProbe probe) {
PrintStream out = probe.output().out;
out.printf("Mode: %s%n", probe.getOperationMode());
Set<StreamState> statuses = probe.getStreamStatus();
if (statuses.isEmpty())
out.println("Not sending any streams.");
for (StreamState status : statuses) {
out.printf("%s %s%n", status.streamOperation.getDescription(), status.planId.toString());
for (SessionInfo info : status.sessions) {
out.printf(" %s", InetAddressAndPort.toString(info.peer, printPort));
// print private IP when it is used
if (!info.peer.equals(info.connecting)) {
out.printf(" (using %s)", InetAddressAndPort.toString(info.connecting, printPort));
}
out.printf("%n");
if (!info.receivingSummaries.isEmpty()) {
printReceivingSummaries(out, info, humanReadable);
}
if (!info.sendingSummaries.isEmpty()) {
printSendingSummaries(out, info, humanReadable);
}
}
}
if (!probe.isStarting()) {
out.printf("Read Repair Statistics:%nAttempted: %d%nMismatch (Blocking): %d%nMismatch (Background): %d%n", probe.getReadRepairAttempted(), probe.getReadRepairRepairedBlocking(), probe.getReadRepairRepairedBackground());
MessagingServiceMBean ms = probe.getMessagingServiceProxy();
out.printf("%-25s", "Pool Name");
out.printf("%10s", "Active");
out.printf("%10s", "Pending");
out.printf("%15s", "Completed");
out.printf("%10s%n", "Dropped");
int pending;
long completed;
long dropped;
pending = 0;
for (int n : ms.getLargeMessagePendingTasksWithPort().values()) pending += n;
completed = 0;
for (long n : ms.getLargeMessageCompletedTasksWithPort().values()) completed += n;
dropped = 0;
for (long n : ms.getLargeMessageDroppedTasksWithPort().values()) dropped += n;
out.printf("%-25s%10s%10s%15s%10s%n", "Large messages", "n/a", pending, completed, dropped);
pending = 0;
for (int n : ms.getSmallMessagePendingTasksWithPort().values()) pending += n;
completed = 0;
for (long n : ms.getSmallMessageCompletedTasksWithPort().values()) completed += n;
dropped = 0;
for (long n : ms.getSmallMessageDroppedTasksWithPort().values()) dropped += n;
out.printf("%-25s%10s%10s%15s%10s%n", "Small messages", "n/a", pending, completed, dropped);
pending = 0;
for (int n : ms.getGossipMessagePendingTasksWithPort().values()) pending += n;
completed = 0;
for (long n : ms.getGossipMessageCompletedTasksWithPort().values()) completed += n;
dropped = 0;
for (long n : ms.getGossipMessageDroppedTasksWithPort().values()) dropped += n;
out.printf("%-25s%10s%10s%15s%10s%n", "Gossip messages", "n/a", pending, completed, dropped);
}
}
use of org.apache.cassandra.streaming.StreamState in project cassandra by apache.
the class CqlBulkRecordWriter method close.
private void close() throws IOException {
if (writer != null) {
writer.close();
Future<StreamState> future = loader.stream(ignores);
while (true) {
try {
future.get(1000, TimeUnit.MILLISECONDS);
break;
} catch (ExecutionException | TimeoutException te) {
if (null != progress)
progress.progress();
if (null != context)
HadoopCompat.progress(context);
} catch (InterruptedException e) {
throw new IOException(e);
}
}
if (loader.getFailedHosts().size() > 0) {
if (loader.getFailedHosts().size() > maxFailures)
throw new IOException("Too many hosts failed: " + loader.getFailedHosts());
else
logger.warn("Some hosts failed: {}", loader.getFailedHosts());
}
}
}
use of org.apache.cassandra.streaming.StreamState in project cassandra by apache.
the class CqlBulkRecordWriter method prepareWriter.
private void prepareWriter() throws IOException {
if (writer == null) {
writer = CQLSSTableWriter.builder().forTable(schema).using(insertStatement).withPartitioner(ConfigHelper.getOutputPartitioner(conf)).inDirectory(outputDir).withBufferSizeInMiB(Integer.parseInt(conf.get(BUFFER_SIZE_IN_MB, "64"))).withPartitioner(partitioner).build();
}
if (loader == null) {
ExternalClient externalClient = new ExternalClient(conf);
externalClient.setTableMetadata(TableMetadataRef.forOfflineTools(CreateTableStatement.parse(schema, keyspace).build()));
loader = new SSTableLoader(outputDir, externalClient, new NullOutputHandler()) {
@Override
public void onSuccess(StreamState finalState) {
if (deleteSrc)
FileUtils.deleteRecursive(outputDir);
}
};
}
}
Aggregations