C11 exception base class changes vs. pool retry #164

merged 3 commits into from Jul 23, 2012


None yet
2 participants

hannosch commented Jul 18, 2012

I noticed one unintended side-effect of the thrift API updates. The custom exceptions in ttypes.py now inherit from TException instead of the Python's Exception base class. I think that's a sensible change.

But the retry logic in the connection pool, amongst others retried all exceptions inheriting from TException. This would also retry things like InvalidRequestException or AuthenticationException. I changed the logic to retry TTransportException instead, which restores the old behavior (letting those raise directly and not being covered up in a MaximumRetryException).

Compared to pycassa 1.6.0 TProtocolException is no longer retried. Looking at the places where thrift raises those, they look like general configuration/installation problems and not intermittent problems likely to be fixed by a retry.

hannosch added some commits Jul 18, 2012

@hannosch hannosch Let the pool retry TTransportException instead of the general TException
With the c11 thrift API update, all exceptions in ttypes inherit from
TException instead of Exception. This change restores the old behavior and
does not retry any of: NotFoundException, InvalidRequestException,
AuthenticationException, AuthorizationException, SchemaDisagreementException

Compared to pycassa 1.6.0 TProtocolException is no longer retried either.
@hannosch hannosch Add explicit test for NotFoundException 83c6da6
@hannosch hannosch Apply TException to TTransportException change to pool create connection 00cd392

thobbs commented Jul 23, 2012

Good catch, and thanks for the test!

@thobbs thobbs added a commit that referenced this pull request Jul 23, 2012

@thobbs thobbs Merge pull request #164 from hannosch/c11-exception-changes
C11 exception base class changes vs. pool retry

@thobbs thobbs merged commit ca12fca into pycassa:master Jul 23, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment