-
Notifications
You must be signed in to change notification settings - Fork 531
Logstreamer doesn't notice new file in a stream since previous empty one was deleted #1199
Comments
It's seems that we have erroneous loop in this case:
|
I've tried to look deeper at code, but it's too complicated for me. Too scary to touch hashing. So I just wrote a 'special-case-fix'. It works for me. --- dir1/logstreamer/reader.go 2014-10-14 10:28:30.000000000 +0700
+++ dir2/logstreamer/reader.go 2014-10-14 10:37:44.000000000 +0700
@@ -178,10 +178,14 @@
return "", false
}
+ prior_was_empty := false
// 1. If our size is greater than the file at this filename, we're not the
// same file
if currentInfo.Size() > fInfo.Size() {
ok = true
+ } else if (currentInfo.Size() < fInfo.Size() && currentInfo.Size()==0 ) {
+ prior_was_empty = true
+ ok = true
} else if l.FileHashMismatch() {
// Our file-hash didn't verify, not the same file
ok = true
@@ -234,6 +238,11 @@
return l.logfiles[fileIndex+1].FileName, true
}
+ // So filename did't change, but currently opened file is empty and existing file with our filename is bigger. Maybe is it a newer one?
+ if prior_was_empty == true {
+ return l.position.Filename, true
+ }
+
return
}
|
This also affects me when using a program that runs mv on the tracked log files to a different directory and then deletes them after being copied. New ones are then made at the original path. |
And the old log file doesn't have to be empty for this to occur. At least if I mv the tracked log file to a new directory, and then delete it, heka loses track of that log stream until it is restarted. |
@markabey Did you try to view positions in journal files? I'll say banality, but maybe heka just couldn't read your files as fast as you expect. |
I can reproduce this issue (in heka 0.10.b1) with rolling empty files with same name. |
This bug is a show stopper for me. @validname fix works properly. |
@markabey In the case you're describing, Heka will hold on to the deleted file when no replacement file has been created, but it should notice that there's a new file as soon as one is created in the original location. |
@rafrombrc Thanks for fix the issue. |
Hello!
I've found a bug. I've checked it on the last commit 8941404 without our patches.
How to reproduce:
The text was updated successfully, but these errors were encountered: