Merge lp://staging/~diogobaeder/storm/cleanup-timeline into lp://staging/storm

Proposed by Sidnei da Silva
Status: Merged
Merged at revision: 456
Proposed branch: lp://staging/~diogobaeder/storm/cleanup-timeline
Merge into: lp://staging/storm
Diff against target: 80 lines (+38/-5)
2 files modified
storm/database.py (+24/-5)
tests/database.py (+14/-0)
To merge this branch: bzr merge lp://staging/~diogobaeder/storm/cleanup-timeline
Reviewer Review Type Date Requested Status
Free Ekanayaka (community) Approve
Review via email: mp+146980@code.staging.launchpad.net

Description of the change

Make sure connection_raw_execute_error is called when the tracer's connection_raw_execute fails, so that the tracers have a chance to clean themselves up.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

I've just been discussing this changes with Diogo and Sidnei, and now understand something
I missed first time. This change is most important when using two tracers:

   A -> connection_raw_execute -> success
   B -> connection_raw_execute -> exception

A is then left in a state where it doesn't know that the execution was halted, which
this patch corrects.

Thanks,

James

Revision history for this message
Sidnei da Silva (sidnei) wrote :

There's an alternative failure scenario that this fix doesn't cover:

  - If the cursor.execute() raises a DatabaseError, the PostgresTimeoutTracer's connection_raw_execute_error may turn that into a TimeoutError and re-raise.
  - If the TimelineTracer (or any other tracer for that matter) comes last, then it's connection_raw_execute_error will never be called because the exception bubbles up from trace(), never notifying the remaining tracers.

An additional solution to that problem might be to also make the trace() function more robust, ensuring that it always goes through all the tracers and collects all exceptions, raising some sort of MultiException if there is more than one.

The change of behaviour *could* break people relying on the broken behaviour (eg, expecting that if one of the tracers fails, the remaining ones will never execute), but I don't think anyone in their sane mind would do that.

Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Looks good, +1!

[1]

+ def test_raw_execute_setup_error_tracing(self):

Please add a docstring for this test. I know it's not there in every old test, but we're trying to do that for new tests.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: