Search in sources :

Example 1 with ProgressInfo

use of org.apache.cassandra.streaming.ProgressInfo in project cassandra by apache.

the class NetStats method execute.

@Override
public void execute(NodeProbe probe) {
    System.out.printf("Mode: %s%n", probe.getOperationMode());
    Set<StreamState> statuses = probe.getStreamStatus();
    if (statuses.isEmpty())
        System.out.println("Not sending any streams.");
    for (StreamState status : statuses) {
        System.out.printf("%s %s%n", status.description, status.planId.toString());
        for (SessionInfo info : status.sessions) {
            System.out.printf("    %s", info.peer.toString());
            // print private IP when it is used
            if (!info.peer.equals(info.connecting)) {
                System.out.printf(" (using %s)", info.connecting.toString());
            }
            System.out.printf("%n");
            if (!info.receivingSummaries.isEmpty()) {
                if (humanReadable)
                    System.out.printf("        Receiving %d files, %s total. Already received %d files, %s total%n", info.getTotalFilesToReceive(), FileUtils.stringifyFileSize(info.getTotalSizeToReceive()), info.getTotalFilesReceived(), FileUtils.stringifyFileSize(info.getTotalSizeReceived()));
                else
                    System.out.printf("        Receiving %d files, %d bytes total. Already received %d files, %d bytes total%n", info.getTotalFilesToReceive(), info.getTotalSizeToReceive(), info.getTotalFilesReceived(), info.getTotalSizeReceived());
                for (ProgressInfo progress : info.getReceivingFiles()) {
                    System.out.printf("            %s%n", progress.toString());
                }
            }
            if (!info.sendingSummaries.isEmpty()) {
                if (humanReadable)
                    System.out.printf("        Sending %d files, %s total. Already sent %d files, %s total%n", info.getTotalFilesToSend(), FileUtils.stringifyFileSize(info.getTotalSizeToSend()), info.getTotalFilesSent(), FileUtils.stringifyFileSize(info.getTotalSizeSent()));
                else
                    System.out.printf("        Sending %d files, %d bytes total. Already sent %d files, %d bytes total%n", info.getTotalFilesToSend(), info.getTotalSizeToSend(), info.getTotalFilesSent(), info.getTotalSizeSent());
                for (ProgressInfo progress : info.getSendingFiles()) {
                    System.out.printf("            %s%n", progress.toString());
                }
            }
        }
    }
    if (!probe.isStarting()) {
        System.out.printf("Read Repair Statistics:%nAttempted: %d%nMismatch (Blocking): %d%nMismatch (Background): %d%n", probe.getReadRepairAttempted(), probe.getReadRepairRepairedBlocking(), probe.getReadRepairRepairedBackground());
        MessagingServiceMBean ms = probe.msProxy;
        System.out.printf("%-25s", "Pool Name");
        System.out.printf("%10s", "Active");
        System.out.printf("%10s", "Pending");
        System.out.printf("%15s", "Completed");
        System.out.printf("%10s%n", "Dropped");
        int pending;
        long completed;
        long dropped;
        pending = 0;
        for (int n : ms.getLargeMessagePendingTasks().values()) pending += n;
        completed = 0;
        for (long n : ms.getLargeMessageCompletedTasks().values()) completed += n;
        dropped = 0;
        for (long n : ms.getLargeMessageDroppedTasks().values()) dropped += n;
        System.out.printf("%-25s%10s%10s%15s%10s%n", "Large messages", "n/a", pending, completed, dropped);
        pending = 0;
        for (int n : ms.getSmallMessagePendingTasks().values()) pending += n;
        completed = 0;
        for (long n : ms.getSmallMessageCompletedTasks().values()) completed += n;
        dropped = 0;
        for (long n : ms.getSmallMessageDroppedTasks().values()) dropped += n;
        System.out.printf("%-25s%10s%10s%15s%10s%n", "Small messages", "n/a", pending, completed, dropped);
        pending = 0;
        for (int n : ms.getGossipMessagePendingTasks().values()) pending += n;
        completed = 0;
        for (long n : ms.getGossipMessageCompletedTasks().values()) completed += n;
        dropped = 0;
        for (long n : ms.getGossipMessageDroppedTasks().values()) dropped += n;
        System.out.printf("%-25s%10s%10s%15s%10s%n", "Gossip messages", "n/a", pending, completed, dropped);
    }
}
Also used : StreamState(org.apache.cassandra.streaming.StreamState) ProgressInfo(org.apache.cassandra.streaming.ProgressInfo) MessagingServiceMBean(org.apache.cassandra.net.MessagingServiceMBean) SessionInfo(org.apache.cassandra.streaming.SessionInfo)

