Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent using message compression mode with mcap storage #1782

Merged
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
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
Loading