diff options
author | Vito Caputo <vito.caputo@coreos.com> | 2016-02-17 17:37:10 -0800 |
---|---|---|
committer | Vito Caputo <vito.caputo@coreos.com> | 2016-02-19 18:50:20 -0800 |
commit | b58c888f30947b29730768c48ad402a2c5b65be9 (patch) | |
tree | 07c83055898fa1734f2f76409732ac73c0ecbb6e /src/journal/test-journal-stream.c | |
parent | ac2e41f5103ce2c679089c4f8fb6be61d7caec07 (diff) |
journal: defer journal closes on rotate
When we rotate journals, we must set offline and close the current one,
but don't generally need to wait for this to complete.
Instead, we'll initiate an asynchronous offline via
journal_file_set_offline(oldfile, false), and add the file to a
per-server set of deferred closes to be closed later when they
won't block.
There's one complication however; journal_file_open() via
journal_file_verify_header() assumes that any writable journal in the
online state is the product of an unclean shutdown or other form of
corruption.
Thus there's a need for journal_file_open() to be aware of deferred
closes and synchronize with their completion when opening preexisting
journals for writing. To facilitate this the deferred closes set is
supplied to the journal_file_open() function where the deferred closes
may be closed synchronously before verifying the header in such
circumstances.
Diffstat (limited to 'src/journal/test-journal-stream.c')
-rw-r--r-- | src/journal/test-journal-stream.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/journal/test-journal-stream.c b/src/journal/test-journal-stream.c index 82543bb5f9..839ea5a9a5 100644 --- a/src/journal/test-journal-stream.c +++ b/src/journal/test-journal-stream.c @@ -92,9 +92,9 @@ int main(int argc, char *argv[]) { assert_se(mkdtemp(t)); assert_se(chdir(t) >= 0); - assert_se(journal_file_open("one.journal", O_RDWR|O_CREAT, 0666, true, false, NULL, NULL, NULL, &one) == 0); - assert_se(journal_file_open("two.journal", O_RDWR|O_CREAT, 0666, true, false, NULL, NULL, NULL, &two) == 0); - assert_se(journal_file_open("three.journal", O_RDWR|O_CREAT, 0666, true, false, NULL, NULL, NULL, &three) == 0); + assert_se(journal_file_open("one.journal", O_RDWR|O_CREAT, 0666, true, false, NULL, NULL, NULL, NULL, &one) == 0); + assert_se(journal_file_open("two.journal", O_RDWR|O_CREAT, 0666, true, false, NULL, NULL, NULL, NULL, &two) == 0); + assert_se(journal_file_open("three.journal", O_RDWR|O_CREAT, 0666, true, false, NULL, NULL, NULL, NULL, &three) == 0); for (i = 0; i < N_ENTRIES; i++) { char *p, *q; |