journald: reset runtime seqnum data when flushing to system journal
Follow-up for e5d60d1b3b.
The current system journal's seqnum ID will usually be different from
the seqnum ID of the current runtime journal. Therefore, to avoid
unnecessary rotations on boot, reset the runtime seqnum data when
switching to system journal so that systemd-journald will adopt the
system journal's seqnum ID and value on next write.
Fixes #30092
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "journald-stream.h"
|
||||
#include "journald-syslog.h"
|
||||
#include "log.h"
|
||||
#include "memory-util.h"
|
||||
#include "missing_audit.h"
|
||||
#include "mkdir.h"
|
||||
#include "parse-util.h"
|
||||
@@ -1275,6 +1276,10 @@ int server_flush_to_var(Server *s, bool require_flag_file) {
|
||||
if (!s->system_journal)
|
||||
return 0;
|
||||
|
||||
/* Reset current seqnum data to avoid unnecessary rotation when switching to system journal.
|
||||
* See issue #30092. */
|
||||
zero(*s->seqnum);
|
||||
|
||||
log_debug("Flushing to %s...", s->system_storage.path);
|
||||
|
||||
start = now(CLOCK_MONOTONIC);
|
||||
|
||||
Reference in New Issue
Block a user