smiklosovic commented on code in PR #2058:
URL: https://github.com/apache/cassandra/pull/2058#discussion_r1061550162
##########
src/java/org/apache/cassandra/streaming/StreamSession.java:
##########
@@ -1027,9 +1022,30 @@ public void receive(IncomingStreamMessage message)
public void progress(String filename, ProgressInfo.Direction direction,
long bytes, long total)
{
ProgressInfo progress = new ProgressInfo(peer, index, filename,
direction, bytes, total);
+ updateMetricsOnProgress(progress);
streamResult.handleProgress(progress);
}
+ private void updateMetricsOnProgress(ProgressInfo progress)
+ {
+ ProgressInfo.Direction direction = progress.direction;
+ long lastSeenBytesStreamedForProgress =
lastSeenBytesStreamed.getOrDefault(progress, 0L);
Review Comment:
does this mean that `lastSeenBytesStreamed` map will be ever growing only as
I dont see any place where we are removing it from that map?
##########
src/java/org/apache/cassandra/streaming/StreamSession.java:
##########
@@ -1027,9 +1022,30 @@ public void receive(IncomingStreamMessage message)
public void progress(String filename, ProgressInfo.Direction direction,
long bytes, long total)
{
ProgressInfo progress = new ProgressInfo(peer, index, filename,
direction, bytes, total);
+ updateMetricsOnProgress(progress);
streamResult.handleProgress(progress);
}
+ private void updateMetricsOnProgress(ProgressInfo progress)
+ {
+ ProgressInfo.Direction direction = progress.direction;
+ long lastSeenBytesStreamedForProgress =
lastSeenBytesStreamed.getOrDefault(progress, 0L);
+ long newBytesStreamed = progress.currentBytes -
lastSeenBytesStreamedForProgress;
+ if (direction == ProgressInfo.Direction.OUT)
+ {
+ StreamingMetrics.totalOutgoingBytes.inc(newBytesStreamed);
+ metrics.outgoingBytes.inc(newBytesStreamed);
+ }
+
+ else if (direction == ProgressInfo.Direction.IN)
Review Comment:
ProgressInfo.Direction can be only IN or OUT. If it is not OUT, it is IN, so
we do not need `else if`, is not `else` good enough? Or direction can be null?
I would `assert` that direction is not null and then the `else` branch does not
need `else if`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]