Skip to content

Prune files of log entries

Sami Hiltunen requested to merge smh-prune-logged-files into master

The state of a log entry is currently split in two places:

  1. Protobuf message stored in the database.
  2. Files associated with the log entry on the disk.

The protobuf message was initially the only entry but we've since added support for logging files along it. This avoids copying the files to log them as we can instead hard link move them to the log without copying.

The clean up logic wasn't so far extended to cover removing the files of a log entry. Only the protobuf message from the database is removed when pruning a log entry after it is applied.

This MR extend the clean up logic to also prune the files of the log entries. They're not needed anymore when the log entry itself is removed.

The change itself is small but the changes to the tests are larger. As we didn't handle cleaning up the files, the tests had to assert the state of the log. As we expect the log entries to be now fully cleaned up, the tests have been updated to assert an empty log at the end of the run. Asserting the log entries in each test is not very useful. The tests should focus on behavior so they don't break when some of the internals change.

Closes #5111 (closed)

Merge request reports