]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/journal/journal-verify.c
journal: avoid mapping empty data and field hash tables
authorLennart Poettering <lennart@poettering.net>
Thu, 23 Jul 2015 23:55:45 +0000 (01:55 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 23 Jul 2015 23:55:45 +0000 (01:55 +0200)
commitdade37d403f1b8c1d7bb2efbe2361f2a3e999613
tree854ef27f7463a0e56cf03c5acffab76b28a03b40
parent45c047b227d96e98e7076c15ae774ff6390dc403
journal: avoid mapping empty data and field hash tables

When a new journal file is created we write the header first, then sync
and only then create the data and field hash tables in them. That means
to other processes it might appear that the files have a valid header
but not data and field hash tables. Our reader code should be able to
deal with this.

With this change we'll not map the two hash tables right-away after
opening a file for reading anymore (because that will of course fail if
the objects are missing), but delay this until the first time we access
them. On top of that, when we want to look something up in the hash
tables and we notice they aren't initialized yet, we consider them
empty.

This improves handling of some journal files reported in #487.
src/journal/journal-file.c
src/journal/journal-file.h
src/journal/journal-verify.c