Track file ending more carefully
The old method was failing on long compressed logs with unclean
shutdown. We were getting large differences in end times between parts
and CHECKing. Instead, track when we stop seeing data on a channel, and
when that happens, eat the rest of the log file, confirming that the data
on that channel doesn't come back. This makes it so we don't try to
determine if we got to the end or not, and instead just confirm that we
don't have gaps in the data. That is a more direct measurement of what
we actually care about.
Change-Id: I20debdf5623788f66f6c1f01dcb066c8a7ba7ef6
diff --git a/aos/events/logging/logger.h b/aos/events/logging/logger.h
index 4aa45a1..948b3a0 100644
--- a/aos/events/logging/logger.h
+++ b/aos/events/logging/logger.h
@@ -552,13 +552,9 @@
// Connects up the timestamp mappers.
void AddPeer(State *peer);
- // Returns the timestamps, channel_index, and message from a channel.
- // update_time (will be) set to true when popping this message causes the
- // filter to change the time offset estimation function.
- TimestampedMessage PopOldest(bool *update_time);
-
- // Returns the oldest message (if it exists) non destructively.
- const TimestampedMessage &PeekOldest();
+ // Returns the next sorted message with all the timestamps extracted and
+ // matched.
+ TimestampedMessage PopOldest();
// Returns the monotonic time of the oldest message.
monotonic_clock::time_point OldestMessageTime() const;
@@ -639,11 +635,6 @@
RemoteMessageSender *remote_timestamp_sender,
State *source_state);
- // Returns if we have read all the messages from all the logs.
- bool at_end() const {
- return timestamp_mapper_ ? timestamp_mapper_->Front() == nullptr : true;
- }
-
// Unregisters everything so we can destory the event loop.
void Deregister();
@@ -671,6 +662,8 @@
<< configuration::StrippedChannelToString(
event_loop_->configuration()->channels()->Get(
std::get<0>(message).channel_index))
+ << (std::get<0>(message).data.span().size() == 0 ? " null"
+ : " data")
<< "\n";
} else if (i == 7) {
messages << "...\n";