chiark / gitweb /
journal: make skipping of exhausted journal files effective again
authorMichal Schmidt <mschmidt@redhat.com>
Tue, 24 Feb 2015 18:45:17 +0000 (19:45 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Wed, 25 Feb 2015 16:32:27 +0000 (17:32 +0100)
commit950c07d421c04e5aae99973479f4f13131fb45e1
treefb12be70bf3136b42f7894a2b361fa78159a3781
parent3cabeab1197d3e45f16f514f5a396e0fb311e867
journal: make skipping of exhausted journal files effective again

Commit 668c965af "journal: skipping of exhausted journal files is bad if
direction changed" fixed a correctness issue, but it also significantly
limited the cases where the optimization that skips exhausted journal
files could apply.
As a result, some journalctl queries are much slower in v219 than in v218.
(e.g. queries where a "--since" cutoff should have quickly eliminated
older journal files from consideration, but didn't.)

If already in the initial iteration find_location_with_matches() finds
no entry, the journal file's location is not updated. This is fine,
except that:
 - We must update at least f->last_direction. The optimization relies on
   it. Let's separate that from journal_file_save_location() and update
   it immediately after the direction checks.
 - The optimization was conditional on "f->current_offset > 0", but it
   would always be 0 in this scenario. This check is unnecessary for the
   optimization.
src/journal/journal-file.c
src/journal/journal-file.h
src/journal/sd-journal.c