Skip to content

Commit

Permalink
CLI: scan in log time order when using index (#1160)
Browse files Browse the repository at this point in the history
This changes the cat command to do a log-time order scan when it is able
to use the index (e.g seekable reader).

This was the intent of the existing code (there is no other reason for
it to try to use the index), but it was not supplying both necessary
parameters.
  • Loading branch information
Wyatt Alt authored Apr 24, 2024
1 parent a435019 commit 431d1dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/cli/mcap/cmd/cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,12 @@ func (w *jsonOutputWriter) writeMessage(

func getReadOpts(useIndex bool) []mcap.ReadOpt {
topics := strings.FieldsFunc(catTopics, func(c rune) bool { return c == ',' })
opts := []mcap.ReadOpt{mcap.UsingIndex(useIndex), mcap.WithTopics(topics)}

opts := []mcap.ReadOpt{mcap.WithTopics(topics)}

if useIndex {
opts = append(opts, mcap.UsingIndex(true), mcap.InOrder(mcap.LogTimeOrder))
}
catStart := catStartNano
if catStartSec > 0 {
catStart = catStartSec * 1e9
Expand Down

0 comments on commit 431d1dc

Please sign in to comment.