Skip to content

Update mcap vendor to version 1.4.2#2323

Closed
mosfet80 wants to merge 1 commit intoros2:rollingfrom
mosfet80:patch-16
Closed

Update mcap vendor to version 1.4.2#2323
mosfet80 wants to merge 1 commit intoros2:rollingfrom
mosfet80:patch-16

Conversation

@mosfet80
Copy link
Contributor

@mosfet80 mosfet80 commented Feb 3, 2026

Description

Changelog:
PR 1291 added an optimization, which caused the behavior reported in issue 1355. The intention of that change was to close a non-empty chunk before writing a message that would overflow the chunk size. It checks whether the chunk is non-empty after writing Channel & Schema records to the chunk. Therefore, it's possible to write a chunk that contains no messages.

The writer has a small bug in the metadata that it writes into the chunk index record. The currentChunkStart_ register is initialized as MaxTime, and only updated when a message is added to the chunk. But when writing a message-less chunk, we need to write the message start time as 0.

The indexed message reader has a small bug in the way it detects the presence of a message index. It only looks for a message index on the first chunk index record, instead of scanning all chunk index records. This is why the test case provided in 1355 fails: the first chunk contains only Channel & Schema records without messages, and therefore the first chunk index has no message index.

Remove dead members in McapReader
cpp: Fix for undefined behavior in mcap::ParseByteArray(..)

Is this user-facing behavior change?

Did you use Generative AI?

Additional Information

PR 1291 added an optimization, which caused the behavior reported in
issue 1355. The intention of that change was to close a non-empty chunk
before writing a message that would overflow the chunk size. It checks
whether the chunk is non-empty _after_ writing `Channel` & `Schema`
records to the chunk. Therefore, it's possible to write a chunk that
contains no messages.

The writer has a small bug in the metadata that it writes into the chunk
index record. The `currentChunkStart_` register is initialized as
`MaxTime`, and only updated when a message is added to the chunk. But
when writing a message-less chunk, we need to write the message start
time as 0.

The indexed message reader has a small bug in the way it detects the
presence of a message index. It only looks for a message index on the
first chunk index record, instead of scanning all chunk index records.
This is why the test case provided in 1355 fails: the first chunk
contains only `Channel` & `Schema` records without messages, and
therefore the first chunk index has no message index.

Remove dead members in McapReader
cpp: Fix for undefined behavior in mcap::ParseByteArray(..)


Signed-off-by: mosfet80 <10235105+mosfet80@users.noreply.github.com>
@MichaelOrlov
Copy link
Contributor

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants