Skip to content

Commit 3731dbb

Browse files
committed
schema-agreement: propagate post-mismatch connection errors
1 parent ac3149d commit 3731dbb

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

cassandra/cluster.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4333,12 +4333,12 @@ def _wait_for_schema_agreement(self, connection=None, preloaded_results=None, wa
43334333
log.debug("[control connection] Aborting wait for schema match due to shutdown")
43344334
return None
43354335

4336+
elapsed = self._time.time() - start
43364337
if schema_mismatches is not None:
4337-
log.warning("Node %s is reporting a schema disagreement: %s",
4338-
connection.endpoint, schema_mismatches)
4339-
return False
4338+
log.debug("[control connection] Error during schema agreement check after mismatch: %s",
4339+
exc)
4340+
raise
43404341

4341-
elapsed = self._time.time() - start
43424342
fallback_wait = total_timeout - elapsed
43434343
fallback = self._wait_for_schema_agreement_through_session(fallback_wait)
43444344
if fallback is not None:

tests/unit/test_control_connection.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,17 @@ def test_wait_for_schema_agreement_retries_control_connection_after_mismatch_the
341341
session.wait_for_schema_agreement.assert_not_called()
342342
assert self.connection.wait_for_responses.call_count == 3
343343

344+
def test_wait_for_schema_agreement_raises_connection_error_after_mismatch(self):
345+
peer_columns = self.connection.peer_results[0]
346+
mismatching_peer_rows = [list(row) for row in self.connection.peer_results[1]]
347+
mismatching_peer_rows[1][2] = 'b'
348+
self.connection.wait_for_responses.side_effect = [
349+
_node_meta_results(self.connection.local_results, (peer_columns, mismatching_peer_rows)),
350+
ConnectionShutdown("closed")]
351+
352+
with self.assertRaises(ConnectionShutdown):
353+
self.control_connection.wait_for_schema_agreement()
354+
344355
def test_wait_for_schema_agreement_does_not_exceed_configured_wait_with_session_fallback(self):
345356
session = Mock(is_shutdown=False)
346357

0 commit comments

Comments
 (0)