journal-file: journal-file: extend journal header to always carry offset of most recent entry

This way we can quickly find the most recent entry, without searching or
traversing entry array chains.

This is relevant later, as it it allows us to quickly determine the most
recent timestamps of each journal file, in a roughly atomic way.
This commit is contained in:
Lennart Poettering
2023-03-02 10:03:15 +01:00
parent 7a67afe331
commit 206f0f397e
3 changed files with 16 additions and 3 deletions
+7 -2
View File
@@ -178,8 +178,10 @@ _packed_ struct Header {
le64_t data_hash_chain_depth;
le64_t field_hash_chain_depth;
/* Added in 252 */
le32_t tail_entry_array_offset; \
le32_t tail_entry_array_n_entries; \
le32_t tail_entry_array_offset;
le32_t tail_entry_array_n_entries;
/* Added in 254 */
le64_t tail_entry_offset;
};
```
@@ -252,6 +254,9 @@ field hash table, minus one.
**tail_entry_array_offset** and **tail_entry_array_n_entries** allow immediate
access to the last entry array in the global entry array chain.
**tail_entry_offset** allow immediate access to the last entry in the journal
file.
## Extensibility
The format is supposed to be extensible in order to enable future additions of