PrepareStatement should support is_idempotent

This commit is contained in:
Alan Boudreault 2017-05-25 17:34:40 -04:00 committed by Jim Witschey
parent b81cfee027
commit 8e6a1db2f8
3 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,10 @@
3.11
====
Bug Fixes
---------
* is_idempotent flag is not propagated from PreparedStatement to BoundStatement (PYTHON-736)
3.10.0
======
May 24, 2017

View File

@ -496,7 +496,8 @@ class BoundStatement(Statement):
self.keyspace = meta[0].keyspace_name
Statement.__init__(self, retry_policy, consistency_level, routing_key,
serial_consistency_level, fetch_size, keyspace, custom_payload)
serial_consistency_level, fetch_size, keyspace, custom_payload,
prepared_statement.is_idempotent)
def bind(self, values):
"""

View File

@ -112,6 +112,16 @@ class SpecExecTest(BasicSharedKeyspaceUnitTestCase):
with self.assertRaises(OperationTimedOut):
result = self.session.execute(statement, execution_profile='spec_ep_rr', timeout=.5)
# PYTHON-736 Test speculation policy works with a prepared statement
statement = self.session.prepare("SELECT timeout(100) FROM d WHERE k = ?")
# non-idempotent
result = self.session.execute(statement, (0,), execution_profile='spec_ep_brr')
self.assertEqual(1, len(result.response_future.attempted_hosts))
# idempotent
statement.is_idempotent = True
result = self.session.execute(statement, (0,), execution_profile='spec_ep_brr')
self.assertLess(1, len(result.response_future.attempted_hosts))
#TODO redo this tests with Scassandra
def test_speculative_and_timeout(self):
"""