Handle finishing a log file more gracefully
Once one file ended, we were spinning until the end and popping
continually. This was resulting in us removing all the intermediate
data, and then adding it back in with the reverse timestamps.
There are 2 parts to the fix. 1 is detection and the other is fixing
the issue.
1) Instead of tracking a frozen bool, track the frozen time. This more
accurately captures what is going on, and handles things being popped
off the front. Also, make sure Validate won't certify an answer
which needs data we popped.
2) When we are spinning to the end of the log, don't forget the
timestamps yet. We need those for solving the problem still.
The current strategy likely keeps too much data at the end, but that
sure beats keeping too little.
Future improvements should consider managing all of this inside
multinode timestamp filter so we aren't dependent on the logger getting
it right.
Change-Id: I323eff3e19c3b67258835b50a339939360de0444
diff --git a/aos/events/logging/logger.cc b/aos/events/logging/logger.cc
index e10d911..272250e 100644
--- a/aos/events/logging/logger.cc
+++ b/aos/events/logging/logger.cc
@@ -2027,6 +2027,8 @@
CHECK_NOTNULL(timer_);
timer_->Setup(remote_timestamps_.front().monotonic_timestamp_time);
scheduled_time_ = remote_timestamps_.front().monotonic_timestamp_time;
+ CHECK_GE(scheduled_time_, event_loop_->monotonic_now())
+ << event_loop_->node()->name()->string_view();
}
}
@@ -2056,7 +2058,8 @@
}
void LogReader::RemoteMessageSender::SendTimestamp() {
- CHECK_EQ(event_loop_->context().monotonic_event_time, scheduled_time_);
+ CHECK_EQ(event_loop_->context().monotonic_event_time, scheduled_time_)
+ << event_loop_->node()->name()->string_view();
CHECK(!remote_timestamps_.empty());
// Send out all timestamps at the currently scheduled time.
@@ -2111,7 +2114,7 @@
// TODO(austin): We probably want to push this down into the timestamp
// mapper directly.
- filter->Pop(event_loop_->node(), result.monotonic_event_time);
+ filter->Pop(event_loop_->node(), event_loop_->monotonic_now());
}
VLOG(1) << "Popped " << result
<< configuration::CleanedChannelToString(