You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PYCBC-1594: Replica reads from preferred server group
Motivation
==========
Operations do not currently take into account server groups. For
reading from replica servers we need to provide a way for users to
be able to read from specific groups, which can correspond to
availablity zones. Doing so helps users to reduce costs of sending
requests across availability zones.
Changes
=======
* Add a preferred_server_group option to ClusterOptions and propagate it to the C++ core
* Add a read_preference option in replica read operations and propagate it to the C++ core
Results
=======
All tests pass
Change-Id: Ib98a92d9cf141e4e6dbbbdeb9e43d17aa5811d6e
Reviewed-on: https://review.couchbase.org/c/couchbase-python-client/+/221585
Reviewed-by: Jared Casey <jared.casey@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>
@@ -362,6 +363,7 @@ class ClusterOptions(ClusterOptionsBase):
362
363
dns_nameserver (str, optional): **VOLATILE** This API is subject to change at any time. Set to configure custom DNS nameserver. Defaults to None.
363
364
dns_port (int, optional): **VOLATILE** This API is subject to change at any time. Set to configure custom DNS port. Defaults to None.
364
365
dump_configuration (bool, optional): Set to True to dump every new configuration when TRACE level logging. Defaults to False (disabled).
366
+
preferred_server_group (str, optional): Specifies the preferred server group to be used for replica reads with 'selected server group' read preference.
365
367
"""# noqa: E501
366
368
367
369
defapply_profile(self,
@@ -507,6 +509,8 @@ class GetAllReplicasOptions(GetAllReplicasOptionsBase):
507
509
key-value operation timeout.
508
510
transcoder (:class:`~.transcoder.Transcoder`, optional): Specifies an explicit transcoder
509
511
to use for this specific operation. Defaults to :class:`~.transcoder.JsonTranscoder`.
512
+
read_preference(:class:`~couchbase.replica_reads.ReadPreference`, optional): Specifies how the replica nodes
513
+
will be selected. Defaults to no preference.
510
514
"""
511
515
512
516
@@ -552,6 +556,8 @@ class GetAnyReplicaOptions(GetAnyReplicaOptionsBase):
552
556
key-value operation timeout.
553
557
transcoder (:class:`~.transcoder.Transcoder`, optional): Specifies an explicit transcoder
554
558
to use for this specific operation. Defaults to :class:`~.transcoder.JsonTranscoder`.
559
+
read_preference(:class:`~couchbase.replica_reads.ReadPreference`, optional): Specifies how the replica nodes
560
+
will be selected. Defaults to no preference.
555
561
"""
556
562
557
563
@@ -706,6 +712,8 @@ class LookupInAnyReplicaOptions(LookupInAnyReplicaOptionsBase):
706
712
Args:
707
713
timeout (timedelta, optional): The timeout for this operation. Defaults to global
708
714
subdocument operation timeout.
715
+
read_preference(:class:`~couchbase.replica_reads.ReadPreference`, optional): Specifies how the replica nodes
716
+
will be selected. Defaults to no preference.
709
717
"""
710
718
711
719
@@ -719,6 +727,8 @@ class LookupInAllReplicasOptions(LookupInAllReplicasOptionsBase):
719
727
Args:
720
728
timeout (timedelta, optional): The timeout for this operation. Defaults to global
721
729
subdocument operation timeout.
730
+
read_preference(:class:`~couchbase.replica_reads.ReadPreference`, optional): Specifies how the replica nodes
731
+
will be selected. Defaults to no preference.
722
732
"""
723
733
724
734
@@ -834,6 +844,8 @@ class GetAllReplicasMultiOptions(dict):
834
844
key-value operation timeout.
835
845
transcoder (:class:`~couchbase.transcoder.Transcoder`, optional): Specifies an explicit transcoder
836
846
to use for this specific operation. Defaults to :class:`~.transcoder.JsonTranscoder`.
847
+
read_preference(:class:`~couchbase.replica_reads.ReadPreference`, optional): Specifies how the replica nodes
0 commit comments