add journalctl --sync command and other stuff#1848
Conversation
…is actually enabled Otherwise we might end up mistaking a SMACK label for an selinux label. Also, fixes unexpect debug messages: http://lists.freedesktop.org/archives/systemd-devel/2015-November/034913.html
…nd of main() To avoid confusion as outlined in systemd#1845.
With this new "--sync" switch we add a synchronous way to sync everything queued to disk, and return only after that's complete. This command gives the guarantee that anything queued before has hit the disk before the command returns. While we are at it, also improve the man pages and help text for journalctl a bit.
Of course, ideally we'd just use normal synchronous bus calls, but this is out of the question as long as we rely on dbus-daemon (which logs to journald, and thus cannot use to avoid cyclic sync loops). Hence, instead, reuse the wait logic already implemented for --sync, and use a signal in one direction, and a mtime watch file for the reply.
add journalctl --sync command and other stuff
|
|
|
|
@evverx have you restarted your journald? journald only writes the touch files out after the patch was applied... And yes, we don't touch those files on SyncIntervalSec=, for a reason: otherwise the guarantee we want to give wouldn't hold: we want that everything queued before invocation of "journalctl --sync" is definitely on disk. That requires us that we sync and touch from a low-priority event source, so that all the other log messages (which are dispatched by higher-priorty event sources) are known to be processed already. Now, the sync interval stuff is triggered by a much higher priority event source than the handling of SIGRTMIN+1, which means we better avoid touch the file in that case. But yeah, we should generate an error if the command is invoked if --machine= is called. |
|
I have prepped a patch locally, that generates an error if --machine= is combined with --flush, --sync or --rotate. |
I tested in a clean new container: works fine |
|
OK, so all is good now? |
|
oh, sorry. no. |
|
In this comment, I mean |
|
The full output of the |
|
@evverx i tried hard to reproduce the issue here, but no luck... I ran the --sync stuff in a loop for quite some time, but it worked every time... The strace you attached shows nothing wrong. For some reason though the tool is never woken up via inotify triggered by a change on /var/run/systemd/synced... Now, this could have two reasons: one could be that there's something wrong with the inotify match we install, and for some reason we don't notice the touch() done by journald. But I don't see how that could happen. The other would be that journald never actually manages to touch the file. I have the suspicion that the latter is more likely the problem. Could you please use "strace -s500 -p" on the journal pid, and then reproduce the issue? This should show how journald gets the SIGRTMIN+1, and then syncs things to disk and eventually touches the sync file. |
No description provided.