Merge pull request #461 from datastax/458

PYTHON-458 - is_schema_agreed attribute for insight following DDL requests
This commit is contained in:
Adam Holmberg
2016-01-29 13:51:22 -06:00
2 changed files with 11 additions and 1 deletions

View File

@@ -2617,7 +2617,7 @@ def refresh_schema_and_set_result(control_conn, response_future, **kwargs):
if control_conn._meta_refresh_enabled:
log.debug("Refreshing schema in response to schema change. "
"%s", kwargs)
control_conn._refresh_schema(response_future._connection, **kwargs)
response_future.is_schema_agreed = control_conn._refresh_schema(response_future._connection, **kwargs)
else:
log.debug("Skipping schema refresh in response to schema change because meta refresh is disabled; "
"%s", kwargs)
@@ -2646,6 +2646,13 @@ class ResponseFuture(object):
:class:`.ResponseFuture`.
"""
is_schema_agreed = True
"""
For DDL requests, this may be set ``False`` if the schema agreement poll after the response fails.
Always ``True`` for non-DDL requests.
"""
session = None
row_factory = None
message = None
@@ -2869,6 +2876,7 @@ class ResponseFuture(object):
elif response.kind == RESULT_KIND_SCHEMA_CHANGE:
# refresh the schema before responding, but do it in another
# thread instead of the event loop thread
self.is_schema_agreed = False
self.session.submit(
refresh_schema_and_set_result,
self.session.cluster.control_connection,

View File

@@ -131,6 +131,8 @@
.. autoattribute:: custom_payload()
.. autoattribute:: is_schema_agreed
.. autoattribute:: has_more_pages
.. autoattribute:: warnings