diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2016-04-26 23:29:43 -0700 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-04-27 08:29:43 +0200 |
commit | 8eb851711fd166024297c425e9261200c36f489d (patch) | |
tree | d283b28fba75ca0b691e3987d4438291123ed754 /src/journal/test-journal-verify.c | |
parent | 959718c62107c11f1665f813e856a0a1d5b0bb7c (diff) |
journal: set STATE_ARCHIVED as part of offlining (#2740)
The only code path which makes a journal durable is via
journal_file_set_offline().
When we perform a rotate the journal's header->state is being set to
STATE_ARCHIVED prior to journal_file_set_offline() being called.
In journal_file_set_offline(), we short-circuit the entire offline when
f->header->state != STATE_ONLINE.
This all results in none of the journal_file_set_offline() fsync() calls
being reached when rotate archives a journal, so archived journals are
never explicitly made durable.
What we do now is instead of setting the f->header->state to
STATE_ARCHIVED directly in journal_file_rotate() prior to
journal_file_close(), we set an archive flag in f->archive for the
journal_file_set_offline() machinery to honor by committing
STATE_ARCHIVED instead of STATE_OFFLINE when set.
Prior to this, rotated journals were never getting fsync() explicitly
performed on them, since journal_file_set_offline() short-circuited.
Obviously this is undesirable, and depends entirely on the underlying
filesystem as to how much durability was achieved when simply closing
the file.
Note that this problem existed prior to the recent asynchronous fsync
changes, but those changes do facilitate our performing this durable
offline on rotate without blocking, regardless of the underlying
filesystem sync-on-close semantics.
Diffstat (limited to 'src/journal/test-journal-verify.c')
0 files changed, 0 insertions, 0 deletions