[ 
https://issues.apache.org/jira/browse/FLUME-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459182#comment-13459182
 ] 

Hari Shreedharan edited comment on FLUME-1593 at 9/20/12 9:49 AM:
------------------------------------------------------------------

Yes. I was suggesting something of this sort(pretty similar to what you 
mentioned above):

In put/commit/blah:
{code}
writeToLogFile(transactionID);
{code}
{code}
void writeToLogFile(long txnID) {
        int n //max number of retries
        for(int i = 0; i<n;i++){
                logFileIndex = nextLogWriter(txnID);
                try{
                        //Check if roll is needed, if yes, roll
                        //write to file
                        //return
                } catch(Ex) {
                        //log it
                }
        }
        throw new IOException("Could not write after trying a gazillion times);
}
{code}

Specifically I am not too keen on having additional inner classes and other 
complex logic to handle an error case like this.  From what I understand, a 
simple method like the one above should be enough to handle this, right?

In this case, we also don't need to introduce additional exceptions. We just 
assume that the Exception thrown was because the writer was closed. Also we 
could check if after a failure we get the same writer as before, if we do we 
can just throw an exception, since the writer is obviously not closed.
                
      was (Author: hshreedharan):
    Yes. I was suggesting something of this sort(pretty similar to what you 
mentioned above):

In put/commit/blah:
{code}
writeToLogFile(transactionID);
{code}
{code}
void writeToLogFile(long txnID) {
        int n //max number of retries
        for(int i = 0; i<n;i++){
                logFileIndex = nextLogWriter(txnID);
                try{
                        //Check if roll is needed, if yes, roll
                        //write to file
                        //return
                } catch(Ex) {
                        //log it
                }
        }
        throw new IOException("Could not write after trying a gazillion times);
}
{code}

Specifically I am not too keen on having additional inner classes and other 
complex logic to handle an error case like this.  From what I understand, a 
simple method like the one above should be enough to handle this, right?
                  
> FileChannel race condition when log file rolls
> ----------------------------------------------
>
>                 Key: FLUME-1593
>                 URL: https://issues.apache.org/jira/browse/FLUME-1593
>             Project: Flume
>          Issue Type: Improvement
>          Components: Channel
>    Affects Versions: v1.3.0
>            Reporter: Brock Noland
>            Assignee: Brock Noland
>            Priority: Minor
>         Attachments: FLUME-1593-0.patch
>
>
> There is a non-harmful race condition when we roll a log. One thread can call 
> logFiles.get(logFileIndex).{take,put,etc} while another is closing that log 
> writer.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to