Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions docs/TheBook/src/main/markdown/config-scitags.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ Main JSON sections:
- `usage` (`received`, `sent`)
- optional `storage-stats` when `pool.firefly.storage-statistics=true`

For end markers, `start-time` is reconstructed from mover submit time and `end-time`
is derived as `start-time + max(connectionTime, 0)`.
For end markers sent by a pool, `end-time` is the time the transfer finished and
`start-time` is derived as `end-time - max(connectionTime, 0)`.

Test schema file:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,12 @@ public void onStart(InetSocketAddress src, InetSocketAddress dst, ProtocolInfo p
* @param mover the mover's description of the completed transfer
*/
public void onEnd(InetSocketAddress src, InetSocketAddress dst, MoverInfoMessage mover) {
// The mover info message is created when the transfer has finished, so its
// timestamp is the end of the transfer; the start is derived from the duration.
long durationMillis = Math.max(0L, mover.getConnectionTime());
onEnd(src, dst, mover.getProtocolInfo(), mover.getSubject(),
Instant.ofEpochMilli(mover.getTimestamp()), mover.getConnectionTime(),
Instant.ofEpochMilli(mover.getTimestamp()).minusMillis(durationMillis),
durationMillis,
mover.getBytesRead(), mover.getBytesWritten(),
storageStatisticsEnabled ? mover : null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void shouldSendEndMarkerForTransferWithoutMover() throws Exception {
}

@Test
public void shouldSetEndMarkerStartTimeFromTransferDuration() throws Exception {
public void shouldDeriveEndMarkerTimesFromTransferEnd() throws Exception {
try (DatagramSocket socket = new DatagramSocket(0, InetAddress.getByName("127.0.0.1"))) {
socket.setSoTimeout(700);

Expand All @@ -156,8 +156,9 @@ public void shouldSetEndMarkerStartTimeFromTransferDuration() throws Exception {
mover.setBytesRead(1024);
mover.setBytesWritten(0);

Instant expectedStart = Instant.ofEpochMilli(mover.getTimestamp());
Instant expectedEnd = expectedStart.plusMillis(transferDuration);
// the mover info message is created when the transfer has finished
Instant expectedEnd = Instant.ofEpochMilli(mover.getTimestamp());
Instant expectedStart = expectedEnd.minusMillis(transferDuration);

lifecycle.onEnd(
new InetSocketAddress("203.0.113.20", 42000),
Expand All @@ -174,10 +175,13 @@ public void shouldSetEndMarkerStartTimeFromTransferDuration() throws Exception {

Instant startTime = Instant.parse(lifecyclePayload.getString("start-time"));
Instant endTime = Instant.parse(lifecyclePayload.getString("end-time"));
Instant currentTime = Instant.parse(lifecyclePayload.getString("current-time"));

assertEquals(expectedStart, startTime);
assertEquals(expectedEnd, endTime);
assertEquals(transferDuration, Duration.between(startTime, endTime).toMillis());
assertFalse("end-time must not lie after the time the marker was built",
endTime.isAfter(currentTime));
}
}

Expand Down
Loading