You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by "Segerlind, Nathan L" <na...@intel.com> on 2014/01/17 15:59:32 UTC

question: handling transactions with store functions

Hello.

I am trying to write a storage function in Pig and I'd like to know what the guarantees are on the  StoreFunc's  prepareToWrite , cleanupOnFailure and cleanupOnSucccess methods are.

In particular, when are these functions called?  Is it once per task or once per tuple?

The store that I am writing to expects a flow like

Open connection.
Many, many writes.
Close connection.

If it turns out the prepareToWrite and cleanupOnSuccess get called for every tuple,  it would be very problematic on large datasets. But once per task (or so) would be reasonable.

Pointers to the pig code controlling the invocation of these functions would be especially appreciated.

Cheers,
Nate Segerlind