Handle logd reconnect.
When statsd reconnects to logd, statsd will read all logs from buffer again. To prevent us from reprocessing old events, we do the following: 1. At any given moment, record the largest timestamp(T_max) and last timestamp (check point) that we've seen before. 2. When reconnection happens, we look for the check point until we see a new log with a timestamp larger than T_max. -> If we found the CP, resume after the CP. Success -> If we can't find CP, there is definitely log loss. We reset all configs. Note: 1. Logd has an API to read logs after a certain timestamp. But this api is vulnerable to time changes from Settings. So we cannot rely on it. 2. If logd inserts a new log (with older timestamp) before CP, we cannot detect it. It's not possible to detect it without record all timestamps we have seen. Test: statsd_test Bug: 77813113 Change-Id: Ic3fdb47230807606ab11dc994cb162194adb8448
Loading
Please register or sign in to comment