Skip to content

fix: _set_keyspace_for_all_pools passes only the last pool's errors to callback#915

Open
mykaul wants to merge 3 commits into
masterfrom
fix/set-keyspace-error-accumulation
Open

fix: _set_keyspace_for_all_pools passes only the last pool's errors to callback#915
mykaul wants to merge 3 commits into
masterfrom
fix/set-keyspace-error-accumulation

Conversation

@mykaul

@mykaul mykaul commented Jun 27, 2026

Copy link
Copy Markdown

Fixes #914

pool_finished_setting_keyspace was calling callback(host_errors) (the last pool to finish) instead of callback(errors) (all accumulated errors).

This caused keyspace changes to silently report success when the last pool finished without errors, even if other pools had failures.

Introduced in d281b50c9 (2013-10-11).

mykaul added 3 commits June 26, 2026 20:11
…o callback

The pool_finished_setting_keyspace closure was calling callback(host_errors)
instead of callback(errors), so when the last pool to finish had no errors,
the callback received an empty list instead of the accumulated error dict
from all pools.

This caused _set_keyspace_completed to report success (not [] is True)
even when other pools had failures — keyspace changes silently succeeded
with partial failures dropped.

Introduced in d281b50 (2013-10-11).

Fixes #914
@mykaul mykaul added the bug Something isn't working label Jun 27, 2026
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8966dafd-bb46-46d2-acb6-89125a2268bb

📥 Commits

Reviewing files that changed from the base of the PR and between c1bfd54 and 8990563.

📒 Files selected for processing (57)
  • cassandra/cluster.py
  • cassandra/concurrent.py
  • cassandra/connection.py
  • cassandra/cqlengine/connection.py
  • cassandra/cqlengine/query.py
  • cassandra/cqltypes.py
  • cassandra/datastax/cloud/__init__.py
  • cassandra/encoder.py
  • cassandra/io/asyncioreactor.py
  • cassandra/io/asyncorereactor.py
  • cassandra/pool.py
  • cassandra/protocol.py
  • tests/integration/cqlengine/__init__.py
  • tests/integration/cqlengine/base.py
  • tests/integration/cqlengine/connections/test_connection.py
  • tests/integration/cqlengine/management/test_management.py
  • tests/integration/cqlengine/model/test_model.py
  • tests/integration/cqlengine/model/test_model_io.py
  • tests/integration/cqlengine/query/test_named.py
  • tests/integration/cqlengine/statements/test_select_statement.py
  • tests/integration/cqlengine/statements/test_update_statement.py
  • tests/integration/cqlengine/test_connections.py
  • tests/integration/cqlengine/test_ifexists.py
  • tests/integration/cqlengine/test_ttl.py
  • tests/integration/long/test_large_data.py
  • tests/integration/simulacron/__init__.py
  • tests/integration/simulacron/test_cluster.py
  • tests/integration/simulacron/test_connection.py
  • tests/integration/simulacron/test_empty_column.py
  • tests/integration/simulacron/test_endpoint.py
  • tests/integration/simulacron/utils.py
  • tests/integration/standard/conftest.py
  • tests/integration/standard/test_cluster.py
  • tests/integration/standard/test_concurrent.py
  • tests/integration/standard/test_concurrent_schema_change_and_node_kill.py
  • tests/integration/standard/test_custom_cluster.py
  • tests/integration/standard/test_custom_payload.py
  • tests/integration/standard/test_custom_protocol_handler.py
  • tests/integration/standard/test_metadata.py
  • tests/integration/standard/test_policies.py
  • tests/integration/standard/test_query.py
  • tests/integration/standard/test_query_paging.py
  • tests/integration/standard/test_shard_aware.py
  • tests/integration/standard/test_single_interface.py
  • tests/integration/standard/test_types.py
  • tests/integration/upgrade/__init__.py
  • tests/integration/upgrade/test_upgrade.py
  • tests/stress_tests/test_load.py
  • tests/unit/advanced/test_graph.py
  • tests/unit/advanced/test_insights.py
  • tests/unit/advanced/test_metadata.py
  • tests/unit/io/test_asyncorereactor.py
  • tests/unit/io/test_twistedreactor.py
  • tests/unit/test_endpoints.py
  • tests/unit/test_host_connection_pool.py
  • tests/unit/test_marshalling.py
  • tests/unit/test_protocol.py
💤 Files with no reviewable changes (26)
  • tests/integration/standard/conftest.py
  • tests/integration/cqlengine/base.py
  • tests/integration/standard/test_concurrent.py
  • tests/integration/simulacron/utils.py
  • tests/unit/io/test_asyncorereactor.py
  • tests/integration/simulacron/test_endpoint.py
  • tests/integration/cqlengine/init.py
  • tests/integration/cqlengine/management/test_management.py
  • tests/stress_tests/test_load.py
  • tests/unit/test_host_connection_pool.py
  • tests/integration/upgrade/test_upgrade.py
  • cassandra/io/asyncorereactor.py
  • tests/integration/cqlengine/model/test_model.py
  • tests/integration/cqlengine/model/test_model_io.py
  • tests/integration/simulacron/test_empty_column.py
  • cassandra/datastax/cloud/init.py
  • tests/integration/simulacron/init.py
  • tests/unit/test_marshalling.py
  • tests/unit/io/test_twistedreactor.py
  • tests/integration/standard/test_concurrent_schema_change_and_node_kill.py
  • cassandra/pool.py
  • tests/integration/simulacron/test_connection.py
  • cassandra/concurrent.py
  • tests/integration/standard/test_query_paging.py
  • tests/unit/test_protocol.py
  • cassandra/encoder.py

📝 Walkthrough

Walkthrough

cassandra/cluster.py now passes the accumulated errors map to the keyspace-setting completion callback. The PR also removes or narrows unused imports across runtime modules, cqlengine and Simulacron modules, standard/upgrade/stress integration tests, and unit tests, and adds one import annotation and one weakset fallback import path.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Most of the diff is unrelated import cleanup across many files and tests, which goes beyond the bug fix described in #914. Remove the unrelated import-only changes or split them into a separate cleanup PR, keeping this PR focused on the keyspace callback fix.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the key bug fix in Session._set_keyspace_for_all_pools and matches the main code change.
Description check ✅ Passed The description summarizes the bug, the fix, and the issue reference, which covers the template’s core requirements.
Linked Issues check ✅ Passed The main code change in cassandra/cluster.py fixes #914 by passing the accumulated errors map to the callback instead of the last pool’s errors.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread cassandra/connection.py
from cassandra.segment import SegmentCodec, CrcException
from cassandra.util import OrderedDict
from cassandra.shard_info import ShardingInfo
from cassandra.shard_info import ShardingInfo # noqa: F401 # re-exported for cassandra.connection.ShardingInfo

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but unrelated.

Comment thread cassandra/protocol.py
Comment on lines +33 to +40
from cassandra.cqltypes import (AsciiType, BytesType, BooleanType, # noqa: F401
CounterColumnType, DateType, DecimalType, # noqa: F401
DoubleType, FloatType, Int32Type, # noqa: F401
InetAddressType, IntegerType, ListType, # noqa: F401
LongType, MapType, SetType, TimeUUIDType, # noqa: F401
UTF8Type, VarcharType, UUIDType, UserType, # noqa: F401
TupleType, lookup_casstype, SimpleDateType, # noqa: F401
TimeType, ByteType, ShortType, DurationType) # noqa: F401

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_set_keyspace_for_all_pools callback receives only the last pool's errors instead of all accumulated errors

1 participant