Enforce max out of order duration contract when writing logs.
Actively enforce this metric on the writer side by tracking the newest
message received and fetcher data for the current message being logged.
If max out of order duration is violated, rotate the part file and
double the max out of order duration value for the next part file.
Eventually we'll reach a satisfactory value and continue logging.
On the log reader side, choose the highest max out of order duration
value among all part files with the same part uuid. This ensures we have
sufficient messages in queue while reading to guarantee that max out of
order duration contract is satisfied.
Change-Id: I1666ed54acfcbc59cb9aedbe2f0dee979ceca095
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/logfile_utils.h b/aos/events/logging/logfile_utils.h
index 18902d3..c8d2e70 100644
--- a/aos/events/logging/logfile_utils.h
+++ b/aos/events/logging/logfile_utils.h
@@ -288,8 +288,8 @@
return raw_log_file_header_;
}
- // Returns the minimum maount of data needed to queue up for sorting before
- // ware guarenteed to not see data out of order.
+ // Returns the minimum amount of data needed to queue up for sorting before
+ // we're guarenteed to not see data out of order.
std::chrono::nanoseconds max_out_of_order_duration() const {
return max_out_of_order_duration_;
}
@@ -376,7 +376,7 @@
// Returns the minimum amount of data needed to queue up for sorting before
// we are guarenteed to not see data out of order.
std::chrono::nanoseconds max_out_of_order_duration() const {
- return message_reader_.max_out_of_order_duration();
+ return max_out_of_order_duration_;
}
// Returns the newest timestamp read out of the log file.
@@ -432,6 +432,8 @@
// Per node boot counts.
std::vector<std::optional<size_t>> boot_counts_;
+
+ const std::chrono::nanoseconds max_out_of_order_duration_;
};
// Stores MessageHeader as a flat header and inline, aligned block of data.