Example 2 with ProgressInfo

use of org.apache.cassandra.streaming.ProgressInfo in project cassandra by apache.

the class SessionInfoCompositeData method fromCompositeData.

public static SessionInfo fromCompositeData(CompositeData cd) {
    assert cd.getCompositeType().equals(COMPOSITE_TYPE);
    Object[] values = cd.getAll(ITEM_NAMES);
    InetAddress peer, connecting;
    try {
        peer = InetAddress.getByName((String) values[1]);
        connecting = InetAddress.getByName((String) values[2]);
    } catch (UnknownHostException e) {
        throw Throwables.propagate(e);
    }
    Function<CompositeData, StreamSummary> toStreamSummary = new Function<CompositeData, StreamSummary>() {

        public StreamSummary apply(CompositeData input) {
            return StreamSummaryCompositeData.fromCompositeData(input);
        }
    };
    SessionInfo info = new SessionInfo(peer, (int) values[8], connecting, fromArrayOfCompositeData((CompositeData[]) values[3], toStreamSummary), fromArrayOfCompositeData((CompositeData[]) values[4], toStreamSummary), StreamSession.State.valueOf((String) values[5]));
    Function<CompositeData, ProgressInfo> toProgressInfo = new Function<CompositeData, ProgressInfo>() {

        public ProgressInfo apply(CompositeData input) {
            return ProgressInfoCompositeData.fromCompositeData(input);
        }
    };
    for (ProgressInfo progress : fromArrayOfCompositeData((CompositeData[]) values[6], toProgressInfo)) {
        info.updateProgress(progress);
    }
    for (ProgressInfo progress : fromArrayOfCompositeData((CompositeData[]) values[7], toProgressInfo)) {
        info.updateProgress(progress);
    }
    return info;
}
Also used : Function(com.google.common.base.Function) UnknownHostException(java.net.UnknownHostException) ProgressInfo(org.apache.cassandra.streaming.ProgressInfo) SessionInfo(org.apache.cassandra.streaming.SessionInfo) InetAddress(java.net.InetAddress) StreamSummary(org.apache.cassandra.streaming.StreamSummary)

Example 3 with ProgressInfo

use of org.apache.cassandra.streaming.ProgressInfo in project cassandra by apache.

the class LocalSyncTask method handleStreamEvent.

public void handleStreamEvent(StreamEvent event) {
    if (state == null)
        return;
    switch(event.eventType) {
        case STREAM_PREPARED:
            StreamEvent.SessionPreparedEvent spe = (StreamEvent.SessionPreparedEvent) event;
            state.trace("Streaming session with {} prepared", spe.session.peer);
            break;
        case STREAM_COMPLETE:
            StreamEvent.SessionCompleteEvent sce = (StreamEvent.SessionCompleteEvent) event;
            state.trace("Streaming session with {} {}", sce.peer, sce.success ? "completed successfully" : "failed");
            break;
        case FILE_PROGRESS:
            ProgressInfo pi = ((StreamEvent.ProgressEvent) event).progress;
            state.trace("{}/{} ({}%) {} idx:{}{}", new Object[] { FBUtilities.prettyPrintMemory(pi.currentBytes), FBUtilities.prettyPrintMemory(pi.totalBytes), pi.currentBytes * 100 / pi.totalBytes, pi.direction == ProgressInfo.Direction.OUT ? "sent to" : "received from", pi.sessionIndex, pi.peer });
    }
}
Also used : StreamEvent(org.apache.cassandra.streaming.StreamEvent) ProgressInfo(org.apache.cassandra.streaming.ProgressInfo)

Aggregations

ProgressInfo (org.apache.cassandra.streaming.ProgressInfo)3 SessionInfo (org.apache.cassandra.streaming.SessionInfo)2 Function (com.google.common.base.Function)1 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 MessagingServiceMBean (org.apache.cassandra.net.MessagingServiceMBean)1 StreamEvent (org.apache.cassandra.streaming.StreamEvent)1 StreamState (org.apache.cassandra.streaming.StreamState)1 StreamSummary (org.apache.cassandra.streaming.StreamSummary)1