On Wed, Mar 30, 2016 at 11:18:46AM -0400, Peter Rabbitson via RT wrote:
Show quoted text
No worries. It does mean I have semi-garbage-collected most of the
context, so I don't remember what was important for me.
I think my original request, that others be warned of autodie<2.26, is
addressed by your explanation of the PSA messages. And maybe also the
fact that search engines can find this thread.
Show quoted text> On Fri Jun 19 16:27:29 2015, mca@sanger.ac.uk wrote:
[ execution-event-annotated pseudocode was here ]
Show quoted text> > Actually it looks like the entire try{} block is happening again,
> > because when I put a print at the top it happens twice..?!
> > Presumably this is due to some deep failure with DESTROYing things
> > while propagating exceptions.
>
> This is most likely due to the behavior of txn_do (it tries to run
> things twice on a disconnect)
OK. I guess a 'cluck' might show that up, but I didn't think of that
at the time.
I had previously concluded that DESTROY blocks may happen more than
once per object, even without the re-blessing mentioned in
L<perlobj/Destructors>, so I try to remember to keep them idempotent.
Show quoted text> There have been many (not yet released) improvements in the last
> couple months in this area. Set DBIC_STORAGE_RETRY_DEBUG=1 for extra
> info on if this is happening or not.
Thanks for the tip. I made a note on my cgpDataOut project to try
this,
(internal :
https://gitlab.internal.sanger.ac.uk/CancerIT/cgpDataOut/issues/1 )
but it may be a while before I'm back on the DBIC side of this.
Show quoted text> > The TxnMinder itself might interest you. Its purpose is to run a LIFO
> > list of CODE blocks, after the database rollbacks are completed, for
> > things like removing files which were being built off the uncommitted
> > rows.
>
> I am very interested in what is the API that you are using for this
> (the implementation isn't that important). I am going to implement
> something very similar next week to fix another problem with the
> DBIC deferred constraint support.
(I'm not sure I understood your question.)
I was building a command line tool and underlying API to supply
temporary copies of large data files to a compute cluster, and track
those files in the database via DBIC in order to clean them up later.
What I wanted was a way to keep the disk and database in sync, for
commit or rollback, and to report on the progress of this. Assuming
that the Perl process doesn't suddenly disappear.
It seemed that a D:C:S:TxnScopeGuard-like object was the answer,
because then I can ask it to (e.g.) mkdir and it will correctly rmdir
if the database transaction is rolled back.
Therefore I create my object (to BEGIN transaction), add to it some
CODE to undo each non-db piece of work as I do the work, and then tell
it when to COMMIT.
The last line of POD says
| This "has a" DBIx::Class::Storage::TxnScopeGuard rather than
| inheriting, to avoid needing to mess with the privates of the
| superclass.
Possibly I would have had less trouble if subclassing TxnScopeGuard
was explicitly OK? In this case I preferred to avoid poking
undocumented magic.
Show quoted text> > However, I'm now suspecting that doing this much work in DESTROY
> > is inadvisable.
(But I haven't found a more convenient way. Scope::Guard-like
behaviour really simplifies code and that removes places to hide
bugs.)
Show quoted text> Generally yes, but it may be moot if I can fit your needs into the
> thing I mentioned above. So please do get back to me with what your
> calling conventions look like (in private if need be).
If the description above isn't enough, I can probably just publish the
project. It would probably be GPL if it could possibly be interesting
to anyone outside the organisation; but I should do the licensing
thing if I do.
Show quoted text
Thanks. 8-)
--
Matthew
--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.