Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
in_tail: Handle records in the correct order on file rotation
This is a fix for the events-emitted-in-the-wrong-order bug reported by fluentd#1055. It turned out that this bug was a matter of the calling order of functions in TailWatcher.on_rotate(). In particular, when TailWatcher detects a log rotation and immediately finds a new file, it performs the following steps: 1) Create a new TailWatcher for the new file. * In this process, it reads the new file and emit its contents. * All of this happens before proceeding to (2). 2) Read the old file and emit its contents. So naturally, newer log records (written to the new log file) will be emitted before older records in the archived log file. This patch fixes it by enforcing flush of older log records before performing the step (1).
- Loading branch information