Skip to content

schema-agreement: add session fallback#842

Draft
dkropachev wants to merge 11 commits intomasterfrom
dk/schema-agreement-session-fallback
Draft

schema-agreement: add session fallback#842
dkropachev wants to merge 11 commits intomasterfrom
dk/schema-agreement-session-fallback

Conversation

@dkropachev
Copy link
Copy Markdown
Collaborator

Summary:

  • add Session.wait_for_schema_agreement() that polls local session hosts via system.local
  • fall back from control-connection schema agreement to a live session when the control connection is unavailable or closed
  • fall back to the session API after DDL schema-refresh agreement fails

Fixes #604

Testing:

  • python -m py_compile cassandra/cluster.py tests/unit/test_control_connection.py tests/unit/test_cluster.py tests/unit/test_response_future.py
  • direct probes for modified control/response-future tests
  • repo_ci fast: workflow-build, workflow-prepare, and workflow-test passed; workflow-build-2 timed out after 300s in cibuildwheel

@Lorak-mmk
Copy link
Copy Markdown

fall back to the session API after DDL schema-refresh agreement fails

I don't think this is correct. The purpose of after-DDL schema agreement is to make sure that all the nodes acknowledged the new schema notification.
If you perform the schema agreement check on a different node, it is possible that it is the node that didn't get the schema change yet, and will get a false-positive schema agreement.

After-DDL schema agreement should be performed on the node we used for DDL. We can use different connection, but not different node.

@dkropachev
Copy link
Copy Markdown
Collaborator Author

fall back to the session API after DDL schema-refresh agreement fails

I don't think this is correct. The purpose of after-DDL schema agreement is to make sure that all the nodes acknowledged the new schema notification. If you perform the schema agreement check on a different node, it is possible that it is the node that didn't get the schema change yet, and will get a false-positive schema agreement.

After-DDL schema agreement should be performed on the node we used for DDL. We can use different connection, but not different node.

It does it on all active nodes.

@dkropachev dkropachev force-pushed the dk/schema-agreement-session-fallback branch from 58b9c7f to 90ae954 Compare May 6, 2026 18:59
@dkropachev dkropachev force-pushed the dk/schema-agreement-session-fallback branch from 90ae954 to 3242df4 Compare May 6, 2026 19:29
Comment thread cassandra/cluster.py
preloaded_results=preloaded_results,
wait_time=wait_time)

def _wait_for_schema_agreement(self, connection=None, preloaded_results=None, wait_time=None):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wait_for_schema_agreement fails when connection is closed

2 participants