Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Flume, mail # dev - Review Request: BasicTransactionSemantics should avoid throw-ing from close()


Copy link to this message
-
Re: Review Request: BasicTransactionSemantics should avoid throw-ing from close()
Roshan Naik 2013-04-17, 00:44


> On April 16, 2013, 10:51 p.m., Mike Percy wrote:
> > I think it'd be great to preserve or enable the Lock-like idiom as a best-practice, i.e.
> >
> > txn.begin()
> > try {
> >   // do stuff, puts, whatever
> >   ch.put(...);
> >   ch.commit();
> > } catch (FlumeException ex) {
> >   ch.rollback();
> > } finally {
> >   ch.close();
> > }
> >
> > So whatever gets us there (right now we have to catch Throwable which is pretty horrible) I would support.
> >
> > May require changes to the channel implementations which is fine. After mulling it over a bit, I think we should encourage channel implementations to do their own rollback-on-close and log an ERROR if the txn is still open at close time, because it will give them more ability to react to implementation specific details, like if rollback throws in the middle of a close.
>
> Mike Percy wrote:
>     BTW, I meant to write txn.close() in the finally block above

So ..  
- BasicTransactionSemanitcs.doClose() will be marked abstract and all the channels will implement this in their transaction class
- BasicTransactionSemanitcs.close()  method's task will henceforth be delegated down to the channel's   doClose()  

is that right ?
- Roshan
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/10362/#review19278
-----------------------------------------------------------
On April 9, 2013, 3:21 a.m., Roshan Naik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/10362/
> -----------------------------------------------------------
>
> (Updated April 9, 2013, 3:21 a.m.)
>
>
> Review request for Flume.
>
>
> Description
> -------
>
> Loggin error instead of throwing exception in cases where close() is called w/o rollback or abort being called.
>
>
> This addresses bug FLUME-1321.
>     https://issues.apache.org/jira/browse/FLUME-1321
>
>
> Diffs
> -----
>
>   flume-ng-core/src/main/java/org/apache/flume/channel/BasicTransactionSemantics.java 403cbca
>
> Diff: https://reviews.apache.org/r/10362/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Roshan Naik
>
>