Track matching forwarded times for log file sorting
Previously, the only thing we knew was a loose ordering based on part
index. That isn't very conclusive. This now provides us with
corresponding timestamps for when things cross the network boundary in a
way that we think should tell us definitively what came first.
There are 2 main problem cases. Let's say we have 2 channels. /a which
is reliable, and /b which isn't, both sent from the same remote node.
case 1: /a -> boot 0 received on boot 0.
/b -> boot 1 received on boot 0.
We start logging after both messages arrive.
case 2: /a -> boot 0 received on boot 0.
/b -> boot 0 received on boot 0.
We log for a bit, then reboot. More messages show up when we reconnect.
/a -> boot 0 received on boot 1.
/b -> boot 0 received on boot 1.
In case 1: we only have a reliable timestamp from boot 0, but that
reliable timestamp makes it clear that /a was before /b, so boot 0 was
before boot 1.
In case 2: we have the same reliable timestamp, so that tells us nothing.
The unreliable timestamps though tell a different story. /b will be after
/a, since any messages on /b generated before the reboot won't get
delivered. So, we get an ordering constraint saying that any sent /b's
on the second boot were after /b on the first boot.
We believe that any other cases are covered by the same mechanism.
Without fully implementing and debugging the sorting code, we won't know
for certain. Sanjay and I have been unable to break the logic so far.
Change-Id: I990bf249b18bf43072997cdb099ac66c2fa8fc57
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/configuration.cc b/aos/configuration.cc
index 7fad440..24e15d9 100644
--- a/aos/configuration.cc
+++ b/aos/configuration.cc
@@ -1137,15 +1137,15 @@
bool ConnectionDeliveryTimeIsLoggedOnNode(const Channel *channel,
const Node *node,
const Node *logger_node) {
- const Connection *connection = ConnectionToNode(channel, node);
- if (connection == nullptr) {
- return false;
- }
- return ConnectionDeliveryTimeIsLoggedOnNode(connection, logger_node);
+ return ConnectionDeliveryTimeIsLoggedOnNode(ConnectionToNode(channel, node),
+ logger_node);
}
bool ConnectionDeliveryTimeIsLoggedOnNode(const Connection *connection,
const Node *node) {
+ if (connection == nullptr) {
+ return false;
+ }
switch (connection->timestamp_logger()) {
case LoggerConfig::LOCAL_AND_REMOTE_LOGGER:
CHECK(connection->has_timestamp_logger_nodes());