You can specify the user-level session variable proxy_route_policy to make ODP first read data from a follower. This setting takes effect only in weak consistency read mode. When the setting is in effect, data is first read from a follower instead of a replica selected by the load balancer.
Log in to the business tenant from a supported client tool. Execute the following statement to set the proxy_route_policy variable:
obclient> SET @proxy_route_policy='[policy]';
Valid values of the [policy] parameter are as follows:
follower_first: ODP reads data first from a follower, even if the cluster is undergoing major compaction. The priority order is as follows:Follower not undergoing major compaction in the same IDC --> Follower not undergoing major compaction in a different IDC in the same city --> Follower undergoing major compaction in the same IDC --> Follower undergoing major compaction in a different IDC in the same city --> Leader not undergoing major compaction in the same IDC --> Leader not undergoing major compaction in a different IDC in the same city --> Follower not undergoing major compaction in a different city --> Follower undergoing major compaction in a different city --> Leader not undergoing major compaction in a different city --> Leader undergoing major compaction in a different city
unmerge_follower_first: ODP reads data first from a follower that is not undergoing major compaction. The priority order is as follows:Follower not undergoing major compaction in the same IDC --> Follower not undergoing major compaction in a different IDC in the same city --> Leader not undergoing major compaction in the same IDC --> Leader not undergoing major compaction in a different IDC in the same city --> Follower undergoing major compaction in the same IDC --> Follower undergoing major compaction in a different IDC in the same city --> Follower not undergoing major compaction in a different city --> Leader not undergoing major compaction in a different city --> Follower undergoing major compaction in a different city --> Leader undergoing major compaction in a different city
Other values: The normal load-balanced routing logic in weak consistency read mode is adopted. The priority order is as follows:
Leader or follower not undergoing major compaction in the same IDC --> Leader or follower not undergoing major compaction in a different IDC in the same city --> Leader or follower undergoing major compaction in the same IDC --> Leader or follower undergoing major compaction in a different IDC in the same city --> Leader or follower not undergoing major compaction in a different city --> Leader or follower undergoing major compaction in a different city