Repository navigation
journald: when we fail to add a new entry to a journal, return the seqno - #18670
Conversation
|
@syyhao1994 any chance you can test if this fixes the issue for you? |
c0b8bef to
4832e3c
Compare
bluca
left a comment
There was a problem hiding this comment.
LGTM - let's maybe wait a little to see if there's any feedback from the reporter
|
I tried the modification and it could solve the issue as you said! 👍 But what confused me is that why we failed to insert journal entry to the last of [email protected] but we could still get the log by using journactl --file [email protected]? |
|
@syyhao1994 most likely adding the entry worked, but then linking it up didn't. but that's OK. so, in journald first a log entry is written to the end of the journal file, and afterwards it is inserted into a bunch of lookup tables. These lookup tables are in the front usually, and thus don't need allocation – except if they are full, in which case we'll allocate a new table at the end of the file, of double the size as the old one. These tables are then chained up. at the beginning of the files the tables are short, at the end they get much larger. this means there's a good chance allocating the table will fail, and we can't link them up hence. — but that is actually entirely OK. These mentioned tables exist purely for finding stuff in the file, i.e. for each field vlaue there's one chain of these tables. So if you know where the field is you also know all entries by looking at these tables. Now, if the tables cannot be created this simply means the entries cannot be found. But that is fine, given they'll be found in the new file. i.e. it doesn't matter where they are found, all that matters is that they are found. If you iterate linearly through a journal file without having any filters applied you'll always see all entries btw, hence in that case you'll se the entries twice (except that now you won#t anymore, once i merge this PR) Hope that makes some sense? |
Fixes: #18005