double 'ctlinnd flushlogs' deletes news, errlog

Julien ÉLIE julien at trigofacile.com
Sat Apr 13 16:57:55 UTC 2013


Hi Florian,

> I just noticed a critical flaw in your recent commit to flush process /
> exploder channels. You introduced a second call to 'ctlinnd flushlogs'
> in scanlogs. Unfortunately, when 'ctlinnd flushlogs' is called, innd
> doesn't just flush its logs, it also rotates (moves) its log and errlog
> to news.old and errlog.old, overwriting what's already there. So the
> second call effectively destroys both logs.

Oooops!  You're totally right.  Thanks for having caught the issue in 
log archives.



> Perhaps innd should stop do the .old rotation and restrict itself to
> flushing, and scanlogs should mv to .old rather than cp, and not just
> "in case innd is down", and then the first invocation of 'ctlinnd
> flushlogs' can be deleted?

That's a possibility.  But shouldn't "news" and "errlog" then treated 
like what is done for live files just below?  (using a symbolic link 
rather than a copy)

A point to take into account:  changing the "flushlogs" behaviour would 
not be possible in the STABLE 2.5 branch, but only in 2.6... so the bug 
you report will still be present.


Another possibility, suggested by the TODO file:

* ctlinnd flushlogs currently renames all of the log files.  It would be
nice to support the method of log rotation that most other daemons
support, namely to move the logs aside and then tell innd to reopen its
log files.  Ideally, that behavior would be triggered with a SIGHUP.
scanlogs would have to be modified to handle this.

The best way to support this seems to be to leave scanlogs as is by
default, but also add two additional modes.  One would flush all the
logs and prepare for the syslog logs to be rotated, and the other would
do all the work needed after the logs have been rotated.  That way, if
someone wanted to plug in a separate log rotation handler, they could do
so and just call scanlogs on either side of it.  The reporting portions
of scanlogs should be in a separate program.




The current "flushlogs" does:

- ICDwrite (flush history, articles in the storage manager, and active)
- rename the news file
- reopen the news file
- rename the errlog file
- reopen the errlog file
- flush exploder and process channels


We could add "prerotatelogs" and "postrotatelogs" modes (another 
suggestion of naming?) which would do:


prerotatelogs
-------------

- ICDwrite (flush history, articles in the storage manager, and active)


postrotatelogs
--------------

- reopen the news file
- reopen the errlog file
- flush exploder and process channels



Then, scanlogs will call "prerotatelogs" instead of the first 
"flushlogs", rename the news and errlog files like live files, and call 
"postrotatelogs" instead of the second "flushlogs".

Would this suggestion suit you?

-- 
Julien ÉLIE

« – Gallo-pin !
   – Il a toujours été comme ça… C'est une brute gallo-née ! »
     (Astérix)


More information about the inn-workers mailing list