summaryrefslogtreecommitdiff
path: root/src/journal/journal-file.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-07-24 01:55:45 +0200
committerLennart Poettering <lennart@poettering.net>2015-07-24 01:55:45 +0200
commitdade37d403f1b8c1d7bb2efbe2361f2a3e999613 (patch)
tree854ef27f7463a0e56cf03c5acffab76b28a03b40 /src/journal/journal-file.h
parent45c047b227d96e98e7076c15ae774ff6390dc403 (diff)
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.
Diffstat (limited to 'src/journal/journal-file.h')
-rw-r--r--src/journal/journal-file.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index 403c8f760c..e92b75eabe 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -229,3 +229,6 @@ int journal_file_get_cutoff_realtime_usec(JournalFile *f, usec_t *from, usec_t *
int journal_file_get_cutoff_monotonic_usec(JournalFile *f, sd_id128_t boot, usec_t *from, usec_t *to);
bool journal_file_rotate_suggested(JournalFile *f, usec_t max_file_usec);
+
+int journal_file_map_data_hash_table(JournalFile *f);
+int journal_file_map_field_hash_table(JournalFile *f);