Merge branch 'dcrt_rethrow_write_timeout' into 338

This commit is contained in:
Adam Holmberg
2015-07-16 15:50:44 -05:00
2 changed files with 9 additions and 1 deletions

View File

@@ -816,7 +816,7 @@ class DowngradingConsistencyRetryPolicy(RetryPolicy):
required_responses, received_responses, retry_num):
if retry_num != 0:
return (self.RETHROW, None)
elif write_type in (WriteType.SIMPLE, WriteType.BATCH, WriteType.COUNTER):
elif write_type in (WriteType.SIMPLE, WriteType.BATCH, WriteType.COUNTER) and received_responses > 0:
return (self.IGNORE, None)
elif write_type == WriteType.UNLOGGED_BATCH:
return self._pick_consistency(received_responses)

View File

@@ -1052,6 +1052,14 @@ class DowngradingConsistencyRetryPolicyTest(unittest.TestCase):
self.assertEqual(retry, RetryPolicy.RETHROW)
self.assertEqual(consistency, None)
# On these type of writes failures should not be ignored
# if received_responses is 0
for write_type in (WriteType.SIMPLE, WriteType.BATCH, WriteType.COUNTER):
retry, consistency = policy.on_write_timeout(
query=None, consistency=ONE, write_type=write_type,
required_responses=1, received_responses=0, retry_num=0)
self.assertEqual(retry, RetryPolicy.RETHROW)
# ignore failures on these types of writes
for write_type in (WriteType.SIMPLE, WriteType.BATCH, WriteType.COUNTER):
retry, consistency = policy.on_write_timeout(