Closed
Conversation
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>
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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&Schemarecords 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 asMaxTime, 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&Schemarecords 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