From 982ad208b5e4d83f966ee4c10ad4f606417bcda6 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Wed, 10 May 2017 15:50:39 -0700 Subject: [PATCH] logd: remove start filtration from flushTo We have already searched for the start point, the start filter check is paranoia that removes out-of-order entries that we are undoubtably interested in. Out-of-order entries occur under reader pressure, as the writer gets pushed back from in-place sorted order and lands it at the end for the reader to pick it up. If this occurred during a batch run or a logger thread wakeup, the entry could be filtered out and never output to the reader. Found one case where logcat.tail_time* tests failed which was fixed with this adjustment. Test: gTest logd-unit-tests, liblog-unit-tests and logcat-unit-tests Bug: 38046067 Bug: 37791296 Change-Id: Icbde6b33dca7ab98348c3a872793aeef3997d460 --- logd/LogBuffer.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp index ded6c8cc7..fbed83b76 100644 --- a/logd/LogBuffer.cpp +++ b/logd/LogBuffer.cpp @@ -1142,10 +1142,6 @@ log_time LogBuffer::flushTo(SocketClient* reader, const log_time& start, continue; } - if (element->getRealTime() <= start) { - continue; - } - // NB: calling out to another object with wrlock() held (safe) if (filter) { int ret = (*filter)(element, arg); @@ -1172,11 +1168,10 @@ log_time LogBuffer::flushTo(SocketClient* reader, const log_time& start, unlock(); // range locking in LastLogTimes looks after us - max = element->flushTo(reader, this, privileged, sameTid); + log_time next = element->flushTo(reader, this, privileged, sameTid); - if (max == element->FLUSH_ERROR) { - return max; - } + if (next == element->FLUSH_ERROR) return next; + if (next > max) max = next; skip = maxSkip; rdlock();