diff --git a/rosbag2_compression/include/rosbag2_compression/sequential_compression_writer.hpp b/rosbag2_compression/include/rosbag2_compression/sequential_compression_writer.hpp index 47d6d69c2b..223add4472 100644 --- a/rosbag2_compression/include/rosbag2_compression/sequential_compression_writer.hpp +++ b/rosbag2_compression/include/rosbag2_compression/sequential_compression_writer.hpp @@ -123,6 +123,10 @@ class ROSBAG2_COMPRESSION_PUBLIC SequentialCompressionWriter /** * Compress a file and update the metadata file path. * + * Note: this may log an error without raising an exception in the case that the input file + * could not be deleted after compressing. This is an error and should never happen, but given + * that the desired output is created, execution will not be halted. + * * \param compressor An initialized compression context. * \param file_relative_to_bag Relative path of the file to compress, as stored in metadata - * meaning the path is relative to the bag base folder. diff --git a/rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp b/rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp index c71c86fe8e..7f544150b9 100644 --- a/rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp +++ b/rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp @@ -255,7 +255,9 @@ void SequentialCompressionWriter::compress_file( if (!rcpputils::fs::remove(file_relative_to_pwd)) { ROSBAG2_COMPRESSION_LOG_ERROR_STREAM( - "Failed to remove uncompressed bag: \"" << file_relative_to_pwd.string() << "\""); + "Failed to remove original pre-compressed bag file: \"" << + file_relative_to_pwd.string() << "\". This should never happen - but execution " << + "will not be halted because the compressed output was successfully created."); } } else { ROSBAG2_COMPRESSION_LOG_DEBUG_STREAM( @@ -270,7 +272,7 @@ void SequentialCompressionWriter::split_bagfile() std::lock_guard compressor_lock(compressor_queue_mutex_); // Grab last file before calling common splitting logic, which pushes the new filename - std::string last_file = metadata_.relative_file_paths.back(); + const auto last_file = metadata_.relative_file_paths.back(); SequentialWriter::split_bagfile();