Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-11367. Improve ozone balancing status command output #7139

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -627,19 +627,20 @@ message ContainerBalancerStatusInfo {
message ContainerBalancerTaskIterationStatusInfo {
optional int32 iterationNumber = 1;
optional string iterationResult = 2;
optional int64 sizeScheduledForMoveGB = 3;
optional int64 dataSizeMovedGB = 4;
optional int64 sizeScheduledForMove = 3;
optional int64 dataSizeMoved = 4;
optional int64 containerMovesScheduled = 5;
optional int64 containerMovesCompleted = 6;
optional int64 containerMovesFailed = 7;
optional int64 containerMovesTimeout = 8;
repeated NodeTransferInfo sizeEnteringNodesGB = 9;
repeated NodeTransferInfo sizeLeavingNodesGB = 10;
repeated NodeTransferInfo sizeEnteringNodes = 9;
repeated NodeTransferInfo sizeLeavingNodes = 10;
optional int64 iterationDuration = 11;
}

message NodeTransferInfo {
optional string uuid = 1;
optional int64 dataVolumeGB = 2;
optional int64 dataVolume = 2;
}

message DecommissionScmRequestProto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public final class ContainerBalancerMetrics {
" in the latest iteration.")
private MutableCounterLong dataSizeMovedGBInLatestIteration;

@Metric(about = "Amount of bytes that Container Balancer moved in the latest iteration.")
private MutableCounterLong dataSizeMovedBytesInLatestIteration;

@Metric(about = "Number of completed container moves performed by " +
"Container Balancer in the latest iteration.")
private MutableCounterLong numContainerMovesCompletedInLatestIteration;
Expand Down Expand Up @@ -131,14 +134,16 @@ void incrementNumContainerMovesScheduledInLatestIteration(long valueToAdd) {
this.numContainerMovesScheduledInLatestIteration.incr(valueToAdd);
}

/**
* Reset number of containers scheduled to move in last iteration.
juncevich marked this conversation as resolved.
Show resolved Hide resolved
*/
public void resetNumContainerMovesScheduledInLatestIteration() {
numContainerMovesScheduledInLatestIteration.incr(
-getNumContainerMovesScheduledInLatestIteration());
}

/**
* Gets the amount of data moved by Container Balancer in the latest
* iteration.
* Gets the amount of data moved by Container Balancer in the latest iteration.
* @return size in GB
*/
public long getDataSizeMovedGBInLatestIteration() {
Expand All @@ -154,6 +159,29 @@ public void resetDataSizeMovedGBInLatestIteration() {
-getDataSizeMovedGBInLatestIteration());
}

/**
* Gets the amount of data moved by Container Balancer in the latest iteration.
* @return size in bytes
*/
public long getDataSizeMovedInLatestIteration() {
return dataSizeMovedBytesInLatestIteration.value();
}

/**
* Increment data size moved in the last iteration.
* @param bytes bytes to add
*/
public void incrementDataSizeMovedInLatestIteration(long bytes) {
this.dataSizeMovedBytesInLatestIteration.incr(bytes);
}

/**
* Reset data size moved in the last iteration.
*/
public void resetDataSizeMovedInLatestIteration() {
juncevich marked this conversation as resolved.
Show resolved Hide resolved
dataSizeMovedBytesInLatestIteration.incr(-getDataSizeMovedInLatestIteration());
}

/**
* Gets the number of container moves performed by Container Balancer in the
* latest iteration.
Expand All @@ -163,11 +191,6 @@ public long getNumContainerMovesCompletedInLatestIteration() {
return numContainerMovesCompletedInLatestIteration.value();
}

public void incrementNumContainerMovesCompletedInLatestIteration(
long valueToAdd) {
this.numContainerMovesCompletedInLatestIteration.incr(valueToAdd);
}

public void incrementCurrentIterationContainerMoveMetric(
MoveManager.MoveResult result, long valueToAdd) {
if (result == null) {
Expand Down Expand Up @@ -204,9 +227,11 @@ public void incrementCurrentIterationContainerMoveMetric(
}
}

/**
* Moved containers in the last iteration.
juncevich marked this conversation as resolved.
Show resolved Hide resolved
*/
public void resetNumContainerMovesCompletedInLatestIteration() {
numContainerMovesCompletedInLatestIteration.incr(
-getNumContainerMovesCompletedInLatestIteration());
numContainerMovesCompletedInLatestIteration.incr(-getNumContainerMovesCompletedInLatestIteration());
}

/**
Expand All @@ -218,14 +243,19 @@ public long getNumContainerMovesTimeoutInLatestIteration() {
return numContainerMovesTimeoutInLatestIteration.value();
}

/**
* Increment number timeouted container moves.
juncevich marked this conversation as resolved.
Show resolved Hide resolved
*/
public void incrementNumContainerMovesTimeoutInLatestIteration(
long valueToAdd) {
this.numContainerMovesTimeoutInLatestIteration.incr(valueToAdd);
}

/**
* Reset number timeouted container moves.
juncevich marked this conversation as resolved.
Show resolved Hide resolved
*/
public void resetNumContainerMovesTimeoutInLatestIteration() {
numContainerMovesTimeoutInLatestIteration.incr(
-getNumContainerMovesTimeoutInLatestIteration());
numContainerMovesTimeoutInLatestIteration.incr(-getNumContainerMovesTimeoutInLatestIteration());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
package org.apache.hadoop.hdds.scm.container.balancer;

import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos;

import java.time.OffsetDateTime;
import java.util.List;
import java.util.stream.Collectors;

/**
* Info about balancer status.
Expand Down Expand Up @@ -51,4 +53,21 @@ public HddsProtos.ContainerBalancerConfigurationProto getConfiguration() {
public List<ContainerBalancerTaskIterationStatusInfo> getIterationsStatusInfo() {
return iterationsStatusInfo;
}

/**
* Converts an instance into the protobuf compatible object.
* @return proto representation
*/
public StorageContainerLocationProtocolProtos.ContainerBalancerStatusInfo toProto() {
juncevich marked this conversation as resolved.
Show resolved Hide resolved
return StorageContainerLocationProtocolProtos.ContainerBalancerStatusInfo
.newBuilder()
.setStartedAt(getStartedAt().toEpochSecond())
.setConfiguration(getConfiguration())
.addAllIterationsStatusInfo(
getIterationsStatusInfo()
.stream()
.map(ContainerBalancerTaskIterationStatusInfo::toProto)
.collect(Collectors.toList())
).build();
}
}
Loading