Skip to content

fix: ensure schemas are cleared in McapWriter::terminate() #1356

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sofuture
Copy link
Contributor

Changelog

Clear schemas in McapWriter::terminate()

Docs

Fixes: FG-10773

Description

Some internal state was left on McapWriter::terminate() contrary to docs.

Copy link

linear bot commented Apr 10, 2025

Copy link
Contributor

@eloff eloff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first glance this appears to be the right fix.

But after a LOT of digging, I don't think it is.

I think schemas_ are meant to persist beyond just the mcap file currently being written. open can be called again on the same writer (e.g. logging to rotating mcap files) and it's fine to re-use the same list of schemas with the same id mappings. A feature, not a bug.

The schemas written in each file are tracked separately in writtenSchemas_, which is cleared in terminate, which makes sense.

But the reported problem is still an issue. And I think it stems from other parts of the writer referencing schemas_ when the should be using writtenSchemas_, thus causing schemas to show up in files they weren't present in, in the summary section.

This happens in close() when repeating the schemas

I think that should reference writtenSchemas_ instead.

@james-rms could you double-check my logic here? I can take over fixing this, but first I want to make sure I understand it correctly.

@jtbandes
Copy link
Member

Just want to interject: I don't think we have documented anywhere whether you are even supposed to be able to reuse the same writer for multiple files 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants