Skip to content

Commit

Permalink
Prevent using message compression mode with mcap storage (#1782)
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Shtylman <[email protected]>
  • Loading branch information
defunctzombie authored Aug 10, 2024
1 parent 684e7c2 commit 9f766bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ros2bag/ros2bag/verb/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ def main(self, *, args): # noqa: D102
return print_error('Invalid choice: Cannot specify compression format '
'without a compression mode.')

if args.compression_mode == 'message' and args.storage == 'mcap':
return print_error("Invalid choice: compression_mode 'message' is not supported "
'by the MCAP storage plugin. You can enable chunk compression by '
"setting `compression: 'Zstd'` in storage config")

if args.compression_queue_size < 0:
return print_error('Compression queue size must be at least 0.')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ void SequentialCompressionWriter::open(
if (storage_) {
return; // The writer already opened.
}
// Note: a better solution was implemented in rosbag2-storage version 0.18+
// See MCAPStorage::update_metadata() for details.
if (compression_options_.compression_mode == CompressionMode::MESSAGE &&
storage_options.storage_id == "mcap")
{
throw std::runtime_error(
"MCAP storage plugin does not support message compression, "
"consider using chunk compression by setting `compression: 'Zstd'` in storage config");
}
SequentialWriter::open(storage_options, converter_options);
setup_compression();
}
Expand Down

0 comments on commit 9f766bf

Please sign in to comment.