Skip to content

Commit

Permalink
make STATE_CLEANUP log details of performed purges
Browse files Browse the repository at this point in the history
Mainly to monitor how long it takes.
  • Loading branch information
wojciech-adaptive committed Oct 10, 2024
1 parent f3fdba8 commit 7e9a02d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public static class Formatters
private final CharFormatter filteredRecordingFormatter = new CharFormatter(
"PruneOperation: filtered recordingId=%s,segmentStartPosition=%s,lowerBoundPrunePosition=%s" +
",segmentFileLength=%s,requestedNewStartPosition=%s,startPosition=%s");
private final CharFormatter purgedSegmentsFormatter = new CharFormatter(
"PruneOperation: purged recordingId=%s,oldStartPosition=%s,newStartPosition=%s,durationNs=%s");
}

private final Formatters formatters;
Expand Down Expand Up @@ -235,7 +237,19 @@ private void prune()
}
else
{
final long start = System.nanoTime();
aeronArchive.purgeSegments(recordingId, segmentStartPosition);
if (STATE_CLEANUP_ENABLED)
{
final long durationNs = System.nanoTime() - start;
formatters.purgedSegmentsFormatter
.clear()
.with(recordingId)
.with(stashedStartPosition)
.with(segmentStartPosition)
.with(durationNs);
DebugLogger.log(STATE_CLEANUP, formatters.purgedSegmentsFormatter);
}
recordingIdToNewStartPosition.put(recordingId, segmentStartPosition);
}
}
Expand Down

0 comments on commit 7e9a02d

Please sign in to comment.