[systemd-devel] bug #64614 and journal seeking woes

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Tue Sep 17 13:28:33 PDT 2013


Hi,
I was looking at https://bugs.freedesktop.org/show_bug.cgi?id=64614

tl;dr: doing
   sd_journal_seek_tail()
   sd_journal_next()
   sd_journal_next()
   sd_journal_next()
   sd_journal_next()
returns 1 (success) each time, and random entries.

Likewise, doing
   sd_journal_seek_head()
   sd_journal_previous()...
returns 1 (success) and random entries.

Those specific cases could be changed to behave differently, but I
think that there's a more general problem.

According to sd_journal_seek_tail(3), this function positions the journal
"on the last entry". sd_j_seek_head positions the journal on the oldest
entry. It is important that journal is *on* the first/last entry, which
suggests that it is in a valid location. Nevertheless,
   sd_journal_get_cursor()
returns -EADDRNOTAVAIL, as if the journal was *before* or *after* the last
entry.

Also, doing sd_j_seek_tail() + sd_j_previous() moves to the *last* entry,
which seems inconsistent with the description in the man pages (if we
were *at* the last entry, and we move back, we should be at the next to
last entry).

Also, doing sd_j_seek_tail(), waiting a bit while the journal file grows,
and doing sd_j_previous() lands as at the *current* last entry, which
is a bit strange.

I'd like to change:
1. sd_j_seek_tail() to seek to a concrete entry, the last at a specific time,
2. sd_j_seek_head() likewise,
3. allow sd_j_get_cursor() after such a seek
4. make sd_j_seek_tail() + sd_j_next() return 0 (if the file hasn't grown),
   or the first new entry if it has grown meanwhile
5. likewise make sd_j_seek_head() + sd_j_previous() return 0

Thoughts, comments, shrugs?

Zbyszek
_______________________________________________
systemd-devel mailing list
systemd-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel



More information about the systemd-devel mailing list