v1: Store an index by publish time #1542
Replies: 7 comments
|
I think the best solution would be to store (log time, publish time, offset) triples in the message index record and extend the chunk index record with publish start/end. Breaking change for the former + 8 bytes per record. If we need something in the interim, we could append publish_start and publish_end to the chunk index record as optional fields, and append a publish_time_index array to the end of message index that mirrors the existing record time index structure. This would cost 8 bytes per record more than the breaking solution due to timestamp duplication. |
|
Can the concept of time be dynamically changed based on a flag somewhere? Maybe in the footer there could be a flag that dictates if "time" means There are a few places where time means
If a flag can universally switch them to mean |
|
The alternative is to maybe introduce another record type with a new opcode: ChunkIndex2 and MessageIndex2 which has this information. The |
|
Cross-linking my write up on allowing less or more than 2 timestamps: #1196 And this thread about per-message metadata: #1369 If we ever do a binary-breaking change to mcap, improving handling of timestamps and metadata handling is up there for me.
The nice thing about this approach is that it degrades gracefully, old mcap client libraries can still read the mcap data, it will just appear unindexed to them. |
|
Yeah, having more than 2 timestamps is also a very important use case (more below). But really having the publish time as index is more of a show stopper. Having a It is actually possible to support per message timestamps and N timestamps without breaking the binary compatibility. The way to do this is to create a new payload type that itself can encapsulate protons/flat buffer/JSON/etc. Basically the message encoding for a channel would be something like Message:
In a way this is the same as if you changed the binary protocol (imagine if the above is flattened), except the versioning is controlledb y the channel message_encoding field, if that makes sense. |
|
If there is interest in this, I may have some time to create a proposal/PR. |
Uh oh!
There was an error while loading. Please reload this page.
The current index records are great when you want to read the messages by log_time. If you want to read the messages by publish_time, you have to create your own index by reading all the records and building it in memory. It would be nice to consider writer options for recording both index types in the file.
All reactions