[jira] [Commented] (IO-523) Do not reload the entire file when a tailed file's length and position are the same but the file is newer
[ https://issues.apache.org/jira/browse/IO-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128264#comment-16128264 ] lingyangtt commented on IO-523: --- I 'am agree with you. In many cases, such as rollingfile, this class needs to be modify by yourself for special requirements. > Do not reload the entire file when a tailed file's length and position are > the same but the file is newer > - > > Key: IO-523 > URL: https://issues.apache.org/jira/browse/IO-523 > Project: Commons IO > Issue Type: Improvement > Components: Streams/Writers >Affects Versions: 2.5 > Environment: Windows 10 >Reporter: Tyler Murry >Priority: Minor > Attachments: IO-523.patch > > Original Estimate: 24h > Remaining Estimate: 24h > > In the Tailer class, when the file length is equal to the position and the > file is newer, the following branch is executed: > {code:title=org.apache.commons.io.input.Tailer.java} > // --- Lines 461 - 472 -- > // ... > else if (newer) { > /* >* This can happen if the file is truncated or overwritten with the exact > same length of >* information. In cases like this, the file position needs to be reset >*/ > position = 0; > reader.seek(position); // cannot be null here > // Now we can read new lines > position = readLines(reader); > last = file.lastModified(); > } > // ... > {code} > The comments in the branch specifically mention wanting to reset the position > and reload the entire file. However, I believe this can lead to undesirable > effects in certain cases. > One example is when you are tailing one file into another file. If this > branch is hit, the entire input file is recopied into the output file. This > is especially troublesome if you have a rouge file who's timestamp changes > regularly without any content changes. > My improvement would be to simply remove this branch if it works for the > general case as well. Or, at least for special cases, allow a parameter to be > checked to prevent this behavior. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (IO-523) Do not reload the entire file when a tailed file's length and position are the same but the file is newer
[ https://issues.apache.org/jira/browse/IO-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123104#comment-16123104 ] Sebb commented on IO-523: - The behaviour needs to be optional to account for the case where the file has been rewritten to the same size. > Do not reload the entire file when a tailed file's length and position are > the same but the file is newer > - > > Key: IO-523 > URL: https://issues.apache.org/jira/browse/IO-523 > Project: Commons IO > Issue Type: Improvement > Components: Streams/Writers >Affects Versions: 2.5 > Environment: Windows 10 >Reporter: Tyler Murry >Priority: Minor > Attachments: IO-523.patch > > Original Estimate: 24h > Remaining Estimate: 24h > > In the Tailer class, when the file length is equal to the position and the > file is newer, the following branch is executed: > {code:title=org.apache.commons.io.input.Tailer.java} > // --- Lines 461 - 472 -- > // ... > else if (newer) { > /* >* This can happen if the file is truncated or overwritten with the exact > same length of >* information. In cases like this, the file position needs to be reset >*/ > position = 0; > reader.seek(position); // cannot be null here > // Now we can read new lines > position = readLines(reader); > last = file.lastModified(); > } > // ... > {code} > The comments in the branch specifically mention wanting to reset the position > and reload the entire file. However, I believe this can lead to undesirable > effects in certain cases. > One example is when you are tailing one file into another file. If this > branch is hit, the entire input file is recopied into the output file. This > is especially troublesome if you have a rouge file who's timestamp changes > regularly without any content changes. > My improvement would be to simply remove this branch if it works for the > general case as well. Or, at least for special cases, allow a parameter to be > checked to prevent this behavior. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (IO-523) Do not reload the entire file when a tailed file's length and position are the same but the file is newer
[ https://issues.apache.org/jira/browse/IO-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16122954#comment-16122954 ] lingyangtt commented on IO-523: --- I foud this issue 3 years ago, it seems sometimes the file is newer, but its length has not changed. I changed the code, in this case, do nothing . else if (newer) { //logger.info("no read bytes"); } > Do not reload the entire file when a tailed file's length and position are > the same but the file is newer > - > > Key: IO-523 > URL: https://issues.apache.org/jira/browse/IO-523 > Project: Commons IO > Issue Type: Improvement > Components: Streams/Writers >Affects Versions: 2.5 > Environment: Windows 10 >Reporter: Tyler Murry >Priority: Minor > Attachments: IO-523.patch > > Original Estimate: 24h > Remaining Estimate: 24h > > In the Tailer class, when the file length is equal to the position and the > file is newer, the following branch is executed: > {code:title=org.apache.commons.io.input.Tailer.java} > // --- Lines 461 - 472 -- > // ... > else if (newer) { > /* >* This can happen if the file is truncated or overwritten with the exact > same length of >* information. In cases like this, the file position needs to be reset >*/ > position = 0; > reader.seek(position); // cannot be null here > // Now we can read new lines > position = readLines(reader); > last = file.lastModified(); > } > // ... > {code} > The comments in the branch specifically mention wanting to reset the position > and reload the entire file. However, I believe this can lead to undesirable > effects in certain cases. > One example is when you are tailing one file into another file. If this > branch is hit, the entire input file is recopied into the output file. This > is especially troublesome if you have a rouge file who's timestamp changes > regularly without any content changes. > My improvement would be to simply remove this branch if it works for the > general case as well. Or, at least for special cases, allow a parameter to be > checked to prevent this behavior. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (IO-523) Do not reload the entire file when a tailed file's length and position are the same but the file is newer
[ https://issues.apache.org/jira/browse/IO-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15699100#comment-15699100 ] Tyler Murry commented on IO-523: Patch to resolve this issue has been uploaded. > Do not reload the entire file when a tailed file's length and position are > the same but the file is newer > - > > Key: IO-523 > URL: https://issues.apache.org/jira/browse/IO-523 > Project: Commons IO > Issue Type: Improvement > Components: Streams/Writers >Affects Versions: 2.5 > Environment: Windows 10 >Reporter: Tyler Murry >Priority: Minor > Attachments: IO-523.patch > > Original Estimate: 24h > Remaining Estimate: 24h > > In the Tailer class, when the file length is equal to the position and the > file is newer, the following branch is executed: > {code:title=org.apache.commons.io.input.Tailer.java} > // --- Lines 461 - 472 -- > // ... > else if (newer) { > /* >* This can happen if the file is truncated or overwritten with the exact > same length of >* information. In cases like this, the file position needs to be reset >*/ > position = 0; > reader.seek(position); // cannot be null here > // Now we can read new lines > position = readLines(reader); > last = file.lastModified(); > } > // ... > {code} > The comments in the branch specifically mention wanting to reset the position > and reload the entire file. However, I believe this can lead to undesirable > effects in certain cases. > One example is when you are tailing one file into another file. If this > branch is hit, the entire input file is recopied into the output file. This > is especially troublesome if you have a rouge file who's timestamp changes > regularly without any content changes. > My improvement would be to simply remove this branch if it works for the > general case as well. Or, at least for special cases, allow a parameter to be > checked to prevent this behavior. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (IO-523) Do not reload the entire file when a tailed file's length and position are the same but the file is newer
[ https://issues.apache.org/jira/browse/IO-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15698727#comment-15698727 ] Tyler Murry commented on IO-523: Just to be clear, are you recommending that I remove this branch entirely or parameterize this functionality? > Do not reload the entire file when a tailed file's length and position are > the same but the file is newer > - > > Key: IO-523 > URL: https://issues.apache.org/jira/browse/IO-523 > Project: Commons IO > Issue Type: Improvement > Components: Streams/Writers >Affects Versions: 2.5 > Environment: Windows 10 >Reporter: Tyler Murry >Priority: Minor > Original Estimate: 24h > Remaining Estimate: 24h > > In the Tailer class, when the file length is equal to the position and the > file is newer, the following branch is executed: > {code:title=org.apache.commons.io.input.Tailer.java} > // --- Lines 461 - 472 -- > // ... > else if (newer) { > /* >* This can happen if the file is truncated or overwritten with the exact > same length of >* information. In cases like this, the file position needs to be reset >*/ > position = 0; > reader.seek(position); // cannot be null here > // Now we can read new lines > position = readLines(reader); > last = file.lastModified(); > } > // ... > {code} > The comments in the branch specifically mention wanting to reset the position > and reload the entire file. However, I believe this can lead to undesirable > effects in certain cases. > One example is when you are tailing one file into another file. If this > branch is hit, the entire input file is recopied into the output file. This > is especially troublesome if you have a rouge file who's timestamp changes > regularly without any content changes. > My improvement would be to simply remove this branch if it works for the > general case as well. Or, at least for special cases, allow a parameter to be > checked to prevent this behavior. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (IO-523) Do not reload the entire file when a tailed file's length and position are the same but the file is newer
[ https://issues.apache.org/jira/browse/IO-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15698295#comment-15698295 ] Gary Gregory commented on IO-523: - Thank you for your report. Can you provide a patch, ideally with a unit test? Make sure the whole build passes ;-) Gary > Do not reload the entire file when a tailed file's length and position are > the same but the file is newer > - > > Key: IO-523 > URL: https://issues.apache.org/jira/browse/IO-523 > Project: Commons IO > Issue Type: Improvement > Components: Streams/Writers >Affects Versions: 2.5 > Environment: Windows 10 >Reporter: Tyler Murry >Priority: Minor > Original Estimate: 24h > Remaining Estimate: 24h > > In the Tailer class, when the file length is equal to the position and the > file is newer, the following branch is executed: > {code:title=org.apache.commons.io.input.Tailer.java} > // --- Lines 461 - 472 -- > // ... > else if (newer) { > /* >* This can happen if the file is truncated or overwritten with the exact > same length of >* information. In cases like this, the file position needs to be reset >*/ > position = 0; > reader.seek(position); // cannot be null here > // Now we can read new lines > position = readLines(reader); > last = file.lastModified(); > } > // ... > {code} > The comments in the branch specifically mention wanting to reset the position > and reload the entire file. However, I believe this can lead to undesirable > effects in certain cases. > One example is when you are tailing one file into another file. If this > branch is hit, the entire input file is recopied into the output file. This > is especially troublesome if you have a rouge file who's timestamp changes > regularly without any content changes. > My improvement would be to simply remove this branch if it works for the > general case as well. Or, at least for special cases, allow a parameter to be > checked to prevent this behavior. -- This message was sent by Atlassian JIRA (v6.3.4#6332)