Skip to content

Commit fad8764

Browse files
authored
Fix hfp docs (apache#802)
* fix HFP docs to account for new behavior * make comment stop rendering
1 parent f42132a commit fad8764

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

cassandra/policies.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,10 @@ def address_is_ignored(host):
485485
load_balancing_policy=blacklist_filter_policy,
486486
)
487487
488+
See the note in the :meth:`.make_query_plan` documentation for a caveat on
489+
how wrapping ordering polices (e.g. :class:`.RoundRobinPolicy`) may break
490+
desirable properties of the wrapped policy.
491+
488492
Please note that whitelist and blacklist policies are not recommended for
489493
general, day-to-day use. You probably want something like
490494
:class:`.DCAwareRoundRobinPolicy`, which prefers a local DC but has
@@ -546,10 +550,15 @@ def populate(self, cluster, hosts):
546550
def make_query_plan(self, working_keyspace=None, query=None):
547551
"""
548552
Defers to the child policy's
549-
:meth:`.LoadBalancingPolicy.make_query_plan`. Since host changes (up,
550-
down, addition, and removal) have not been propagated to the child
551-
policy, the child policy will only ever return policies for which
552-
:meth:`.predicate(host)` was truthy when that change occurred.
553+
:meth:`.LoadBalancingPolicy.make_query_plan` and filters the results.
554+
555+
Note that this filtering may break desirable properties of the wrapped
556+
policy in some cases. For instance, imagine if you configure this
557+
policy to filter out ``host2``, and to wrap a round-robin policy that
558+
rotates through three hosts in the order ``host1, host2, host3``,
559+
``host2, host3, host1``, ``host3, host1, host2``, repeating. This
560+
policy will yield ``host1, host3``, ``host3, host1``, ``host3, host1``,
561+
disproportionately favoring ``host3``.
553562
"""
554563
child_qp = self._child_policy.make_query_plan(
555564
working_keyspace=working_keyspace, query=query

docs/api/cassandra/policies.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Load Balancing
2626

2727
.. autoclass:: HostFilterPolicy
2828

29-
# we document these methods manually so we can specify a param to predicate
29+
.. we document these methods manually so we can specify a param to predicate
3030
3131
.. automethod:: predicate(host)
3232
.. automethod:: distance

0 commit comments

Comments
 (0)