Skip to content

Revert "Make schema agreement waiting code renew connection on each iteration" #460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions cassandra/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -4206,7 +4206,7 @@ def _handle_schema_change(self, event):
delay = self._delay_for_event_type('schema_change', self._schema_event_refresh_window)
self._cluster.scheduler.schedule_unique(delay, self.refresh_schema, **event)

def wait_for_schema_agreement(self, target_connection=None, preloaded_results=None, wait_time=None):
def wait_for_schema_agreement(self, connection=None, preloaded_results=None, wait_time=None):

total_timeout = wait_time if wait_time is not None else self._cluster.max_schema_agreement_wait
if total_timeout <= 0:
Expand All @@ -4220,7 +4220,8 @@ def wait_for_schema_agreement(self, target_connection=None, preloaded_results=No
if self._is_shutdown:
return

connection = target_connection or self._connection
if not connection:
connection = self._connection

if preloaded_results:
log.debug("[control connection] Attempting to use preloaded results for schema agreement")
Expand All @@ -4239,8 +4240,6 @@ def wait_for_schema_agreement(self, target_connection=None, preloaded_results=No
select_peers_query = self._get_peers_query(self.PeersQueryType.PEERS_SCHEMA, connection)

while elapsed < total_timeout:
connection = target_connection or self._connection

peers_query = QueryMessage(query=maybe_add_timeout_to_query(select_peers_query, self._metadata_request_timeout),
consistency_level=cl)
local_query = QueryMessage(query=maybe_add_timeout_to_query(self._SELECT_SCHEMA_LOCAL, self._metadata_request_timeout),
Expand Down
Loading